fix: 优化后台体验与导出日志交互
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
remote
|
||||
:scroll-x="1120"
|
||||
:row-key="(r) => r.id"
|
||||
@update:sorter="onSorterChange"
|
||||
/>
|
||||
<div class="table-pagination">
|
||||
<n-pagination v-bind="pagination" :disabled="loading" />
|
||||
@@ -111,6 +112,7 @@ import { message, dialog } from '@/utils/feedback';
|
||||
import { fmt, statusType } from '@/utils/format';
|
||||
import { useTablePage } from '@/composables/useTablePage';
|
||||
import { renderTableFilterTitle } from '@/utils/tableFilter';
|
||||
import { useRemoteSort } from '@/utils/tableSort';
|
||||
|
||||
const { t } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
@@ -119,6 +121,7 @@ const rows = ref<any[]>([]);
|
||||
const loading = ref(false);
|
||||
const query = reactive<{ keyword: string; status: string | null }>({ keyword: '', status: null });
|
||||
const { pagination, page, pageSize, resetPage, setPageResult } = useTablePage(load);
|
||||
const { sortProps, onSorterChange, sortParams } = useRemoteSort(onSearch);
|
||||
|
||||
const fieldTypeOptions = Object.values(FieldType).map((v) => ({ label: t(`common.fieldType.${v}`), value: v }));
|
||||
const statusOptions = Object.values(TemplateStatus).map((v) => ({ label: t(`common.status.${v}`), value: v }));
|
||||
@@ -131,8 +134,20 @@ const form = reactive<{ name: string; remark: string; status: string; fields: an
|
||||
const rules: FormRules = { name: { required: true, message: () => t('pages.template.namePlaceholder'), trigger: 'blur' } };
|
||||
|
||||
const columns: DataTableColumns<any> = [
|
||||
{ title: 'ID', key: 'id', width: 70, align: 'center' },
|
||||
{ title: () => t('pages.template.name'), key: 'name', minWidth: 220, ellipsis: { tooltip: true } },
|
||||
{
|
||||
title: 'ID',
|
||||
key: 'id',
|
||||
width: 70,
|
||||
align: 'center',
|
||||
render: (r) => h(NButton, { text: true, type: 'primary', title: t('pages.template.edit'), onClick: () => openEdit(r) }, { default: () => String(r.id) }),
|
||||
},
|
||||
{
|
||||
title: () => t('pages.template.name'),
|
||||
key: 'name',
|
||||
minWidth: 220,
|
||||
ellipsis: { tooltip: true },
|
||||
render: (r) => h(NButton, { text: true, type: 'primary', title: t('pages.template.edit'), onClick: () => openEdit(r) }, { default: () => r.name || '-' }),
|
||||
},
|
||||
{
|
||||
title: () => t('pages.template.fields'),
|
||||
key: 'fields',
|
||||
@@ -148,7 +163,7 @@ const columns: DataTableColumns<any> = [
|
||||
render: (r) => h(NTag, { type: statusType(r.status), size: 'small' }, { default: () => t(`common.status.${r.status}`) }),
|
||||
},
|
||||
{ title: () => t('pages.template.useCount'), key: 'useCount', width: 100, align: 'center', render: (r) => r._count?.artworks ?? 0 },
|
||||
{ title: () => t('common.label.createdAt'), key: 'createdAt', width: 160, align: 'center', render: (r) => fmt(r.createdAt) },
|
||||
{ title: () => t('common.label.createdAt'), key: 'createdAt', width: 160, align: 'center', render: (r) => fmt(r.createdAt), ...sortProps('createdAt') },
|
||||
{
|
||||
title: () => t('common.label.operation'),
|
||||
key: 'ops',
|
||||
@@ -200,6 +215,7 @@ async function load() {
|
||||
status: query.status || undefined,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
...sortParams(),
|
||||
});
|
||||
rows.value = res.list;
|
||||
setPageResult(res);
|
||||
|
||||
Reference in New Issue
Block a user