diff --git a/src/pages/vimp-log-page.vue b/src/pages/vimp-log-page.vue index 25c1f1c..686ca9b 100644 --- a/src/pages/vimp-log-page.vue +++ b/src/pages/vimp-log-page.vue @@ -74,6 +74,7 @@ const searchFields = reactive({ logType_in: [] as number[], createdTime: [dayjs().startOf('date').subtract(1, 'week').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss')] as [string, string], }); + const resetSearchFields = () => { searchFields.stationCode = stationList.value.find((station) => station.online)?.code; searchFields.logType_in = []; @@ -104,21 +105,44 @@ const onDateChange = (value: [number, number] | null) => { } }; +const searchFieldsChanged = ref(false); +watch(searchFields, () => { + searchFieldsChanged.value = true; +}); + const tableColumns: DataTableColumns = [ { title: '时间', key: 'createdTime' }, { title: '操作类型', key: 'description' }, { title: '请求IP', key: 'requestIp' }, + { title: '耗时(ms)', key: 'consumedTime' }, { title: '操作参数', key: 'params', + width: 100, render(rowData) { const result = JSON.stringify(destr(rowData.params), null, 2); - return h('pre', {}, { default: () => result }); + // return h('pre', {}, { default: () => result }); + return h( + NPopover, + { trigger: 'click' }, + { + trigger: () => h(NButton, { size: 'tiny', text: true, type: 'primary' }, { default: () => '查看' }), + default: () => + h( + NScrollbar, + { style: { maxHeight: '40vh' } }, + { + default: () => h('pre', {}, { default: () => result }), + }, + ), + }, + ); }, }, { title: '操作结果', key: 'result', + width: 100, render: (rowData) => { const result = JSON.stringify(destr(rowData.result), null, 2); return h( @@ -194,7 +218,14 @@ const onClickReset = () => { tablePagination.itemCount = 0; getVimpLogList(); }; -const onClickQuery = () => getVimpLogList(); +const onClickQuery = () => { + if (searchFieldsChanged.value) { + tablePagination.page = 1; + tablePagination.pageSize = 10; + searchFieldsChanged.value = false; + } + getVimpLogList(); +}; const { mutate: downloadTableData, isPending: isDownloading } = useMutation({ mutationFn: async () => {