马宇豪
2023-07-13 01f3e49f3763a25ef67a4c3e5786491703a1aece
src/views/newSpecialWorkSystem/workTicket/zysq/index.vue
@@ -1,29 +1,29 @@
<template>
   <div class="home-container">
      <el-tabs type="border-card" @tab-change="switchTab" v-model="activeName" @tab-click="handleClick">
      <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
         <el-tab-pane label="动火作业" name="fire">
            <fire-form ref="fire" :workerList = allWorkers :deviceList = allDevices :departList=departmentList :departList2=departmentList2></fire-form>
            <fire-form ref="fire" :workerList = allWorkers :deviceList = allDevices :departList=departmentList :departList2=departmentList2 :otherWorks="otherWorks"></fire-form>
         </el-tab-pane>
         <el-tab-pane label="受限空间作业" name="space">
            <space-form ref="space" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices></space-form>
            <space-form ref="space" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks"></space-form>
         </el-tab-pane>
         <el-tab-pane label="吊装作业" name="hoist">
            <hoist-form ref="hoist" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices></hoist-form>
            <hoist-form ref="hoist" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks"></hoist-form>
         </el-tab-pane>
         <el-tab-pane label="动土作业" name="ground">
            <ground-form ref="ground" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices></ground-form>
            <ground-form ref="ground" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks"></ground-form>
         </el-tab-pane>
         <el-tab-pane label="断路作业" name="broken">
            <broken-form ref="broken" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices></broken-form>
            <broken-form ref="broken" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks"></broken-form>
         </el-tab-pane>
         <el-tab-pane label="高处作业" name="height">
            <height-form ref="height" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices></height-form>
            <height-form ref="height" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks"></height-form>
         </el-tab-pane>
         <el-tab-pane label="临时用电作业" name="power">
            <power-form ref="power" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices></power-form>
            <power-form ref="power" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks"></power-form>
         </el-tab-pane>
         <el-tab-pane label="盲板抽堵作业" name="plate">
            <plate-form ref="plate" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices></plate-form>
            <plate-form ref="plate" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks"></plate-form>
         </el-tab-pane>
      </el-tabs>
<!--    <material-dialog ref="material"></material-dialog>-->
@@ -47,6 +47,7 @@
      allWorkers: Array<any>
      departmentList: Array<any>
    departmentList2: Array<any>
    otherWorks: Array<any>
    allDevices: Array<any>
   }
   export default defineComponent({
@@ -69,6 +70,7 @@
            allWorkers: [],
            departmentList: [],
        departmentList2:[],
        otherWorks: [],
        allDevices: []
         });
      const fire = ref()
@@ -90,6 +92,15 @@
        if(tab.index == 6){power.value.getBasicData()}
        if(tab.index == 7){plate.value.getBasicData()}
      }
      // 页面载入时执行方法
      onMounted(() => {
        getAll();
        getAllDepartment();
        getAllDevice();
        getOtherWork()
      });
         // 获取用户列表
         const getAll = async ()=>{
            const res = await workApplyApi().getAllUsers()
@@ -117,6 +128,19 @@
            }
         };
      // 获取相关作业列表
      const getOtherWork = async () => {
        let res = await workApplyApi().getOtherWork({workPermitNo: '',workType: null});
        if (res.data.code === '200') {
          state.otherWorks = JSON.parse(JSON.stringify(res.data.data))
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      };
      // 获取设备列表
      const getAllDevice = async ()=>{
        const res = await workApplyApi().getAllDevices()
@@ -130,25 +154,6 @@
        }
      };
      const switchTab = (name)=>{
        // if(name == 'fire'){fire.value.getBasicData()}
        // if(name == 'space'){space.value.getBasicData()}
        // if(name == 'hoist'){hoist.value.getBasicData()}
        // if(name == 'ground'){ground.value.getBasicData()}
        // if(name == 'broken'){broken.value.getBasicData()}
        // if(name == 'height'){height.value.getBasicData()}
        // if(name == 'power'){power.value.getBasicData()}
        // if(name == 'plate'){plate.value.getBasicData()}
      }
         // 页面载入时执行方法
         onMounted(() => {
            getAll();
            getAllDepartment();
        getAllDevice();
         });
         return {
            ...toRefs(state),
        fire,
@@ -159,8 +164,8 @@
        hoist,
        plate,
        power,
        switchTab,
        handleClick
        handleClick,
        getOtherWork
         };
      },
   });