Files
admin-govern/src/views/govern/alarm/Device.vue

145 lines
4.5 KiB
Vue
Raw Normal View History

2024-01-11 16:40:44 +08:00
<template>
<TableHeader datePicker ref="refheader">
<template v-slot:select>
<el-form-item label="数据来源">
2024-12-25 10:53:07 +08:00
<el-cascader v-model.trim="tableStore.table.params.cascader" placeholder="请选择数据来源"
@change="sourceChange" :options="deviceTreeOptions" :show-all-levels="false"
:props="{ checkStrictly: true }" clearable></el-cascader>
<!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> -->
2024-01-11 16:40:44 +08:00
</el-form-item>
<el-form-item label="级别">
2024-12-25 10:53:07 +08:00
<el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable>
2024-10-10 09:56:34 +08:00
<el-option v-for="item in rankOptions" :key="item.value" :label="item.label"
:value="item.value"></el-option>
2024-01-11 16:40:44 +08:00
</el-select>
</el-form-item>
</template>
</TableHeader>
<!-- <div style="height: 300px;"> -->
<Table ref="tableRef" :isGroup="true" />
2024-01-11 16:40:44 +08:00
<!-- </div> -->
</template>
<script setup lang="ts">
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout'
const props = defineProps(['deviceTree'])
const refheader = ref()
const deviceTree = ref([])
const tabsList = ref([
{
label: '设备告警',
name: 3
},
{
label: '稳态越限告警',
name: 1
},
{
label: '暂态事件',
name: 0
}
])
const rankOptions = ref([
{
value: '1',
label: '1级'
},
{
value: '2',
label: '2级'
},
{
value: '3',
label: '3级'
}
])
const tableStore = new TableStore({
2024-10-10 09:56:34 +08:00
url: '/cs-harmonic-boot/eventUser/queryEventpageWeb',
2024-01-11 16:40:44 +08:00
method: 'POST',
publicHeight: 65,
2024-01-11 16:40:44 +08:00
column: [
2024-10-09 16:01:49 +08:00
{ title: '设备名称', field: 'equipmentName', align: 'center' },
2024-01-11 16:40:44 +08:00
{ title: '工程名称', field: 'engineeringName', align: 'center' },
{ title: '项目名称', field: 'projectName', align: 'center' },
2024-12-13 14:36:23 +08:00
{
title: '告警代码', field: 'code', align: 'center', formatter: (row: any) => {
return row.cellValue ? row.cellValue : '/'
}
},
2024-12-17 20:57:07 +08:00
{
title: '事件描述', field: 'showName',
},
{
2024-12-25 10:53:07 +08:00
title: '级别', field: 'level', formatter: (row: any) => {
2024-12-17 20:57:07 +08:00
return row.cellValue == 1 ? '1级' : row.cellValue == 2 ? '2级' : row.cellValue == 3 ? '3级' : '/'
}
},
2024-01-11 16:40:44 +08:00
{ title: '发生时刻', field: 'startTime', align: 'center' }
],
beforeSearchFun: () => {
2024-10-10 09:56:34 +08:00
}
2024-01-11 16:40:44 +08:00
})
provide('tableStore', tableStore)
// "target": [],
// "type": "",
// "userId": ""
2024-09-25 16:36:53 +08:00
tableStore.table.params.cascader = ''
tableStore.table.params.level = ''
2024-01-11 16:40:44 +08:00
tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = ''
tableStore.table.params.type = 3
tableStore.table.params.eventIds = []
tableStore.table.params.status = ''
tableStore.table.params.target = []
tableStore.table.params.userId = ''
2024-10-10 09:56:34 +08:00
tableStore.table.params.deviceTypeId = ''
2024-10-10 10:29:38 +08:00
tableStore.table.params.deviceTypeName = ''
const deviceTreeOptions = ref<any>(props.deviceTree)
deviceTreeOptions.value.map((item: any, index: any) => {
if (item.children.length == 0) {
deviceTreeOptions.value.splice(index, 1)
}
})
2024-01-11 16:40:44 +08:00
const sourceChange = (e: any) => {
2024-10-10 09:56:34 +08:00
tableStore.table.params.deviceTypeId = ''
tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = ''
if (e) {
let name = deviceTreeOptions.value.filter((item: any) => {
return item.id == e[0]
})[0].name
2024-10-10 10:29:38 +08:00
tableStore.table.params.deviceTypeName = name
2024-10-10 09:56:34 +08:00
if (name == '便携式设备') {
tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.deviceId = e[1] || ''
} else {
tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || ''
}
2024-10-09 16:01:49 +08:00
}
2024-01-11 16:40:44 +08:00
}
onMounted(() => {
tableStore.index()
})
2024-01-15 16:14:14 +08:00
setTimeout(() => {
2024-09-25 16:36:53 +08:00
// tableStore.table.height = mainHeight(200).height as any
2024-01-15 16:14:14 +08:00
}, 0)
2024-10-10 09:56:34 +08:00
const addMenu = () => { }
2024-01-11 16:40:44 +08:00
</script>
<style></style>