index.ts
2.73 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
109
110
111
112
113
114
115
116
import moment from 'moment';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
import { ApplicationRecordItemType } from '/@/api/application/model/record';
import { Tag } from 'ant-design-vue';
import { h } from 'vue';
import { formatClassifyText } from '../../api/config';
import { findDictItemByCode } from '/@/api/system/dict';
const { t } = useI18n();
// 表格数据
export const columns: BasicColumn[] = [
{
title: t('application.record.text.applicationName'),
dataIndex: 'applicationName',
width: 120,
},
{
title: t('application.record.text.apiName'),
dataIndex: 'apiName',
width: 120,
},
{
title: t('application.record.text.categoryName'),
dataIndex: 'classify',
width: 180,
format(text) {
return formatClassifyText[text];
},
},
{
title: t('application.record.text.interfaceResponse'),
dataIndex: 'message',
width: 180,
},
{
title: t('application.record.text.callTime'),
dataIndex: 'requestTime',
width: 120,
format(text) {
return moment(text).format('YYYY-MM-DD HH:mm:ss');
},
},
{
title: t('application.record.text.interfaceStatus'),
dataIndex: 'state',
width: 180,
customRender({ record }: { record: ApplicationRecordItemType }) {
const flag = record?.state === 1;
return h(Tag, { color: !flag ? 'red' : 'blue' }, () =>
flag ? t('common.successText') : t('common.failText')
);
},
},
];
// 分页查询
export const searchFormSchema: FormSchema[] = [
{
field: 'applicationName',
label: t('application.record.text.applicationName'),
component: 'Input',
componentProps: {
maxLength: 255,
},
},
{
field: 'apiName',
label: t('application.record.text.apiName'),
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',
},
},
{
field: 'state',
label: t('application.record.text.interfaceStatus'),
component: 'Select',
componentProps: {
options: [
{
label: t('common.successText'),
value: 1,
},
{
label: t('common.failText'),
value: 0,
},
],
},
},
{
field: 'callTime',
label: t('application.record.text.callTime'),
component: 'RangePicker',
componentProps: {
showTime: {
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
},
},
},
];