Przeglądaj źródła

Merge branches 'taskID-261-02' and 'taskID-261' of ssh://121.43.162.141:10022/six.fe/diagnosis.admin into taskID-261-02

张田田 1 tydzień temu
rodzic
commit
47851d6ea3
1 zmienionych plików z 9 dodań i 4 usunięć
  1. 9 4
      src/views/business/components/AcupointTable.vue

+ 9 - 4
src/views/business/components/AcupointTable.vue

@@ -1324,17 +1324,19 @@ export default {
     },
     onItemChange(acuid, scope, detailType) {
       const row = scope.row;
+      // 在任何修改之前记录该行是否已有值(区分修改和新增)
+      const hadPreviousValue = !!row.acuid;
+
       const table = this.getDetailTable(detailType);
       const exists = table.find(
         (item) => item.acuid === acuid && item.id !== row.id,
       );
       if (exists) {
         this.$message.error("不可重复选择");
-        row.acuid = "";
-        row.name = "";
-        row.acuname = "";
+        // 不重置行数据,保留原有值,让 :value 绑定自动回显
         return;
       }
+
       const optionsList = this.getSearchOptions(detailType);
       const selected = optionsList.find((item) => item.acuid === acuid);
       if (selected) {
@@ -1349,7 +1351,10 @@ export default {
           row.count = Number(selected.num) || 1;
         }
       }
-      this.addDetailRow(scope, detailType);
+      // 只有新增(原来没有值)才添加新行,修改不添加
+      if (!hadPreviousValue) {
+        this.addDetailRow(scope, detailType);
+      }
     },
     onDetailInput(scope, detailType) {
       if (scope.row.name) {