🔨 表格字段.
This commit is contained in:
@@ -78,6 +78,11 @@
|
||||
</template>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
<!-- 调整 -->
|
||||
<table-adjust :columns="columns"
|
||||
:columns-hook="columnsHook"
|
||||
:query-order="queryOrder"
|
||||
@query="fetchTableData" />
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
@@ -86,7 +91,7 @@
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:columns="tableColumns"
|
||||
:row-selection="rowSelection"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
@@ -165,22 +170,26 @@
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
||||
import { dictValueTypeKey } from '../types/const';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { TableName, dictValueTypeKey } from '../types/const';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { useCacheStore, useDictStore } from '@/store';
|
||||
import { getDictValueList } from '@/api/system/dict-value';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openView']);
|
||||
|
||||
const cacheStore = useCacheStore();
|
||||
const pagination = useTablePagination();
|
||||
const rowSelection = useRowSelection();
|
||||
const pagination = useTablePagination();
|
||||
const queryOrder = useQueryOrder(TableName, DESC);
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
|
||||
const selectedKeys = ref<number[]>([]);
|
||||
const tableRenderData = ref<DictKeyQueryResponse[]>([]);
|
||||
const selectedKeys = ref<Array<number>>([]);
|
||||
const tableRenderData = ref<Array<DictKeyQueryResponse>>([]);
|
||||
const formModel = reactive<DictKeyQueryRequest>({
|
||||
id: undefined,
|
||||
keyName: undefined,
|
||||
@@ -259,7 +268,7 @@
|
||||
const doFetchTableData = async (request: DictKeyQueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await getDictKeyPage(request);
|
||||
const { data } = await getDictKeyPage(queryOrder.markOrderly(request));
|
||||
tableRenderData.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// 表名称
|
||||
export const TableName = 'dict-key';
|
||||
|
||||
// 配置值类型定义
|
||||
export const ValueType = {
|
||||
// 字符串
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue';
|
||||
import { dateFormat } from '@/utils';
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@@ -8,6 +9,7 @@ const columns = [
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
default: true,
|
||||
}, {
|
||||
title: '配置项',
|
||||
dataIndex: 'keyName',
|
||||
@@ -15,6 +17,7 @@ const columns = [
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '配置描述',
|
||||
dataIndex: 'description',
|
||||
@@ -22,23 +25,63 @@ const columns = [
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '类型',
|
||||
dataIndex: 'valueType',
|
||||
slotName: 'valueType',
|
||||
align: 'left',
|
||||
width: 150
|
||||
width: 150,
|
||||
default: true,
|
||||
}, {
|
||||
title: '额外配置',
|
||||
dataIndex: 'extraSchema',
|
||||
slotName: 'extraSchema',
|
||||
align: 'left',
|
||||
default: true,
|
||||
}, {
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
slotName: 'createTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.createTime));
|
||||
},
|
||||
default: false,
|
||||
}, {
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
slotName: 'updateTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.updateTime));
|
||||
},
|
||||
default: true,
|
||||
}, {
|
||||
title: '创建人',
|
||||
dataIndex: 'creator',
|
||||
slotName: 'creator',
|
||||
width: 148,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: false,
|
||||
}, {
|
||||
title: '修改人',
|
||||
dataIndex: 'updater',
|
||||
slotName: 'updater',
|
||||
width: 148,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: false,
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 170,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
default: true,
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@
|
||||
</template>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
<!-- 调整 -->
|
||||
<table-adjust :columns="columns"
|
||||
:columns-hook="columnsHook"
|
||||
:query-order="queryOrder"
|
||||
@query="fetchTableData" />
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
@@ -72,7 +77,7 @@
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:columns="tableColumns"
|
||||
:row-selection="rowSelection"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
@@ -146,14 +151,19 @@
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { TableName } from '../types/const';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import DictKeySelector from '@/components/system/dict-key/selector/index.vue';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openHistory']);
|
||||
|
||||
const pagination = useTablePagination();
|
||||
const rowSelection = useRowSelection();
|
||||
const pagination = useTablePagination();
|
||||
const queryOrder = useQueryOrder(TableName, DESC);
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||
const { loading, setLoading } = useLoading();
|
||||
|
||||
const selectedKeys = ref<Array<number>>([]);
|
||||
@@ -225,7 +235,7 @@
|
||||
const doFetchTableData = async (request: DictValueQueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await getDictValuePage(request);
|
||||
const { data } = await getDictValuePage(queryOrder.markOrderly(request));
|
||||
tableRenderData.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
// 表名称
|
||||
export const TableName = 'dict-value';
|
||||
|
||||
// 历史值类型
|
||||
export const historyType = 'DICT';
|
||||
|
||||
@@ -9,13 +9,15 @@ const columns = [
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
default: true,
|
||||
}, {
|
||||
title: '配置项',
|
||||
dataIndex: 'keyName',
|
||||
slotName: 'keyName',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '配置描述',
|
||||
dataIndex: 'label',
|
||||
@@ -23,12 +25,14 @@ const columns = [
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '配置值',
|
||||
dataIndex: 'value',
|
||||
slotName: 'value',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '额外参数',
|
||||
dataIndex: 'extra',
|
||||
@@ -36,12 +40,24 @@ const columns = [
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '排序',
|
||||
dataIndex: 'sort',
|
||||
slotName: 'sort',
|
||||
align: 'left',
|
||||
width: 70,
|
||||
default: true,
|
||||
}, {
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
slotName: 'createTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.createTime));
|
||||
},
|
||||
default: false,
|
||||
}, {
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
@@ -51,12 +67,30 @@ const columns = [
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.updateTime));
|
||||
},
|
||||
default: true,
|
||||
}, {
|
||||
title: '创建人',
|
||||
dataIndex: 'creator',
|
||||
slotName: 'creator',
|
||||
width: 148,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: false,
|
||||
}, {
|
||||
title: '修改人',
|
||||
dataIndex: 'updater',
|
||||
slotName: 'updater',
|
||||
width: 148,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: false,
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 170,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
default: true,
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user