config.ts
3.43 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { BasicColumn, FormSchema } from '/@/components/Table';
import moment from 'moment';
import { Tag } from 'ant-design-vue';
import { h } from 'vue';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
// 表格配置
export const columns: BasicColumn[] = [
{
title: t('deviceManagement.device.commandDeliveryTimeText'),
dataIndex: 'createTime',
format: (text) => {
return moment(text).format('YYYY-MM-DD HH:mm:ss');
},
},
{
title: t('deviceManagement.device.commandDeliveryTypeText'),
dataIndex: 'additionalInfo.cmdType',
format: (text) => {
return h(
Tag,
{
color: Number(text) === 1 ? 'green' : 'blue',
},
() => (Number(text) === 1 ? t('enum.commandType.service') : t('enum.commandType.custom'))
) as unknown as any;
},
},
{
title: t('deviceManagement.device.responseTypeText'),
dataIndex: 'request.oneway',
format: (text) => {
return !text ? t('enum.commandWay.twoway') : t('enum.commandWay.oneway');
},
},
{
title: t('deviceManagement.device.commandStatusText'),
dataIndex: 'status',
customRender: ({ text, record }) => {
return h(
Tag,
{
color:
text == 'EXPIRED'
? 'red'
: text == 'DELIVERED'
? 'blue'
: text == 'QUEUED'
? '#00C9A7'
: text == 'TIMEOUT'
? 'red'
: text == 'SENT'
? '#00C9A7'
: text == 'FAILED'
? 'red'
: text == 'SUCCESSFUL'
? 'green'
: 'red',
},
() => t(`enum.commandStatus.${record?.status}`)
);
},
},
{
title: t('deviceManagement.device.responseContentText'),
dataIndex: 'response111',
slots: { customRender: 'responseContent' },
},
{
title: t('deviceManagement.device.commandContentText'),
dataIndex: 'request.body',
slots: { customRender: 'recordContent' },
},
];
// 表格查询表单
export const searchFormSchema: FormSchema[] = [
{
field: 'status',
label: t('deviceManagement.device.commandStatusText'),
component: 'Select',
colProps: { span: 6 },
componentProps: {
options: [
{
label: t('enum.commandStatus.QUEUED'),
value: 'QUEUED',
},
{
label: t('enum.commandStatus.SENT'),
value: 'SENT',
},
{
label: t('enum.commandStatus.DELIVERED'),
value: 'DELIVERED',
},
{
label: t('enum.commandStatus.SUCCESSFUL'),
value: 'SUCCESSFUL',
},
{
label: t('enum.commandStatus.TIMEOUT'),
value: 'TIMEOUT',
},
{
label: t('enum.commandStatus.EXPIRED'),
value: 'EXPIRED',
},
{
label: t('enum.commandStatus.FAILED'),
value: 'FAILED',
},
{
label: t('enum.commandStatus.DELETED'),
value: 'DELETED',
},
],
placeholder: t('common.chooseText') + t('deviceManagement.device.commandStatusText'),
},
},
{
field: 'sendTime',
label: t('deviceManagement.device.commandDeliveryTimeText'),
component: 'RangePicker',
componentProps: {
showTime: {
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
},
},
colProps: { span: 10 },
},
];