From 50d33c74675a9d9eee957a685d9e55b77974f6f9 Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期五, 06 一月 2023 16:44:06 +0800 Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/gtqt --- src/views/specialWorkSystem/workTicket/wdsq/components/spaceLog.vue | 21 src/views/specialWorkSystem/workTicket/wdsqjl/index.vue | 19 src/views/specialWorkSystem/workTicket/zysq/components/broken.vue | 228 +---- src/views/specialWorkSystem/workTicket/zysq/components/height.vue | 216 ---- src/views/specialWorkSystem/workTicket/zysq/components/space.vue | 218 +---- src/api/specialWorkSystem/material/index.ts | 2 src/views/specialWorkSystem/workTicket/wdsq/components/hoistLog.vue | 21 src/views/specialWorkSystem/foundationSet/goods/index.vue | 129 +-- src/views/newHome/index.vue | 30 src/views/specialWorkSystem/workTicket/wdsq/index.vue | 5 src/views/specialWorkSystem/workTicket/zysq/components/ground.vue | 222 +---- src/views/specialWorkSystem/workTicket/wdsq/components/fireLog.vue | 13 src/views/specialWorkSystem/workTicket/wdsq/components/heightLog.vue | 21 src/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue | 293 ++++++ src/views/specialWorkSystem/workTicket/wdsq/components/powerLog.vue | 21 src/api/specialWorkSystem/workApply/index.ts | 9 src/views/specialWorkSystem/workTicket/wdsq/components/brokenLog.vue | 21 src/views/specialWorkSystem/workTicket/zysq/components/plate.vue | 218 ---- src/views/specialWorkSystem/workTicket/zysq/components/hoist.vue | 219 ---- src/views/specialWorkSystem/process/zyjcgl/index.vue | 26 src/views/specialWorkSystem/workTicket/zysq/components/fire.vue | 230 +---- src/views/specialWorkSystem/workTicket/wdsq/components/plateLog.vue | 21 src/views/specialWorkSystem/workTicket/zysq/components/power.vue | 235 +---- src/views/specialWorkSystem/workTicket/wdsq/components/groundLog.vue | 21 src/views/specialWorkSystem/workTicket/zysq/index.vue | 50 25 files changed, 878 insertions(+), 1,631 deletions(-) diff --git a/src/api/specialWorkSystem/material/index.ts b/src/api/specialWorkSystem/material/index.ts index 74452ab..5133881 100644 --- a/src/api/specialWorkSystem/material/index.ts +++ b/src/api/specialWorkSystem/material/index.ts @@ -15,7 +15,7 @@ //物资列表 getRecordList: () => { return request({ - url: import.meta.env.VITE_API_URL + `/specialWork/material/emegency/materials`, + url: import.meta.env.VITE_API_URL + `/specialWork/material/equipment/materialClassify`, method: 'post' }); }, diff --git a/src/api/specialWorkSystem/workApply/index.ts b/src/api/specialWorkSystem/workApply/index.ts index 1286cbe..6258f0e 100644 --- a/src/api/specialWorkSystem/workApply/index.ts +++ b/src/api/specialWorkSystem/workApply/index.ts @@ -176,6 +176,15 @@ method: 'post', data: data }); + }, + + // 根据物资配置id和领取人获取领取情况 + getMaterialDetail: (data: object) => { + return request({ + url: import.meta.env.VITE_API_URL + `/specialWork/material/receive`, + method: 'post', + data: data + }); } }; } diff --git a/src/views/newHome/index.vue b/src/views/newHome/index.vue index f93269a..8450675 100644 --- a/src/views/newHome/index.vue +++ b/src/views/newHome/index.vue @@ -452,7 +452,7 @@ transform: translateY(0); } } -@media screen and (min-width: 1400px) { +@media screen and (min-width: 1600px) { .gridCont { width: 100%; height: 100%; @@ -520,7 +520,7 @@ } .itemTit1 { - font-size: 34px; + font-size: 32px; line-height: 42px; height: 40%; letter-spacing: 1px; @@ -528,7 +528,7 @@ margin-bottom: 12px; } .enTit1 { - font-size: 20px; + font-size: 18px; line-height: 24px; color: #072270; } @@ -548,7 +548,7 @@ } } -@media screen and (min-width: 1200px) and (max-width: 1400px) { +@media screen and (min-width: 1200px) and (max-width: 1600px) { .gridCont { width: 100%; height: 100%; @@ -570,14 +570,14 @@ z-index: 99; .itemTit { - font-size: 26px; + font-size: 22px; line-height: 30px; height: 40%; color: #072270; margin-bottom: 2px; } .enTit { - font-size: 14px; + font-size: 12px; color: #072270; } @@ -616,7 +616,7 @@ } .itemTit1 { - font-size: 28px; + font-size: 24px; line-height: 36px; height: 40%; letter-spacing: 1px; @@ -624,7 +624,7 @@ margin-bottom: 12px; } .enTit1 { - font-size: 16px; + font-size: 14px; color: #072270; } } @@ -663,12 +663,12 @@ z-index: 99; .itemTit { - font-size: 18px; + font-size: 14px; line-height: 22px; color: #072270; } .enTit { - font-size: 12px; + font-size: 10px; line-height: 14px; color: #072270; } @@ -708,7 +708,7 @@ } .itemTit1 { - font-size: 24px; + font-size: 16px; line-height: 36px; height: 40%; letter-spacing: 1px; @@ -716,7 +716,7 @@ margin-bottom: 12px; } .enTit1 { - font-size: 14px; + font-size: 12px; color: #072270; } } @@ -822,7 +822,7 @@ position: absolute; left: -100px; top: 0; - width: 240px; + width: 220px; height: 100%; z-index: 99; background: url('../../assets/newMenu/leftbg.png') no-repeat center; @@ -901,12 +901,12 @@ } } .menuGrid { - width: calc(100vw - 240px); + width: calc(100vw - 220px); height: calc(100vh - 320px); padding: 20px 20px 0; position: absolute; top: 260px; - left: 240px; + left: 220px; .gridCont { .grid-content { border-radius: 16px; diff --git a/src/views/specialWorkSystem/foundationSet/goods/index.vue b/src/views/specialWorkSystem/foundationSet/goods/index.vue index 558de0c..ee1493b 100644 --- a/src/views/specialWorkSystem/foundationSet/goods/index.vue +++ b/src/views/specialWorkSystem/foundationSet/goods/index.vue @@ -93,7 +93,7 @@ <el-table-column property="workLevel" label="关联作业等级" align="center" :formatter="toLevel" :show-overflow-tooltip="true"/> <el-table-column property="createUname" label="创建人" align="center"/> <el-table-column property="gmtCreate" label="创建时间" align="center"/> - <el-table-column property="gmtModified" label="更新时间" align="center"/> +<!-- <el-table-column property="gmtModified" label="更新时间" align="center"/>--> <el-table-column fixed="right" label="操作" align="center" width="250"> <template #default="scope"> <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button> @@ -121,33 +121,11 @@ </el-form-item> <el-form-item label="作业物资汇总"> <div class="materials"> - <div class="maList"> - <div>必选</div> + <div class="maList" v-for="item in details.clList"> + <div>{{item.configurationLevelName}}</div> <div> - <div v-if="mustList.length>0" v-for="(i,index) in mustList" :key="index"> - {{i.materialName}}:默认值:{{i.defaultVal}},{{i.consumables?'耗材':'非耗材'}} - </div> - <div v-else> - 无 - </div> - </div> - </div> - <div class="maList"> - <div>可选</div> - <div> - <div v-if="chooseList.length>0" v-for="(i,index) in chooseList" :key="index"> - {{i.materialName}}:默认值:{{i.defaultVal}},{{i.consumables?'耗材':'非耗材'}} - </div> - <div v-else> - 无 - </div> - </div> - </div> - <div class="maList"> - <div>高配</div> - <div> - <div v-if="highList.length>0" v-for="(i,index) in highList" :key="index"> - {{i.materialName}}:默认值:{{i.defaultVal}},{{i.consumables?'耗材':'非耗材'}} + <div v-if="item.mdList.length>0" v-for="i in item.mdList"> + {{i.materialName}}({{i.bigClassifyName }}):标准值:{{i.standVal }} </div> <div v-else> 无 @@ -165,9 +143,9 @@ <el-form-item label="创建时间"> <el-input v-model="details.gmtCreate" readonly /> </el-form-item> - <el-form-item label="更新时间"> - <el-input v-model="details.gmtModified" readonly /> - </el-form-item> +<!-- <el-form-item label="更新时间">--> +<!-- <el-input v-model="details.gmtModified" readonly />--> +<!-- </el-form-item>--> <el-form-item> <el-button type="primary" @click="dialogDetails = false" size="default">确认</el-button> </el-form-item> @@ -225,26 +203,22 @@ </el-form-item> <el-form-item label="物资标准配置"> <el-tabs tab-position="left" class="demo-tabs" type="border-card"> - <el-tab-pane v-for="(item,index) in allList" :label="item.materialTypeName" :key="index"> - <div class="tab-i" v-for="(i,x) in item.list" :key="x" v-if="item.list && item.list.length>0"> - <el-checkbox :label="i.materialName" v-model="checkData[index].list[x].checked"> - </el-checkbox> - <el-form v-if="checkData[index].list[x].checked" :model="checkData[index].list[x]" label-width="100px" ref="addListRef" :rules="addListRules"> - <el-form-item label="配置级别" prop="configurationLevel"> - <el-select v-model="checkData[index].list[x].configurationLevel"> - <el-option key="0" label="必选" value="0"/> - <el-option key="1" label="可选" value="1"/> - <el-option key="2" label="高配" value="2"/> - </el-select> - </el-form-item> - <el-form-item v-if="checkData[index].list[x].configurationLevel==0" label="默认值" prop="defaultVal"><el-input v-model="checkData[index].list[x].defaultVal"/></el-form-item> - <el-form-item label="是否耗材" prop="consumables"> - <el-radio-group v-model="checkData[index].list[x].consumables"> - <el-radio :label=true>是</el-radio> - <el-radio :label=false>否</el-radio> - </el-radio-group> - </el-form-item> - </el-form> + <el-tab-pane v-for="(item,index) in allList" :label="item.materialClassifyName" :key="index"> + <div class="tab-i" v-if="item.childList && item.childList.length>0"> + <div v-for="(i,x) in item.childList" :key="x"> + <el-checkbox :label="i.materialClassifyName" v-model="checkData[index].childList[x].checked"> + </el-checkbox> + <el-form v-if="checkData[index].childList[x].checked" :model="checkData[index].childList[x]" label-width="100px" ref="addListRef" :rules="addListRules"> + <el-form-item label="配置级别" prop="configurationLevel"> + <el-select v-model="checkData[index].childList[x].configurationLevel"> + <el-option key="0" label="必选" :value="0"/> + <el-option key="1" label="可选" :value="1"/> + <el-option key="2" label="高配" :value="2"/> + </el-select> + </el-form-item> + <el-form-item label="标准值" prop="standVal"><el-input type="number" v-model.number="checkData[index].childList[x].standVal"/></el-form-item> + </el-form> + </div> </div> <div v-else>暂无物资配置数据</div> </el-tab-pane> @@ -537,9 +511,8 @@ workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }] }); const addListRules = reactive<FormRules>({ - defaultVal: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], - configurationLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], - consumables: [{ required: true, message: '该内容不能为空', trigger: 'blur' }] + standVal: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], + configurationLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }] }); // 页面载入时执行方法 @@ -572,16 +545,13 @@ if (res.data.code === '200') { state.allList = JSON.parse(JSON.stringify(res.data.data)) for(let i in state.allList){ - state.allList[i].list = state.allList[i].list?.map((item:any) => { + state.allList[i].childList = state.allList[i].childList?.map((item:any) => { const obj = { checked: false, - materialName: item.name, - consumables: null, - defaultVal: 0, + materialClassifyName: item.materialClassifyName, + standVal: 0, configurationLevel: null, - materialType: item.materialType, - materialTypeName: item.materialTypeName, - emergencyMaterialId: item.id + smallClassifyId: item.id } return {...obj} }) @@ -676,7 +646,6 @@ const editRecordBtn = async (index, row) => { getList() state.addRecord = JSON.parse(JSON.stringify(row)); - console.log(state.addRecord,'state.addRecord') state.dialogAddRecord = true; state.chosenIndex = index; }; @@ -704,12 +673,12 @@ if (valid) { state.addRecord.materialDetailList = [] for(let i in state.checkData){ - if(state.checkData[i].list && state.checkData[i].list.length>0){ - for(let j=0;j<state.checkData[i].list.length;j++){ - if(state.checkData[i].list[j].checked){ + if(state.checkData[i].childList && state.checkData[i].childList.length>0){ + for(let j=0;j<state.checkData[i].childList.length;j++){ + if(state.checkData[i].childList[j].checked){ // delete state.checkData[i].list[j].checked // state.checkData[i].list[j].checked - let { checked,...checkObj } = state.checkData[i].list[j] + let { checked,materialClassifyName,...checkObj } = state.checkData[i].childList[j] state.addRecord.materialDetailList.push(checkObj) } } @@ -722,14 +691,20 @@ info: state.addRecord.info, materialDetailList: state.addRecord.materialDetailList }; - console.log(data.materialDetailList,'data.materialDetailList') - if(data.materialDetailList.length==0 || data.materialDetailList.some((e) => e.configurationLevel == null) || data.materialDetailList.some((e) => e.consumables == null)){ + if(data.materialDetailList.length==0 || data.materialDetailList.some((e) => e.configurationLevel == null)){ ElMessage({ type: 'warning', message: '请选择物资配置并完善必填数据' }); return } + if(data.materialDetailList.some((e) => e.configurationLevel == 0 && e.standVal <= 0)){ + ElMessage({ + type: 'warning', + message: '必选物资标准值须大于0' + }); + return + } if (state.chosenIndex == null) { await addRecord(data); } else { @@ -818,26 +793,6 @@ state.details = JSON.parse(JSON.stringify(row)); state.details.workType = toType(state.details) state.details.workLevel = toLevel(state.details) - if(state.details.materialTypeList && state.details.materialTypeList.length>0){ - const allList = JSON.parse(JSON.stringify(state.details.materialTypeList)) - for(let i = 0;i < allList.length; i++){ - if(allList[i].mdList && allList[i].mdList.length>0){ - allList[i].mdList.map((item)=>{ - if(item.configurationLevel == 0){ - state.mustList.push(item) - return - }else if(item.configurationLevel == 1){ - state.chooseList.push(item) - return - }else{ - state.highList.push(item) - return - } - }) - } - - } - } state.dialogDetails = true; }; diff --git a/src/views/specialWorkSystem/process/zyjcgl/index.vue b/src/views/specialWorkSystem/process/zyjcgl/index.vue index fda4558..7398d60 100644 --- a/src/views/specialWorkSystem/process/zyjcgl/index.vue +++ b/src/views/specialWorkSystem/process/zyjcgl/index.vue @@ -38,19 +38,24 @@ height="calc(100% - 100px)" :header-cell-style="{background: '#fafafa'}" > - <el-table-column type="index" label="序号" width="80"/> - <el-table-column property="workPermitNo" label="作业证编号"/> - <el-table-column property="workTypeDesc" label="作业类型"/> - <el-table-column property="checkContent" label="检查内容"/> - <el-table-column property="checkResultDesc" label="检查结果"> + <el-table-column type="index" label="序号" width="80" align="center"/> + <el-table-column property="workPermitNo" label="作业证编号" align="center"/> + <el-table-column property="workTypeDesc" label="作业类型" align="center"/> + <el-table-column property="checkContent" label="检查内容" align="center"/> + <el-table-column property="checkResultDesc" label="检查结果" align="center"> <template #default="scope"> <span :class="scope.row.checkResultDesc == '异常' ? 'red': ''">{{ scope.row.checkResultDesc}}</span> </template> </el-table-column> - <el-table-column property="info" label="描述" show-overflow-tooltip width="200"/> - <el-table-column property="operatorUname" label="分析人"/> - <el-table-column property="operationTime" label="分析时间" width="180"/> - <el-table-column fixed="right" label="操作" align="center" width="250"> + <el-table-column property="info" label="描述" show-overflow-tooltip width="200" align="center"/> + <el-table-column property="operatorUname" label="分析人" align="center"/> + <el-table-column property="operationTime" label="分析时间" width="180" align="center"/> + <el-table-column property="mcResultName" label="物资检查" width="180" align="center"> + <template #default="scope"> + <span :class="scope.row.mcResultName == '不合格' ? 'red': ''">{{ scope.row.mcResultName== null?'-':scope.row.mcResultName}}</span> + </template> + </el-table-column> + <el-table-column fixed="right" label="操作" align="center" width="100"> <template #default="scope"> <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button> </template> @@ -98,6 +103,9 @@ <el-form-item label="分析时间"> <el-input v-model="details.operationTime" readonly/> </el-form-item> + <el-form-item label="物资检查"> + <span>{{details.mcResultName== null?'-':details.mcResultName}}</span> + </el-form-item> </el-form> <template #footer> <span class="dialog-footer"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/brokenLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/brokenLog.vue index 70b06f9..b32213d 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/brokenLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/brokenLog.vue @@ -40,16 +40,19 @@ <el-form-item label="图片"> <el-image v-for="item in details.workDetail.bcPath" :preview-src-list="details.workDetail.bcPath" style="width: 150px; height: 150px;margin-right: 50px;margin-bottom: 20px" :src="item" fit="cover" /> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> - <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> - <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} - </template> - </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> + <el-table-column prop="materialName" label="物资名称" align="center"/> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> + <template #default="scope"> + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} + </template> + </el-table-column> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="期望开始时间"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/fireLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/fireLog.vue index feb4040..6386a7e 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/fireLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/fireLog.vue @@ -28,16 +28,19 @@ <el-form-item label="作业方式"> <el-input v-model="details.workDetail.hotMethod" readonly type="textarea" /> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial&&details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} </template> </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="关联其他作业"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/groundLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/groundLog.vue index 5e1f2c7..ed728d7 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/groundLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/groundLog.vue @@ -34,16 +34,19 @@ <el-form-item label="动土方式"> <el-input v-model="details.workDetail.gbMethod" readonly type="textarea" /> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial&&details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> - <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> - <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} - </template> - </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> + <el-table-column prop="materialName" label="物资名称" align="center"/> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> + <template #default="scope"> + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} + </template> + </el-table-column> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="关联其他作业"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/heightLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/heightLog.vue index ba57c56..f95c6e9 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/heightLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/heightLog.vue @@ -31,16 +31,19 @@ <el-form-item label="作业高度"> <el-input v-model="details.workDetail.operationHeight" readonly type="textarea"><template #append>米(m)</template></el-input> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial&&details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> - <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> - <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} - </template> - </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> + <el-table-column prop="materialName" label="物资名称" align="center"/> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> + <template #default="scope"> + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} + </template> + </el-table-column> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="关联其他作业"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/hoistLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/hoistLog.vue index fb95a14..1086537 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/hoistLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/hoistLog.vue @@ -31,16 +31,19 @@ <el-form-item label="起吊物体重量"> <el-input v-model="details.workDetail.weightMass" readonly type="textarea"><template #append>吨(t)</template></el-input> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial&&details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> - <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> - <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} - </template> - </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> + <el-table-column prop="materialName" label="物资名称" align="center"/> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> + <template #default="scope"> + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} + </template> + </el-table-column> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="关联其他作业"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/plateLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/plateLog.vue index 3cf73c9..69620a3 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/plateLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/plateLog.vue @@ -52,16 +52,19 @@ <el-form-item label="拆盲板时间"> <el-input v-model="details.workDetail.uninstallBpTime" readonly/> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial&&details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> - <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> - <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} - </template> - </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> + <el-table-column prop="materialName" label="物资名称" align="center"/> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> + <template #default="scope"> + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} + </template> + </el-table-column> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="关联其他作业"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/powerLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/powerLog.vue index c83eb3d..cf81c13 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/powerLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/powerLog.vue @@ -34,16 +34,19 @@ <el-form-item label="用电设备及功率"> <el-input v-model="details.workDetail.equipmentAndPower" readonly type="textarea" /> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial&&details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> - <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> - <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} - </template> - </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> + <el-table-column prop="materialName" label="物资名称" align="center"/> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> + <template #default="scope"> + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} + </template> + </el-table-column> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="关联其他作业"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/components/spaceLog.vue b/src/views/specialWorkSystem/workTicket/wdsq/components/spaceLog.vue index 3cc4206..d6b4606 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/components/spaceLog.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/components/spaceLog.vue @@ -34,16 +34,19 @@ <el-form-item label="空间原有介质名称"> <el-input v-model="details.workDetail.csOriginalName" readonly type="textarea" /> </el-form-item> - <el-form-item label="关联物资"> + <el-form-item label="物资状态"> + <span>{{ details.materialStatus==0?'未关联物资':(details.materialStatus==1?'必选物资配备不足':(details.materialStatus==2?'必选物资配备齐全':(details.materialStatus==3?'物资配置专业':(details.materialStatus==4?'物资配置高端':'-')))) }}</span> + </el-form-item> + <el-form-item label="关联物资" v-if="details.workMaterial&&details.workMaterial.length>0"> <el-table :data="details.workMaterial" style="width: 100%" border> - <el-table-column prop="materialTypeName" label="物资类型" align="center"/> - <el-table-column prop="materialName" label="物资名称" align="center"/> - <el-table-column prop="consumables" label="是否耗材" align="center"> - <template #default="scope"> - {{scope.row.consumables?'耗材':'非耗材'}} - </template> - </el-table-column> - <el-table-column prop="defaultVal" label="配置数量" align="center"/> + <el-table-column prop="bigClassifyName" label="物资类型" align="center"/> + <el-table-column prop="materialName" label="物资名称" align="center"/> + <el-table-column prop="configurationLevel" label="配置级别" align="center"> + <template #default="scope"> + {{scope.row.configurationLevel == 0?'必选':(scope.row.configurationLevel == 1? '可选':'高配')}} + </template> + </el-table-column> + <el-table-column prop="useCount" label="配置数量" align="center"/> </el-table> </el-form-item> <el-form-item label="关联其他作业"> diff --git a/src/views/specialWorkSystem/workTicket/wdsq/index.vue b/src/views/specialWorkSystem/workTicket/wdsq/index.vue index 91206f2..340b902 100644 --- a/src/views/specialWorkSystem/workTicket/wdsq/index.vue +++ b/src/views/specialWorkSystem/workTicket/wdsq/index.vue @@ -38,6 +38,11 @@ <el-table-column property="operators" label="作业人" /> <el-table-column property="workTypeDesc" label="作业类型" /> <el-table-column property="workLevelDesc" label="作业等级" /> + <el-table-column property="materialStatus" label="物资状态" align="center" width="180"> + <template #default="scope"> + <span>{{ scope.row.materialStatus==0?'未关联物资':(scope.row.materialStatus==1?'必选物资配备不足':(scope.row.materialStatus==2?'必选物资配备齐全':(scope.row.materialStatus==3?'物资配置专业':(scope.row.materialStatus==4?'物资配置高端':'-')))) }}</span> + </template> + </el-table-column> <el-table-column property="applyTime" label="申请时间" width="180" /> <el-table-column label="申请状态" align="center" width="180"> <template #default="scope"> diff --git a/src/views/specialWorkSystem/workTicket/wdsqjl/index.vue b/src/views/specialWorkSystem/workTicket/wdsqjl/index.vue index 2446c26..9bf63b3 100644 --- a/src/views/specialWorkSystem/workTicket/wdsqjl/index.vue +++ b/src/views/specialWorkSystem/workTicket/wdsqjl/index.vue @@ -51,13 +51,18 @@ <el-button type="primary" :icon="Refresh" size="default" @click="reLoadData()" /> </el-row> <el-table ref="multipleTableRef" :data="applyData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }"> - <el-table-column property="workPermitNo" label="作业申请单号" width="180" /> - <el-table-column property="applyUname" label="申请人" /> - <el-table-column property="depName" label="部门名称" /> - <el-table-column property="operators" label="作业人" /> - <el-table-column property="workTypeDesc" label="作业类型" /> - <el-table-column property="workLevelDesc" label="作业等级" /> - <el-table-column property="applyTime" label="申请时间" width="180" /> + <el-table-column property="workPermitNo" label="作业申请单号" width="180" align="center"/> + <el-table-column property="applyUname" label="申请人" align="center"/> + <el-table-column property="depName" label="部门名称" align="center"/> + <el-table-column property="operators" label="作业人" align="center"/> + <el-table-column property="workTypeDesc" label="作业类型" align="center"/> + <el-table-column property="workLevelDesc" label="作业等级" align="center"/> + <el-table-column property="materialStatus" label="物资状态" align="center" width="180"> + <template #default="scope"> + <span>{{ scope.row.materialStatus==0?'未关联物资':(scope.row.materialStatus==1?'必选物资配备不足':(scope.row.materialStatus==2?'必选物资配备齐全':(scope.row.materialStatus==3?'物资配置专业':(scope.row.materialStatus==4?'物资配置高端':'-')))) }}</span> + </template> + </el-table-column> + <el-table-column property="applyTime" label="申请时间" width="180" align="center"/> <el-table-column label="申请状态" align="center" width="180"> <template #default="scope"> <el-tag :type="scope.row.status==2?'success':(scope.row.status==8||scope.row.status==9)?'warning':'danger'">{{ scope.row.statusDesc }}</el-tag> diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/broken.vue b/src/views/specialWorkSystem/workTicket/zysq/components/broken.vue index 17a7dcb..da141bb 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/broken.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/broken.vue @@ -120,40 +120,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> @@ -165,7 +138,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"; @@ -177,7 +150,6 @@ import axios from 'axios'; interface stateType { - equipmentDialog: boolean, form: Object, csDepList: Array<any>, fileList: Array<file>, @@ -188,20 +160,20 @@ casProps: {}, casProps2: {}, isOverSize: boolean, - materialList: Array<any> } interface file { url: string; } export default defineComponent({ name: 'brokenForm', - components: {}, + components: { + materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')), + }, props:['workerList','departList'], - setup() { + setup(props: any, context: any) { const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ - equipmentDialog: false, form: { operatorUids: [], workType: 5, @@ -209,6 +181,7 @@ workContent: '', workLocation: '', hazardIdentification: '', + maBaseId: null, workDetail:{ operationDepId: null, bcReason: '', @@ -216,12 +189,11 @@ bcPath: [], involvedDepIds: [] }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, - materialList: [], isOverSize: false, fileList: [], imgLimit: 3, @@ -258,7 +230,8 @@ emitPath: false, value: 'depId', label: 'depName', - multiple: true + multiple: true, + expandTrigger: 'hover' }, casProps2: { emitPath: false, @@ -269,6 +242,7 @@ checkStrictly: true } }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -284,52 +258,44 @@ "workDetail.involvedDepIds": [{ 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)) @@ -350,7 +316,8 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } @@ -465,100 +432,6 @@ }); } - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 5,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) @@ -570,10 +443,9 @@ Search, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + conFirmMaterials, + openMaList, handlePreview, getUploadUrl, beforeRemove, diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/fire.vue b/src/views/specialWorkSystem/workTicket/zysq/components/fire.vue index a62a7ec..9af9738 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/fire.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/fire.vue @@ -102,40 +102,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> @@ -153,37 +126,36 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; - - interface stateType { form: Object, workLevelList: Array<any>, otherWorkList: Array<any>, - equipmentDialog: boolean, - materialList: Array<any> + equipmentDialog: boolean } export default defineComponent({ name: 'fireForm', - components: {}, + components: { + 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>({ equipmentDialog: false, - materialList: [], form: { operatorUids: [], workType: 1, workLevel: null, workContent: '', workLocation: '', + maBaseId: null, hazardIdentification: '', workDetail:{ hotMethod: '', otherSpecialWork: [] }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -237,6 +209,7 @@ } ] }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -253,58 +226,42 @@ onMounted(() => { }); - 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.workLevel == null || 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) { - if (state.materialList.length == 0){ - ElMessage({ - type: 'warning', - message: '请确认关联物资的配置' - }); - return - } - 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)) @@ -322,106 +279,14 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } }) } - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 1,workLevel: state.form.workLevel} - 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) @@ -431,12 +296,11 @@ return { renderMenu, Search, + material, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + openMaList, + conFirmMaterials, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue b/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue index fa98456..26a089b 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/ground.vue @@ -122,40 +122,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 +151,6 @@ import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; import axios from 'axios'; - interface stateType { equipmentDialog: boolean, form: Object, @@ -190,15 +162,16 @@ dialogImageUrl: string | null, imgLimit: number, casProps: {}, - isOverSize: Boolean, - materialList: Array<any> + isOverSize: Boolean } interface file { url: string; } export default { name: 'groundForm', - components: {}, + components: { + materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')), + }, props:['workerList','departList'], setup(props: any, context: any) { const userInfo = useUserInfo() @@ -212,6 +185,7 @@ workContent: '', workLocation: '', hazardIdentification: '', + maBaseId: null, workDetail:{ operationDepId: null, gbScope: '', @@ -219,14 +193,13 @@ gbPath: [], otherSpecialWork: [] }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, isOverSize: false, fileList: [], - materialList: [], imgLimit: 3, uploadUrl: '', dialogVisible: false, @@ -300,6 +273,7 @@ checkStrictly: true } }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -313,51 +287,44 @@ "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 +345,8 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } @@ -495,99 +463,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 +475,9 @@ Plus, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + openMaList, + conFirmMaterials, handlePreview, getUploadUrl, beforeRemove, diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/height.vue b/src/views/specialWorkSystem/workTicket/zysq/components/height.vue index cc25b8e..0fcee6b 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/height.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/height.vue @@ -116,40 +116,13 @@ </el-col> <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> @@ -158,7 +131,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"; @@ -176,14 +149,15 @@ workLevelList: Array<any>, heDepList: Array<any>, otherWorkList: Array<any>, - casProps:{}, - materialList: Array<any> + casProps:{} } export default defineComponent({ name: 'heightForm', - components: {}, + components: { + materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')), + }, props:['workerList','departList'], - setup() { + setup(props: any, context: any) { const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ @@ -195,12 +169,13 @@ workContent: '', workLocation: '', hazardIdentification: '', + maBaseId: null, workDetail:{ operationDepId: '', operationHeight: null, otherSpecialWork: [] }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -231,7 +206,6 @@ value: 6 } ], - materialList: [], casProps: { emitPath: false, value: 'depId', @@ -303,6 +277,7 @@ } ] }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -316,52 +291,36 @@ "workDetail.operationHeight": [{ 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.workLevel == null || 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] - } 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)) @@ -379,106 +338,14 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } }) } - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 6,workLevel: state.form.workLevel} - 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) => { @@ -491,10 +358,9 @@ Search, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + openMaList, + conFirmMaterials, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/hoist.vue b/src/views/specialWorkSystem/workTicket/zysq/components/hoist.vue index c781918..f9ae96f 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/hoist.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/hoist.vue @@ -101,40 +101,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> @@ -143,7 +116,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"; @@ -153,18 +126,18 @@ import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; - interface stateType { equipmentDialog: boolean, form: Object, - workLevelList: Array<any>, - materialList: Array<any> + workLevelList: Array<any> } export default defineComponent({ name: 'hoistForm', - components: {}, + components: { + 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>({ @@ -175,17 +148,17 @@ workLevel: null, workContent: '', workLocation: '', + maBaseId: null, hazardIdentification: '', workDetail:{ hoistingToolName: '', weightMass: null }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, - materialList: [], workLevelList: [ { label: "一级吊装作业", @@ -201,6 +174,7 @@ } ] }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -214,52 +188,35 @@ "workDetail.weightMass": [{ 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.workLevel == null || 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] - } 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)) @@ -277,105 +234,12 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } }) - } - - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 3,workLevel: state.form.workLevel} - 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 = ()=>{ - } // 折线图 @@ -389,10 +253,9 @@ Search, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + openMaList, + conFirmMaterials, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue b/src/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue new file mode 100644 index 0000000..384515a --- /dev/null +++ b/src/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue @@ -0,0 +1,293 @@ +<template> + <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> + <div class="standard" v-for="item in materialList"> + <div>{{ item.name }}</div> + <el-button @click="openList(item)" type="success">选用</el-button> + </div> + + <el-dialog v-model="equipDetailDialog" title="物资标准详情" width="75%" center @open="openDetail"> + <div class="choose-receiver"> + <span>选择其他作业关联人员</span> + <el-select v-model="receiveUids" multiple @change="changeReceiver"> + <el-option + v-for="item in workerList" + :key="item.uid" + :label="item.username" + :value="item.uid" + /> + </el-select> + </div> + <table class="table"> + <tr> + <th class="w-25">物资名称</th> + <th class="w-15">标准值</th> + <th class="w-15">级别</th> + <th class="w-30">关联人员与个数</th> + <th class="w-15">实际使用</th> + </tr> + <tr v-for="(item,index) in materialDetail"> + <td class="w-25">{{item.materialName}}</td> +<!-- <td class="w-1">--> +<!-- <el-select v-model="addList[index].depId" @change="changeDep($event,index)">--> +<!-- <el-option--> +<!-- v-for="i in item.msList"--> +<!-- :key="i.depId"--> +<!-- :label="i.depName"--> +<!-- :value="i.depId"--> +<!-- />--> +<!-- </el-select>--> +<!-- </td>--> +<!-- <td class="w-15">--> +<!-- {{stockCount[index]}}--> +<!-- </td>--> + <td class="w-15">{{item.standVal}}</td> + <td class="w-15">{{item.configurationLevelName}}</td> + <td class="w-30"> + {{item.receiveUnames}} + </td> +<!-- <td class="w-15">--> +<!-- <el-input type="number" v-model.number="addList[index].useCount"/>--> +<!-- </td>--> + <td class="w-15"> + {{item.receiveCount}} + </td> + </tr> + </table> + <template #footer> + <span class="dialog-footer"> + <el-button @click="closeChoose()" size="default">取消</el-button> + <el-button type="primary" @click="submitMaterials" size="default">确认</el-button> + </span> + </template> + </el-dialog> + </el-dialog> +</template> + +<script lang="ts"> +import {workApplyApi} from "/@/api/specialWorkSystem/workApply"; + +interface stateType { + equipmentDialog:boolean + materialList: Array<any> + equipDetailDialog: boolean + materialDetail: Array<any> + stockCount: Array<number> + chosenId: number | null, + receiveUids: Array<number> +} + + +import { reactive, toRefs, ref } from 'vue'; +import { approveBasicApi } from '/@/api/specialWorkSystem/approveBasic'; +import {ElMessage, ElMessageBox} from 'element-plus'; +import {useUserInfo} from "/@/stores/userInfo"; +import {storeToRefs} from "pinia"; + +export default { + name: 'materialDialog', + setup(props: any, context: any) { + const userInfo = useUserInfo() + const { userInfos } = storeToRefs(userInfo); + const approveBasicFormRef = ref(); + const state = reactive<stateType>({ + chosenId: null, + equipmentDialog: false, + materialList: [], + equipDetailDialog: false, + materialDetail: [], + stockCount: [], + receiveUids: [] + }); + + // 确认物资标准 + const getMaList = async(type:number,level:number) =>{ + const data = {workType: type,workLevel: level} + const res = await workApplyApi().getMaterial(data) + if (res.data.code === '200') { + if(res.data.data && res.data.data.length>0){ + state.materialList = JSON.parse(JSON.stringify(res.data.data)) + state.equipmentDialog = true + }else{ + ElMessage({ + type: 'warning', + message: '暂时查询不到物资标准信息' + }); + } + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + const openList = async(item:object)=>{ + state.chosenId = item.id + const data = {maBaseId: state.chosenId,receiveUids:state.receiveUids} + const res = await workApplyApi().getMaterialDetail(data) + if (res.data.code === '200') { + if(res.data.data && res.data.data.length>0){ + state.materialDetail = res.data.data + state.equipDetailDialog = true + }else{ + ElMessage({ + type: 'warning', + message: '暂时查询不到物资标准信息' + }); + } + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + // state.stockCount = [] + // if(item.mcList && item.mcList.length>0){ + // for(let j in item.mcList){ + // if(item.mcList[j].msList == null || item.mcList[j].msList.length==0){ + // item.mcList.splice(j,1) + // } + // } + // state.materialDetail = item.mcList + // for(let i in state.materialDetail){ + // state.addList.push( + // { + // materialId: state.materialDetail[i].materialId, + // depId: null, + // depName: '', + // useCount: null + // } + // ) + // for(let x in state.materialDetail[i].msList){ + // if(state.materialDetail[i].msList[x].depId == userInfos.value.depId){ + // state.addList[i].depId = userInfos.value.depId + // state.addList[i].depName = state.materialDetail[i].msList[x].depName + // state.stockCount[i] = state.materialDetail[i].msList.find((e) => e.depId == state.addList[i].depId).stockCount + // } + // } + // } + // } + } + const changeReceiver = async ()=>{ + const data = {maBaseId: state.chosenId,receiveUids:state.receiveUids} + const res = await workApplyApi().getMaterialDetail(data) + if (res.data.code === '200') { + if(res.data.data && res.data.data.length>0){ + state.materialDetail = res.data.data + }else{ + ElMessage({ + type: 'warning', + message: '暂时查询不到物资标准信息' + }); + } + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + const openDetail = ()=>{ + } + const submitMaterials = ()=>{ + // if(state.addList.length > 0 && (state.addList.some((e) => e.depId == null && e.useCount != null ) || state.addList.some((e) => e.useCount == null && e.depId != null))){ + // ElMessage({ + // type: 'warning', + // message: '出库部门或实际使用值不可为空' + // }); + // return + // } + // for(let i in state.materialDetail){ + // if(state.materialDetail[i].configurationLevelName == '必选' && state.addList[i].depId != null && state.addList[i].useCount <= 0){ + // ElMessage({ + // type: 'warning', + // message: '必选物资数量不能小于等于0' + // }); + // return + // } + // if((state.stockCount[i] !=null && state.addList[i].useCount !=null) && (state.stockCount[i] < state.addList[i].useCount)){ + // ElMessage({ + // type: 'warning', + // message: '物资配置数量超出库存量,请重新配置' + // }); + // return + // } + // } + // if(state.addList.length > 0){ + // for(let n in state.addList){ + // if(state.addList[n].depId == null && state.addList[n].useCount == null){ + // state.addList.splice(n,1) + // } + // } + // } + console.log(state.receiveUids,state.chosenId,'666666666') + context.emit('conFirmMaterials',state.receiveUids,state.chosenId) + state.equipDetailDialog = false + state.equipmentDialog = false + } + + const closeMaterial = ()=>{ + + } + const closeChoose = () =>{ + state.equipDetailDialog = false + } + return { + ...toRefs(state), + getMaList, + openList, + changeReceiver, + openDetail, + closeChoose, + closeMaterial, + submitMaterials + }; + } +}; +</script> + +<style lang="scss" scoped> + .standard{ + width: 100%; + display: flex; + margin-bottom: 20px; + align-items: center; + justify-content: space-between; + } + + .table{ + width: 100%; + border-collapse: collapse; + margin-top: 20px; + tr{ + width: 100%; + border: 1px solid #ccc; + th,td{ + padding: 6px 0; + border-left: 1px solid #ccc; + &:first-of-type{ + border-left: none; + } + } + td{ + font-weight: bolder; + } + + .w-15{ + width: 15%; + text-align: center; + } + .w-20{ + width: 20%; + text-align: center; + } + .w-25{ + width: 25%; + text-align: center; + } + .w-30{ + width: 30%; + text-align: center; + } + } + } +</style> diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/plate.vue b/src/views/specialWorkSystem/workTicket/zysq/components/plate.vue index efde56e..f0e9544 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/plate.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/plate.vue @@ -197,40 +197,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> @@ -242,7 +215,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"; @@ -264,28 +237,29 @@ dialogImageUrl: string | null, imgLimit: number, isOverSize: boolean, - equipmentDialog: boolean, - materialList: Array<any> + equipmentDialog: boolean } interface file { url: string; } export default defineComponent({ name: 'plateForm', - components: {}, + components: { + 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>({ equipmentDialog: false, - materialList: [], form: { operatorUids: [], workType: 8, workLevel: null, workContent: '', workLocation: '', + maBaseId: null, hazardIdentification: '', workDetail:{ bpCode: '', @@ -301,7 +275,7 @@ uninstallBpTime: '', otherSpecialWork: [] }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -383,6 +357,7 @@ } ] }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -403,52 +378,35 @@ "workDetail.bpLocationMapPath": [{ 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.workLevel == null || 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] - } state.form.expStartTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[0] state.form.expEndTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[1] state.form.workDetail.installBpTime = JSON.parse(JSON.stringify(state.form.workDetail.installLine))[0] @@ -475,7 +433,8 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } @@ -588,100 +547,6 @@ }); } - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 8,workLevel: state.form.workLevel} - 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) @@ -693,10 +558,9 @@ Search, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + openMaList, + conFirmMaterials, handlePreview, getUploadUrl, beforeRemove, diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/power.vue b/src/views/specialWorkSystem/workTicket/zysq/components/power.vue index b44371b..07d84b4 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/power.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/power.vue @@ -99,40 +99,13 @@ </el-col> <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> @@ -141,7 +114,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"; @@ -151,60 +124,45 @@ import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; - interface stateType { form: Object, - workLevelList: Array<any>, - equipmentDialog: boolean, - materialList: Array<any> + equipmentDialog: boolean } export default defineComponent({ name: 'powerForm', - components: {}, + components: { + 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>({ equipmentDialog: false, - materialList: [], form: { operatorUids: [], workType: 7, workLevel: 0, workContent: '', workLocation: '', + 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' }], @@ -214,52 +172,37 @@ "workDetail.equipmentAndPower": [{ 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] - } 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)) @@ -277,105 +220,14 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } }) } - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 7,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) @@ -387,10 +239,9 @@ Search, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + openMaList, + conFirmMaterials, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/space.vue b/src/views/specialWorkSystem/workTicket/zysq/components/space.vue index 5bc5bba..a474192 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/components/space.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/components/space.vue @@ -110,40 +110,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> @@ -152,7 +125,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"; @@ -162,31 +135,31 @@ import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; - interface stateType { form: Object, csDepList: Array<any>, otherWorkList: Array<any>, casProps: {}, - equipmentDialog: boolean, - materialList: Array<any> + equipmentDialog: boolean } export default defineComponent({ name: 'spaceForm', - components: {}, + components: { + materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')), + }, props:['workerList','departList'], - setup() { + setup(props: any, context: any) { const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ equipmentDialog: false, - materialList: [], form: { operatorUids: [], workType: 2, workLevel: 0, workContent: '', workLocation: '', + maBaseId: null, hazardIdentification: '', workDetail:{ csDepId: null, @@ -194,7 +167,7 @@ csOriginalName: '', otherSpecialWork: [] }, - wmAddReqDTOList: [], + receiveUids: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -268,6 +241,7 @@ } ] }); + const material = ref() const ruleFormRef = ref<FormInstance>() const applyRules = reactive<FormRules>({ operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -281,52 +255,37 @@ "workDetail.csOriginalName": [{ 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] - } 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)) @@ -345,106 +304,14 @@ message: res.data.msg }); } - state.materialList = [] + material.value.maBaseId = null + material.value.receiveUids = [] } else { console.log('error submit!', fields) } }) } - // 确认物资标准 - const getMaList = async() =>{ - if(state.materialList.length == 0){ - const data = {workType: 2,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) => { @@ -457,10 +324,9 @@ Search, ruleFormRef, applyRules, - toZero, - getMaList, - conFirmDevices, - closeMaterial, + material, + openMaList, + conFirmMaterials, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/zysq/index.vue b/src/views/specialWorkSystem/workTicket/zysq/index.vue index 6a6906b..fea4f09 100644 --- a/src/views/specialWorkSystem/workTicket/zysq/index.vue +++ b/src/views/specialWorkSystem/workTicket/zysq/index.vue @@ -1,31 +1,32 @@ <template> <div class="home-container"> - <el-tabs type="border-card"> + <el-tabs type="border-card" @tab-change="switchTab"> <el-tab-pane label="动火作业"> - <fire-form :workerList = allWorkers></fire-form> + <fire-form ref="fire" :workerList = allWorkers></fire-form> </el-tab-pane> <el-tab-pane label="受限空间作业"> - <space-form :workerList = allWorkers :departList = departmentList></space-form> + <space-form ref="space" :workerList = allWorkers :departList = departmentList></space-form> </el-tab-pane> <el-tab-pane label="吊装作业"> - <hoist-form :workerList = allWorkers></hoist-form> + <hoist-form ref="hoist" :workerList = allWorkers></hoist-form> </el-tab-pane> <el-tab-pane label="动土作业"> - <ground-form :workerList = allWorkers :departList = departmentList></ground-form> + <ground-form ref="ground" :workerList = allWorkers :departList = departmentList></ground-form> </el-tab-pane> <el-tab-pane label="断路作业"> - <broken-form :workerList = allWorkers :departList = departmentList></broken-form> + <broken-form ref="broken" :workerList = allWorkers :departList = departmentList></broken-form> </el-tab-pane> <el-tab-pane label="高处作业"> - <height-form :workerList = allWorkers :departList = departmentList></height-form> + <height-form ref="height" :workerList = allWorkers :departList = departmentList></height-form> </el-tab-pane> <el-tab-pane label="临时用电作业"> - <power-form :workerList = allWorkers></power-form> + <power-form ref="power" :workerList = allWorkers></power-form> </el-tab-pane> <el-tab-pane label="盲板抽堵作业"> - <plate-form :workerList = allWorkers></plate-form> + <plate-form ref="plate" :workerList = allWorkers></plate-form> </el-tab-pane> </el-tabs> + <material-dialog ref="material"></material-dialog> </div> </template> @@ -55,7 +56,8 @@ brokenForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/broken.vue')), heightForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/height.vue')), powerForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/power.vue')), - plateForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/plate.vue')) + plateForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/plate.vue')), + materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')) }, setup() { const userInfo = useUserInfo() @@ -64,7 +66,15 @@ allWorkers: [], departmentList: [] }); - + const fire = ref() + const space = ref() + const hoist = ref() + const ground = ref() + const broken = ref() + const height = ref() + const power = ref() + const plate = ref() + const material = ref() // 获取用户列表 const getAll = async ()=>{ const res = await workApplyApi().getAllUsers() @@ -91,6 +101,14 @@ } }; + const switchTab = (name)=>{ + console.log(name,'name') + fire.value.form.resetFields() + material.value.maBaseId = null + material.value.receiveUids = [] + } + + // 页面载入时执行方法 onMounted(() => { getAll(); @@ -99,6 +117,16 @@ return { ...toRefs(state), + fire, + space, + broken, + ground, + height, + hoist, + plate, + power, + material, + switchTab }; }, }); -- Gitblit v1.9.2