From a520895c5b01934a7210917d52cbe98455cba33b Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期三, 27 十一月 2024 15:15:32 +0800
Subject: [PATCH] 档案页详情优化

---
 src/views/project/donationdetails/index.vue |   12 +++
 dist (2).zip                                |    0 
 src/store/modules/user.js                   |    4 +
 src/components/Address/index.vue            |  126 +++++++++++++++++++++++++-----------------
 src/store/getters.js                        |    1 
 src/views/project/indexstatistics/index.vue |   17 +++++
 6 files changed, 108 insertions(+), 52 deletions(-)

diff --git "a/dist \0502\051.zip" "b/dist \0502\051.zip"
new file mode 100644
index 0000000..1a618c5
--- /dev/null
+++ "b/dist \0502\051.zip"
Binary files differ
diff --git a/src/components/Address/index.vue b/src/components/Address/index.vue
index 4056a0c..a26d5b4 100644
--- a/src/components/Address/index.vue
+++ b/src/components/Address/index.vue
@@ -50,18 +50,20 @@
 
 <script>
 // 浣跨敤璇存槑锛歷-model鏃讹紝蹇呴』浼犲甫鏈夊甫鏈夌渷锛屽競锛屽尯鎷奸煶鐨勫瓧娈�
-import request from '@/utils/request'
+import request from "@/utils/request";
+import store from "@/store";
+
 export default {
   name: "li_area_select",
   //閫氳繃 model 閫夐」閰嶇疆瀛愮粍浠舵帴鏀剁殑 prop 鍚嶄互鍙婃淳鍙戠殑浜嬩欢鍚�
   model: {
     prop: "caddress",
-    event: "change",
+    event: "change"
   },
   props: {
     caddress: {
-      type: Object,
-    },
+      type: Object
+    }
   },
   data() {
     return {
@@ -69,7 +71,7 @@
       //areaJson: './../address.json',
       addressArray: [], //鎵�鏈夋暟鎹�
       cityArray: [],
-      areaArray: [],
+      areaArray: []
     };
   },
   created() {
@@ -78,34 +80,58 @@
   methods: {
     getAddressData() {
       var that = this;
-      request({
-        url: that.areaJson,
-        method: "get",
-      }).then(function (response) {
-        if (response.code === 200) {
-          //鑾峰彇鍦板潃
+      console.log(store.getters.addressArray,'addressArray');
 
-          that.addressArray = response.data;
-          //榛樿鍊艰祴鍊艰幏鍙栧煄甯傛暟缁�
-          if (that.caddress.sheng) {
-            for (let ad of that.addressArray) {
-              if (ad.areaname === that.caddress.sheng) {
-                that.cityArray = ad.subarea;
-                //---
-                //榛樿璧嬪�艰幏鍙栧尯鍩熸暟缁�
-                if (that.caddress.shi) {
-                  for (let area of that.cityArray) {
-                    if (area.areaname === that.caddress.shi) {
-                      that.areaArray = area.subarea;
-                      break;
-                    }
+      if (store.getters.addressArray.length) {
+        that.addressArray = store.getters.addressArray.length;
+        //榛樿鍊艰祴鍊艰幏鍙栧煄甯傛暟缁�
+        if (that.caddress.sheng) {
+          for (let ad of that.addressArray) {
+            if (ad.areaname === that.caddress.sheng) {
+              that.cityArray = ad.subarea;
+              //---
+              //榛樿璧嬪�艰幏鍙栧尯鍩熸暟缁�
+              if (that.caddress.shi) {
+                for (let area of that.cityArray) {
+                  if (area.areaname === that.caddress.shi) {
+                    that.areaArray = area.subarea;
+                    break;
                   }
                 }
               }
             }
           }
         }
-      });
+      } else {
+        request({
+          url: that.areaJson,
+          method: "get"
+        }).then(function(response) {
+          if (response.code === 200) {
+            //鑾峰彇鍦板潃
+
+            that.addressArray = response.data;
+            //榛樿鍊艰祴鍊艰幏鍙栧煄甯傛暟缁�
+            if (that.caddress.sheng) {
+              for (let ad of that.addressArray) {
+                if (ad.areaname === that.caddress.sheng) {
+                  that.cityArray = ad.subarea;
+                  //---
+                  //榛樿璧嬪�艰幏鍙栧尯鍩熸暟缁�
+                  if (that.caddress.shi) {
+                    for (let area of that.cityArray) {
+                      if (area.areaname === that.caddress.shi) {
+                        that.areaArray = area.subarea;
+                        break;
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        });
+      }
     },
     //閫夋嫨鐪佷唤
     getCityData(val) {
@@ -137,41 +163,39 @@
       this.$forceUpdate();
     },
 
-    getSheng(){
-      let list= this.addressArray.filter(r=>r.areaname ==  this.caddress.sheng);
-      if(list.length>0){
+    getSheng() {
+      let list = this.addressArray.filter(
+        r => r.areaname == this.caddress.sheng
+      );
+      if (list.length > 0) {
         return list[0].areacode;
-      }
-      else{
-        return '';
+      } else {
+        return "";
       }
     },
-     getShi(){
-      let list= this.cityArray.filter(r=>r.areaname ==  this.caddress.shi);
-      if(list.length>0){
+    getShi() {
+      let list = this.cityArray.filter(r => r.areaname == this.caddress.shi);
+      if (list.length > 0) {
         return list[0].areacode;
-      }
-      else{
-        return '';
+      } else {
+        return "";
       }
     },
-     getQu(){
-      let list= this.areaArray.filter(r=>r.areaname ==  this.caddress.qu);
-      if(list.length>0){
+    getQu() {
+      let list = this.areaArray.filter(r => r.areaname == this.caddress.qu);
+      if (list.length > 0) {
         return list[0].areacode;
+      } else {
+        return "";
       }
-      else{
-        return '';
-      } 
     },
-    clean(){
-      this.caddress.sheng="";
-      this.caddress.shi="";
-      this.caddress.qu="";
+    clean() {
+      this.caddress.sheng = "";
+      this.caddress.shi = "";
+      this.caddress.qu = "";
     }
-  },
+  }
 };
 </script>
 
-<style scoped>
-</style>
\ No newline at end of file
+<style scoped></style>
diff --git a/src/store/getters.js b/src/store/getters.js
index 7650799..90c8d4e 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -6,6 +6,7 @@
   cachedViews: state => state.tagsView.cachedViews,
   token: state => state.user.token,
   avatar: state => state.user.avatar,
+  addressArray: state => state.user.addressArray,
   name: state => state.user.name,
   organization: state => state.user.organization,
   introduction: state => state.user.introduction,
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index efaed5b..f0c77c0 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -15,6 +15,7 @@
     roles: [],
     permissions: [],
     organization:[],
+    addressArray:[],
   },
 
   mutations: {
@@ -36,6 +37,9 @@
     SET_ROLES: (state, roles) => {
       state.roles = roles
     },
+     SET_addressArray: (state, addressArray) => {
+      state.addressArray = addressArray
+    },
     SET_PERMISSIONS: (state, permissions) => {
       state.permissions = permissions
     },
diff --git a/src/views/project/donationdetails/index.vue b/src/views/project/donationdetails/index.vue
index e15b466..97b9aff 100644
--- a/src/views/project/donationdetails/index.vue
+++ b/src/views/project/donationdetails/index.vue
@@ -2024,7 +2024,7 @@
                     align="center"
                     width="220"
                     prop="hospitalno"
-                    v-if="actives == 6"
+
                   >
                     <template slot-scope="scope">
                       <org-selecter
@@ -2796,6 +2796,7 @@
         }
       });
 
+
       // 琛ㄥ崟鏁版嵁
       getDonatebaseinfo(this.infoid).then(response => {
         this.form = response.data;
@@ -2804,10 +2805,14 @@
         } else {
           this.showTerminationBtn = 0;
         }
+
+
         this.actives = response.data.workflow;
         this.workflow = response.data.workflow;
         response.data.sex = parseInt(response.data.sex);
         this.form.id = response.data.id;
+
+
         this.form.diseasetype = this.form.diseasetype.split(",");
         this.form.infectious = this.form.infectious.split(",");
         this.form.selfwill = this.form.selfwill.split(",");
@@ -2815,6 +2820,8 @@
         this.form.infosources = this.form.infosources.split(",");
         this.form.kinship = this.form.kinship.split(",");
         this.form.patientstate = this.form.patientstate.split(",");
+
+
         this.open = true;
         this.title = "浜轰綋鍣ㄥ畼娼滃湪鎹愮尞鑰呯櫥璁拌〃";
         this.registerAddresss.sheng = response.data.registerprovincename;
@@ -2823,6 +2830,8 @@
         this.residenceAddresss.shi = response.data.residencecityname;
         this.residenceAddresss.qu = response.data.residencetownname;
         this.registerAddresss.qu = response.data.registertownname;
+
+
         // 鑾峰彇浜岀骇琛�
         this.GetAttacheddata();
       });
@@ -2958,6 +2967,7 @@
         if (this.transplantdata[0] && !this.istb) {
           return;
         }
+        console.log("瀹屾垚鐧昏");
 
         listDonatecomporgan(searchParam).then(res => {
           if (res.code == 200) {
diff --git a/src/views/project/indexstatistics/index.vue b/src/views/project/indexstatistics/index.vue
index 9cdce92..fc284ba 100644
--- a/src/views/project/indexstatistics/index.vue
+++ b/src/views/project/indexstatistics/index.vue
@@ -602,6 +602,7 @@
 import { listOrganallocation } from "@/api/project/organallocation";
 
 import RankChart from "./components/rankbarchart";
+import request from '@/utils/request'
 import OrganNumChart from "./components/organnumchart";
 import { listDonatebaseinfo } from "@/api/project/donatebaseinfo";
 import dayjs from "dayjs";
@@ -649,6 +650,7 @@
       year: "閫夋嫨骞翠唤",
       isloading: false,
       maxHeight: 0,
+      areaJson: "/project/dict/treeselect", // 鎻愬墠瀛樺偍鍦板潃鏁版嵁鎺ュ彛
       CommonOrgan: null,
       provinceData: [
         { label: "鍏ㄩ儴鍦板競", value: "" },
@@ -914,6 +916,7 @@
       this.value = "鏉窞甯�";
       this.GetOrgDonateNumNew();
       this.GetOrgDonateNum();
+      this.getAddressData();
     });
   },
   methods: {
@@ -938,6 +941,20 @@
         }
       });
     },
+    // 鎻愬墠缂撳瓨鏁版嵁
+    getAddressData() {
+      var that = this;
+      request({
+        url: that.areaJson,
+        method: "get",
+      }).then(function (response) {
+        if (response.code === 200) {
+          //鑾峰彇鍦板潃
+          let addressArray = response.data;
+          this.$store.commit('updateMyData', addressArray);
+        }
+      });
+    },
     // 纭畾宸茶
     clickMessageDetailed(item) {
       let data = item;

--
Gitblit v1.9.3