DeviceProfileDrawer.vue 2.09 KB
<template>
  <BasicDrawer v-bind="$attrs" title="产品详情" @register="register" width="50%">
    <Tabs :animated="true" v-model:activeKey="activeKey">
      <TabPane forceRender key="1" tab="产品">
        <div class="relative">
          <DeviceConfigurationStep :ifShowBtn="false" ref="DevConStRef" />
          <div class="absolute w-full h-full top-0 cursor-not-allowed"></div>
        </div>
      </TabPane>
      <TabPane forceRender key="2" tab="传输配置">
        <div class="relative">
          <TransportConfigurationStep :ifShowBtn="false" ref="TransConStRef" />
          <div class="absolute w-full h-full top-0 cursor-not-allowed"></div>
        </div>
      </TabPane>
      <TabPane forceRender key="3" tab="物模型管理">
        <PhysicalModelManagementStep />
      </TabPane>
    </Tabs>
  </BasicDrawer>
</template>
<script lang="ts" setup>
  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
  import { Tabs, TabPane } from 'ant-design-vue';
  import DeviceConfigurationStep from './step/DeviceConfigurationStep.vue';
  import TransportConfigurationStep from './step/TransportConfigurationStep.vue';
  import PhysicalModelManagementStep from './step/PhysicalModelManagementStep.vue';
  import { ref, unref } from 'vue';
  import { deviceConfigGetDetail } from '/@/api/device/deviceConfigApi';

  defineEmits(['register']);

  const activeKey = ref('1');

  const DevConStRef = ref<InstanceType<typeof DeviceConfigurationStep>>();
  const TransConStRef = ref<InstanceType<typeof TransportConfigurationStep>>();
  // const PhysicalModManRef = ref<InstanceType<typeof PhysicalModelManagementStep>>();

  const setDeviceConfFormData = async (res: Recordable) => {
    unref(DevConStRef)?.setFormData(res);
  };
  const setTransConfFormData = async (res: Recordable) => {
    unref(TransConStRef)?.setFormData(res);
  };

  const [register, {}] = useDrawerInner(async (data: Recordable) => {
    activeKey.value = '1';
    const res = await deviceConfigGetDetail(data.record.id);
    setDeviceConfFormData(res);
    setTransConfFormData(res);
  });
</script>

<style lang="less" scope></style>