From a8ef7c1a4b2ab6acd91a0520e6258bd753d17f20 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期三, 16 八月 2023 15:58:20 +0800 Subject: [PATCH] 人员证书类型 --- src/views/specialWorkSystem/workTicket/zysq/components/ground.vue | 242 +++++++++++++----------------------------------- 1 files changed, 65 insertions(+), 177 deletions(-) diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue b/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue index fa98456..6838d8e 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue @@ -61,6 +61,18 @@ /> </el-form-item> </el-col> + <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> @@ -102,7 +114,7 @@ <el-col :span="12"> <el-form-item label="关联作业" prop="workDetail.otherSpecialWork"> <el-select v-model="form.workDetail.otherSpecialWork" multiple> - <el-option v-for="item in otherWorkList" :key="item.value" :label="item.label" :value="item.value" /> + <el-option v-for="item in otherWorkList" :key="item.value" :label="item.label" :value="item.label" /> </el-select> </el-form-item> </el-col> @@ -110,7 +122,7 @@ <el-row> <el-col :span="24"> <el-form-item label="图片上传" prop="workDetail.gbPath"> - <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> @@ -122,40 +134,13 @@ <el-row> <el-col :span="12"> <el-form-item label="选择关联物资"> - <el-button type="primary" @click="getMaList">选择物资标准</el-button> + <el-button type="primary" @click="openMaList">选择物资标准</el-button> </el-form-item> </el-col> </el-row> </div> </el-form> - <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> - <el-tabs tab-position="left" class="demo-tabs" type="border-card"> - <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> - <div style="margin-bottom: 20px"> - <el-form label-width="150px" label-position="top"> - <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> - <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> - <el-input size="default" type="number" v-model="item.mustList[x].value" @change="(val)=>toZero(val,index,'mustList',x)" placeholder="请输入配置数量,空值默认为0"> - <template #append>{{'库存:' + item.mustList[x].stock}}</template> - </el-input> - </el-form-item> - <div v-if="item.unList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">其他</div> - <el-form-item v-if="item.unList.length>0" class="tab-i" v-for="(i,x) in item.unList" :key="x" :label="item.unList[x].materialName + ':'"> - <el-input size="default" type="number" v-model="item.unList[x].value" @change="(val)=>toZero(val,index,'unList',x)" placeholder="请输入配置数量,空值默认为0"> - <template #append>{{'库存:' + item.unList[x].stock}}</template> - </el-input> - </el-form-item> - </el-form> - </div> - </el-tab-pane> - </el-tabs> - <template #footer> - <span class="dialog-footer"> - <el-button @click="equipmentDialog = false" size="default">取消</el-button> - <el-button type="primary" @click="conFirmDevices" size="default">确认</el-button> - </span> - </template> - </el-dialog> + <material-dialog ref="material" @conFirmMaterials="conFirmMaterials"></material-dialog> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -178,7 +163,6 @@ import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; import axios from 'axios'; - interface stateType { equipmentDialog: boolean, form: Object, @@ -190,16 +174,17 @@ dialogImageUrl: string | null, imgLimit: number, casProps: {}, - isOverSize: Boolean, - materialList: Array<any> + isOverSize: Boolean } interface file { url: string; } export default { name: 'groundForm', - components: {}, - props:['workerList','departList'], + components: { + materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')), + }, + props:['workerList','departList', 'deviceList'], setup(props: any, context: any) { const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); @@ -212,6 +197,8 @@ workContent: '', workLocation: '', hazardIdentification: '', + cameraIds: [], + maBaseId: null, workDetail:{ operationDepId: null, gbScope: '', @@ -219,14 +206,13 @@ gbPath: [], otherSpecialWork: [] }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, isOverSize: false, fileList: [], - materialList: [], imgLimit: 3, uploadUrl: '', dialogVisible: false, @@ -300,6 +286,7 @@ checkStrictly: true } }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -307,57 +294,51 @@ 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.operationDepId": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], "workDetail.gbScope": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], "workDetail.gbMethod": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], "workDetail.gbPath": [{ required: true, message: '该内容不能为空', trigger: 'blur' }] }); - const toZero = (value: string | number,index: number,name: string,x:number) =>{ - if(!value){ - state.materialList[index][name][x].value = 0 - } - } + // const toZero = (value: string | number,index: number,name: string,x:number) =>{ + // if(!value){ + // state.materialList[index][name][x].value = 0 + // } + // } + + const openMaList = ()=>{ + if(state.form.operatorUids == []){ + ElMessage({ + type: 'warning', + message: '请先选择作业人再获取相应物资配置' + }); + }else{ + 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 = (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 await formEl.validate(async (valid, fields) => { if (valid) { - for(let i in state.materialList){ - for(let j in state.materialList[i].mustList){ - if(state.materialList[i].mustList[j].value>state.materialList[i].mustList[j].stock){ - ElMessage({ - type: 'warning', - message: '部分物资库存不足,请重新配置数量。' - }); - return - } - } - for(let j in state.materialList[i].unList){ - if(state.materialList[i].unList[j].value>state.materialList[i].unList[j].stock){ - ElMessage({ - type: 'warning', - message: '部分物资库存不足,请重新配置数量。' - }); - return - } - } - state.materialList[i].mustList = state.materialList[i].mustList.map((item:any)=>{ - const obj = { - defaultVal: item.value, - id: item.id - } - return {...obj} - }) - state.materialList[i].unList = state.materialList[i].unList.map((item:any)=>{ - const obj = { - defaultVal: item.value, - id: item.id - } - return {...obj} - }) - state.materialList[i].postList = [...state.materialList[i].mustList,...state.materialList[i].unList] - state.form.wmAddReqDTOList = [...state.form.wmAddReqDTOList,...state.materialList[i].postList] - } + // if (state.form.wmAddReqDTOList == null || state.form.wmAddReqDTOList.length == 0){ + // ElMessage({ + // type: 'warning', + // message: '请确认关联物资的配置' + // }); + // return + // } state.form.expStartTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[0] state.form.expEndTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[1] let { workTimeLine, ...data } = JSON.parse(JSON.stringify(state.form)) @@ -378,7 +359,8 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } @@ -495,99 +477,6 @@ // console.log('2111111111111') // }; - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 4,workLevel: null} - const res = await workApplyApi().getMaterial(data) - if (res.data.code === '200') { - if(res.data.data.materialTypeList && res.data.data.materialTypeList!=null&&res.data.data.materialTypeList.length>0){ - state.materialList = JSON.parse(JSON.stringify(res.data.data.materialTypeList)) - for(let i in state.materialList){ - state.materialList[i].mustList = [] - state.materialList[i].unList = [] - state.materialList[i].mdList = state.materialList[i].mdList?.map((item:any) => { - if(item.configurationLevel == 0){ - state.materialList[i].mustList.push(item) - return - }else{ - state.materialList[i].unList.push(item) - return - } - }) - state.materialList[i].mustList = state.materialList[i].mustList.map((item:any)=>{ - const obj = { - value: item.defaultVal, - materialName: item.materialName, - configurationLevel: item.configurationLevel, - id: item.id, - stock: item.stock - } - return {...obj} - }) - state.materialList[i].unList = state.materialList[i].unList.map((item:any)=>{ - const obj = { - value: item.defaultVal, - materialName: item.materialName, - configurationLevel: item.configurationLevel, - id: item.id, - stock: item.stock - } - return {...obj} - }) - } - state.equipmentDialog = true - }else{ - ElMessage({ - type: 'warning', - message: '暂时查询不到物资标准信息' - }); - } - } else { - ElMessage({ - type: 'warning', - message: res.data.msg - }); - } - }else{ - state.materialList = state.materialList - state.equipmentDialog = true - } - } - const conFirmDevices = ()=>{ - for(let i in state.materialList){ - for(let j in state.materialList[i].mustList){ - if(state.materialList[i].mustList[j].value>state.materialList[i].mustList[j].stock){ - ElMessage({ - type: 'warning', - message: '部分物资库存不足,请重新配置数量。' - }); - return - } - } - for(let j in state.materialList[i].unList){ - if(state.materialList[i].unList[j].value>state.materialList[i].unList[j].stock){ - ElMessage({ - type: 'warning', - message: '部分物资库存不足,请重新配置数量。' - }); - return - } - } - - } - ElMessageBox.confirm('是否确认物资及数量配置?') - .then(() => { - state.equipmentDialog = false - }) - .catch(() => { - // catch error - }) - } - - const closeMaterial = ()=>{ - - } // 折线图 const renderMenu = async (value: string) => { Session.set('projectId',value) @@ -600,10 +489,9 @@ Plus, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + openMaList, + conFirmMaterials, handlePreview, getUploadUrl, beforeRemove, -- Gitblit v1.9.2