viewDrawer.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <BasicDrawer
  3. v-bind="$attrs"
  4. destroyOnClose
  5. @register="registerDrawer"
  6. :title="getTitle"
  7. :width="width"
  8. >
  9. <Description @register="registerDesc" :data="descData" />
  10. </BasicDrawer>
  11. </template>
  12. <script lang="ts" setup>
  13. import { onBeforeMount, ref } from 'vue'; // onBeforeMount,
  14. import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
  15. import { Description, useDescription } from '/@/components/Description';
  16. import { viewSchema } from './data';
  17. import { storageRecordDetail } from '/@/api/infra/storageRecordApi';
  18. const descData = ref({});
  19. const getTitle = '查看存储记录';
  20. const width = '45%';
  21. onBeforeMount(async () => {});
  22. const [registerDrawer] = useDrawerInner(async data => {
  23. const resData = await storageRecordDetail(data.record.id);
  24. descData.value = {
  25. ...resData,
  26. };
  27. });
  28. const [registerDesc] = useDescription({
  29. schema: viewSchema,
  30. column: 2,
  31. size: 'middle',
  32. labelStyle: {
  33. width: '120px',
  34. },
  35. });
  36. </script>