From 475a352a4bfd7ac3a81e8c7c92d3bb64e2e01037 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期五, 27 二月 2026 15:48:37 +0800
Subject: [PATCH] 青岛维护提交

---
 src/views/business/affirm/affirmInfo.vue |  888 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 521 insertions(+), 367 deletions(-)

diff --git a/src/views/business/affirm/affirmInfo.vue b/src/views/business/affirm/affirmInfo.vue
index fa7b7be..ce4013d 100644
--- a/src/views/business/affirm/affirmInfo.vue
+++ b/src/views/business/affirm/affirmInfo.vue
@@ -5,10 +5,10 @@
       <div slot="header" class="clearfix">
         <span class="detail-title">鎹愮尞纭鍩烘湰淇℃伅</span>
         <el-button
-          v-if="$route.query.confirm"
-          type="primary"
-          style="float: right; padding: 3px 0"
+          type="success"
+          style="float: right;"
           @click="handleSave"
+          :loading="saveLoading"
         >
           淇濆瓨纭淇℃伅
         </el-button>
@@ -17,24 +17,20 @@
       <el-form :model="form" ref="form" label-width="120px">
         <el-row :gutter="20">
           <el-col :span="8">
-            <el-form-item label="妗堜緥缂栧彿" prop="caseNo">
-              <el-input v-model="form.caseNo" :readonly="!isEdit" />
+            <el-form-item label="浣忛櫌鍙�" prop="caseNo">
+              <el-input v-model="form.caseNo" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="鎹愮尞鑰呭鍚�" prop="donorName">
-              <el-input v-model="form.donorName" :readonly="!isEdit" />
+            <el-form-item label="鎹愮尞鑰呭鍚�" prop="name">
+              <el-input v-model="form.name" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="鎬у埆" prop="gender">
-              <el-select
-                v-model="form.gender"
-                :disabled="!isEdit"
-                style="width: 100%"
-              >
-                <el-option label="鐢�" value="0" />
-                <el-option label="濂�" value="1" />
+            <el-form-item label="鎬у埆" prop="sex">
+              <el-select v-model="form.sex" style="width: 100%">
+                <el-option label="鐢�" value="1" />
+                <el-option label="濂�" value="2" />
               </el-select>
             </el-form-item>
           </el-col>
@@ -43,91 +39,158 @@
         <el-row :gutter="20">
           <el-col :span="8">
             <el-form-item label="骞撮緞" prop="age">
-              <el-input v-model="form.age" :readonly="!isEdit" />
+              <el-input v-model="form.age" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="鐤剧梾璇婃柇" prop="diagnosis">
-              <el-input v-model="form.diagnosis" :readonly="!isEdit" />
+            <el-form-item label="鐤剧梾璇婃柇" prop="diagnosisname">
+              <el-input v-model="form.diagnosisname" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="鎵�鍦ㄥ尰鐤楁満鏋�" prop="hospitalName">
-              <el-input v-model="form.hospitalName" :readonly="!isEdit" />
+            <el-form-item label="鎵�鍦ㄥ尰鐤楁満鏋�" prop="treatmenthospitalname">
+              <el-input v-model="form.treatmenthospitalname" />
             </el-form-item>
           </el-col>
         </el-row>
 
         <el-row :gutter="20">
           <el-col :span="8">
-            <el-form-item label="鍗忚皟鍛�1" prop="coordinator1">
-              <el-input v-model="form.coordinator1" :readonly="!isEdit" />
+            <el-form-item label="鍗忚皟鍛�1" prop="coordinatedusernameo">
+              <el-input v-model="form.coordinatedusernameo" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="鍗忚皟鍛�2" prop="coordinator2">
-              <el-input v-model="form.coordinator2" :readonly="!isEdit" />
+            <el-form-item label="鍗忚皟鍛�2" prop="coordinatedusernamet">
+              <el-input v-model="form.coordinatedusernamet" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="涓氬姟浜哄憳" prop="assignee">
-              <el-input v-model="form.assignee" :readonly="!isEdit" />
+            <el-form-item label="涓氬姟浜哄憳" prop="responsibleusername">
+              <el-input v-model="form.responsibleusername" />
             </el-form-item>
           </el-col>
         </el-row>
 
         <el-row :gutter="20">
-          <el-col :span="8">
-            <el-form-item label="纭鐘舵��" prop="confirmationStatus">
+          <!-- <el-col :span="8">
+            <el-form-item label="纭鐘舵��" prop="relativeconfirmationsign">
               <el-select
-                v-model="form.confirmationStatus"
-                :disabled="!isEdit"
+                v-model="form.relativeconfirmationsign"
                 style="width: 100%"
+
               >
                 <el-option label="鏈‘璁�" value="0" />
                 <el-option label="瀹跺睘纭" value="1" />
                 <el-option label="涓嶅悓鎰忔崘鐚�" value="2" />
               </el-select>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="8">
-            <el-form-item label="纭鏃堕棿" prop="confirmationTime">
+            <el-form-item label="绛惧瓧鏃堕棿" prop="signdate">
               <el-date-picker
-                v-model="form.confirmationTime"
+                v-model="form.signdate"
                 type="datetime"
-                value-format="yyyy-MM-dd HH:mm:ss"
+                value-format="yyyy-MM-dd"
                 style="width: 100%"
-                :disabled="!isEdit"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- <el-col :span="8">
+            <el-form-item label="琛�鍨�" prop="bloodtype">
+              <el-input v-model="form.bloodtype"  />
+            </el-form-item>
+          </el-col> -->
+        </el-row>
+
+        <!-- <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="璇佷欢鍙风爜" prop="idcardno">
+              <el-input v-model="form.idcardno"  />
+            </el-form-item>
+          </el-col>
+        </el-row> -->
+
+        <!-- 浜插睘淇℃伅 -->
+        <!-- 浜插睘淇℃伅 -->
+        <el-divider content-position="left">浜插睘纭淇℃伅</el-divider>
+
+        <el-row :gutter="20">
+          <el-col :span="6">
+            <el-form-item label="浜插睘濮撳悕" prop="relativeconfirmationsignname">
+              <el-input
+                v-model="form.relativeconfirmationsignname"
+                placeholder="璇疯緭鍏ヤ翰灞炲鍚�"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="涓庢崘璧犺�呭叧绯�" prop="familyrelations">
+              <el-select
+                v-model="form.familyrelations"
+                placeholder="璇烽�夋嫨涓庢崘璧犺�呭叧绯�"
+              >
+                <el-option
+                  v-for="dict in dict.type.sys_FamilyRelation || []"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="浜插睘韬唤璇�" prop="relativeidcardno">
+              <el-input
+                v-model="form.relativeidcardno"
+                placeholder="璇疯緭鍏ヤ翰灞炶瘉浠跺彿鐮�"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="浜插睘鐢佃瘽" prop="relativephone">
+              <el-input
+                v-model="form.relativephone"
+                placeholder="璇疯緭鍏ヤ翰灞炶仈绯荤數璇�"
               />
             </el-form-item>
           </el-col>
         </el-row>
 
-        <el-form-item label="瀹跺睘鎰忚澶囨敞" prop="familyRemark">
+        <el-row>
+          <el-form-item label-width="100px" label="鎹愮尞鍐冲畾">
+            <el-checkbox-group v-model="organdecision">
+              <el-checkbox
+                v-for="item in organselection"
+                :key="item"
+                :label="item"
+                >{{ item }}
+              </el-checkbox>
+            </el-checkbox-group>
+            <el-input
+              v-if="organdecision.includes('鍏朵粬')"
+              v-model="organdecisionOther"
+              placeholder="璇疯緭鍏ュ叾浠栨崘鐚喅瀹氱殑鍏蜂綋鍐呭"
+              style="margin-top: 10px; width: 300px;"
+            ></el-input>
+          </el-form-item>
+        </el-row>
+
+        <el-form-item label="瀹跺睘鎰忚澶囨敞" prop="relativeRemark">
           <el-input
             type="textarea"
             :rows="3"
-            v-model="form.familyRemark"
-            :readonly="!isEdit"
+            v-model="form.relativeRemark"
             placeholder="璁板綍瀹跺睘鐨勬剰瑙佸拰娌熼�氭儏鍐�"
           />
         </el-form-item>
       </el-form>
     </el-card>
 
-    <!-- 闄勪欢鍒楄〃 -->
+    <!-- 闄勪欢淇℃伅 - 鎸夌被鍨嬪垎绫� -->
     <el-card class="attachment-card">
       <div slot="header" class="clearfix">
         <span class="detail-title">鐩稿叧闄勪欢涓婁紶</span>
-        <el-button
-          v-if="isEdit"
-          type="primary"
-          size="mini"
-          @click="handleSaveAll"
-          :loading="saveLoading"
-        >
-          淇濆瓨鎵�鏈夐檮浠�
-        </el-button>
       </div>
 
       <!-- 闄勪欢绫诲瀷閫夐」鍗� -->
@@ -138,8 +201,8 @@
           :label="type.label"
           :name="type.value"
         >
-          <div class="attachment-upload-section">
-            <div class="upload-header">
+          <div class="attachment-section">
+            <div class="attachment-header">
               <span class="upload-title">{{ type.label }}</span>
               <el-tooltip content="鐐瑰嚮涓婁紶璇ョ被鍨嬮檮浠�" placement="top">
                 <el-button
@@ -147,97 +210,87 @@
                   type="primary"
                   icon="el-icon-plus"
                   @click="openUploadDialog(type.value)"
-                  :disabled="!isEdit"
                 >
                   娣诲姞闄勪欢
                 </el-button>
               </el-tooltip>
             </div>
 
-            <!-- 闄勪欢鍒楄〃 -->
-            <el-table
-              :data="getAttachmentsByType(type.value)"
-              v-loading="attachmentLoading"
-              style="width: 100%; margin-top: 15px;"
-            >
-              <el-table-column label="鏂囦欢鍚嶇О" min-width="200">
-                <template slot-scope="scope">
-                  <div class="file-info">
+            <!-- 褰撳墠绫诲瀷鐨勯檮浠跺垪琛� -->
+            <div class="attachment-list">
+              <el-table
+                :data="getAttachmentsByType(type.value)"
+                size="small"
+                v-loading="attachmentLoading"
+                style="width: 100%;"
+              >
+                <el-table-column label="鏂囦欢鍚�" min-width="200">
+                  <template slot-scope="scope">
                     <i
                       class="el-icon-document"
-                      style="margin-right: 8px; color: #409EFF;"
+                      style="color: #409EFF; margin-right: 8px;"
                     ></i>
-                    <span>{{ scope.row.fileName }}</span>
-                  </div>
-                </template>
-              </el-table-column>
+                    <span class="file-name">{{ scope.row.fileName }}</span>
+                  </template>
+                </el-table-column>
 
-              <el-table-column label="鏂囦欢澶у皬" width="100" align="center">
-                <template slot-scope="scope">
-                  <span>{{ formatFileSize(scope.row.fileSize) }}</span>
-                </template>
-              </el-table-column>
+                <el-table-column label="鏂囦欢绫诲瀷" width="100" align="center">
+                  <template slot-scope="scope">
+                    <el-tag size="small">{{
+                      getFileType(scope.row.fileName)
+                    }}</el-tag>
+                  </template>
+                </el-table-column>
 
-              <el-table-column label="涓婁紶鏃堕棿" width="160" align="center">
-                <template slot-scope="scope">
-                  <span>{{ parseTime(scope.row.uploadTime) }}</span>
-                </template>
-              </el-table-column>
+                <el-table-column label="鏂囦欢澶у皬" width="100" align="center">
+                  <template slot-scope="scope">
+                    <span>{{ formatFileSize(scope.row.fileSize) }}</span>
+                  </template>
+                </el-table-column>
 
-              <el-table-column label="涓婁紶浜�" width="100" align="center">
-                <template slot-scope="scope">
-                  <span>{{ scope.row.uploader }}</span>
-                </template>
-              </el-table-column>
+                <el-table-column label="涓婁紶鏃堕棿" width="160" align="center">
+                  <template slot-scope="scope">
+                    <span>{{ formatDateTime(scope.row.uploadTime) }}</span>
+                  </template>
+                </el-table-column>
 
-              <el-table-column
-                label="鎿嶄綔"
-                width="120"
-                align="center"
-                v-if="isEdit"
+                <el-table-column label="鎿嶄綔" width="150" align="center">
+                  <template slot-scope="scope">
+                    <el-button
+                      size="mini"
+                      type="primary"
+                      @click="handlePreview(scope.row)"
+                    >
+                      棰勮
+                    </el-button>
+                    <el-button
+                      size="mini"
+                      type="danger"
+                      @click="handleRemoveAttachment(type.value, scope.$index)"
+                    >
+                      鍒犻櫎
+                    </el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+
+              <!-- 绌虹姸鎬佹彁绀� -->
+              <div
+                v-if="getAttachmentsByType(type.value).length === 0"
+                class="empty-attachment"
               >
-                <template slot-scope="scope">
-                  <el-button
-                    size="mini"
-                    type="text"
-                    icon="el-icon-view"
-                    @click="handlePreview(scope.row)"
-                    >棰勮</el-button
-                  >
-                  <el-button
-                    size="mini"
-                    type="text"
-                    icon="el-icon-delete"
-                    style="color: #F56C6C;"
-                    @click="handleRemoveAttachment(scope.row, type.value)"
-                    >鍒犻櫎</el-button
-                  >
-                </template>
-              </el-table-column>
-
-              <el-table-column label="鎿嶄綔" width="80" align="center" v-else>
-                <template slot-scope="scope">
-                  <el-button
-                    size="mini"
-                    type="text"
-                    icon="el-icon-view"
-                    @click="handlePreview(scope.row)"
-                    >棰勮</el-button
-                  >
-                </template>
-              </el-table-column>
-            </el-table>
-
-            <div
-              v-if="getAttachmentsByType(type.value).length === 0"
-              class="empty-attachment"
-            >
-              <el-empty description="鏆傛棤闄勪欢" :image-size="80"></el-empty>
+                <el-empty
+                  :description="`鏆傛棤${type.label}闄勪欢`"
+                  :image-size="80"
+                ></el-empty>
+              </div>
             </div>
           </div>
         </el-tab-pane>
       </el-tabs>
     </el-card>
+
+    <!-- 涓婁紶瀵硅瘽妗� -->
     <el-dialog
       :title="`涓婁紶${getCurrentTypeLabel}闄勪欢`"
       :visible.sync="uploadDialogVisible"
@@ -276,17 +329,27 @@
         </el-button>
       </span>
     </el-dialog>
+
+    <!-- 鏂囦欢棰勮寮圭獥 -->
+    <FilePreviewDialog
+      :visible="previewVisible"
+      :file="currentPreviewFile"
+      @close="previewVisible = false"
+      @download="handleDownload"
+    />
   </div>
 </template>
 
 <script>
-import {
-  getConfirmationDetail,
-  updateConfirmation
-} from "./mockConfirmationApi";
+import { relativesList, relativesEdit } from "@/api/businessApi";
+import FilePreviewDialog from "@/components/FilePreviewDialog";
 
 export default {
   name: "ConfirmationDetail",
+  components: {
+    FilePreviewDialog
+  },
+  dicts: ["sys_FamilyRelation"],
   data() {
     return {
       // 鏄惁缂栬緫妯″紡
@@ -294,28 +357,53 @@
       // 琛ㄥ崟鏁版嵁
       form: {
         id: undefined,
+        infoid: undefined,
         caseNo: "",
-        donorName: "",
-        gender: "",
+        name: "",
+        sex: "",
         age: "",
-        diagnosis: "",
-        hospitalName: "",
-        coordinator1: "",
-        coordinator2: "",
-        assignee: "",
-        confirmationStatus: "0",
-        confirmationTime: "",
-        familyRemark: ""
+        diagnosisname: "",
+        treatmenthospitalname: "",
+        coordinatedusernameo: "",
+        coordinatedusernamet: "",
+        responsibleusername: "",
+        relativeconfirmationsign: "0",
+        signdate: "",
+        relativeconfirmationsignname: "",
+        familyrelations: "",
+        relativeidcardno: "",
+        relativephone: "",
+        relativeRemark: "",
+        assessannex: "" // JSON瀛楃涓插瓨鍌ㄦ墍鏈夐檮浠�
       },
-      // 闄勪欢鍒楄〃
+      organdecision: [],
+      organdecisionOther: "",
+      organselection: [
+        "鑲濊剰",
+        "鍙岃偩",
+        "宸﹁偩",
+        "鍙宠偩",
+        "蹇冭剰",
+        "鑲鸿剰",
+        "鑳拌吅",
+        "灏忚偁",
+        "鍙岀溂缁勭粐",
+        "閬椾綋",
+        "鍏朵粬"
+      ],
+      // 鍔犺浇鐘舵��
+      loading: false,
+      saveLoading: false,
       // 闄勪欢鐩稿叧鏁版嵁
       activeAttachmentType: "1",
       attachmentLoading: false,
       uploadDialogVisible: false,
       uploadLoading: false,
-      saveLoading: false,
       tempFileList: [],
       currentUploadType: "",
+      // 棰勮鐩稿叧
+      previewVisible: false,
+      currentPreviewFile: null,
 
       // 闄勪欢绫诲瀷瀹氫箟
       attachmentTypes: [
@@ -327,36 +415,18 @@
         { value: "6", label: "蹇冩浜″垽瀹氱煡鎯呭悓鎰忎功" }
       ],
 
-      // 闄勪欢鍒楄〃鏁版嵁
-      attachmentList: [
-        // 妯℃嫙鏁版嵁 - 瀹為檯椤圭洰涓粠鎺ュ彛鑾峰彇
-        {
-          id: 1,
-          type: "1",
-          typeName: "浜轰綋鍣ㄥ畼娼滃湪鎹愮尞鑰呯櫥璁拌〃",
-          fileName: "娼滃湪鎹愮尞鑰呯櫥璁拌〃_202512001.pdf",
-          fileSize: 2548321,
-          uploadTime: "2025-12-01 10:30:00",
-          uploader: "寮犱笁",
-          fileUrl: "/attachments/1.pdf"
-        },
-        {
-          id: 2,
-          type: "1",
-          typeName: "浜轰綋鍣ㄥ畼娼滃湪鎹愮尞鑰呯櫥璁拌〃",
-          fileName: "琛ュ厖璇存槑.docx",
-          fileSize: 512345,
-          uploadTime: "2025-12-01 14:20:00",
-          uploader: "鏉庡洓",
-          fileUrl: "/attachments/2.docx"
-        }
-      ]
+      // 闄勪欢鏁版嵁缁撴瀯 - 鎸夌被鍨嬪垎寮�瀛樺偍
+      attachmentData: {
+        "1": [], // 绫诲瀷1鐨勯檮浠跺垪琛�
+        "2": [],
+        "3": [],
+        "4": [],
+        "5": [],
+        "6": []
+      }
     };
   },
   computed: {
-    isEdit() {
-      return this.$route.query.confirm === "true";
-    },
     getCurrentTypeLabel() {
       const type = this.attachmentTypes.find(
         t => t.value === this.currentUploadType
@@ -365,113 +435,119 @@
     }
   },
   created() {
-    const id = this.$route.query.id;
+    const infoid = this.$route.query.infoid;
     this.isEdit = this.$route.query.confirm === "true";
-    if (id) {
-      this.getDetail(id);
+    if (infoid) {
+      this.getDetail(infoid);
     }
-    this.getAttachmentList();
   },
   methods: {
     // 鑾峰彇璇︽儏
-    getDetail(id) {
-      getConfirmationDetail(id).then(response => {
+    async getDetail(infoid) {
+      this.loading = true;
+      try {
+        const response = await relativesList({ infoid });
+
         if (response.code === 200) {
-          this.form = response.data;
+          this.handleDetailData(response);
+        } else {
+          this.$message.error("鑾峰彇璇︽儏澶辫触锛�" + (response.msg || "鏈煡閿欒"));
         }
-      });
+      } catch (error) {
+        console.error("鑾峰彇鎹愮尞纭璇︽儏澶辫触:", error);
+        this.$message.error("鑾峰彇璇︽儏澶辫触");
+      } finally {
+        this.loading = false;
+      }
     },
-    // 鑾峰彇闄勪欢鍒楄〃
-    getAttachmentList() {
-      this.attachmentLoading = true;
-      // 妯℃嫙闄勪欢鏁版嵁
-      this.attachmentList = [
-        {
-          id: 1,
-          type: "1",
-          typeName: "浜轰綋鍣ㄥ畼娼滃湪鎹愮尞鑰呯櫥璁拌〃",
-          fileName: "娼滃湪鎹愮尞鑰呯櫥璁拌〃_202512001.pdf",
-          uploadTime: "2025-12-01 10:30:00",
-          uploader: "寮犱笁",
-          fileSize: "2.5MB",
-          fileUrl: "/attachments/1.pdf"
-        },
-        {
-          id: 2,
-          type: "2",
-          typeName: "浜轰綋鍣ㄥ畼鎹愮尞浜插睘纭鐧昏琛�",
-          fileName: "浜插睘纭鐧昏琛╛202512001.pdf",
-          uploadTime: "2025-12-01 14:20:00",
-          uploader: "鏉庡洓",
-          fileSize: "1.8MB",
-          fileUrl: "/attachments/2.pdf"
-        },
-        {
-          id: 3,
-          type: "3",
-          typeName: "鎹愮尞鑰呭強鐩寸郴浜插睘韬唤璇併�佹埛鍙g翱鐩稿叧璇佹槑",
-          fileName: "韬唤璇佹槑_202512001.zip",
-          uploadTime: "2025-12-01 16:45:00",
-          uploader: "鐜嬩簲",
-          fileSize: "5.2MB",
-          fileUrl: "/attachments/3.zip"
-        },
-        {
-          id: 4,
-          type: "4",
-          typeName: "鍏皯韬晠鍚庝汉浣撳櫒瀹橈紙瑙掕啘锛夐仐浣撴崘鐚憡鐭ヤ功",
-          fileName: "鎹愮尞鍛婄煡涔202512001.pdf",
-          uploadTime: "2025-12-02 09:15:00",
-          uploader: "寮犱笁",
-          fileSize: "1.2MB",
-          fileUrl: "/attachments/4.pdf"
-        },
-        {
-          id: 5,
-          type: "5",
-          typeName: "鑴戞浜″垽瀹氱煡鎯呭悓鎰忎功",
-          fileName: "鑴戞浜″垽瀹氬悓鎰忎功_202512001.pdf",
-          uploadTime: "2025-12-02 11:30:00",
-          uploader: "鏉庡洓",
-          fileSize: "0.8MB",
-          fileUrl: "/attachments/5.pdf"
-        },
-        {
-          id: 6,
-          type: "6",
-          typeName: "蹇冩浜″垽瀹氱煡鎯呭悓鎰忎功",
-          fileName: "蹇冩浜″垽瀹氬悓鎰忎功_202512001.pdf",
-          uploadTime: "2025-12-02 13:20:00",
-          uploader: "鐜嬩簲",
-          fileSize: "0.9MB",
-          fileUrl: "/attachments/6.pdf"
+
+    // 澶勭悊璇︽儏鏁版嵁
+    handleDetailData(response) {
+      let detailData = null;
+
+      // 鏍规嵁鎺ュ彛瀹為檯杩斿洖鐨勬暟鎹粨鏋勮繘琛岃皟鏁�
+      if (response.data) {
+        if (Array.isArray(response.data)) {
+          detailData = response.data[0] || {};
+        } else if (response.data.rows && Array.isArray(response.data.rows)) {
+          detailData = response.data.rows[0] || {};
+        } else if (Array.isArray(response.data.list)) {
+          detailData = response.data.list[0] || {};
+        } else {
+          detailData = response.data;
         }
-      ];
-      this.attachmentLoading = false;
+      } else {
+        detailData = response;
+      }
+
+      // 鏄犲皠瀛楁鍒拌〃鍗�
+      this.form = {
+        ...this.form,
+        id: detailData.id || this.$route.query.id,
+        infoid: detailData.infoid || infoid,
+        caseNo: detailData.caseNo || "",
+        name: detailData.name || "",
+        sex: detailData.sex || "",
+        age: detailData.age || "",
+        diagnosisname: detailData.diagnosisname || "",
+        treatmenthospitalname: detailData.treatmenthospitalname || "",
+        coordinatedusernameo: detailData.coordinatedusernameo || "",
+        coordinatedusernamet: detailData.coordinatedusernamet || "",
+        responsibleusername: detailData.responsibleusername || "",
+        relativeconfirmationsign: detailData.relativeconfirmationsign || "0",
+        signdate: detailData.signdate,
+        relativeconfirmationsignname:
+          detailData.relativeconfirmationsignname || "",
+        familyrelations: detailData.familyrelations || "",
+        relativeidcardno: detailData.relativeidcardno || "",
+        relativephone: detailData.relativephone || "",
+        relativeRemark: detailData.relativeRemark || "",
+        assessannex: detailData.assessannex || ""
+      };
+
+      // 澶勭悊鎹愮尞鍐冲畾鏁版嵁
+      if (detailData.organdecision) {
+        this.organdecision = Array.isArray(detailData.organdecision)
+          ? detailData.organdecision
+          : detailData.organdecision.split(",");
+      }
+
+      // 澶勭悊闄勪欢鏁版嵁 - 浠巃ssessannex瀛楁瑙f瀽JSON骞舵寜绫诲瀷鍒嗙被
+      this.processAssessannexData();
     },
-    // 涓嬭浇闄勪欢
-    handleDownload(row) {
-      // 瀹為檯椤圭洰涓繖閲岃皟鐢ㄦ枃浠朵笅杞芥帴鍙�
-      this.$message.success(`涓嬭浇鏂囦欢: ${row.fileName}`);
-      console.log("涓嬭浇鏂囦欢:", row.fileUrl);
-    },
-    // 淇濆瓨纭淇℃伅
-    handleSave() {
-      this.$refs.form.validate(valid => {
-        if (valid) {
-          updateConfirmation(this.form).then(response => {
-            if (response.code === 200) {
-              this.$message.success("淇濆瓨鎴愬姛");
-              this.isEdit = false;
-              this.$router.push("/case/confirmation");
-            }
+
+    // 澶勭悊assessannex瀛楁鏁版嵁骞舵寜绫诲瀷鍒嗙被
+    processAssessannexData() {
+      if (this.form.assessannex) {
+        try {
+          const annexData =
+            typeof this.form.assessannex === "string"
+              ? JSON.parse(this.form.assessannex)
+              : this.form.assessannex;
+
+          // 娓呯┖鐜版湁鏁版嵁
+          Object.keys(this.attachmentData).forEach(key => {
+            this.attachmentData[key] = [];
           });
+
+          // 鎸夌被鍨嬪垎绫诲瓨鍌�
+          if (Array.isArray(annexData)) {
+            annexData.forEach(attachment => {
+              const type = attachment.type || "1"; // 榛樿鍒扮涓�绉嶇被鍨�
+              if (this.attachmentData[type]) {
+                this.attachmentData[type].push(attachment);
+              }
+            });
+          }
+        } catch (error) {
+          console.warn("assessannex鏁版嵁瑙f瀽澶辫触:", error);
         }
-      });
+      }
     },
- // 鏍规嵁绫诲瀷鑾峰彇闄勪欢
+
+    // 鏍规嵁绫诲瀷鑾峰彇闄勪欢鍒楄〃
     getAttachmentsByType(type) {
-      return this.attachmentList.filter(item => item.type === type);
+      return this.attachmentData[type] || [];
     },
 
     // 鎵撳紑涓婁紶瀵硅瘽妗�
@@ -486,35 +562,38 @@
       });
     },
 
-    // 涓婁紶鍓嶆牎楠�
+    // 涓婁紶鍓嶆牎楠孾7](@ref)
     beforeUpload(file) {
       const allowedTypes = [
-        'application/pdf',
-        'image/jpeg',
-        'image/png',
-        'application/msword',
-        'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
+        "application/pdf",
+        "image/jpeg",
+        "image/png",
+        "application/msword",
+        "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
       ];
 
       const maxSize = 10 * 1024 * 1024; // 10MB
 
       // 鏍¢獙鏂囦欢绫诲瀷
-      const isTypeOk = allowedTypes.includes(file.type) ||
-                      file.name.endsWith('.pdf') ||
-                      file.name.endsWith('.jpg') ||
-                      file.name.endsWith('.jpeg') ||
-                      file.name.endsWith('.png') ||
-                      file.name.endsWith('.doc') ||
-                      file.name.endsWith('.docx');
+      const isTypeOk =
+        allowedTypes.includes(file.type) ||
+        file.name.endsWith(".pdf") ||
+        file.name.endsWith(".jpg") ||
+        file.name.endsWith(".jpeg") ||
+        file.name.endsWith(".png") ||
+        file.name.endsWith(".doc") ||
+        file.name.endsWith(".docx");
 
       if (!isTypeOk) {
-        this.$message.error('鏂囦欢鏍煎紡涓嶆敮鎸侊紝璇蜂笂浼爌df銆乯pg銆乸ng銆乨oc鎴杁ocx鏍煎紡鏂囦欢');
+        this.$message.error(
+          "鏂囦欢鏍煎紡涓嶆敮鎸侊紝璇蜂笂浼爌df銆乯pg銆乸ng銆乨oc鎴杁ocx鏍煎紡鏂囦欢"
+        );
         return false;
       }
 
       // 鏍¢獙鏂囦欢澶у皬
       if (file.size > maxSize) {
-        this.$message.error('鏂囦欢澶у皬涓嶈兘瓒呰繃10MB');
+        this.$message.error("鏂囦欢澶у皬涓嶈兘瓒呰繃10MB");
         return false;
       }
 
@@ -533,25 +612,29 @@
 
     // 鑷畾涔変笂浼犺姹�
     handleHttpRequest(options) {
-      // 妯℃嫙涓婁紶杩囩▼
       return new Promise((resolve, reject) => {
         this.uploadLoading = true;
 
-        // 妯℃嫙涓婁紶寤惰繜
+        // 妯℃嫙涓婁紶杩囩▼
         setTimeout(() => {
           const newAttachment = {
             id: Date.now(),
-            type: this.currentUploadType,
-            typeName: this.getCurrentTypeLabel,
             fileName: options.file.name,
+            fileUrl: URL.createObjectURL(options.file),
             fileSize: options.file.size,
+            fileType: this.getFileExtension(options.file.name),
+            type: this.currentUploadType, // 璁板綍闄勪欢绫诲瀷
             uploadTime: new Date().toISOString(),
-            uploader: '褰撳墠鐢ㄦ埛', // 瀹為檯椤圭洰涓粠鐢ㄦ埛淇℃伅鑾峰彇
-            fileUrl: URL.createObjectURL(options.file) // 涓存椂URL锛屽疄闄呴」鐩腑涓烘湇鍔″櫒杩斿洖鐨刄RL
+            uploader: "褰撳墠鐢ㄦ埛"
           };
 
-          this.attachmentList.push(newAttachment);
+          // 娣诲姞鍒板搴旂被鍨嬬殑闄勪欢鍒楄〃
+          if (this.attachmentData[this.currentUploadType]) {
+            this.attachmentData[this.currentUploadType].push(newAttachment);
+          }
+
           this.uploadLoading = false;
+          this.updateAssessannexField(); // 鏇存柊瀛樺偍瀛楁
           resolve({ code: 200, data: newAttachment });
         }, 1500);
       });
@@ -560,90 +643,184 @@
     // 鎻愪氦涓婁紶
     async submitUpload() {
       if (this.tempFileList.length === 0) {
-        this.$message.warning('璇峰厛閫夋嫨瑕佷笂浼犵殑鏂囦欢');
+        this.$message.warning("璇峰厛閫夋嫨瑕佷笂浼犵殑鏂囦欢");
         return;
       }
 
       try {
-        // 渚濇涓婁紶鎵�鏈夋枃浠�
         for (const file of this.tempFileList) {
           await this.$refs.uploadRef.submit();
         }
 
-        this.$message.success('鏂囦欢涓婁紶鎴愬姛');
+        this.$message.success("鏂囦欢涓婁紶鎴愬姛");
         this.uploadDialogVisible = false;
         this.tempFileList = [];
       } catch (error) {
-        this.$message.error('鏂囦欢涓婁紶澶辫触');
-        console.error('涓婁紶澶辫触:', error);
+        this.$message.error("鏂囦欢涓婁紶澶辫触");
+        console.error("涓婁紶澶辫触:", error);
       }
     },
 
     // 鍒犻櫎闄勪欢
-    handleRemoveAttachment(attachment, type) {
-      this.$confirm('纭畾瑕佸垹闄よ繖涓檮浠跺悧锛�', '鎻愮ず', {
-        confirmButtonText: '纭畾',
-        cancelButtonText: '鍙栨秷',
-        type: 'warning'
-      }).then(() => {
-        const index = this.attachmentList.findIndex(item => item.id === attachment.id);
-        if (index !== -1) {
-          this.attachmentList.splice(index, 1);
-          this.$message.success('闄勪欢鍒犻櫎鎴愬姛');
-
-          // 瀹為檯椤圭洰涓皟鐢ㄥ垹闄ゆ帴鍙�
-          // this.deleteAttachment(attachment.id);
-        }
-      }).catch(() => {});
+    handleRemoveAttachment(type, index) {
+      this.$confirm("纭畾瑕佸垹闄よ繖涓檮浠跺悧锛�", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          if (this.attachmentData[type] && this.attachmentData[type][index]) {
+            this.attachmentData[type].splice(index, 1);
+            this.$message.success("闄勪欢鍒犻櫎鎴愬姛");
+            this.updateAssessannexField(); // 鏇存柊瀛樺偍瀛楁
+          }
+        })
+        .catch(() => {});
     },
 
-    // 棰勮闄勪欢
-    handlePreview(attachment) {
-      // 瀹為檯椤圭洰涓牴鎹枃浠剁被鍨嬭皟鐢ㄤ笉鍚岀殑棰勮鏂瑰紡
-      if (attachment.fileName.endsWith('.pdf')) {
-        // PDF棰勮
-        window.open(attachment.fileUrl, '_blank');
-      } else if (attachment.fileName.match(/\.(jpg|jpeg|png)$/i)) {
-        // 鍥剧墖棰勮
-        this.$alert(`<img src="${attachment.fileUrl}" style="max-width: 100%;" alt="${attachment.fileName}">`,
-          '鍥剧墖棰勮', {
-            dangerouslyUseHTMLString: true,
-            customClass: 'image-preview-dialog'
-          });
+    // 鏇存柊assessannex瀛樺偍瀛楁
+    updateAssessannexField() {
+      // 灏嗘墍鏈夌被鍨嬬殑闄勪欢鍚堝苟涓轰竴涓暟缁�
+      const allAttachments = [];
+      Object.values(this.attachmentData).forEach(attachments => {
+        allAttachments.push(...attachments);
+      });
+
+      // 鏇存柊鍒拌〃鍗曞瓧娈�
+      this.form.assessannex = JSON.stringify(allAttachments);
+    },
+
+    // 鏂囦欢棰勮
+    handlePreview(file) {
+      this.currentPreviewFile = {
+        fileName: file.fileName,
+        fileUrl: file.fileUrl,
+        fileType: this.getFileType(file.fileName)
+      };
+      this.previewVisible = true;
+    },
+
+    // 鏂囦欢涓嬭浇
+    handleDownload(file) {
+      const fileUrl = 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.info('璇ユ枃浠剁被鍨嬫殏涓嶆敮鎸佸湪绾块瑙堬紝璇蜂笅杞藉悗鏌ョ湅');
+        this.$message.warning("鏂囦欢璺緞涓嶅瓨鍦紝鏃犳硶涓嬭浇");
       }
     },
 
-    // 淇濆瓨鎵�鏈夐檮浠朵俊鎭�
-    handleSaveAll() {
-      this.saveLoading = true;
+    // 鑾峰彇鏂囦欢绫诲瀷
+    getFileType(fileName) {
+      if (!fileName) return "other";
+      const extension = this.getFileExtension(fileName);
+      const imageTypes = ["jpg", "jpeg", "png"];
+      const pdfTypes = ["pdf"];
+      const officeTypes = ["doc", "docx"];
 
-      // 妯℃嫙淇濆瓨杩囩▼
-      setTimeout(() => {
-        this.$message.success('闄勪欢淇℃伅淇濆瓨鎴愬姛');
-        this.saveLoading = false;
+      if (imageTypes.includes(extension)) return "image";
+      if (pdfTypes.includes(extension)) return "pdf";
+      if (officeTypes.includes(extension)) return "office";
+      return "other";
+    },
 
-        // 瀹為檯椤圭洰涓皟鐢ㄤ繚瀛樻帴鍙�
-        // this.saveAttachments();
-      }, 1000);
+    // 鑾峰彇鏂囦欢鎵╁睍鍚�
+    getFileExtension(filename) {
+      return filename
+        .split(".")
+        .pop()
+        .toLowerCase();
     },
 
     // 鏂囦欢澶у皬鏍煎紡鍖�
     formatFileSize(size) {
-      if (size === 0) return '0 B';
+      if (!size) return "0 B";
       const k = 1024;
-      const sizes = ['B', 'KB', 'MB', 'GB'];
+      const sizes = ["B", "KB", "MB", "GB"];
       const i = Math.floor(Math.log(size) / Math.log(k));
-      return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
+      return parseFloat((size / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
     },
 
-    // 鏃堕棿鏍煎紡鍖�
-    parseTime(time) {
-      if (!time) return '';
-      const date = new Date(time);
-      return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
+    // 鏃ユ湡鏃堕棿鏍煎紡鍖�
+    formatDateTime(dateTime) {
+      if (!dateTime) return "";
+      try {
+        const date = new Date(dateTime);
+        if (isNaN(date.getTime())) return dateTime;
+
+        const year = date.getFullYear();
+        const month = String(date.getMonth() + 1).padStart(2, "0");
+        const day = String(date.getDate()).padStart(2, "0");
+        const hours = String(date.getHours()).padStart(2, "0");
+        const minutes = String(date.getMinutes()).padStart(2, "0");
+
+        return `${year}-${month}-${day} ${hours}:${minutes}`;
+      } catch (error) {
+        return dateTime;
+      }
+    },
+
+    // 鑾峰彇褰撳墠鏃堕棿
+    getCurrentTime() {
+      const now = new Date();
+      return `${now.getFullYear()}-${(now.getMonth() + 1)
+        .toString()
+        .padStart(2, "0")}-${now
+        .getDate()
+        .toString()
+        .padStart(2, "0")} ${now
+        .getHours()
+        .toString()
+        .padStart(2, "0")}:${now
+        .getMinutes()
+        .toString()
+        .padStart(2, "0")}:${now
+        .getSeconds()
+        .toString()
+        .padStart(2, "0")}`;
+    },
+
+    // 淇濆瓨纭淇℃伅
+    async handleSave() {
+      try {
+        await this.$refs.form.validate();
+        this.saveLoading = true;
+
+        // 纭繚闄勪欢鏁版嵁鏄渶鏂扮殑
+        this.updateAssessannexField();
+
+        const saveData = {
+          ...this.form,
+          organdecision: this.organdecision.join(","),
+          organdecisionOther: this.organdecisionOther
+          // assessannex瀛楁宸插湪updateAssessannexField涓洿鏂�
+        };
+
+        const response = await relativesEdit(saveData);
+
+        if (response.code === 200) {
+          this.$message.success("淇濆瓨鎴愬姛");
+          this.$router.push("/case/confirmation");
+        } else {
+          this.$message.error("淇濆瓨澶辫触锛�" + (response.msg || "鏈煡閿欒"));
+        }
+      } catch (error) {
+        if (error !== "cancel") {
+          console.error("淇濆瓨澶辫触:", error);
+          this.$message.error("淇濆瓨澶辫触");
+        }
+      } finally {
+        this.saveLoading = false;
+      }
     }
   }
 };
@@ -665,37 +842,20 @@
 .detail-title {
   font-size: 16px;
   font-weight: bold;
+  margin-right: 20px;
 }
 
-.fixed-width .el-button {
-  margin: 0 5px;
-}
-.confirmation-detail {
-  padding: 20px;
+.attachment-section {
+  padding: 15px;
 }
 
-.detail-card {
-  margin-bottom: 20px;
-}
-
-.attachment-card {
-  margin-bottom: 20px;
-}
-
-.detail-title {
-  font-size: 16px;
-  font-weight: bold;
-}
-
-.attachment-upload-section {
-  padding: 10px;
-}
-
-.upload-header {
+.attachment-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 15px;
+  padding-bottom: 10px;
+  border-bottom: 1px solid #ebeef5;
 }
 
 .upload-title {
@@ -704,9 +864,8 @@
   color: #303133;
 }
 
-.file-info {
-  display: flex;
-  align-items: center;
+.attachment-list {
+  margin-top: 15px;
 }
 
 .empty-attachment {
@@ -715,13 +874,8 @@
   color: #909399;
 }
 
-/* 鍥剧墖棰勮瀵硅瘽妗嗘牱寮� */
-:deep(.image-preview-dialog) {
-  width: auto;
-  max-width: 90vw;
-}
-
-:deep(.image-preview-dialog .el-message-box__content) {
-  text-align: center;
+.file-name {
+  font-size: 13px;
+  color: #606266;
 }
 </style>

--
Gitblit v1.9.3