<template>
|
<a-card :bordered="false">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :md="7" :sm="8">
|
<a-form-item label="时间范围">
|
<a-range-picker
|
style="width: 100%"
|
:show-time="{
|
hideDisabledOptions: true,
|
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('11:59:59', 'HH:mm:ss')],
|
}"
|
:value="defaultTime"
|
@change="onChange"
|
format="YYYY-MM-DD HH:mm:ss"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="6" :sm="8">
|
<a-form-item label="终端名称">
|
<j-dict-select-tag
|
v-model="queryParam.cameraCode"
|
placeholder="请选择设备"
|
dictCode="t_camera,name,code"
|
/>
|
</a-form-item>
|
</a-col>
|
|
<template v-if="toggleSearchStatus">
|
<a-col :md="6" :sm="8">
|
<a-form-item label="检查类型">
|
<j-dict-select-tag
|
v-model="queryParam.algorithmCode"
|
placeholder="请选择检查类型"
|
dictCode="t_sys_algorithm_item,algorithm_name,algorithm_code,algorithm_type='4'"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="5" :sm="8">
|
<a-form-item label="状态">
|
<a-select allowClear v-model="queryParam.audited" placeholder="请选择状态">
|
<a-select-option :value="0"> 未处理 </a-select-option>
|
<a-select-option :value="1"> 已处理 </a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<a-col :md="6" :sm="8">
|
<a-form-item label="所属机构">
|
<a-tree-select
|
allow-clear
|
show-search
|
treeNodeFilterProp="title"
|
style="width: 100%"
|
v-model="queryParam.orgCode"
|
:dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
|
:treeData="departTree"
|
treeDefaultExpandAll
|
placeholder="请选择机构"
|
>
|
</a-tree-select>
|
<!-- <j-dict-select-tag
|
show-search
|
v-model="queryParam.orgCode"
|
placeholder="请选择机构"
|
dictCode="sys_depart,depart_name,org_code,org_category=3"
|
/>-->
|
</a-form-item>
|
</a-col>
|
<a-col :md="6" :sm="8">
|
<a-form-item label="处理结果">
|
<a-select allowClear v-model="queryParam.auditResult" placeholder="请选择处理结果">
|
<a-select-option :value="1"> 规范 </a-select-option>
|
<a-select-option :value="2"> 异常 </a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
</template>
|
<a-col :md="6" :sm="8">
|
<span style="float: left; overflow: hidden" class="table-page-search-submit-buttons">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="primary" @click="resetForm" icon="reload" style="margin-left: 8px">重置</a-button>
|
<!-- <a-button type="primary" icon="download" style="margin-left: 8px" @click="oilExportXls('OiloutEvent')"
|
>导出</a-button
|
> -->
|
<a @click="handleToggleSearch" style="margin-left: 8px">
|
{{ toggleSearchStatus ? '收起' : '展开' }}
|
<a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
|
</a>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<!-- table区域-begin -->
|
<div>
|
<a-table
|
ref="table"
|
size="middle"
|
class="infoTable"
|
:rowKey="
|
(record, index) => {
|
return index
|
}
|
"
|
:columns="defaultColumns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
@change="handleTableChange"
|
>
|
<span slot="eventAddress" slot-scope="text, record">
|
{{ record.eventAddress | filterAddress }}
|
</span>
|
<span slot="status" slot-scope="text, record">
|
{{ record.auditResult === 0 ? '未处理' : '已处理' }}
|
</span>
|
<span slot="auditResult" :style="{ color: record.auditResult == 1 ? 'red' : '' }" slot-scope="text, record">
|
{{ record.auditResult | filterAudit }}
|
</span>
|
<span slot="action" slot-scope="text, record">
|
<a @click="handleOk(record)">详情</a>
|
</span>
|
</a-table>
|
</div>
|
|
<!-- table区域-end -->
|
|
<!-- 告警详情 -->
|
<OiloutEventInfo :visible="show" @modalClose="modalClose" fromWhich="spotCheck" :infoObj="infoObj" />
|
</a-card>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@tievd/cube-block/lib/mixins/JeecgListMixin'
|
import OiloutEventInfo from './components/OiloutEventInfo.vue'
|
import moment from 'moment'
|
import { getAction, downFile } from '@tievd/cube-block/lib/api/manage'
|
import { queryDepartTreeList, queryIdTree } from '@tievd/cube-block/lib/api/api'
|
var time
|
export default {
|
name: 'OilEventList',
|
mixins: [JeecgListMixin],
|
components: {
|
OiloutEventInfo,
|
},
|
data() {
|
return {
|
description: '事件查询',
|
// 表头
|
columns: [],
|
show: false,
|
infoObj: {},
|
defaultTime: [],
|
// 列定义
|
defaultColumns: [
|
{
|
title: '时间',
|
align: 'center',
|
dataIndex: 'eventTime',
|
},
|
{
|
title: '事件类型',
|
align: 'center',
|
dataIndex: 'algorithmName',
|
},
|
{
|
title: '所属区域',
|
align: 'center',
|
scopedSlots: { customRender: 'eventAddress' },
|
},
|
{
|
title: '终端名称',
|
align: 'center',
|
dataIndex: 'cameraName',
|
},
|
{
|
title: '所属网关',
|
align: 'center',
|
dataIndex: 'deviceName',
|
},
|
{
|
title: '所属机构',
|
align: 'center',
|
dataIndex: 'orgName',
|
},
|
{
|
title: '状态',
|
align: 'center',
|
scopedSlots: { customRender: 'status' },
|
},
|
{
|
title: '处理结果',
|
align: 'center',
|
dataIndex: 'auditResult',
|
scopedSlots: { customRender: 'auditResult' },
|
},
|
{
|
title: '处理人',
|
align: 'center',
|
dataIndex: 'auditUser',
|
},
|
{
|
title: '处理时间',
|
align: 'center',
|
dataIndex: 'auditTime',
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width: 150,
|
align: 'center',
|
scopedSlots: { customRender: 'action' },
|
},
|
],
|
queryParam: {},
|
dataSource: [],
|
url: {
|
list: '/jyz/spotcheckEvent/list',
|
// delete: '/jyz/camera/delete',
|
// deleteBatch: '/jyz/camera/deleteBatch',
|
exportXlsUrl: '/jyz/camera/exportXls',
|
// importXlsUrl: '/jyz/camera/importExcel',
|
},
|
selectOrg: '',
|
departTree: [],
|
}
|
},
|
filters: {
|
filterAudit(val) {
|
let text = ''
|
switch (val) {
|
case 1:
|
text = '属实'
|
break
|
case 2:
|
text = '误报'
|
break
|
default:
|
break
|
}
|
return text
|
},
|
filterAddress(val) {
|
let text = ''
|
switch (val) {
|
case 1:
|
text = '卸油区'
|
break
|
case 2:
|
text = '加油区'
|
break
|
case 3:
|
text = '便利店'
|
break
|
default:
|
break
|
}
|
return text
|
},
|
},
|
methods: {
|
loadTreeData() {
|
queryDepartTreeList({ myself: true }).then((res) => {
|
if (res.success) {
|
this.departTree = []
|
for (let i = 0; i < res.result.length; i++) {
|
let temp = res.result[i]
|
this.cleanData(temp)
|
this.departTree.push(temp)
|
}
|
}
|
})
|
},
|
|
cleanData(e) {
|
e.key = e.orgCode
|
e.value = e.orgCode
|
e.disabled = e.orgCategory === '3' ? false : true
|
if (e.children != null) {
|
for (let i = 0; i < e.children.length; i++) {
|
this.cleanData(e.children[i])
|
}
|
}
|
},
|
moment,
|
// 重置表单
|
resetForm() {
|
this.defaultTime = []
|
this.queryParam = {}
|
this.loadTreeData()
|
this.loadData()
|
},
|
// 监听时间
|
onChange(date, dateString) {
|
console.log(dateString)
|
this.defaultTime = dateString
|
this.queryParam.startTime = dateString[0]
|
this.queryParam.endTime = dateString[1]
|
},
|
onTreeNodeSelect(id, node) {
|
this.selectOrg = this.queryParam.orgCode = node.selectedNodes[0].data.props.orgCode
|
console.log(id, this.selectOrg)
|
this.loadData()
|
},
|
getImportXlsUrl() {
|
return window._CONFIG['domianURL'] + this.url.importXlsUrl
|
},
|
// 打开弹窗
|
handleOk(data) {
|
console.log(data)
|
this.infoObj = JSON.parse(JSON.stringify(data))
|
this.show = true
|
},
|
// 关闭弹窗
|
modalClose(data) {
|
this.show = false
|
if (data) this.loadData() //有返回值代表请求成功
|
},
|
// 下载导出
|
oilExportXls() {
|
if (typeof time == 'undefined') {
|
this.$notification.open({
|
message: '事件查询导出中...',
|
description: '请耐心等待...',
|
style: {
|
width: '250px',
|
marginLeft: '134px',
|
marginTop: '28px',
|
marginRight: '10px',
|
backgroundColor: '#fff',
|
boxShadow: ' 0 4px 12px rgba(0,0,0,.15)',
|
},
|
duration: null,
|
icon: <a-icon type="smile" style="color: #108ee9" />,
|
})
|
this.getZip()
|
time = setInterval(() => {
|
this.getZip()
|
}, 5000)
|
} else {
|
this.$message.warning('导出任务进行中,请稍后再试...')
|
// clearInterval(time)
|
// this.getZip()
|
// time = setInterval(() => {
|
// this.getZip()
|
// }, 5000)
|
}
|
},
|
// 轮询网络请求
|
getZip() {
|
getAction('/jyz/oilEvent/exportZip', this.queryParam).then((res) => {
|
console.log(res)
|
if (res.code === 200) {
|
if (res.result === 0) {
|
} else {
|
clearInterval(time) //关闭定时器
|
time = undefined
|
this.$notification.destroy()
|
console.log('已获得导出成功结果')
|
downFile('/jyz/oilEvent/getExportFile', { fileName: '事件查询', type: 1 }).then((res) => {
|
if (!res) {
|
this.$message.error('文件下载失败')
|
return
|
}
|
this.$message.success('事件查询文件下载成功!')
|
let blob = new Blob([res], { type: 'application/zip;charset=UTF-8' }) //
|
let downloadElement = document.createElement('a')
|
let href = window.URL.createObjectURL(blob) //创建下载的链接
|
downloadElement.href = href
|
downloadElement.download = '事件查询' //下载后文件名
|
document.body.appendChild(downloadElement)
|
downloadElement.click() //点击下载
|
document.body.removeChild(downloadElement) //下载完成移除元素
|
window.URL.revokeObjectURL(href) //释放掉blob对象
|
})
|
}
|
} else {
|
this.$message.error(res.message)
|
}
|
})
|
},
|
},
|
|
created() {
|
this.loadTreeData()
|
},
|
}
|
</script>
|
<style scoped lang="less">
|
.table-top {
|
margin-bottom: 16px;
|
height: 32.5px;
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
}
|
.query-form {
|
display: flex;
|
margin-bottom: 20px;
|
flex-wrap: wrap;
|
align-items: center;
|
}
|
@import '~@assets/less/common.less';
|
</style>
|