Commit 05122beb925f9fee363c67e245f44faf4636a0f1

Authored by ww
1 parent d29129b7

perf: DEFECT-807 refactor view product prefoile detail info

  1 +<template>
  2 + <BasicDrawer v-bind="$attrs" title="产品详情" @register="register" width="50%">
  3 + <Tabs :animated="true" v-model:activeKey="activeKey">
  4 + <TabPane forceRender key="1" tab="产品">
  5 + <div class="relative">
  6 + <DeviceConfigurationStep :ifShowBtn="false" ref="DevConStRef" />
  7 + <div class="absolute w-full h-full top-0 cursor-not-allowed"></div>
  8 + </div>
  9 + </TabPane>
  10 + <TabPane forceRender key="2" tab="传输配置">
  11 + <div class="relative">
  12 + <TransportConfigurationStep :ifShowBtn="false" ref="TransConStRef" />
  13 + <div class="absolute w-full h-full top-0 cursor-not-allowed"></div>
  14 + </div>
  15 + </TabPane>
  16 + <TabPane forceRender key="3" tab="物模型管理">
  17 + <PhysicalModelManagementStep />
  18 + </TabPane>
  19 + </Tabs>
  20 + </BasicDrawer>
  21 +</template>
  22 +<script lang="ts" setup>
  23 + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
  24 + import { Tabs, TabPane } from 'ant-design-vue';
  25 + import DeviceConfigurationStep from './step/DeviceConfigurationStep.vue';
  26 + import TransportConfigurationStep from './step/TransportConfigurationStep.vue';
  27 + import PhysicalModelManagementStep from './step/PhysicalModelManagementStep.vue';
  28 + import { ref, unref } from 'vue';
  29 + import { deviceConfigGetDetail } from '/@/api/device/deviceConfigApi';
  30 +
  31 + defineEmits(['register']);
  32 +
  33 + const activeKey = ref('1');
  34 +
  35 + const DevConStRef = ref<InstanceType<typeof DeviceConfigurationStep>>();
  36 + const TransConStRef = ref<InstanceType<typeof TransportConfigurationStep>>();
  37 + // const PhysicalModManRef = ref<InstanceType<typeof PhysicalModelManagementStep>>();
  38 +
  39 + const setDeviceConfFormData = async (res: Recordable) => {
  40 + unref(DevConStRef)?.setFormData(res);
  41 + };
  42 + const setTransConfFormData = async (res: Recordable) => {
  43 + unref(TransConStRef)?.setFormData(res);
  44 + };
  45 +
  46 + 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 + });
  52 +</script>
  53 +
  54 +<style lang="less" scope></style>
@@ -90,6 +90,7 @@ @@ -90,6 +90,7 @@
90 </template> 90 </template>
91 </BasicTable> 91 </BasicTable>
92 <DeviceProfileModal @register="registerModal" @success="handleSuccess" /> 92 <DeviceProfileModal @register="registerModal" @success="handleSuccess" />
  93 + <DeviceProfileDrawer @register="registerDrawer" />
93 <ExpExcelModal 94 <ExpExcelModal
94 ref="expExcelModalRef" 95 ref="expExcelModalRef"
95 @register="registerExportModal" 96 @register="registerExportModal"
@@ -108,12 +109,14 @@ @@ -108,12 +109,14 @@
108 setDeviceProfileIsDefaultApi, 109 setDeviceProfileIsDefaultApi,
109 } from '/@/api/device/deviceConfigApi'; 110 } from '/@/api/device/deviceConfigApi';
110 import { useModal } from '/@/components/Modal'; 111 import { useModal } from '/@/components/Modal';
  112 + import { useDrawer } from '/@/components/Drawer';
111 import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue'; 113 import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue';
112 import { ImpExcel, ExcelData } from '/@/components/Excel'; 114 import { ImpExcel, ExcelData } from '/@/components/Excel';
113 import { jsonToSheetXlsx, ExpExcelModal, ExportModalResult } from '/@/components/Excel'; 115 import { jsonToSheetXlsx, ExpExcelModal, ExportModalResult } from '/@/components/Excel';
114 import { Authority } from '/@/components/Authority'; 116 import { Authority } from '/@/components/Authority';
115 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 117 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
116 import { Popconfirm } from 'ant-design-vue'; 118 import { Popconfirm } from 'ant-design-vue';
  119 + import DeviceProfileDrawer from './DeviceProfileDrawer.vue';
117 120
118 const exportData: any = ref([]); 121 const exportData: any = ref([]);
119 const expExcelModalRef: any = ref(null); 122 const expExcelModalRef: any = ref(null);
@@ -253,13 +256,16 @@ @@ -253,13 +256,16 @@
253 isView: false, 256 isView: false,
254 }); 257 });
255 } 258 }
  259 +
  260 + const [registerDrawer, { openDrawer }] = useDrawer();
256 //详情 261 //详情
257 function handleDetailView(record: Recordable) { 262 function handleDetailView(record: Recordable) {
258 - openModal(true, {  
259 - record,  
260 - isUpdate: false,  
261 - isView: true,  
262 - }); 263 + openDrawer(true, { record });
  264 + // openModal(true, {
  265 + // record,
  266 + // isUpdate: false,
  267 + // isView: true,
  268 + // });
263 } 269 }
264 270
265 function defaultHeader({ filename, bookType }: ExportModalResult) { 271 function defaultHeader({ filename, bookType }: ExportModalResult) {
@@ -151,7 +151,7 @@ @@ -151,7 +151,7 @@
151 showIndexColumn: false, 151 showIndexColumn: false,
152 clickToRowSelect: false, 152 clickToRowSelect: false,
153 useSearchForm: false, 153 useSearchForm: false,
154 - rowKey: 'id', 154 + // rowKey: 'id',
155 showTableSetting: true, 155 showTableSetting: true,
156 bordered: true, 156 bordered: true,
157 actionColumn: { 157 actionColumn: {