index.ts
2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { Tooltip } from 'ant-design-vue';
import { h } from 'vue';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
import { handeleCopy } from '/@/views/device/profiles/step/topic';
import { findDictItemByCode } from '/@/api/system/dict';
const { t } = useI18n();
export const formatClassifyText = {
DEVICE: t('application.config.classifyText.device'),
ALARM: t('application.config.classifyText.alarm'),
VIDEO: t('application.config.classifyText.video'),
STATISTICS: t('application.config.classifyText.statistics'),
SYSTEM: t('application.config.classifyText.system'),
};
// const formatRequestMethodText = {
// 0: 'GET',
// 1: 'POST',
// 2: 'PUT',
// 3: 'DELETE',
// };
// 表格数据
export const columns: BasicColumn[] = [
{
title: t('application.api.text.name'),
dataIndex: 'name',
width: 120,
},
{
title: t('application.api.text.categoryName'),
dataIndex: 'classify',
width: 120,
format(text) {
return formatClassifyText[text];
},
},
{
title: t('application.api.text.interfaceAddress'),
dataIndex: 'uri',
width: 180,
customRender: ({ record }) => {
return h('div', { class: 'py-3 px-3.5' }, [
record.uri &&
h(
'div',
{
style: {
color: '#1677ff',
},
class: 'cursor-pointer truncate',
onClick: () => {
handeleCopy(`${record.uri}`);
},
},
h(
Tooltip,
{
placement: 'topLeft',
title: `${record.uri}`,
},
() => `${record.uri}`
)
),
]);
},
},
{
title: t('application.api.text.requestMethod'),
dataIndex: 'requestMethod',
width: 120,
// format(text) {
// return formatRequestMethodText[text];
// },
},
{
title: t('common.createTimeText'),
dataIndex: 'createTime',
width: 180,
},
];
// 分页查询
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: t('application.api.text.name'),
component: 'Input',
componentProps: {
maxLength: 255,
},
},
{
field: 'classify',
label: t('application.api.text.categoryName'),
component: 'ApiSelect',
componentProps: {
api: findDictItemByCode,
params: {
dictCode: 'open_api_classify',
},
labelField: 'itemText',
valueField: 'itemValue',
},
},
];