From 21fe2968337eb8eab97adc88750b71c4057e98f8 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期三, 17 七月 2024 15:39:46 +0800
Subject: [PATCH] 11

---
 src/views/project/donationdetails/index.vue |  325 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 202 insertions(+), 123 deletions(-)

diff --git a/src/views/project/donationdetails/index.vue b/src/views/project/donationdetails/index.vue
index 9285831..ad38fa3 100644
--- a/src/views/project/donationdetails/index.vue
+++ b/src/views/project/donationdetails/index.vue
@@ -573,7 +573,7 @@
                   >
                     <el-checkbox-group v-model="form.kinship">
                       <el-checkbox
-                        v-for="dict in dict.type.sys_Kinship"
+                        v-for="dict in dict.type.sys_kinship"
                         :key="dict.value"
                         :label="dict.value"
                       >
@@ -1042,13 +1042,17 @@
           <el-row>
             <el-col :span="12">
               <el-form-item label="绛惧瓧浜插睘" prop="kinshipconfirmationsign">
-                <el-checkbox-group v-model="organdecision">
+                <el-checkbox-group v-model="kinship">
                   <el-checkbox
-                    v-for="item in kinshiplist"
-                    :key="item"
-                    :label="item"
+                    v-for="item in dict.type.sys_kinshipConfirm"
+                    :label="item.value"
+                    :value="item.value"
                   >
-                    {{ item == "瀛愬コ" ? item + "(浜�)" : item }}
+                    {{
+                      item.label == "鎴愬勾瀛愬コ"
+                        ? item.label + "(浜�)"
+                        : item.label
+                    }}
                   </el-checkbox>
                 </el-checkbox-group>
               </el-form-item>
@@ -1320,7 +1324,7 @@
                     prop="organno"
                   />
                   <el-table-column
-                    label="绯荤粺缂栧彿"
+                    label="鍒嗛厤绯荤粺缂栧彿"
                     align="center"
                     width="120"
                     prop="caseno"
@@ -1328,12 +1332,12 @@
                     <template slot-scope="scope">
                       <el-input
                         v-model="scope.row.caseno"
-                        placeholder="绯荤粺缂栧彿"
+                        placeholder="鍒嗛厤绯荤粺缂栧彿"
                       />
                     </template>
                   </el-table-column>
                   <el-table-column
-                    label="鎺ユ敹鏃堕棿"
+                    label="鍒嗛厤鎺ユ敹鏃堕棿"
                     align="center"
                     width="200"
                     prop="applicanttime"
@@ -1346,7 +1350,7 @@
                         v-model="scope.row.applicanttime"
                         type="datetime"
                         value-format="yyyy-MM-dd HH:mm:ss"
-                        placeholder="閫夋嫨鎺ユ敹鏃堕棿"
+                        placeholder="閫夋嫨鍒嗛厤鎺ユ敹鏃堕棿"
                       >
                       </el-date-picker>
                     </template>
@@ -1375,6 +1379,7 @@
                         <org-selecter
                           ref="tranHosSelect"
                           :org-type="'4'"
+                          :dataList="dataList"
                           v-model="scope.row.transplanthospitalno"
                         />
                       </div>
@@ -1784,6 +1789,7 @@
                         <org-selecter
                           ref="tranHosSelect"
                           :org-type="'4'"
+                          :dataList="dataList"
                           v-model="scope.row.gainhospitalno"
                         />
                       </div>
@@ -2024,6 +2030,7 @@
                       <org-selecter
                         ref="tranHosSelect"
                         :org-type="'4'"
+                        :dataList="dataList"
                         v-model="scope.row.hospitalno"
                         style="width: 100%"
                       />
@@ -2397,7 +2404,8 @@
   addDonatebaseinfo,
   updateDonatebaseinfo,
   getDonatebaseinfoflow,
-  fileCase
+  fileCase,
+  getDonationNumber
 } from "@/api/project/donatebaseinfo";
 import {
   listMedicalevaluation,
@@ -2481,6 +2489,7 @@
       infoid: 736,
       drawer: false,
       form: {},
+      istb: false,
       activeName: "",
       tableDatafile: [
         {
@@ -2490,14 +2499,17 @@
           type: "success"
         }
       ],
+      dataList: [],
       medicineform: {
         infoid: null
       },
       affirmform: {
         infoid: null,
-        organdecision: []
+        organdecision: [],
+        kinship: []
       },
       organdecision: [],
+      kinship: [],
       ethicform: {
         infoid: null
       },
@@ -2819,6 +2831,7 @@
       let searchParam = {
         infoid: this.infoid
       };
+      console.log(this.procureddata, "procureddata");
       if (this.actives == 1) {
         this.activetele = "鍖诲璇勪及";
 
@@ -2840,6 +2853,9 @@
             if (this.affirmform.organdecision) {
               this.organdecision = this.affirmform.organdecision.split(",");
             }
+            if (this.affirmform.kinship) {
+              this.kinship = this.affirmform.kinship.split(",");
+            }
             if (!this.affirmform) {
               this.affirmform = {};
               this.affirmform.residenceprovincename = "";
@@ -2849,14 +2865,6 @@
             this.defultAddresss.sheng = this.affirmform.residenceprovincename;
             this.defultAddresss.shi = this.affirmform.residencecityname;
             this.defultAddresss.qu = this.affirmform.residencetownname;
-            // if (this.affirmform.kinship) {
-            //   this.affirmform.kinship = this.affirmform.kinship.split(",");
-            // }
-            // if (this.affirmform.organdecision) {
-            //   this.affirmform.organdecision = this.affirmform.organdecision.split(
-            //     ","
-            //   );
-            // }
           } else {
             // this.$modal.msgError(
             //   "鏌ヨ鏄惁瀛樺湪纭鐧昏璁板綍澶辫触" + JSON.stringify(response)
@@ -2892,21 +2900,32 @@
             // );
           }
         });
-      } else if (this.actives == 5 && !this.witnessform.id) {
+      } else if (this.actives == 5) {
         // 涓嶅瓨鍦ㄦ椂鑾峰彇鍣ㄥ畼淇℃伅
-        if (this.witnessform.id) {
+        if (this.procureddata[0] && !this.istb) {
           return;
         }
+
         listDonationwitnessorgan(searchParam).then(res => {
           if (res.code == 200) {
             if (res.rows[0]) {
               this.procureddata = res.rows;
-              this.procureddata.infoid = this.infoid;
+              // this.procureddata.infoid = this.infoid;
             } else {
               this.procureddata = this.allocateddata.filter(
-                obj => obj.organname !== "宸﹁倽" && obj.organname !== "鍙宠倽"
+                obj =>
+                  obj.organname !== "宸﹀崐鑲�" &&
+                  obj.organname !== "鍙冲崐鑲�" &&
+                  obj.organname !== "宸﹀鍙�" &&
+                  obj.organname !== "鍙充笁鍙�" &&
+                  obj.organname !== "宸﹁倽" &&
+                  obj.organname !== "鍙宠倽"
               );
-              this.procureddata.infoid = this.infoid;
+              this.procureddata = this.procureddata.map(obj => {
+                obj.id = null;
+                return obj;
+              });
+              // this.procureddata.infoid = this.infoid;
             }
             this.organList.organprocured = [];
             for (let i = 0; i < this.procureddata.length; i++) {
@@ -2925,6 +2944,7 @@
             if (response.data) {
               this.witnessform = response.data;
               this.witnessform.infoid = this.infoid;
+              this.istb = false;
             }
           } else {
             // this.$modal.msgError(
@@ -2934,32 +2954,42 @@
         });
       } else if (this.actives == 6) {
         this.activetele = "瀹屾垚鐧昏";
-        if (this.accomplishform.id) {
+        if (this.transplantdata[0] && !this.istb) {
           return;
         }
 
-        if (!this.organList.organtransplant[0]) {
-          listDonatecomporgan(searchParam).then(res => {
-            if (res.code == 200) {
-              if (res.rows[0]) {
-                this.transplantdata = res.rows;
-                this.transplantdata.infoid = this.infoid;
-              } else {
-                this.transplantdata = this.allocateddata;
-                this.transplantdata.infoid = this.infoid;
-              }
-              for (let i = 0; i < this.transplantdata.length; i++) {
-                this.organList.organtransplant.push(
-                  this.transplantdata[i].organno
-                );
-              }
+        listDonatecomporgan(searchParam).then(res => {
+          if (res.code == 200) {
+            if (res.rows[0]) {
+              this.transplantdata = res.rows;
+              // this.transplantdata.infoid = this.infoid;
             } else {
-              // this.$modal.msgError(
-              //   "鍣ㄥ畼鍒楄〃鑾峰彇澶辫触锛�" + JSON.stringify(resall)
-              // );
+              this.transplantdata = this.allocateddata;
+              this.transplantdata = this.transplantdata.map(obj => {
+                obj.id = null;
+                if (
+                  obj.organname == "宸︾溂瑙掕啘" ||
+                  obj.organname == "鍙崇溂瑙掕啘"
+                ) {
+                  obj.transplantstate = 2;
+                }
+                return obj;
+              });
+
+              this.transplantdata.infoid = this.infoid;
             }
-          });
-        }
+            for (let i = 0; i < this.transplantdata.length; i++) {
+              this.organList.organtransplant.push(
+                this.transplantdata[i].organno
+              );
+            }
+          } else {
+            // this.$modal.msgError(
+            //   "鍣ㄥ畼鍒楄〃鑾峰彇澶辫触锛�" + JSON.stringify(resall)
+            // );
+          }
+        });
+
         // 鑾峰彇瀹屾垚鐧昏淇℃伅
         listDonatecompletioninfo(searchParam).then(response => {
           if (response.code == 200 && response.rows.length) {
@@ -2972,6 +3002,22 @@
       } else if (this.actives == 0) {
         this.activetele = "娼滃湪鎹愮尞";
       }
+      if (!this.allocateddata[0]) {
+        listDonateorgan(searchParam).then(res => {
+          if (res.code == 200) {
+            if (res.rows[0]) {
+              this.allocateddata = res.rows;
+              console.log("this.allocateddata", this.allocateddata);
+              this.allocateddataform.allocateddata = this.allocateddata;
+            }
+            this.organList.organallocated = [];
+            for (let i = 0; i < res.rows.length; i++) {
+              this.organList.organallocated.push(this.allocateddata[i].organno);
+            }
+          } else {
+          }
+        });
+      }
     },
     /** 淇濆瓨涓昏〃鎸夐挳 */
 
@@ -2982,7 +3028,9 @@
           this.form.birthday = this.$moment(this.form.birthday).format(
             "YYYY-MM-DD HH:mm:ss"
           );
+
           this.form.diseasetype = this.form.diseasetype.join(",");
+
           this.form.infectious = this.form.infectious.join(",");
           this.form.selfwill = this.form.selfwill.join(",");
           this.form.othercases = this.form.othercases.join(",");
@@ -3040,7 +3088,9 @@
             }
             updateDonatebaseinfo(this.form).then(response => {
               this.$modal.msgSuccess("淇濆瓨鎴愬姛");
-              Modifydonationattachment(this.donatelist).then(res => {});
+              Modifydonationattachment(this.donatelist).then(res => {
+                this.listDonateannex();
+              });
               this.Getbasicinformation();
               // this.Processvalidation();
               this.open = false;
@@ -3050,7 +3100,9 @@
             addDonatebaseinfo(this.form).then(response => {
               if (response.code == 200) {
                 this.$modal.msgSuccess("鏂板鎴愬姛");
-                Modifydonationattachment(this.donatelist).then(res => {});
+                Modifydonationattachment(this.donatelist).then(res => {
+                  this.listDonateannex();
+                });
                 this.Getbasicinformation();
                 // this.Processvalidation();
                 this.open = false;
@@ -3065,11 +3117,11 @@
     // 淇濆瓨浜岀骇琛ㄦ寜閽�
     Savethedetails() {
       console.log(this.actives);
-      this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
       if (this.actives == 1) {
         this.medicineform.infoid = this.infoid;
         this.$refs["medicineform"].validate(valid => {
           if (valid) {
+            this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
             if (this.medicineform.id != null) {
               updateMedicalevaluation(this.medicineform).then(response => {
                 this.$modal.msgSuccess("鍖诲璇勪及淇℃伅淇敼鎴愬姛");
@@ -3087,8 +3139,10 @@
       } else if (this.actives == 2) {
         this.affirmform.infoid = this.infoid;
         this.affirmform.organdecision = this.organdecision.join(",");
+        this.affirmform.kinship = this.kinship.join(",");
         this.$refs["affirmform"].validate(valid => {
           if (valid) {
+            this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
             if (this.affirmform.id != null) {
               this.affirmform.residenceprovincename = this.defultAddresss.sheng;
               this.affirmform.residencecityname = this.defultAddresss.shi;
@@ -3098,6 +3152,9 @@
                 this.$modal.closeLoading();
               });
             } else {
+              this.affirmform.residenceprovincename = this.defultAddresss.sheng;
+              this.affirmform.residencecityname = this.defultAddresss.shi;
+              this.affirmform.residencetownname = this.defultAddresss.qu;
               addRelativesconfirmation(this.affirmform).then(response => {
                 this.$modal.msgSuccess("鎹愮尞纭淇℃伅鏂板鎴愬姛");
                 this.$modal.closeLoading();
@@ -3110,6 +3167,7 @@
         this.ethicform.infoid = this.infoid;
         this.$refs["ethicform"].validate(valid => {
           if (valid) {
+            this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
             if (this.ethicform.id != null) {
               // updateDonateflowchart(this.ethicform).then(response => {
               updateEthicalreviewopinions(this.ethicform).then(res => {
@@ -3127,27 +3185,20 @@
           }
         });
       } else if (this.actives == 4) {
-        this.procureddata.infoid = this.infoid;
+        // this.procureddata.infoid = this.infoid;
         this.$refs["allocateddataform"].validate(valid => {
-          /**
-          let rows = [];
-          this.allocateddata.map(item => {
-            if (item.id) {
-              item.applicanttime = formatDate(item.applicanttime);
-              updateDonateorgan(item).then(response => { });
-            } else {
-              item.infoid=this.infoid;
-              rows.push(item);
-            }
-          });
-          if (rows.length) {
-            addOrganallocation(rows).then(res => {
-              this.$modal.msgSuccess("鍣ㄥ畼鎹愮尞淇℃伅鏂板鎴愬姛");
-            });
-          }
-           */
+          this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
+
           this.allocateddata.map(item => {
             item.applicanttime = formatDate(item.applicanttime);
+          });
+          this.allocateddata.forEach(item => {
+            const objs = this.dataList.find(
+              obj => obj.organizationid == item.transplanthospitalno
+            );
+            if (objs) {
+              item.transplanthospitalname = objs.organizationname;
+            }
           });
           saveDonateorgan(this.allocateddata).then(res => {
             if (res.code == 200) {
@@ -3168,6 +3219,7 @@
               coordinatedusernameIndex
             ].reportName;
           }
+
           //鍗忚皟鍛�2
           let coordinatedusernametIndex = this.coordinatorlist1.findIndex(
             item => this.witnessform.coordinateduseridt == item.reportNo
@@ -3179,79 +3231,106 @@
           }
 
           if (valid) {
+            this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
+
             if (this.witnessform.id != null) {
               updateDonationwitness(this.witnessform).then(response => {
                 this.$modal.msgSuccess("鑾峰彇瑙佽瘉淇℃伅淇敼鎴愬姛");
-                this.$modal.closeLoading();
+                this.form.donationcategory = this.witnessform.donationcategory;
+                this.Processvalidation();
+
+                this.procureddata.forEach(item => {
+                  const objs = this.dataList.find(
+                    obj => obj.organizationid == item.gainhospitalno
+                  );
+                  if (objs) {
+                    item.gainhospitalname = objs.organizationname;
+                  }
+                });
+                //淇濆瓨鍣ㄥ畼鑾峰彇琛ㄦ暟鎹�
+                saveDonationwitnessorgan(this.procureddata).then(res => {
+                  if (res == 200) {
+                    this.$modal.msgSuccess("鎹愮尞鍣ㄥ畼鑾峰彇淇℃伅淇濆瓨鎴愬姛锛�");
+                  }
+                  this.$modal.closeLoading();
+                });
               });
             } else {
               addDonationwitness(this.witnessform).then(response => {
-                this.$modal.msgSuccess("鑾峰彇瑙佽瘉淇℃伅鏂板鎴愬姛");
-                this.$modal.closeLoading();
+                if (response.code === 200) {
+                  this.$modal.msgSuccess("鑾峰彇瑙佽瘉淇℃伅鏂板鎴愬姛");
+                  this.form.donationcategory = this.witnessform.donationcategory;
+                  let data = JSON.parse(JSON.stringify(this.form));
+                  data.diseasetype = "";
+                  data.infectious = data.infectious.join(",");
+                  data.selfwill = data.selfwill.join(",");
+                  data.othercases = data.othercases.join(",");
+                  data.infosources = data.infosources.join(",");
+                  data.kinship = data.kinship.join(",");
+                  data.patientstate = data.patientstate.join(",");
+                  // 鑾峰彇鎹愮尞缂栧彿
+                  getDonationNumber(data).then(res => {
+                    this.form.donorno = res.msg;
+                    this.istb = true;
+                    this.Processvalidation();
+                  });
+                  //淇濆瓨鍣ㄥ畼鑾峰彇琛ㄦ暟鎹�
+                  saveDonationwitnessorgan(this.procureddata).then(res => {
+                    if (res == 200) {
+                      this.$modal.msgSuccess("鎹愮尞鍣ㄥ畼鑾峰彇淇℃伅淇濆瓨鎴愬姛锛�");
+                    }
+                    this.$modal.closeLoading();
+                  });
+                } else {
+                  this.$modal.msgError("鑾峰彇瑙佽瘉淇℃伅鏂板澶辫触");
+                  this.$modal.closeLoading();
+                }
               });
             }
-
-            //淇濆瓨鍣ㄥ畼鑾峰彇琛ㄦ暟鎹�
-            this.procureddata.infoid = this.infoid;
-            saveDonationwitnessorgan(this.procureddata).then(res => {
-              if (res == 200) {
-                this.$modal.msgSuccess("鎹愮尞鍣ㄥ畼鑾峰彇淇℃伅淇濆瓨鎴愬姛锛�");
-              }
-            });
-
-            this.form.donationcategory = this.witnessform.donationcategory;
-            this.Processvalidation();
           }
         });
       } else if (this.actives == 6) {
         this.accomplishform.infoid = this.infoid;
         this.$refs["accomplishform"].validate(valid => {
           if (valid) {
-            // 淇濆瓨鎹愮尞鍣ㄥ畼绉绘淇℃伅
-            this.transplantdata.infoid = this.infoid;
-            console.log(this.form);
-            this.transplantdata.forEach(item => {
-              listDonorchargeorgan({
-                infoid: item.infoid,
-                organno: item.organno
-              }).then(res => {
-                console.log("aaa");
-                if (res.rows[0]) {
-                  let objfn = res.rows[0];
-                  console.log(objfn, "sass");
+            this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
 
-                  objfn.caseno = item.caseno;
-                  objfn.hospitalno = item.hospitalno;
-                  objfn.name = item.name;
-                  objfn.receiveTime = item.transplanttime;
-                  console.log(objfn, "sass");
-                  updateDonorchargeorgan(objfn).then(res1 => {});
-                } else {
-                  item.id = null;
-                  addDonorchargeorgan(item).then(res2 => {});
-                }
-              });
+            this.transplantdata.forEach(item => {
+              item.donorname = this.form.name;
             });
-            saveDonatecomporgan(this.transplantdata).then(res => {
-              if (res == 200) {
-                this.$modal.msgSuccess("鎹愮尞鍣ㄥ畼鑾峰彇淇℃伅淇濆瓨鎴愬姛锛�");
-              } else {
-                this.$modal.msgSuccess(res.msg);
-                return;
+            this.transplantdata.forEach(item => {
+              const objs = this.dataList.find(
+                obj => obj.organizationid == item.hospitalno
+              );
+              if (objs) {
+                item.hospitalname = objs.organizationname;
               }
             });
-
-            console.log(this.accomplishform.id, "瀹屾垚id");
             // 淇濆瓨纭淇℃伅
             if (this.accomplishform.id) {
               updateDonatecompletioninfo(this.accomplishform).then(response => {
                 this.$modal.msgSuccess("瀹屾垚鐧昏淇℃伅淇敼鎴愬姛");
-                this.$modal.closeLoading();
+                saveDonatecomporgan(this.transplantdata).then(res => {
+                  if (res == 200) {
+                    this.$modal.msgSuccess("鎹愮尞鍣ㄥ畼鐧昏淇℃伅淇濆瓨鎴愬姛锛�");
+                  } else {
+                    this.$modal.msgSuccess(res.msg);
+                  }
+                  this.$modal.closeLoading();
+                });
               });
             } else {
               addDonatecompletioninfo(this.accomplishform).then(response => {
                 this.$modal.msgSuccess("瀹屾垚鐧昏鎴愬姛");
-                this.$modal.closeLoading();
+                saveDonatecomporgan(this.transplantdata).then(res => {
+                  if (res.code == 200) {
+                    this.$modal.msgSuccess("鎹愮尞鍣ㄥ畼鐧昏淇℃伅淇濆瓨鎴愬姛锛�");
+                  } else {
+                    this.$modal.msgError(res.msg);
+                  }
+                  this.$modal.closeLoading();
+                });
+                this.istb = true;
                 // this.$modal
                 //   .confirm("妗堜緥宸插畬鎴愭槸鍚﹁烦杞渚嬭垂鐢ㄩ〉闈㈣繘琛岃垂鐢ㄥ崟淇濆瓨锛�")
                 //   .then(() => {
@@ -3509,8 +3588,8 @@
     },
     // 鏇存敼杩涚▼鏁堥獙
     Processvalidation() {
-      if (this.form.workflow + 1 == this.actives || this.actives == 6) {
-        if (this.form.workflow <= 6) {
+      if (this.form.workflow + 1 == this.actives) {
+        if (this.form.workflow < 6) {
           this.form.workflow++;
         } else {
         }
@@ -3518,8 +3597,7 @@
         // this.GetAttacheddata();
       } else if (this.form.workflow > this.actives) {
         this.submitForm();
-        Modifydonationattachment(this.donatelist).then(res => {});
-        this.listDonateannex();
+        // Modifydonationattachment(this.donatelist).then(res => {});
         // this.GetAttacheddata();
       } else {
         this.submitForm();
@@ -3529,8 +3607,8 @@
     },
     // 鎻愪氦褰掓。
     Reportforreview() {
-      if (this.form.workflow == 9) {
-        this.form.workflow = 8;
+      if (this.form.workflow == 8) {
+        this.form.workflow = 7;
         this.submitForm();
         this.$router.go(-1);
         this.$message({
@@ -3548,7 +3626,7 @@
               if (res.code == 500) {
                 this.$message.error(res.msg);
               } else {
-                this.form.workflow = 9;
+                this.form.workflow = 8;
                 this.submitForm();
                 this.$message({
                   type: "success",
@@ -3843,7 +3921,7 @@
     "sys_0_1",
     "sys_patientstate",
     "sys_DonationCategory",
-    "sys_Kinship",
+    "sys_kinship",
     "sys_Infectious",
     "sys_bloodtype_rhd",
     "sys_InfoSources",
@@ -3855,7 +3933,8 @@
     "sys_CoreAssessConclusion",
     "sys_BaseAssessConclusion",
     "sys_EthicalReview",
-    "materials_DBD"
+    "materials_DBD",
+    "sys_kinshipConfirm"
   ]
 };
 </script>

--
Gitblit v1.9.3