From c819024e241b9f7c54cc3786373ad0d2998f2190 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Fri, 05 May 2023 08:55:46 +0800
Subject: [PATCH] 修改
---
src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue | 425 ++++++++++++++++++++++++++++++----------------------
1 files changed, 244 insertions(+), 181 deletions(-)
diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue
index 7b41e36..44ca664 100644
--- a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue
+++ b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue
@@ -2,52 +2,87 @@
<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-select class="analyseUnit_box" v-model="listQuery.result" placeholder="排查结果" filterable clearable>
+ <el-option v-for="item in resultList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+ </el-select>
+ </div>
+ <div class="basic_search">
+ <span>排查任务状态:</span>
+ <el-select class="analyseUnit_box" v-model="listQuery.taskStatus" placeholder="排查任务状态" filterable clearable>
+ <el-option v-for="item in taskStatusList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+ </el-select>
+ </div>
+ <div class="basic_search">
+ <span>任务类型:</span>
+ <el-select class="analyseUnit_box" v-model="listQuery.taskType" placeholder="任务类型" filterable clearable>
+ <el-option v-for="item in taskTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+ </el-select>
+ </div>
+ <div class="basic_search">
+ <span>部门名称:</span>
+ <el-select class="analyseUnit_box" v-model="listQuery.execDepId" placeholder="部门名称" filterable clearable>
+ <el-option v-for="item in departmentList" :key="item.id" :label="item.department" :value="item.id"></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"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- >
- <el-table-column label="安全风险分析对象编码" prop="hazardCode" align="center">
+ <el-table :data="inspectionRecordData" style="width: 100%">
+ <el-table-column type="expand">
+ <template slot-scope="scope">
+ <el-table :data="scope.row.checkContent" style="width: 100%">
+ <el-table-column label="序号" type="index" width="150" align="center"> </el-table-column>
+ <el-table-column label="检查内容" prop="checkContent" align="center"> </el-table-column>
+ <el-table-column label="检查结果" prop="checkResult" align="center">
+ <template slot-scope="scope">
+ <el-tag :type="scope.row.checkResult === 1 ? 'success' : scope.row.checkResult === 2 ? 'danger' : 'info'">
+ {{ parseNumber(scope.row.checkResult, '检查结果') }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
+ <template slot-scope="scope">
+ <el-button size="small" type="text" @click="onOpenDialogRef('查看', scope.row)">查看</el-button>
+ <el-button size="small" type="text" @click="onOpenDialogRef('提交', 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 type="index" label="序号" width="60" />
+ <el-table-column prop="taskCode" label="排查名称" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="execDep" label="执行部门" show-overflow-tooltip>
</el-table-column>
- <el-table-column label="责任人" prop="hazardLiablePerson" align="center">
+ <el-table-column prop="taskStatus" label="状态" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ parseNumber(scope.row.taskStatus, '状态') }}
+ </template>
</el-table-column>
- <el-table-column label="安全风险分析单元名称" prop="riskUnitName" align="center">
+ <el-table-column prop="taskBelong" label="是否认领" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ parseNumber(scope.row.taskBelong, '认领状态') }}
+ </template>
</el-table-column>
- <el-table-column label="创建人" prop="createBy" 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>
+ <el-table-column prop="startTime" label="开始时间" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="validTime" label="有效时间" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="execUserName" label="执行人" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="createUserName" label="创建人" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></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" v-show="(scope.row.taskStatus === 1 || scope.row.taskStatus === 4) && scope.row.taskBelong === 1" @click="onHandleTask(scope.row)">任务认领</el-button>
</template>
</el-table-column>
</el-table>
<br>
<el-pagination
v-show="recordTotal>0"
- :current-page="currentPage"
+ :current-page="listQuery.pageIndex"
: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 +92,56 @@
/>
<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" @refreshRecord="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 {deleteInspectionTask, submitTask, taskToUser} from "../../../../api/inspectionTask";
export default {
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 +151,32 @@
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:'已取消'}],
+ resultList: [
+ { id: 1, name: '正常' },
+ { id: 2, name: '存在隐患' },
+ { id: 3, name: '未排查' },
+ { id: 4, name: '其他' }
+ ],
+ checkResultList: [
+ { id: 1, name: '正常' },
+ { id: 2, name: '异常' },
+ { id: 3, name: '未处理' }
+ ],
+ taskStatusList: [
+ { id: 1, name: '待排查' },
+ { id: 2, name: '已完成' },
+ { id: 3, name: '超时未排查' },
+ { id: 4, name: '排查中' }
+ ],
+ taskTypeList: [
+ { id: 1, name: '周期任务' },
+ { id: 2, name: '日常任务' }
+ ],
listLoading: false,
pageSize: 10,
recordTotal: 0,
@@ -121,50 +185,34 @@
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:'',
- }
+ pageIndex: 1,
+ pageSize: 10,
+ result: null,
+ taskStatus: null,
+ execDepId: null,
+ taskType: 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 = res.data.count
+ this.inspectionRecordData = res.data.data
}else{
this.$message({
message:res.data.message,
@@ -184,108 +232,119 @@
})
}
},
- 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
- })
- }
- })
- }
+
+ onHandleTask(val){
+
+ this.$confirm('此操作将认领该任务,是否继续','提示',{
+ confirmButtonText:'确定',
+ cancelButtonText:'取消',
+ type:'warning',
+ }).then(()=> {
+ taskToUser({ id: val.id }).then( (res)=>{
+ if(res.data.code === '200'){
+ this.getInspectionRecordData()
+ this.$notify({
+ title:'成功',
+ message:'认领成功',
+ type:'success',
+ duration:2000,
+ })
+ }else{
+ this.$message({
+ type:'warning',
+ message:res.data.message
+ })
+ }
+ })
+ })
+
+ },
+
+ onOpenDialogRef(type,value){
+ this.$refs.detail.showInspectionRecordForm(type,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')
+ }
+ }
+ },
+
+ parseNumber(value, type) {
+ if (type === '状态') {
+ return this.taskStatusList.find((item) => item.id === value).name;
+ }else if (type === '检查结果') {
+ return this.checkResultList.find((item) => item.id === value).name;
+ } else {
+ if (value === 1) {
+ return '未认领';
+ } else {
+ return '已认领';
+ }
+ }
+ },
+
refreshHandle(){
- this.getAnalyseUnitData()
+ this.getInspectionRecordData()
},
handleSizeChange(val){
this.listQuery.pageSize = val
- this.getAnalyseUnitData()
+ this.getInspectionRecordData()
},
handleCurrentChange(val){
this.listQuery.pageIndex = val
- this.getAnalyseUnitData()
+ this.getInspectionRecordData()
},
}
}
@@ -294,8 +353,12 @@
.basic_search{
display:inline-block;
padding-bottom: 10px;
+ padding-left: 10px;
}
.analyseUnit_input{
- width:320px;
+ width:90%;
+ }
+ .analyseUnit_box{
+ width:200px;
}
</style>
--
Gitblit v1.9.2