<!-- 安全管理 ==> 风险分级管控 => 区域巡检(任务打卡)-->
|
<template>
|
<div class="wrap">
|
<div class="main_header">
|
<div class="header_item">
|
<span class="header_label">巡检人:</span>
|
<el-input size="mini" v-model="queryInfo.realName" placeholder="请输入巡检人" clearable></el-input>
|
</div>
|
<div class="header_item">
|
<span class="header_label">巡检状态:</span>
|
<el-select size="mini" v-model="queryInfo.status" clearable>
|
<el-option v-for="item in queryStatus" :key="item.value" :label="item.label" :value="item.value"
|
placeholder="请选择巡检状态"></el-option>
|
</el-select>
|
</div>
|
<div class="header_item">
|
<span class="header_label">时间范围:</span>
|
<el-date-picker type="daterange" v-model="times" value-format="yyyy-MM-dd" start-placeholder="起始时间"
|
end-placeholder="结束时间" @change="changeTime" clear></el-date-picker>
|
</div>
|
<div class="header_item">
|
<el-button icon="el-icon-search" v-permission="'search'" @click="queryReset">查询</el-button>
|
<el-button icon="el-icon-plus" v-permission="'export'" @click="exportExcel">导出Excel</el-button>
|
</div>
|
</div>
|
<div class="main_content">
|
<cpn-table :table-index="true" :table-loading="tableConfig.loading" :table-data="tableConfig.tableData"
|
:table-columns="tableConfig.tableColumns" :page-total="tableConfig.total" :page-num.sync="queryInfo.pageNum"
|
:page-size.sync="queryInfo.pageSize" :page-change="pageChange">
|
</cpn-table>
|
</div>
|
|
<!-- 详情dialog -->
|
<el-dialog width="400px" class="prop_dialog" v-if="isRenderDialog" title="详情" :visible.sync="asyncVisible">
|
|
<el-form class="rule_form" label-width="auto">
|
|
<div class="divider"></div>
|
|
<el-form-item label="巡检任务:">{{ info.task }}</el-form-item>
|
|
<el-form-item label="巡检标准:">{{ info.standard }}</el-form-item>
|
|
<el-form-item label="巡检人员:">{{ info.name }}</el-form-item>
|
|
<div class="divider"><span>巡检路线</span></div>
|
|
<div class="regions">
|
<div class="region" v-for="item in info.regions" :key="item.regionId"
|
@click="regionClick(item.regionId)">{{
|
item.region }}
|
</div>
|
</div>
|
</el-form>
|
</el-dialog>
|
|
<!-- 区域信息dialog -->
|
<el-dialog width="400px" class="prop_dialog" v-if="regionInfos.isRenderDialog" title="详情"
|
:visible.sync="regionInfos.asyncVisible">
|
|
<el-form class="rule_form" label-width="auto">
|
|
<div class="divider"></div>
|
|
<el-form-item label="巡检时间:">{{ regionInfos.time }}</el-form-item>
|
|
<el-form-item label="巡检区域:">{{ regionInfos.region }}</el-form-item>
|
|
<el-form-item label="巡检结果:">{{ regionInfos.res }}</el-form-item>
|
|
<el-form-item label="上传图片:">
|
<el-image class="image" v-for="(item, index) in regionInfos.img" :key="index" :src="item" fit="contain"
|
:preview-src-list="regionInfos.img"></el-image>
|
</el-form-item>
|
</el-form>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import cpnTable from '@/components/element/Table'
|
import {downFiles} from '@/plugins/public'
|
export default {
|
data() {
|
return {
|
isRenderDialog: false,
|
asyncVisible: false,
|
info: { // 详情信息
|
task: '',
|
standard: '',
|
name: '',
|
regions: [],
|
},
|
userId: '', // 存储点击后的用户id
|
taskId: '', // 存储点击后的巡检任务id
|
times: [], // 时间范围
|
queryStatus: [
|
{value: '0', label: '待巡检'},
|
{value: '1', label: '已完成'},
|
],
|
queryInfo: {
|
pageNum: 1,
|
pageSize: 10,
|
status: '',
|
realName: '',
|
startTime: '',
|
endTime: '',
|
},
|
tableConfig: {
|
loading: '',
|
tableData: [],
|
tableColumns: [],
|
total: 0,
|
},
|
regionInfos: { // 巡检路线详情
|
isRenderDialog: false,
|
asyncVisible: false,
|
time: '', // 巡检时间
|
region: '', // 巡检区域
|
res: '', // 巡检结果
|
img: '', // 上传的图片
|
}
|
}
|
},
|
components: {
|
cpnTable,
|
},
|
beforeCreate() {
|
this.$http = this.$api.Safety.RiskGrad.polling
|
},
|
created() {
|
this.setTableColumn()
|
this.getLists()
|
},
|
methods: {
|
// 获取table列表数据
|
getLists() {
|
let params = this.queryInfo
|
let tableConfig = this.tableConfig
|
tableConfig.loading = true
|
this.$http.taskcardGetlists(params).then(res => {
|
if (res.statusMsg === 'ok') {
|
tableConfig.total = res.data.total
|
tableConfig.tableData = res.data.list
|
}
|
tableConfig.loading = false
|
})
|
},
|
// 获取巡检路线的id (用来点击展示详情)
|
getRegionId() {
|
|
},
|
// 初始化 table 配置
|
setTableColumn() {
|
this.tableConfig.tableColumns = [
|
{index: true},
|
{name: "巡检时间", key: "inspectionTime"},
|
{name: "巡检任务", key: "task"},
|
{
|
name: "巡检路线", align: 'left', key: "region", formatter: row => {
|
return row.region.replace(/,/g, ',\n')
|
}
|
},
|
{name: "巡检人", key: "realName"},
|
{
|
name: "巡检状态", key: "status", width: 120, formatter: row => {
|
return row.status === 1 ? '已完成' : '待巡检'
|
}
|
},
|
{
|
operation: true, name: "操作", width: 120, value: [
|
{name: "详情", handleRow: this.detailRow}]
|
},
|
]
|
},
|
// 查询按钮列表信息
|
queryReset() {
|
this.queryInfo.pageNum = 1
|
this.queryInfo.pageSize = 10
|
this.getLists()
|
},
|
showDialog() {
|
if (!this.isRenderDialog) {
|
this.isRenderDialog = true
|
}
|
this.asyncVisible = true
|
},
|
showRegionDialog() {
|
if (!this.regionInfos.isRenderDialog) {
|
this.regionInfos.isRenderDialog = true
|
}
|
this.regionInfos.asyncVisible = true
|
},
|
detailRow(row) {
|
this.info.task = row.task
|
this.info.standard = row.standard
|
this.info.name = row.realName
|
this.info.regions = []
|
|
this.userId = row.userId
|
this.taskId = row.regionInspectionId
|
const params = {
|
userId: row.userId,
|
regionInspectionId: row.regionInspectionId,
|
}
|
this.$http.taskcardGetregions(params).then(res => {
|
if (res.statusMsg === 'ok') {
|
let regions = []
|
res.data.regionList.forEach(item => {
|
regions.push({
|
regionId: item.regionHazardInformId,
|
region: item.region,
|
})
|
})
|
this.info.regions.push(...regions)
|
}
|
})
|
this.showDialog()
|
},
|
regionClick(regionId) {
|
const params = {
|
userId: this.userId,
|
regionInspectionId: this.taskId,
|
regionHazardInformId: regionId,
|
}
|
this.$http.taskcardGetregionInfo(params).then(res => {
|
if (res.statusMsg === 'ok') {
|
this.regionInfos.time = res.data.inspectionTime
|
this.regionInfos.region = res.data.region
|
this.regionInfos.res = res.data.result
|
this.regionInfos.img = []
|
|
if (res.data.imgPaths) {
|
let arr = []
|
res.data.imgPaths.split(',').forEach(item => {
|
arr.push('https://szpipe.thhy-tj.com/' + item) // 是生产地址
|
})
|
this.regionInfos.img.push(...arr)
|
}
|
}
|
this.showRegionDialog()
|
})
|
},
|
exportExcel() {
|
let params = this.queryInfo
|
this.$http.taskcardExport(params).then(res => {
|
downFiles(res, '任务打卡', 'xls')
|
})
|
},
|
changeTime(times) {
|
times = times || ['', '']
|
this.queryInfo.startTime = times[0]
|
this.queryInfo.endTime = times[1]
|
},
|
pageChange() {
|
this.getLists()
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import '@/style/layout-main.scss';
|
|
.wrap {
|
display: flex;
|
flex-direction: column;
|
height: 100%;
|
|
.main_content {
|
overflow: hidden;
|
flex: 1;
|
}
|
}
|
|
.rule_form {
|
color: #fff;
|
|
::v-deep .el-form-item__content {
|
display: block;
|
}
|
|
.image {
|
flex: none;
|
width: 91px;
|
height: 120px;
|
margin-right: 15px;
|
border-radius: 5px;
|
border: 1px solid #0c5983;
|
|
img {
|
width: 100%;
|
}
|
}
|
}
|
|
.regions {
|
text-align: center;
|
|
.region {
|
line-height: 34px;
|
margin-bottom: 16px;
|
background: rgba(56, 175, 247, .25);
|
cursor: pointer;
|
}
|
}
|
|
.divider {
|
position: relative;
|
margin-bottom: 30px;
|
text-indent: 10px;
|
color: #fff;
|
border-left: 3px solid #18F6F8;
|
|
&::after {
|
content: "";
|
position: absolute;
|
left: 0;
|
bottom: -8px;
|
width: 100%;
|
padding: 20px 0;
|
border-bottom: 1px solid #0C4D6F;
|
}
|
}
|
</style>
|