Commit 6b4e205d18b39e3dc15b4ce2145d8a02d4c10f99

Authored by ww
1 parent fc63e5f9

fix: DEFECT-824 not echo tcp script on first enter device detail

1 <template> 1 <template>
2 <BasicDrawer v-bind="$attrs" title="产品详情" @register="register" width="50%"> 2 <BasicDrawer v-bind="$attrs" title="产品详情" @register="register" width="50%">
3 - <Tabs :animated="true" v-model:activeKey="activeKey">  
4 - <TabPane forceRender key="1" tab="产品"> 3 + <Tabs :animated="true" v-model:activeKey="activeKey" @change="handlePanelChange">
  4 + <TabPane forceRender key="product" tab="产品">
5 <div class="relative"> 5 <div class="relative">
6 <DeviceConfigurationStep :ifShowBtn="false" ref="DevConStRef" /> 6 <DeviceConfigurationStep :ifShowBtn="false" ref="DevConStRef" />
7 <div class="absolute w-full h-full top-0 cursor-not-allowed"></div> 7 <div class="absolute w-full h-full top-0 cursor-not-allowed"></div>
8 </div> 8 </div>
9 </TabPane> 9 </TabPane>
10 - <TabPane forceRender key="2" tab="传输配置"> 10 + <TabPane forceRender key="transport" tab="传输配置">
11 <div class="relative"> 11 <div class="relative">
12 <TransportConfigurationStep :ifShowBtn="false" ref="TransConStRef" /> 12 <TransportConfigurationStep :ifShowBtn="false" ref="TransConStRef" />
13 <div class="absolute w-full h-full top-0 cursor-not-allowed"></div> 13 <div class="absolute w-full h-full top-0 cursor-not-allowed"></div>
14 </div> 14 </div>
15 </TabPane> 15 </TabPane>
16 - <TabPane forceRender key="3" tab="物模型管理"> 16 + <TabPane forceRender key="modelOfMatter" tab="物模型管理">
17 <PhysicalModelManagementStep /> 17 <PhysicalModelManagementStep />
18 </TabPane> 18 </TabPane>
19 </Tabs> 19 </Tabs>
@@ -30,7 +30,11 @@ @@ -30,7 +30,11 @@
30 30
31 defineEmits(['register']); 31 defineEmits(['register']);
32 32
33 - const activeKey = ref('1'); 33 + type ActiveKey = 'product' | 'transport' | 'modelOfMatter';
  34 +
  35 + const activeKey = ref<ActiveKey>('product');
  36 +
  37 + const record = ref<Recordable>({});
34 38
35 const DevConStRef = ref<InstanceType<typeof DeviceConfigurationStep>>(); 39 const DevConStRef = ref<InstanceType<typeof DeviceConfigurationStep>>();
36 const TransConStRef = ref<InstanceType<typeof TransportConfigurationStep>>(); 40 const TransConStRef = ref<InstanceType<typeof TransportConfigurationStep>>();
@@ -44,11 +48,14 @@ @@ -44,11 +48,14 @@
44 }; 48 };
45 49
46 const [register, {}] = useDrawerInner(async (data: Recordable) => { 50 const [register, {}] = useDrawerInner(async (data: Recordable) => {
47 - activeKey.value = '1';  
48 - const res = await deviceConfigGetDetail(data.record.id);  
49 - setDeviceConfFormData(res);  
50 - setTransConfFormData(res); 51 + activeKey.value = 'product';
  52 + record.value = await deviceConfigGetDetail(data.record.id);
  53 + setDeviceConfFormData(unref(record));
51 }); 54 });
  55 +
  56 + const handlePanelChange = (activeKey: ActiveKey) => {
  57 + if (activeKey === 'transport') setTransConfFormData(unref(record));
  58 + };
52 </script> 59 </script>
53 60
54 <style lang="less" scope></style> 61 <style lang="less" scope></style>