Commit 05122beb925f9fee363c67e245f44faf4636a0f1
1 parent
d29129b7
perf: DEFECT-807 refactor view product prefoile detail info
Showing
3 changed files
with
66 additions
and
6 deletions
| 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 | 90 | </template> |
| 91 | 91 | </BasicTable> |
| 92 | 92 | <DeviceProfileModal @register="registerModal" @success="handleSuccess" /> |
| 93 | + <DeviceProfileDrawer @register="registerDrawer" /> | |
| 93 | 94 | <ExpExcelModal |
| 94 | 95 | ref="expExcelModalRef" |
| 95 | 96 | @register="registerExportModal" |
| ... | ... | @@ -108,12 +109,14 @@ |
| 108 | 109 | setDeviceProfileIsDefaultApi, |
| 109 | 110 | } from '/@/api/device/deviceConfigApi'; |
| 110 | 111 | import { useModal } from '/@/components/Modal'; |
| 112 | + import { useDrawer } from '/@/components/Drawer'; | |
| 111 | 113 | import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue'; |
| 112 | 114 | import { ImpExcel, ExcelData } from '/@/components/Excel'; |
| 113 | 115 | import { jsonToSheetXlsx, ExpExcelModal, ExportModalResult } from '/@/components/Excel'; |
| 114 | 116 | import { Authority } from '/@/components/Authority'; |
| 115 | 117 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 116 | 118 | import { Popconfirm } from 'ant-design-vue'; |
| 119 | + import DeviceProfileDrawer from './DeviceProfileDrawer.vue'; | |
| 117 | 120 | |
| 118 | 121 | const exportData: any = ref([]); |
| 119 | 122 | const expExcelModalRef: any = ref(null); |
| ... | ... | @@ -253,13 +256,16 @@ |
| 253 | 256 | isView: false, |
| 254 | 257 | }); |
| 255 | 258 | } |
| 259 | + | |
| 260 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
| 256 | 261 | //详情 |
| 257 | 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 | 271 | function defaultHeader({ filename, bookType }: ExportModalResult) { | ... | ... |