| | |
| | | //物资列表 |
| | | 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' |
| | | }); |
| | | }, |
| | |
| | | <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> |
| | |
| | | </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> |
| | | 无 |
| | |
| | | <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> |
| | |
| | | </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-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].list[x].checked" :model="checkData[index].list[x]" label-width="100px" ref="addListRef" :rules="addListRules"> |
| | | <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].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 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 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-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> |
| | |
| | | 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' }] |
| | | }); |
| | | |
| | | // 页面载入时执行方法 |
| | |
| | | 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} |
| | | }) |
| | |
| | | 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; |
| | | }; |
| | |
| | | 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) |
| | | } |
| | | } |
| | |
| | | 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 |
| | | } |
| | |
| | | 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; |
| | | }; |
| | | |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="期望开始时间"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="关联其他作业"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="关联其他作业"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="关联其他作业"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="关联其他作业"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="关联其他作业"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="关联其他作业"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="关联物资"> |
| | | <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="关联其他作业"> |
| | |
| | | <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> |
| | |
| | | import axios from 'axios'; |
| | | |
| | | interface stateType { |
| | | equipmentDialog: boolean, |
| | | form: Object, |
| | | csDepList: Array<any>, |
| | | fileList: Array<file>, |
| | |
| | | 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() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 5, |
| | | workLevel: 0, |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | maId: null, |
| | | workDetail:{ |
| | | operationDepId: null, |
| | | bcReason: '', |
| | |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | materialList: [], |
| | | isOverSize: false, |
| | | fileList: [], |
| | | imgLimit: 3, |
| | |
| | | checkStrictly: true |
| | | } |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | "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 = ()=>{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | |
| | | const 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)) |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | // 确认物资标准 |
| | | 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) |
| | |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | material, |
| | | conFirmMaterials, |
| | | openMaList, |
| | | handlePreview, |
| | | getUploadUrl, |
| | | beforeRemove, |
| | |
| | | <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> |
| | |
| | | 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() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | materialList: [], |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 1, |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | maId: null, |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | hotMethod: '', |
| | |
| | | } |
| | | ] |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | 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){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请先选择作业等级再获取相应物资配置' |
| | | }); |
| | | }else{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | } |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | const 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)) |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } 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) |
| | |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | material, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | openMaList, |
| | | conFirmMaterials, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | |
| | | <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> |
| | |
| | | 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() |
| | |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 4, |
| | | workLevel: 0, |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | maId: null, |
| | | workDetail:{ |
| | | operationDepId: null, |
| | | gbScope: '', |
| | |
| | | }, |
| | | isOverSize: false, |
| | | fileList: [], |
| | | materialList: [], |
| | | imgLimit: 3, |
| | | uploadUrl: '', |
| | | dialogVisible: false, |
| | |
| | | checkStrictly: true |
| | | } |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | "workDetail.gbMethod": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.gbPath": [{ required: true, message: '该内容不能为空', trigger: 'blur' }] |
| | | }); |
| | | const toZero = (value: string | number,index: number,name: string,x:number) =>{ |
| | | if(!value){ |
| | | state.materialList[index][name][x].value = 0 |
| | | // const toZero = (value: string | number,index: number,name: string,x:number) =>{ |
| | | // if(!value){ |
| | | // state.materialList[index][name][x].value = 0 |
| | | // } |
| | | // } |
| | | |
| | | const openMaList = ()=>{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | |
| | | const 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)) |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | } |
| | |
| | | // 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) |
| | |
| | | Plus, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | material, |
| | | openMaList, |
| | | conFirmMaterials, |
| | | handlePreview, |
| | | getUploadUrl, |
| | | beforeRemove, |
| | |
| | | </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> |
| | |
| | | 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() { |
| | | const userInfo = useUserInfo() |
| | |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | maId: null, |
| | | workDetail:{ |
| | | operationDepId: '', |
| | | operationHeight: null, |
| | |
| | | value: 6 |
| | | } |
| | | ], |
| | | materialList: [], |
| | | casProps: { |
| | | emitPath: false, |
| | | value: 'depId', |
| | |
| | | } |
| | | ] |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | "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){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请先选择作业等级再获取相应物资配置' |
| | | }); |
| | | }else{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | } |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | |
| | | const 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)) |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } 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) => { |
| | |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | material, |
| | | openMaList, |
| | | conFirmMaterials, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | |
| | | <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> |
| | |
| | | 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() { |
| | | const userInfo = useUserInfo() |
| | |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | maId: null, |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | hoistingToolName: '', |
| | |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | materialList: [], |
| | | workLevelList: [ |
| | | { |
| | | label: "一级吊装作业", |
| | |
| | | } |
| | | ] |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | "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){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请先选择作业等级再获取相应物资配置' |
| | | }); |
| | | }else{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | } |
| | | |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | const 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)) |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } 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 = ()=>{ |
| | | |
| | | } |
| | | |
| | | // 折线图 |
| | |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | material, |
| | | openMaList, |
| | | conFirmMaterials, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
对比新文件 |
| | |
| | | <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="40%" center @open="openDetail" > |
| | | <table class="table"> |
| | | <tr> |
| | | <th class="w-20">物资名称</th> |
| | | <th class="w-20">出库部门(仓库)</th> |
| | | <th class="w-15">对应库存</th> |
| | | <th class="w-15">标准值</th> |
| | | <th class="w-15">级别</th> |
| | | <th class="w-15">实际使用</th> |
| | | </tr> |
| | | <tr v-for="(item,index) in materialDetail"> |
| | | <td class="w-20">{{item.materialName}}</td> |
| | | <td class="w-20"> |
| | | <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-15"> |
| | | <el-input type="number" v-model.number="addList[index].useCount"/> |
| | | </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> |
| | | addList: Array<any> |
| | | chosenId: number | null |
| | | } |
| | | |
| | | |
| | | 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,context) { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const approveBasicFormRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | chosenId: null, |
| | | equipmentDialog: false, |
| | | materialList: [], |
| | | equipDetailDialog: false, |
| | | materialDetail: [], |
| | | stockCount: [], |
| | | addList: [] |
| | | }); |
| | | |
| | | // 确认物资标准 |
| | | 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)) |
| | | }else{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '暂时查询不到物资标准信息' |
| | | }); |
| | | state.equipmentDialog = false |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | state.equipmentDialog = false |
| | | } |
| | | } |
| | | const openList =(item:object)=>{ |
| | | state.chosenId = item.id |
| | | state.addList = [] |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | state.equipDetailDialog = true |
| | | } |
| | | |
| | | const openDetail = ()=>{ |
| | | console.log(state.addList,'打开弹窗') |
| | | } |
| | | |
| | | const changeDep = (val:number,index:number)=>{ |
| | | state.addList[index].depName = state.materialDetail[index].msList.find((i) => i.depId == val).depName |
| | | state.stockCount[index] = state.materialDetail[index].msList.find((i) => i.depId == val).stockCount |
| | | } |
| | | 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.addList,state.chosenId,'666666666') |
| | | context.emit('conFirmMaterials',state.addList,state.chosenId) |
| | | state.equipDetailDialog = false |
| | | state.equipmentDialog = false |
| | | } |
| | | |
| | | const closeMaterial = ()=>{ |
| | | |
| | | } |
| | | const closeChoose = () =>{ |
| | | state.equipDetailDialog = false |
| | | state.equipmentDialog = false |
| | | } |
| | | return { |
| | | ...toRefs(state), |
| | | changeDep, |
| | | getMaList, |
| | | openList, |
| | | 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; |
| | | tr{ |
| | | width: 100%; |
| | | border: 1px solid #ccc; |
| | | th,td{ |
| | | border-left: 1px solid #ccc; |
| | | &:first-of-type{ |
| | | border-left: none; |
| | | } |
| | | } |
| | | th{ |
| | | padding: 10px 0; |
| | | font-weight: bolder; |
| | | } |
| | | |
| | | .w-15{ |
| | | width: 15%; |
| | | text-align: center; |
| | | } |
| | | .w-20{ |
| | | width: 20%; |
| | | text-align: center; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <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> |
| | |
| | | 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() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | materialList: [], |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 8, |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | maId: null, |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | bpCode: '', |
| | |
| | | } |
| | | ] |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | "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){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请先选择作业等级再获取相应物资配置' |
| | | }); |
| | | }else{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | } |
| | | |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | const 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] |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | // 确认物资标准 |
| | | 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) |
| | |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | material, |
| | | openMaList, |
| | | conFirmMaterials, |
| | | handlePreview, |
| | | getUploadUrl, |
| | | beforeRemove, |
| | |
| | | </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> |
| | |
| | | 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() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | materialList: [], |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 7, |
| | | workLevel: 0, |
| | | workContent: '', |
| | | workLocation: '', |
| | | maId: null, |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | powerAccessPoint: '', |
| | |
| | | } |
| | | ] |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | "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.workLevel == null){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请先选择作业等级再获取相应物资配置' |
| | | }); |
| | | }else{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | } |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | |
| | | const 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)) |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } 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) |
| | |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | material, |
| | | openMaList, |
| | | conFirmMaterials, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | |
| | | <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> |
| | |
| | | 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() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | materialList: [], |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 2, |
| | | workLevel: 0, |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | maId: null, |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | csDepId: null, |
| | |
| | | } |
| | | ] |
| | | }); |
| | | const material = ref() |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | |
| | | "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 = ()=>{ |
| | | material.value.equipmentDialog = true |
| | | material.value.getMaList(state.form.workType,state.form.workLevel) |
| | | } |
| | | const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{ |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | if(addList.length > 0){ |
| | | for(let i in addList){ |
| | | if(addList[i].depId != null && addList[i].useCount != null){ |
| | | state.form.wmAddReqDTOList.push(addList[i]) |
| | | } |
| | | } |
| | | } |
| | | // state.form.wmAddReqDTOList = addList |
| | | state.form.maId = chosenId |
| | | } |
| | | |
| | | const 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)) |
| | |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | state.form.maId = null |
| | | state.form.wmAddReqDTOList = [] |
| | | } 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) => { |
| | |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | material, |
| | | openMaList, |
| | | conFirmMaterials, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |