From 4c9fdc87987140e8b2c3f0dfc2f6608cdb6be774 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 21 十月 2026 17:39:24 +0800
Subject: [PATCH] 青岛维护

---
 src/views/business/OrganUtilization/OrganUtilizationInfo.vue |  184 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 165 insertions(+), 19 deletions(-)

diff --git a/src/views/business/OrganUtilization/OrganUtilizationInfo.vue b/src/views/business/OrganUtilization/OrganUtilizationInfo.vue
index 181ffa6..ead00f7 100644
--- a/src/views/business/OrganUtilization/OrganUtilizationInfo.vue
+++ b/src/views/business/OrganUtilization/OrganUtilizationInfo.vue
@@ -13,18 +13,21 @@
             <el-input
               v-model="form.responsibleusername"
               placeholder="璇疯緭鍏ヨ礋璐d汉濮撳悕"
+              :disabled="isReadOnly"
             />
           </el-form-item>
           <el-form-item label="鍗忚皟鍛樹竴" prop="coordinatedusernameo" class="col-1-3">
             <el-input
               v-model="form.coordinatedusernameo"
               placeholder="璇疯緭鍏ュ崗璋冨憳涓�濮撳悕"
+              :disabled="isReadOnly"
             />
           </el-form-item>
           <el-form-item label="鍗忚皟鍛樹簩" prop="coordinatedusernamet" class="col-1-3">
             <el-input
               v-model="form.coordinatedusernamet"
               placeholder="璇疯緭鍏ュ崗璋冨憳浜屽鍚�"
+              :disabled="isReadOnly"
             />
           </el-form-item>
           <el-form-item label="瀹屾垚鏃堕棿" prop="completetime" class="col-1-3">
@@ -33,6 +36,7 @@
               type="datetime"
               value-format="yyyy-MM-dd HH:mm:ss"
               style="width: 100%"
+              :disabled="isReadOnly"
             />
           </el-form-item>
         </div>
@@ -61,7 +65,7 @@
         </div>
         <div class="form-row">
           <el-form-item align="left" label="閬椾綋鎺ユ敹" prop="isbodydonation" class="col-1-3">
-            <el-radio-group v-model="form.isbodydonation">
+            <el-radio-group v-model="form.isbodydonation" :disabled="isReadOnly">
               <el-radio
                 v-for="dict in dict.type.sys_0_1 || []"
                 :key="dict.value"
@@ -75,12 +79,14 @@
             <el-input
               v-model="form.relationname"
               placeholder="璇疯緭鍏ユ帴鏀跺灞�"
+              :disabled="isReadOnly"
             />
           </el-form-item>
           <el-form-item label="涓庢崘鐚�呭叧绯�" prop="signfamilyrelations" class="col-1-3">
             <el-select
               v-model="form.signfamilyrelations"
               placeholder="璇烽�夋嫨涓庢崘鐚�呭叧绯�"
+              :disabled="isReadOnly"
             >
               <el-option
                 v-for="dict in dict.type.sys_FamilyRelation || []"
@@ -116,6 +122,7 @@
             <el-form-item label-width="100px" label="绉绘鍣ㄥ畼">
               <el-checkbox-group
                 v-model="selectedOrgans"
+                :disabled="isReadOnly"
                 @change="handleOrganSelectionChange"
               >
                 <el-checkbox
@@ -181,7 +188,9 @@
                               <el-form-item label="鍙楄�呭鍚�">
                                 <el-input
                                   v-model="scope.row.name"
+                                  :class="{ 'field-error': isFieldError(scope.row, 'name') }"
                                   placeholder="璇疯緭鍏ュ彈鑰呭鍚�"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -193,6 +202,7 @@
                                   value-format="yyyy-MM-dd"
                                   placeholder="閫夋嫨鍑虹敓鏃ユ湡"
                                   style="width: 100%"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -202,6 +212,7 @@
                                   v-model="scope.row.sex"
                                   placeholder="璇烽�夋嫨鎬у埆"
                                   style="width: 100%"
+                                  :disabled="isReadOnly"
                                 >
                                   <el-option label="鐢�" :value="0" />
                                   <el-option label="濂�" :value="1" />
@@ -216,6 +227,7 @@
                                 <el-input
                                   v-model="scope.row.age"
                                   placeholder="骞撮緞"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -225,6 +237,7 @@
                                   v-model="scope.row.idcardtype"
                                   placeholder="璇烽�夋嫨璇佷欢绫诲瀷"
                                   style="width: 100%"
+                                  :disabled="isReadOnly"
                                 >
                                   <el-option label="韬唤璇�" :value="1" />
                                   <el-option label="鎶ょ収" :value="2" />
@@ -238,6 +251,7 @@
                                 <el-input
                                   v-model="scope.row.idcardno"
                                   placeholder="璇佷欢鍙风爜"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -253,6 +267,7 @@
                                 <el-input
                                   v-model="scope.row.hospitalname"
                                   placeholder="璇疯緭鍏ョЩ妞嶄腑蹇冨悕绉�"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -261,6 +276,7 @@
                                 <el-input
                                   v-model="scope.row.phone"
                                   placeholder="鑱旂郴鐢佃瘽"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -274,6 +290,7 @@
                                   :rows="2"
                                   v-model="scope.row.residenceaddress"
                                   placeholder="璇疯緭鍏ヨ缁嗗湴鍧�"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -295,6 +312,7 @@
                                   value-format="yyyy-MM-dd HH:mm:ss"
                                   placeholder="閫夋嫨绉绘鏃ユ湡"
                                   style="width: 100%"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -303,6 +321,7 @@
                                 <el-input
                                   v-model="scope.row.transplantdoct"
                                   placeholder="璇疯緭鍏ョЩ妞嶅尰鐢�"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -321,8 +340,10 @@
                                 <el-input
                                   type="textarea"
                                   :rows="3"
+                                  :class="{ 'field-error': isFieldError(scope.row, 'abandonreason') }"
                                   v-model="scope.row.abandonreason"
                                   placeholder="璇疯緭鍏ユ湭绉绘鍘熷洜"
+                                  :disabled="isReadOnly"
                                 />
                               </el-form-item>
                             </el-col>
@@ -365,10 +386,12 @@
                   <template slot-scope="scope">
                     <el-autocomplete
                       v-model="scope.row.hospitalname"
+                      :class="{ 'field-error': isFieldError(scope.row, 'hospitalname') }"
                       :fetch-suggestions="queryHospitalSearch"
                       placeholder="璇烽�夋嫨鎴栬緭鍏ョЩ妞嶅尰闄�"
                       style="width: 100%"
                       clearable
+                      :disabled="isReadOnly"
                     ></el-autocomplete>
                   </template>
                 </el-table-column>
@@ -382,6 +405,7 @@
                       v-model="scope.row.transplantstate"
                       placeholder="璇烽�夋嫨绉绘鐘舵��"
                       style="width: 100%"
+                      :disabled="isReadOnly"
                       @change="handleTransplantStatusChange(scope.row, $event)"
                     >
                       <el-option
@@ -406,9 +430,11 @@
                       size="small"
                       style="width: 100%"
                       v-model="scope.row.transplanttime"
+                      :class="{ 'field-error': isFieldError(scope.row, 'transplanttime') }"
                       type="datetime"
                       value-format="yyyy-MM-dd HH:mm:ss"
                       placeholder="閫夋嫨绉绘鏃堕棿"
+                      :disabled="isReadOnly"
                     />
                   </template>
                 </el-table-column>
@@ -422,13 +448,18 @@
                     <el-input
                       v-model="scope.row.transplantdoct"
                       placeholder="鍖诲笀濮撳悕"
+                      :disabled="isReadOnly"
                     />
                   </template>
                 </el-table-column>
 
                 <el-table-column label="鍙楄�呭鍚�" align="center" prop="name">
                   <template slot-scope="scope">
-                    <el-input v-model="scope.row.name" placeholder="鍙楄�呭鍚�" />
+                    <el-input
+                      v-model="scope.row.name"
+                      placeholder="鍙楄�呭鍚�"
+                      :disabled="isReadOnly"
+                    />
                   </template>
                 </el-table-column>
               </el-table>
@@ -469,6 +500,7 @@
         >
           <div style="margin-bottom: 10px; text-align: right;">
             <el-button
+              v-if="!isReadOnly"
               size="mini"
               type="primary"
               icon="el-icon-plus"
@@ -498,6 +530,7 @@
                 <el-select
                   v-model="scope.row.fileType"
                   size="small"
+                  :disabled="isReadOnly"
                   @change="updateAttachmentCategory(scope.row, $event)"
                   placeholder="閫夋嫨鍒嗙被"
                 >
@@ -526,7 +559,12 @@
                 <span>{{ formatFileSize(scope.row.fileSize) }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="鎿嶄綔" width="180" fixed="right">
+            <el-table-column
+              v-if="!isReadOnly"
+              label="鎿嶄綔"
+              width="180"
+              fixed="right"
+            >
               <template #default="scope">
                 <el-button
                   size="mini"
@@ -553,10 +591,16 @@
       </el-tabs>
     </el-card>
     <div style="text-align: center; margin: 30px 0;">
-      <el-button type="primary" @click="handleSave" :loading="saveLoading">
+      <el-button
+        v-if="!isReadOnly"
+        type="primary"
+        @click="handleSave"
+        :loading="saveLoading"
+      >
         淇濆瓨
       </el-button>
       <el-button
+        v-if="!isReadOnly"
         type="success"
         @click="handleComplete"
         :loading="confirmLoading"
@@ -621,6 +665,7 @@
   completionadd,
   completionedit
 } from "@/api/businessApi";
+import { getDonatebaseinfo } from "@/api/project/donatebaseinfo";
 import FilePreviewDialog from "@/components/FilePreviewDialog";
 import CaseBasicInfo from "@/components/CaseBasicInfo";
 import { getToken } from "@/utils/auth";
@@ -706,7 +751,8 @@
         { value: "1", label: "宸茬Щ妞�" },
         { value: "0", label: "鏈Щ妞�" },
         { value: "2", label: "绉绘涓�" },
-        { value: "3", label: "搴撳瓨" }
+        { value: "3", label: "搴撳瓨" },
+        { value: "4", label: "寮冪敤" }
       ],
       organExpansionMap: {
         C64: { subItems: ["C64L", "C64R"], subNames: ["宸﹁偩", "鍙宠偩"] },
@@ -724,6 +770,8 @@
       attachments: [],
       // 灞曞紑鐨勮keys
       expandedRows: [],
+      // 鏍¢獙澶辫触鏃堕珮浜殑瀛楁锛坥rganno -> 缂哄け瀛楁鍚嶆暟缁勶級
+      errorFields: {},
       // 缂栬緫瀵硅瘽妗�
       editDialogVisible: false,
       currentRecord: {},
@@ -795,6 +843,21 @@
     // 鑾峰彇鍣ㄥ畼瀛楀吀
     organDict() {
       return this.dict.type.sys_Organ || [];
+    },
+    // 鏌ョ湅妯″紡锛氬彧璇伙紝绂佺敤琛ㄥ崟骞堕殣钘忎繚瀛樻寜閽�
+    isReadOnly() {
+      return this.$route.query.mode === "view";
+    }
+  },
+  watch: {
+    // 鐢ㄦ埛淇敼鍒╃敤璁板綍鏃讹紝娓呴櫎瀛楁楂樹寒
+    "utilizationData.serviceDonatecomporganList": {
+      deep: true,
+      handler() {
+        if (Object.keys(this.errorFields).length > 0) {
+          this.errorFields = {};
+        }
+      }
     }
   },
   created() {
@@ -1154,7 +1217,7 @@
     getOrganRowClassName({ row }) {
       if (
         row.transplantstate == "1" &&
-        (!row.hospitalno || !row.name || !row.transplanttime)
+        (!row.hospitalname || !row.name || !row.transplanttime)
       ) {
         return "warning-row";
       }
@@ -1162,6 +1225,11 @@
         return "warning-row";
       }
       return "";
+    },
+    // 鏍¢獙澶辫触鏃跺瓧娈垫槸鍚﹂珮浜�
+    isFieldError(row, field) {
+      const fields = this.errorFields[row.organno];
+      return fields && fields.includes(field);
     },
 
     // 鑾峰彇鐘舵�佹爣绛剧被鍨�
@@ -1206,10 +1274,19 @@
 
     // 淇濆瓨鍩烘湰淇℃伅
     async handleSave() {
+      if (this.saveLoading) return;
       this.$refs.form.validate(async valid => {
         if (valid) {
           this.saveLoading = true;
           try {
+            // 鏂板鏃舵牎楠屾槸鍚﹀凡鏈夌浉鍚屾偅鑰�
+            if (!this.form.id) {
+              const exists = await this.checkPatientExists();
+              if (exists) {
+                this.$message.warning("璇ユ偅鑰呭凡瀛樺湪锛岃鍕块噸澶嶆坊鍔�");
+                return;
+              }
+            }
             const saveData = {
               ...this.form,
               assessannex: JSON.stringify(this.attachments),
@@ -1240,6 +1317,33 @@
           }
         }
       });
+    },
+    // 鏂板鏃舵牎楠屾槸鍚﹀凡鏈夌浉鍚屾偅鑰咃紙鎸変綇闄㈠彿锛�
+    async checkPatientExists() {
+      let inpatientno = this.form.inpatientno;
+      if (!inpatientno && this.caseId) {
+        try {
+          const caseRes = await getDonatebaseinfo(this.caseId);
+          inpatientno = (caseRes.data && caseRes.data.inpatientno) || "";
+        } catch (e) {
+          inpatientno = "";
+        }
+      }
+      if (!inpatientno) return false;
+      try {
+        const res = await completionList({
+          inpatientno,
+          pageNum: 1,
+          pageSize: 1
+        });
+        let list = res.data || [];
+        if (!Array.isArray(list)) {
+          list = list.rows || list.list || [];
+        }
+        return list.some(item => item && item.id != null && item.id !== "");
+      } catch (e) {
+        return false;
+      }
     },
 
     // 淇濆瓨鍒╃敤璁板綍
@@ -1281,20 +1385,57 @@
 
     // 纭瀹屾垚鍒╃敤
     async handleConfirmUtilization() {
-      // 妫�鏌ュ埄鐢ㄨ褰曟槸鍚﹀畬鏁�
-      const incompleteRecords = this.utilizationData.serviceDonatecomporganList.filter(
-        record => {
-          if (record.transplantstate == "1") {
-            return !record.hospitalno || !record.name || !record.transplanttime;
-          } else if (record.transplantstate == "0") {
-            return !record.abandonreason;
-          }
-          return false;
+      if (
+        !this.utilizationData.serviceDonatecomporganList ||
+        this.utilizationData.serviceDonatecomporganList.length == 0
+      ) {
+        this.$message.warning("璇峰厛娣诲姞鍒╃敤璁板綍");
+        return;
+      }
+
+      // 妫�鏌ュ埄鐢ㄨ褰曟槸鍚﹀畬鏁达紝璁板綍缂哄け瀛楁
+      const errorFields = {};
+      const incompleteRecords = [];
+      this.utilizationData.serviceDonatecomporganList.forEach(record => {
+        const missing = [];
+        if (record.transplantstate == "1") {
+          if (!record.hospitalname) missing.push("hospitalname");
+          if (!record.name) missing.push("name");
+          if (!record.transplanttime) missing.push("transplanttime");
+        } else if (record.transplantstate == "0") {
+          if (!record.abandonreason) missing.push("abandonreason");
         }
-      );
+        if (missing.length > 0) {
+          errorFields[record.organno] = missing;
+          incompleteRecords.push(record);
+        }
+      });
+      this.errorFields = errorFields;
 
       if (incompleteRecords.length > 0) {
-        this.$message.warning("璇峰厛瀹屽杽鎵�鏈夊埄鐢ㄨ褰曠殑淇℃伅");
+        // 浠呭綋缂哄皯銆屾湭绉绘鍘熷洜銆嶆椂璇ュ瓧娈典綅浜庢姌鍙犻潰鏉垮唴锛屾墠鑷姩灞曞紑瀵瑰簲闈㈡澘
+        this.expandedRows = incompleteRecords
+          .filter(record =>
+            (errorFields[record.organno] || []).includes("abandonreason")
+          )
+          .map(record => record.organno);
+
+        // 缂哄け瀛楁涓枃鍚嶏紝鐢ㄤ簬鎻愮ず鍏蜂綋鏄摢涓」娌″~
+        const fieldLabels = {
+          hospitalname: "绉绘鍖婚櫌",
+          name: "鍙楄�呭鍚�",
+          transplanttime: "绉绘鏃堕棿",
+          abandonreason: "鏈Щ妞嶅師鍥�"
+        };
+        const details = incompleteRecords
+          .map(record => {
+            const missingLabels = (errorFields[record.organno] || [])
+              .map(field => fieldLabels[field] || field)
+              .join("銆�");
+            return `${record.organname || record.organno} ${missingLabels}`;
+          })
+          .join("锛�");
+        this.$message.warning(`璇峰畬鍠勪互涓嬪櫒瀹樼殑鍒╃敤淇℃伅锛�${details}`);
         return;
       }
 
@@ -1760,6 +1901,13 @@
   background-color: #fdf6ec;
 }
 
+/* 鏍¢獙澶辫触瀛楁楂樹寒 */
+.field-error >>> .el-input__inner,
+.field-error >>> .el-textarea__inner {
+  border-color: #f56c6c !important;
+  box-shadow: 0 0 0 2px rgba(245, 108, 108, 0.15);
+}
+
 :deep(.el-table__row.default-row) {
   background-color: #f0f9ff;
 }
@@ -2073,8 +2221,6 @@
 .paper-form {
   border-left: 1px solid #d0d3db;
   background: #fff;
-  /* 瓒呭灞忛檺鍒惰〃鍗曟渶澶у搴︼紝鍙充晶鐣欑櫧锛岄伩鍏嶅瓧娈靛垎甯冭繃寮� */
-  max-width: 1400px;
 }
 
 .paper-form >>> .form-row {

--
Gitblit v1.9.3