13937891274
2022-08-05 c12e39694dae65cf10460b3eccfb2e4005559173
src/views/contingencyManagement/panManagement/index.vue
@@ -84,19 +84,24 @@
                <VideoPlay />
              </el-icon>启动
            </el-button>
            <el-button size="small" text type="primary" @click="abolish(0)">
            <el-button size="small" text type="primary" @click="abolish(scope.row.id)">
              <el-icon style="margin-right: 5px;">
                <VideoPause />
              </el-icon>废止
            </el-button>
            <el-button size="small" text type="primary" @click="jumpFrom(0)">
            <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="abolish(0)">
             发起审批
            </el-button>
<!--            <el-button size="small" text type="primary" @click="jumpFrom(0)">-->
<!--              <el-icon style="margin-right: 5px;">-->
<!--                <EditPen />-->
<!--              </el-icon>修改-->
<!--            </el-button>-->
<!--            <el-button  size="small" text type="primary" @click="abolish(0)">-->
<!--             发起审批-->
<!--            </el-button>-->
            <el-button size="small" text type="primary" @click="onRowDel(scope.row.id)">
              <el-icon>
                <Delete />
@@ -154,7 +159,7 @@
  ElMessageBox,
  ElMessage,
} from 'element-plus';
import {useRouter} from "vue-router"
// import {useRouter} from "vue-router"
import type {
  // FormInstance,
} from 'element-plus'
@@ -202,6 +207,7 @@
      searchParams: {
        name: "",
        type: "",
        abolishStatus: false,
      }
    })
    // 定义表格数据
@@ -230,26 +236,7 @@
    };
    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.toString();
      console.log(deleteAll.value);
      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()
@@ -290,18 +277,10 @@
          remark: '',
        }
    }
    // 新增后刷新
    // const startUp = (e: boolean) => {
    //   if (e) {
    //     onSubmit();
    //   } else {
    //     onSubmit();
    //   }
    // };
    // 打开新增用户弹窗
    const addRef = ref();
    const onOpenAdd = () => {
      addRef.value.openDialog('新建应急预案管理');
      addRef.value.openDialog('新建应急预案管理',false);
    };
    // 新增后刷新
    const onMyAdd = (e: boolean) => {
@@ -311,20 +290,60 @@
        onSubmit();
      }
    };
    // 打开修改应急预案管理弹窗
    const onEdit = (val: string, row: object) => {
      if (val == '详情') {
        addRef.value.openDialog('查看应急预案管理',row,true);
      } else {
        addRef.value.openDialog('修改应急预案管理',row,false);
      }
    };
    //打开废止库弹窗
    const abolishRef = ref();
    const onabolishLibrary = () => {
      abolishRef.value.openDialog();
    };
    // 废止
    const abolish = (data: any) => {
      ElMessageBox.confirm('确定要废止所选项吗?', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        emergencyPlanApi()
            .EmergencyTeam(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 onRowDel = (data: any) => {
    const onRowDel = (id: number) => {
      let arr = [];
      arr.push(id)
      ElMessageBox.confirm('确定删除所选项吗?', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        emergencyPlanApi()
              .deleteEmergencyTeam(data)
              .deleteEmergencyTeam(arr)
              .then((res) => {
                if (res.data.code == 200) {
                  ElMessage({
@@ -344,6 +363,26 @@
              });
        }).catch(() => {});
    };
    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 onDeleteAll = () => {
      ElMessageBox.confirm('确定删除所选项吗?', '提示', {
@@ -353,24 +392,23 @@
      })
          .then(() => {
            emergencyPlanApi()
                .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();
                  }
                });
              .deleteEmergencyTeam(deleteAll.value)
              .then((res) => {
                if (res.data.code == 200) {
                  ElMessage({
                    message: res.data.msg,
                    type: 'success',
                  });
                  onSubmit();
                } else {
                  ElMessage({
                    showClose: true,
                    message: res.data.msg,
                    type: 'error',
                  });
                  onSubmit();
                }
              });
          })
          .catch(() => {});
    };
@@ -387,25 +425,25 @@
      listQuery.pageIndex = val;
    };
    const router=useRouter()
    // const router=useRouter()
    // 修改跳转
    const jumpFrom=(data:string)=>{
      router.push({
        path:"/processForm",
        query:{
          type:data
        }
      })
    }
    // const jumpFrom=(data:string)=>{
    //   router.push({
    //     path:"/processForm",
    //     query:{
    //       type:data
    //     }
    //   })
    // }
    // 发起审批跳转
    const abolish=(data:string)=>{
      router.push({
        path:"/abolishDialog",
        query:{
          type:data
        }
      })
    }
    // const abolish=(data:string)=>{
    //   router.push({
    //     path:"/abolishDialog",
    //     query:{
    //       type:data
    //     }
    //   })
    // }
    //全屏
    const full = ref(false);
    const toggleFullscreen = () => {
@@ -425,15 +463,15 @@
      tableData,
      onSubmit,
      onOpenAdd,  //新增
      onabolishLibrary,
      addRef,
      onabolishLibrary,
      abolishRef,
      abolish,
      onRowDel,
      onHandleSizeChange,
      onHandleCurrentChange,
      jumpFrom,
      abolish,
      router,
      // jumpFrom,
      // router,
      toggleFullscreen,
      FullScreen,
      full,
@@ -455,6 +493,7 @@
      form,
      emit,
      onDetermine,
      onEdit,
    };
  },
});