| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="巡检任务类型" prop="type"> |
| | | <el-select v-model="inspectionTaskForm.type" class="analyseUnit_input"> |
| | | <el-select v-model="inspectionTaskForm.type" class="analyseUnit_input" :disabled="ifShow"> |
| | | <el-option |
| | | v-for="item in typeList" |
| | | :key="item.id" |
| | |
| | | <div class="inspectionTask_point"> |
| | | <el-tabs class="active" v-model="activeName"> |
| | | <el-tab-pane label="巡检点信息" name="inspectionPoint"> |
| | | <inspection-point @giveToForm="receiveToForm" ref="inspectionPoint"></inspection-point> |
| | | <inspection-point @giveToForm="receiveToForm" ref="inspectionPoint" :title="title" :inspectionTaskForm="inspectionTaskForm"></inspection-point> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | |
| | | data() { |
| | | return { |
| | | tableKey: 0, |
| | | ifShow:true, |
| | | activeName:'inspectionPoint', |
| | | inspectionTaskData: [], |
| | | departmentList:[], |
| | |
| | | } |
| | | }, |
| | | showAnalyseUnitForm(value,type){ |
| | | debugger |
| | | this.inspectionTaskVisible = true |
| | | this.$nextTick(() =>{ |
| | | this.$refs["inspectionTaskForm"].clearValidate() |
| | | }) |
| | | if(type === '新增'){ |
| | | this.ifShow = false |
| | | this.title = '新建巡检计划设定' |
| | | this.noticeDepartment = '' |
| | | this.execDepartment = '' |
| | | this.inspectionTaskForm = { |
| | | type:null, |
| | | createUid: parseInt(Cookies.get('userId')), |
| | |
| | | setTimeout(() => { |
| | | this.$refs.inspectionPoint.inspectionPointData = [] |
| | | }); |
| | | }else{ |
| | | }else{ |
| | | this.ifShow = true |
| | | this.title = '编辑巡检计划设定' |
| | | this.noticeDepartment = this.handleDepartment(JSON.parse(JSON.stringify(value)).noticeUid) |
| | | this.changeNotice() |
| | | this.execDepartment = this.handleDepartment(JSON.parse(JSON.stringify(value)).execUid) |
| | | this.changeExec() |
| | | this.inspectionTaskForm = JSON.parse(JSON.stringify(value)) |
| | | // this.inspectionTaskForm.execUid = value.execUname |
| | | // this.inspectionTaskForm.noticeUid = value.noticeUname |
| | | setTimeout(() => { |
| | | this.$refs.inspectionPoint.inspectionPointData = this.inspectionTaskForm.checkContents |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | handleDepartment(value){ |
| | | let department = '' |
| | | for(let i in this.userList){ |
| | | if(this.userList[i].id === value){ |
| | | department = this.userList[i].department |
| | | } |
| | | } |
| | | department = this.departmentList.find(item => item.department === department) |
| | | return department.department |
| | | }, |
| | | submitAnalyseUnit(){ |
| | | this.$refs["inspectionTaskForm"].validate((valid) =>{ |
| | | if(valid){ |
| | | if(this.title === '新建巡检计划设定'){ |
| | | addInspectionTask(this.inspectionTaskForm).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.inspectionTaskVisible = false |
| | | this.getInspectionTaskData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | message:'新增成功', |
| | | title:'成功' |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | if(this.inspectionTaskForm.noticeSeconds >= this.inspectionTaskForm.intervalSeconds){ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:'提前通知时间不能大于检查频次' |
| | | }) |
| | | }else if(this.inspectionTaskForm.intervalSeconds <= this.inspectionTaskForm.effectSeconds){ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:'任务持续时间不能大于检查频次' |
| | | }) |
| | | }else{ |
| | | updateInspectionTask(this.inspectionTaskForm).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.inspectionTaskVisible = false |
| | | this.getInspectionTaskData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | title:'成功', |
| | | message:'编辑成功' |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | }) |
| | | if(this.title === '新建巡检计划设定'){ |
| | | addInspectionTask(this.inspectionTaskForm).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.inspectionTaskVisible = false |
| | | this.getInspectionTaskData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | message:'新增成功', |
| | | title:'成功' |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | }) |
| | | }else{ |
| | | updateInspectionTask({ |
| | | effectSeconds: this.inspectionTaskForm.effectSeconds, |
| | | execUid: this.inspectionTaskForm.execUid, |
| | | intervalSeconds: this.inspectionTaskForm.intervalSeconds, |
| | | noticeSeconds: this.inspectionTaskForm.noticeSeconds, |
| | | noticeUid: this.inspectionTaskForm.noticeUid, |
| | | startTime: this.inspectionTaskForm.startTime, |
| | | status: this.inspectionTaskForm.status, |
| | | workId: this.inspectionTaskForm.workId |
| | | }).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.inspectionTaskVisible = false |
| | | this.getInspectionTaskData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | title:'成功', |
| | | message:'编辑成功' |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | |
| | | }) |
| | | }, |
| | | receiveToForm(value) { |
| | | debugger |
| | | this.inspectionTaskForm.riskControlMeasureIdList = [] |
| | | this.inspectionTaskForm.riskControlMeasureIdList = value.map( item => { |
| | | return item.id |