index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <div class="m-4">
  3. <!-- 透前准备
  4. <a-button type="primary" @click="plusFn">
  5. {{ countRef }}
  6. </a-button> -->
  7. <XTTitle title="透析病历" :right-data="titleData" @click="cellTitle" />
  8. <div class="flex justify-between my-4">
  9. <XTTab
  10. type="illness"
  11. :width="120"
  12. :selected="tabSelected"
  13. :data="tabData"
  14. @item-click="callTab"
  15. />
  16. <XTForm :form-data="formData" @change="cellFrom" />
  17. </div>
  18. <div>
  19. <XTCard class="flex justify-around my-2" :data="dataCard" @item-click="cellCard" />
  20. </div>
  21. <importView @register="registerModal" />
  22. </div>
  23. </template>
  24. <script setup lang="ts">
  25. import { ref } from 'vue';
  26. import { XTTab } from '/@/components/XTTab/index';
  27. import { XTCard } from '/@/components/XTCard/index';
  28. import { XTForm } from '/@/components/XTForm/index';
  29. import { XTTitle } from '/@/components/XTTitle/index';
  30. import { onMounted } from 'vue';
  31. import { readyPrepare, prePrepareSailing, wardInfo } from '/@/api/biz/visit/prepareApi';
  32. import { TitleEnum } from './data';
  33. import { nanoid } from 'nanoid';
  34. import { useModal } from '/@/components/Modal';
  35. import importView from './importView.vue';
  36. const dataCard = ref([]) as any; // 卡片数据
  37. const tabSelected = ref('0'); // 默认病区 // 病区id
  38. const SailingList = ref([]) as any; // 班次列表
  39. const tabData = ref([]);
  40. const Status = ref(''); // 状态
  41. const Name = ref('');
  42. const Sailing = ref('1'); //班次
  43. // const wardId = ref('');
  44. // const abcdefg = [
  45. // { key: '0', label: '全部' },
  46. // { key: '1', label: 'A区' },
  47. // { key: '2', label: 'B区' },
  48. // ];
  49. // 默认状态
  50. const [registerModal, { openModal }] = useModal();
  51. const titleData = [
  52. {
  53. type: 'import',
  54. icon: 'icon-xt-import_default',
  55. },
  56. {
  57. type: 'export',
  58. icon: 'icon-xt-export_default',
  59. },
  60. {
  61. type: 'add',
  62. btnIcon: 'icon-xt-add_default',
  63. btnText: '患者建档',
  64. },
  65. ];
  66. onMounted(async () => {
  67. const PrepareData = await readyPrepare({ sailingSort: '1' });
  68. const SailingData = await prePrepareSailing();
  69. const wardData = await wardInfo();
  70. for (const i of SailingData) {
  71. const obj = {
  72. label: i.name,
  73. value: i.sort,
  74. };
  75. SailingList.value.push(obj);
  76. }
  77. for (const i of wardData) {
  78. if (!i.disable) {
  79. const obj = {
  80. key: i.id,
  81. label: i.name,
  82. };
  83. tabData.value.push(obj);
  84. }
  85. }
  86. console.log('PrepareData', PrepareData);
  87. for (const i in PrepareData) {
  88. // console.log('i', i, PrepareData[i]);
  89. if (PrepareData[i] == null) continue;
  90. const obj = {
  91. groupKey: PrepareData[i] ? i : nanoid(),
  92. groupTit: TitleEnum[i],
  93. groupMode: 'simple',
  94. groupValue: [
  95. {
  96. value: PrepareData[i] ? PrepareData[i].length : 0,
  97. color: TitleEnum[i + 'Color'],
  98. background: TitleEnum[i + 'Bg'],
  99. },
  100. ],
  101. groupValueShow: true,
  102. groupData: PrepareData[i].map(ele => {
  103. return {
  104. id: ele.patientBasicId,
  105. type: '1',
  106. borderLeftColor: TitleEnum[i + 'Color'],
  107. ward: ele.inpatientWard,
  108. bed: ele.bed,
  109. cure: 'HDF/AVF',
  110. name: ele.name,
  111. age: ele.age,
  112. gender: ele.gender,
  113. infoShow: false,
  114. way: [
  115. { label: '透前称量', type: '2' },
  116. { label: '确认配方', type: '3' },
  117. ],
  118. };
  119. }),
  120. };
  121. dataCard.value.push(obj);
  122. }
  123. console.log(' dataCard.value', dataCard.value);
  124. });
  125. // formdata
  126. const formData = [
  127. {
  128. name: 'prepareStatus',
  129. label: '全部',
  130. componentType: 'Select',
  131. placeholder: '请选择',
  132. width: 100,
  133. defaultValue: '',
  134. dicts: [
  135. { label: '全部', value: '' },
  136. { label: '未称量', value: 'pds_unWeighed', prefixColor: TitleEnum.unWeighedColor },
  137. { label: '待确认', value: 'pds_unconfirmed', prefixColor: TitleEnum.unconfirmedColor },
  138. { label: '可打印', value: 'pds_printable', prefixColor: TitleEnum.printableColor },
  139. { label: '已完成', value: 'pds_finish', prefixColor: TitleEnum.finishColor },
  140. ],
  141. },
  142. {
  143. name: 'sailingSort',
  144. componentType: 'Select',
  145. placeholder: '请选择',
  146. width: 120,
  147. defaultValue: '1班',
  148. label: '班次',
  149. dicts: SailingList.value,
  150. },
  151. {
  152. name: 'name',
  153. componentType: 'Input',
  154. placeholder: '请输入',
  155. width: 200,
  156. },
  157. ];
  158. // 回调
  159. async function callTab(data) {
  160. console.log('🚀 ~ file: index.vue:41 ~ callTab ~ data:', data);
  161. tabSelected.value = data.value;
  162. const formData = {
  163. prepareStatus: Status.value,
  164. sailingSort: Sailing.value,
  165. name: Name.value,
  166. inpatientWardId: tabSelected.value,
  167. };
  168. const PrepareData = await readyPrepare(formData);
  169. console.log('PrepareData', PrepareData);
  170. dataCard.value = [];
  171. for (const i in PrepareData) {
  172. // console.log('i', i, PrepareData[i]);
  173. if (PrepareData[i] == null) continue;
  174. const obj = {
  175. groupKey: PrepareData[i] ? i : nanoid(),
  176. groupTit: TitleEnum[i],
  177. groupMode: 'simple',
  178. groupValue: [
  179. {
  180. value: PrepareData[i] ? PrepareData[i].length : 0,
  181. color: TitleEnum[i + 'Color'],
  182. background: TitleEnum[i + 'Bg'],
  183. },
  184. ],
  185. groupValueShow: true,
  186. groupData: PrepareData[i].map(ele => {
  187. return {
  188. id: ele.patientBasicId,
  189. type: '1',
  190. borderLeftColor: TitleEnum[i + 'Color'],
  191. ward: ele.inpatientWard,
  192. bed: ele.bed,
  193. cure: 'HDF/AVF',
  194. name: ele.name,
  195. age: ele.age,
  196. gender: ele.gender,
  197. infoShow: false,
  198. way: [
  199. { label: '透前称量', type: '2' },
  200. { label: '确认配方', type: '3' },
  201. ],
  202. };
  203. }),
  204. };
  205. dataCard.value.push(obj);
  206. }
  207. }
  208. function cellCard(data) {
  209. console.log('🚀 ~ file: index.vue:106 ~ cellCard ~ data:', data);
  210. }
  211. // 导入导出回调
  212. function cellTitle(data) {
  213. console.log('🚀 ~ file: index.vue:106 ~ cellTitle ~ data:', data);
  214. if (data.type == 'import') {
  215. openModal(true);
  216. }
  217. }
  218. async function cellFrom(data) {
  219. Status.value = data.prepareStatus;
  220. if (data.sailingSort) {
  221. Sailing.value = data.sailingSort;
  222. }
  223. Name.value = data.name;
  224. data.inpatientWardId = tabSelected.value;
  225. console.log('🚀 ~ file: index.vue:106 ~ cellFrom ~ data:', data);
  226. if (!data.sailingSort) {
  227. data.sailingSort = '1';
  228. }
  229. const PrepareData = await readyPrepare(data);
  230. console.log('PrepareData', PrepareData);
  231. dataCard.value = [];
  232. for (const i in PrepareData) {
  233. // console.log('i', i, PrepareData[i]);
  234. if (PrepareData[i] == null) continue;
  235. const obj = {
  236. groupKey: PrepareData[i] ? i : nanoid(),
  237. groupTit: TitleEnum[i],
  238. groupMode: 'simple',
  239. groupValue: [
  240. {
  241. value: PrepareData[i] ? PrepareData[i].length : 0,
  242. color: TitleEnum[i + 'Color'],
  243. background: TitleEnum[i + 'Bg'],
  244. },
  245. ],
  246. groupValueShow: true,
  247. groupData: PrepareData[i].map(ele => {
  248. return {
  249. id: ele.patientBasicId,
  250. type: '1',
  251. borderLeftColor: TitleEnum[i + 'Color'],
  252. ward: ele.inpatientWard,
  253. bed: ele.bed,
  254. cure: 'HDF/AVF',
  255. name: ele.name,
  256. age: ele.age,
  257. gender: ele.gender,
  258. infoShow: false,
  259. way: [
  260. { label: '透前称量', type: '2' },
  261. { label: '确认配方', type: '3' },
  262. ],
  263. };
  264. }),
  265. };
  266. dataCard.value.push(obj);
  267. }
  268. }
  269. // function callHover() {
  270. // timeOuter.value = true;
  271. // }
  272. </script>
  273. <style lang="less" scoped>
  274. ::v-deep(.ant-form-item-label > label) {
  275. width: 100% !important;
  276. }
  277. .timeline-outer {
  278. display: flex;
  279. margin-left: 20px;
  280. transition: all 0.3s ease-in-out;
  281. &_item {
  282. padding: 0 30px;
  283. height: 40px;
  284. line-height: 40px;
  285. border-radius: 30px;
  286. color: #fff;
  287. background: #0075ff;
  288. margin-right: 20px;
  289. cursor: pointer;
  290. }
  291. }
  292. </style>