diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/assets/images/spread.gif b/src/assets/images/spread.gif new file mode 100644 index 0000000..bad5c84 --- /dev/null +++ b/src/assets/images/spread.gif Binary files differ diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/assets/images/spread.gif b/src/assets/images/spread.gif new file mode 100644 index 0000000..bad5c84 --- /dev/null +++ b/src/assets/images/spread.gif Binary files differ diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue new file mode 100644 index 0000000..a0d693f --- /dev/null +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -0,0 +1,229 @@ + + + + + + diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/assets/images/spread.gif b/src/assets/images/spread.gif new file mode 100644 index 0000000..bad5c84 --- /dev/null +++ b/src/assets/images/spread.gif Binary files differ diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue new file mode 100644 index 0000000..a0d693f --- /dev/null +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -0,0 +1,229 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 30f312e..53fd910 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -4,12 +4,17 @@ Date: 2023-07-08 --> diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/assets/images/spread.gif b/src/assets/images/spread.gif new file mode 100644 index 0000000..bad5c84 --- /dev/null +++ b/src/assets/images/spread.gif Binary files differ diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue new file mode 100644 index 0000000..a0d693f --- /dev/null +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -0,0 +1,229 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 30f312e..53fd910 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -4,12 +4,17 @@ Date: 2023-07-08 --> diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue new file mode 100644 index 0000000..3199aed --- /dev/null +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -0,0 +1,43 @@ + + + + + + diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/assets/images/spread.gif b/src/assets/images/spread.gif new file mode 100644 index 0000000..bad5c84 --- /dev/null +++ b/src/assets/images/spread.gif Binary files differ diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue new file mode 100644 index 0000000..a0d693f --- /dev/null +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -0,0 +1,229 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 30f312e..53fd910 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -4,12 +4,17 @@ Date: 2023-07-08 --> diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue new file mode 100644 index 0000000..3199aed --- /dev/null +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -0,0 +1,43 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/pendingDialog.vue b/src/views/home/alarm/current/components/pendingDialog.vue new file mode 100644 index 0000000..df1cd85 --- /dev/null +++ b/src/views/home/alarm/current/components/pendingDialog.vue @@ -0,0 +1,103 @@ + + + + + + diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/assets/images/spread.gif b/src/assets/images/spread.gif new file mode 100644 index 0000000..bad5c84 --- /dev/null +++ b/src/assets/images/spread.gif Binary files differ diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue new file mode 100644 index 0000000..a0d693f --- /dev/null +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -0,0 +1,229 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 30f312e..53fd910 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -4,12 +4,17 @@ Date: 2023-07-08 --> diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue new file mode 100644 index 0000000..3199aed --- /dev/null +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -0,0 +1,43 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/pendingDialog.vue b/src/views/home/alarm/current/components/pendingDialog.vue new file mode 100644 index 0000000..df1cd85 --- /dev/null +++ b/src/views/home/alarm/current/components/pendingDialog.vue @@ -0,0 +1,103 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue new file mode 100644 index 0000000..76fb612 --- /dev/null +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -0,0 +1,199 @@ + + + + + + diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts new file mode 100644 index 0000000..c78804a --- /dev/null +++ b/src/api/home/alarm/current.ts @@ -0,0 +1,49 @@ +/** + * 当前报警接口 + */ +import request from '@/api/index' + +// 基础列表 +export function getCurrentAlarmListPage(data: any) { + return request({ + url: `/system/alarmRecords/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 已读 +export function viewAlarm(id: any) { + return request({ + url: '/system/alarmRecords/read', + method: 'post', + data: { + id, + }, + }) +} +// 查看 +export function detailAlarm(id: any) { + return request({ + url: '/system/alarmRecords/view', + method: 'post', + data: { + id, + }, + }) +} +// 挂起 +export function pendingAlarm(data: any) { + return request({ + url: '/system/alarmRecords/suspend', + method: 'post', + data, + }) +} +// 提醒责任人 +export function remindAlarm(data: any) { + return request({ + url: '/system/alarmRecords/remind', + method: 'post', + data, + }) +} diff --git a/src/assets/images/spread.gif b/src/assets/images/spread.gif new file mode 100644 index 0000000..bad5c84 --- /dev/null +++ b/src/assets/images/spread.gif Binary files differ diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue new file mode 100644 index 0000000..a0d693f --- /dev/null +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -0,0 +1,229 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 30f312e..53fd910 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -4,12 +4,17 @@ Date: 2023-07-08 --> diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue new file mode 100644 index 0000000..3199aed --- /dev/null +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -0,0 +1,43 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/pendingDialog.vue b/src/views/home/alarm/current/components/pendingDialog.vue new file mode 100644 index 0000000..df1cd85 --- /dev/null +++ b/src/views/home/alarm/current/components/pendingDialog.vue @@ -0,0 +1,103 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue new file mode 100644 index 0000000..76fb612 --- /dev/null +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -0,0 +1,199 @@ + + + + + + diff --git a/src/views/home/alarm/current/index.vue b/src/views/home/alarm/current/index.vue index 0c937fe..4bcec98 100644 --- a/src/views/home/alarm/current/index.vue +++ b/src/views/home/alarm/current/index.vue @@ -7,21 +7,29 @@ import { ElMessage } from 'element-plus' import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue' import MapCom from './components/map.vue' - +import { getCurrentAlarmListPage, viewAlarm } from '@/api/home/alarm/current' +import { getDictByCode } from '@/api/system/dict' +import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { getDeviceTypeListPage } from '@/api/home/device/type' +const alarmCategoryList = ref<{ id: string; name: string; value: string }[]>([]) // 报警类别 +const alarmTypeList = ref<{ id: string; name: string; value: string }[]>([]) // 报警类型 +const alarmLevelList = ref<{ id: string; name: string; value: string }[]>([]) // 报警等级 +const deviceTypeList = ref<{ id: string; name: string; value: string }[]>([]) // 设备类型 +const alarmStatusList = ref<{ id: string; name: string; value: string }[]>([]) // 报警状态 // 表格数据 const list1 = ref([]) const total = ref(0) // 初始展示列 const columns = ref([ - { text: '报警类型', value: 'alarmTypeName', align: 'center' }, - { text: '报警等级', value: 'alarmRank', align: 'center' }, - { text: '报警原因', value: 'alarmReason', align: 'center' }, + { text: '报警类型', value: 'alarmType', align: 'center' }, + { text: '报警等级', value: 'alarmLevelName', align: 'center' }, + { text: '报警原因', value: 'alarmMsg', align: 'center' }, { text: '位置', value: 'position', align: 'center' }, - { text: '设备类型', value: 'deviceType', align: 'center' }, - { text: '设备编号', value: 'deviceNo', align: 'center' }, - { text: '管理单位', value: 'dept', align: 'center' }, - { text: '状态', value: 'status', align: 'center' }, - { text: '报警时间', value: 'alarmTime', align: 'center' }, + { text: '设备类型', value: 'devTypeName', align: 'center' }, + { text: '设备编号', value: 'devcode', align: 'center' }, + { text: '管理单位', value: 'deptName', align: 'center' }, + { text: '状态', value: 'processStatusName', align: 'center' }, + { text: '报警时间', value: 'ts', align: 'center' }, ]) // 最终展示列 const columnsConfig = ref([]) @@ -34,126 +42,59 @@ const listQuery = ref({ limit: 20, offset: 1, + begTime: '', + endTime: '', + alarmCategory: '', // 报警类别 + alarmLevel: '', // 报警等级 + alarmTypeId: '', // 报警类型 + deptId: '', // 管理单位 + devCode: '', // 设备编号 + devTypeId: '', // 设备类型 + position: '', // 位置 + processStatus: '', // 报警状态 }) // 开始结束时间 const datetimerange = ref() watch(() => datetimerange.value, (newVal) => { - // listQuery.createTimeStart = '' - // listQuery.createTimeEnd = '' + listQuery.value.begTime = '' + listQuery.value.endTime = '' if (Array.isArray(newVal)) { if (newVal.length) { - // listQuery.createTimeStart = `${newVal[0]} 00:00:00` - // listQuery.createTimeEnd = `${newVal[1]} 23:59:59` + listQuery.value.begTime = `${newVal[0]} 00:00:00` + listQuery.value.endTime = `${newVal[1]} 23:59:59` } } }) // 查询数据 const fetchData = () => { - setTimeout(() => { + loadingTable.value = true + getCurrentAlarmListPage(listQuery.value).then((res) => { + total.value = res.data.total + list1.value = res.data.rows.map((item: any) => ({ + ...item, + alarmCategoryName: alarmCategoryList.value.length ? alarmCategoryList.value.filter((citem: any) => citem.value === item.alarmCategory)[0]?.name : '', + })) loadingTable.value = false - list1.value = [ - { - alarmTypeName: '闸井浓度超限', - alarmRank: '一级', - alarmReason: '燃气浓度23%vol', - position: 'N121422南小街中压', - deviceType: '燃气智能监测终端', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '未读', - alarmTime: '2024-07-01 12:45:50', - lat: '39.91081620470105', - lng: '116.2590451793805', - }, - { - alarmTypeName: '闸井浓度超限', - alarmRank: '二级', - alarmReason: '燃气浓度23%vol', - position: 'N121422南小街中压', - deviceType: '燃气智能监测终端', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '未读', - alarmTime: '', - lat: '39.911268', - lng: '116.343489', - }, - { - alarmTypeName: '疑似第三方破坏', - alarmRank: '一级', - alarmReason: '桩倾斜报警', - position: 'N121422南小街中压', - deviceType: '智能监测桩', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '已确认', - alarmTime: '', - lat: '39.943322', - lng: '116.403976', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - lat: '39.901552', - lng: '116.398043', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - ] as any[] - }, 1000) + }).catch(() => { + loadingTable.value = false + }) } // 重置查询条件f const reset = () => { - + listQuery.value = { + limit: 20, + offset: 1, + begTime: '', + endTime: '', + alarmCategory: '', // 报警类别 + alarmLevel: '', // 报警等级 + alarmTypeId: '', // 报警类型 + deptId: '', // 管理单位 + devCode: '', // 设备编号 + devTypeId: '', // 设备类型 + position: '', // 位置 + processStatus: '', // 报警状态 + } } // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size: number; page: number }) => { @@ -172,7 +113,7 @@ // 表格标识 地图或普通 const tableFlag = ref('normal') const tableHeight = ref(0) -const switchMode = (type: string) => { +const switchMode = async (type: string) => { if (!list1.value.length) { ElMessage.warning('暂无数据') return @@ -190,36 +131,95 @@ }) // 查看报警 const mapRef = ref() +const mapData = ref({}) const detail = (row: any) => { + mapData.value = row switchMode('map') + row.lngGaode = '116.398043' + row.latGaode = '39.901552' // 绘制点 const draw = () => { - mapRef.value.mapRef.map.setCenter([row.lng, row.lat]) mapRef.value.mapRef.removeMarker() mapRef.value.mapRef.addMarker({ - position: [row.lng, row.lat], - content: '', + position: [row.lngGaode, row.latGaode], + content: '
', label: '', }) + mapRef.value.mapRef.map.setFitView() + mapRef.value.mapRef.map.setZoom(15) + mapRef.value.openInfoDetail({ + ...row, + lnglat: [row.lngGaode, row.latGaode], + }) } setTimeout(() => { - if (!row.lng || !row.lat) { + if (!row.lngGaode || !row.latGaode) { ElMessage.warning('该数据缺少坐标信息') return } - if (mapRef.value.completeFlag) { - draw() + // 已读 + if (row.processStatus === '0') { + viewAlarm(row.id).then(() => { + row.processStatus = 2 + row.processStatusName = '已读' + if (mapRef.value.completeFlag) { + draw() + } + else { + setTimeout(() => { + draw() + }, 1000) + } + }) } else { - setTimeout(() => { + if (mapRef.value.completeFlag) { draw() - }, 1000) + } + else { + setTimeout(() => { + draw() + }, 1000) + } } - // console.log(mapRef.value) - // lat: '39.901552', - // lng: '116.398043', }) } +// 字典 +const fetchDict = () => { + // 报警类别 + getDictByCode('alarmCategory').then((res) => { + alarmCategoryList.value = res.data + }) + // 报警类型 + getAlarmTypeListPage({ offset: 1, limit: 99999 }).then((res) => { + alarmTypeList.value = res.data.rows.map((item: any) => ({ + name: item.alarmType, + value: item.id, + id: item.id, + })) + }) + // 报警等级 + getAlarmLevelListPage({ offset: 1, limit: 99999 }).then((res) => { + alarmLevelList.value = res.data.rows.map((item: any) => ({ + name: item.alarmLevel, + value: item.id, + id: item.id, + })) + }) + // 设备类型 + getDeviceTypeListPage({ offset: 1, limit: 99999 }).then((res) => { + deviceTypeList.value = res.data.rows.map((item: any) => ({ + name: item.typeName, + value: item.id, + id: item.id, + })) + }) + // 报警状态 + getDictByCode('alarmStatus').then((res) => { + alarmStatusList.value = res.data + }) +} +fetchDict() + + diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 30f312e..53fd910 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -4,12 +4,17 @@ Date: 2023-07-08 --> diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue new file mode 100644 index 0000000..3199aed --- /dev/null +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -0,0 +1,43 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/pendingDialog.vue b/src/views/home/alarm/current/components/pendingDialog.vue new file mode 100644 index 0000000..df1cd85 --- /dev/null +++ b/src/views/home/alarm/current/components/pendingDialog.vue @@ -0,0 +1,103 @@ + + + + + + diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue new file mode 100644 index 0000000..76fb612 --- /dev/null +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -0,0 +1,199 @@ + + + + + + diff --git a/src/views/home/alarm/current/index.vue b/src/views/home/alarm/current/index.vue index 0c937fe..4bcec98 100644 --- a/src/views/home/alarm/current/index.vue +++ b/src/views/home/alarm/current/index.vue @@ -7,21 +7,29 @@ import { ElMessage } from 'element-plus' import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue' import MapCom from './components/map.vue' - +import { getCurrentAlarmListPage, viewAlarm } from '@/api/home/alarm/current' +import { getDictByCode } from '@/api/system/dict' +import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { getDeviceTypeListPage } from '@/api/home/device/type' +const alarmCategoryList = ref<{ id: string; name: string; value: string }[]>([]) // 报警类别 +const alarmTypeList = ref<{ id: string; name: string; value: string }[]>([]) // 报警类型 +const alarmLevelList = ref<{ id: string; name: string; value: string }[]>([]) // 报警等级 +const deviceTypeList = ref<{ id: string; name: string; value: string }[]>([]) // 设备类型 +const alarmStatusList = ref<{ id: string; name: string; value: string }[]>([]) // 报警状态 // 表格数据 const list1 = ref([]) const total = ref(0) // 初始展示列 const columns = ref([ - { text: '报警类型', value: 'alarmTypeName', align: 'center' }, - { text: '报警等级', value: 'alarmRank', align: 'center' }, - { text: '报警原因', value: 'alarmReason', align: 'center' }, + { text: '报警类型', value: 'alarmType', align: 'center' }, + { text: '报警等级', value: 'alarmLevelName', align: 'center' }, + { text: '报警原因', value: 'alarmMsg', align: 'center' }, { text: '位置', value: 'position', align: 'center' }, - { text: '设备类型', value: 'deviceType', align: 'center' }, - { text: '设备编号', value: 'deviceNo', align: 'center' }, - { text: '管理单位', value: 'dept', align: 'center' }, - { text: '状态', value: 'status', align: 'center' }, - { text: '报警时间', value: 'alarmTime', align: 'center' }, + { text: '设备类型', value: 'devTypeName', align: 'center' }, + { text: '设备编号', value: 'devcode', align: 'center' }, + { text: '管理单位', value: 'deptName', align: 'center' }, + { text: '状态', value: 'processStatusName', align: 'center' }, + { text: '报警时间', value: 'ts', align: 'center' }, ]) // 最终展示列 const columnsConfig = ref([]) @@ -34,126 +42,59 @@ const listQuery = ref({ limit: 20, offset: 1, + begTime: '', + endTime: '', + alarmCategory: '', // 报警类别 + alarmLevel: '', // 报警等级 + alarmTypeId: '', // 报警类型 + deptId: '', // 管理单位 + devCode: '', // 设备编号 + devTypeId: '', // 设备类型 + position: '', // 位置 + processStatus: '', // 报警状态 }) // 开始结束时间 const datetimerange = ref() watch(() => datetimerange.value, (newVal) => { - // listQuery.createTimeStart = '' - // listQuery.createTimeEnd = '' + listQuery.value.begTime = '' + listQuery.value.endTime = '' if (Array.isArray(newVal)) { if (newVal.length) { - // listQuery.createTimeStart = `${newVal[0]} 00:00:00` - // listQuery.createTimeEnd = `${newVal[1]} 23:59:59` + listQuery.value.begTime = `${newVal[0]} 00:00:00` + listQuery.value.endTime = `${newVal[1]} 23:59:59` } } }) // 查询数据 const fetchData = () => { - setTimeout(() => { + loadingTable.value = true + getCurrentAlarmListPage(listQuery.value).then((res) => { + total.value = res.data.total + list1.value = res.data.rows.map((item: any) => ({ + ...item, + alarmCategoryName: alarmCategoryList.value.length ? alarmCategoryList.value.filter((citem: any) => citem.value === item.alarmCategory)[0]?.name : '', + })) loadingTable.value = false - list1.value = [ - { - alarmTypeName: '闸井浓度超限', - alarmRank: '一级', - alarmReason: '燃气浓度23%vol', - position: 'N121422南小街中压', - deviceType: '燃气智能监测终端', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '未读', - alarmTime: '2024-07-01 12:45:50', - lat: '39.91081620470105', - lng: '116.2590451793805', - }, - { - alarmTypeName: '闸井浓度超限', - alarmRank: '二级', - alarmReason: '燃气浓度23%vol', - position: 'N121422南小街中压', - deviceType: '燃气智能监测终端', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '未读', - alarmTime: '', - lat: '39.911268', - lng: '116.343489', - }, - { - alarmTypeName: '疑似第三方破坏', - alarmRank: '一级', - alarmReason: '桩倾斜报警', - position: 'N121422南小街中压', - deviceType: '智能监测桩', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '已确认', - alarmTime: '', - lat: '39.943322', - lng: '116.403976', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - lat: '39.901552', - lng: '116.398043', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - { - alarmTypeName: '设备故障', - alarmRank: '三级', - alarmReason: '传感器异常', - position: '422南小街中压', - deviceType: '管线哨兵', - deviceNo: '342022010027', - dept: '第一分公司/运维1所/1班', - status: '挂起', - alarmTime: '', - }, - ] as any[] - }, 1000) + }).catch(() => { + loadingTable.value = false + }) } // 重置查询条件f const reset = () => { - + listQuery.value = { + limit: 20, + offset: 1, + begTime: '', + endTime: '', + alarmCategory: '', // 报警类别 + alarmLevel: '', // 报警等级 + alarmTypeId: '', // 报警类型 + deptId: '', // 管理单位 + devCode: '', // 设备编号 + devTypeId: '', // 设备类型 + position: '', // 位置 + processStatus: '', // 报警状态 + } } // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size: number; page: number }) => { @@ -172,7 +113,7 @@ // 表格标识 地图或普通 const tableFlag = ref('normal') const tableHeight = ref(0) -const switchMode = (type: string) => { +const switchMode = async (type: string) => { if (!list1.value.length) { ElMessage.warning('暂无数据') return @@ -190,36 +131,95 @@ }) // 查看报警 const mapRef = ref() +const mapData = ref({}) const detail = (row: any) => { + mapData.value = row switchMode('map') + row.lngGaode = '116.398043' + row.latGaode = '39.901552' // 绘制点 const draw = () => { - mapRef.value.mapRef.map.setCenter([row.lng, row.lat]) mapRef.value.mapRef.removeMarker() mapRef.value.mapRef.addMarker({ - position: [row.lng, row.lat], - content: '', + position: [row.lngGaode, row.latGaode], + content: '
', label: '', }) + mapRef.value.mapRef.map.setFitView() + mapRef.value.mapRef.map.setZoom(15) + mapRef.value.openInfoDetail({ + ...row, + lnglat: [row.lngGaode, row.latGaode], + }) } setTimeout(() => { - if (!row.lng || !row.lat) { + if (!row.lngGaode || !row.latGaode) { ElMessage.warning('该数据缺少坐标信息') return } - if (mapRef.value.completeFlag) { - draw() + // 已读 + if (row.processStatus === '0') { + viewAlarm(row.id).then(() => { + row.processStatus = 2 + row.processStatusName = '已读' + if (mapRef.value.completeFlag) { + draw() + } + else { + setTimeout(() => { + draw() + }, 1000) + } + }) } else { - setTimeout(() => { + if (mapRef.value.completeFlag) { draw() - }, 1000) + } + else { + setTimeout(() => { + draw() + }, 1000) + } } - // console.log(mapRef.value) - // lat: '39.901552', - // lng: '116.398043', }) } +// 字典 +const fetchDict = () => { + // 报警类别 + getDictByCode('alarmCategory').then((res) => { + alarmCategoryList.value = res.data + }) + // 报警类型 + getAlarmTypeListPage({ offset: 1, limit: 99999 }).then((res) => { + alarmTypeList.value = res.data.rows.map((item: any) => ({ + name: item.alarmType, + value: item.id, + id: item.id, + })) + }) + // 报警等级 + getAlarmLevelListPage({ offset: 1, limit: 99999 }).then((res) => { + alarmLevelList.value = res.data.rows.map((item: any) => ({ + name: item.alarmLevel, + value: item.id, + id: item.id, + })) + }) + // 设备类型 + getDeviceTypeListPage({ offset: 1, limit: 99999 }).then((res) => { + deviceTypeList.value = res.data.rows.map((item: any) => ({ + name: item.typeName, + value: item.id, + id: item.id, + })) + }) + // 报警状态 + getDictByCode('alarmStatus').then((res) => { + alarmStatusList.value = res.data + }) +} +fetchDict() + +