马宇豪
2023-08-16 a8ef7c1a4b2ab6acd91a0520e6258bd753d17f20
src/views/specialWorkSystem/workTicket/zysq/components/plate.vue
@@ -74,6 +74,20 @@
               </el-form-item>
            </el-col>
         </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="关联视频设备" prop="cameraIds">
              <el-select v-model="form.cameraIds" multiple>
                <el-option
                    v-for="item in deviceList"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
            <el-divider border-style="dashed"/>
         <el-row>
            <el-col :span="12">
@@ -176,7 +190,7 @@
                           v-for="item in otherWorkList"
                           :key="item.value"
                           :label="item.label"
                           :value="item.value"
                           :value="item.label"
                     />
                  </el-select>
               </el-form-item>
@@ -185,7 +199,7 @@
         <el-row>
            <el-col :span="24">
               <el-form-item label="盲板位置图" prop="workDetail.bpLocationMapPath">
                  <el-upload accept="image/*" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='imgLimit' v-model:file-list="fileList" :http-request="upload" :action="uploadUrl" list-type="picture-card" :on-remove="handleRemove" :before-remove="beforeRemove" :before-upload="getUploadUrl">
                  <el-upload accept="image/*" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='imgLimit' v-model:file-list="fileList" :http-request="upload" :action="uploadUrl" list-type="picture-card" :before-remove="beforeRemove" :before-upload="getUploadUrl">
                     <el-icon><Plus /></el-icon>
                     <template #tip>
                        <div class="el-upload__tip">上传jpg/png图片尺寸小于500KB,最多可上传3张</div>
@@ -215,7 +229,7 @@
</template>
<script lang="ts">
   import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue';
import {toRefs, reactive, defineComponent, ref, defineAsyncComponent} from 'vue';
   import { storeToRefs } from 'pinia';
   import { initBackEndControlRoutes } from '/@/router/backEnd';
   import {useUserInfo} from "/@/stores/userInfo";
@@ -247,8 +261,8 @@
      components: {
      materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')),
    },
      props:['workerList'],
      setup() {
      props:['workerList','deviceList'],
      setup(props: any, context: any) {
         const userInfo = useUserInfo()
         const { userInfos } = storeToRefs(userInfo);
         const state  = reactive<stateType>({
@@ -259,8 +273,9 @@
               workLevel: null,
               workContent: '',
               workLocation: '',
          maId: null,
          maBaseId: null,
               hazardIdentification: '',
          cameraIds: [],
               workDetail:{
                  bpCode: '',
                  mainMedia: '',
@@ -275,7 +290,7 @@
                  uninstallBpTime: '',
                  otherSpecialWork: []
               },
               wmAddReqDTOList: [],
               receiveUids: [],
               workTimeLine: [],
               expStartTime: '',
               expEndTime: ''
@@ -366,6 +381,7 @@
            workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
        cameraIds: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            "workDetail.bpCode": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
            "workDetail.mainMedia": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
@@ -384,28 +400,24 @@
         //    }
         // }
      const openMaList = ()=>{
        if(state.form.workLevel == null){
        if(state.form.workLevel == null || 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) => {
            if (!formEl) return
@@ -437,8 +449,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)
               }