Selaa lähdekoodia

完成ca的患者优化

xiaochan 3 kuukautta sitten
vanhempi
commit
e7db6514c4

+ 12 - 0
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/plugins/ca/EmrCAComp.vue

@@ -314,6 +314,18 @@ function handleSignType(val, index) {
 
   if (find.length === 1) {
     setSelectListByIndex(index, find[0]);
+  } else {
+    useDialog(SignIdCard, {
+      params: {
+        data: idCardTypeList.value,
+        isEdit: false,
+      },
+      dialogProps: {
+        title: "选择一个人",
+      },
+    }).then(res => {
+      setSelectListByIndex(index, res);
+    });
   }
 }
 

+ 25 - 13
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/plugins/ca/SignIdCard.vue

@@ -10,12 +10,17 @@ import {
 } from "@/api/ca/ca-api";
 import XEUtils from "xe-utils";
 import { BizException, ExceptionEnum } from "@/utils/BizException";
-import { Row } from "vxe-pc-ui";
 import { CyMessageBox } from "@/utils/cy-message-box";
 
-const props = defineProps<{ data: any[]; patNo: string }>();
+const props = withDefaults(
+  defineProps<{ data: any[]; patNo?: string; isEdit?: boolean }>(),
+  {
+    isEdit: true,
+  }
+);
 
 const tableRef = useVxeTableRef<PatientIdCardType>();
+const emits = defineEmits<UseDialogType.Emits>();
 
 async function handleAdd() {
   const caType = selectData[2];
@@ -34,7 +39,6 @@ async function handleAdd() {
 }
 
 async function handleDel(row, index: number) {
-  console.log(row);
   await CyMessageBox.confirm({
     message: "删除后无法恢复",
     type: "delete",
@@ -63,17 +67,25 @@ function handleSelect(row, val) {
     XEUtils.find(selectData, item => item.code === val)?.name ?? "未知";
 }
 
+function cellClick({ row }) {
+  emits("cyDialogConfirm", row);
+}
+
 defineExpose<UseDialogType.Expose>({
   async confirm() {
-    const insertRecords = tableRef.value.getInsertRecords();
-    const editRecord = tableRef.value.getUpdateRecords();
+    if (props.isEdit) {
+      const insertRecords = tableRef.value.getInsertRecords();
+      const editRecord = tableRef.value.getUpdateRecords();
 
-    const errMap = await tableRef.value.validate(true);
-    if (errMap) {
-      BizException(ExceptionEnum.MESSAGE_ERROR, "校验不通过!");
+      const errMap = await tableRef.value.validate(true);
+      if (errMap) {
+        BizException(ExceptionEnum.MESSAGE_ERROR, "校验不通过!");
+      }
+      await savePatientIdCardType(insertRecords, editRecord, props.patNo);
+      return true;
+    } else {
+      return tableRef.value.getCurrentRecord();
     }
-    await savePatientIdCardType(insertRecords, editRecord, props.patNo);
-    return true;
   },
 });
 </script>
@@ -81,10 +93,12 @@ defineExpose<UseDialogType.Expose>({
 <template>
   <vxe-table
     ref="tableRef"
+    :row-config="{ isCurrent: !props.isEdit }"
     keep-source
+    @cell-click="cellClick"
     :data="data"
     :edit-rules="validRules"
-    :edit-config="editorConfig"
+    :edit-config="props.isEdit ? editorConfig : null"
   >
     <vxe-column :edit-render="{}" title="名字" field="name">
       <template #edit="{ row }">
@@ -116,5 +130,3 @@ defineExpose<UseDialogType.Expose>({
     </vxe-column>
   </vxe-table>
 </template>
-
-<style lang="scss"></style>