已重命名23个文件
已修改1个文件
已添加9个文件
已复制9个文件
| | |
| | | #VITE_API_URL = 'http://192.168.0.35:8008' |
| | | #李宇飞接口地址 |
| | | |
| | | #VITE_API_URL = 'http://192.168.0.50:8008' |
| | | VITE_API_URL = 'http://192.168.0.50:8008' |
| | | #张凤接口地址 |
| | | |
| | | #VITE_API_URL = 'http://192.168.0.29:8008' |
| | |
| | | #VITE_API_URL = 'http://192.168.0.69:8008' |
| | | #戚会山接口地址 |
| | | |
| | | VITE_API_URL = 'http://121.239.169.27:16006/safeplatform' |
| | | #VITE_API_URL = 'http://121.239.169.27:16006/safeplatform' |
| | | #线上正式环境接口地址 |
| | | |
| | | #VITE_API_URL_OUT = 'http://121.239.169.27:16006/safeplatform-out' |
copy from src/views/specialWorkSystem/workTicket/myApproval/components/brokenLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/brokenLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/components/fireLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/fireLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/components/groundLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/groundLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/components/heightLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/heightLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/components/hoistLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/hoistLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/components/plateLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/plateLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/components/powerLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/powerLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/components/spaceLog.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/components/spaceLog.vue
copy from src/views/specialWorkSystem/workTicket/myApproval/index.vue
copy to src/views/specialWorkSystem/workTicket/wdsp/index.vue
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed"/> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业单位" prop="workDetail.operationDepId"> |
| | | <!-- <el-select v-model="form.workDetail.operationDepId">--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in csDepList"--> |
| | | <!-- :key="item.value"--> |
| | | <!-- :label="item.label"--> |
| | | <!-- :value="item.value"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <el-cascader v-model="form.workDetail.operationDepId" :options="departList" :props="casProps2" :show-all-levels="false" @change="handleChange2" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="断路原因" prop="workDetail.bcReason"> |
| | | <el-input |
| | | v-model="form.workDetail.bcReason" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="断路地段说明" prop="workDetail.bcExplain"> |
| | | <el-input |
| | | v-model="form.workDetail.bcExplain" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="涉及相关部门" prop="workDetail.involvedDepIds"> |
| | | <el-cascader v-model="form.workDetail.involvedDepIds" :options="departList" :props="casProps" :show-all-levels="false" @change="handleChange" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="图片上传" prop="workDetail.bcPath"> |
| | | <el-upload accept="image/*" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='imgLimit' v-model:file-list="fileList" :http-request="upload" :action="uploadUrl" list-type="picture-card" :on-remove="handleRemove" :before-remove="beforeRemove" :before-upload="getUploadUrl"> |
| | | <el-icon><Plus /></el-icon> |
| | | <template #tip> |
| | | <div class="el-upload__tip">上传jpg/png图片尺寸小于500KB,最多可上传3张</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | <el-dialog v-model="dialogVisible"> |
| | | <img w-full :src="dialogImageUrl" alt="Preview Image" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import type { FormInstance, FormRules, UploadProps, UploadUserFile } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | import axios from 'axios'; |
| | | |
| | | interface stateType { |
| | | equipmentDialog: boolean, |
| | | form: Object, |
| | | csDepList: Array<any>, |
| | | fileList: Array<file>, |
| | | uploadUrl: string, |
| | | dialogVisible: Boolean, |
| | | dialogImageUrl: string | null, |
| | | imgLimit: number, |
| | | casProps: {}, |
| | | casProps2: {}, |
| | | isOverSize: boolean, |
| | | materialList: Array<any> |
| | | } |
| | | interface file { |
| | | url: string; |
| | | } |
| | | export default defineComponent({ |
| | | name: 'brokenForm', |
| | | components: {}, |
| | | props:['workerList','departList'], |
| | | setup() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 5, |
| | | workLevel: 0, |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | operationDepId: null, |
| | | bcReason: '', |
| | | bcExplain: '', |
| | | bcPath: [], |
| | | involvedDepIds: [] |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | materialList: [], |
| | | isOverSize: false, |
| | | fileList: [], |
| | | imgLimit: 3, |
| | | uploadUrl: '', |
| | | dialogVisible: false, |
| | | dialogImageUrl: null, |
| | | csDepList: [ |
| | | { |
| | | label: "单位一", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "单位二", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "单位三", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "单位四", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "单位五", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "单位六", |
| | | value: 6 |
| | | } |
| | | ], |
| | | casProps: { |
| | | emitPath: false, |
| | | value: 'depId', |
| | | label: 'depName', |
| | | multiple: true |
| | | }, |
| | | casProps2: { |
| | | emitPath: false, |
| | | value: 'depId', |
| | | label: 'depName', |
| | | multiple: false, |
| | | expandTrigger: 'hover', |
| | | checkStrictly: true |
| | | } |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.operationDepId": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.bcReason": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.bcExplain": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.bcPath": [{ 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 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)) |
| | | data.workDetail.involvedDepIds = data.workDetail.involvedDepIds.join(',') |
| | | data.workDetail.bcPath = data.workDetail.bcPath.join(',') |
| | | const res = await workApplyApi().postBrokenApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | state.form.workDetail.bcPath = [] |
| | | state.fileList = [] |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handlePreview: UploadProps['onPreview'] = (uploadFile) => { |
| | | console.log(uploadFile); |
| | | }; |
| | | |
| | | const handlePictureCardPreview = (uploadFile: { url: string }) => { |
| | | state.dialogImageUrl = uploadFile.url!; |
| | | state.dialogVisible = true; |
| | | }; |
| | | |
| | | const getUploadUrl = async (rawFile: any) => { |
| | | const fileSize = rawFile.size / 1024 < 500 ? '1' : '0' |
| | | if(fileSize === '0'){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件大小不能超过500k。' |
| | | }); |
| | | state.isOverSize = true |
| | | return false |
| | | }else{ |
| | | const res = await workApplyApi().getUploadUrl(rawFile.name); |
| | | state.form.workDetail.bcPath.push(res.data.data.fileName) |
| | | state.uploadUrl = res.data.data.uploadUrl; |
| | | console.log(res.data.data.fileName,'name') |
| | | } |
| | | }; |
| | | |
| | | const upload = async (params: any) => { |
| | | // const formData = new FormData(); |
| | | // formData.append('file', state.fileList[0].raw); |
| | | let reader = new FileReader(); |
| | | reader.readAsArrayBuffer(params.file); |
| | | reader.onload = async () => { |
| | | axios |
| | | .put(state.uploadUrl, reader.result, { |
| | | header: { 'Content-Type': 'multipart/form-data' } |
| | | }) |
| | | .then(() => { |
| | | // if (state.fileList.length === 2) { |
| | | // state.fileList.splice(0, 1); |
| | | // } |
| | | // console.log(state.form.workDetail.bcPath,'bcPath') |
| | | }); |
| | | }; |
| | | }; |
| | | |
| | | const beforeRemove = (file: {}, fileList: []) => { |
| | | const result = new Promise((resolve, reject) => { |
| | | if(!state.isOverSize){ |
| | | ElMessageBox.confirm('此操作将删除该图片, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | // console.log(state.workDetail.bcPath,'path') |
| | | const list = JSON.parse(JSON.stringify(state.form.workDetail.bcPath)) |
| | | fileList.map((item,index)=>{ |
| | | if(item.uid === file.uid){ |
| | | fileList.splice(index,1) |
| | | state.form.workDetail.bcPath.splice(index,1) |
| | | deletePic(false,list[index]) |
| | | } |
| | | }) |
| | | // 请求删除接口 |
| | | }) |
| | | .catch(() => { |
| | | reject(false); |
| | | }); |
| | | }else{ |
| | | const list = JSON.parse(JSON.stringify(state.form.workDetail.bcPath)) |
| | | fileList.map((item,index)=>{ |
| | | if(item.uid === file.uid){ |
| | | fileList.splice(index,1) |
| | | state.form.workDetail.bcPath.splice(index,1) |
| | | deletePic(true,list[index]) |
| | | } |
| | | }) |
| | | state.isOverSize = false |
| | | } |
| | | }); |
| | | return result; |
| | | }; |
| | | |
| | | |
| | | // 删除图片接口 |
| | | const deletePic = async(isOverSize:boolean,fileName:string)=>{ |
| | | console.log(fileName,'fileName') |
| | | const res = await workApplyApi().deleteFile({fileName: fileName}) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: isOverSize ? 'error' : 'success', |
| | | message: isOverSize ? '上传失败':'删除成功!' |
| | | }); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | |
| | | const showTip =()=>{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '超出文件上传数量' |
| | | }); |
| | | } |
| | | |
| | | // 确认物资标准 |
| | | 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) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | handlePreview, |
| | | getUploadUrl, |
| | | beforeRemove, |
| | | upload, |
| | | showTip, |
| | | submitForm, |
| | | handlePictureCardPreview, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | :deep(.el-cascader){ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业等级" prop="workLevel"> |
| | | <el-select v-model="form.workLevel"> |
| | | <el-option |
| | | v-for="item in workLevelList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed"/> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="动火方式" prop="workDetail.hotMethod"> |
| | | <el-input |
| | | v-model="form.workDetail.hotMethod" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入动火方式" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联作业" prop="workDetail.otherSpecialWork"> |
| | | <el-select v-model="form.workDetail.otherSpecialWork" multiple> |
| | | <el-option |
| | | v-for="item in otherWorkList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent, onMounted } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage, 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> |
| | | } |
| | | export default defineComponent({ |
| | | name: 'fireForm', |
| | | components: {}, |
| | | 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: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | hotMethod: '', |
| | | otherSpecialWork: [] |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | workLevelList: [ |
| | | { |
| | | label: "一级动火作业", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "二级动火作业", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "特级动火作业", |
| | | value: 3 |
| | | } |
| | | ], |
| | | otherWorkList: [ |
| | | { |
| | | label: "动火作业", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "受限空间作业", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "吊装作业", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "动土作业", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "断路作业", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "高处作业", |
| | | value: 6 |
| | | }, |
| | | { |
| | | label: "临时用电作业", |
| | | value: 7 |
| | | }, |
| | | { |
| | | label: "盲板抽堵作业", |
| | | value: 8 |
| | | } |
| | | ] |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.hotMethod": [{ 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 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] |
| | | } |
| | | state.form.expStartTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[0] |
| | | state.form.expEndTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[1] |
| | | let { workTimeLine, ...data } = JSON.parse(JSON.stringify(state.form)) |
| | | data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',') |
| | | const res = await workApplyApi().postFireApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } 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) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | .el-cascader{ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | |
| | | .tab-i{ |
| | | margin-bottom: 15px; |
| | | |
| | | &:last-of-type{ |
| | | margin-bottom: 0; |
| | | } |
| | | ::v-deep(.el-form-item){ |
| | | .el-form-item__label{ |
| | | margin-bottom: 4px; |
| | | } |
| | | } |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed"/> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业单位" prop="workDetail.operationDepId"> |
| | | <!-- <el-select v-model="form.workDetail.operationDepId">--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in csDepList"--> |
| | | <!-- :key="item.value"--> |
| | | <!-- :label="item.label"--> |
| | | <!-- :value="item.value"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <el-cascader v-model="form.workDetail.operationDepId" :options="departList" :props="casProps" :show-all-levels="false" @change="handleChange" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="范围" prop="workDetail.gbScope"> |
| | | <el-input |
| | | v-model="form.workDetail.gbScope" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="动土方式" prop="workDetail.gbMethod"> |
| | | <el-input |
| | | v-model="form.workDetail.gbMethod" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联作业" prop="workDetail.otherSpecialWork"> |
| | | <el-select v-model="form.workDetail.otherSpecialWork" multiple> |
| | | <el-option v-for="item in otherWorkList" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="图片上传" prop="workDetail.gbPath"> |
| | | <el-upload accept="image/*" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='imgLimit' v-model:file-list="fileList" :http-request="upload" :action="uploadUrl" list-type="picture-card" :on-remove="handleRemove" :before-remove="beforeRemove" :before-upload="getUploadUrl"> |
| | | <el-icon><Plus /></el-icon> |
| | | <template #tip> |
| | | <div class="el-upload__tip">上传jpg/png图片尺寸小于500KB,最多可上传3张</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | <el-dialog v-model="dialogVisible"> |
| | | <img w-full :src="dialogImageUrl" alt="Preview Image" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search,Plus } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import type { FormInstance, FormRules, UploadProps, UploadUserFile } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | import axios from 'axios'; |
| | | |
| | | |
| | | interface stateType { |
| | | equipmentDialog: boolean, |
| | | form: Object, |
| | | csDepList: Array<any>, |
| | | otherWorkList: Array<any>, |
| | | fileList: Array<file>, |
| | | uploadUrl: string, |
| | | dialogVisible: Boolean, |
| | | dialogImageUrl: string | null, |
| | | imgLimit: number, |
| | | casProps: {}, |
| | | isOverSize: Boolean, |
| | | materialList: Array<any> |
| | | } |
| | | interface file { |
| | | url: string; |
| | | } |
| | | export default { |
| | | name: 'groundForm', |
| | | components: {}, |
| | | props:['workerList','departList'], |
| | | setup(props: any, context: any) { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 4, |
| | | workLevel: 0, |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | operationDepId: null, |
| | | gbScope: '', |
| | | gbMethod: '', |
| | | gbPath: [], |
| | | otherSpecialWork: [] |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | isOverSize: false, |
| | | fileList: [], |
| | | materialList: [], |
| | | imgLimit: 3, |
| | | uploadUrl: '', |
| | | dialogVisible: false, |
| | | dialogImageUrl: null, |
| | | csDepList: [ |
| | | { |
| | | label: "单位一", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "单位二", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "单位三", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "单位四", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "单位五", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "单位六", |
| | | value: 6 |
| | | } |
| | | ], |
| | | otherWorkList: [ |
| | | { |
| | | label: '动火作业', |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: '受限空间作业', |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: '吊装作业', |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: '动土作业', |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: '断路作业', |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: '高处作业', |
| | | value: 6 |
| | | }, |
| | | { |
| | | label: '临时用电作业', |
| | | value: 7 |
| | | }, |
| | | { |
| | | label: '盲板抽堵作业', |
| | | value: 8 |
| | | } |
| | | ], |
| | | casProps: { |
| | | emitPath: false, |
| | | value: 'depId', |
| | | label: 'depName', |
| | | multiple: false, |
| | | expandTrigger: 'hover', |
| | | checkStrictly: true |
| | | } |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.operationDepId": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.gbScope": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.gbMethod": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.gbPath": [{ required: true, message: '该内容不能为空', trigger: 'blur' }] |
| | | }); |
| | | const toZero = (value: string | number,index: number,name: string,x:number) =>{ |
| | | if(!value){ |
| | | state.materialList[index][name][x].value = 0 |
| | | } |
| | | } |
| | | const 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)) |
| | | data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',') |
| | | data.workDetail.gbPath = data.workDetail.gbPath.join(',') |
| | | const res = await workApplyApi().postGroundApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | state.form.workDetail.gbPath = [] |
| | | state.fileList = [] |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handlePreview: UploadProps['onPreview'] = (uploadFile) => { |
| | | console.log(uploadFile); |
| | | }; |
| | | |
| | | const handlePictureCardPreview = (uploadFile: { url: string }) => { |
| | | state.dialogImageUrl = uploadFile.url!; |
| | | state.dialogVisible = true; |
| | | }; |
| | | |
| | | const getUploadUrl = async (rawFile: any) => { |
| | | const fileSize = rawFile.size / 1024 < 500 ? '1' : '0' |
| | | if(fileSize === '0'){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件大小不能超过500k。' |
| | | }); |
| | | state.isOverSize = true |
| | | return false |
| | | }else{ |
| | | const res = await workApplyApi().getUploadUrl(rawFile.name); |
| | | state.form.workDetail.gbPath.push(res.data.data.fileName) |
| | | state.uploadUrl = res.data.data.uploadUrl; |
| | | } |
| | | }; |
| | | |
| | | const upload = async (params: any) => { |
| | | // const formData = new FormData(); |
| | | // formData.append('file', state.fileList[0].raw); |
| | | let reader = new FileReader(); |
| | | reader.readAsArrayBuffer(params.file); |
| | | reader.onload = async () => { |
| | | axios |
| | | .put(state.uploadUrl, reader.result, { |
| | | header: { 'Content-Type': 'multipart/form-data' } |
| | | }) |
| | | .then(() => { |
| | | // if (state.fileList.length === 2) { |
| | | // state.fileList.splice(0, 1); |
| | | // } |
| | | // console.log(state.form.workDetail.gbPath,'gbpath') |
| | | }); |
| | | }; |
| | | }; |
| | | |
| | | const beforeRemove = (file: {}, fileList: []) => { |
| | | const result = new Promise((resolve, reject) => { |
| | | if(!state.isOverSize){ |
| | | ElMessageBox.confirm('此操作将删除该图片, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | // console.log(state.workDetail.gbPath,'path') |
| | | const list = JSON.parse(JSON.stringify(state.form.workDetail.gbPath)) |
| | | fileList.map((item,index)=>{ |
| | | if(item.uid === file.uid){ |
| | | fileList.splice(index,1) |
| | | state.form.workDetail.gbPath.splice(index,1) |
| | | // 请求删除接口 |
| | | deletePic(false,list[index]) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | reject(false); |
| | | }); |
| | | }else{ |
| | | const list = JSON.parse(JSON.stringify(state.form.workDetail.gbPath)) |
| | | fileList.map((item,index)=>{ |
| | | if(item.uid === file.uid){ |
| | | fileList.splice(index,1) |
| | | state.form.workDetail.gbPath.splice(index,1) |
| | | deletePic(true,list[index]) |
| | | } |
| | | }) |
| | | state.isOverSize = false |
| | | } |
| | | }); |
| | | return result; |
| | | }; |
| | | |
| | | |
| | | // 删除图片接口 |
| | | const deletePic = async(isOverSize:boolean,fileName:string)=>{ |
| | | const res = await workApplyApi().deleteFile({fileName: fileName}) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: isOverSize ? 'error' : 'success', |
| | | message: isOverSize ? '上传失败':'删除成功!' |
| | | }); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | |
| | | const showTip =()=>{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '超出文件上传数量' |
| | | }); |
| | | } |
| | | |
| | | // const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => { |
| | | // 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) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | Plus, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | handlePreview, |
| | | getUploadUrl, |
| | | beforeRemove, |
| | | upload, |
| | | showTip, |
| | | submitForm, |
| | | handlePictureCardPreview, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .avatar-uploader .avatar { |
| | | width: 178px; |
| | | height: 178px; |
| | | display: block; |
| | | } |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | :deep(.el-cascader){ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed var(--el-border-color); |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | overflow: hidden; |
| | | transition: var(--el-transition-duration-fast); |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: var(--el-color-primary); |
| | | } |
| | | |
| | | .el-icon.avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 178px; |
| | | height: 178px; |
| | | text-align: center; |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业等级" prop="workLevel"> |
| | | <el-select v-model="form.workLevel"> |
| | | <el-option |
| | | v-for="item in workLevelList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed"/> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业单位" prop="workDetail.operationDepId"> |
| | | <!-- <el-select v-model="form.workDetail.operationDepId">--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in heDepList"--> |
| | | <!-- :key="item.value"--> |
| | | <!-- :label="item.label"--> |
| | | <!-- :value="item.value"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <el-cascader v-model="form.workDetail.operationDepId" :options="departList" :props="casProps" :show-all-levels="false" @change="handleChange" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业高度" prop="workDetail.operationHeight"> |
| | | <el-input |
| | | v-model="form.workDetail.operationHeight" |
| | | type="number" |
| | | placeholder="请输入" |
| | | > |
| | | <template #append>米(m)</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联作业" prop="workDetail.otherSpecialWork"> |
| | | <el-select v-model="form.workDetail.otherSpecialWork" multiple> |
| | | <el-option |
| | | v-for="item in otherWorkList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import type { FormInstance, FormRules } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | |
| | | |
| | | interface stateType { |
| | | equipmentDialog: boolean, |
| | | form: Object, |
| | | workTypeList: Array<any>, |
| | | workLevelList: Array<any>, |
| | | heDepList: Array<any>, |
| | | otherWorkList: Array<any>, |
| | | casProps:{}, |
| | | materialList: Array<any> |
| | | } |
| | | export default defineComponent({ |
| | | name: 'heightForm', |
| | | components: {}, |
| | | props:['workerList','departList'], |
| | | setup() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 6, |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | operationDepId: '', |
| | | operationHeight: null, |
| | | otherSpecialWork: [] |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | heDepList: [ |
| | | { |
| | | label: "单位一", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "单位二", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "单位三", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "单位四", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "单位五", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "单位六", |
| | | value: 6 |
| | | } |
| | | ], |
| | | materialList: [], |
| | | casProps: { |
| | | emitPath: false, |
| | | value: 'depId', |
| | | label: 'depName', |
| | | multiple: false, |
| | | expandTrigger: 'hover', |
| | | checkStrictly: true |
| | | }, |
| | | workTypeList: [ |
| | | { |
| | | label: "类型一", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "类型二", |
| | | value: 2 |
| | | } |
| | | ], |
| | | workLevelList: [ |
| | | { |
| | | label: "一级高处作业", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "二级高处作业", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "三级高处作业", |
| | | value: 6 |
| | | }, |
| | | { |
| | | label: "特级高处作业", |
| | | value: 7 |
| | | } |
| | | ], |
| | | otherWorkList: [ |
| | | { |
| | | label: "动火作业", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "受限空间作业", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "吊装作业", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "动土作业", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "断路作业", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "高处作业", |
| | | value: 6 |
| | | }, |
| | | { |
| | | label: "临时用电作业", |
| | | value: 7 |
| | | }, |
| | | { |
| | | label: "盲板抽堵作业", |
| | | value: 8 |
| | | } |
| | | ] |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.operationDepId": [{ 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 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)) |
| | | data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',') |
| | | const res = await workApplyApi().postHeightApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } 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) => { |
| | | Session.set('projectId',value) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | :deep(.el-cascader){ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业等级" prop="workLevel"> |
| | | <el-select v-model="form.workLevel"> |
| | | <el-option |
| | | v-for="item in workLevelList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed"/> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="吊装工具名称" prop="workDetail.hoistingToolName"> |
| | | <el-input |
| | | v-model="form.workDetail.hoistingToolName" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="起吊物体质量" prop="workDetail.weightMass"> |
| | | <el-input |
| | | v-model="form.workDetail.weightMass" |
| | | type="number" |
| | | placeholder="请输入" |
| | | > |
| | | <template #append>吨(t)</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import type { FormInstance, FormRules } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | |
| | | |
| | | interface stateType { |
| | | equipmentDialog: boolean, |
| | | form: Object, |
| | | workLevelList: Array<any>, |
| | | materialList: Array<any> |
| | | } |
| | | export default defineComponent({ |
| | | name: 'hoistForm', |
| | | components: {}, |
| | | props:['workerList'], |
| | | setup() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 3, |
| | | workLevel: null, |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | hoistingToolName: '', |
| | | weightMass: null |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | materialList: [], |
| | | workLevelList: [ |
| | | { |
| | | label: "一级吊装作业", |
| | | value: 8 |
| | | }, |
| | | { |
| | | label: "二级吊装作业", |
| | | value: 9 |
| | | }, |
| | | { |
| | | label: "三级吊装作业", |
| | | value: 10 |
| | | } |
| | | ] |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.hoistingToolName": [{ 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 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)) |
| | | data.workDetail.weightMass = Number(data.workDetail.weightMass) |
| | | const res = await workApplyApi().postHoistApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } 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 = ()=>{ |
| | | |
| | | } |
| | | |
| | | // 折线图 |
| | | const renderMenu = async (value: string) => { |
| | | Session.set('projectId',value) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | .el-cascader{ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业等级" prop="workLevel"> |
| | | <el-select v-model="form.workLevel"> |
| | | <el-option |
| | | v-for="item in workLevelList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed"/> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="盲板编号" prop="workDetail.bpCode"> |
| | | <el-input |
| | | v-model="form.workDetail.bpCode" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="主要介质" prop="workDetail.mainMedia"> |
| | | <el-input |
| | | v-model="form.workDetail.mainMedia" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="温度" prop="workDetail.temperature"> |
| | | <el-input |
| | | v-model="form.workDetail.temperature" |
| | | type="number" |
| | | placeholder="请输入" |
| | | > |
| | | <template #append>摄氏度(℃)</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="压力" prop="workDetail.pressure"> |
| | | <el-input |
| | | v-model="form.workDetail.pressure" |
| | | type="number" |
| | | placeholder="请输入" |
| | | > |
| | | <template #append>千帕(kPa)</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="盲板材质" prop="workDetail.bpMaterialQuality"> |
| | | <el-input |
| | | v-model="form.workDetail.bpMaterialQuality" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="盲板规格" prop="workDetail.bpSpecification"> |
| | | <el-input |
| | | v-model="form.workDetail.bpSpecification" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="盲板时间" prop="workDetail.installLine"> |
| | | <el-date-picker |
| | | v-model="form.workDetail.installLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="--" |
| | | start-placeholder="装盲板时间" |
| | | end-placeholder="拆盲板时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="盲板位置" prop="workDetail.bpLocation"> |
| | | <el-input |
| | | v-model="form.workDetail.bpLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联作业" prop="workDetail.otherSpecialWork"> |
| | | <el-select v-model="form.workDetail.otherSpecialWork" multiple> |
| | | <el-option |
| | | v-for="item in otherWorkList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="盲板位置图" prop="workDetail.bpLocationMapPath"> |
| | | <el-upload accept="image/*" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='imgLimit' v-model:file-list="fileList" :http-request="upload" :action="uploadUrl" list-type="picture-card" :on-remove="handleRemove" :before-remove="beforeRemove" :before-upload="getUploadUrl"> |
| | | <el-icon><Plus /></el-icon> |
| | | <template #tip> |
| | | <div class="el-upload__tip">上传jpg/png图片尺寸小于500KB,最多可上传3张</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | <el-dialog v-model="dialogVisible"> |
| | | <img w-full :src="dialogImageUrl" alt="Preview Image" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import type { FormInstance, FormRules, UploadProps, UploadUserFile } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | import axios from 'axios'; |
| | | |
| | | interface stateType { |
| | | form: Object, |
| | | csDepList: Array<any>, |
| | | otherWorkList: Array<any>, |
| | | workLevelList: Array<any>, |
| | | fileList: Array<file>, |
| | | uploadUrl: string, |
| | | dialogVisible: Boolean, |
| | | dialogImageUrl: string | null, |
| | | imgLimit: number, |
| | | isOverSize: boolean, |
| | | equipmentDialog: boolean, |
| | | materialList: Array<any> |
| | | } |
| | | interface file { |
| | | url: string; |
| | | } |
| | | export default defineComponent({ |
| | | name: 'plateForm', |
| | | components: {}, |
| | | 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: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | bpCode: '', |
| | | mainMedia: '', |
| | | temperature: null, |
| | | pressure: null, |
| | | bpMaterialQuality: '', |
| | | bpSpecification: '', |
| | | bpLocation: '', |
| | | bpLocationMapPath: [], |
| | | installLine: [], |
| | | installBpTime: '', |
| | | uninstallBpTime: '', |
| | | otherSpecialWork: [] |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | isOverSize: false, |
| | | fileList: [], |
| | | imgLimit: 3, |
| | | uploadUrl: '', |
| | | dialogVisible: false, |
| | | dialogImageUrl: null, |
| | | workLevelList: [ |
| | | { |
| | | label: "抽盲板作业", |
| | | value: 11 |
| | | }, |
| | | { |
| | | label: "堵盲板作业", |
| | | value: 12 |
| | | } |
| | | ], |
| | | csDepList: [ |
| | | { |
| | | label: "单位一", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "单位二", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "单位三", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "单位四", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "单位五", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "单位六", |
| | | value: 6 |
| | | } |
| | | ], |
| | | otherWorkList: [ |
| | | { |
| | | label: "动火作业", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "受限空间作业", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "吊装作业", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "动土作业", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "断路作业", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "高处作业", |
| | | value: 6 |
| | | }, |
| | | { |
| | | label: "临时用电作业", |
| | | value: 7 |
| | | }, |
| | | { |
| | | label: "盲板抽堵作业", |
| | | value: 8 |
| | | } |
| | | ] |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.bpCode": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.mainMedia": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.temperature": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.pressure": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.bpMaterialQuality": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.bpSpecification": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.installLine": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.bpLocation": [{ 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 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] |
| | | state.form.workDetail.uninstallBpTime = JSON.parse(JSON.stringify(state.form.workDetail.installLine))[1] |
| | | let { workTimeLine, ...data } = JSON.parse(JSON.stringify(state.form)) |
| | | let { installLine, ...data2 } = JSON.parse(JSON.stringify(state.form.workDetail)) |
| | | data.workDetail = data2 |
| | | data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',') |
| | | data.workDetail.bpLocationMapPath = data.workDetail.bpLocationMapPath.join(',') |
| | | data.workDetail.temperature = Number(data.workDetail.temperature) |
| | | data.workDetail.pressure = Number(data.workDetail.pressure) |
| | | const res = await workApplyApi().postPlateApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | state.form.workDetail.bpLocationMapPath = [] |
| | | state.fileList = [] |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | } |
| | | }) |
| | | } |
| | | const handlePreview: UploadProps['onPreview'] = (uploadFile) => { |
| | | console.log(uploadFile); |
| | | }; |
| | | |
| | | const handlePictureCardPreview = (uploadFile: { url: string }) => { |
| | | state.dialogImageUrl = uploadFile.url!; |
| | | state.dialogVisible = true; |
| | | }; |
| | | |
| | | const getUploadUrl = async (rawFile: any) => { |
| | | const fileSize = rawFile.size / 1024 < 500 ? '1' : '0' |
| | | if(fileSize === '0'){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件大小不能超过500k。' |
| | | }); |
| | | state.isOverSize = true |
| | | return false |
| | | }else{ |
| | | const res = await workApplyApi().getUploadUrl(rawFile.name); |
| | | state.form.workDetail.bpLocationMapPath.push(res.data.data.fileName) |
| | | state.uploadUrl = res.data.data.uploadUrl; |
| | | console.log(res.data.data.fileName,'name') |
| | | } |
| | | }; |
| | | |
| | | const upload = async (params: any) => { |
| | | // const formData = new FormData(); |
| | | // formData.append('file', state.fileList[0].raw); |
| | | let reader = new FileReader(); |
| | | reader.readAsArrayBuffer(params.file); |
| | | reader.onload = async () => { |
| | | axios |
| | | .put(state.uploadUrl, reader.result, { |
| | | header: { 'Content-Type': 'multipart/form-data' } |
| | | }) |
| | | .then(() => { |
| | | // if (state.fileList.length === 2) { |
| | | // state.fileList.splice(0, 1); |
| | | // } |
| | | // console.log(state.form.workDetail.bpLocationMapPath,'bpLocationMapPath') |
| | | }); |
| | | }; |
| | | }; |
| | | |
| | | const beforeRemove = (file: {}, fileList: []) => { |
| | | const result = new Promise((resolve, reject) => { |
| | | if(!state.isOverSize){ |
| | | ElMessageBox.confirm('此操作将删除该图片, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | // console.log(state.workDetail.bpLocationMapPath,'path') |
| | | const list = JSON.parse(JSON.stringify(state.form.workDetail.bpLocationMapPath)) |
| | | fileList.map((item,index)=>{ |
| | | if(item.uid === file.uid){ |
| | | fileList.splice(index,1) |
| | | state.form.workDetail.bpLocationMapPath.splice(index,1) |
| | | deletePic(false,list[index]) |
| | | } |
| | | }) |
| | | // 请求删除接口 |
| | | }) |
| | | .catch(() => { |
| | | reject(false); |
| | | }); |
| | | }else{ |
| | | const list = JSON.parse(JSON.stringify(state.form.workDetail.bpLocationMapPath)) |
| | | fileList.map((item,index)=>{ |
| | | if(item.uid === file.uid){ |
| | | fileList.splice(index,1) |
| | | state.form.workDetail.bpLocationMapPath.splice(index,1) |
| | | deletePic(true,list[index]) |
| | | } |
| | | }) |
| | | state.isOverSize = false |
| | | } |
| | | }); |
| | | return result; |
| | | }; |
| | | |
| | | |
| | | // 删除图片接口 |
| | | const deletePic = async(isOverSize:boolean,fileName:string)=>{ |
| | | console.log(fileName,'fileName') |
| | | const res = await workApplyApi().deleteFile({fileName: fileName}) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: isOverSize ? 'error' : 'success', |
| | | message: isOverSize ? '上传失败':'删除成功!' |
| | | }); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | const showTip =()=>{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '超出文件上传数量' |
| | | }); |
| | | } |
| | | |
| | | // 确认物资标准 |
| | | 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) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | handlePreview, |
| | | getUploadUrl, |
| | | beforeRemove, |
| | | upload, |
| | | showTip, |
| | | submitForm, |
| | | handlePictureCardPreview, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | .el-cascader{ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed"/> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="电源接入点" prop="workDetail.powerAccessPoint"> |
| | | <el-input |
| | | v-model="form.workDetail.powerAccessPoint" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工作电压" prop="workDetail.workingVoltage"> |
| | | <el-input |
| | | v-model="form.workDetail.workingVoltage" |
| | | type="number" |
| | | placeholder="请输入" |
| | | > |
| | | <template #append>伏特(v)</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="用电设备及功率" prop="workDetail.equipmentAndPower"> |
| | | <el-input |
| | | v-model="form.workDetail.equipmentAndPower" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import type { FormInstance, FormRules } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | |
| | | |
| | | interface stateType { |
| | | form: Object, |
| | | workLevelList: Array<any>, |
| | | equipmentDialog: boolean, |
| | | materialList: Array<any> |
| | | } |
| | | export default defineComponent({ |
| | | name: 'powerForm', |
| | | components: {}, |
| | | 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: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | powerAccessPoint: '', |
| | | workingVoltage: null, |
| | | equipmentAndPower: '' |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | workLevelList: [ |
| | | { |
| | | label: "一级吊装作业", |
| | | value: 8 |
| | | }, |
| | | { |
| | | label: "二级吊装作业", |
| | | value: 9 |
| | | }, |
| | | { |
| | | label: "三级吊装作业", |
| | | value: 10 |
| | | } |
| | | ] |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.powerAccessPoint": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.workingVoltage": [{ 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 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)) |
| | | // data.workDetail.weightMass = Number(data.workDetail.weightMass) |
| | | const res = await workApplyApi().postPowerApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } 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) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | .el-cascader{ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef"> |
| | | <div class="homeCard"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业人" prop="operatorUids"> |
| | | <el-select v-model="form.operatorUids" multiple> |
| | | <el-option |
| | | v-for="item in workerList" |
| | | :key="item.uid" |
| | | :label="item.username" |
| | | :value="item.uid" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业时间" prop="workTimeLine"> |
| | | <el-date-picker |
| | | v-model="form.workTimeLine" |
| | | format="YYYY-MM-DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm:00" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业内容" prop="workContent"> |
| | | <el-input |
| | | v-model="form.workContent" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业内容" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="作业地址" prop="workLocation"> |
| | | <el-input |
| | | v-model="form.workLocation" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入作业地址" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="危害辨识" prop="hazardIdentification"> |
| | | <el-input |
| | | v-model="form.hazardIdentification" |
| | | placeholder="请输入危害辨识" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider border-style="dashed" /> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="受限空间所属单位" prop="workDetail.csDepId"> |
| | | <!-- <el-select v-model="form.workDetail.csDepId">--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in csDepList"--> |
| | | <!-- :key="item.value"--> |
| | | <!-- :label="item.label"--> |
| | | <!-- :value="item.value"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <el-cascader v-model="form.workDetail.csDepId" :options="departList" :props="casProps" :show-all-levels="false" @change="handleChange" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="受限空间名称" prop="workDetail.csName"> |
| | | <el-input |
| | | v-model="form.workDetail.csName" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="空间内原有介质" prop="workDetail.csOriginalName"> |
| | | <el-input |
| | | v-model="form.workDetail.csOriginalName" |
| | | autosize |
| | | type="textarea" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联作业" prop="workDetail.otherSpecialWork"> |
| | | <el-select v-model="form.workDetail.otherSpecialWork" multiple> |
| | | <el-option v-for="item in otherWorkList" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择关联物资"> |
| | | <el-button type="primary" @click="getMaList">选择物资标准</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <el-dialog v-model="equipmentDialog" title="关联物资标准" width="40%" center @close="closeMaterial"> |
| | | <el-tabs tab-position="left" class="demo-tabs" type="border-card"> |
| | | <el-tab-pane v-for="(item,index) in materialList" :label="item.materialTypeName" :key="index"> |
| | | <div style="margin-bottom: 20px"> |
| | | <el-form label-width="150px" label-position="top"> |
| | | <div v-if="item.mustList.length>0" style="width: 100%;border-bottom: 1px solid #ccc;padding-bottom: 6px;margin-bottom: 10px;font-weight: bolder">必选</div> |
| | | <el-form-item v-if="item.mustList.length>0" class="tab-i" v-for="(i,x) in item.mustList" :key="x" :label="item.mustList[x].materialName + ':'" prop="defaultVal" :rules="[{ type: 'defaultVal', required: true, message: '该内容不能为空', trigger: 'blur'}]"> |
| | | <el-input size="default" type="number" v-model="item.mustList[x].value" @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> |
| | | <div class="applyBtn"> |
| | | <el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import type { FormInstance, FormRules } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | |
| | | |
| | | interface stateType { |
| | | form: Object, |
| | | csDepList: Array<any>, |
| | | otherWorkList: Array<any>, |
| | | casProps: {}, |
| | | equipmentDialog: boolean, |
| | | materialList: Array<any> |
| | | } |
| | | export default defineComponent({ |
| | | name: 'spaceForm', |
| | | components: {}, |
| | | props:['workerList','departList'], |
| | | setup() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | equipmentDialog: false, |
| | | materialList: [], |
| | | form: { |
| | | operatorUids: [], |
| | | workType: 2, |
| | | workLevel: 0, |
| | | workContent: '', |
| | | workLocation: '', |
| | | hazardIdentification: '', |
| | | workDetail:{ |
| | | csDepId: null, |
| | | csName: '', |
| | | csOriginalName: '', |
| | | otherSpecialWork: [] |
| | | }, |
| | | wmAddReqDTOList: [], |
| | | workTimeLine: [], |
| | | expStartTime: '', |
| | | expEndTime: '' |
| | | }, |
| | | csDepList: [ |
| | | { |
| | | label: "单位一", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "单位二", |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: "单位三", |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: "单位四", |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: "单位五", |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: "单位六", |
| | | value: 6 |
| | | } |
| | | ], |
| | | casProps: { |
| | | emitPath: false, |
| | | value: 'depId', |
| | | label: 'depName', |
| | | multiple: false, |
| | | expandTrigger: 'hover', |
| | | checkStrictly: true |
| | | }, |
| | | otherWorkList: [ |
| | | { |
| | | label: '动火作业', |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: '受限空间作业', |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: '吊装作业', |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: '动土作业', |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: '断路作业', |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: '高处作业', |
| | | value: 6 |
| | | }, |
| | | { |
| | | label: '临时用电作业', |
| | | value: 7 |
| | | }, |
| | | { |
| | | label: '盲板抽堵作业', |
| | | value: 8 |
| | | } |
| | | ] |
| | | }); |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const applyRules = reactive<FormRules>({ |
| | | operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.csDepId": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], |
| | | "workDetail.csName": [{ 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 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)) |
| | | data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',') |
| | | console.log(data,'data') |
| | | const res = await workApplyApi().postSpaceApply(data) |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | formEl.resetFields() |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | state.materialList = [] |
| | | } 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) => { |
| | | Session.set('projectId',value) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | return { |
| | | renderMenu, |
| | | Search, |
| | | ruleFormRef, |
| | | applyRules, |
| | | toZero, |
| | | getMaList, |
| | | conFirmDevices, |
| | | closeMaterial, |
| | | submitForm, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | padding-top: 15px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | :deep(.el-cascader){ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <el-tabs type="border-card"> |
| | | <el-tab-pane label="动火作业"> |
| | | <fire-form :workerList = allWorkers></fire-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="受限空间作业"> |
| | | <space-form :workerList = allWorkers :departList = departmentList></space-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="吊装作业"> |
| | | <hoist-form :workerList = allWorkers></hoist-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="动土作业"> |
| | | <ground-form :workerList = allWorkers :departList = departmentList></ground-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="断路作业"> |
| | | <broken-form :workerList = allWorkers :departList = departmentList></broken-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="高处作业"> |
| | | <height-form :workerList = allWorkers :departList = departmentList></height-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="临时用电作业"> |
| | | <power-form :workerList = allWorkers></power-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="盲板抽堵作业"> |
| | | <plate-form :workerList = allWorkers></plate-form> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import {toRefs, reactive, defineComponent, ref, defineAsyncComponent, onMounted} from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import type { FormInstance, FormRules } from 'element-plus' |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | import {teamManageApi} from "/@/api/systemManage/basicDateManage/personShiftManage/teamManage"; |
| | | |
| | | interface stateType { |
| | | allWorkers: Array<any> |
| | | departmentList: Array<any> |
| | | } |
| | | export default defineComponent({ |
| | | name: 'apply', |
| | | components: { |
| | | fireForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/fire.vue')), |
| | | spaceForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/space.vue')), |
| | | hoistForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/hoist.vue')), |
| | | groundForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/ground.vue')), |
| | | brokenForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/broken.vue')), |
| | | heightForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/height.vue')), |
| | | powerForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/power.vue')), |
| | | plateForm: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/apply/components/plate.vue')) |
| | | }, |
| | | setup() { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const state = reactive<stateType>({ |
| | | allWorkers: [], |
| | | departmentList: [] |
| | | }); |
| | | |
| | | // 获取用户列表 |
| | | const getAll = async ()=>{ |
| | | const res = await workApplyApi().getAllUsers() |
| | | if (res.data.code === '200') { |
| | | state.allWorkers = JSON.parse(JSON.stringify(res.data.data)) |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 获取部门列表 |
| | | const getAllDepartment = async () => { |
| | | let res = await teamManageApi().getAllDepartment(); |
| | | if (res.data.code === '200') { |
| | | state.departmentList = JSON.parse(JSON.stringify(res.data.data)) |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 页面载入时执行方法 |
| | | onMounted(() => { |
| | | getAll(); |
| | | getAllDepartment(); |
| | | }); |
| | | |
| | | return { |
| | | ...toRefs(state), |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | position: relative; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .applyBtn{ |
| | | width: 100%; |
| | | background: #fff; |
| | | height: 80px; |
| | | z-index: 5; |
| | | box-shadow: 0 -3px 8px rgba(150,150,150,.1); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-row:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | .el-date-editor::v-deep{ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | .el-cascader{ |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |