topic.tsx
5.07 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import { BasicColumn } from '/@/components/Table/src/types/table';
import { h, unref } from 'vue';
import { useClipboard } from '@vueuse/core';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
export const handeleCopy = async (e) => {
const { copied, copy } = useClipboard({ legacy: true });
await copy(JSON.parse(JSON.stringify(unref(e), null, 2)));
if (unref(copied)) {
createMessage.success('复制成功!');
}
};
export const topicTableColumn: BasicColumn[] = [
{
title: '设备类型',
dataIndex: 'deviceType',
width: 40,
align: 'left',
customRender: ({ text, index }: { text: any; index: number }) => {
const obj: any = {
children: text,
attrs: {},
};
if (text !== '网关/直连/网关子设备') {
if (index === 0) {
obj.attrs.rowSpan = 6;
}
if (index > 0 && index < 6) {
obj.attrs.rowSpan = 0;
}
if (index > 6) {
obj.attrs.rowSpan = 0;
}
if (index === 6) {
obj.attrs.rowSpan = 4;
}
return obj;
} else {
return obj;
}
},
},
{
title: '功能',
dataIndex: 'function',
width: 80,
align: 'left',
slots: { customRender: 'function' },
},
{
title: '发布主题',
dataIndex: 'release',
width: 80,
align: 'left',
customRender: ({ text }: { text: any }) => {
return h(
'span',
{
style: { cursor: 'pointer' },
onClick: () => {
handeleCopy(text);
},
},
text
);
},
},
{
title: '订阅主题',
dataIndex: 'subscribe',
width: 80,
align: 'left',
customRender: ({ text }: { text: any }) => {
return h(
'span',
{
style: { cursor: 'pointer' },
onClick: () => {
handeleCopy(text);
},
},
text
);
},
},
{
title: '平台',
dataIndex: 'platform',
width: 30,
slots: { customRender: 'platform' },
},
{
title: '设备',
dataIndex: 'device',
width: 30,
slots: { customRender: 'device' },
},
];
export const list = [
{
deviceType: '网关/直连设备',
function: '网关/直连设备遥测',
release: 'v1/devices/me/telemetry',
subscribe: 'v1/devices/me/telemetry',
platform: '订阅',
device: '发布',
},
{
deviceType: '网关/直连设备',
function: '服务端命令下发到设备端',
release: 'v1/devices/me/rpc/request/$request_id',
subscribe: 'v1/devices/me/rpc/request/+',
platform: '发布',
device: '订阅',
},
{
deviceType: '网关/直连设备',
function: '设备端响应命令到服务端',
release: 'v1/devices/me/rpc/response/$request_id',
subscribe: 'v1/devices/me/rpc/response/+',
platform: '订阅',
device: '发布',
},
{
deviceType: '网关/直连设备',
function: '直连设备属性上报',
release: 'v1/devices/me/attributes',
subscribe: 'v1/devices/me/attributes',
platform: '订阅',
device: '发布',
},
{
deviceType: '网关/直连设备',
function: '设备端请求服务端共享属性及客户端属性',
release: 'v1/devices/me/attributes/request/$request_id',
subscribe: 'v1/devices/me/attributes/response/+',
platform: '订阅',
device: '发布',
},
{
deviceType: '网关/直连设备',
function: '服务端响应共享属性集客户端属性给设备端',
release: 'v1/devices/me/attributes/response/$request_id',
subscribe: 'v1/devices/me/attributes/response/+',
platform: '发布',
device: '订阅',
},
{
deviceType: '网关子设备',
function: '设备端请求服务端子设备共享属性及客户端属性',
release: 'v1/gateway/attributes/request',
subscribe: 'v1/gateway/attributes/request',
platform: '订阅',
device: '发布',
},
{
deviceType: '网关子设备',
function: '服务端响应子设备共享属性及客户端属性给设备端',
release: 'v1/gateway/attributes/response',
subscribe: 'v1/gateway/attributes/response',
platform: '发布',
device: '订阅',
},
{
deviceType: '网关子设备',
function: '设备端上报子设备客户端属性',
release: 'v1/gateway/attributes',
subscribe: 'v1/gateway/attributes',
platform: '订阅',
device: '发布',
},
{
deviceType: '网关子设备',
function: '网关子设备遥测',
release: 'v1/gateway/telemetry',
subscribe: 'v1/gateway/telemetry',
platform: '订阅',
device: '发布',
},
{
deviceType: '网关/直连/网关子设备',
function: '事件上报',
release: 'v1/devices/event/${deviceId}或${deviceName}/${identifier}',
subscribe: 'v1/devices/event/${deviceId}或${deviceName}/${identifier}',
platform: '订阅',
device: '发布',
},
];