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 |  112 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 89 insertions(+), 23 deletions(-)

diff --git a/src/views/business/allocation/allocationInfo.vue b/src/views/business/allocation/allocationInfo.vue
index 4be4f21..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;
+      }
     },
 
     // 纭瀹屾垚鍒嗛厤
@@ -1891,6 +1927,21 @@
   display: flex;
   width: 100%;
   border-top: 1px solid #d0d3db;
+  /* 涓婄Щ1px涓庝笂涓�琛岀殑border-bottom閲嶅彔锛屼袱琛屼箣闂村彧鏄剧ず涓�鏉�1px缁嗙嚎 */
+  margin-top: -1px;
+}
+.paper-form >>> .form-row:first-child {
+  margin-top: 0;
+}
+
+/* 琛屽熬绌虹櫧濉厖锛氫笉婊℃暣琛岀殑鍙充晶鑷姩琛ヤ竴涓┖鐧芥牸瀛愶紝缃戞牸淇濇寔闂悎锛堝彸渚ч�傚綋鐣欑櫧锛� */
+.paper-form >>> .form-row::after {
+  content: "";
+  flex: 1 1 0;
+  min-height: 42px;
+  background: linear-gradient(to left, #d0d3db 1px, transparent 1px),
+    linear-gradient(to top, #d0d3db 1px, transparent 1px);
+  background-color: #fff;
 }
 
 .paper-form >>> .el-form-item {
@@ -1912,8 +1963,8 @@
 .paper-form >>> .col-full { flex: 0 0 100%; }
 
 .paper-form >>> .el-form-item__label {
-  flex: 0 0 120px;
-  width: 120px !important;
+  flex: 0 0 150px;
+  width: 150px !important;
   float: none;
   padding: 0 8px !important;
   background: #ecf5ff;
@@ -1926,8 +1977,7 @@
   font-weight: 600;
   color: #2c3038;
   line-height: 1.3;
-  white-space: normal;
-  word-break: break-all;
+  white-space: nowrap;
 }
 .paper-form >>> .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before {
   color: #f56c6c;
@@ -1945,4 +1995,20 @@
   min-height: 42px;
   line-height: 1.4;
 }
+
+/* 鎺т欢瀹藉害閫備腑锛屼笉閾烘弧鏁存牸锛堝唴瀹圭煭鏃惰緭鍏ユ涓嶅啀鎷夊緱寰堥暱锛� */
+.paper-form >>> .el-form-item__content .el-input,
+.paper-form >>> .el-form-item__content .el-select,
+.paper-form >>> .el-form-item__content .el-cascader {
+  width: 220px;
+  max-width: 100%;
+}
+.paper-form >>> .el-form-item__content .el-date-editor {
+  width: 240px;
+  max-width: 100%;
+}
+.paper-form >>> .el-form-item__content .el-range-editor {
+  width: 360px;
+  max-width: 100%;
+}
 </style>

--
Gitblit v1.9.3