From db5aed78bc305815558e97f9a1110cc2fa993bc9 Mon Sep 17 00:00:00 2001
From: TreeWish <1131093754@qq.com>
Date: 星期二, 28 二月 2023 22:11:57 +0800
Subject: [PATCH] 处理全国项目&单个项目数据

---
 src/components/Screen/bottom.vue             |    2 
 src/components/chart/projectintroduction.vue |   18 ++++++---
 src/components/chart/BaseLineChart.vue       |   30 ++++++++++----
 src/api/screen.js                            |   16 ++++++++
 src/components/Screen/right.vue              |   53 ++++++++++++++++++++------
 5 files changed, 91 insertions(+), 28 deletions(-)

diff --git a/src/api/screen.js b/src/api/screen.js
index d01f1a2..00363e6 100644
--- a/src/api/screen.js
+++ b/src/api/screen.js
@@ -87,3 +87,19 @@
 export function selectProjectInfo(params) {
   return request.get("/oneMap/selectProjectInfo", { params: params })
 }
+// 鍗曚釜椤圭洰鏁版嵁鏉戞暟閲�
+export function countStorageByProject(params) {
+  return request.get("/oneMap/countStorageByProject", { params: params })
+}
+
+// 鍏ㄧ悆銆佸叏鍥介」鐩�
+// 鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟
+export function countProjectTypeNumber(params) {
+  return request.get("/oneMap/countProjectTypeNumber", { params: params })
+}
+
+// 涓嬭浇閲忕粺璁�
+
+export function countDownloads(params) {
+  return request.get("/oneMap/countDownloads", { params: params })
+}
diff --git a/src/components/Screen/bottom.vue b/src/components/Screen/bottom.vue
index 2e2d4e7..216c9db 100644
--- a/src/components/Screen/bottom.vue
+++ b/src/components/Screen/bottom.vue
@@ -242,7 +242,7 @@
           this.showPathLine(child)
           break
         case "椤圭洰灞曠ず":
-          // this.DisplayCurrentProject(child)
+          this.DisplayCurrentProject(child)
           this.changeProject(child)
           this.$bus.$emit("changeProjectCode", child.id)
 
diff --git a/src/components/Screen/right.vue b/src/components/Screen/right.vue
index 1dc7ac9..4ecbb25 100644
--- a/src/components/Screen/right.vue
+++ b/src/components/Screen/right.vue
@@ -19,7 +19,10 @@
       <div class="current1">
         <div class="aside-title"></div>
         <!-- <country-dimension-bar ref="barRef"></country-dimension-bar> -->
-        <base-bar-chart title="椤圭洰涓暟" :project="currentProject"></base-bar-chart>
+        <base-bar-chart
+          title="椤圭洰涓暟"
+          :project="currentProject"
+        ></base-bar-chart>
       </div>
       <div class="current1">
         <div class="aside-title">椤圭洰楗肩姸鍥�</div>
@@ -31,7 +34,7 @@
         <province-dimension-pie v-else ref="pieRef"></province-dimension-pie>
       </div>
       <div class="current1">
-        <div class="aside-title">椤圭洰鏁版嵁浣跨敤鎯呭喌</div>
+        <div class="aside-title">鏁版嵁浣跨敤鎯呭喌</div>
         <dv-capsule-chart
           :config="barConfig"
           style="width: 360px; height: 85%"
@@ -43,7 +46,10 @@
       <div class="current1">
         <div class="aside-title">绔欏満搴ф暟</div>
         <!-- <country-dimension-bar ref="barRef"></country-dimension-bar> -->
-        <base-bar-chart title="绔欏満搴ф暟" :project="currentProject"></base-bar-chart>
+        <base-bar-chart
+          title="绔欏満搴ф暟"
+          :project="currentProject"
+        ></base-bar-chart>
       </div>
       <div class="current1">
         <div class="aside-title">闃�瀹ゅ骇鏁�</div>
@@ -53,7 +59,7 @@
         />
       </div>
       <div class="current1">
-        <div class="aside-title">涓嶅悓杈撻�佷粙璐ㄧ閬撴潯鏁�</div>
+        <div class="aside-title">绠¢亾鏉℃暟</div>
         <dv-conical-column-chart
           :config="config"
           style="width: 377px; height: 85%"
@@ -64,14 +70,22 @@
     <div class="rightContainer" v-if="currentDisplay == '宸ョ▼'">
       <div class="current1">
         <div class="aside-title">鏁版嵁瀛樺偍閲�</div>
-        <base-line-chart title="鏁版嵁瀛樺偍閲�" :project="currentProject" :params="params"></base-line-chart>
+        <base-line-chart
+          title="鏁版嵁瀛樺偍閲�"
+          :project="currentProject"
+          :params="params"
+        ></base-line-chart>
       </div>
       <div class="current1">
         <div class="aside-title">鏁版嵁涓嬭浇娆℃暟</div>
-        <base-pie-chart height="90%" :project="currentProject" :params="params"></base-pie-chart>
+        <base-pie-chart
+          height="90%"
+          :project="currentProject"
+          :params="params"
+        ></base-pie-chart>
       </div>
       <div class="current1">
-        <div class="aside-title">缁熻涓嶅悓杈撻�佷粙璐ㄧ閬撴潯鏁�</div>
+        <div class="aside-title">绠¢亾鏉℃暟</div>
         <div class="content" style="height: 30px">
           <div class="header">
             <div>鏍煎紡</div>
@@ -107,6 +121,7 @@
   countCountryDimension,
   countProvinceDimension,
   countZhPipeStations,
+  countDownloads,
 } from "@/api/screen.js"
 
 export default {
@@ -212,11 +227,12 @@
         ],
         showValue: true,
       },
-      params: {}
+      params: {},
     }
   },
   created() {
     this.getZhPipeStations()
+    this.getCountDownloads()
   },
   mounted() {
     this.OpenLeftInit()
@@ -230,14 +246,13 @@
       }
       this.currentProject = name
     })
-    this.$bus.$on('changeProjectCode', code => {
+    this.$bus.$on("changeProjectCode", code => {
       this.params = {
-        projectCode: code
+        projectCode: code,
       }
     })
-    
   },
-  
+
   methods: {
     ChangeRight() {
       if (this.leftMessage == "init") {
@@ -303,6 +318,20 @@
         }
       }
     },
+    async getCountDownloads() {
+      const res = await countDownloads()
+      if (res.code == 200) {
+        this.barConfig.data = res.result.map(item => {
+          return {
+            name: item.typename,
+            value: item.count,
+          }
+        })
+        this.barConfig = {
+          ...this.barConfig,
+        }
+      }
+    },
   },
 }
 </script>
diff --git a/src/components/chart/BaseLineChart.vue b/src/components/chart/BaseLineChart.vue
index fb37072..6cf4063 100644
--- a/src/components/chart/BaseLineChart.vue
+++ b/src/components/chart/BaseLineChart.vue
@@ -11,7 +11,9 @@
   countZhPipeMapLength,
   countLargeCategories,
   countProjectType,
-  countProjectDown
+  countProjectDown,
+  countProjectTypeNumber,
+  countStorageByProject,
 } from "@/api/screen.js"
 export default {
   props: {
@@ -62,11 +64,21 @@
     option() {
       let xAxis = []
       let yAxis = []
-
-      this.dataList.forEach(item => {
-        xAxis.push(item.type)
-        yAxis.push(item.count)
-      })
+      const proObj = this.dataList.find(item => item.椤圭洰鍚嶇О == this.project)
+      if (proObj) {
+        Object.keys(proObj).forEach(item => {
+          if (item.toString() != '椤圭洰鍚嶇О') {
+            xAxis.push(item)
+            yAxis.push(proObj[item])
+          }
+        })
+      } else {
+        this.dataList.forEach(item => {
+          let type = item.type || item.projtype
+          xAxis.push(type)
+          yAxis.push(item.count)
+        })
+      }
 
       // let data = [220, 182, 191, 234, 290, 330, 310]
       // const sideData = data.map(item => {
@@ -164,10 +176,10 @@
         let requsetFn = null
         switch (newVal) {
           case "鍏ㄧ悆椤圭洰":
-            requsetFn = countLargeCategories
+            requsetFn = countProjectTypeNumber
             break
           case "鍏ㄥ浗椤圭洰":
-            requsetFn = countLargeCategories
+            requsetFn = countProjectTypeNumber
             break
           case "鍏ㄧ悆绠$綉鍥�":
             requsetFn = countZhPipeMapLength
@@ -176,7 +188,7 @@
             requsetFn = countZhPipeMapLength
             break
           default:
-            requsetFn = GetServicesVisitsCount
+            requsetFn = countStorageByProject
 
             break
         }
diff --git a/src/components/chart/projectintroduction.vue b/src/components/chart/projectintroduction.vue
index 87cf7ba..5e9c81c 100644
--- a/src/components/chart/projectintroduction.vue
+++ b/src/components/chart/projectintroduction.vue
@@ -2,11 +2,11 @@
   <div class="projectintroduction">
     <div class="item">
       <div class="itemName">椤圭洰鍚嶇О:</div>
-      <div class="itemValue" :title="result.projname">
+      <div class="itemValue" :title="projname">
         {{
-          result.projname.length > 15
-            ? result.projname.substring(0, 15)
-            : result.projname
+          projname.length > 15
+            ? projname.substring(0, 15)
+            : projname
         }}
       </div>
     </div>
@@ -30,7 +30,7 @@
       <div class="itemName">宸ョ▼鍐呭:</div>
       <div class="itemValue">
         {{
-          result.contents.length > 15
+          result.contents && result.contents.length > 15
             ? result.contents.substring(0, 15)
             : result.contents
         }}
@@ -69,6 +69,7 @@
         remarks: "娴嬭瘯鐢紝鍐呭铏氭瀯",
         updateuser: 1,
       },
+      projname: "瑗挎皵涓滆緭涓夌嚎锛堜腑鍗�-鏋i槼锛�",
     }
   },
   created() {
@@ -78,12 +79,17 @@
       }
       this.getDataList(params)
     })
+    this.$bus.$on("changeProject", name => {
+      this.projname = name
+    })
   },
   methods: {
     async getDataList(params) {
       const res = await selectProjectInfo(params)
       if (res.code == 200) {
-        this.result = res.result
+        if (res.result.length > 0) {
+          this.result = res.result[0]
+        }
       }
     },
     //鑾峰彇鏃堕棿

--
Gitblit v1.9.3