feat: vimp operation type

This commit is contained in:
yangsy
2025-09-03 14:55:03 +08:00
parent bd9ddf2473
commit 58a9dea96d
2 changed files with 75 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ export interface NdmVimpLogVO extends BaseModel {
result: string;
httpMethod: string;
userId: string;
logType: number;
}
export type NdmVimpLogResultVO = Partial<NdmVimpLogVO>;

View File

@@ -1,3 +1,40 @@
<script lang="ts">
const vimpOperationTypeOptions: SelectOption[] = [
{ label: '视频点播', value: 10001 },
{ label: '视频回放', value: 10002 },
{ label: '停止视频回放', value: 10003 },
{ label: '回放暂停', value: 10004 },
{ label: '回放回复', value: 10005 },
{ label: '回放倍速播放', value: 10006 },
{ label: '回放拖动播放', value: 10007 },
{ label: '云台指令', value: 10008 },
{ label: '根据国标码查录像', value: 10009 },
{ label: '下载录像', value: 10010 },
{ label: '停止下载录像', value: 10011 },
{ label: '获取预置位列表', value: 10012 },
{ label: '设置本平台分屏数量', value: 20001 },
{ label: '设置本平台monitor播放的摄像机rtsp流', value: 20002 },
{ label: '停止本平台monitor播放的摄像机rtsp流', value: 20003 },
{ label: '启动非报警时序', value: 30001 },
{ label: '停止非报警时序', value: 30002 },
{ label: '暂停非报警时序', value: 30003 },
{ label: '调用组切', value: 30004 },
{ label: '启动报警时序', value: 40001 },
{ label: '停止报警时序', value: 40002 },
{ label: '分页查询报警', value: 50001 },
{ label: '确认报警', value: 50002 },
{ label: '删除报警', value: 50004 },
];
const tableColumns: DataTableColumns<NdmVimpLogResultVO> = [
{ title: '时间', key: 'createdTime' },
{ title: '操作内容', key: 'description' },
{ title: '请求IP', key: 'requestIp' },
{ title: '操作参数', key: 'params' },
{ title: '操作结果', key: 'result' },
];
</script>
<script setup lang="ts">
import type { NdmVimpLogResultVO } from '@/apis/models/device';
import { ndmVimpLogDefaultExportByTemplate, postNdmVimpLogPage } from '@/apis/requests';
@@ -23,11 +60,11 @@ import {
type SelectOption,
} from 'naive-ui';
import { storeToRefs } from 'pinia';
import { computed, h, onBeforeMount, reactive, ref } from 'vue';
import { computed, h, onMounted, reactive, ref, watch, watchEffect } from 'vue';
useStationListQuery();
const stationStore = useStationStore();
const { stationList } = storeToRefs(stationStore);
const { stationList, onlineStationList } = storeToRefs(stationStore);
const stationSelectOptions = computed(() => {
return stationList.value.map<SelectOption>((station) => ({
@@ -38,21 +75,15 @@ const stationSelectOptions = computed(() => {
});
const searchFields = reactive({
stationCode: stationList.value.find((s) => s.online)?.code,
stationCode: undefined as string | undefined,
logType_in: [] as number[],
createdTime: [dayjs().startOf('date').subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss')] as [string, string],
});
const resetSearchFields = () => {
searchFields.stationCode = undefined;
searchFields.stationCode = stationList.value.find((station) => station.online)?.code;
searchFields.logType_in = [];
};
const tableColumns: DataTableColumns<NdmVimpLogResultVO> = [
{ title: '时间', key: 'createdTime' },
{ title: '操作内容', key: 'description' },
{ title: '请求IP', key: 'requestIp' },
{ title: '操作参数', key: 'params' },
{ title: '操作结果', key: 'result' },
];
const tableData = ref<DataTableRowData[]>([]);
const tablePagination = reactive<PaginationProps>({
@@ -84,6 +115,7 @@ const { mutate: getVimpLogList, isPending: isTableLoading } = useMutation({
extra: {
createdTime_precisest: searchFields.createdTime[0],
createdTime_preciseed: searchFields.createdTime[1],
logType_in: searchFields.logType_in,
},
current: tablePagination.page ?? 1,
size: tablePagination.pageSize ?? 10,
@@ -122,6 +154,7 @@ const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
extra: {
createdTime_precisest: searchFields.createdTime[0],
createdTime_preciseed: searchFields.createdTime[1],
logType_in: searchFields.logType_in,
},
current: tablePagination.page ?? 1,
size: tablePagination.pageSize ?? 10,
@@ -140,7 +173,32 @@ const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
const exportTableData = () => downloadTableData();
onBeforeMount(() => getVimpLogList());
// 进入页面时选择首个在线的车站
onMounted(() => {
// if (onlineStationList.value.length > 0) {
// searchFields.stationCode = onlineStationList.value.at(0)?.code;
// getVimpLogList();
// } else {
// const watchHandle = watch(onlineStationList, (onlineStations) => {
// searchFields.stationCode = onlineStations.at(0)?.code;
// watchHandle.stop();
// getVimpLogList();
// });
// }
});
// 进入页面时选择首个在线的车站
// 当页面刷新时车站列表还没有加载完成defaultStation不存在if条件为false
// 等待车站列表加载完成后defaultStation会更新if条件为true会更新选择的车站并加载日志记录。
// 当从其他页面跳转过来时车站列表已经存在defaultStation存在if条件为true会更新选择的车站并加载日志记录。
// 由于if条件是and逻辑所以即使defaultStation因车站状态变化而更新由于已经选择了车站所以if条件为false。
const defaultStation = computed(() => onlineStationList.value.at(0));
watchEffect(() => {
if (defaultStation.value?.code && !searchFields.stationCode) {
searchFields.stationCode = defaultStation.value.code;
getVimpLogList();
}
});
</script>
<template>
@@ -166,6 +224,9 @@ onBeforeMount(() => getVimpLogList());
clearable
/>
</NFormItemGi>
<NFormItemGi :span="1" label="操作类型" label-placement="left">
<NSelect v-model:value="searchFields.logType_in" :options="vimpOperationTypeOptions" multiple clearable />
</NFormItemGi>
<NFormItemGi :span="1" label="时间" label-placement="left">
<NDatePicker v-model:formatted-value="searchFields.createdTime" type="datetimerange" />
</NFormItemGi>