index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div>
  3. <div class="mx-6 mb-2">
  4. <TimeLine :data="timeLineData" @hover="callHover" @icon="callIcon">
  5. <template #head>
  6. <transition class="animate__animated animate__slideInLeft">
  7. <div class="timeline-outer" v-if="timeOuter">
  8. <div class="timeline-outer_item" @click="handleAdd"> 新建透析处方模板 </div>
  9. </div>
  10. </transition>
  11. </template>
  12. </TimeLine>
  13. </div>
  14. <FormDrawer @register="registerDrawer" @success="callSuccess" />
  15. </div>
  16. </template>
  17. <script setup lang="ts">
  18. import { ref, reactive, onUnmounted } from 'vue';
  19. import TimeLine from '/@/components/XTTimeLine/src/TimeLine.vue';
  20. import { onMounted } from 'vue';
  21. import dayjs from 'dayjs';
  22. import { listDictModelBatch } from '/@/api/common';
  23. import { formatDictValue } from '/@/utils';
  24. //
  25. import FormDrawer from './FormDrawer.vue';
  26. import { useDrawer } from '@/components/Drawer';
  27. import { archivesFormulaTemplateQueryList } from '@/api/biz/archives/formulaTemplateApi';
  28. const props = defineProps({
  29. info: {
  30. type: Object,
  31. default: () => {},
  32. },
  33. });
  34. const bizDictOptions = reactive<any>({});
  35. const timeLineData = ref([]);
  36. const timeOuter = ref(false);
  37. onMounted(async () => {
  38. const res = await listDictModelBatch(bizDictData.value.map(ele => ele.dictCode));
  39. for (const i in res) {
  40. const filter = bizDictData.value.filter(ele => ele.dictCode == i)[0];
  41. bizDictOptions[filter.key] = res[i];
  42. }
  43. console.log('🚀 ~ file: index.vue:47 ~ onMounted ~ bizDictOptions:', bizDictOptions);
  44. // console.log('🚀 ~ file: index.vue:96 ~ onMounted ~ res:', res);
  45. await getData();
  46. });
  47. const [registerDrawer, { openDrawer }] = useDrawer();
  48. const bizDictData = ref([
  49. // 透析模式
  50. { key: 'dt', dictCode: 'dt' },
  51. // 通路类型
  52. { key: 'type', dictCode: 'va_type' },
  53. ]);
  54. async function getData() {
  55. const res = await archivesFormulaTemplateQueryList(props.info?.id);
  56. console.log('🚀 ~ file: index.vue:105 ~ getData ~ res:', res);
  57. timeLineData.value = res.map(ele => {
  58. const innerData = {
  59. title: '基本信息',
  60. icon: 'icon-xt-edit_default',
  61. type: 'basic',
  62. data: [
  63. { field: 'vascularAccess', label: '血管通路', value: '', dict: true },
  64. { field: 'setUpHospital', label: '干体重 (kg)', value: '' },
  65. { field: 'setUpHospital', label: 'CH值 (kg)', value: '' },
  66. { field: 'setUpHospital', label: 'V值 (kg)', value: '' },
  67. { field: 'setUpHospital', label: '首剂 (mg)', value: '' },
  68. { field: 'setUpHospital', label: '追加 (mg)', value: '' },
  69. { field: 'setUpHospital', label: '抗凝方式', value: '', span: 12 },
  70. { field: 'setUpHospital', label: '耗材使用', value: '', span: 24 },
  71. { field: 'setUpHospital', label: '透析时长 (h)', value: '' },
  72. { field: 'setUpHospital', label: '流量 (ml/min)', value: '' },
  73. { field: 'setUpHospital', label: '湿度 (℃)', value: '' },
  74. { field: 'setUpHospital', label: '血流量 (ml/min)', value: '' },
  75. { field: 'setUpHospital', label: 'K (mmolL)', value: '' },
  76. { field: 'setUpHospital', label: 'Na (mmolL)', value: '' },
  77. { field: 'setUpHospital', label: 'Ca (mmolL)', value: '' },
  78. { field: 'setUpHospital', label: '碳酸氢根 (mmolL)', value: '' },
  79. { field: 'setUpHospital', label: 'Mg (mmolL)', value: '' },
  80. { field: 'setUpHospital', label: 'Cl (mmolL)', value: '' },
  81. { field: 'setUpHospital', label: '葡萄糖 (mmolL)', value: '' },
  82. ],
  83. };
  84. innerData.title = formatDictValue(bizDictOptions.dt, ele.dialysisType);
  85. console.log('🚀 ~ file: index.vue:114 ~ getData ~ innerData:', innerData);
  86. innerData.type = ele.dialysisType;
  87. innerData.data = innerData.data.map(eleC => {
  88. if (eleC.dict) {
  89. if (eleC.field == 'vascularAccess') {
  90. eleC.value = formatDictValue(bizDictOptions['type'], ele[eleC.field]);
  91. } else {
  92. eleC.value = formatDictValue(bizDictOptions[eleC.field], ele[eleC.field]);
  93. }
  94. } else {
  95. eleC.value = ele[eleC.field];
  96. }
  97. // if (ele.type == 'va_avf' || ele.type == 'va_avg') {
  98. // // 置管引导
  99. // eleC.hidden = eleC.field == 'catheterGuidance' ? true : false;
  100. // }
  101. return eleC;
  102. });
  103. // console.log('🚀 ~ file: index.vue:168 ~ getData ~ cnt:', innerData);
  104. return {
  105. id: ele.id,
  106. dot: ele.updatorName,
  107. date: dayjs(ele.enactedTime).format('YYYY-MM-DD'),
  108. cnt: innerData,
  109. };
  110. });
  111. console.log('🚀 ~ file: index.vue:168 ~ getData ~ timeLineData.value :', timeLineData.value);
  112. }
  113. function handleAdd(data) {
  114. console.log('🚀 ~ file: index.vue:205 ~ handleAdd ~ data:', data);
  115. openDrawer(true, {
  116. record: { ...props.info, accessType: data },
  117. });
  118. }
  119. onUnmounted(() => {
  120. timeOuter.value = false;
  121. });
  122. // 回调
  123. function callSuccess(data) {
  124. console.log('🚀 ~ file: index.vue:212 ~ callSuccess ~ data:', data);
  125. }
  126. function callHover() {
  127. timeOuter.value = true;
  128. }
  129. function callIcon(data) {
  130. openDrawer(true, {
  131. isUpdate: true,
  132. record: { ...props.info, ...data },
  133. });
  134. }
  135. </script>
  136. <style lang="less" scoped>
  137. .timeline-outer {
  138. display: flex;
  139. margin-left: 20px;
  140. transition: all 0.3s ease-in-out;
  141. &_item {
  142. padding: 0 30px;
  143. height: 40px;
  144. line-height: 40px;
  145. border-radius: 30px;
  146. color: #fff;
  147. background: #0075ff;
  148. margin-right: 20px;
  149. cursor: pointer;
  150. letter-spacing: 2px;
  151. }
  152. }
  153. ::v-deep(.ant-picker) {
  154. width: 100%;
  155. }
  156. .ant-dropdown-link {
  157. display: block;
  158. margin-right: 16px;
  159. background: #fff;
  160. border-radius: 50%;
  161. width: 32px;
  162. height: 32px;
  163. text-align: center;
  164. line-height: 32px;
  165. cursor: pointer;
  166. &:last-child {
  167. margin-right: 0;
  168. }
  169. &:hover {
  170. color: #0075ff;
  171. }
  172. }
  173. </style>