<template>
|
<div class="app-container">
|
<div class="filter-container">
|
<div class="basic_search">
|
<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>
|
</div>
|
<div class="table_content">
|
<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 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 prop="taskStatus" label="状态" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ parseNumber(scope.row.taskStatus, '状态') }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="taskBelong" label="是否认领" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ parseNumber(scope.row.taskBelong, '认领状态') }}
|
</template>
|
</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" 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="listQuery.pageIndex"
|
:page-sizes="[10, 20, 30, 50]"
|
:page-size="listQuery.pageSize"
|
:total="recordTotal"
|
layout="total, sizes, prev, pager, next, jumper"
|
background
|
style="float:right;"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
<br>
|
</div>
|
<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 { 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: {
|
parseType(type){
|
if(type === 1){
|
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([
|
'userType'
|
])
|
},
|
data() {
|
return {
|
tableKey: 0,
|
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,
|
currentPage: 1,
|
pageTotal: 0,
|
title:'',
|
company:'',
|
code:'',
|
inspectionRecordForm:{
|
|
},
|
listQuery:{
|
pageIndex: 1,
|
pageSize: 10,
|
result: null,
|
taskStatus: null,
|
execDepId: null,
|
taskType: null
|
},
|
}
|
},
|
components: {
|
detail
|
},
|
created() {
|
this.getInspectionRecordData()
|
this.getDepartment()
|
this.getUser()
|
},
|
methods: {
|
async getInspectionRecordData(){
|
this.listLoading = true
|
let res = await getInspectionRecord(this.listQuery)
|
if(res.data.code === '200'){
|
this.recordTotal = res.data.count
|
this.inspectionRecordData = res.data.data
|
}else{
|
this.$message({
|
message:res.data.message,
|
type:'warning'
|
})
|
}
|
this.listLoading = false
|
},
|
async getDepartment(){
|
let res = await getDepartmentList({pageSize:1000,pageIndex:1})
|
if(res.data.code === '200'){
|
this.departmentList = res.data.result.result
|
}else{
|
this.$message({
|
message:res.data.message,
|
type:'warning'
|
})
|
}
|
},
|
async getUser(){
|
let res = await safetyInspectionItemName()
|
if(res.data.code === '200'){
|
this.userList = res.data.result
|
}else{
|
this.$message({
|
message:res.data.message,
|
type:'warning'
|
})
|
}
|
},
|
|
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:res.data.message
|
})
|
}
|
}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.getInspectionRecordData()
|
},
|
handleSizeChange(val){
|
this.listQuery.pageSize = val
|
this.getInspectionRecordData()
|
},
|
handleCurrentChange(val){
|
this.listQuery.pageIndex = val
|
this.getInspectionRecordData()
|
},
|
}
|
}
|
</script>
|
<style scoped>
|
.basic_search{
|
display:inline-block;
|
padding-bottom: 10px;
|
padding-left: 10px;
|
}
|
.analyseUnit_input{
|
width:90%;
|
}
|
.analyseUnit_box{
|
width:200px;
|
}
|
</style>
|