viewDrawer.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 { smsChannelDetail } from '/@/api/sys/smsChannelApi';
  18. import { listDictModel } from '/@/api/common';
  19. import { formatDictValue } from '/@/utils';
  20. const descData = ref({});
  21. const getTitle = '查看调度任务';
  22. const width = '45%';
  23. const typeOptions = ref();
  24. const typeStatus = ref();
  25. onBeforeMount(async () => {
  26. typeOptions.value = await listDictModel({ dictCode: 'sys_create_type' });
  27. typeStatus.value = await listDictModel({ dictCode: 'sys_common_result' });
  28. });
  29. const [registerDrawer] = useDrawerInner(async data => {
  30. const resData = data.record;
  31. // const resData = await smsChannelDetail(data.record.id);
  32. descData.value = {
  33. ...resData,
  34. jobGroup: formatDictValue(typeOptions.value, resData.jobGroup),
  35. status: formatDictValue(typeStatus.value, resData.status == 'true' ? '0' : '1'),
  36. };
  37. });
  38. const [registerDesc] = useDescription({
  39. schema: viewSchema,
  40. column: 2,
  41. size: 'middle',
  42. labelStyle: {
  43. width: '140px',
  44. },
  45. });
  46. </script>