Showing
6 changed files
with
53 additions
and
8 deletions
@@ -14,9 +14,9 @@ VITE_PUBLIC_PATH = / | @@ -14,9 +14,9 @@ VITE_PUBLIC_PATH = / | ||
14 | # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | 14 | # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] |
15 | # 线上测试环境 | 15 | # 线上测试环境 |
16 | # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] | 16 | # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] |
17 | -VITE_PROXY = [["/api","https://dev.thingskit.com/api"],["/thingskit-drawio","http://localhost:3000/"]] | 17 | +# VITE_PROXY = [["/api","https://dev.thingskit.com/api"],["/thingskit-drawio","http://localhost:3000/"]] |
18 | # VITE_PROXY = [["/api","http://121.37.251.8:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] | 18 | # VITE_PROXY = [["/api","http://121.37.251.8:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] |
19 | -# VITE_PROXY = [["/api","http://192.168.10.106:8080/api"],["/thingskit-drawio","http://192.168.10.106:8080/api"]] | 19 | +VITE_PROXY = [["/api","http://192.168.10.111:8080/api"],["/thingskit-drawio","http://192.168.10.106:8080/api"]] |
20 | 20 | ||
21 | # 实时数据的ws地址 | 21 | # 实时数据的ws地址 |
22 | # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token= | 22 | # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token= |
@@ -18,6 +18,7 @@ enum EDeviceConfigApi { | @@ -18,6 +18,7 @@ enum EDeviceConfigApi { | ||
18 | DEVICE_CONFIG_IMPORT = '/device_profile/import', | 18 | DEVICE_CONFIG_IMPORT = '/device_profile/import', |
19 | SET_DEVICE_ISDEFAULT = '/deviceProfile', | 19 | SET_DEVICE_ISDEFAULT = '/deviceProfile', |
20 | FRP_API = '/frp/', | 20 | FRP_API = '/frp/', |
21 | + GET_TB_DEVICE_ID = '/device/get_subset', | ||
21 | } | 22 | } |
22 | 23 | ||
23 | /** | 24 | /** |
@@ -130,3 +131,9 @@ export const frpPutInfoApi = (proxyName: string, enableRemote: number) => { | @@ -130,3 +131,9 @@ export const frpPutInfoApi = (proxyName: string, enableRemote: number) => { | ||
130 | url: `${EDeviceConfigApi.FRP_API}${proxyName}/${enableRemote}`, | 131 | url: `${EDeviceConfigApi.FRP_API}${proxyName}/${enableRemote}`, |
131 | }); | 132 | }); |
132 | }; | 133 | }; |
134 | + | ||
135 | +export const getTbDeviceId = (params: string) => { | ||
136 | + return defHttp.get({ | ||
137 | + url: `${EDeviceConfigApi.GET_TB_DEVICE_ID}/${params}`, | ||
138 | + }); | ||
139 | +}; |
@@ -252,6 +252,9 @@ export const childDeviceColumns: BasicColumn[] = [ | @@ -252,6 +252,9 @@ export const childDeviceColumns: BasicColumn[] = [ | ||
252 | title: '名称', | 252 | title: '名称', |
253 | dataIndex: 'tbDeviceName', | 253 | dataIndex: 'tbDeviceName', |
254 | width: 120, | 254 | width: 120, |
255 | + slots: { | ||
256 | + customRender: 'tbDeviceName', | ||
257 | + }, | ||
255 | }, | 258 | }, |
256 | { | 259 | { |
257 | title: '标签', | 260 | title: '标签', |
@@ -23,7 +23,10 @@ | @@ -23,7 +23,10 @@ | ||
23 | </TabPane> | 23 | </TabPane> |
24 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> | 24 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> |
25 | <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'"> | 25 | <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'"> |
26 | - <ChildDevice :fromId="deviceDetail?.tbDeviceId" /> | 26 | + <ChildDevice |
27 | + :fromId="deviceDetail?.tbDeviceId" | ||
28 | + @openTbDeviceDetail="handleOpenTbDeviceDetail" | ||
29 | + /> | ||
27 | </TabPane> | 30 | </TabPane> |
28 | <!-- 网关设备并且场家是TBox --> | 31 | <!-- 网关设备并且场家是TBox --> |
29 | <TabPane | 32 | <TabPane |
@@ -64,8 +67,8 @@ | @@ -64,8 +67,8 @@ | ||
64 | TBoxDetail, | 67 | TBoxDetail, |
65 | HistoryData, | 68 | HistoryData, |
66 | }, | 69 | }, |
67 | - emits: ['reload', 'register'], | ||
68 | - setup() { | 70 | + emits: ['reload', 'register', 'openTbDeviceDetail'], |
71 | + setup(_props, { emit }) { | ||
69 | const activeKey = ref('1'); | 72 | const activeKey = ref('1'); |
70 | const size = ref('small'); | 73 | const size = ref('small'); |
71 | const deviceDetailRef = ref(); | 74 | const deviceDetailRef = ref(); |
@@ -86,6 +89,9 @@ | @@ -86,6 +89,9 @@ | ||
86 | activeKey.value = '1'; | 89 | activeKey.value = '1'; |
87 | }; | 90 | }; |
88 | 91 | ||
92 | + const handleOpenTbDeviceDetail = (data: { id: string; tbDeviceId: string }) => { | ||
93 | + emit('openTbDeviceDetail', data); | ||
94 | + }; | ||
89 | return { | 95 | return { |
90 | size, | 96 | size, |
91 | activeKey, | 97 | activeKey, |
@@ -94,6 +100,7 @@ | @@ -94,6 +100,7 @@ | ||
94 | deviceDetail, | 100 | deviceDetail, |
95 | deviceDetailRef, | 101 | deviceDetailRef, |
96 | tbDeviceId, | 102 | tbDeviceId, |
103 | + handleOpenTbDeviceDetail, | ||
97 | }; | 104 | }; |
98 | }, | 105 | }, |
99 | }); | 106 | }); |
1 | <template> | 1 | <template> |
2 | <div style="background-color: #f0f2f5"> | 2 | <div style="background-color: #f0f2f5"> |
3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
4 | + <template #tbDeviceName="{ record }"> | ||
5 | + <div style="color: #619eff" class="cursor-pointer" @click="handleGetTbDeviceId(record)">{{ | ||
6 | + record.tbDeviceName | ||
7 | + }}</div> | ||
8 | + </template> | ||
4 | <template #deviceState="{ record }"> | 9 | <template #deviceState="{ record }"> |
5 | <Tag | 10 | <Tag |
6 | :color=" | 11 | :color=" |
@@ -28,9 +33,10 @@ | @@ -28,9 +33,10 @@ | ||
28 | import { defineComponent } from 'vue'; | 33 | import { defineComponent } from 'vue'; |
29 | import { Tag } from 'ant-design-vue'; | 34 | import { Tag } from 'ant-design-vue'; |
30 | import { DeviceState } from '/@/api/device/model/deviceModel'; | 35 | import { DeviceState } from '/@/api/device/model/deviceModel'; |
36 | + import { getTbDeviceId } from '/@/api/device/deviceConfigApi'; | ||
31 | import { BasicTable, useTable } from '/@/components/Table'; | 37 | import { BasicTable, useTable } from '/@/components/Table'; |
32 | import { childDeviceColumns, childDeviceSchemas } from '../../config/detail.config'; | 38 | import { childDeviceColumns, childDeviceSchemas } from '../../config/detail.config'; |
33 | - import { getChildDevicePage } from '/@/api/device/deviceManager.ts'; | 39 | + import { getChildDevicePage } from '/@/api/device/deviceManager'; |
34 | export default defineComponent({ | 40 | export default defineComponent({ |
35 | name: 'DeviceManagement', | 41 | name: 'DeviceManagement', |
36 | components: { | 42 | components: { |
@@ -43,7 +49,8 @@ | @@ -43,7 +49,8 @@ | ||
43 | required: true, | 49 | required: true, |
44 | }, | 50 | }, |
45 | }, | 51 | }, |
46 | - setup(props) { | 52 | + emits: ['openTbDeviceDetail'], |
53 | + setup(props, { emit }) { | ||
47 | const [registerTable] = useTable({ | 54 | const [registerTable] = useTable({ |
48 | api: getChildDevicePage, | 55 | api: getChildDevicePage, |
49 | columns: childDeviceColumns, | 56 | columns: childDeviceColumns, |
@@ -60,9 +67,18 @@ | @@ -60,9 +67,18 @@ | ||
60 | showIndexColumn: false, | 67 | showIndexColumn: false, |
61 | }); | 68 | }); |
62 | 69 | ||
70 | + const handleGetTbDeviceId = async (record) => { | ||
71 | + try { | ||
72 | + const res = await getTbDeviceId(record.tbDeviceId); | ||
73 | + if (res && res.id) { | ||
74 | + emit('openTbDeviceDetail', { id: res.id, tbDeviceId: res.tbDeviceId }); | ||
75 | + } | ||
76 | + } catch (error) {} | ||
77 | + }; | ||
63 | return { | 78 | return { |
64 | registerTable, | 79 | registerTable, |
65 | DeviceState, | 80 | DeviceState, |
81 | + handleGetTbDeviceId, | ||
66 | }; | 82 | }; |
67 | }, | 83 | }, |
68 | }); | 84 | }); |
@@ -148,7 +148,12 @@ | @@ -148,7 +148,12 @@ | ||
148 | /> | 148 | /> |
149 | </template> | 149 | </template> |
150 | </BasicTable> | 150 | </BasicTable> |
151 | - <DeviceDetailDrawer @register="registerDetailDrawer" /> | 151 | + <DeviceDetailDrawer |
152 | + @register="registerDetailDrawer" | ||
153 | + @open-tb-device-detail="handleOpenTbDeviceDetail" | ||
154 | + /> | ||
155 | + <DeviceDetailDrawer @register="registerTbDetailDrawer" /> | ||
156 | + | ||
152 | <DeviceModal @register="registerModal" @success="handleSuccess" @reload="handleSuccess" /> | 157 | <DeviceModal @register="registerModal" @success="handleSuccess" @reload="handleSuccess" /> |
153 | <CustomerModal @register="registerCustomerModal" @reload="handleReload" /> | 158 | <CustomerModal @register="registerCustomerModal" @reload="handleReload" /> |
154 | </PageWrapper> | 159 | </PageWrapper> |
@@ -211,6 +216,7 @@ | @@ -211,6 +216,7 @@ | ||
211 | const [registerModal, { openModal }] = useModal(); | 216 | const [registerModal, { openModal }] = useModal(); |
212 | const [registerCustomerModal, { openModal: openCustomerModal }] = useModal(); | 217 | const [registerCustomerModal, { openModal: openCustomerModal }] = useModal(); |
213 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); | 218 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); |
219 | + const [registerTbDetailDrawer, { openDrawer: openTbDeviceDrawer }] = useDrawer(); | ||
214 | 220 | ||
215 | const [registerTable, { reload, setSelectedRowKeys, setProps }] = useTable({ | 221 | const [registerTable, { reload, setSelectedRowKeys, setProps }] = useTable({ |
216 | title: '设备列表', | 222 | title: '设备列表', |
@@ -318,6 +324,10 @@ | @@ -318,6 +324,10 @@ | ||
318 | } | 324 | } |
319 | }; | 325 | }; |
320 | 326 | ||
327 | + const handleOpenTbDeviceDetail = (data: { id: string; tbDeviceId: string }) => { | ||
328 | + openTbDeviceDrawer(true, data); | ||
329 | + }; | ||
330 | + | ||
321 | return { | 331 | return { |
322 | registerTable, | 332 | registerTable, |
323 | handleCreate, | 333 | handleCreate, |
@@ -341,6 +351,8 @@ | @@ -341,6 +351,8 @@ | ||
341 | hasBatchDelete, | 351 | hasBatchDelete, |
342 | handleDeleteOrBatchDelete, | 352 | handleDeleteOrBatchDelete, |
343 | handleReload, | 353 | handleReload, |
354 | + registerTbDetailDrawer, | ||
355 | + handleOpenTbDeviceDetail, | ||
344 | }; | 356 | }; |
345 | }, | 357 | }, |
346 | }); | 358 | }); |