From dad957f2d33ba871beeba251e7c51c1e7bb2b1ab Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期四, 02 六月 2022 10:46:33 +0800 Subject: [PATCH] 'lct; --- src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue | 392 +++++++++++++++++++++++++++++++------------------------ 1 files changed, 222 insertions(+), 170 deletions(-) diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue index 7b41e36..95b83e9 100644 --- a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue +++ b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue @@ -2,52 +2,138 @@ <div class="app-container"> <div class="filter-container"> <div class="basic_search"> - <span>单位名称:</span> - <el-input v-model="listQuery.filter.riskUnitName" style="width:200px"> - </el-input> + <span>开始时间:</span> + <el-date-picker v-model="listQuery.startTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="巡检开始时间"></el-date-picker> + </div> + <div class="basic_search"> + <span>结束时间:</span> + <el-date-picker v-model="listQuery.endTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="巡检结束时间"></el-date-picker> + </div> + <div class="basic_search"> + <span>任务类型:</span> + <el-select v-model="listQuery.type"> + <el-option + v-for="item in typeList" + :key="item.id" + :value="item.id" + :label="item.name" + ></el-option> + </el-select> + </div> + <div class="basic_search"> + <span>任务单元状态列表:</span> + <el-select v-model="listQuery.statusList" filterable clearable multiple> + <el-option + v-for="item in statusListList" + :key="item.id" + :value="item.id" + :label="item.name" + ></el-option> + </el-select> + </div> + <div class="basic_search"> + <span>巡检任务创建人员:</span> + <el-select v-model="listQuery.createUid" 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> + <el-option + v-for="item in userList" + :key="item.id" + :value="item.id" + :label="item.realname" + ></el-option> + </el-select> </div> <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" icon="el-icon-refresh" @click="refreshHandle">搜索</el-button> - <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" icon="el-icon-plus" @click="showAnalyseUnitForm('','新增')">新增</el-button> </div> <div class="table_content"> <el-table v-loading="listLoading" :key="tableKey" - :data="analyseUnitData" + :data="inspectionRecordData" border fit highlight-current-row style="width: 100%;" > - <el-table-column label="安全风险分析对象编码" prop="hazardCode" align="center"> + <el-table-column type="expand"> + <template slot-scope="scope"> + <el-table + v-loading="listLoading" + :key="tableKey" + :data="scope.row.unitList" + border + fit + highlight-current-row + style="width: 100%;" + > + <el-table-column label="序号" type="index" width="150" align="center"> + </el-table-column> + <el-table-column label="隐患排查内容" prop="content" align="center"> + </el-table-column> + <el-table-column label="上报说明" prop="info" align="center"> + </el-table-column> + <el-table-column label="上报照片" prop="img" align="center"> + <template slot-scope="scope"> + <el-button type="text" @click="downloadFile(scope.row)">下载</el-button> + </template> + </el-table-column> + <el-table-column label="状态" prop="status" align="center"> + <template slot-scope="scope"> + {{ scope.row.status | parseUnitStatus}} + </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="showInspectionRecordDetailForm(scope.row,'上报')" v-show="scope.row.status === 1">上报</el-button> + <el-button type="text" @click="showInspectionRecordDetailForm(scope.row,'查看')">查看</el-button> + </template> + </el-table-column> + </el-table> + </template> </el-table-column> - <el-table-column label="责任部门" prop="hazardDep" align="center"> + <el-table-column label="任务名称" prop="title" align="center"> </el-table-column> - <el-table-column label="责任人" prop="hazardLiablePerson" align="center"> + <el-table-column label="检查类型" prop="type" align="center"> + <template slot-scope="scope"> + {{ scope.row.type | parseType}} + </template> </el-table-column> - <el-table-column label="安全风险分析单元名称" prop="riskUnitName" align="center"> + <el-table-column label="巡检人" prop="execUname" align="center"> </el-table-column> - <el-table-column label="创建人" prop="createBy" align="center"> + <el-table-column label="巡检开始时间" prop="expTime" align="center"> </el-table-column> - <el-table-column label="创建时间" prop="createTime" align="center"> + <el-table-column label="巡检结束时间" prop="endTime" align="center"> </el-table-column> - <el-table-column label="最后修改人" prop="updateBy" align="center"> + <el-table-column label="巡检提交时间" prop="execTime" align="center"> </el-table-column> - <el-table-column label="最后修改时间" prop="updateTime" align="center"> + <el-table-column label="任务状态" prop="status" align="center"> + <template slot-scope="scope"> + {{ scope.row.status | parseStatusList}} + </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="submitInspectionRecordForm(scope.row,'上报')">提交</el-button> + <el-button type="text" @click="showInspectionRecordForm(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 @@ -57,51 +143,57 @@ /> <br> </div> - <el-dialog :title="title" :visible.sync="analyseUnitVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="600px"> - <el-form ref="analyseUnitForm" :rules="analyseUnitFormRules" :model="analyseUnitForm" label-position="right" label-width="165px"> - <el-form-item label="责任部门" prop="hazardDep"> - <el-select v-model="analyseUnitForm.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> - <el-form-item label="责任人" prop="hazardLiablePerson"> - <el-input v-model="analyseUnitForm.hazardLiablePerson" class="analyseUnit_input"></el-input> - </el-form-item> - <el-form-item label="安全风险分析对象编码" prop="hazardCode"> - <el-input v-model="analyseUnitForm.hazardCode" class="analyseUnit_input"></el-input> - </el-form-item> - <el-form-item label="安全风险分析单元名称" prop="riskUnitName"> - <el-input v-model="analyseUnitForm.riskUnitName" class="analyseUnit_input"></el-input> - </el-form-item> - </el-form> - <div align="right"> - <el-button @click="unitFormVisible = false">取消</el-button> - <el-button type="primary" @click="submitAnalyseUnit()">确认</el-button> - </div> - </el-dialog> + <detail ref="detail" @getList="getInspectionRecordData"></detail> </div> </template> <script> + import Cookies from "js-cookie"; + import detail from './components/detail.vue' import { mapGetters } from 'vuex' import { computePageCount } from '@/utils' - import { addAnalyseUnit, deleteAnalyseUnit, getAnalyseUnitList, updateAnalyseUnit } from '@/api/riskLevelManage' + import { getInspectionRecord } from '@/api/inspectionTask' import {getAllDepartment, getDepartmentList} from "../../../../api/departmentManage"; + import {safetyInspectionItemName} from "../../../../api/safetySelfInspection"; + import {submitTask} from "../../../../api/inspectionTask"; export default { + components: { detail }, name: 'index', filters: { - parseMain(type){ + parseType(type){ if(type === 1){ - return "是" - }else if(type === 0){ - return "否" + return "日常检查" + }else{ + return "周期检查" } }, + parseStatus(status){ + if(status === 1){ + return "任务开启" + }else{ + return "任务关闭" + } + }, + parseUnitStatus(value) { + if(value === 1){ + return "待巡检" + }else if(value === 2) { + return "已完成" + } + }, + parseStatusList(status) { + if(status === 1){ + return "待巡检" + }else if(status === 2) { + return "巡检中" + }else if(status === 3) { + return "已完成" + }else if(status === 4) { + return "超时未巡检" + }else{ + return "已取消" + } + } }, computed: { ...mapGetters([ @@ -111,8 +203,11 @@ data() { return { tableKey: 0, - analyseUnitData: [], + inspectionRecordData: [], departmentList:[], + userList:[], + typeList:[{id:1,name:'日常检查'},{id:2,name:'周期检查'}], + statusListList:[{id:1,name:'待巡检'},{id:2,name:'巡检中'},{id:3,name:'已完成'},{id:4,name:'超时未巡检'},{id:5,name:'已取消'}], listLoading: false, pageSize: 10, recordTotal: 0, @@ -121,50 +216,38 @@ title:'', company:'', code:'', - analyseUnitVisible:false, - analyseUnitFormRules:{ - hazardDep: [{ required: true, message: '责任部门不能为空', trigger: 'change' }], - hazardLiablePerson: [{ required: true, message: '责任人不能为空', trigger: 'blur' }], - hazardCode: [{ required: true, message: '安全风险分析对象编码不能为空', trigger: 'blur' }], - riskUnitName: [{ required: true, message: '安全风险分析单元名称不能为空', trigger: 'blur' }], - }, - analyseUnitForm:{ - id: null, - hazardCode: "", - hazardDep: "", - hazardLiablePerson: "", - riskUnitName: "", - createTime: "", - updateTime: "", - createBy: "", - updateBy: "", - validFlag: null, - hazardLiablePersonId: null, - hazardDepId: 1 + inspectionRecordForm:{ + }, listQuery:{ - pageIndex:1, - pageSize:10, - filter:{ - riskUnitName:'', - } + createUid: null, + endTime: null, + execUid: null, + execUname: null, + page: 1, + pageSize: 10, + result: null, + startTime: null, + statusList: null, + type: null }, } }, + components: { + detail + }, created() { - this.getAnalyseUnitData() + this.getInspectionRecordData() this.getDepartment() + this.getUser() }, methods: { - async getAnalyseUnitData(){ + async getInspectionRecordData(){ this.listLoading = true - let res = await getAnalyseUnitList(this.listQuery) + let res = await getInspectionRecord(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.analyseUnitData = res.data.result.records + this.recordTotal = JSON.parse(res.data.message).total + this.inspectionRecordData = res.data.result }else{ this.$message({ message:res.data.message, @@ -184,108 +267,76 @@ }) } }, - showAnalyseUnitForm(value,type){ - this.analyseUnitVisible = true - this.$nextTick(() =>{ - this.$refs["analyseUnitForm"].clearValidate() - }) - if(type === '新增'){ - this.title = '新增' - this.analyseUnitForm = { - id: null, - hazardCode: "", - hazardDep: "", - hazardLiablePerson: "", - riskUnitName: "", - createTime: "", - updateTime: "", - createBy: "", - updateBy: "", - validFlag: null, - hazardLiablePersonId: null, - hazardDepId: 1 - } + async getUser(){ + let res = await safetyInspectionItemName() + if(res.data.code === '200'){ + this.userList = res.data.result }else{ - this.title = '修改' - this.analyseUnitForm = value + this.$message({ + message:res.data.message, + type:'warning' + }) } }, - submitAnalyseUnit(){ - this.$refs["analyseUnitForm"].validate((valid) =>{ - if(valid){ - if(this.title === '新增'){ - addAnalyseUnit(this.analyseUnitForm).then((res)=>{ - if(res.data.code === '200'){ - this.analyseUnitVisible = false - this.getAnalyseUnitData() - this.$notify({ - type:'success', - duration:2000, - message:'新增成功', - title:'成功' - }) - }else{ - this.$message({ - type:'warning', - message:res.data.message - }) - } - }) - }else{ - updateAnalyseUnit(this.analyseUnitForm).then((res)=>{ - if(res.data.code === '200'){ - this.analyseUnitVisible = false - this.getAnalyseUnitData() - this.$notify({ - type:'success', - duration:2000, - title:'成功', - message:'编辑成功' - }) - }else{ - this.$message({ - type:'warning', - message:res.data.message - }) - } - }) - } + showInspectionRecordForm(value){ + this.$refs.detail.showInspectionRecordForm(value) + }, + showInspectionRecordDetailForm(value,type) { + this.$refs.detail.showInspectionRecordDetailForm(value,type,this.userList,this.departmentList) + }, + async submitInspectionRecordForm(value){ + if(value.unitList.find(item => item.status === 1) === undefined){ + let data = { + + } + let res = await submitTask({ + execUid:Cookies.get('userId'), + info:"", + taskId: value.id + }) + if(res.data.code === '200'){ + this.getInspectionRecordData() + this.$message({ + type:'success', + message:'提交成功', + duration:2000, + title:'成功' + }) }else{ this.$message({ type:'warning', - message:'请完善基本信息' + message:res.data.message }) } - }) - - }, - deleteById(val){ - this.$confirm('删除此条信息,是否继续','提示',{ - confirmButtonText:'确定', - cancelButtonText:'取消', - type:'warning', - }).then(()=> { - deleteAnalyseUnit({id:val.id}).then( ()=>{ - this.getAnalyseUnitData() - this.$notify({ - title:'成功', - message:'删除成功', - type:'success', - duration:2000, - }) + }else{ + this.$message({ + type:'warning', + message:'请先上报所有巡检单元' }) - }) + } + }, + downloadFile(value){ + if(value.problem.imageInfoList === null){ + this.$message({ + type:'warning', + message:'无文件可下载' + }) + }else{ + for(let i in value.problem.imageInfoList){ + window.open(process.env.IMG_API + value.problem.imageInfoList[i].imgPath, '_blank') + } + } }, refreshHandle(){ - this.getAnalyseUnitData() + this.getInspectionRecordData() }, handleSizeChange(val){ this.listQuery.pageSize = val - this.getAnalyseUnitData() + this.getInspectionRecordData() }, handleCurrentChange(val){ - this.listQuery.pageIndex = val - this.getAnalyseUnitData() + this.listQuery.page = val + this.getInspectionRecordData() }, } } @@ -294,8 +345,9 @@ .basic_search{ display:inline-block; padding-bottom: 10px; + padding-left: 10px; } .analyseUnit_input{ - width:320px; + width:200px; } </style> -- Gitblit v1.9.2