fix: 看板异常查询点进去显示对应的查询记录

This commit is contained in:
Nixevol
2026-11-15 14:47:52 +08:00
parent d1ade47864
commit a5f7844125
6 changed files with 66 additions and 11 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ const stats = computed(() => [
{ key: 'activatedCodes', label: t('pages.dashboard.activatedCodes'), icon: CheckmarkCircleOutline, color: '#138a72', open: () => router.push({ path: '/trace-codes', query: { status: 'ACTIVE' } }) },
{ key: 'totalQueries', label: t('pages.dashboard.totalQueries'), icon: SearchOutline, color: '#3a7bd5', open: () => router.push('/query-logs') },
{ key: 'todayQueries', label: t('pages.dashboard.todayQueries'), icon: TodayOutline, color: '#b9851f', open: () => router.push({ path: '/query-logs', query: { quickRange: 'today' } }) },
{ key: 'abnormalQueries', label: t('pages.dashboard.abnormalQueries'), icon: WarningOutline, color: '#c0392b', open: () => router.push({ path: '/query-logs', query: { result: 'ABNORMAL' } }) },
{ key: 'abnormalQueries', label: t('pages.dashboard.abnormalQueries'), icon: WarningOutline, color: '#c0392b', open: () => router.push({ path: '/query-logs', query: { abnormal: '1' } }) },
]);
const trendOption = computed(() => ({
+11 -4
View File
@@ -60,7 +60,7 @@ import { useI18n } from 'vue-i18n';
import { NTag, type DataTableColumns } from 'naive-ui';
import { SearchOutline } from '@vicons/ionicons5';
import dayjs from 'dayjs';
import { QueryResult } from '@artveris/shared';
import { ABNORMAL_QUERY_RESULTS, QueryResult } from '@artveris/shared';
import { queryLogApi } from '@/api';
import { fmt, statusType } from '@/utils/format';
import { useTablePage } from '@/composables/useTablePage';
@@ -80,7 +80,12 @@ const query = reactive<{ keyword: string; archiveNo: string; batchNo: string; re
});
const { pagination, page, pageSize, resetPage, setPageResult } = useTablePage(load);
const { sortProps, onSorterChange, sortParams } = useRemoteSort(onSearch);
const resultOptions = Object.values(QueryResult).map((v) => ({ label: t(`common.queryResult.${v}`), value: v }));
// 看板「异常查询」的口径:无效、停用、异常三种一起看
const ABNORMAL_GROUP = '__abnormal__';
const resultOptions = [
...Object.values(QueryResult).map((v) => ({ label: t(`common.queryResult.${v}`), value: v as string })),
{ label: ABNORMAL_QUERY_RESULTS.map((v) => t(`common.queryResult.${v}`)).join(' / '), value: ABNORMAL_GROUP },
];
const columns: DataTableColumns<any> = [
{ title: () => t('pages.traceCode.shortCode'), key: 'shortCode', width: 130, align: 'center', ellipsis: { tooltip: true }, render: (r) => r.shortCode || '-' },
@@ -121,7 +126,8 @@ async function load() {
keyword: query.keyword || undefined,
archiveNo: query.archiveNo || undefined,
batchNo: query.batchNo || undefined,
result: query.result || undefined,
result: query.result && query.result !== ABNORMAL_GROUP ? query.result : undefined,
abnormal: query.result === ABNORMAL_GROUP ? true : undefined,
startTime: query.startTime,
endTime: query.endTime,
page: page.value,
@@ -154,7 +160,8 @@ function setResultFilter(value: string | number | null) {
}
onMounted(() => {
if (typeof route.query.result === 'string') query.result = route.query.result;
if (route.query.abnormal === '1') query.result = ABNORMAL_GROUP;
else if (typeof route.query.result === 'string') query.result = route.query.result;
if (route.query.quickRange === 'today') {
const start = dayjs().startOf('day');
const end = dayjs().endOf('day');