2026-04-03 09:56:14 +08:00
|
|
|
import { BasicColumn, FormSchema } from '/@/components/Table';
|
2026-05-18 20:05:03 +08:00
|
|
|
import { h } from 'vue';
|
|
|
|
|
import { Tag, Tooltip } from 'ant-design-vue';
|
2026-04-03 09:56:14 +08:00
|
|
|
|
|
|
|
|
export const columns: BasicColumn[] = [
|
|
|
|
|
{
|
|
|
|
|
title: '表名',
|
|
|
|
|
dataIndex: 'dataTable',
|
2026-05-18 20:05:03 +08:00
|
|
|
width: 120,
|
2026-04-03 09:56:14 +08:00
|
|
|
align: 'left',
|
2026-05-18 20:05:03 +08:00
|
|
|
customRender: ({ text }) => {
|
|
|
|
|
return h(Tag, { color: 'blue' }, () => text);
|
|
|
|
|
},
|
2026-04-03 09:56:14 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '数据ID',
|
|
|
|
|
dataIndex: 'dataId',
|
2026-05-18 20:05:03 +08:00
|
|
|
width: 260,
|
|
|
|
|
align: 'left',
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
customRender: ({ text }) => {
|
|
|
|
|
return h(
|
|
|
|
|
'span',
|
|
|
|
|
{ style: 'font-family: Consolas, Monaco, monospace; font-size: 12px; color: #595959' },
|
|
|
|
|
text
|
|
|
|
|
);
|
|
|
|
|
},
|
2026-04-03 09:56:14 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '版本号',
|
|
|
|
|
dataIndex: 'dataVersion',
|
2026-05-18 20:05:03 +08:00
|
|
|
width: 70,
|
|
|
|
|
align: 'center',
|
|
|
|
|
customRender: ({ text }) => {
|
|
|
|
|
return h(Tag, { color: 'green' }, () => 'V' + text);
|
|
|
|
|
},
|
2026-04-03 09:56:14 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '数据内容',
|
|
|
|
|
dataIndex: 'dataContent',
|
2026-05-18 20:05:03 +08:00
|
|
|
ellipsis: true,
|
|
|
|
|
customRender: ({ text }) => {
|
|
|
|
|
if (!text) return '--';
|
|
|
|
|
// 尝试格式化 JSON 显示关键字段
|
|
|
|
|
try {
|
|
|
|
|
const obj = JSON.parse(text);
|
|
|
|
|
const keys = Object.keys(obj);
|
|
|
|
|
const preview = keys
|
|
|
|
|
.slice(0, 3)
|
|
|
|
|
.map((k) => {
|
|
|
|
|
const v = obj[k];
|
|
|
|
|
const val = v === null || v === undefined || v === '' ? '--' : String(v);
|
|
|
|
|
return `${k}: ${val.length > 20 ? val.substring(0, 20) + '...' : val}`;
|
|
|
|
|
})
|
|
|
|
|
.join(' | ');
|
|
|
|
|
const suffix = keys.length > 3 ? ` (+${keys.length - 3} 字段)` : '';
|
|
|
|
|
return h(
|
|
|
|
|
Tooltip,
|
|
|
|
|
{ title: JSON.stringify(obj, null, 2), overlayStyle: { maxWidth: '500px', whiteSpace: 'pre-wrap', fontFamily: 'Consolas, monospace', fontSize: '12px' } },
|
|
|
|
|
() => h('span', { style: 'font-size: 12px; color: #595959' }, preview + suffix)
|
|
|
|
|
);
|
|
|
|
|
} catch {
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-04-03 09:56:14 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '创建人',
|
|
|
|
|
dataIndex: 'createBy',
|
|
|
|
|
sorter: true,
|
2026-05-18 20:05:03 +08:00
|
|
|
width: 90,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '创建时间',
|
|
|
|
|
dataIndex: 'createTime',
|
|
|
|
|
width: 120,
|
|
|
|
|
sorter: true,
|
2026-04-03 09:56:14 +08:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const searchFormSchema: FormSchema[] = [
|
|
|
|
|
{
|
|
|
|
|
field: 'dataTable',
|
|
|
|
|
label: '表名',
|
|
|
|
|
component: 'Input',
|
2026-05-18 20:05:03 +08:00
|
|
|
componentProps: {
|
|
|
|
|
placeholder: '请输入表名',
|
|
|
|
|
},
|
|
|
|
|
colProps: { span: 6 },
|
2026-04-03 09:56:14 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'dataId',
|
|
|
|
|
label: '数据ID',
|
|
|
|
|
component: 'Input',
|
2026-05-18 20:05:03 +08:00
|
|
|
componentProps: {
|
|
|
|
|
placeholder: '请输入数据ID',
|
|
|
|
|
},
|
|
|
|
|
colProps: { span: 6 },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'createBy',
|
|
|
|
|
label: '创建人',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
componentProps: {
|
|
|
|
|
placeholder: '请输入创建人',
|
|
|
|
|
},
|
|
|
|
|
colProps: { span: 6 },
|
2026-04-03 09:56:14 +08:00
|
|
|
},
|
|
|
|
|
];
|