2025-08-12 13:51:35 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
|
|
|
import { getVxePopupContainer } from '@vben/utils';
|
|
|
|
|
2025-08-18 09:06:31 +08:00
|
|
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
2025-08-12 13:51:35 +08:00
|
|
|
import {
|
|
|
|
useVbenVxeGrid,
|
|
|
|
vxeCheckboxChecked,
|
|
|
|
type VxeGridProps,
|
|
|
|
} from '#/adapter/vxe-table';
|
|
|
|
|
|
|
|
import { columns, querySchema } from './data';
|
|
|
|
import warningModal from './warning-modal.vue';
|
|
|
|
import warningDetail from './warning-detail.vue';
|
2025-09-08 17:50:44 +08:00
|
|
|
import { alarmEventsListCurr, alarmEventsRemove } from '#/api/sis/alarmEvents';
|
2025-08-18 09:06:31 +08:00
|
|
|
import type { AlarmEventsForm } from '#/api/sis/alarmEvents/model';
|
2025-08-12 13:51:35 +08:00
|
|
|
|
2025-08-18 09:06:31 +08:00
|
|
|
/* 搜索栏配置 */
|
2025-08-12 13:51:35 +08:00
|
|
|
const formOptions: VbenFormProps = {
|
|
|
|
commonConfig: {
|
|
|
|
labelWidth: 100,
|
|
|
|
componentProps: {
|
|
|
|
allowClear: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
schema: querySchema(),
|
|
|
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
|
|
|
};
|
|
|
|
|
2025-08-18 09:06:31 +08:00
|
|
|
/* table栏配置 */
|
2025-08-12 13:51:35 +08:00
|
|
|
const gridOptions: VxeGridProps = {
|
2025-08-18 09:06:31 +08:00
|
|
|
checkboxConfig: {
|
|
|
|
// 高亮
|
|
|
|
highlight: true,
|
|
|
|
// 翻页时保留选中状态
|
|
|
|
reserve: true,
|
|
|
|
// 点击行选中
|
|
|
|
// trigger: 'row',
|
|
|
|
},
|
|
|
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
|
|
|
// columns: columns(),
|
2025-08-12 13:51:35 +08:00
|
|
|
columns,
|
|
|
|
height: 'auto',
|
2025-08-18 09:06:31 +08:00
|
|
|
pagerConfig: {},
|
|
|
|
proxyConfig: {
|
|
|
|
ajax: {
|
|
|
|
query: async ({ page }, formValues = {}) => {
|
|
|
|
return await alarmEventsListCurr({
|
|
|
|
pageNum: page.currentPage,
|
|
|
|
pageSize: page.pageSize,
|
|
|
|
states: [20, 30, 31, 32],
|
|
|
|
...formValues,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
2025-08-12 13:51:35 +08:00
|
|
|
},
|
|
|
|
rowConfig: {
|
|
|
|
keyField: 'id',
|
|
|
|
},
|
|
|
|
id: 'video-warning-processing-index',
|
|
|
|
};
|
|
|
|
|
|
|
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
|
|
|
formOptions,
|
|
|
|
gridOptions,
|
|
|
|
});
|
|
|
|
|
|
|
|
// 监听数据变化,强制重新渲染表格
|
|
|
|
|
|
|
|
const [WarningModal, modalApi] = useVbenModal({
|
|
|
|
connectedComponent: warningModal,
|
|
|
|
});
|
|
|
|
|
|
|
|
const [WarningDetail, detailApi] = useVbenModal({
|
|
|
|
connectedComponent: warningDetail,
|
|
|
|
});
|
|
|
|
|
|
|
|
// 查看详情
|
|
|
|
async function handleView(row: any) {
|
2025-08-18 09:06:31 +08:00
|
|
|
detailApi.setData({ id: row.id, data: row });
|
2025-08-12 13:51:35 +08:00
|
|
|
detailApi.open();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 编辑
|
|
|
|
async function handleEdit(row: any) {
|
2025-08-18 09:06:31 +08:00
|
|
|
modalApi.setData({ id: row.id, data: row });
|
2025-08-12 13:51:35 +08:00
|
|
|
modalApi.open();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 删除
|
|
|
|
async function handleDelete(row: any) {
|
2025-08-18 09:06:31 +08:00
|
|
|
const index = row.id;
|
2025-08-12 13:51:35 +08:00
|
|
|
if (index !== -1) {
|
|
|
|
await tableApi.query();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 批量删除
|
|
|
|
function handleMultiDelete() {
|
|
|
|
const rows = tableApi.grid.getCheckboxRecords();
|
2025-08-18 09:06:31 +08:00
|
|
|
const ids = rows.map((row: Required<AlarmEventsForm>) => row.id);
|
2025-08-12 13:51:35 +08:00
|
|
|
Modal.confirm({
|
|
|
|
title: '提示',
|
|
|
|
okType: 'danger',
|
|
|
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
|
|
|
onOk: async () => {
|
2025-08-18 09:06:31 +08:00
|
|
|
await alarmEventsRemove(ids);
|
2025-08-12 13:51:35 +08:00
|
|
|
await tableApi.query();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<Page :auto-content-height="true">
|
2025-08-18 09:06:31 +08:00
|
|
|
<BasicTable class="flex-1 overflow-hidden" table-title="视频预警处理">
|
2025-08-12 13:51:35 +08:00
|
|
|
<template #toolbar-tools>
|
|
|
|
<Space>
|
|
|
|
<a-button
|
|
|
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
|
|
|
danger
|
|
|
|
type="primary"
|
|
|
|
v-access:code="['video:warning:remove']"
|
|
|
|
@click="handleMultiDelete"
|
|
|
|
>
|
|
|
|
{{ $t('pages.common.delete') }}
|
|
|
|
</a-button>
|
|
|
|
</Space>
|
|
|
|
</template>
|
|
|
|
<template #action="{ row }">
|
|
|
|
<Space>
|
|
|
|
<!-- <ghost-button
|
|
|
|
v-access:code="['video:warning:level']"
|
|
|
|
@click.stop="handleLevelSetting(row)"
|
|
|
|
>
|
|
|
|
级别设置
|
|
|
|
</ghost-button> -->
|
|
|
|
<ghost-button
|
|
|
|
v-access:code="['video:warning:view']"
|
|
|
|
@click.stop="handleView(row)"
|
|
|
|
>
|
|
|
|
{{ $t('pages.common.info') }}
|
|
|
|
</ghost-button>
|
2025-08-18 09:06:31 +08:00
|
|
|
|
2025-08-12 13:51:35 +08:00
|
|
|
<ghost-button
|
|
|
|
v-access:code="['video:warning:edit']"
|
|
|
|
@click.stop="handleEdit(row)"
|
|
|
|
>
|
2025-08-18 09:06:31 +08:00
|
|
|
处理
|
2025-08-12 13:51:35 +08:00
|
|
|
</ghost-button>
|
2025-08-18 09:06:31 +08:00
|
|
|
|
2025-08-12 13:51:35 +08:00
|
|
|
<Popconfirm
|
|
|
|
:get-popup-container="getVxePopupContainer"
|
|
|
|
placement="left"
|
|
|
|
title="确认删除?"
|
|
|
|
@confirm="handleDelete(row)"
|
|
|
|
>
|
|
|
|
<ghost-button
|
|
|
|
danger
|
|
|
|
v-access:code="['video:warning:remove']"
|
|
|
|
@click.stop=""
|
|
|
|
>
|
|
|
|
{{ $t('pages.common.delete') }}
|
|
|
|
</ghost-button>
|
|
|
|
</Popconfirm>
|
|
|
|
</Space>
|
|
|
|
</template>
|
|
|
|
</BasicTable>
|
|
|
|
<WarningModal @reload="tableApi.query()" />
|
|
|
|
<WarningDetail />
|
|
|
|
</Page>
|
|
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.ant-table-wrapper {
|
|
|
|
.ant-table-thead > tr > th {
|
|
|
|
background-color: #fafafa;
|
|
|
|
font-weight: 600;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.ant-pagination {
|
|
|
|
.ant-pagination-item-active {
|
|
|
|
background-color: #1890ff;
|
|
|
|
border-color: #1890ff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|