From fe2617a36f52c16f83e7d3cb19d911bb91a3b79f Mon Sep 17 00:00:00 2001 From: lyfO_o <764716047@qq.com> Date: 星期一, 13 六月 2022 09:00:28 +0800 Subject: [PATCH] 删除固定菜单 --- src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue | 230 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 152 insertions(+), 78 deletions(-) diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue index ccebb06..3bbd25f 100644 --- a/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue +++ b/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue @@ -22,7 +22,7 @@ </div> <div class="basic_search"> <span>巡检任务状态:</span> - <el-select v-model="listQuery.status"> + <el-select v-model="listQuery.status" clearable> <el-option v-for="item in statusList" :key="item.id" @@ -42,17 +42,17 @@ ></el-option> </el-select> </div> - <div class="basic_search"> - <span>异常通知人员:</span> - <el-select v-model="listQuery.noticeUid" filterable clearable> - <el-option - v-for="item in userList" - :key="item.id" - :value="item.id" - :label="item.realname" - ></el-option> - </el-select> - </div> +<!-- <div class="basic_search">--> +<!-- <span>异常通知人员:</span>--> +<!-- <el-select v-model="listQuery.noticeUid" filterable clearable>--> +<!-- <el-option--> +<!-- v-for="item in userList"--> +<!-- :key="item.id"--> +<!-- :value="item.id"--> +<!-- :label="item.realname"--> +<!-- ></el-option>--> +<!-- </el-select>--> +<!-- </div>--> <div class="basic_search"> <span>执行巡检人员:</span> <el-select v-model="listQuery.execUid" filterable clearable> @@ -96,18 +96,29 @@ </el-table-column> <el-table-column label="任务开始时间" prop="startTime" align="center"> </el-table-column> - <el-table-column label="异常通知人" prop="noticeUname" align="center"> - </el-table-column> +<!-- <el-table-column label="异常通知人" prop="noticeUname" align="center">--> +<!-- </el-table-column>--> <el-table-column label="巡检人" prop="execUname" align="center"> </el-table-column> <el-table-column label="创建人" prop="createUname" align="center"> </el-table-column> <el-table-column label="创建时间" prop="createTime" align="center"> </el-table-column> + <el-table-column label="状态" prop="createTime" align="center"> + <template slot-scope="scope"> + <div v-for="item in statusList"> + <div v-show="scope.row.status === item.id"> + <el-tag :type="scope.row.status === 1 ? 'primary' : (scope.row.status === 2 ? 'warning' : (scope.row.status === 3 ? 'danger' : 'info'))">{{item.name}}</el-tag> + </div> + </div> + </template> + </el-table-column> <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button type="text" @click="showAnalyseUnitForm(scope.row,'编辑')">编辑</el-button> <el-button type="text" style="color: red" @click="deleteById(scope.row)">删除</el-button> + <el-button type="text" @click="openTask(scope.row,'编辑')">开启</el-button> + <el-button type="text" style="color: red" @click="closeTask(scope.row)">关闭</el-button> </template> </el-table-column> </el-table> @@ -123,7 +134,7 @@ style="float:right;" @size-change="handleSizeChange" @current-change="handleCurrentChange" - /> + /> <br> </div> @@ -202,32 +213,32 @@ </el-form-item> </el-col> </el-row> - <el-row> - <el-col :span="12"> - <el-form-item label="异常通知部门" prop="noticeDepartment"> - <el-select v-model="noticeDepartment" class="analyseUnit_input" filterable clearable @change="changeNotice"> - <el-option - v-for="item in departmentList" - :key="item.id" - :value="item.department" - :label="item.department" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="异常通知人员" prop="noticeUid"> - <el-select v-model="inspectionTaskForm.noticeUid" filterable clearable class="analyseUnit_input"> - <el-option - v-for="item in noticeUidList" - :key="item.id" - :value="item.id" - :label="item.realname" - ></el-option> - </el-select> - </el-form-item> - </el-col> - </el-row> +<!-- <el-row>--> +<!-- <el-col :span="12">--> +<!-- <el-form-item label="异常通知部门" prop="noticeDepartment">--> +<!-- <el-select v-model="noticeDepartment" class="analyseUnit_input" filterable clearable @change="changeNotice">--> +<!-- <el-option--> +<!-- v-for="item in departmentList"--> +<!-- :key="item.id"--> +<!-- :value="item.department"--> +<!-- :label="item.department"--> +<!-- ></el-option>--> +<!-- </el-select>--> +<!-- </el-form-item>--> +<!-- </el-col>--> +<!-- <el-col :span="12">--> +<!-- <el-form-item label="异常通知人员" prop="noticeUid">--> +<!-- <el-select v-model="inspectionTaskForm.noticeUid" filterable clearable class="analyseUnit_input">--> +<!-- <el-option--> +<!-- v-for="item in noticeUidList"--> +<!-- :key="item.id"--> +<!-- :value="item.id"--> +<!-- :label="item.realname"--> +<!-- ></el-option>--> +<!-- </el-select>--> +<!-- </el-form-item>--> +<!-- </el-col>--> +<!-- </el-row>--> <el-row> <el-col :span="12"> <el-form-item label="执行巡检部门" prop="execDepartment"> @@ -281,7 +292,12 @@ import { mapGetters } from 'vuex' import { computePageCount } from '@/utils' import inspectionPoint from './components/inpectionPoint' - import { getInspectionTask , addInspectionTask, updateInspectionTask} from "../../../../api/inspectionTask"; + import { + getInspectionTask, + addInspectionTask, + updateInspectionTask, + deleteInspectionTask, closeInspectionTask + } from "../../../../api/inspectionTask"; import {getAllDepartment, getDepartmentList} from "../../../../api/departmentManage"; import {safetyInspectionItemName} from "../../../../api/safetySelfInspection"; export default { @@ -324,10 +340,10 @@ inspectionTaskData: [], departmentList:[], userList:[], - noticeUidList:[], + // noticeUidList:[], execUidList:[], - statusList:[{name:'任务开启',id:1},{id:2,name:'任务关闭'}], - intervalSecondsList:[{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'},{id:17280,name:'2天'}], + statusList:[{name:'任务开启',id:1},{id:2,name:'任务关闭'},{id:3,name:'删除'},{id:4,name:'过期'}], + intervalSecondsList:[{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:28800,name:'8小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'},{id:17280,name:'2天'},{id:604800,name:'每周'},{id:2592000,name:'每月'},{id:7862400,name:'每季度'}], noticeSecondsList:[{id:600,name:'10分'},{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'}], effectSecondsList:[{id:1800,name:'30分'},{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'}], typeList:[{id:1,name:'日常检查'},{id:2,name:'周期检查'}], @@ -339,7 +355,7 @@ title:'', company:'', code:'', - noticeDepartment:'', + // noticeDepartment:'', execDepartment:'', inspectionTaskVisible:false, inspectionTaskFormRules:{ @@ -359,7 +375,7 @@ execUid: null, intervalSeconds: null, noticeSeconds: null, - noticeUid: null, + // noticeUid: null, title:'', riskControlMeasureIdList: [ ], @@ -369,13 +385,12 @@ createUid: "", endTime: "", execUid: "", - noticeUid: "", startTime: "", status:"", type: "", page: 1, pageSize: 10, - + }, } }, @@ -413,13 +428,13 @@ }) } }, - changeNotice(){ - if(this.noticeDepartment === '') { - this.noticeUidList = [] - this.inspectionTaskForm.noticeUid = '' - } - this.noticeUidList = this.userList.filter( item => item.department === this.noticeDepartment) - }, + // changeNotice(){ + // if(this.noticeDepartment === '') { + // this.noticeUidList = [] + // this.inspectionTaskForm.noticeUid = '' + // } + // this.noticeUidList = this.userList.filter( item => item.department === this.noticeDepartment) + // }, changeExec(){ if(this.execDepartment === '') { this.execUidList = [] @@ -446,7 +461,7 @@ if(type === '新增'){ this.ifShow = false this.title = '新建巡检计划设定' - this.noticeDepartment = '' + // this.noticeDepartment = '' this.execDepartment = '' this.inspectionTaskForm = { type:null, @@ -455,7 +470,7 @@ execUid: null, intervalSeconds: null, noticeSeconds: null, - noticeUid: null, + // noticeUid: null, title:'', riskControlMeasureIdList: [ ], @@ -468,17 +483,17 @@ }else{ this.ifShow = true this.title = '编辑巡检计划设定' - this.noticeDepartment = this.handleDepartment(JSON.parse(JSON.stringify(value)).noticeUid) - this.changeNotice() + // 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.execUid = value.execUid // this.inspectionTaskForm.noticeUid = value.noticeUname setTimeout(() => { this.$refs.inspectionPoint.inspectionPointData = this.inspectionTaskForm.checkContents this.$refs.inspectionPoint.ifEdit = true - }); + }); } }, handleDepartment(value){ @@ -534,10 +549,11 @@ execUid: this.inspectionTaskForm.execUid, intervalSeconds: this.inspectionTaskForm.intervalSeconds, noticeSeconds: this.inspectionTaskForm.noticeSeconds, - noticeUid: this.inspectionTaskForm.noticeUid, + // noticeUid: this.inspectionTaskForm.noticeUid, startTime: this.inspectionTaskForm.startTime, status: this.inspectionTaskForm.status, - workId: this.inspectionTaskForm.workId + workId: this.inspectionTaskForm.workId, + title: this.inspectionTaskForm.title }).then((res)=>{ if(res.data.code === '200'){ this.inspectionTaskVisible = false @@ -568,7 +584,6 @@ }, justifyTime(time,interval) { - debugger let timeStr = new Date(time.replace(/-/g,'/')) let date = parseInt(timeStr.getTime()/1000) let newTimeStr = new Date() @@ -579,29 +594,88 @@ return true } }, + + openTask(val,type){ + if(val.status !== 2){ + this.$message({ + type:'warning', + message:'当前状态不可开启' + }) + return + } + this.showAnalyseUnitForm(val,type) + this.inspectionTaskForm.status = 1 + }, + + closeTask(val){ + if(val.status !== 1){ + this.$message({ + type:'warning', + message:'当前状态不可关闭' + }) + return + } + this.$confirm('关闭此条任务,是否继续','提示',{ + confirmButtonText:'确定', + cancelButtonText:'取消', + type:'warning', + }).then(()=> { + closeInspectionTask(val.workId).then( (res)=>{ + if(res.data.code === '200'){ + this.getInspectionTaskData() + this.$notify({ + title:'成功', + message:'关闭成功', + type:'success', + duration:2000, + }) + }else{ + this.$message({ + type:'warning', + message:res.data.message + }) + } + }) + }) + }, + deleteById(val){ + if(val.status !== 2){ + this.$message({ + type:'warning', + message:'当前状态不可删除' + }) + return + } this.$confirm('删除此条信息,是否继续','提示',{ confirmButtonText:'确定', cancelButtonText:'取消', type:'warning', }).then(()=> { - deleteAnalyseUnit({id:val.id}).then( ()=>{ - this.getInspectionTaskData() - this.$notify({ - title:'成功', - message:'删除成功', - type:'success', - duration:2000, - }) + deleteInspectionTask(val.workId).then( (res)=>{ + if(res.data.code === '200'){ + this.getInspectionTaskData() + this.$notify({ + title:'成功', + message:'删除成功', + type:'success', + duration:2000, + }) + }else{ + this.$message({ + type:'warning', + message:res.data.message + }) + } }) }) }, receiveToForm(value) { - // this.inspectionTaskForm.riskControlMeasureIdList = [] - // this.inspectionTaskForm.riskControlMeasureIdList = value.map( item => { - // return item.id - // }) - this.inspectionTaskForm.riskControlMeasureIdList.push({id:value.id}) + this.inspectionTaskForm.riskControlMeasureIdList = [] + this.inspectionTaskForm.riskControlMeasureIdList = value.map( item => { + return item.id + }) + // this.inspectionTaskForm.riskControlMeasureIdList.push({id:value.id}) }, refreshHandle(){ this.getInspectionTaskData() -- Gitblit v1.9.2