FormModal.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. <template>
  2. <BasicModal
  3. v-bind="$attrs"
  4. destroyOnClose
  5. @register="registerModal"
  6. :title="getTitle"
  7. :width="width"
  8. @ok="handleSubmit"
  9. :showFooter="true"
  10. >
  11. <div class="!pl-8 !pt-4">
  12. <BasicForm @register="registerForm" layout="vertical" />
  13. <div v-if="type != DiagnosisEnum.firstDialysis_field">
  14. <div class="mb-4">
  15. <a-button type="primary" shape="round" @click="handleAdd">
  16. <template #icon>
  17. <PlusOutlined />
  18. </template>
  19. 添加
  20. </a-button>
  21. </div>
  22. <!-- 过敏原添加 -->
  23. <div v-if="type == DiagnosisEnum.allergic_field">
  24. <BasicTable @register="registerTable" @edit-change="callEditChange">
  25. <template #bodyCell="{ column, record }">
  26. <template v-if="column.key === 'action'">
  27. <TableAction
  28. :actions="[
  29. {
  30. auth: 'archives:diagnosisHistory:edit',
  31. icon: 'icon-xt-details_delete_default|iconfont',
  32. tooltip: '删除',
  33. popConfirm: {
  34. title: '是否取消删除',
  35. placement: 'left',
  36. confirm: handleDel.bind(null, record, column),
  37. },
  38. },
  39. ]"
  40. />
  41. </template>
  42. </template>
  43. </BasicTable>
  44. </div>
  45. <div v-if="type == DiagnosisEnum.operation_field">
  46. <BasicTable @register="registerTableOperation" @edit-change="callEditChange">
  47. <template #bodyCell="{ column, record }">
  48. <template v-if="column.key === 'action'">
  49. <TableAction
  50. :actions="[
  51. {
  52. auth: 'archives:diagnosisHistory:edit',
  53. icon: 'icon-xt-details_delete_default|iconfont',
  54. tooltip: '删除',
  55. popConfirm: {
  56. title: '是否取消删除',
  57. placement: 'left',
  58. confirm: handleDel.bind(null, record, column),
  59. },
  60. },
  61. ]"
  62. />
  63. </template>
  64. </template>
  65. </BasicTable>
  66. </div>
  67. <div v-if="type == DiagnosisEnum.contagious_field">
  68. <BasicTable @register="registerTableContagious" @edit-change="callEditChange">
  69. <template #bodyCell="{ column, record }">
  70. <template v-if="column.key === 'action'">
  71. <TableAction
  72. :actions="[
  73. {
  74. auth: 'archives:diagnosisHistory:edit',
  75. icon: 'icon-xt-details_delete_default|iconfont',
  76. tooltip: '删除',
  77. popConfirm: {
  78. title: '是否取消删除',
  79. placement: 'left',
  80. confirm: handleDel.bind(null, record, column),
  81. },
  82. },
  83. ]"
  84. />
  85. </template>
  86. </template>
  87. </BasicTable>
  88. </div>
  89. <div
  90. v-if="
  91. type == DiagnosisEnum.complications_field ||
  92. type == DiagnosisEnum.clinic_field ||
  93. type == DiagnosisEnum.pathological_field ||
  94. type == DiagnosisEnum.ckd_field
  95. "
  96. >
  97. <BasicTable @register="registerTableMulti" @edit-change="callEditChange">
  98. <template #bodyCell="{ column, record }">
  99. <template v-if="column.key === 'action'">
  100. <TableAction
  101. :actions="[
  102. {
  103. auth: 'archives:diagnosisHistory:edit',
  104. icon: 'icon-xt-details_delete_default|iconfont',
  105. tooltip: '删除',
  106. popConfirm: {
  107. title: '是否取消删除',
  108. placement: 'left',
  109. confirm: handleDel.bind(null, record, column),
  110. },
  111. },
  112. ]"
  113. />
  114. </template>
  115. </template>
  116. </BasicTable>
  117. </div>
  118. <div v-if="type == DiagnosisEnum.elseRemark_field">
  119. <BasicTable @register="registerTableOther" @edit-change="callEditChange">
  120. <template #bodyCell="{ column, record }">
  121. <template v-if="column.key === 'action'">
  122. <TableAction
  123. :actions="[
  124. {
  125. auth: 'archives:diagnosisHistory:edit',
  126. icon: 'icon-xt-details_delete_default|iconfont',
  127. tooltip: '删除',
  128. popConfirm: {
  129. title: '是否取消删除',
  130. placement: 'left',
  131. confirm: handleDel.bind(null, record, column),
  132. },
  133. },
  134. ]"
  135. />
  136. </template>
  137. </template>
  138. </BasicTable>
  139. </div>
  140. </div>
  141. <!-- {{ type }} -->
  142. </div>
  143. </BasicModal>
  144. </template>
  145. <script lang="ts" setup>
  146. import { ref, unref, nextTick, reactive } from 'vue';
  147. import { BasicModal, useModalInner } from '/@/components/Modal';
  148. import { BasicForm, useForm } from '/@/components/Form';
  149. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  150. import { PlusOutlined } from '@ant-design/icons-vue';
  151. import { useMessage } from '/@/hooks/web/useMessage';
  152. import {
  153. dataFormSchema,
  154. columnsAllergic,
  155. DiagnosisEnum,
  156. columnsMulti,
  157. columnsContagious,
  158. columnsOther,
  159. columnsOperation,
  160. } from './data';
  161. import {
  162. archivesDiagnosisHistorySingleAddOrEdit,
  163. archivesDiagnosisHistoryMultiAddOrEdit,
  164. } from '/@/api/biz/archives/diagnosisHistoryApi';
  165. import { nanoid } from 'nanoid';
  166. import { listDictModel, listDictModelBatch } from '@/api/common';
  167. import dayjs from 'dayjs';
  168. const emit = defineEmits(['success', 'register']);
  169. const getTitle = ref('编辑');
  170. const width = '850px';
  171. const isSingle = ref(true);
  172. const type = ref('');
  173. const typeOptions = ref([]);
  174. const rowId = ref('');
  175. const patientBasicId = ref('');
  176. // 表格数据
  177. // 过敏史
  178. const tableDataAllergic = ref([]);
  179. const tableRecordType = ref('');
  180. // 传染病史
  181. const tableDataContagious = ref([]);
  182. const tableDataOperation = ref([]);
  183. const tableDataMulti = ref([]);
  184. const tableDataOther = ref([]);
  185. const { createMessage } = useMessage();
  186. const bizDictOptions = reactive<any>({});
  187. const bizDictData = ref([
  188. { key: 'allergic', dictCode: 'allergic' },
  189. { key: 'allergic_food', dictCode: 'allergic_food' },
  190. { key: 'allergic_touch', dictCode: 'allergic_touch' },
  191. { key: 'allergic_air', dictCode: 'allergic_air' },
  192. { key: 'allergic_inject', dictCode: 'allergic_inject' },
  193. { key: 'contagious', dictCode: 'contagious' },
  194. { key: 'pb_epidemic', dictCode: 'pb_epidemic' },
  195. { key: 'complications', dictCode: 'complications' },
  196. { key: 'complications_breath', dictCode: 'complications_breath' },
  197. { key: 'complications_blood', dictCode: 'complications_blood' },
  198. { key: 'complications_incretion', dictCode: 'complications_incretion' },
  199. { key: 'clinic', dictCode: 'clinic' },
  200. { key: 'clinic_breath', dictCode: 'clinic_breath' },
  201. { key: 'clinic_heart', dictCode: 'clinic_heart' },
  202. { key: 'clinic_blood', dictCode: 'clinic_blood' },
  203. { key: 'clinic_hbgr', dictCode: 'clinic_hbgr' },
  204. { key: 'pathological', dictCode: 'pathological' },
  205. { key: 'pathological_breath', dictCode: 'pathological_breath' },
  206. { key: 'pathological_heart', dictCode: 'pathological_heart' },
  207. { key: 'pathological_blood', dictCode: 'pathological_blood' },
  208. { key: 'pathological_hbgr', dictCode: 'pathological_hbgr' },
  209. { key: 'ckd', dictCode: 'ckd' },
  210. { key: 'ckd_breath', dictCode: 'ckd_breath' },
  211. { key: 'ckd_heart', dictCode: 'ckd_heart' },
  212. { key: 'ckd_blood', dictCode: 'ckd_blood' },
  213. { key: 'ckd_hbgr', dictCode: 'ckd_hbgr' },
  214. ]);
  215. const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
  216. await resetFields();
  217. setModalProps({ confirmLoading: false });
  218. console.log('🚀 ~ file: FormModal.vue:52 ~ data:', data);
  219. const res = await listDictModelBatch(bizDictData.value.map(ele => ele.dictCode));
  220. for (const i in res) {
  221. const filter = bizDictData.value.filter(ele => ele.dictCode == i)[0];
  222. bizDictOptions[filter.key] = res[i];
  223. }
  224. tableDataAllergic.value = [];
  225. type.value = data.type || '';
  226. typeOptions.value = data.dictOptions;
  227. rowId.value = data?.id || '';
  228. patientBasicId.value = data?.patientBasicId || '';
  229. isSingle.value = data.isSingle;
  230. getTitle.value = `${data.id ? '编辑' : '新增'} — ${data.title}`;
  231. // 其他诊断
  232. if (type.value == DiagnosisEnum.elseRemark_field) {
  233. tableDataOther.value =
  234. (data.multiContent.length &&
  235. data.multiContent.map(ele => {
  236. return {
  237. remark: ele.remark,
  238. id: nanoid(5),
  239. };
  240. })) ||
  241. [];
  242. console.log('🚀 ~ file: FormModal.vue:179 ~ tableDataOther.value:', tableDataOther.value);
  243. await nextTick();
  244. await setTableDataOther(tableDataOther.value);
  245. }
  246. // 过敏原
  247. if (type.value == DiagnosisEnum.allergic_field) {
  248. tableDataAllergic.value =
  249. (data.content.length &&
  250. data.content.map(ele => {
  251. const nameOptions = bizDictOptions[ele.contentType];
  252. return {
  253. type: type.value,
  254. contentType: ele.contentType,
  255. typeOptions: typeOptions.value,
  256. name: ele.multiName,
  257. nameOptions,
  258. id: nanoid(5),
  259. };
  260. })) ||
  261. [];
  262. await nextTick();
  263. await setTableDataAllergic(tableDataAllergic.value);
  264. }
  265. // 手术史
  266. if (type.value == DiagnosisEnum.operation_field) {
  267. tableDataOperation.value =
  268. (data.content.length &&
  269. data.content.map(ele => {
  270. return {
  271. type: type.value,
  272. singleName: ele.singleName,
  273. recordTime: dayjs(ele.recordTime).format('YYYY-MM-DD'),
  274. remark: ele.remark,
  275. id: nanoid(5),
  276. };
  277. })) ||
  278. [];
  279. await nextTick();
  280. await setTableDataOperation(tableDataOperation.value);
  281. }
  282. // 传染病史
  283. if (type.value == DiagnosisEnum.contagious_field) {
  284. console.log('🚀 ~ file: FormModal.vue:178 ~ data.data:', data);
  285. tableDataContagious.value =
  286. (data.content.length &&
  287. data.content.map(ele => {
  288. return {
  289. type: type.value,
  290. contentType: ele.contentType,
  291. typeOptions: typeOptions.value,
  292. startTime: ele.startTime ? dayjs(ele.startTime).format('YYYY-MM-DD') : '',
  293. endTime: ele.endTime ? dayjs(ele.endTime).format('YYYY-MM-DD') : '',
  294. status: ele.status,
  295. remark: ele.remark,
  296. id: nanoid(5),
  297. };
  298. })) ||
  299. [];
  300. await nextTick();
  301. await setTableDataContagious(tableDataContagious.value);
  302. }
  303. // 合并症类型、临床诊断类型、病理类型、CKD类型
  304. if (
  305. type.value == DiagnosisEnum.complications_field ||
  306. type.value == DiagnosisEnum.clinic_field ||
  307. type.value == DiagnosisEnum.pathological_field ||
  308. type.value == DiagnosisEnum.ckd_field
  309. ) {
  310. console.log('🚀 ~ file: FormModal.vue:178 ~ data.data:', data);
  311. tableDataMulti.value =
  312. (data.multiContent.length &&
  313. data.multiContent.map(ele => {
  314. const nameOptions = bizDictOptions[ele.type];
  315. return {
  316. type: type.value,
  317. contentType: ele.type,
  318. typeOptions: typeOptions.value,
  319. name: ele.multiName || [],
  320. nameOptions,
  321. id: nanoid(5),
  322. };
  323. })) ||
  324. [];
  325. await nextTick();
  326. await setTableDataMulti(tableDataMulti.value);
  327. }
  328. let resData = {} as any;
  329. // resData = {
  330. // recordTime: data.isSingle ? data.content?.recordTime : '',
  331. // name: data.isSingle ? useUser.getUserInfo?.nickname,
  332. // type: type.value,
  333. // };
  334. resData = {
  335. recordTime: data.updateTime
  336. ? dayjs(data.updateTime).format('YYYY-MM-DD')
  337. : dayjs().format('YYYY-MM-DD'),
  338. name: data.updatorName,
  339. type: type.value,
  340. };
  341. // 首次透析方式
  342. if (type.value == DiagnosisEnum.firstDialysis_field) {
  343. resData.firstDialysisType = data.content[0]?.contentType;
  344. resData.firstDialysisDate = dayjs().format('YYYY-MM-DD');
  345. resData.recordTime = dayjs(data.content[0]?.recordTime).format('YYYY-MM-DD');
  346. }
  347. await setFieldsValue({
  348. ...resData,
  349. });
  350. });
  351. const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
  352. labelWidth: 100,
  353. schemas: dataFormSchema,
  354. showActionButtonGroup: false,
  355. actionColOptions: {
  356. span: 23,
  357. },
  358. baseColProps: {
  359. span: 12,
  360. },
  361. wrapperCol: {
  362. span: 22,
  363. },
  364. });
  365. const useTbaleObj = {
  366. rowKey: 'id',
  367. showIndexColumn: false,
  368. bordered: true,
  369. striped: false,
  370. pagination: false,
  371. maxHeight: 200,
  372. actionColumn: {
  373. width: 40,
  374. title: '操作',
  375. dataIndex: 'action',
  376. },
  377. };
  378. // 过敏史 allergic
  379. const [
  380. registerTable,
  381. { setTableData: setTableDataAllergic, getDataSource: getDataSourceAllergic },
  382. ] = useTable({
  383. ...useTbaleObj,
  384. dataSource: tableDataAllergic.value,
  385. columns: columnsAllergic,
  386. });
  387. // 传染病 contagious
  388. const [
  389. registerTableContagious,
  390. { setTableData: setTableDataContagious, getDataSource: getDataSourceContagious },
  391. ] = useTable({
  392. ...useTbaleObj,
  393. dataSource: tableDataContagious.value,
  394. columns: columnsContagious,
  395. });
  396. const [
  397. registerTableOperation,
  398. { setTableData: setTableDataOperation, getDataSource: getDataSourceOperation },
  399. ] = useTable({
  400. ...useTbaleObj,
  401. dataSource: tableDataOperation.value,
  402. columns: columnsOperation,
  403. });
  404. // 治疗前合并症 contagious
  405. const [
  406. registerTableMulti,
  407. { setTableData: setTableDataMulti, getDataSource: getDataSourceMulti },
  408. ] = useTable({
  409. ...useTbaleObj,
  410. dataSource: tableDataMulti.value || [],
  411. columns: columnsMulti,
  412. });
  413. // 其他
  414. const [
  415. registerTableOther,
  416. { setTableData: setTableDataOther, getDataSource: getDataSourceOther },
  417. ] = useTable({
  418. ...useTbaleObj,
  419. dataSource: tableDataOther.value,
  420. columns: columnsOther,
  421. });
  422. async function handleAdd() {
  423. if (type.value == DiagnosisEnum.allergic_field) {
  424. tableDataAllergic.value.push({
  425. type: type.value,
  426. contentType: '',
  427. typeOptions: typeOptions.value,
  428. name: [],
  429. nameOptions: [],
  430. id: nanoid(5),
  431. });
  432. console.log(
  433. '🚀 ~ file: FormModal.vue:135 ~ handleAdd ~ tableDataAllergic.value:',
  434. tableDataAllergic.value,
  435. );
  436. await nextTick();
  437. await setTableDataAllergic(tableDataAllergic.value);
  438. }
  439. if (type.value == DiagnosisEnum.operation_field) {
  440. tableDataOperation.value.push({
  441. type: type.value,
  442. singleName: '',
  443. recordTime: dayjs().format('YYYY-MM-DD'),
  444. remark: '',
  445. id: nanoid(5),
  446. });
  447. console.log(
  448. '🚀 ~ file: FormModal.vue:135 ~ handleAdd ~ tableDataOperation.value:',
  449. tableDataOperation.value,
  450. );
  451. await nextTick();
  452. await setTableDataOperation(tableDataOperation.value);
  453. }
  454. if (type.value == DiagnosisEnum.contagious_field) {
  455. tableDataContagious.value.push({
  456. type: type.value,
  457. contentType: '',
  458. startTime: '',
  459. endTime: '',
  460. status: 'contagious_status_alive',
  461. remark: '',
  462. id: nanoid(5),
  463. });
  464. console.log(
  465. '🚀 ~ file: FormModal.vue:135 ~ handleAdd ~ tableDataAllergic.value:',
  466. tableDataContagious.value,
  467. );
  468. await nextTick();
  469. await setTableDataContagious(tableDataContagious.value);
  470. }
  471. if (
  472. type.value == DiagnosisEnum.complications_field ||
  473. type.value == DiagnosisEnum.clinic_field ||
  474. type.value == DiagnosisEnum.pathological_field ||
  475. type.value == DiagnosisEnum.ckd_field
  476. ) {
  477. tableDataMulti.value.push({
  478. type: type.value,
  479. contentType: '',
  480. typeOptions: typeOptions.value,
  481. name: [],
  482. nameOptions: [],
  483. id: nanoid(5),
  484. });
  485. console.log(
  486. '🚀 ~ file: FormModal.vue:135 ~ handleAdd ~ tableDataAllergic.value:',
  487. tableDataMulti.value,
  488. );
  489. await nextTick();
  490. await setTableDataMulti(tableDataMulti.value);
  491. }
  492. if (type.value == DiagnosisEnum.elseRemark_field) {
  493. tableDataOther.value.push({
  494. type: type.value,
  495. remark: '',
  496. id: nanoid(5),
  497. });
  498. console.log(
  499. '🚀 ~ file: FormModal.vue:135 ~ handleAdd ~ tableDataAllergic.value:',
  500. tableDataOther.value,
  501. );
  502. await nextTick();
  503. await setTableDataOther(tableDataOther.value);
  504. }
  505. }
  506. async function handleDel(record) {
  507. console.log('🚀 ~ file: FormModal.vue:488 ~ handleDel ~ record:', record);
  508. let data = [];
  509. let index = null;
  510. if (type.value == DiagnosisEnum.operation_field) {
  511. data = getDataSourceOperation();
  512. index = data.findIndex(item => item.id === record.id);
  513. tableDataOperation.value.splice(index, 1);
  514. setTableDataOperation(tableDataOperation.value);
  515. }
  516. if (type.value == DiagnosisEnum.allergic_field) {
  517. data = getDataSourceAllergic();
  518. index = data.findIndex(item => item.id === record.id);
  519. tableDataAllergic.value.splice(index, 1);
  520. setTableDataAllergic(tableDataAllergic.value);
  521. }
  522. if (type.value == DiagnosisEnum.contagious_field) {
  523. data = getDataSourceContagious();
  524. index = data.findIndex(item => item.id === record.id);
  525. tableDataContagious.value.splice(index, 1);
  526. setTableDataContagious(tableDataContagious.value);
  527. }
  528. if (type.value == DiagnosisEnum.elseRemark_field) {
  529. data = getDataSourceOther();
  530. index = data.findIndex(item => item.id === record.id);
  531. tableDataOther.value.splice(index, 1);
  532. setTableDataOther(tableDataOther.value);
  533. }
  534. if (!isSingle.value && type.value != DiagnosisEnum.elseRemark_field) {
  535. data = getDataSourceMulti();
  536. index = data.findIndex(item => item.id === record.id);
  537. tableDataMulti.value.splice(index, 1);
  538. setTableDataMulti(tableDataMulti.value);
  539. }
  540. }
  541. // 提交按钮事件
  542. async function handleSubmit() {
  543. try {
  544. const values = await validate();
  545. const sendData = {
  546. content: [],
  547. multiContent: [],
  548. id: isSingle.value ? '' : rowId.value,
  549. patientBasicId: patientBasicId.value,
  550. type: type.value,
  551. };
  552. setModalProps({ confirmLoading: true });
  553. // 首次透析
  554. if (type.value == DiagnosisEnum.firstDialysis_field) {
  555. sendData.content = [
  556. {
  557. recordTime: values.firstDialysisDate,
  558. contentType: values.firstDialysisType,
  559. },
  560. ];
  561. }
  562. // 手术史
  563. if (type.value == DiagnosisEnum.operation_field) {
  564. sendData.content = tableDataOperation.value.map(ele => {
  565. return {
  566. singleName: ele.singleName,
  567. recordTime: ele.recordTime,
  568. remark: ele.remark,
  569. };
  570. });
  571. }
  572. // 过敏史
  573. if (type.value == DiagnosisEnum.allergic_field) {
  574. sendData.content = tableDataAllergic.value.map(ele => {
  575. return {
  576. contentType: ele.contentType,
  577. multiName: ele.name,
  578. };
  579. });
  580. }
  581. // 传染病史
  582. if (type.value == DiagnosisEnum.contagious_field) {
  583. sendData.content = tableDataContagious.value.map(ele => {
  584. return {
  585. contentType: ele.contentType,
  586. status: ele.status,
  587. startTime: ele.startTime,
  588. endTime: ele.endTime,
  589. remark: ele.remark,
  590. };
  591. });
  592. }
  593. // 合并症类型、临床诊断类型、病理类型、CKD类型 编辑(添加)
  594. if (
  595. type.value == DiagnosisEnum.complications_field ||
  596. type.value == DiagnosisEnum.clinic_field ||
  597. type.value == DiagnosisEnum.pathological_field ||
  598. type.value == DiagnosisEnum.ckd_field
  599. ) {
  600. sendData.multiContent = tableDataMulti.value.map(ele => {
  601. return {
  602. type: ele.contentType,
  603. multiName: ele.name,
  604. remark: '',
  605. };
  606. });
  607. }
  608. // 其他编辑(添加)
  609. if (type.value == DiagnosisEnum.elseRemark_field) {
  610. sendData.multiContent = tableDataOther.value.map(ele => {
  611. return {
  612. type: '',
  613. multiName: [],
  614. remark: ele.remark,
  615. };
  616. });
  617. }
  618. console.log('🚀 ~ file: FormModal.vue:528 ~ handleSubmit ~ sendData:', sendData);
  619. unref(isSingle)
  620. ? await archivesDiagnosisHistorySingleAddOrEdit(sendData)
  621. : await archivesDiagnosisHistoryMultiAddOrEdit(sendData);
  622. createMessage.success(`${rowId.value ? '编辑' : '新增'}成功!`);
  623. closeModal();
  624. emit('success');
  625. } finally {
  626. setModalProps({ confirmLoading: false });
  627. }
  628. }
  629. // 回调
  630. async function callEditChange({ record }) {
  631. console.log('🚀 ~ file: FormModal.vue:638 ~ callEditChange ~ record:', record);
  632. console.log(
  633. '🚀 ~ file: FormModal.vue:648 ~ callEditChange ~ tableRecordType.value:',
  634. tableRecordType.value,
  635. );
  636. if (
  637. record.type == DiagnosisEnum.complications_field ||
  638. record.type == DiagnosisEnum.clinic_field ||
  639. record.type == DiagnosisEnum.pathological_field ||
  640. record.type == DiagnosisEnum.ckd_field ||
  641. record.type == DiagnosisEnum.allergic_field
  642. ) {
  643. if (tableRecordType.value != record.contentType || !record.nameOptions.length) {
  644. tableRecordType.value = record.contentType;
  645. let res = [];
  646. res = await listDictModel({ dictCode: record.contentType });
  647. record.nameOptions = res;
  648. record.name = [];
  649. }
  650. if (record.name.length > 3) {
  651. // createMessage.error('每次最多选择4个');
  652. record.nameOptions = record.nameOptions.map(ele => {
  653. if (!record.name.includes(ele.value)) {
  654. ele.disabled = true;
  655. }
  656. return ele;
  657. });
  658. } else {
  659. record.nameOptions = record.nameOptions.map(ele => {
  660. ele.disabled = false;
  661. return ele;
  662. });
  663. }
  664. }
  665. }
  666. </script>
  667. <style lang="less" scoped>
  668. ::v-deep(.ant-btn-link) {
  669. color: rgb(61 65 85 / 100%);
  670. }
  671. ::v-deep(.ant-table-body) {
  672. height: 200px !important;
  673. }
  674. </style>