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/allocation/allocationInfo.vue |   76 +++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 21 deletions(-)

diff --git a/src/views/business/allocation/allocationInfo.vue b/src/views/business/allocation/allocationInfo.vue
index d714426..6f0d7b5 100644
--- a/src/views/business/allocation/allocationInfo.vue
+++ b/src/views/business/allocation/allocationInfo.vue
@@ -10,20 +10,20 @@
       <el-form :model="form" ref="form" :rules="rules" label-width="120px" class="paper-form">
         <div class="form-row">
           <el-form-item label="鍒嗛厤鐘舵��" prop="allocationStatus" class="col-half">
-            <el-select v-model="form.allocationStatus" placeholder="璇烽�夋嫨鍒嗛厤鐘舵��">
+            <el-select v-model="form.allocationStatus" placeholder="璇烽�夋嫨鍒嗛厤鐘舵��" :disabled="isReadOnly">
               <el-option v-for="dict in dict.type.organ_allocation_status || []" :key="dict.value" :label="dict.label"
                 :value="dict.value"></el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="鍒嗛厤鏃堕棿" prop="allocationTime" class="col-half">
             <el-date-picker v-model="form.allocationTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
-              style="width: 100%" :disabled="form.allocationStatus == '1'" />
+              style="width: 100%" :disabled="form.allocationStatus == '1' || isReadOnly" />
           </el-form-item>
         </div>
 
         <div class="form-row">
           <el-form-item label="璐熻矗浜�" prop="registrationName" class="col-half">
-              <el-input v-model="form.registrationName" />
+              <el-input v-model="form.registrationName" :disabled="isReadOnly" />
           </el-form-item>
         </div>
       </el-form>
@@ -43,12 +43,12 @@
           <el-form-item label-width="100px" label="鍒嗛厤鍣ㄥ畼" class="col-full">
               <el-checkbox-group v-model="selectedOrgans" @change="handleOrganSelectionChange">
                 <el-checkbox v-for="dict in dict.type.sys_Organ || []" :key="dict.value" :label="dict.value"
-                  :disabled="form.allocationStatus == '1'">
+                  :disabled="form.allocationStatus == '1' || isReadOnly">
                   {{ dict.label }}
                 </el-checkbox>
               </el-checkbox-group>
               <el-input v-if="showOtherInput" v-model="otherOrganInput" placeholder="璇疯緭鍏ュ叾浠栧櫒瀹樺悕绉�"
-                style="margin-top: 10px; width: 300px;" :disabled="form.allocationStatus == '1'" />
+                style="margin-top: 10px; width: 300px;" :disabled="form.allocationStatus == '1' || isReadOnly" />
           </el-form-item>
         </div>
 
@@ -95,7 +95,7 @@
                   <template slot-scope="scope">
                     <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.applicanttime"
                       type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="閫夋嫨寮�濮嬫帴鏀舵椂闂�" :disabled="form.allocationStatus == '1' ||
-                        scope.row.allocationstatus == '3'
+                        scope.row.allocationstatus == '3' || isReadOnly
                         " />
                   </template>
                 </el-table-column>
@@ -103,7 +103,7 @@
                   <template slot-scope="scope">
                     <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.organgettime"
                       type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="閫夋嫨鍒嗛厤鎺ユ敹鏃堕棿" :disabled="form.allocationStatus == '1' ||
-                        scope.row.allocationstatus == '3'
+                        scope.row.allocationstatus == '3' || isReadOnly
                         " />
                   </template>
                 </el-table-column>
@@ -111,7 +111,7 @@
                 <el-table-column label="鍙椾綋濮撴皬" align="center" width="120" prop="name">
                   <template slot-scope="scope">
                     <el-input v-model="scope.row.name" placeholder="鍙椾綋濮撴皬" :disabled="form.allocationStatus == '1' ||
-                      scope.row.allocationstatus == '3'
+                      scope.row.allocationstatus == '3' || isReadOnly
                       " />
                   </template>
                 </el-table-column>
@@ -119,7 +119,7 @@
                 <el-table-column label="绉绘鍖婚櫌" align="center" width="200" prop="transplanthospitalname">
                   <template slot-scope="scope">
                     <el-autocomplete v-model="scope.row.transplanthospitalname" :fetch-suggestions="queryHospitalSearch"
-                      placeholder="璇烽�夋嫨鎴栬緭鍏ョЩ妞嶅尰闄�" style="width: 100%" clearable></el-autocomplete>
+                      placeholder="璇烽�夋嫨鎴栬緭鍏ョЩ妞嶅尰闄�" style="width: 100%" :disabled="isReadOnly" clearable></el-autocomplete>
                   </template>
                   <!-- <template slot-scope="scope">
                     <el-select
@@ -143,7 +143,7 @@
                     <div v-if="scope.row.allocationstatus != '3'">
                       <el-input type="textarea" clearable v-model="scope.row.reallocationreason" placeholder="璇疯緭鍏ヨ鏄�"
                         :disabled="form.allocationStatus == '1' ||
-                          scope.row.allocationstatus == '3'
+                          scope.row.allocationstatus == '3' || isReadOnly
                           " />
                     </div>
                     <div v-else>
@@ -169,7 +169,7 @@
                 </el-table-column>
 
                 <el-table-column label="鎿嶄綔" align="center" width="120" class-name="small-padding fixed-width"
-                  v-if="form.allocationStatus !== '1'" fixed="right">
+                  v-if="!isReadOnly && form.allocationStatus !== '1'" fixed="right">
                   <template slot-scope="scope">
                     <el-button size="mini" type="text" icon="el-icon-copy-document"
                       @click="handleRedistribution(scope.row)" :disabled="scope.row.allocationstatus == '3'"
@@ -252,7 +252,7 @@
       </div>
 
       <!-- 浣跨敤 UploadAttachment 缁勪欢 -->
-      <UploadAttachment ref="uploadAttachment" :file-list="attachmentFileList" :limit="attachmentLimit"
+      <UploadAttachment v-if="!isReadOnly" ref="uploadAttachment" :file-list="attachmentFileList" :limit="attachmentLimit"
         :accept="attachmentAccept" :multiple="true" @change="handleAttachmentChange"
         @upload-success="handleUploadSuccess" @upload-error="handleUploadError" @remove="handleAttachmentRemove" />
 
@@ -292,7 +292,7 @@
               <el-button size="mini" type="success" @click="handleDownloadAttachment(scope.row)">
                 涓嬭浇
               </el-button>
-              <el-button size="mini" type="danger" @click="handleRemoveAttachment(scope.$index)">
+              <el-button v-if="!isReadOnly" size="mini" type="danger" @click="handleRemoveAttachment(scope.$index)">
                 鍒犻櫎
               </el-button>
             </template>
@@ -300,7 +300,7 @@
         </el-table>
       </div>
     </el-card>
-    <div style="text-align: center; margin: 30px 0;">
+    <div v-if="!isReadOnly" style="text-align: center; margin: 30px 0;">
       <el-button type="primary" @click="handleSave" :loading="saveLoading">
         淇濆瓨
       </el-button>
@@ -447,6 +447,7 @@
   allocationedit,
   donateorganBaseinfoInfo
 } from "@/api/businessApi";
+import { getDonatebaseinfo } from "@/api/project/donatebaseinfo";
 import UploadAttachment from "@/components/UploadAttachment";
 import FilePreviewDialog from "@/components/FilePreviewDialog";
 import OrgSelecter from "@/views/project/components/orgselect";
@@ -564,6 +565,10 @@
     };
   },
   computed: {
+    // 鏌ョ湅妯″紡锛氬彧璇伙紝绂佺敤琛ㄥ崟骞堕殣钘忎繚瀛樻寜閽�
+    isReadOnly() {
+      return this.$route.query.mode === "view";
+    },
     // 褰撳墠鐢ㄦ埛淇℃伅
     currentUser() {
       return JSON.parse(sessionStorage.getItem("user") || "{}");
@@ -572,15 +577,16 @@
     return (this.allocationData.serviceDonateorganList || [])
       .filter(item => item.delFlag !== 1);
   },
-    // 涓嶅畬鏁寸殑璁板綍鏁伴噺
+    // 涓嶅畬鏁寸殑璁板綍鏁伴噺锛堥噸鍒嗛厤璁板綍涓嶅弬涓庢牎楠岋級
     incompleteRecords() {
       if (!this.allocationData.serviceDonateorganList) return 0;
       return this.allocationData.serviceDonateorganList.filter(
         record =>
-          !record.applicanttime ||
-          !record.organgettime ||
-          !record.name ||
-          !record.transplanthospitalname
+          record.allocationstatus != "3" &&
+          (!record.applicanttime ||
+            !record.organgettime ||
+            !record.name ||
+            !record.transplanthospitalname)
       ).length;
     },
     // 寰呭鏍歌褰曟暟閲�
@@ -1293,6 +1299,7 @@
 
     // 淇濆瓨鍩烘湰淇℃伅
     async handleSave() {
+      if (this.saveLoading) return;
       this.$refs.form.validate(async valid => {
         if (!valid) {
           this.$message.warning("璇峰畬鍠勮〃鍗曚俊鎭�");
@@ -1301,6 +1308,14 @@
 
         this.saveLoading = true;
         try {
+          // 鏂板鏃舵牎楠屾槸鍚﹀凡鏈夌浉鍚屾偅鑰�
+          if (!this.form.id) {
+            const exists = await this.checkPatientExists();
+            if (exists) {
+              this.$message.warning("璇ユ偅鑰呭凡瀛樺湪锛岃鍕块噸澶嶆坊鍔�");
+              return;
+            }
+          }
           const saveData = {
             ...this.form,
             serviceDonateorganList:
@@ -1344,6 +1359,27 @@
           this.saveLoading = false;
         }
       });
+    },
+
+    // 鏂板鏃舵牎楠屾槸鍚﹀凡鏈夌浉鍚屾偅鑰咃紙鎸変綇闄㈠彿锛�
+    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 allocationList({ inpatientno, pageNum: 1, pageSize: 1 });
+        const list = res.data || [];
+        return list.some(item => item && item.id != null && item.id !== "");
+      } catch (e) {
+        return false;
+      }
     },
 
     // 纭瀹屾垚鍒嗛厤
@@ -1885,8 +1921,6 @@
 .paper-form {
   border-left: 1px solid #d0d3db;
   background: #fff;
-  /* 瓒呭灞忛檺鍒惰〃鍗曟渶澶у搴︼紝鍙充晶鐣欑櫧锛岄伩鍏嶅瓧娈靛垎甯冭繃寮� */
-  max-width: 1400px;
 }
 
 .paper-form >>> .form-row {

--
Gitblit v1.9.3