| | |
| | | <div class="basic_search"> |
| | | <span>巡检任务类型:</span> |
| | | <el-select v-model="listQuery.type"> |
| | | <el-option |
| | | v-for="item in departmentList" |
| | | <el-option |
| | | v-for="item in typeList" |
| | | :key="item.id" |
| | | :value="item.department" |
| | | :label="item.department" |
| | | :value="item.id" |
| | | :label="item.name" |
| | | ></el-option> |
| | | </el-select> |
| | | </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 departmentList" |
| | | v-for="item in statusList" |
| | | :key="item.id" |
| | | :value="item.department" |
| | | :label="item.department" |
| | | :value="item.id" |
| | | :label="item.name" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="basic_search"> |
| | | <span>巡检任务创建人员:</span> |
| | | <el-select v-model="listQuery.createUid"> |
| | | <el-select v-model="listQuery.createUid" filterable clearable> |
| | | <el-option |
| | | v-for="item in departmentList" |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :value="item.department" |
| | | :label="item.department" |
| | | :value="item.id" |
| | | :label="item.realname" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="basic_search"> |
| | | <span>异常通知人员:</span> |
| | | <el-select v-model="listQuery.noticeUid"> |
| | | <el-option |
| | | v-for="item in departmentList" |
| | | :key="item.id" |
| | | :value="item.department" |
| | | :label="item.department" |
| | | ></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"> |
| | | <el-select v-model="listQuery.execUid" filterable clearable> |
| | | <el-option |
| | | v-for="item in departmentList" |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :value="item.department" |
| | | :label="item.department" |
| | | :value="item.id" |
| | | :label="item.realname" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> |
| | |
| | | highlight-current-row |
| | | style="width: 100%;" |
| | | > |
| | | <el-table-column label="任务名称" prop="hazardCode" align="center"> |
| | | <el-table-column label="任务名称" prop="title" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="检查类型" prop="hazardDep" align="center"> |
| | | <el-table-column label="检查类型" prop="type" align="center"> |
| | | <template slot-scope="scope"> |
| | | <div v-for="item in typeList"> |
| | | <div v-show="item.id === scope.row.type"> |
| | | {{ item.name }} |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="检查频次" prop="hazardLiablePerson" align="center"> |
| | | <el-table-column label="检查频次(小时)" prop="intervalSeconds" align="center"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.intervalSeconds | parseHours}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="任务开始时间" prop="riskUnitName" align="center"> |
| | | <el-table-column label="任务开始时间" prop="startTime" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="任务结束时间" prop="createBy" align="center"> |
| | | <!-- <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="createTime" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="巡检人" prop="updateBy" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="创建人" prop="createBy" align="center"> |
| | | <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="updateBy" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="最后修改时间" prop="updateTime" align="center"> |
| | | <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> |
| | | <br> |
| | | <el-pagination |
| | | v-show="recordTotal>0" |
| | | :current-page="currentPage" |
| | | :current-page="listQuery.page" |
| | | :page-sizes="[10, 20, 30, 50]" |
| | | :page-size="pageSize" |
| | | :page-size="listQuery.pageSize" |
| | | :total="recordTotal" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | background |
| | |
| | | <el-form ref="inspectionTaskForm" :rules="inspectionTaskFormRules" :model="inspectionTaskForm" label-position="right" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="任务名称" prop="hazardDep"> |
| | | <el-select v-model="inspectionTaskForm.hazardDep" class="analyseUnit_input"> |
| | | <el-option |
| | | v-for="item in departmentList" |
| | | :key="item.id" |
| | | :value="item.department" |
| | | :label="item.department" |
| | | ></el-option> |
| | | </el-select> |
| | | <el-form-item label="任务名称" prop="title"> |
| | | <el-input v-model="inspectionTaskForm.title" class="analyseUnit_input"> |
| | | </el-input> |
| | | </el-form-item> |
| | | </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" |
| | | :value="item.name" |
| | | :value="item.id" |
| | | :label="item.name" |
| | | ></el-option> |
| | | </el-select> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检查频次" prop="intervalSeconds"> |
| | | <el-input v-model="inspectionTaskForm.intervalSeconds" class="analyseUnit_input"></el-input> |
| | | <el-select v-model="inspectionTaskForm.intervalSeconds" class="analyseUnit_input"> |
| | | <el-option |
| | | v-for="item in intervalSecondsList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="提前通知时间" prop="noticeSeconds"> |
| | | <el-input v-model="inspectionTaskForm.noticeSeconds" class="analyseUnit_input"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="任务有效时间" prop="effectSeconds"> |
| | | <el-input v-model="inspectionTaskForm.effectSeconds" class="analyseUnit_input"></el-input> |
| | | </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-select v-model="inspectionTaskForm.noticeSeconds" class="analyseUnit_input"> |
| | | <el-option |
| | | v-for="item in departmentList" |
| | | v-for="item in noticeSecondsList" |
| | | :key="item.id" |
| | | :value="item.department" |
| | | :label="item.department" |
| | | ></el-option> |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | </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.realname" |
| | | :label="item.realname" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-form-item label="任务有效时间" prop="effectSeconds"> |
| | | <el-select v-model="inspectionTaskForm.effectSeconds" class="analyseUnit_input"> |
| | | <el-option |
| | | v-for="item in effectSecondsList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | </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"> |
| | |
| | | <el-option |
| | | v-for="item in execUidList" |
| | | :key="item.id" |
| | | :value="item.realname" |
| | | :value="item.id" |
| | | :label="item.realname" |
| | | ></el-option> |
| | | </el-select> |
| | |
| | | |
| | | <div class="inspectionTask_point"> |
| | | <el-tabs class="active" v-model="activeName"> |
| | | <el-tab-pane label="巡检点信息" name="inspectionPoint"> |
| | | <inspection-point ref="inspectionPoint"></inspection-point> |
| | | <el-tab-pane label="检查项信息" name="inspectionPoint"> |
| | | <inspection-point @giveToForm="receiveToForm" ref="inspectionPoint" :title="title" :inspectionTaskForm="inspectionTaskForm"></inspection-point> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import Cookies from "js-cookie"; |
| | | import { mapGetters } from 'vuex' |
| | | import { computePageCount } from '@/utils' |
| | | import inspectionPoint from './components/inpectionPoint' |
| | | import { addAnalyseUnit, deleteAnalyseUnit, getAnalyseUnitList, updateAnalyseUnit } from '@/api/riskLevelManage' |
| | | import { getInspectionTask } 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 { |
| | | name: 'index', |
| | | filters: { |
| | | parseMain(type){ |
| | | if(type === 1){ |
| | | return "是" |
| | | }else if(type === 0){ |
| | | return "否" |
| | | parseHours(seconds){ |
| | | let arg1 = parseFloat(seconds) |
| | | let arg2 = parseFloat(3600) |
| | | let t1 = 0 |
| | | let t2 = 0 |
| | | let r1 |
| | | let r2 |
| | | try { |
| | | t1 = arg1.toString().split(".")[1].length; |
| | | }catch (e){ |
| | | |
| | | } |
| | | try { |
| | | t2 = arg2.toString().split(".")[1].length; |
| | | }catch (e){ |
| | | } |
| | | r1 = Number(arg1.toString().replace(".","")) |
| | | r2 = Number(arg2.toString().replace(".","")) |
| | | return r1/r2*Math.pow(10,t2-t1) |
| | | }, |
| | | }, |
| | | computed: { |
| | |
| | | data() { |
| | | return { |
| | | tableKey: 0, |
| | | ifShow:true, |
| | | activeName:'inspectionPoint', |
| | | inspectionTaskData: [], |
| | | departmentList:[], |
| | | userList:[], |
| | | noticeUidList:[], |
| | | // noticeUidList:[], |
| | | execUidList:[], |
| | | 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:'周期检查'}], |
| | | listLoading: false, |
| | | pageSize: 10, |
| | |
| | | title:'', |
| | | company:'', |
| | | code:'', |
| | | noticeDepartment:'', |
| | | // noticeDepartment:'', |
| | | execDepartment:'', |
| | | inspectionTaskVisible:false, |
| | | inspectionTaskFormRules:{ |
| | | hazardDep: [{ required: true, message: '责任部门不能为空', trigger: 'change' }], |
| | | hazardLiablePerson: [{ required: true, message: '责任人不能为空', trigger: 'blur' }], |
| | | hazardCode: [{ required: true, message: '安全风险分析对象编码不能为空', trigger: 'blur' }], |
| | | riskUnitName: [{ required: true, message: '安全风险分析单元名称不能为空', trigger: 'blur' }], |
| | | title: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }], |
| | | type: [{ required: true, message: '检查类型不能为空', trigger: 'change' }], |
| | | intervalSeconds: [{ required: true, message: '检查频次不能为空', trigger: 'change' }], |
| | | noticeSeconds: [{ required: true, message: '提前通知时间不能为空', trigger: 'change' }], |
| | | startTime: [{ required: true, message: '周期开始时间不能为空', trigger: 'change' }], |
| | | effectSeconds: [{ required: true, message: '任务有效时间不能为空', trigger: 'change' }], |
| | | noticeUid: [{ required: true, message: '异常通知人员不能为空', trigger: 'change' }], |
| | | execUid: [{ required: true, message: '执行巡检人员不能为空', trigger: 'change' }], |
| | | }, |
| | | inspectionTaskForm:{ |
| | | createUid: 0, |
| | | effectSeconds: 0, |
| | | execUid: 0, |
| | | intervalSeconds: 0, |
| | | noticeSeconds: 0, |
| | | noticeUid: 0, |
| | | type:null, |
| | | createUid: null, |
| | | effectSeconds: null, |
| | | execUid: null, |
| | | intervalSeconds: null, |
| | | noticeSeconds: null, |
| | | // noticeUid: null, |
| | | title:'', |
| | | riskControlMeasureIdList: [ |
| | | ], |
| | | startTime: "", |
| | | type: 0 |
| | | }, |
| | | listQuery:{ |
| | | createUid: "", |
| | | endTime: "", |
| | | execUid: "", |
| | | noticeUid: "", |
| | | startTime: "", |
| | | status:"", |
| | | type: "" |
| | | type: "", |
| | | page: 1, |
| | | pageSize: 10, |
| | | |
| | | }, |
| | | } |
| | | }, |
| | |
| | | this.listLoading = true |
| | | let res = await getInspectionTask(this.listQuery) |
| | | if(res.data.code === '200'){ |
| | | this.recordTotal = res.data.result.total |
| | | this.pageSize = res.data.result.size |
| | | this.pageTotal = computePageCount(res.data.result.total, res.data.result.size) |
| | | this.currentPage = res.data.result.current |
| | | this.inspectionTaskData = res.data.result.records |
| | | this.recordTotal = JSON.parse(res.data.message).total |
| | | this.inspectionTaskData = res.data.result |
| | | }else if(res.data.code === '300'){ |
| | | this.inspectionTaskData = [] |
| | | } |
| | |
| | | }) |
| | | } |
| | | }, |
| | | 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 = [] |
| | | this.inspectionTaskForm.execUid = '' |
| | | } |
| | | this.execUidList = this.userList.filter ( item => item.department === this.execDepartment) |
| | | this.execUidList = this.userList.filter ( item => item.departmentname === this.execDepartment) |
| | | }, |
| | | async getUser(){ |
| | | let res = await safetyInspectionItemName() |
| | |
| | | this.$refs["inspectionTaskForm"].clearValidate() |
| | | }) |
| | | if(type === '新增'){ |
| | | this.ifShow = false |
| | | this.title = '新建巡检计划设定' |
| | | // this.noticeDepartment = '' |
| | | this.execDepartment = '' |
| | | this.inspectionTaskForm = { |
| | | id: null, |
| | | hazardCode: "", |
| | | hazardDep: "", |
| | | hazardLiablePerson: "", |
| | | riskUnitName: "", |
| | | createTime: "", |
| | | updateTime: "", |
| | | createBy: "", |
| | | updateBy: "", |
| | | validFlag: null, |
| | | hazardLiablePersonId: null, |
| | | hazardDepId: 1 |
| | | type:null, |
| | | createUid: parseInt(Cookies.get('userId')), |
| | | effectSeconds: null, |
| | | execUid: null, |
| | | intervalSeconds: null, |
| | | noticeSeconds: null, |
| | | // noticeUid: null, |
| | | title:'', |
| | | riskControlMeasureIdList: [ |
| | | ], |
| | | startTime: "", |
| | | } |
| | | setTimeout(() => { |
| | | this.$refs.inspectionPoint.inspectionPointData = [] |
| | | this.$refs.inspectionPoint.ifEdit = false |
| | | }); |
| | | }else{ |
| | | this.title = '修改' |
| | | this.inspectionTaskForm = value |
| | | 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.execUid |
| | | // this.inspectionTaskForm.noticeUid = value.noticeUname |
| | | setTimeout(() => { |
| | | this.$refs.inspectionPoint.inspectionPointData = this.inspectionTaskForm.checkContents |
| | | this.$refs.inspectionPoint.ifEdit = true |
| | | }); |
| | | } |
| | | }, |
| | | handleDepartment(value){ |
| | | let department = '' |
| | | for(let i in this.userList){ |
| | | if(this.userList[i].id === value){ |
| | | department = this.userList[i].departmentname |
| | | } |
| | | } |
| | | department = this.departmentList.find(item => item.department === department) |
| | | return department.department |
| | | }, |
| | | submitAnalyseUnit(){ |
| | | this.$refs["inspectionTaskForm"].validate((valid) =>{ |
| | | if(valid){ |
| | | if(this.title === '新增'){ |
| | | addAnalyseUnit(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 if(this.justifyTime(this.inspectionTaskForm.startTime,this.inspectionTaskForm.noticeSeconds)){ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:'周期开始时间减去当前时间和提前通知时间要大于等于半小时' |
| | | }) |
| | | }else{ |
| | | updateAnalyseUnit(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, |
| | | title: this.inspectionTaskForm.title |
| | | }).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', |
| | |
| | | }) |
| | | |
| | | }, |
| | | justifyTime(time,interval) { |
| | | let timeStr = new Date(time.replace(/-/g,'/')) |
| | | let date = parseInt(timeStr.getTime()/1000) |
| | | let newTimeStr = new Date() |
| | | let newDate = parseInt(newTimeStr.getTime()/1000) |
| | | if(date - newDate - interval - 1800 >= 0){ |
| | | return false |
| | | }else{ |
| | | 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}) |
| | | }, |
| | | refreshHandle(){ |
| | | this.getInspectionTaskData() |
| | |
| | | this.getInspectionTaskData() |
| | | }, |
| | | handleCurrentChange(val){ |
| | | this.listQuery.pageIndex = val |
| | | this.listQuery.page = val |
| | | this.getInspectionTaskData() |
| | | }, |
| | | } |