From c09b09a73a7905f980f5ebb8f25df0500d7c8ccb Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 24 九月 2025 16:15:26 +0800
Subject: [PATCH] 器官编辑的比对国家表自动排序功能和新写了个附件预览的组件

---
 src/views/project/donationdetails/index.vue |  227 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 168 insertions(+), 59 deletions(-)

diff --git a/src/views/project/donationdetails/index.vue b/src/views/project/donationdetails/index.vue
index 02e0119..2d69c3d 100644
--- a/src/views/project/donationdetails/index.vue
+++ b/src/views/project/donationdetails/index.vue
@@ -727,7 +727,7 @@
               </el-form-item>
             </el-col> -->
           </el-row>
-          <el-row>
+          <!-- <el-row>
             <el-col :span="8">
               <el-form-item align="left" label="绾㈠崄瀛椾細" prop="redorganno">
                 <org-selecter
@@ -759,7 +759,7 @@
                 </el-date-picker>
               </el-form-item>
             </el-col>
-          </el-row>
+          </el-row> -->
         </el-form>
         <div class="dialog-footer">
           <el-button
@@ -1018,50 +1018,6 @@
         >
           <el-row>
             <el-col :span="6">
-              <el-form-item label="浜插睘濮撳悕" prop="name">
-                <el-input v-model="affirmform.name" placeholder="璇疯緭鍏ュ鍚�" />
-              </el-form-item>
-            </el-col>
-            <el-col :span="6">
-              <el-form-item
-                align="left"
-                label="涓庢崘璧犺�呭叧绯�"
-                prop="familyrelations"
-              >
-                <el-select
-                  v-model="affirmform.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="idcardno">
-                <el-input
-                  ref="updateBSvalue"
-                  class="sfzcode"
-                  v-model="affirmform.idcardno"
-                  placeholder="璇疯緭鍏ヨ瘉浠跺彿鐮�"
-                />
-              </el-form-item>
-            </el-col>
-            <el-col :span="6">
-              <el-form-item label="浜插睘鐢佃瘽" prop="phone">
-                <el-input
-                  v-model="affirmform.phone"
-                  placeholder="璇疯緭鍏ヨ仈绯荤數璇�"
-                />
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row>
-            <el-col :span="6">
               <el-form-item label="鎹愯禒鑰呮皯鏃�" prop="nation">
                 <el-select v-model="affirmform.nation" placeholder="璇烽�夋嫨姘戞棌">
                   <el-option
@@ -1104,6 +1060,51 @@
               </el-form-item>
             </el-col>
           </el-row>
+          <el-row>
+            <el-col :span="6">
+              <el-form-item label="浜插睘濮撳悕" prop="name">
+                <el-input v-model="affirmform.name" placeholder="璇疯緭鍏ュ鍚�" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item
+                align="left"
+                label="涓庢崘璧犺�呭叧绯�"
+                prop="familyrelations"
+              >
+                <el-select
+                  v-model="affirmform.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="idcardno">
+                <el-input
+                  ref="updateBSvalue"
+                  class="sfzcode"
+                  v-model="affirmform.idcardno"
+                  placeholder="璇疯緭鍏ヨ瘉浠跺彿鐮�"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="浜插睘鐢佃瘽" prop="phone">
+                <el-input
+                  v-model="affirmform.phone"
+                  placeholder="璇疯緭鍏ヨ仈绯荤數璇�"
+                />
+              </el-form-item>
+            </el-col>
+          </el-row>
+
           <el-row>
             <!-- <el-col :span="12">
               <el-form-item label="浜插睘绫嶈疮" prop="residenceaddresss">
@@ -1402,12 +1403,12 @@
                       />
                     </template>
                   </el-table-column>
-                  <el-table-column
+                  <!-- <el-table-column
                     label="鍣ㄥ畼缂栧彿"
                     align="center"
                     width="90"
                     prop="organno"
-                  />
+                  /> -->
                   <el-table-column
                     label="鍒嗛厤绯荤粺缂栧彿"
                     align="center"
@@ -1456,7 +1457,7 @@
                   <el-table-column
                     label="绉绘鍖婚櫌"
                     align="center"
-                    width="230"
+                    width="280"
                     prop="transplanthospitalno"
                   >
                     <template slot-scope="scope">
@@ -1689,7 +1690,7 @@
             <el-col :span="6">
               <el-form-item
                 align="left"
-                label="绛惧瓧鏃堕棿"
+                label="绛惧瓧鏃ユ湡"
                 label-width="120px"
                 prop="coordinatorSignTime"
               >
@@ -1697,7 +1698,7 @@
                   clearable
                   v-model="witnessform.coordinatorSignTime"
                   type="datetime"
-                  value-format="yyyy-MM-dd HH:mm:ss"
+                  value-format="yyyy-MM-dd"
                   placeholder="閫夋嫨鎵嬫湳缁撴潫鏃堕棿"
                 >
                 </el-date-picker>
@@ -1863,7 +1864,12 @@
           <el-row>
             <el-col>
               <el-form-item>
-                <el-table v-loading="loading" border :data="procureddata">
+                <el-table
+                  v-loading="loading"
+                  border
+                  :key="tableKey"
+                  :data="procureddata"
+                >
                   <el-table-column
                     label="鍣ㄥ畼鍚嶇О"
                     align="center"
@@ -1878,12 +1884,12 @@
                       />
                     </template>
                   </el-table-column>
-                  <el-table-column
+                  <!-- <el-table-column
                     label="鍣ㄥ畼缂栧彿"
                     align="center"
                     width="90"
                     prop="organno"
-                  />
+                  /> -->
                   <!-- <el-table-column
                     label="绯荤粺缂栧彿"
                     align="center"
@@ -1919,7 +1925,7 @@
                   <el-table-column
                     label="鑾峰彇鍖婚櫌"
                     align="center"
-                    width="230"
+                    width="280"
                     prop="gainhospitalno"
                   >
                     <template slot-scope="scope">
@@ -2138,12 +2144,12 @@
                       />
                     </template>
                   </el-table-column>
-                  <el-table-column
+                  <!-- <el-table-column
                     label="鍣ㄥ畼缂栧彿"
                     align="center"
                     width="90"
                     prop="organno"
-                  />
+                  /> -->
                   <el-table-column
                     label="绯荤粺缂栧彿"
                     align="center"
@@ -2160,7 +2166,7 @@
                   <el-table-column
                     label="绉绘鍖婚櫌"
                     align="center"
-                    width="220"
+                    width="280"
                     prop="hospitalno"
                   >
                     <template slot-scope="scope">
@@ -2694,6 +2700,20 @@
         contacttime: "",
         reporttime: ""
       },
+      organOrder: [
+        "鑲濊剰",
+        "宸﹁偩",
+        "鍙宠偩",
+        "蹇冭剰",
+        "宸﹁偤",
+        "鍙宠偤",
+        "鑳拌吅",
+        "灏忚偁",
+        "宸︾溂瑙掕啘",
+        "鍙崇溂瑙掕啘"
+      ], // 鎸囧畾鐨勫櫒瀹橀『搴�
+      isSorting: false, // 鏍囧織浣嶏紝琛ㄧず鏄惁姝e湪鎺掑簭
+      tableKey: 0,
       istb: false,
       activeName: "",
       tableDatafile: [
@@ -2891,7 +2911,7 @@
         education: [
           { required: true, message: "瀹跺睘鑱旂郴鐢佃瘽涓嶄负绌�", trigger: "blur" }
         ],
-         occupation: [
+        occupation: [
           { required: true, message: "瀹跺睘鑱旂郴鐢佃瘽涓嶄负绌�", trigger: "blur" }
         ],
         signfamilyrelations: [
@@ -2974,6 +2994,28 @@
     listReportname("fzr").then(res => {
       this.leaderlist = res.data;
     });
+    // this.customOrganSort();
+  },
+  watch: {
+    // 鐩戝惉 procureddata 鐨勫彉鍖栵紝鏁版嵁鏇存柊鍚庨噸鏂版帓搴�
+    procureddata: {
+      handler(newVal) {
+        if (this.isSorting) {
+          return;
+        }
+        this.customOrganSort();
+      },
+      deep: true // 娣卞害鐩戝惉锛屽洜涓烘暟缁勫唴瀹瑰彲鑳藉彉鍖�
+    },
+    allocateddata: {
+      handler(newVal) {
+        if (this.isSorting) {
+          return;
+        }
+        this.allocateddataSort();
+      },
+      deep: true // 娣卞害鐩戝惉锛屽洜涓烘暟缁勫唴瀹瑰彲鑳藉彉鍖�
+    }
   },
 
   methods: {
@@ -3566,6 +3608,73 @@
         });
       }
     },
+
+    customOrganSort() {
+      console.log("璋冪敤");
+
+      // 1. 鍔犻攣锛岄樆姝㈢洃鍚櫒鎵ц
+      this.isSorting = true;
+      // 鑷畾涔夋帓搴忓嚱鏁�
+      this.procureddata.sort((a, b) => {
+        const indexA = this.organOrder.indexOf(a.organname);
+        const indexB = this.organOrder.indexOf(b.organname);
+
+        // 濡傛灉涓や釜閮藉湪鍒楄〃涓紝鎸夊垪琛ㄤ腑鐨勯『搴忔帓搴�
+        if (indexA !== -1 && indexB !== -1) {
+          return indexA - indexB;
+        }
+        // 濡傛灉 a 鍦ㄥ垪琛ㄤ腑锛宐 涓嶅湪锛宎 鎺掑墠闈�
+        if (indexA !== -1) {
+          return -1;
+        }
+        // 濡傛灉 b 鍦ㄥ垪琛ㄤ腑锛宎 涓嶅湪锛宐 鎺掑墠闈�
+        if (indexB !== -1) {
+          return 1;
+        }
+        // 涓や釜閮戒笉鍦ㄥ垪琛ㄤ腑锛屼繚鎸佸師椤哄簭锛堟垨鎸夊叾浠栬鍒欙紝姣斿鎸夊瓧姣嶆帓搴忥紝杩欓噷鎸夊師濮嬮『搴忥級
+        return 0;
+      });
+      console.log(this.procureddata, "椤哄簭");
+      this.tableKey += 1; // 鏀瑰彉 key 杩娇琛ㄦ牸閲嶆柊娓叉煋
+      // 浣犲彲浠ヤ娇鐢� this.$forceUpdate() 鎴栬�呴噸鏂拌祴鍊兼暟缁勬潵瑙﹀彂鏇存柊
+      this.procureddata = [...this.procureddata];
+      this.$nextTick(() => {
+        this.isSorting = false;
+      });
+    },
+     allocateddataSort() {
+      console.log("璋冪敤");
+
+      // 1. 鍔犻攣锛岄樆姝㈢洃鍚櫒鎵ц
+      this.isSorting = true;
+      // 鑷畾涔夋帓搴忓嚱鏁�
+      this.allocateddata.sort((a, b) => {
+        const indexA = this.organOrder.indexOf(a.organname);
+        const indexB = this.organOrder.indexOf(b.organname);
+
+        // 濡傛灉涓や釜閮藉湪鍒楄〃涓紝鎸夊垪琛ㄤ腑鐨勯『搴忔帓搴�
+        if (indexA !== -1 && indexB !== -1) {
+          return indexA - indexB;
+        }
+        // 濡傛灉 a 鍦ㄥ垪琛ㄤ腑锛宐 涓嶅湪锛宎 鎺掑墠闈�
+        if (indexA !== -1) {
+          return -1;
+        }
+        // 濡傛灉 b 鍦ㄥ垪琛ㄤ腑锛宎 涓嶅湪锛宐 鎺掑墠闈�
+        if (indexB !== -1) {
+          return 1;
+        }
+        // 涓や釜閮戒笉鍦ㄥ垪琛ㄤ腑锛屼繚鎸佸師椤哄簭锛堟垨鎸夊叾浠栬鍒欙紝姣斿鎸夊瓧姣嶆帓搴忥紝杩欓噷鎸夊師濮嬮『搴忥級
+        return 0;
+      });
+      console.log(this.allocateddata, "椤哄簭");
+      this.tableKey += 1; // 鏀瑰彉 key 杩娇琛ㄦ牸閲嶆柊娓叉煋
+      // 浣犲彲浠ヤ娇鐢� this.$forceUpdate() 鎴栬�呴噸鏂拌祴鍊兼暟缁勬潵瑙﹀彂鏇存柊
+      this.allocateddata = [...this.allocateddata];
+      this.$nextTick(() => {
+        this.isSorting = false;
+      });
+    },
     // 鍒囨崲tab
     on_click(e) {
       // if (e != "" || e != null) {

--
Gitblit v1.9.3