Commit dee773435132b723c205b874738c3ffd5ffef1b6

Authored by fengtao
2 parents 3b644510 f0282628

Merge branch 'main' into f-dev

... ... @@ -14,9 +14,9 @@ VITE_PUBLIC_PATH = /
14 14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]]
15 15 # 线上测试环境
16 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 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 21 # 实时数据的ws地址
22 22 # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token=
... ...
... ... @@ -18,6 +18,7 @@ enum EDeviceConfigApi {
18 18 DEVICE_CONFIG_IMPORT = '/device_profile/import',
19 19 SET_DEVICE_ISDEFAULT = '/deviceProfile',
20 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 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 252 title: '名称',
253 253 dataIndex: 'tbDeviceName',
254 254 width: 120,
  255 + slots: {
  256 + customRender: 'tbDeviceName',
  257 + },
255 258 },
256 259 {
257 260 title: '标签',
... ...
... ... @@ -23,7 +23,10 @@
23 23 </TabPane>
24 24 <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane>
25 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 30 </TabPane>
28 31 <!-- 网关设备并且场家是TBox -->
29 32 <TabPane
... ... @@ -64,8 +67,8 @@
64 67 TBoxDetail,
65 68 HistoryData,
66 69 },
67   - emits: ['reload', 'register'],
68   - setup() {
  70 + emits: ['reload', 'register', 'openTbDeviceDetail'],
  71 + setup(_props, { emit }) {
69 72 const activeKey = ref('1');
70 73 const size = ref('small');
71 74 const deviceDetailRef = ref();
... ... @@ -86,6 +89,9 @@
86 89 activeKey.value = '1';
87 90 };
88 91
  92 + const handleOpenTbDeviceDetail = (data: { id: string; tbDeviceId: string }) => {
  93 + emit('openTbDeviceDetail', data);
  94 + };
89 95 return {
90 96 size,
91 97 activeKey,
... ... @@ -94,6 +100,7 @@
94 100 deviceDetail,
95 101 deviceDetailRef,
96 102 tbDeviceId,
  103 + handleOpenTbDeviceDetail,
97 104 };
98 105 },
99 106 });
... ...
1 1 <template>
2 2 <div style="background-color: #f0f2f5">
3 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 9 <template #deviceState="{ record }">
5 10 <Tag
6 11 :color="
... ... @@ -28,9 +33,10 @@
28 33 import { defineComponent } from 'vue';
29 34 import { Tag } from 'ant-design-vue';
30 35 import { DeviceState } from '/@/api/device/model/deviceModel';
  36 + import { getTbDeviceId } from '/@/api/device/deviceConfigApi';
31 37 import { BasicTable, useTable } from '/@/components/Table';
32 38 import { childDeviceColumns, childDeviceSchemas } from '../../config/detail.config';
33   - import { getChildDevicePage } from '/@/api/device/deviceManager.ts';
  39 + import { getChildDevicePage } from '/@/api/device/deviceManager';
34 40 export default defineComponent({
35 41 name: 'DeviceManagement',
36 42 components: {
... ... @@ -43,7 +49,8 @@
43 49 required: true,
44 50 },
45 51 },
46   - setup(props) {
  52 + emits: ['openTbDeviceDetail'],
  53 + setup(props, { emit }) {
47 54 const [registerTable] = useTable({
48 55 api: getChildDevicePage,
49 56 columns: childDeviceColumns,
... ... @@ -60,9 +67,18 @@
60 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 78 return {
64 79 registerTable,
65 80 DeviceState,
  81 + handleGetTbDeviceId,
66 82 };
67 83 },
68 84 });
... ...
... ... @@ -148,7 +148,12 @@
148 148 />
149 149 </template>
150 150 </BasicTable>
151   - <DeviceDetailDrawer @register="registerDetailDrawer" />
  151 + <DeviceDetailDrawer
  152 + @register="registerDetailDrawer"
  153 + @open-tb-device-detail="handleOpenTbDeviceDetail"
  154 + />
  155 + <DeviceDetailDrawer @register="registerTbDetailDrawer" />
  156 +
152 157 <DeviceModal @register="registerModal" @success="handleSuccess" @reload="handleSuccess" />
153 158 <CustomerModal @register="registerCustomerModal" @reload="handleReload" />
154 159 </PageWrapper>
... ... @@ -211,6 +216,7 @@
211 216 const [registerModal, { openModal }] = useModal();
212 217 const [registerCustomerModal, { openModal: openCustomerModal }] = useModal();
213 218 const [registerDetailDrawer, { openDrawer }] = useDrawer();
  219 + const [registerTbDetailDrawer, { openDrawer: openTbDeviceDrawer }] = useDrawer();
214 220
215 221 const [registerTable, { reload, setSelectedRowKeys, setProps }] = useTable({
216 222 title: '设备列表',
... ... @@ -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 331 return {
322 332 registerTable,
323 333 handleCreate,
... ... @@ -341,6 +351,8 @@
341 351 hasBatchDelete,
342 352 handleDeleteOrBatchDelete,
343 353 handleReload,
  354 + registerTbDetailDrawer,
  355 + handleOpenTbDeviceDetail,
344 356 };
345 357 },
346 358 });
... ...