马宇豪
2024-03-25 9673c181dd7b3882cbde386422ffb9a2b1949693
src/views/newSpecialWorkSystem/workTicket/wdsq/index.vue
@@ -98,8 +98,8 @@
                                        <span v-if="scope.row.status == -1">已废止</span>
                                        <el-button v-if="scope.row.status == 0 || scope.row.status == 1" link type="danger" size="small" :icon="Delete" @click="abortRecordBtn(scope.row)">作废</el-button>
                                        <el-button v-if="scope.row.status !== -1" link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button>
<!--                                        <el-button link type="success" size="small" :icon="Finished">修改</el-button>-->
                                        <el-button v-if="scope.row.status == 1" link type="success" size="small" :icon="Download" @click="checkTicket(scope.row)">正式办票</el-button>
                                        <el-button link type="primary" size="small" v-throttle :icon="Edit" @click="openEdit(scope.row)">修改</el-button>
                                        <el-button link type="success" v-throttle v-if="scope.row.status == 0 || scope.row.status == 1" size="small" :icon="Download" @click="checkTicket(scope.row)">正式办票</el-button>
<!--                                        <el-button :disabled="scope.row.status == 7 ? false : true" link type="primary" size="small" :icon="Download" @click="downLoadBtn(scope.row)">导出作业票</el-button>-->
                                    </template>
                                </el-table-column>
@@ -122,13 +122,19 @@
                  <detail-log :type=dialogType :statusList=statusList :details = details></detail-log>
                    <template #footer>
                      <span class="dialog-footer">
                        <el-button type="primary" @click="dialogDetails = false"
                        >确认</el-button
                        >
                        <el-button type="primary" @click="dialogDetails = false">确认</el-button>
                      </span>
                    </template>
                </el-dialog>
                <report-log ref="reportDialogRef" @refresh="getListByPage"></report-log>
                <fire-dialog ref="fireRef" :lists="lists" @refresh="getListByPage"></fire-dialog>
                <plate-dialog ref="plateRef" :lists="lists" @refresh="getListByPage"></plate-dialog>
                <space-dialog ref="spaceRef" :lists="lists" @refresh="getListByPage"></space-dialog>
                <hoist-dialog ref="hoistRef" :lists="lists" @refresh="getListByPage"></hoist-dialog>
                <ground-dialog ref="groundRef" :lists="lists" @refresh="getListByPage"></ground-dialog>
                <broken-dialog ref="brokenRef" :lists="lists" @refresh="getListByPage"></broken-dialog>
                <height-dialog ref="heightRef" :lists="lists" @refresh="getListByPage"></height-dialog>
      <power-dialog ref="powerRef" :lists="lists" @refresh="getListByPage"></power-dialog>
    </div>
</template>
@@ -175,6 +181,7 @@
    searPara: {}
    timeRange: Array<string>;
    dep4List: Array<type>;
    lists: {}
}
interface type {
    id: number;
@@ -188,13 +195,29 @@
    name: 'myApply',
    components: {
      detailLog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/detailLog.vue')),
      reportLog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/jsaReportDialog.vue'))
      reportLog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/jsaReportDialog.vue')),
      fireDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/fireDialog.vue')),
      plateDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/plateDialog.vue')),
      spaceDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/spaceDialog.vue')),
      hoistDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/hoistDialog.vue')),
      groundDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/groundDialog.vue')),
      brokenDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/brokenDialog.vue')),
      heightDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/heightDialog.vue')),
      powerDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/powerDialog.vue'))
    },
    setup() {
        const userInfo = useUserInfo();
        const { userInfos } = storeToRefs(userInfo);
        const router = useRouter();
        const reportDialogRef = ref();
        const fireRef = ref()
        const plateRef = ref()
        const spaceRef = ref()
        const hoistRef = ref()
        const groundRef = ref()
        const brokenRef = ref()
        const heightRef = ref()
        const powerRef = ref()
        const state = reactive<stateType>({
            pageIndex1: 1,
            pageSize1: 10,
@@ -237,6 +260,15 @@
                { id: 7, name: '临时用电作业' },
                { id: 8, name: '盲板抽堵作业' }
            ],
          lists: {
            workerList: [],
            departList: [],
            departList2: [],
            deviceList: [],
            otherWorks: [],
            spList: [],
            riskList: []
          },
          dep4List: [
            {id:49,name:'电石事业部'},
            {id:50,name:'电力事业部'},
@@ -290,6 +322,121 @@
            }
          ]
        });
      // 页面载入时执行方法
      onMounted(() => {
        getListByPage();
        getAllDepartment()
        spWorker()
        getAll()
        getAllDevice()
        getAllRisks()
        getOtherWork()
      });
        const openEdit = (row)=>{
          if(row.workType == 1){
            fireRef.value.openDialog(row)
          }
          if(row.workType == 2){
            spaceRef.value.openDialog(row)
          }
          if(row.workType == 3){
            hoistRef.value.openDialog(row)
          }
          if(row.workType == 4){
            groundRef.value.openDialog(row)
          }
          if(row.workType == 5){
            brokenRef.value.openDialog(row)
          }
          if(row.workType == 6){
            heightRef.value.openDialog(row)
          }
          if(row.workType == 7){
            powerRef.value.openDialog(row)
          }
          if(row.workType == 8){
            plateRef.value.openDialog(row)
          }
        }
      const spWorker = async ()=>{
        for(let id of ['17','18','19']){
          const res = await workApplyApi().getSpList({roleId: id})
          if(id == '17'){
            if (res.data.code === '200') {
              state.lists.spList.opList = JSON.parse(JSON.stringify(res.data.data))
            } else {
              ElMessage({
                type: 'warning',
                message: res.data.msg
              });
            }
          }
          if(id == '18'){
            if (res.data.code === '200') {
              state.lists.spList.jhList = JSON.parse(JSON.stringify(res.data.data))
            } else {
              ElMessage({
                type: 'warning',
                message: res.data.msg
              });
            }
          }
          if(id == '19'){
            if (res.data.code === '200') {
              state.lists.spList.sfList = JSON.parse(JSON.stringify(res.data.data))
            } else {
              ElMessage({
                type: 'warning',
                message: res.data.msg
              });
            }
          }
        }
      }
      // 获取用户列表
      const getAll = async ()=>{
        const res = await workApplyApi().getAllUsers()
        if (res.data.code === '200') {
          state.lists.workerList = JSON.parse(JSON.stringify(res.data.data))
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      };
      // 获取设备列表
      const getAllDevice = async ()=>{
        const res = await workApplyApi().getAllDevices()
        if (res.data.code === '200') {
          state.lists.deviceList = JSON.parse(JSON.stringify(res.data.data))
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      }
      // 获取设备列表
      const getAllRisks = async ()=>{
        const res = await workApplyApi().getAllRiskIdentity()
        if (res.data.code === '200') {
          // state.allDevices = JSON.parse(JSON.stringify(res.data.data))
          state.lists.riskList = JSON.parse(JSON.stringify(res.data.data))
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      }
        const giveTime = () => {
          if (state.timeRange && state.timeRange !== null) {
            state.searPara.startTime = state.timeRange[0];
@@ -321,12 +468,25 @@
            if (res.data.code === '200') {
                state.departmentList = JSON.parse(JSON.stringify(res.data.data))
                recursion(state.departmentList);
                state.lists.departList = JSON.parse(JSON.stringify(res.data.data))
                state.lists.departList2 = JSON.parse(JSON.stringify(res.data.data))[0].children[0].children.filter(i=>i.depId == 32 || i.depId == 48 || i.depId == 49 || i.depId == 50)
            } else {
                ElMessage({
                    type: 'warning',
                    message: res.data.msg
                });
            }
        };
        const getOtherWork = async () => {
          let res = await workApplyApi().getOtherWork({workPermitNo: '',workType: null});
          if (res.data.code === '200') {
            state.lists.otherWorks = JSON.parse(JSON.stringify(res.data.data))
          } else {
            ElMessage({
              type: 'warning',
              message: res.data.msg
            });
          }
        };
        const recursion = (value: any) => {
@@ -537,12 +697,6 @@
            await initBackEndControlRoutes();
        };
        // 页面载入时执行方法
        onMounted(() => {
            getListByPage();
            getAllDepartment()
        });
        return {
            View,
            Edit,
@@ -552,6 +706,16 @@
            Finished,
            Download,
          reportDialogRef,
          fireRef,
          plateRef,
          spaceRef,
          hoistRef,
          groundRef,
          brokenRef,
          heightRef,
          powerRef,
          openEdit,
          getAllDepartment,
          checkTicket,
            giveTime,
            reLoadData,