Commit 499d2b8a9a08494b5c05f59a33fdf73b4dcebe79

Authored by fengtao
1 parent 86838065

pref:优化Topic里的内容 合并表格

@@ -447,39 +447,3 @@ export const formSchema: FormSchema[] = [ @@ -447,39 +447,3 @@ export const formSchema: FormSchema[] = [
447 }, 447 },
448 }, 448 },
449 ]; 449 ];
450 -  
451 -export const topicTableColumn: BasicColumn[] = [  
452 - {  
453 - title: '功能',  
454 - dataIndex: 'function',  
455 - width: 100,  
456 - },  
457 - {  
458 - title: '发布主题',  
459 - dataIndex: 'release',  
460 - width: 100,  
461 - },  
462 -  
463 - {  
464 - title: '订阅主题',  
465 - dataIndex: 'subscribe',  
466 - width: 100,  
467 - },  
468 - {  
469 - title: '平台',  
470 - dataIndex: 'platform',  
471 - width: 30,  
472 - },  
473 -  
474 - {  
475 - title: '设备',  
476 - dataIndex: 'device',  
477 - width: 30,  
478 - },  
479 -  
480 - // {  
481 - // title: '描述',  
482 - // dataIndex: 'description',  
483 - // width: 100,  
484 - // },  
485 -];  
1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 - import { topicTableColumn } from '../device.profile.data';  
3 import { BasicTable, useTable } from '/@/components/Table'; 2 import { BasicTable, useTable } from '/@/components/Table';
4 -  
5 - const list = [  
6 - {  
7 - function: '网关/直连设备遥测',  
8 - release: 'v1/devices/me/telemetry',  
9 - subscribe: 'v1/devices/me/telemetry',  
10 - platform: '订阅',  
11 - device: '发布',  
12 - },  
13 - {  
14 - function: '服务端命令下发到设备端',  
15 - release: 'v1/devices/me/rpc/request/$request_id',  
16 - subscribe: 'v1/devices/me/rpc/request/+',  
17 - platform: '发布',  
18 - device: '订阅',  
19 - },  
20 - {  
21 - function: '设备端响应命令到服务端',  
22 - release: 'v1/devices/me/rpc/response/$request_id',  
23 - subscribe: 'v1/devices/me/rpc/response/+',  
24 - platform: '订阅',  
25 - device: '发布',  
26 - },  
27 - {  
28 - function: '直连设备属性上报',  
29 - release: 'v1/devices/me/attributes',  
30 - subscribe: 'v1/devices/me/attributes',  
31 - platform: '订阅',  
32 - device: '发布',  
33 - },  
34 -  
35 - {  
36 - function: '设备端请求服务端共享属性及客户端属性',  
37 - release: 'vv1/devices/me/attributes/response/$request_id',  
38 - subscribe: 'v1/devices/me/attributes/response/+',  
39 - platform: '订阅',  
40 - device: '发布',  
41 - },  
42 - {  
43 - function: '服务端响应共享属性集客户端属性给设备端',  
44 - release: 'v1/devices/me/attributes/response/$request_id',  
45 - subscribe: 'v1/devices/me/attributes/response/+',  
46 - platform: '发布',  
47 - device: '订阅',  
48 - },  
49 - {  
50 - function: '设备端请求服务端子设备共享属性及客户端属性',  
51 - release: 'v1/gateway/attributes/request',  
52 - subscribe: 'v1/gateway/attributes/request',  
53 - platform: '订阅',  
54 - device: '发布',  
55 - },  
56 - {  
57 - function: '服务端响应子设备共享属性及客户端属性给设备端',  
58 - release: 'v1/gateway/attributes/response',  
59 - subscribe: 'v1/gateway/attributes/response',  
60 - platform: '发布',  
61 - device: '订阅',  
62 - },  
63 - {  
64 - function: '设备端上报子设备客户端属性',  
65 - release: 'v1/gateway/attributes',  
66 - subscribe: 'v1/gateway/attributes',  
67 - platform: '订阅',  
68 - device: '发布',  
69 - },  
70 - {  
71 - function: '网关子设备遥测',  
72 - release: 'v1/gateway/telemetry',  
73 - subscribe: 'v1/gateway/telemetry',  
74 - platform: '订阅',  
75 - device: '发布',  
76 - },  
77 - ];  
78 -  
79 - const dataSource = list; 3 + import { list, topicTableColumn } from './topic';
80 4
81 const [register] = useTable({ 5 const [register] = useTable({
82 title: 'Topic', 6 title: 'Topic',
83 showIndexColumn: false, 7 showIndexColumn: false,
84 - dataSource, 8 + dataSource: list,
85 columns: topicTableColumn, 9 columns: topicTableColumn,
86 bordered: true, 10 bordered: true,
87 showTableSetting: true, 11 showTableSetting: true,
  1 +import { BasicColumn } from '/@/components/Table/src/types/table';
  2 +
  3 +export const topicTableColumn: BasicColumn[] = [
  4 + {
  5 + title: '设备类型',
  6 + dataIndex: 'deviceType',
  7 + width: 50,
  8 + customRender: ({ text, index }: { text: any; index: number }) => {
  9 + const obj: any = {
  10 + children: text,
  11 + attrs: {},
  12 + };
  13 + if (index === 0) {
  14 + obj.attrs.rowSpan = 6;
  15 + }
  16 + if (index > 0 && index < 6) {
  17 + obj.attrs.rowSpan = 0;
  18 + }
  19 + if (index > 6) {
  20 + obj.attrs.rowSpan = 0;
  21 + }
  22 + if (index === 6) {
  23 + obj.attrs.rowSpan = 4;
  24 + }
  25 + return obj;
  26 + },
  27 + },
  28 + {
  29 + title: '功能',
  30 + dataIndex: 'function',
  31 + width: 100,
  32 + },
  33 + {
  34 + title: '发布主题',
  35 + dataIndex: 'release',
  36 + width: 120,
  37 + },
  38 + {
  39 + title: '订阅主题',
  40 + dataIndex: 'subscribe',
  41 + width: 120,
  42 + },
  43 + {
  44 + title: '平台',
  45 + dataIndex: 'platform',
  46 + width: 30,
  47 + },
  48 + {
  49 + title: '设备',
  50 + dataIndex: 'device',
  51 + width: 30,
  52 + },
  53 +];
  54 +
  55 +export const list = [
  56 + {
  57 + deviceType: '网关/直连设备',
  58 + function: '网关/直连设备遥测',
  59 + release: 'v1/devices/me/telemetry',
  60 + subscribe: 'v1/devices/me/telemetry',
  61 + platform: '订阅',
  62 + device: '发布',
  63 + },
  64 + {
  65 + deviceType: '网关/直连设备',
  66 + function: '服务端命令下发到设备端',
  67 + release: 'v1/devices/me/rpc/request/$request_id',
  68 + subscribe: 'v1/devices/me/rpc/request/+',
  69 + platform: '发布',
  70 + device: '订阅',
  71 + },
  72 + {
  73 + deviceType: '网关/直连设备',
  74 + function: '设备端响应命令到服务端',
  75 + release: 'v1/devices/me/rpc/response/$request_id',
  76 + subscribe: 'v1/devices/me/rpc/response/+',
  77 + platform: '订阅',
  78 + device: '发布',
  79 + },
  80 + {
  81 + deviceType: '网关/直连设备',
  82 + function: '直连设备属性上报',
  83 + release: 'v1/devices/me/attributes',
  84 + subscribe: 'v1/devices/me/attributes',
  85 + platform: '订阅',
  86 + device: '发布',
  87 + },
  88 +
  89 + {
  90 + deviceType: '网关/直连设备',
  91 + function: '设备端请求服务端共享属性及客户端属性',
  92 + release: 'vv1/devices/me/attributes/response/$request_id',
  93 + subscribe: 'v1/devices/me/attributes/response/+',
  94 + platform: '订阅',
  95 + device: '发布',
  96 + },
  97 + {
  98 + deviceType: '网关/直连设备',
  99 + function: '服务端响应共享属性集客户端属性给设备端',
  100 + release: 'v1/devices/me/attributes/response/$request_id',
  101 + subscribe: 'v1/devices/me/attributes/response/+',
  102 + platform: '发布',
  103 + device: '订阅',
  104 + },
  105 + {
  106 + deviceType: '网关子设备',
  107 + function: '设备端请求服务端子设备共享属性及客户端属性',
  108 + release: 'v1/gateway/attributes/request',
  109 + subscribe: 'v1/gateway/attributes/request',
  110 + platform: '订阅',
  111 + device: '发布',
  112 + },
  113 + {
  114 + deviceType: '网关子设备',
  115 + function: '服务端响应子设备共享属性及客户端属性给设备端',
  116 + release: 'v1/gateway/attributes/response',
  117 + subscribe: 'v1/gateway/attributes/response',
  118 + platform: '发布',
  119 + device: '订阅',
  120 + },
  121 + {
  122 + deviceType: '网关子设备',
  123 + function: '设备端上报子设备客户端属性',
  124 + release: 'v1/gateway/attributes',
  125 + subscribe: 'v1/gateway/attributes',
  126 + platform: '订阅',
  127 + device: '发布',
  128 + },
  129 + {
  130 + deviceType: '网关子设备',
  131 + function: '网关子设备遥测',
  132 + release: 'v1/gateway/telemetry',
  133 + subscribe: 'v1/gateway/telemetry',
  134 + platform: '订阅',
  135 + device: '发布',
  136 + },
  137 +];