From 81de99b01513d6f20a00adf3e8757a20a1f955f7 Mon Sep 17 00:00:00 2001 From: lxj <15683799673@163.com> Date: Fri, 15 Aug 2025 14:08:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=91=8A=E8=AD=A6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/sis/video/index.vue | 3 +- .../videoWarningProcessing/data.ts | 82 +++--------- .../videoWarningProcessing/index.vue | 119 ++++++------------ .../base/shared/src/constants/dict-enum.ts | 7 ++ 4 files changed, 64 insertions(+), 147 deletions(-) diff --git a/apps/web-antd/src/views/sis/video/index.vue b/apps/web-antd/src/views/sis/video/index.vue index bda3df59..7390fef4 100644 --- a/apps/web-antd/src/views/sis/video/index.vue +++ b/apps/web-antd/src/views/sis/video/index.vue @@ -291,7 +291,8 @@ function streamProxy(nodeData: any, cb: Function) { if (isSupportH265) { addStreamProxy(params).then((res) => cb(res)); } else { - addFFmpegStreamProxy(params).then((res) => cb(res)); + // addFFmpegStreamProxy(params).then((res) => cb(res)); + addStreamProxy(params).then((res) => cb(res)); } } } diff --git a/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/data.ts b/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/data.ts index a6cae811..989bc049 100644 --- a/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/data.ts +++ b/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/data.ts @@ -1,8 +1,9 @@ import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; -import { getDictOptions } from '#/utils/dict'; -import { renderDict } from '#/utils/render'; import { h } from 'vue'; +import { getPopupContainer } from '@vben/utils'; +import { getDictOptions } from '#/utils/dict'; +import { DictEnum } from '@vben/constants'; export const querySchema: FormSchemaGetter = () => [ { @@ -13,11 +14,8 @@ export const querySchema: FormSchemaGetter = () => [ { component: 'Select', componentProps: { - options: [ - { label: '特大', value: '特大' }, - { label: '重要', value: '重要' }, - { label: '一般', value: '一般' }, - ], + getPopupContainer, + options: getDictOptions(DictEnum.alarm_level), }, fieldName: 'level', label: '级别', @@ -25,13 +23,10 @@ export const querySchema: FormSchemaGetter = () => [ { component: 'Select', componentProps: { - options: [ - { label: '待分配', value: '待分配' }, - { label: '处理中', value: '处理中' }, - { label: '已完成', value: '已完成' }, - ], + getPopupContainer, + options: getDictOptions(DictEnum.alarm_state), }, - fieldName: 'processingStatus', + fieldName: 'state', label: '处理状态', }, ]; @@ -40,29 +35,25 @@ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '预警编号', - field: 'alarmId', - width: 150, + field: 'id', }, { title: '预警时间', - field: 'alarmTime', - width: 150, + field: 'reportTime', }, { title: '设备名称', field: 'deviceName', - width: 150, }, { title: '级别', field: 'level', - width: 100, slots: { default: ({ row }: any) => { const levelColors: Record = { - 特大: 'red', - 重要: 'orange', - 一般: 'blue', + 1: 'red', + 2: 'orange', + 3: 'blue', }; return h( 'span', @@ -72,64 +63,31 @@ export const columns: VxeGridProps['columns'] = [ fontWeight: 'bold', }, }, - row.level, + row.levelName, ); }, }, }, { title: '预警类型', - field: 'alarmType', - width: 120, - }, - { - title: '描述', - field: 'description', - minWidth: 200, - }, - { - title: '所在位置', - field: 'location', - width: 150, - }, - { - title: '处理状态', - field: 'processingStatus', - width: 100, + field: 'alarmTypeName', slots: { default: ({ row }: any) => { - const statusColors: Record = { - 待分配: 'red', - 处理中: 'orange', - 已完成: 'green', - }; - return h( - 'span', - { - style: { - color: statusColors[row.processingStatus] || '#666', - fontWeight: 'bold', - }, - }, - row.processingStatus, - ); + return h('span', row.bigTypeName + '-' + row.smallTypeName); }, }, }, { - title: '处理情况', - field: 'processingDetails', - width: 150, + title: '处理状态', + field: 'stateName', }, { title: '预期处理时间', - field: 'expectedProcessingTime', - width: 150, + field: 'processSt', }, { title: '处理时间', - field: 'processingTime', - width: 150, + field: 'processEt', }, { field: 'action', diff --git a/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/index.vue b/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/index.vue index 7ff8410d..d15a9ad5 100644 --- a/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/index.vue +++ b/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/index.vue @@ -2,69 +2,21 @@ import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { getVxePopupContainer } from '@vben/utils'; -import { Modal, Popconfirm, Space, Tag } from 'ant-design-vue'; -import { ref, watch } from 'vue'; - +import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, } from '#/adapter/vxe-table'; -import { commonDownloadExcel } from '#/utils/file/download'; -import { renderDict } from '#/utils/render'; - import { columns, querySchema } from './data'; import warningModal from './warning-modal.vue'; import warningDetail from './warning-detail.vue'; import LevelSettingModal from './level-setting-modal.vue'; -import imgPng from '../../../../assets/algorithmManagement/image.png'; - -// 假数据 -const mockData = ref([ - { - id: 1, - alarmId: 'JWD-3434234', - alarmTime: '2025.07.21 12:20', - level: '特大', - alarmType: '越界侦测', - description: '温度高于80度发生火宅', - location: '1栋3号电梯旁', - processingStatus: '待分配', - processingDetails: '', - processingTime: '', - deviceName: '监控设备', - }, - { - id: 2, - alarmId: 'JWD-3434235', - alarmTime: '2025.07.21 11:15', - level: '重要', - alarmType: '异常行为', - description: '人员异常聚集', - location: '2栋大厅', - processingStatus: '处理中', - processingDetails: '已派人员前往处理', - processingTime: '2025.07.21 11:30', - expectedProcessingTime: '2025.07.21 11:30', - deviceName: '门禁设备', - }, - { - id: 3, - alarmId: 'JWD-3434236', - alarmTime: '2025.07.21 10:45', - level: '一般', - alarmType: '设备故障', - description: '摄像头离线', - location: '3栋走廊', - processingStatus: '已完成', - processingDetails: '已修复设备', - processingTime: '2025.07.21 11:00', - imgUrl: imgPng, - deviceName: '消防设备', - }, -]); +import { alarmEventsList, alarmEventsRemove } from '#/api/sis/alarmEvents'; +import type { AlarmEventsForm } from '#/api/sis/alarmEvents/model'; +/* 搜索栏配置 */ const formOptions: VbenFormProps = { commonConfig: { labelWidth: 100, @@ -76,14 +28,31 @@ const formOptions: VbenFormProps = { wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3', }; +/* table栏配置 */ const gridOptions: VxeGridProps = { + checkboxConfig: { + // 高亮 + highlight: true, + // 翻页时保留选中状态 + reserve: true, + // 点击行选中 + // trigger: 'row', + }, + // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 + // columns: columns(), columns, height: 'auto', - data: mockData.value, - pagerConfig: { - currentPage: 1, - pageSize: 10, - total: mockData.value.length, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + return await alarmEventsList({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues, + }); + }, + }, }, rowConfig: { keyField: 'id', @@ -97,14 +66,6 @@ const [BasicTable, tableApi] = useVbenVxeGrid({ }); // 监听数据变化,强制重新渲染表格 -const tableKey = ref(0); -watch( - mockData, - () => { - tableKey.value++; - }, - { deep: true }, -); const [WarningModal, modalApi] = useVbenModal({ connectedComponent: warningModal, @@ -120,19 +81,19 @@ const [LevelSettingModalComp, levelModalApi] = useVbenModal({ // 级别设置 function handleLevelSetting(row: any) { - levelModalApi.setData({ id: row.id, level: row.level, data: mockData.value }); + levelModalApi.setData({ id: row.id, level: row.level, data: row }); levelModalApi.open(); } // 查看详情 async function handleView(row: any) { - detailApi.setData({ id: row.id, data: mockData.value }); + detailApi.setData({ id: row.id, data: row }); detailApi.open(); } // 编辑 async function handleEdit(row: any) { - modalApi.setData({ id: row.id, data: mockData.value }); + modalApi.setData({ id: row.id, data: row }); modalApi.open(); } @@ -143,7 +104,7 @@ function handleAssign(row: any) { content: `确定要分配预警 ${row.alarmId} 给处理人员吗?`, onOk() { // 模拟分配处理 - const index = mockData.value.findIndex((item: any) => item.id === row.id); + const index = row.id; if (index !== -1) { // mockData.value[index].processingStatus = '处理中'; // mockData.value[index].processingDetails = '已分配给处理人员'; @@ -156,9 +117,8 @@ function handleAssign(row: any) { // 删除 async function handleDelete(row: any) { - const index = mockData.value.findIndex((item: any) => item.id === row.id); + const index = row.id; if (index !== -1) { - mockData.value.splice(index, 1); await tableApi.query(); } } @@ -166,18 +126,13 @@ async function handleDelete(row: any) { // 批量删除 function handleMultiDelete() { const rows = tableApi.grid.getCheckboxRecords(); - const ids = rows.map((row: any) => row.id); + const ids = rows.map((row: Required) => row.id); Modal.confirm({ title: '提示', okType: 'danger', content: `确认删除选中的${ids.length}条记录吗?`, onOk: async () => { - ids.forEach((id) => { - const index = mockData.value.findIndex((item: any) => item.id === id); - if (index !== -1) { - mockData.value.splice(index, 1); - } - }); + await alarmEventsRemove(ids); await tableApi.query(); }, }); @@ -185,11 +140,7 @@ function handleMultiDelete() {