Your Name
2022-08-25 0d661774046de0f6c62f2bab113730d7663bd3d5
解决bug
已修改2个文件
694 ■■■■ 文件已修改
.env.development 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/contingencyManagement/contingency/index.vue 690 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -27,7 +27,9 @@
#VITE_API_URL_OUT = 'http://192.168.0.52:8011/safeplatform-out'
#本地外包预发接口地址
VITE_API_URL_OUT = 'http://192.168.0.52:7021/safeplatform-out'
#VITE_API_URL_OUT = 'http://192.168.0.52:7021/safeplatform-out'
#VITE_API_URL = 'http://192.168.0.52:7021/safeplatform'
src/views/contingencyManagement/contingency/index.vue
@@ -1,401 +1,361 @@
<template>
  <div class="system-user-container">
    <el-card shadow="hover">
      <div class="system-user-search mb15">
        <el-form :inline="true" class="demo-form-inline">
          <el-form-item>
            <el-input size="default" v-model="listQuery.searchParams.teamName" placeholder="队伍名称"> </el-input>
          </el-form-item>
          <el-form-item>
            <el-select size="default" v-model="listQuery.searchParams.teamLevel" placeholder="请选择队伍级别">
              <el-option label="公司" value="1"></el-option>
              <el-option label="分厂-车间" value="2"></el-option>
              <el-option label="工序-班组等" value="3"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
             <el-button size="default" type="primary" class="ml10" @click="onSubmit">
               查询
             </el-button>
             <el-button size="default" class="ml10"  @click="submitReset">
               重置
             </el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="button_Line">
        <div class="button_Left">
          <el-button size="default" type="primary"  @click="onOpenAdd">
            <el-icon>
              <Plus />
            </el-icon>新建
          </el-button>
          <el-button size="default" type="warning" plain :disabled="warning" @click="onEdit('修改', deleteAll[0])">
            <el-icon>
              <Edit />
            </el-icon>修改
          </el-button>
          <el-button size="default" type="danger" plain :disabled="danger" @click="onDeleteAll">
            <el-icon>
              <Delete />
            </el-icon>删除
          </el-button>
        </div>
<!--        <div class="button_Right">-->
<!--          <el-button size="default" @click="upButton">-->
<!--            <el-icon>-->
<!--              <Upload />-->
<!--            </el-icon>-->
<!--          </el-button>-->
<!--          <el-button size="default">-->
<!--            <el-icon>-->
<!--              <Download />-->
<!--            </el-icon>-->
<!--          </el-button>-->
<!--          <el-button size="default">-->
<!--            <el-icon>-->
<!--              <Refresh />-->
<!--            </el-icon>-->
<!--          </el-button>-->
<!--        </div>-->
      </div>
      <el-table
          :data="tableData"
          style="width: 100%"
          ref="multipleTableRef"
          @selection-change="handleSelectionChange"
      >
        <el-table-column
            type="selection"
            width="55"
        />
        <el-table-column prop="teamName" label="队伍名称" show-overflow-tooltip sortable></el-table-column>
        <el-table-column prop="teamLevel" label="队伍级别" show-overflow-tooltip sortable>
          <template #default="scope">
            <span v-if="scope.row.teamLevel == 1">公司</span>
            <span v-if="scope.row.teamLevel == 2">分厂-车间</span>
            <span v-if="scope.row.teamLevel == 3">工序-班组等</span>
          </template>
        </el-table-column>
        <el-table-column prop="teamDesc" label="队伍描述" show-overflow-tooltip sortable></el-table-column>
        <el-table-column prop="principalPhone" label="负责人手机" show-overflow-tooltip sortable></el-table-column>
        <el-table-column prop="fileList" label="相关附件" show-overflow-tooltip sortable>
        </el-table-column>
        <el-table-column label="操作" width="200" align="center" fixed="right">
          <template #default="scope">
            <el-button size="small" text type="primary" @click="onEdit('详情',scope.row.id)">
              <el-icon style="margin-right: 5px;">
                <View />
              </el-icon>查看
            </el-button>
            <el-button size="small" text type="primary" @click="onEdit('修改',scope.row.id)">
              <el-icon style="margin-right: 5px;">
                <EditPen />
              </el-icon>修改
            </el-button>
            <el-button size="small" text type="primary" @click="onRowDel(scope.row.id)">
              <el-icon>
                <Delete />
              </el-icon>删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pages">
        <el-pagination
            v-if="tableData.length == 0 ? false : true"
            @size-change="onHandleSizeChange"
            @current-change="onHandleCurrentChange"
            class="mt15"
            :pager-count="5"
            :page-sizes="[10, 20, 30]"
            v-model:currentPage="pageIndex"
            background
            v-model:page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
        >
        </el-pagination>
      </div>
    </el-card>
    <OpenAdd ref="addRef"  @myAdd="onMyAdd" />
    <upData ref="upShow"></upData>
  </div>
    <div class="system-user-container">
        <el-card shadow="hover">
            <div class="system-user-search mb15">
                <el-form :inline="true" class="demo-form-inline">
                    <el-form-item>
                        <el-input size="default" v-model="listQuery.searchParams.teamName" placeholder="队伍名称"> </el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-select size="default" v-model="listQuery.searchParams.teamLevel" placeholder="请选择队伍级别">
                            <el-option label="公司" value="1"></el-option>
                            <el-option label="分厂-车间" value="2"></el-option>
                            <el-option label="工序-班组等" value="3"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button size="default" type="primary" class="ml10" @click="onSubmit"> 查询 </el-button>
                        <el-button size="default" class="ml10" @click="submitReset"> 重置 </el-button>
                    </el-form-item>
                </el-form>
            </div>
            <div class="button_Line">
                <div class="button_Left">
                    <el-button size="default" type="primary" @click="onOpenAdd">
                        <el-icon> <Plus /> </el-icon>新建
                    </el-button>
                    <el-button size="default" type="warning" plain :disabled="warning" @click="onEdit('修改', deleteAll[0])">
                        <el-icon> <Edit /> </el-icon>修改
                    </el-button>
                    <el-button size="default" type="danger" plain :disabled="danger" @click="onDeleteAll">
                        <el-icon> <Delete /> </el-icon>删除
                    </el-button>
                </div>
                <!--        <div class="button_Right">-->
                <!--          <el-button size="default" @click="upButton">-->
                <!--            <el-icon>-->
                <!--              <Upload />-->
                <!--            </el-icon>-->
                <!--          </el-button>-->
                <!--          <el-button size="default">-->
                <!--            <el-icon>-->
                <!--              <Download />-->
                <!--            </el-icon>-->
                <!--          </el-button>-->
                <!--          <el-button size="default">-->
                <!--            <el-icon>-->
                <!--              <Refresh />-->
                <!--            </el-icon>-->
                <!--          </el-button>-->
                <!--        </div>-->
            </div>
            <el-table :data="tableData" style="width: 100%" ref="multipleTableRef" @selection-change="handleSelectionChange">
                <el-table-column type="selection" width="55" />
                <el-table-column prop="teamName" label="队伍名称" show-overflow-tooltip sortable></el-table-column>
                <el-table-column prop="teamLevel" label="队伍级别" show-overflow-tooltip sortable>
                    <template #default="scope">
                        <span v-if="scope.row.teamLevel == 1">公司</span>
                        <span v-if="scope.row.teamLevel == 2">分厂-车间</span>
                        <span v-if="scope.row.teamLevel == 3">工序-班组等</span>
                    </template>
                </el-table-column>
                <el-table-column prop="teamDesc" label="队伍描述" show-overflow-tooltip sortable></el-table-column>
                <el-table-column prop="principalPhone" label="负责人手机" show-overflow-tooltip sortable></el-table-column>
                <el-table-column prop="fileList" label="相关附件" show-overflow-tooltip sortable> </el-table-column>
                <el-table-column label="操作" width="200" align="center" fixed="right">
                    <template #default="scope">
                        <el-button size="small" text type="primary" @click="onEdit('详情', scope.row.id)">
                            <el-icon style="margin-right: 5px"> <View /> </el-icon>查看
                        </el-button>
                        <el-button size="small" text type="primary" @click="onEdit('修改', scope.row.id)">
                            <el-icon style="margin-right: 5px"> <EditPen /> </el-icon>修改
                        </el-button>
                        <el-button size="small" text type="primary" @click="onRowDel(scope.row.id)">
                            <el-icon> <Delete /> </el-icon>删除
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pages">
                <el-pagination v-if="tableData.length == 0 ? false : true" @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:currentPage="pageIndex" background v-model:page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
            </div>
        </el-card>
        <OpenAdd ref="addRef" @myAdd="onMyAdd" />
        <upData ref="upShow"></upData>
    </div>
</template>
<script lang="ts">
import {
  // toRefs,
  reactive,
  onMounted,
  ref,
  defineComponent
    // toRefs,
    reactive,
    onMounted,
    ref,
    defineComponent
} from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import {
  ElMessageBox,
  ElMessage,
} from 'element-plus';
import {
  Plus,
  Delete,
  // Upload,
  // Download,
  // Refresh,
  Edit,
  View,
  EditPen,
} from '@element-plus/icons-vue'
import OpenAdd from '../../contingencyManagement/contingency/component/openAdd.vue'
import UpData from '../../contingencyManagement/contingency/component/upData.vue';
import {contingencyApi} from "../../../api/contingencyManagement/contingency";
export default defineComponent({
  name: 'systemUser',
  components: {
    OpenAdd,
    View,
    Edit,
    EditPen,
    Plus,
    Delete,
    // Upload,
    // Download,
    // Refresh,
    UpData,
    contingencyApi
  },
  setup() {
    // 列表参数
    const listQuery = reactive({
      pageIndex: 1,
      pageSize: 10,
      searchParams: {
        teamName: "",
        teamLevel: "",
      }
    })
    // 定义表格数据
    const tableData = ref([]);
    // 列表数据请求
    const onSubmit = async () => {
      let res = await contingencyApi().getTeamManagementList(listQuery)
      if(res.data.code === '200'){
        tableData.value = res.data.data;
        for(var a = 0;a<tableData.value.length;a++){
          if(tableData.value[a].fileList!=null&&tableData.value[a].fileList!=''&&tableData.value[a].fileList.length!=0){
            tableData.value[a].fileList = tableData.value[a].fileList[0].fileName
          }
        }
        pageIndex.value = res.data.pageIndex;
        pageSize.value = res.data.pageSize;
        total.value = res.data.total;
      }else{
        ElMessage({
          showClose: true,
          type:'error',
          message:res.data.msg
        })
      }
    }
    // 重置
    const submitReset = () => {
      listQuery.searchParams.teamName = '';
      listQuery.searchParams.teamLevel = '';
      onSubmit();
    };
    const warning = ref(true);
    const danger = ref(true);
    const deleteAll = ref();
    const handleSelectionChange = (val: any) => {
      let valId = JSON.parse(JSON.stringify(val));
      let arr = [];
      for (let i = 0; i < valId.length; i++) {
        arr.push(valId[i].id);
      }
      deleteAll.value = arr;
      if (val.length == 1) {
        warning.value = false;
        danger.value = false;
      } else if (val.length == 0) {
        warning.value = true;
        danger.value = true;
      } else {
        warning.value = true;
        danger.value = false;
      }
    };
    Edit,
    View,
    EditPen
} from '@element-plus/icons-vue';
    // 上传
    // const upShow=ref()
    // const upButton=()=>{
    //   upShow.value.openDialog()
    // }
    // 打开新增应急队伍弹窗
    const addRef = ref();
    const onOpenAdd = () => {
      addRef.value.openDialog('新建应急队伍管理');
    };
    // 新增后刷新
    const onMyAdd = (e: boolean) => {
      if (e) {
        onSubmit();
      } else {
        onSubmit();
      }
    };
    // 打开修改应急队伍弹窗
    const onEdit = (val: string, row: object) => {
      if (val == '详情') {
        addRef.value.openDialog('查看应急队伍管理',row,true);
      } else {
        addRef.value.openDialog('修改应急队伍管理',row,false);
      }
    };
    // 删除用户
    const onRowDel = (data: any) => {
      ElMessageBox.confirm('确定删除所选项吗?', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        contingencyApi()
          .deleteEmergencyTeam([data])
          .then((res) => {
            if (res.data.code == 200) {
              ElMessage({
                showClose: true,
                message: res.data.msg,
                type: 'success',
              });
              onSubmit();
            } else {
              ElMessage({
                showClose: true,
                message: res.data.msg,
                type: 'error',
              });
              onSubmit();
import OpenAdd from '../../contingencyManagement/contingency/component/openAdd.vue';
import UpData from '../../contingencyManagement/contingency/component/upData.vue';
import { contingencyApi } from '../../../api/contingencyManagement/contingency';
export default defineComponent({
    name: 'systemUser',
    components: {
        OpenAdd,
        View,
        Edit,
        EditPen,
        Plus,
        Delete,
        // Upload,
        // Download,
        // Refresh,
        UpData,
        contingencyApi
    },
    setup() {
        // 列表参数
        const listQuery = reactive({
            pageIndex: 1,
            pageSize: 10,
            searchParams: {
                teamName: '',
                teamLevel: ''
            }
          });
      }).catch(() => {});
    };
    // 多选删除
    const onDeleteAll = () => {
      ElMessageBox.confirm('确定删除所选项吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
          .then(() => {
            contingencyApi()
                .deleteEmergencyTeam(deleteAll.value)
                .then((res) => {
                  if (res.data.code == 200) {
                    ElMessage({
                      showClose: true,
                      message: res.data.msg,
                      type: 'success',
                    });
                    onSubmit();
                  } else {
                    ElMessage({
                      showClose: true,
                      message: res.data.msg,
                      type: 'error',
                    });
                    onSubmit();
                  }
        });
        // 定义表格数据
        const tableData = ref([]);
        // 列表数据请求
        const onSubmit = async () => {
            let res = await contingencyApi().getTeamManagementList(listQuery);
            if (res.data.code === '200') {
                tableData.value = JSON.parse(JSON.stringify(res.data.data));
                for (var a = 0; a < tableData.value.length; a++) {
                    if (tableData.value[a].fileList != null && tableData.value[a].fileList != '' && tableData.value[a].fileList.length != 0) {
                        tableData.value[a].fileList = tableData.value[a].fileList[0].fileName;
                    }
                }
                pageIndex.value = res.data.pageIndex;
                pageSize.value = res.data.pageSize;
                total.value = res.data.total;
            } else {
                ElMessage({
                    showClose: true,
                    type: 'error',
                    message: res.data.msg
                });
          })
          .catch(() => {});
    };
    // 分页
    const pageIndex = ref();
    const pageSize = ref();
    const total = ref();
    // 分页改变
    const onHandleSizeChange = (val: number) => {
      listQuery.pageSize = val;
      onSubmit();
    };
    const onHandleCurrentChange = (val: number) => {
      listQuery.pageIndex = val;
      onSubmit();
    };
    // 页面加载时
    onMounted(() => {
      onSubmit();
    });
    return {
      listQuery,
      onSubmit,
      // upButton,
      // upShow,
      onOpenAdd,  //新增
      addRef,
      pageIndex,
      pageSize,
      total,
      onEdit,
      handleSelectionChange,
      submitReset,
      onRowDel,
      onMyAdd,
      tableData,
      onDeleteAll,
      onHandleSizeChange,
      onHandleCurrentChange,
      deleteAll,
      warning,
      danger,
    };
  },
            }
        };
        // 重置
        const submitReset = () => {
            listQuery.searchParams.teamName = '';
            listQuery.searchParams.teamLevel = '';
            onSubmit();
        };
        const warning = ref(true);
        const danger = ref(true);
        const deleteAll = ref();
        const handleSelectionChange = (val: any) => {
            let valId = JSON.parse(JSON.stringify(val));
            let arr = [];
            for (let i = 0; i < valId.length; i++) {
                arr.push(valId[i].id);
            }
            deleteAll.value = arr;
            if (val.length == 1) {
                warning.value = false;
                danger.value = false;
            } else if (val.length == 0) {
                warning.value = true;
                danger.value = true;
            } else {
                warning.value = true;
                danger.value = false;
            }
        };
        // 上传
        // const upShow=ref()
        // const upButton=()=>{
        //   upShow.value.openDialog()
        // }
        // 打开新增应急队伍弹窗
        const addRef = ref();
        const onOpenAdd = () => {
            addRef.value.openDialog('新建应急队伍管理');
        };
        // 新增后刷新
        const onMyAdd = (e: boolean) => {
            if (e) {
                onSubmit();
            } else {
                onSubmit();
            }
        };
        // 打开修改应急队伍弹窗
        const onEdit = (val: string, row: object) => {
            if (val == '详情') {
                addRef.value.openDialog('查看应急队伍管理', row, true);
            } else {
                addRef.value.openDialog('修改应急队伍管理', row, false);
            }
        };
        // 删除用户
        const onRowDel = (data: any) => {
            ElMessageBox.confirm('确定删除所选项吗?', '提示', {
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    contingencyApi()
                        .deleteEmergencyTeam([data])
                        .then((res) => {
                            if (res.data.code == 200) {
                                ElMessage({
                                    showClose: true,
                                    message: res.data.msg,
                                    type: 'success'
                                });
                                onSubmit();
                            } else {
                                ElMessage({
                                    showClose: true,
                                    message: res.data.msg,
                                    type: 'error'
                                });
                                onSubmit();
                            }
                        });
                })
                .catch(() => {});
        };
        // 多选删除
        const onDeleteAll = () => {
            ElMessageBox.confirm('确定删除所选项吗?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    contingencyApi()
                        .deleteEmergencyTeam(deleteAll.value)
                        .then((res) => {
                            if (res.data.code == 200) {
                                ElMessage({
                                    showClose: true,
                                    message: res.data.msg,
                                    type: 'success'
                                });
                                onSubmit();
                            } else {
                                ElMessage({
                                    showClose: true,
                                    message: res.data.msg,
                                    type: 'error'
                                });
                                onSubmit();
                            }
                        });
                })
                .catch(() => {});
        };
        // 分页
        const pageIndex = ref();
        const pageSize = ref();
        const total = ref();
        // 分页改变
        const onHandleSizeChange = (val: number) => {
            listQuery.pageSize = val;
            onSubmit();
        };
        const onHandleCurrentChange = (val: number) => {
            listQuery.pageIndex = val;
            onSubmit();
        };
        // 页面加载时
        onMounted(() => {
            onSubmit();
        });
        return {
            listQuery,
            onSubmit,
            // upButton,
            // upShow,
            onOpenAdd, //新增
            addRef,
            pageIndex,
            pageSize,
            total,
            onEdit,
            handleSelectionChange,
            submitReset,
            onRowDel,
            onMyAdd,
            tableData,
            onDeleteAll,
            onHandleSizeChange,
            onHandleCurrentChange,
            deleteAll,
            warning,
            danger
        };
    }
});
</script>
<style scoped lang="scss">
.table_Box{
  padding: 20px;
  background-color: #fff;
.table_Box {
    padding: 20px;
    background-color: #fff;
}
.tableForm{
  margin-top: 10px;
.tableForm {
    margin-top: 10px;
}
/*按钮行*/
  .button_Line{
.button_Line {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin-bottom: 10px;
  }
//分页
.pages{
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
}
.el-form .el-form-item{
  margin-bottom: 0px!important;
//分页
.pages {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}
.el-form .el-form-item {
    margin-bottom: 0px !important;
}
//弹窗底部边框线
::v-deep .el-dialog__footer{
  border-top: 1px solid #e8e8e8;
  border-radius: 0 0 4px 4px;
::v-deep .el-dialog__footer {
    border-top: 1px solid #e8e8e8;
    border-radius: 0 0 4px 4px;
}
//弹窗顶部边框线
::v-deep .el-dialog__header {
  border-bottom: 1px solid #e8e8e8;
  margin-right: 0;
  border-radius: 4px 4px 0 0;
    border-bottom: 1px solid #e8e8e8;
    margin-right: 0;
    border-radius: 4px 4px 0 0;
}
//表头
::v-deep .el-table th.el-table__cell {
  background-color: #f6f7fa;
  font-weight: 400;
  color: #909399;
    background-color: #f6f7fa;
    font-weight: 400;
    color: #909399;
}
.el-table .sort-caret.ascending{
  border-bottom-color: #c0c4cc;
.el-table .sort-caret.ascending {
    border-bottom-color: #c0c4cc;
}
</style>
</style>