config.ts
2.81 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
import { BasicColumn, FormSchema } from '/@/components/Table';
import moment from 'moment';
import { Tag } from 'ant-design-vue';
import { h } from 'vue';
// 表格配置
export const columns: BasicColumn[] = [
{
title: '命令下发时间',
dataIndex: 'createTime',
format: (text) => {
return moment(text).format('YYYY-MM-DD HH:mm:ss');
},
},
{
title: '命令类型',
dataIndex: 'additionalInfo.cmdType',
format: (text) => {
return h(
Tag,
{
color: Number(text) === 1 ? 'green' : 'blue',
},
() => (Number(text) === 1 ? '服务' : '自定义')
) as unknown as any;
},
},
{
title: '响应类型',
dataIndex: 'request.oneway',
format: (text) => {
return !text ? '双向' : '单向';
},
},
{
title: '命令状态',
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',
},
() => record?.statusName
);
},
},
{
title: '响应内容',
dataIndex: 'response111',
slots: { customRender: 'responseContent' },
},
{
title: '命令内容',
dataIndex: 'request.body',
slots: { customRender: 'recordContent' },
},
];
// 表格查询表单
export const searchFormSchema: FormSchema[] = [
{
field: 'status',
label: '命令状态',
component: 'Select',
colProps: { span: 6 },
componentProps: {
options: [
{
label: '队列中',
value: 'QUEUED',
},
{
label: '已发送',
value: 'SENT',
},
{
label: '发送成功',
value: 'DELIVERED',
},
{
label: '响应成功',
value: 'SUCCESSFUL',
},
{
label: '超时',
value: 'TIMEOUT',
},
{
label: '已过期',
value: 'EXPIRED',
},
{
label: '响应失败',
value: 'FAILED',
},
{
label: '已删除',
value: 'DELETED',
},
],
placeholder: '请选择命令状态',
},
},
{
field: 'sendTime',
label: '命令下发时间',
component: 'RangePicker',
componentProps: {
showTime: {
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
},
},
colProps: { span: 10 },
},
];