From 4b65c83845208972c85ede0ea1a632fc8e2fc41c Mon Sep 17 00:00:00 2001 From: Admin <978517621@qq.com> Date: 星期三, 28 九月 2022 17:53:30 +0800 Subject: [PATCH] Default Changelist --- src/views/specialWorkSystem/workTicket/workApply/components/hoist.vue | 154 ++++++ src/views/specialWorkSystem/workTicket/workApply/components/plate.vue | 153 ++++++ src/views/specialWorkSystem/workTicket/workApply/components/space.vue | 154 ++++++ src/views/specialWorkSystem/workTicket/workApply/components/power.vue | 152 ++++++ src/views/specialWorkSystem/workTicket/workApply/components/height.vue | 153 ++++++ src/views/specialWorkSystem/workTicket/workApply/components/fire.vue | 193 ++++++++ src/api/specialWorkSystem/workApply/index.ts | 9 src/views/specialWorkSystem/workTicket/workApply/components/broken.vue | 151 ++++++ src/views/specialWorkSystem/foundationSet/material/index.vue | 26 src/views/specialWorkSystem/workTicket/workApply/components/ground.vue | 150 ++++++ 10 files changed, 1,253 insertions(+), 42 deletions(-) diff --git a/src/api/specialWorkSystem/workApply/index.ts b/src/api/specialWorkSystem/workApply/index.ts index 7e6337f..4575477 100644 --- a/src/api/specialWorkSystem/workApply/index.ts +++ b/src/api/specialWorkSystem/workApply/index.ts @@ -158,6 +158,15 @@ method: 'post', data: data }); + }, + + // 获取物资配置数据 + getMaterial: (data: object) => { + return request({ + url: import.meta.env.VITE_API_URL + `/specialWork/material/queryByWorkTypeOrLevel`, + method: 'post', + data: data + }); } }; } diff --git a/src/views/specialWorkSystem/foundationSet/material/index.vue b/src/views/specialWorkSystem/foundationSet/material/index.vue index 93ea978..116b215 100644 --- a/src/views/specialWorkSystem/foundationSet/material/index.vue +++ b/src/views/specialWorkSystem/foundationSet/material/index.vue @@ -230,7 +230,6 @@ <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="defaultVal"><el-input v-model="checkData[index].list[x].defaultVal"/></el-form-item> <el-form-item label="配置级别" prop="configurationLevel"> <el-select v-model="checkData[index].list[x].configurationLevel"> <el-option key="0" label="必选" value="0"/> @@ -238,6 +237,7 @@ <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> @@ -248,6 +248,7 @@ </div> </el-tab-pane> </el-tabs> + <div v-if="chosenIndex != null" style="color: #79bbff">注:修改配置数据须重新填写配置</div> </el-form-item> <el-form-item label="描述" prop="info"> <el-input v-model="addRecord.info" type="textarea" autosize :rows="2"/> @@ -292,7 +293,6 @@ import type { FormInstance, FormRules } from 'element-plus' import { teamManageApi } from '/@/api/systemManage/basicDateManage/personShiftManage/teamManage'; import { materialApi } from '/@/api/specialWorkSystem/material'; -import {a} from "pinia-plugin-persistedstate/dist/types-374a3a36"; // 定义接口来定义对象的类型 interface stateType { @@ -576,7 +576,7 @@ checked: false, materialName: item.name, consumables: null, - defaultVal: null, + defaultVal: 0, configurationLevel: null, materialType: item.materialType, materialTypeName: item.materialTypeName, @@ -722,20 +722,20 @@ materialDetailList: state.addRecord.materialDetailList }; console.log(data.materialDetailList,'data.materialDetailList') - if(data.materialDetailList.length==0 || data.materialDetailList.some((e) => e.defaultVal == null) || 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) || data.materialDetailList.some((e) => e.consumables == null)){ ElMessage({ type: 'warning', - message: '请完善物资配置必填数据' + message: '请选择物资配置并完善必填数据' }); - }else{ - if (state.chosenIndex == null) { - await addRecord(data); - } else { - data.id = state.addRecord.id; - await editRecord(data); - } - state.dialogAddRecord = false; + return } + if (state.chosenIndex == null) { + await addRecord(data); + } else { + data.id = state.addRecord.id; + await editRecord(data); + } + state.dialogAddRecord = false; } else { console.log('error submit!', fields); } diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/broken.vue b/src/views/specialWorkSystem/workTicket/workApply/components/broken.vue index 3800466..1c32a26 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/broken.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/broken.vue @@ -117,8 +117,43 @@ </el-form-item> </el-col> </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -142,6 +177,7 @@ import axios from 'axios'; interface stateType { + equipmentDialog: boolean, form: Object, csDepList: Array<any>, fileList: Array<file>, @@ -151,7 +187,8 @@ imgLimit: number, casProps: {}, casProps2: {}, - isOverSize: boolean + isOverSize: boolean, + materialList: Array<any> } interface file { url: string; @@ -164,6 +201,7 @@ const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, form: { operatorUids: [], workType: 5, @@ -178,10 +216,12 @@ bcPath: [], involvedDepIds: [] }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, + materialList: [], isOverSize: false, fileList: [], imgLimit: 3, @@ -247,6 +287,24 @@ if (!formEl) return await formEl.validate(async (valid, fields) => { if (valid) { + for(let i in state.materialList){ + 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)) @@ -261,6 +319,7 @@ formEl.resetFields() state.form.workDetail.bcPath = [] state.fileList = [] + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -381,6 +440,93 @@ }); } + // 确认物资标准 + 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') { + 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: 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) @@ -392,6 +538,9 @@ Search, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, handlePreview, getUploadUrl, beforeRemove, diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/fire.vue b/src/views/specialWorkSystem/workTicket/workApply/components/fire.vue index f3ebc7f..29b2fce 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/fire.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/fire.vue @@ -99,8 +99,43 @@ </el-form-item> </el-col> </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -109,22 +144,23 @@ </template> <script lang="ts"> - import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; + import { toRefs, reactive, defineComponent, ref, defineAsyncComponent, onMounted } from 'vue'; import { storeToRefs } from 'pinia'; import { initBackEndControlRoutes } from '/@/router/backEnd'; import {useUserInfo} from "/@/stores/userInfo"; import { Session } from '/@/utils/storage'; import { Search } from '@element-plus/icons-vue' - import { ElMessage } from 'element-plus' + import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; interface stateType { form: Object, - workTypeList: Array<any>, workLevelList: Array<any>, - otherWorkList: Array<any> + otherWorkList: Array<any>, + equipmentDialog: boolean, + materialList: Array<any> } export default defineComponent({ name: 'fireForm', @@ -134,6 +170,8 @@ const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, + materialList: [], form: { operatorUids: [], workType: 1, @@ -145,20 +183,11 @@ hotMethod: '', otherSpecialWork: [] }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, - workTypeList: [ - { - label: "类型一", - value: 1 - }, - { - label: "类型二", - value: 2 - } - ], workLevelList: [ { label: "一级动火作业", @@ -219,15 +248,45 @@ workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], "workDetail.hotMethod": [{ required: true, message: '该内容不能为空', trigger: 'blur' }] }); + + // 页面载入时执行方法 + onMounted(() => { + + }); + 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){ + 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)) data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',') - console.log(data,'data') const res = await workApplyApi().postFireApply(data) if (res.data.code === '200') { ElMessage({ @@ -235,6 +294,7 @@ message: '提交成功!' }); formEl.resetFields() + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -245,6 +305,93 @@ 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') { + 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: 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) => { @@ -257,6 +404,9 @@ Search, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, submitForm, ...toRefs(state), }; @@ -306,4 +456,17 @@ width: 100% !important; } } + + .tab-i{ + margin-bottom: 15px; + + &:last-of-type{ + margin-bottom: 0; + } + ::v-deep(.el-form-item){ + .el-form-item__label{ + margin-bottom: 4px; + } + } + } </style> diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/ground.vue b/src/views/specialWorkSystem/workTicket/workApply/components/ground.vue index 1716f56..6ac168c 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/ground.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/ground.vue @@ -119,8 +119,43 @@ </el-form-item> </el-col> </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -145,6 +180,7 @@ interface stateType { + equipmentDialog: boolean, form: Object, csDepList: Array<any>, otherWorkList: Array<any>, @@ -154,7 +190,8 @@ dialogImageUrl: string | null, imgLimit: number, casProps: {}, - isOverSize: Boolean + isOverSize: Boolean, + materialList: Array<any> } interface file { url: string; @@ -167,6 +204,7 @@ const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, form: { operatorUids: [], workType: 4, @@ -181,12 +219,14 @@ gbPath: [], otherSpecialWork: [] }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, isOverSize: false, fileList: [], + materialList: [], imgLimit: 3, uploadUrl: '', dialogVisible: false, @@ -277,6 +317,24 @@ if (!formEl) return await formEl.validate(async (valid, fields) => { if (valid) { + for(let i in state.materialList){ + 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)) @@ -291,6 +349,7 @@ formEl.resetFields() state.form.workDetail.gbPath = [] state.fileList = [] + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -413,6 +472,92 @@ // 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') { + 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: 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) @@ -425,6 +570,9 @@ Plus, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, handlePreview, getUploadUrl, beforeRemove, diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/height.vue b/src/views/specialWorkSystem/workTicket/workApply/components/height.vue index 27bc3ab..207938e 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/height.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/height.vue @@ -114,9 +114,42 @@ </el-select> </el-form-item> </el-col> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -131,18 +164,20 @@ import {useUserInfo} from "/@/stores/userInfo"; import { Session } from '/@/utils/storage'; import { Search } from '@element-plus/icons-vue' - import { ElMessage } from 'element-plus' + import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; interface stateType { + equipmentDialog: boolean, form: Object, workTypeList: Array<any>, workLevelList: Array<any>, heDepList: Array<any>, otherWorkList: Array<any>, - casProps:{} + casProps:{}, + materialList: Array<any> } export default defineComponent({ name: 'heightForm', @@ -152,6 +187,7 @@ const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, form: { operatorUids: [], workType: 6, @@ -164,6 +200,7 @@ operationHeight: null, otherSpecialWork: [] }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -194,6 +231,7 @@ value: 6 } ], + materialList: [], casProps: { emitPath: false, value: 'depId', @@ -281,11 +319,28 @@ if (!formEl) return await formEl.validate(async (valid, fields) => { if (valid) { + for(let i in state.materialList){ + 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)) data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',') - console.log(data,'data') const res = await workApplyApi().postHeightApply(data) if (res.data.code === '200') { ElMessage({ @@ -293,6 +348,7 @@ message: '提交成功!' }); formEl.resetFields() + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -304,6 +360,94 @@ } }) } + + // 确认物资标准 + 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') { + 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: 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) @@ -315,6 +459,9 @@ Search, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/hoist.vue b/src/views/specialWorkSystem/workTicket/workApply/components/hoist.vue index e9a629a..57bfd66 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/hoist.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/hoist.vue @@ -98,8 +98,43 @@ </el-form-item> </el-col> </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -114,14 +149,16 @@ import {useUserInfo} from "/@/stores/userInfo"; import { Session } from '/@/utils/storage'; import { Search } from '@element-plus/icons-vue' - import { ElMessage } from 'element-plus' + import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; interface stateType { + equipmentDialog: boolean, form: Object, - workLevelList: Array<any> + workLevelList: Array<any>, + materialList: Array<any> } export default defineComponent({ name: 'hoistForm', @@ -131,6 +168,7 @@ const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, form: { operatorUids: [], workType: 3, @@ -142,10 +180,12 @@ hoistingToolName: '', weightMass: null }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' }, + materialList: [], workLevelList: [ { label: "一级吊装作业", @@ -177,6 +217,24 @@ if (!formEl) return await formEl.validate(async (valid, fields) => { if (valid) { + for(let i in state.materialList){ + 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)) @@ -188,6 +246,7 @@ message: '提交成功!' }); formEl.resetFields() + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -199,6 +258,94 @@ } }) } + + // 确认物资标准 + 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') { + 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: 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) @@ -210,6 +357,9 @@ Search, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/plate.vue b/src/views/specialWorkSystem/workTicket/workApply/components/plate.vue index 6bb7136..2f09dd7 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/plate.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/plate.vue @@ -194,8 +194,43 @@ </el-form-item> </el-col> </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -228,19 +263,23 @@ dialogVisible: Boolean, dialogImageUrl: string | null, imgLimit: number, - isOverSize: boolean + isOverSize: boolean, + equipmentDialog: boolean, + materialList: Array<any> } interface file { url: string; } export default defineComponent({ - name: 'brokenForm', + name: 'plateForm', components: {}, props:['workerList'], setup() { const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, + materialList: [], form: { operatorUids: [], workType: 8, @@ -262,6 +301,7 @@ uninstallBpTime: '', otherSpecialWork: [] }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -366,6 +406,24 @@ if (!formEl) return await formEl.validate(async (valid, fields) => { if (valid) { + for(let i in state.materialList){ + 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] @@ -386,6 +444,7 @@ formEl.resetFields() state.form.workDetail.bpLocationMapPath = [] state.fileList = [] + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -504,6 +563,93 @@ }); } + // 确认物资标准 + 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') { + 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: 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) @@ -515,6 +661,9 @@ Search, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, handlePreview, getUploadUrl, beforeRemove, diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/power.vue b/src/views/specialWorkSystem/workTicket/workApply/components/power.vue index 2940b9c..afde329 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/power.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/power.vue @@ -97,9 +97,42 @@ /> </el-form-item> </el-col> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -114,23 +147,27 @@ import {useUserInfo} from "/@/stores/userInfo"; import { Session } from '/@/utils/storage'; import { Search } from '@element-plus/icons-vue' - import { ElMessage } from 'element-plus' + 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> + workLevelList: Array<any>, + equipmentDialog: boolean, + materialList: Array<any> } export default defineComponent({ - name: 'hoistForm', + name: 'powerForm', components: {}, props:['workerList'], setup() { const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, + materialList: [], form: { operatorUids: [], workType: 7, @@ -143,6 +180,7 @@ workingVoltage: null, equipmentAndPower: '' }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -179,6 +217,24 @@ if (!formEl) return await formEl.validate(async (valid, fields) => { if (valid) { + for(let i in state.materialList){ + 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)) @@ -190,6 +246,7 @@ message: '提交成功!' }); formEl.resetFields() + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -200,6 +257,92 @@ 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') { + 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: 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) => { @@ -212,6 +355,9 @@ Search, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, submitForm, ...toRefs(state), }; diff --git a/src/views/specialWorkSystem/workTicket/workApply/components/space.vue b/src/views/specialWorkSystem/workTicket/workApply/components/space.vue index c2904c9..552979f 100644 --- a/src/views/specialWorkSystem/workTicket/workApply/components/space.vue +++ b/src/views/specialWorkSystem/workTicket/workApply/components/space.vue @@ -107,8 +107,43 @@ </el-form-item> </el-col> </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="选择关联物资"> + <el-button type="primary" @click="getMaList">选择物资标准</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" 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" 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> <div class="applyBtn"> <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> </div> @@ -123,7 +158,7 @@ import {useUserInfo} from "/@/stores/userInfo"; import { Session } from '/@/utils/storage'; import { Search } from '@element-plus/icons-vue' - import { ElMessage } from 'element-plus' + import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus' import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; @@ -132,7 +167,9 @@ form: Object, csDepList: Array<any>, otherWorkList: Array<any>, - casProps: {} + casProps: {}, + equipmentDialog: boolean, + materialList: Array<any> } export default defineComponent({ name: 'spaceForm', @@ -142,6 +179,8 @@ const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const state = reactive<stateType>({ + equipmentDialog: false, + materialList: [], form: { operatorUids: [], workType: 2, @@ -155,6 +194,7 @@ csOriginalName: '', otherSpecialWork: [] }, + wmAddReqDTOList: [], workTimeLine: [], expStartTime: '', expEndTime: '' @@ -244,6 +284,24 @@ if (!formEl) return await formEl.validate(async (valid, fields) => { if (valid) { + for(let i in state.materialList){ + 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)) @@ -256,6 +314,7 @@ message: '提交成功!' }); formEl.resetFields() + state.materialList = [] } else { ElMessage({ type: 'warning', @@ -267,6 +326,94 @@ } }) } + + // 确认物资标准 + 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') { + 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: 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) @@ -278,6 +425,9 @@ Search, ruleFormRef, applyRules, + getMaList, + conFirmDevices, + closeMaterial, submitForm, ...toRefs(state), }; -- Gitblit v1.9.2