From dc082351978a1e9f75d7a1471a0ca7ebeac552a5 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期一, 01 六月 2026 11:07:50 +0800
Subject: [PATCH] opo维护

---
 src/views/business/allocation/allocationInfo.vue |  860 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 732 insertions(+), 128 deletions(-)

diff --git a/src/views/business/allocation/allocationInfo.vue b/src/views/business/allocation/allocationInfo.vue
index c2106f3..c78d505 100644
--- a/src/views/business/allocation/allocationInfo.vue
+++ b/src/views/business/allocation/allocationInfo.vue
@@ -52,7 +52,7 @@
 
         <el-row :gutter="20">
           <el-col :span="12">
-            <el-form-item label="鐧昏浜�" prop="registrationName">
+            <el-form-item label="璐熻矗浜�" prop="registrationName">
               <el-input v-model="form.registrationName" />
             </el-form-item>
           </el-col>
@@ -122,6 +122,7 @@
                 v-model="otherOrganInput"
                 placeholder="璇疯緭鍏ュ叾浠栧櫒瀹樺悕绉�"
                 style="margin-top: 10px; width: 300px;"
+                :disabled="form.allocationStatus == '1'"
               />
             </el-form-item>
           </el-col>
@@ -137,6 +138,33 @@
                 style="width: 100%"
                 :row-class-name="getOrganRowClassName"
               >
+                <el-table-column
+                  label="搴忓彿"
+                  type="index"
+                  width="60"
+                  align="center"
+                  fixed
+                ></el-table-column>
+
+                <el-table-column
+                  label="鍒嗛厤鐘舵��"
+                  align="center"
+                  width="100"
+                  prop="allocationstatus"
+                  fixed
+                >
+                  <template slot-scope="scope">
+                    <el-tag
+                      :type="
+                        getAllocationStatusTagType(scope.row.allocationstatus)
+                      "
+                      size="small"
+                    >
+                      {{ getAllocationStatusText(scope.row.allocationstatus) }}
+                    </el-tag>
+                  </template>
+                </el-table-column>
+
                 <el-table-column
                   label="鍣ㄥ畼鍚嶇О"
                   align="center"
@@ -162,13 +190,16 @@
                     <el-input
                       v-model="scope.row.caseno"
                       placeholder="鍒嗛厤绯荤粺缂栧彿"
-                      :disabled="form.allocationStatus == '1'"
+                      :disabled="
+                        form.allocationStatus == '1' ||
+                          scope.row.allocationstatus == '3'
+                      "
                     />
                   </template>
                 </el-table-column>
 
                 <el-table-column
-                  label="鍒嗛厤鎺ユ敹鏃堕棿"
+                  label="鍒嗛厤寮�濮嬫椂闂�"
                   align="center"
                   width="180"
                   prop="applicanttime"
@@ -181,8 +212,33 @@
                       v-model="scope.row.applicanttime"
                       type="datetime"
                       value-format="yyyy-MM-dd HH:mm:ss"
+                      placeholder="閫夋嫨寮�濮嬫帴鏀舵椂闂�"
+                      :disabled="
+                        form.allocationStatus == '1' ||
+                          scope.row.allocationstatus == '3'
+                      "
+                    />
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="鍒嗛厤鎺ユ敹鏃堕棿"
+                  align="center"
+                  width="180"
+                  prop="organgettime"
+                >
+                  <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'"
+                      :disabled="
+                        form.allocationStatus == '1' ||
+                          scope.row.allocationstatus == '3'
+                      "
                     />
                   </template>
                 </el-table-column>
@@ -197,7 +253,10 @@
                     <el-input
                       v-model="scope.row.name"
                       placeholder="鍙椾綋濮撴皬"
-                      :disabled="form.allocationStatus == '1'"
+                      :disabled="
+                        form.allocationStatus == '1' ||
+                          scope.row.allocationstatus == '3'
+                      "
                     />
                   </template>
                 </el-table-column>
@@ -216,11 +275,16 @@
                         :dataList="dataList"
                         v-model="scope.row.transplanthospitalno"
                         style="width: 100%"
+                        :disabled="
+                          form.allocationStatus == '1' ||
+                            scope.row.allocationstatus == '3'
+                        "
                       />
                     </div>
                   </template>
                 </el-table-column>
 
+                <!-- 淇敼template涓殑璇存槑鍒� -->
                 <el-table-column
                   label="璇存槑"
                   align="center"
@@ -228,13 +292,51 @@
                   min-width="200"
                 >
                   <template slot-scope="scope">
-                    <el-input
-                      type="textarea"
-                      clearable
-                      v-model="scope.row.reallocationreason"
-                      placeholder="璇疯緭鍏ヨ鏄�"
-                      :disabled="form.allocationStatus == '1'"
-                    />
+                    <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'
+                        "
+                      />
+                    </div>
+                    <div v-else>
+                      <!-- 閲嶅垎閰嶈褰曪細鏄剧ず璇︾粏鏌ョ湅鎸夐挳 -->
+                      <el-button
+                        v-if="scope.row.reallocationreason"
+                        type="text"
+                        size="small"
+                        @click="handleViewRedistributionDetail(scope.row)"
+                        style="color: #e6a23c;"
+                      >
+                        <i class="el-icon-document"></i>
+                        鏌ョ湅閲嶅垎閰嶈鎯�
+                      </el-button>
+                      <span v-else class="no-data">-</span>
+
+                      <!-- 淇濈暀鍘熸湁鐨勫伐鍏锋彁绀猴紙鍙Щ闄ゆ垨淇濈暀锛� -->
+                      <el-tooltip
+                        v-if="scope.row.redistributionInfo"
+                        :content="
+                          formatRedistributionTooltip(
+                            scope.row.redistributionInfo
+                          )
+                        "
+                        placement="top"
+                      >
+                        <el-button
+                          type="text"
+                          size="small"
+                          style="margin-left: 5px;"
+                        >
+                          <i class="el-icon-info"></i>
+                        </el-button>
+                      </el-tooltip>
+                    </div>
                   </template>
                 </el-table-column>
 
@@ -244,6 +346,7 @@
                   width="120"
                   class-name="small-padding fixed-width"
                   v-if="form.allocationStatus !== '1'"
+                  fixed="right"
                 >
                   <template slot-scope="scope">
                     <el-button
@@ -251,9 +354,16 @@
                       type="text"
                       icon="el-icon-copy-document"
                       @click="handleRedistribution(scope.row)"
-                      :disabled="!scope.row.caseno"
+                      :disabled="
+                        scope.row.allocationstatus == '3' || !scope.row.caseno
+                      "
+                      style="color: #e6a23c;"
                     >
-                      閲嶅垎閰�
+                      {{
+                        scope.row.allocationstatus == "3"
+                          ? "宸查噸鍒嗛厤"
+                          : "閲嶅垎閰�"
+                      }}
                     </el-button>
                   </template>
                 </el-table-column>
@@ -281,8 +391,8 @@
             </el-col>
             <el-col :span="6">
               <div class="stat-item">
-                <span class="stat-label">寰呭畬鍠勪俊鎭�:</span>
-                <span class="stat-value">{{ incompleteRecords }} 涓�</span>
+                <span class="stat-label">寰呭鏍�:</span>
+                <span class="stat-value">{{ pendingReviewCount }} 涓�</span>
               </div>
             </el-col>
             <el-col :span="6">
@@ -293,26 +403,8 @@
             </el-col>
             <el-col :span="6">
               <div class="stat-item">
-                <span class="stat-label">鍒嗛厤鐘舵��:</span>
-                <span class="stat-value">
-                  <el-tag
-                    :type="
-                      form.allocationStatus == '1'
-                        ? 'success'
-                        : form.allocationStatus == '2'
-                        ? 'danger'
-                        : 'warning'
-                    "
-                  >
-                    {{
-                      form.allocationStatus == "1"
-                        ? "宸插垎閰�"
-                        : form.allocationStatus == "2"
-                        ? "浣滃簾"
-                        : "鏈垎閰�"
-                    }}
-                  </el-tag>
-                </span>
+                <span class="stat-label">閲嶅垎閰�:</span>
+                <span class="stat-value">{{ redistributedCount }} 涓�</span>
               </div>
             </el-col>
           </el-row>
@@ -324,28 +416,6 @@
           </el-empty>
         </div>
       </el-form>
-
-      <!-- <div class="dialog-footer" v-if="form.allocationStatus !== '1'">
-        <el-button
-          type="primary"
-          @click="handleSaveAllocation"
-          :loading="saveLoading"
-          :disabled="
-            !allocationData.serviceDonateorganList ||
-              allocationData.serviceDonateorganList.length == 0
-          "
-        >
-          淇濆瓨鍒嗛厤璁板綍
-        </el-button>
-        <el-button
-          type="success"
-          @click="handleConfirmAllocation"
-          :loading="confirmLoading"
-          :disabled="incompleteRecords > 0"
-        >
-          纭瀹屾垚鍒嗛厤
-        </el-button>
-      </div> -->
     </el-card>
 
     <!-- 闄勪欢绠$悊閮ㄥ垎浼樺寲 -->
@@ -436,12 +506,18 @@
       title="鍣ㄥ畼閲嶅垎閰�"
       :visible.sync="redistributionDialogVisible"
       width="500px"
+      @close="handleRedistributionDialogClose"
     >
-      <el-form :model="redistributionForm" label-width="100px">
+      <el-form
+        :model="redistributionForm"
+        :rules="redistributionRules"
+        ref="redistributionFormRef"
+        label-width="100px"
+      >
         <el-form-item label="鍘熷櫒瀹樹俊鎭�">
           <el-input v-model="redistributionForm.organname" readonly />
         </el-form-item>
-        <el-form-item label="閲嶅垎閰嶅師鍥�" prop="reason">
+        <el-form-item label="閲嶅垎閰嶅師鍥�" prop="reason" required>
           <el-input
             type="textarea"
             :rows="4"
@@ -449,15 +525,170 @@
             placeholder="璇疯緭鍏ラ噸鍒嗛厤鍘熷洜"
           />
         </el-form-item>
+        <el-form-item label="閲嶅垎閰嶆椂闂�" prop="redistributionTime" required>
+          <el-date-picker
+            v-model="redistributionForm.redistributionTime"
+            type="datetime"
+            placeholder="璇烽�夋嫨閲嶅垎閰嶆椂闂�"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            style="width: 100%"
+          />
+        </el-form-item>
+        <el-form-item label="閲嶅垎閰嶉檮浠�">
+          <UploadAttachment
+            ref="redistributionAttachmentUpload"
+            :file-list="redistributionAttachmentList"
+            :limit="5"
+            :accept="attachmentAccept"
+            :multiple="true"
+            @change="handleRedistributionChange"
+            @upload-success="handleRedistributionUploadSuccess"
+            @upload-error="handleRedistributionUploadError"
+            @remove="handleRedistributionAttachmentRemove"
+          />
+          <div style="margin-top: 5px; font-size: 12px; color: #999;">
+            鏀寔涓婁紶閲嶅垎閰嶇浉鍏虫枃浠� (鏈�澶�5涓�)
+          </div>
+        </el-form-item>
       </el-form>
       <div slot="footer">
         <el-button @click="redistributionDialogVisible = false">鍙栨秷</el-button>
-        <el-button type="primary" @click="handleRedistributionConfirm"
-          >纭閲嶅垎閰�</el-button
+        <el-button
+          type="primary"
+          @click="handleRedistributionConfirm"
+          :loading="redistributionLoading"
+        >
+          纭閲嶅垎閰�
+        </el-button>
+      </div>
+    </el-dialog>
+    <!-- 鍦╰emplate涓坊鍔犻噸鍒嗛厤璇︽儏寮圭獥 -->
+    <el-dialog
+      title="閲嶅垎閰嶈鎯�"
+      :visible.sync="redistributionDetailDialogVisible"
+      width="600px"
+    >
+      <div v-loading="redistributionDetailLoading">
+        <div v-if="currentRedistributionDetail" style="padding: 20px;">
+          <!-- 鍩烘湰淇℃伅 -->
+          <el-descriptions title="閲嶅垎閰嶄俊鎭�" :column="2" border>
+            <el-descriptions-item label="鍣ㄥ畼鍚嶇О">
+              {{ currentRedistributionDetail.organname || "-" }}
+            </el-descriptions-item>
+            <el-descriptions-item label="鎿嶄綔浜�">
+              {{ currentRedistributionDetail.operator || "-" }}
+            </el-descriptions-item>
+            <el-descriptions-item label="鎿嶄綔鏃堕棿">
+              {{
+                currentRedistributionDetail.operatorTime
+                  ? formatDateTime(currentRedistributionDetail.operatorTime)
+                  : "-"
+              }}
+            </el-descriptions-item>
+            <el-descriptions-item label="閲嶅垎閰嶆椂闂�">
+              {{
+                currentRedistributionDetail.redistributionTime
+                  ? formatDateTime(
+                      currentRedistributionDetail.redistributionTime
+                    )
+                  : "-"
+              }}
+            </el-descriptions-item>
+          </el-descriptions>
+
+          <!-- 閲嶅垎閰嶅師鍥� -->
+          <div style="margin-top: 20px;">
+            <div class="section-title">閲嶅垎閰嶅師鍥�</div>
+            <div
+              class="section-content"
+              style="padding: 10px; background: #f5f7fa; border-radius: 4px;"
+            >
+              {{ currentRedistributionDetail.reason || "鏃�" }}
+            </div>
+          </div>
+
+          <!-- 閲嶅垎閰嶉檮浠� -->
+          <div
+            style="margin-top: 20px;"
+            v-if="
+              currentRedistributionDetail.attachments &&
+                currentRedistributionDetail.attachments.length > 0
+            "
+          >
+            <div class="section-title">
+              閲嶅垎閰嶉檮浠� ({{ currentRedistributionDetail.attachments.length }})
+            </div>
+            <div class="redistribution-attachments">
+              <el-table
+                :data="currentRedistributionDetail.attachments"
+                size="small"
+                style="width: 100%"
+              >
+                <el-table-column label="鏂囦欢鍚�" min-width="200">
+                  <template slot-scope="scope">
+                    <i
+                      class="el-icon-document"
+                      :style="{ color: getFileIconColor(scope.row.fileName) }"
+                    ></i>
+                    <span class="file-name">{{ scope.row.fileName }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="鏂囦欢绫诲瀷" width="100">
+                  <template slot-scope="scope">
+                    <el-tag
+                      :type="getFileTagType(scope.row.fileName)"
+                      size="small"
+                    >
+                      {{ getFileTypeText(scope.row.fileName) }}
+                    </el-tag>
+                  </template>
+                </el-table-column>
+                <el-table-column label="涓婁紶鏃堕棿" width="150">
+                  <template slot-scope="scope">
+                    <span>{{
+                      scope.row.uploadTime
+                        ? formatDateTime(scope.row.uploadTime)
+                        : "-"
+                    }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="鎿嶄綔" width="150" fixed="right">
+                  <template slot-scope="scope">
+                    <el-button
+                      size="mini"
+                      type="primary"
+                      @click="handleRedistributionAttachmentPreview(scope.row)"
+                      :disabled="!isPreviewable(scope.row.fileName)"
+                    >
+                      棰勮
+                    </el-button>
+                    <el-button
+                      size="mini"
+                      type="success"
+                      @click="handleRedistributionAttachmentDownload(scope.row)"
+                    >
+                      涓嬭浇
+                    </el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+          </div>
+
+          <div
+            v-else
+            style="margin-top: 20px; text-align: center; color: #909399;"
+          >
+            鏃犻噸鍒嗛厤闄勪欢
+          </div>
+        </div>
+      </div>
+      <div slot="footer">
+        <el-button @click="redistributionDetailDialogVisible = false"
+          >鍏抽棴</el-button
         >
       </div>
     </el-dialog>
-
     <!-- 闄勪欢棰勮瀵硅瘽妗� -->
     <FilePreviewDialog
       :visible="filePreviewVisible"
@@ -499,7 +730,10 @@
   data() {
     return {
       caseId: null,
-
+      // 閲嶅垎閰嶈鎯呯浉鍏�
+      redistributionDetailDialogVisible: false,
+      redistributionDetailLoading: false,
+      currentRedistributionDetail: null,
       // 琛ㄥ崟鏁版嵁
       form: {
         id: undefined,
@@ -538,9 +772,19 @@
       },
       // 鍒嗛厤璁板綍楠岃瘉瑙勫垯
       allocationRules: {},
+      // 閲嶅垎閰嶉獙璇佽鍒�
+      redistributionRules: {
+        reason: [
+          { required: true, message: "閲嶅垎閰嶅師鍥犱笉鑳戒负绌�", trigger: "blur" }
+        ],
+        redistributionTime: [
+          { required: true, message: "閲嶅垎閰嶆椂闂翠笉鑳戒负绌�", trigger: "blur" }
+        ]
+      },
       // 淇濆瓨鍔犺浇鐘舵��
       saveLoading: false,
       confirmLoading: false,
+      redistributionLoading: false,
       // 鍔犺浇鐘舵��
       loading: false,
       // 閫変腑鐨勫櫒瀹橈紙瀛樺偍瀛楀吀value锛�
@@ -564,8 +808,11 @@
       redistributionDialogVisible: false,
       redistributionForm: {
         organname: "",
-        reason: ""
+        reason: "",
+        redistributionTime: ""
       },
+      redistributionAttachmentList: [],
+      redistributionFormRef: null,
       currentRedistributeRecord: null,
       // 鏂囦欢棰勮鐩稿叧
       filePreviewVisible: false,
@@ -585,8 +832,23 @@
         record =>
           !record.caseno ||
           !record.applicanttime ||
+          !record.organgettime ||
           !record.name ||
           !record.transplanthospitalno
+      ).length;
+    },
+    // 寰呭鏍歌褰曟暟閲�
+    pendingReviewCount() {
+      if (!this.allocationData.serviceDonateorganList) return 0;
+      return this.allocationData.serviceDonateorganList.filter(
+        record => record.allocationstatus == "0"
+      ).length;
+    },
+    // 閲嶅垎閰嶈褰曟暟閲�
+    redistributedCount() {
+      if (!this.allocationData.serviceDonateorganList) return 0;
+      return this.allocationData.serviceDonateorganList.filter(
+        record => record.allocationstatus == "3"
       ).length;
     },
     // 鍞竴鍖婚櫌鏁伴噺
@@ -604,6 +866,15 @@
     // 鍒ゆ柇鏄惁闇�瑕佹樉绀哄叾浠栬緭鍏ユ
     showOtherInput() {
       return this.selectedOrgans.includes("C01"); // 鍋囪"鍏朵粬"鐨勫瓧鍏稿�兼槸C01
+    },
+    // 鍒嗛厤鐘舵�佸瓧鍏告槧灏�
+    allocationStatusDict() {
+      return {
+        "0": { label: "鎻愪氦鍒嗛厤", type: "info" },
+        "1": { label: "瀹℃牳閫氳繃", type: "success" },
+        "2": { label: "瀹℃牳鎷掔粷", type: "danger" },
+        "3": { label: "閲嶅垎閰�", type: "warning" }
+      };
     }
   },
   watch: {
@@ -639,6 +910,100 @@
     this.initData();
   },
   methods: {
+    // 鑾峰彇鍒嗛厤鐘舵�佹爣绛剧被鍨�
+    getAllocationStatusTagType(status) {
+      const statusMap = this.allocationStatusDict;
+      return statusMap[status] ? statusMap[status].type : "info";
+    },
+
+    // 鑾峰彇鍒嗛厤鐘舵�佹枃鏈�
+    getAllocationStatusText(status) {
+      const statusMap = this.allocationStatusDict;
+      return statusMap[status] ? statusMap[status].label : "鏈煡鐘舵��";
+    },
+
+    // 鏌ョ湅閲嶅垎閰嶈鎯�
+    handleViewRedistributionDetail(row) {
+      this.redistributionDetailLoading = true;
+      this.redistributionDetailDialogVisible = true;
+
+      try {
+        if (row.redistributionInfo) {
+          // 瑙f瀽閲嶅垎閰嶄俊鎭�
+          const redistributionInfo = JSON.parse(row.redistributionInfo);
+          this.currentRedistributionDetail = {
+            organname: row.organname || "-",
+            ...redistributionInfo
+          };
+        } else {
+          this.currentRedistributionDetail = {
+            organname: row.organname || "-",
+            reason: "鏃犻噸鍒嗛厤鍘熷洜",
+            attachments: []
+          };
+        }
+      } catch (error) {
+        console.error("瑙f瀽閲嶅垎閰嶄俊鎭け璐�:", error);
+        this.$message.error("閲嶅垎閰嶄俊鎭В鏋愬け璐�");
+        this.currentRedistributionDetail = {
+          organname: row.organname || "-",
+          reason: "閲嶅垎閰嶄俊鎭牸寮忛敊璇�",
+          attachments: []
+        };
+      } finally {
+        this.redistributionDetailLoading = false;
+      }
+    },
+
+    // 棰勮閲嶅垎閰嶉檮浠�
+    handleRedistributionAttachmentPreview(file) {
+      this.currentPreviewFile = {
+        fileName: file.fileName,
+        fileUrl: file.path || file.fileUrl,
+        fileType: this.getFileType(file.fileName)
+      };
+      this.filePreviewVisible = true;
+    },
+
+    // 涓嬭浇閲嶅垎閰嶉檮浠�
+    handleRedistributionAttachmentDownload(file) {
+      const fileUrl = file.path || file.fileUrl;
+      const fileName = file.fileName;
+
+      if (fileUrl) {
+        const link = document.createElement("a");
+        link.href = fileUrl;
+        link.download = fileName;
+        link.style.display = "none";
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+        this.$message.success("寮�濮嬩笅杞芥枃浠�");
+      } else {
+        this.$message.warning("鏂囦欢璺緞涓嶅瓨鍦紝鏃犳硶涓嬭浇");
+      }
+    },
+
+    // 澧炲己鏍煎紡鍖栧伐鍏锋彁绀烘柟娉�
+    formatRedistributionTooltip(redistributionInfo) {
+      if (!redistributionInfo) return "";
+      try {
+        const info = JSON.parse(redistributionInfo);
+        let tooltip = `閲嶅垎閰嶅師鍥�: ${info.reason}\n閲嶅垎閰嶆椂闂�: ${info.redistributionTime}`;
+
+        // 娣诲姞闄勪欢淇℃伅
+        if (info.attachments && info.attachments.length > 0) {
+          tooltip += `\n\n闄勪欢(${info.attachments.length}涓�):`;
+          info.attachments.forEach((att, index) => {
+            tooltip += `\n${index + 1}. ${att.fileName}`;
+          });
+        }
+
+        return tooltip;
+      } catch (error) {
+        return redistributionInfo;
+      }
+    },
     // 鏍规嵁瀛楀吀value鑾峰彇label
     getOrganLabel(organValue) {
       const dictItem = this.organDict.find(item => item.value == organValue);
@@ -671,6 +1036,7 @@
 
       this.getHospitalData();
     },
+
     // 鐢熸垚鎹愮尞鑰呯紪鍙�
     generateDonorNo() {
       const timestamp = Date.now().toString();
@@ -692,10 +1058,10 @@
         this.form.attachments = [];
       }
     },
+
     // 鑾峰彇璇︽儏
     async getDetail(infoid, id) {
       this.loading = true;
-      donateorganBaseinfoInfo(id);
       try {
         const response = await allocationList({ infoid });
         if (response.code == 200 && response.data && response.data.length > 0) {
@@ -719,7 +1085,30 @@
             this.allocationData.serviceDonateorganList = Array.isArray(
               data.serviceDonateorganList
             )
-              ? data.serviceDonateorganList
+              ? data.serviceDonateorganList.map(item => {
+                  // 纭繚姣忔潯璁板綍閮芥湁鍒嗛厤鐘舵�佸瓧娈碉紝榛樿鍊间负0
+                  const allocationstatus = item.allocationstatus || "0";
+                  let redistributionInfo = null;
+
+                  // 瑙f瀽閲嶅垎閰嶄俊鎭�
+                  if (allocationstatus == "3" && item.reallocationreason) {
+                    try {
+                      redistributionInfo = JSON.parse(item.reallocationreason);
+                      console.log(redistributionInfo);
+                    } catch (error) {
+                      console.warn("瑙f瀽閲嶅垎閰嶄俊鎭け璐�:", error);
+                      redistributionInfo = item.reallocationreason;
+                    }
+                  }
+
+                  return {
+                    ...item,
+                    allocationstatus,
+                    redistributionInfo: redistributionInfo
+                      ? JSON.stringify(redistributionInfo)
+                      : null
+                  };
+                })
               : [];
 
             // 鏇存柊閫変腑鐨勫櫒瀹�
@@ -767,6 +1156,7 @@
         this.loading = false;
       }
     },
+
     // 鑾峰彇鍖婚櫌鏁版嵁
     async getHospitalData() {
       try {
@@ -784,6 +1174,7 @@
         this.$message.error("鑾峰彇鍖婚櫌鏁版嵁澶辫触");
       }
     },
+
     // 鍣ㄥ畼閫夋嫨鐘舵�佸彉鍖�
     handleOrganSelectionChange(selectedValues) {
       if (!this.allocationData.serviceDonateorganList) {
@@ -884,10 +1275,13 @@
         organno: organValue,
         caseno: "",
         applicanttime: "",
+        organgettime: "",
         name: "",
         transplanthospitalno: "",
         transplantHospitalName: "",
         reallocationreason: "",
+        allocationstatus: "0", // 榛樿鎻愪氦鍒嗛厤鐘舵��
+        redistributionInfo: null,
         organState: 1
       });
     },
@@ -901,38 +1295,184 @@
         row.transplantHospitalName = hospital.hospitalName;
       }
     },
+
     // 閲嶅垎閰嶆搷浣�
     handleRedistribution(row) {
       this.currentRedistributeRecord = row;
       this.redistributionForm.organname = row.organname;
-      this.redistributionForm.reason = row.reallocationreason || "";
+      this.redistributionForm.reason = "";
+      this.redistributionForm.redistributionTime = new Date()
+        .toISOString()
+        .replace("T", " ")
+        .substring(0, 19);
+      this.redistributionAttachmentList = [];
       this.redistributionDialogVisible = true;
     },
-    // 纭閲嶅垎閰�
-    handleRedistributionConfirm() {
-      if (!this.redistributionForm.reason) {
-        this.$message.warning("璇疯緭鍏ラ噸鍒嗛厤鍘熷洜");
-        return;
-      }
 
-      if (this.currentRedistributeRecord) {
-        this.currentRedistributeRecord.reallocationreason = this.redistributionForm.reason;
-        this.$message.success("閲嶅垎閰嶅師鍥犲凡鏇存柊");
-        this.redistributionDialogVisible = false;
+    // 閲嶅垎閰嶅璇濇鍏抽棴
+    handleRedistributionDialogClose() {
+      this.redistributionForm = {
+        organname: "",
+        reason: "",
+        redistributionTime: ""
+      };
+      this.redistributionAttachmentList = [];
+      this.currentRedistributeRecord = null;
+    },
+
+    // 閲嶅垎閰嶉檮浠朵笂浼犳垚鍔�
+    handleRedistributionUploadSuccess({ file, fileList, response }) {
+      if (response.code == 200) {
+        const attachmentObj = {
+          fileName: file.name,
+          path: response.fileUrl || file.url,
+          fileUrl: response.fileUrl || file.url,
+          fileType: this.getFileExtension(file.name),
+          fileSize: file.size,
+          uploadTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
+        };
+        console.log(11);
+
+        this.redistributionAttachmentList = fileList;
+        this.$message.success("閲嶅垎閰嶉檮浠朵笂浼犳垚鍔�");
       }
     },
+
+    // 閲嶅垎閰嶉檮浠朵笂浼犻敊璇�
+    handleRedistributionUploadError({ file, fileList, error }) {
+      console.error("閲嶅垎閰嶉檮浠朵笂浼犲け璐�:", error);
+      this.$message.error("閲嶅垎閰嶉檮浠朵笂浼犲け璐ワ紝璇烽噸璇�");
+    },
+
+    // 閲嶅垎閰嶉檮浠剁Щ闄�
+    handleRedistributionAttachmentRemove(file) {
+      if (file.url) {
+        const index = this.redistributionAttachmentList.findIndex(
+          item => item.path == file.url || item.fileUrl == file.url
+        );
+        if (index > -1) {
+          this.redistributionAttachmentList.splice(index, 1);
+        }
+      }
+    },
+
+    // 纭閲嶅垎閰�
+    async handleRedistributionConfirm() {
+      this.$refs.redistributionFormRef.validate(async valid => {
+        if (!valid) {
+          this.$message.warning("璇峰畬鍠勯噸鍒嗛厤淇℃伅");
+          return;
+        }
+        console.log(1, this.redistributionAttachmentList);
+
+        this.redistributionLoading = true;
+
+        try {
+          // 鏋勫缓閲嶅垎閰嶄俊鎭璞�
+          const redistributionInfo = {
+            reason: this.redistributionForm.reason,
+            redistributionTime: this.redistributionForm.redistributionTime,
+            attachments: this.redistributionAttachmentList.map(att => ({
+              // fileName: att.fileName,
+              // path: att.path || att.fileUrl,
+              // fileUrl: att.path || att.fileUrl,
+              // fileType: this.getFileExtension(att.name),
+              // fileSize: att.fileSize,
+              // uploadTime: att.uploadTime
+              fileName: att.name,
+              path: att.url,
+              fileUrl: att.url,
+              fileType: this.getFileExtension(att.name),
+              fileSize: att.size,
+              uploadTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
+            })),
+
+            operator: this.currentUser.username || this.currentUser.nickName,
+            operatorTime: new Date()
+              .toISOString()
+              .replace("T", " ")
+              .substring(0, 19)
+          };
+          console.log(2, this.redistributionAttachmentList);
+
+          // 鎵惧埌褰撳墠璁板綍鐨勭储寮�
+          const currentIndex = this.allocationData.serviceDonateorganList.findIndex(
+            item => item == this.currentRedistributeRecord
+          );
+
+          if (currentIndex !== -1) {
+            // 1. 鏇存柊鍘熻褰曠殑鐘舵�佷负3锛堥噸鍒嗛厤锛夊苟淇濆瓨閲嶅垎閰嶄俊鎭�
+            const originalRecord = { ...this.currentRedistributeRecord };
+            originalRecord.allocationstatus = "3";
+            originalRecord.reallocationreason = JSON.stringify(
+              redistributionInfo
+            );
+            originalRecord.redistributionInfo = JSON.stringify(
+              redistributionInfo
+            );
+
+            // 2. 鍒涘缓鏂扮殑璁板綍
+            const newRecord = {
+              ...this.currentRedistributeRecord,
+              id: null, // 鏂拌褰旾D涓虹┖
+              allocationstatus: "0", // 鏂拌褰曠姸鎬佷负鎻愪氦鍒嗛厤
+              reallocationreason: "", // 娓呯┖閲嶅垎閰嶅師鍥�
+              redistributionInfo: null,
+              // 閲嶇疆鐩稿叧瀛楁锛屼絾淇濈暀鍣ㄥ畼淇℃伅
+              caseno: "",
+              applicanttime: "",
+              organgettime: "",
+              name: "",
+              transplanthospitalno: "",
+              transplantHospitalName: ""
+            };
+
+            // 3. 鍦ㄦ暟缁勪腑鎻掑叆鏂拌褰曪紙鍦ㄦ棫璁板綍涔嬪悗锛�
+            this.allocationData.serviceDonateorganList.splice(
+              currentIndex + 1,
+              0,
+              newRecord
+            );
+            // 4. 鏇存柊鍘熻褰�
+            this.allocationData.serviceDonateorganList[
+              currentIndex
+            ] = originalRecord;
+
+            // 5. 鏇存柊閫変腑鐨勫櫒瀹樺垪琛�
+            this.selectedOrgans.push(this.currentRedistributeRecord.organno);
+
+            this.$message.success("閲嶅垎閰嶆搷浣滄垚鍔熷畬鎴�");
+            this.redistributionDialogVisible = false;
+          } else {
+            this.$message.error("鏈壘鍒板搴旂殑璁板綍");
+          }
+        } catch (error) {
+          console.error("閲嶅垎閰嶆搷浣滃け璐�:", error);
+          this.$message.error("閲嶅垎閰嶆搷浣滃け璐�");
+        } finally {
+          this.redistributionLoading = false;
+        }
+      });
+    },
+
     // 鍣ㄥ畼琛屾牱寮�
     getOrganRowClassName({ row }) {
-      if (
+      if (row.allocationstatus == "3") {
+        return "redistributed-row"; // 閲嶅垎閰嶈褰曟牱寮�
+      } else if (
         !row.caseno ||
         !row.applicanttime ||
+        !row.organgettime ||
         !row.name ||
         !row.transplanthospitalno
       ) {
-        return "warning-row";
+        return "warning-row"; // 淇℃伅涓嶅畬鏁存牱寮�
+      } else if (row.allocationstatus == "0") {
+        return "pending-row"; // 寰呭鏍告牱寮�
       }
       return "";
     },
+
     // 鏋勫缓 filePatch 瀛楁
     buildFilePatch() {
       if (!this.attachments || this.attachments.length == 0) {
@@ -940,6 +1480,7 @@
       }
       return JSON.stringify(this.attachments);
     },
+
     // 淇濆瓨鍩烘湰淇℃伅
     async handleSave() {
       this.$refs.form.validate(async valid => {
@@ -955,17 +1496,26 @@
             serviceDonateorganList:
               this.allocationData.serviceDonateorganList || []
           };
-          if (
-            submitData.allocationStatus == 1 ||
-            !submitData.allocationStatus
-          ) {
-            submitData.allocationStatus = 2;
-          }
-          saveData.fileName = this.buildFilePatch();
+
+          // 纭繚姣忔潯璁板綍閮芥湁鍒嗛厤鐘舵��
           saveData.serviceDonateorganList.forEach(item => {
             item.baseid = this.form.id;
             item.infoid = this.form.infoid;
+            // 纭繚鏈夊垎閰嶇姸鎬佸瓧娈�
+            if (!item.allocationstatus) {
+              item.allocationstatus = "0";
+            }
+            // 濡傛灉鏄噸鍒嗛厤璁板綍锛岀‘淇濇湁閲嶅垎閰嶄俊鎭�
+            if (item.allocationstatus == "3" && !item.reallocationreason) {
+              item.reallocationreason = item.redistributionInfo || "";
+            }
           });
+
+          if (saveData.allocationStatus == 1 || !saveData.allocationStatus) {
+            saveData.allocationStatus = 2;
+          }
+          saveData.fileName = this.buildFilePatch();
+
           const apiMethod = this.form.id ? allocationedit : allocationadd;
           const response = await apiMethod(saveData);
 
@@ -973,9 +1523,6 @@
             this.$message.success("淇濆瓨鎴愬姛");
             if (!this.form.id && response.data) {
               this.form.id = response.data;
-              // this.$router.replace({
-              //   query: { ...this.$route.query, id: this.form.id }
-              // });
             }
           } else {
             this.$message.error("淇濆瓨澶辫触锛�" + (response.msg || "鏈煡閿欒"));
@@ -988,38 +1535,7 @@
         }
       });
     },
-    // 淇濆瓨鍒嗛厤璁板綍
-    async handleSaveAllocation() {
-      if (!this.form.id) {
-        this.$message.warning("璇峰厛淇濆瓨鍩烘湰淇℃伅");
-        return;
-      }
 
-      this.saveLoading = true;
-      try {
-        const saveData = {
-          ...this.form,
-          attachments: this.attachments,
-          serviceDonateorganList:
-            this.allocationData.serviceDonateorganList || []
-        };
-
-        const response = await allocationedit(saveData);
-
-        if (response.code == 200) {
-          this.$message.success("鍒嗛厤璁板綍淇濆瓨鎴愬姛");
-        } else {
-          this.$message.error(
-            "淇濆瓨鍒嗛厤璁板綍澶辫触锛�" + (response.msg || "鏈煡閿欒")
-          );
-        }
-      } catch (error) {
-        console.error("淇濆瓨鍒嗛厤璁板綍澶辫触:", error);
-        this.$message.error("淇濆瓨鍒嗛厤璁板綍澶辫触");
-      } finally {
-        this.saveLoading = false;
-      }
-    },
     // 纭瀹屾垚鍒嗛厤
     async handleConfirmAllocation() {
       if (this.incompleteRecords > 0) {
@@ -1075,6 +1591,9 @@
     /** 闄勪欢鍙樺寲澶勭悊 */
     handleAttachmentChange(fileList) {
       this.attachmentFileList = fileList;
+    },
+    handleRedistributionChange(fileList) {
+      this.redistributionAttachmentList = fileList;
     },
 
     /** 闄勪欢绉婚櫎澶勭悊 */
@@ -1132,9 +1651,9 @@
         fileUrl: file.path || file.fileUrl,
         fileType: this.getFileType(file.fileName)
       };
-      // this.filePreviewTitle = file.fileName;
       this.filePreviewVisible = true;
     },
+
     handleDownloadAttachment(file) {
       const fileUrl = file.path || file.fileUrl;
       const fileName = file.fileName;
@@ -1213,6 +1732,8 @@
 
     /** 鑾峰彇鏂囦欢鎵╁睍鍚� */
     getFileExtension(filename) {
+      console.log(filename, "filename");
+
       return filename
         .split(".")
         .pop()
@@ -1342,7 +1863,46 @@
   font-size: 20px;
   font-weight: bold;
 }
+/* 鍦╯tyle閮ㄥ垎娣诲姞 */
+.section-title {
+  font-weight: 600;
+  color: #303133;
+  margin-bottom: 8px;
+  font-size: 14px;
+}
 
+.section-content {
+  background: #f5f7fa;
+  padding: 12px;
+  border-radius: 4px;
+  border-left: 3px solid #e6a23c;
+  line-height: 1.6;
+}
+
+.redistribution-attachments {
+  margin-top: 10px;
+  border: 1px solid #ebeef5;
+  border-radius: 4px;
+  overflow: hidden;
+}
+
+/* 閲嶅垎閰嶈鎯呰〃鏍兼牱寮� */
+:deep(.redistribution-attachments .el-table) {
+  border: none;
+}
+
+:deep(.redistribution-attachments .el-table th) {
+  background-color: #f5f7fa;
+  color: #606266;
+  font-weight: 600;
+}
+
+/* 鍝嶅簲寮忚皟鏁� */
+@media (max-width: 768px) {
+  .redistribution-attachments {
+    overflow-x: auto;
+  }
+}
 /* 绌虹姸鎬佹牱寮� */
 .empty-allocation {
   text-align: center;
@@ -1350,15 +1910,23 @@
   color: #909399;
 }
 
-/* 瀵硅瘽妗嗗簳閮ㄦ寜閽� */
-.dialog-footer {
-  margin-top: 20px;
-  text-align: center;
-  padding-top: 20px;
-  border-top: 1px solid #e4e7ed;
+/* 鏃犳暟鎹牱寮� */
+.no-data {
+  color: #909399;
+  font-style: italic;
 }
 
 /* 琛ㄦ牸琛屾牱寮� */
+:deep(.redistributed-row) {
+  background-color: #fdf6ec;
+  opacity: 0.8;
+}
+
+:deep(.redistributed-row:hover) {
+  background-color: #faecd8;
+  opacity: 0.9;
+}
+
 :deep(.warning-row) {
   background-color: #fff7e6;
 }
@@ -1367,6 +1935,42 @@
   background-color: #ffecc2;
 }
 
+:deep(.pending-row) {
+  background-color: #f0f9ff;
+}
+
+:deep(.pending-row:hover) {
+  background-color: #e0f2ff;
+}
+
+/* 绂佺敤鐘舵�佺殑杈撳叆妗嗘牱寮� */
+:deep(.el-input.is-disabled .el-input__inner) {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #c0c4cc;
+  cursor: not-allowed;
+}
+
+:deep(.el-textarea.is-disabled .el-textarea__inner) {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #c0c4cc;
+  cursor: not-allowed;
+}
+
+/* 閲嶅垎閰嶆寜閽牱寮� */
+:deep(.el-button--text.is-disabled) {
+  color: #c0c4cc !important;
+  cursor: not-allowed;
+}
+
+/* 閲嶅垎閰嶄俊鎭彁绀烘鏍峰紡 */
+:deep(.el-tooltip__popper) {
+  max-width: 300px;
+  white-space: pre-line;
+  line-height: 1.6;
+}
+
 /* 鍝嶅簲寮忚璁� */
 @media (max-width: 768px) {
   .organ-allocation-detail {

--
Gitblit v1.9.3