马宇豪
2022-12-20 6ca4914a18d1b1561e537674292cf9374791de7c
src/views/specialWorkSystem/workTicket/zysq/components/power.vue
@@ -124,10 +124,8 @@
   import type { FormInstance, FormRules } from 'element-plus'
   import { workApplyApi } from '/@/api/specialWorkSystem/workApply';
   interface stateType {
      form: Object,
      workLevelList: Array<any>,
      equipmentDialog: boolean
   }
   export default defineComponent({
@@ -136,7 +134,7 @@
      materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')),
    },
      props:['workerList'],
      setup() {
      setup(props: any, context: any) {
         const userInfo = useUserInfo()
         const { userInfos } = storeToRefs(userInfo);
         const state  = reactive<stateType>({
@@ -147,39 +145,24 @@
               workLevel: 0,
               workContent: '',
               workLocation: '',
          maId: null,
          maBaseId: null,
               hazardIdentification: '',
               workDetail:{
                  powerAccessPoint: '',
                  workingVoltage: null,
                  equipmentAndPower: ''
               },
               wmAddReqDTOList: [],
          receiveUids: [],
               workTimeLine: [],
               expStartTime: '',
               expEndTime: ''
            },
            workLevelList: [
               {
                  label: "一级吊装作业",
                  value: 8
               },
               {
                  label: "二级吊装作业",
                  value: 9
               },
               {
                  label: "三级吊装作业",
                  value: 10
               }
            ]
         });
      const material = ref()
         const ruleFormRef = ref<FormInstance>()
         const applyRules = reactive<FormRules>({
            operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
@@ -196,28 +179,24 @@
         // }
      const openMaList = ()=>{
        if(state.form.workLevel == null){
        if(state.form.operatorUids == []){
          ElMessage({
            type: 'warning',
            message: '请先选择作业等级再获取相应物资配置'
            message: '请先选择作业人再获取相应物资配置'
          });
        }else{
          material.value.equipmentDialog = true
          if(material.value.receiveUids.length==0){
            material.value.receiveUids = state.form.operatorUids
          }
          material.value.getMaList(state.form.workType,state.form.workLevel)
          material.value.workerList = props.workerList
        }
      }
      const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{
        state.form.maId = null
        state.form.wmAddReqDTOList = []
        if(addList.length > 0){
          for(let i in addList){
            if(addList[i].depId != null && addList[i].useCount != null){
              state.form.wmAddReqDTOList.push(addList[i])
            }
          }
        }
        // state.form.wmAddReqDTOList = addList
        state.form.maId = chosenId
      const conFirmMaterials = (receiveUids: Array<number>,chosenId: number) =>{
        state.form.maBaseId = null
        state.form.receiveUids = []
        state.form.receiveUids = receiveUids
        state.form.maBaseId = chosenId
      }
         const submitForm = async (formEl: FormInstance | undefined) => {
@@ -241,8 +220,8 @@
                        message: res.data.msg
                     });
                  }
            state.form.maId = null
            state.form.wmAddReqDTOList = []
            material.value.maBaseId = null
            material.value.receiveUids = []
               } else {
                  console.log('error submit!', fields)
               }