gr 1 gadu atpakaļ
vecāks
revīzija
db7711641b

+ 8 - 6
src/echarts/options.js

@@ -185,6 +185,7 @@ export function setTdfbqk(ele, dataIn) {
 	if (tdfbqk) {
 		tdfbqk.dispose()
 	}
+	dataIn = dataIn.sort((a,b)=>b.value-a.value)
 
 	let name = []; let value = [];
 	dataIn.forEach(i => {
@@ -392,6 +393,7 @@ export function setSqhd(ele, dataIn) {
 
 let nyxz = null
 export function setNyxz(ele, dataIn) {
+	console.log(dataIn)
 	if (nyxz) {
 		nyxz.dispose()
 	}
@@ -427,11 +429,11 @@ export function setNyxz(ele, dataIn) {
 				icon: "circle",
 				x: "left",
 				y: 'center',
-				itemGap: nowSize(70),
+				itemGap: nowSize(40),
 				data: legendData.slice(0,3),
 				formatter: function (params) {
 					let val = data.find(i=>i.name===params).value
-					return "{title|"+params + "}\t\n{value|"+ val +"}{unit|万亩 / }{value|" + Math.round((val / total) * 100) + "%}"
+					return "{title|"+params + "}\t\n{value|"+ val +"}{unit|万亩\t\n}{value|" + ((val / total) * 100).toFixed(2) + "%}"
 				},
 				textStyle: {
 					rich: {
@@ -459,11 +461,11 @@ export function setNyxz(ele, dataIn) {
 				icon: "circle",
 				x: "right",
 				y: 'center',
-				itemGap: nowSize(70),
+				itemGap: nowSize(40),
 				data: legendData.slice(3),
 				formatter: function (params) {
 					let val = data.find(i=>i.name===params).value
-					return "{title|"+params + "}\t\n{value|"+ val +"}{unit|万亩 / }{value|" + Math.round((val / total) * 100) + "%}"
+					return "{title|"+params + "}\t\n{value|"+ val +"}{unit|万亩\t\n}{value|" + ((val / total) * 100).toFixed(2) + "%}"
 				},
 				textStyle: {
 					rich: {
@@ -644,7 +646,7 @@ export function setYjjbnt(ele, dataIn) {
 					}
 				})
 				return (
-					"{title|" + params + "}{value|" + parseInt((dataIn[dataIndex].value) / total * 100) + "%}{value|" + dataIn[dataIndex].value + "}" + "{unit|万亩}"
+					"{title|" + params + "}{value|" + ((dataIn[dataIndex].value) / total * 100).toFixed(1) + "%}{value|" + dataIn[dataIndex].value + "}" + "{unit|万亩}"
 				);
 			},
 			left: '36%',
@@ -667,7 +669,7 @@ export function setYjjbnt(ele, dataIn) {
 					unit: {
 						fontSize: nowSize(20),
 						color: "#fff",
-						padding: [0, 0, 0, 5]
+						padding: [5, 0, 0, 9]
 					},
 				}
 			},

+ 1 - 1
src/services/ztgl.js

@@ -3,7 +3,7 @@ import { service_city as requestCity } from './index'
 //  农用现状
 export function GetAgriculturalLand() {
   return requestCity({
-    url: `/getAgriculturalLand?quxian=崇明区`,
+    url: `/getAgriculturalLand?region=崇明区`,
     method: "get",
   })
 }

+ 42 - 28
src/views/deck/pages/Page_nyxz.vue

@@ -103,20 +103,20 @@ export default {
         { title: '地块总数', value: '0', unit: '块', updateTime: '', img: require('@/assets/imgs/deck/page_nygh/icon-dkzs.png') },
       ],
       chartData_tdfb: [
-        { name: '粮田', value: '256' },
-        { name: '果园', value: '229' },
-        { name: '菜田', value: '201' },
-        { name: '经作田', value: '172' },
-        { name: '养殖(畜牧)', value: '143' },
-        { name: '养殖(水产)', value: '126' },
+        { name: '粮田', value: '0' },
+        { name: '果园', value: '0' },
+        { name: '菜田', value: '0' },
+        { name: '经作田', value: '0' },
+        { name: '养殖(畜牧)', value: '0' },
+        { name: '养殖(水产)', value: '0' },
       ],
       data_tdlxtj: [
-        { type: '粮田', typeColor: '#D97E00', count: '35589', area: '35589' },
-        { type: '果园', typeColor: '#969600', count: '74543', area: '74543' },
-        { type: '菜田', typeColor: '#D5848B', count: '4283',  area: '4283' },
-        { type: '经作田', typeColor: '#980220', count: '20170', area: '20170' },
-        { type: '养殖(畜牧)', typeColor: '#E8B707', count: '270', area: '270' },
-        { type: '养殖(水产)', typeColor: '#6697FE', count: '13401', area: '13401' },
+        { type: '粮田', typeColor: '#D97E00', count: '0', area: '0' },
+        { type: '果园', typeColor: '#969600', count: '0', area: '0' },
+        { type: '菜田', typeColor: '#D5848B', count: '0',  area: '0' },
+        { type: '经作田', typeColor: '#980220', count: '0', area: '0' },
+        { type: '养殖(畜牧)', typeColor: '#E8B707', count: '0', area: '0' },
+        { type: '养殖(水产)', typeColor: '#6697FE', count: '0', area: '0' },
       ],
       currentSearchI:'dmdz',
       currentSearchKeyWord:'',
@@ -131,27 +131,41 @@ export default {
     }
   },
   mounted() {
-    GetAgriculturalLand().then(res => {
-      let areaTotal = 0
-      let count = 0
-      res.data.Result.forEach(i => {
-        areaTotal += i.areamu
-        count += i.count
-      })
-      areaTotal = (areaTotal/10000).toFixed(2)
-      this.data_nyscyd[0].value = areaTotal
-      this.data_nyscyd[1].value = count
-    })
-    GetLandSta('粮田').then(res => {
-      console.log(res)
-    })
   },
   watch: {
     showRight: {
       handler(val) {
         if(val) {
-          this.$nextTick(()=> {
-            setTdfbqk(document.getElementById('chart-crb2'), this.chartData_tdfb)
+          GetAgriculturalLand().then(res => {
+            let areaTotal = 0
+            let count = 0
+            res.data.Result.forEach(i => {
+              areaTotal += i.areamu
+              count += i.count
+            })
+            areaTotal = (areaTotal/10000).toFixed(2)
+            this.data_nyscyd[0].value = areaTotal
+            this.data_nyscyd[1].value = count
+          })
+          GetLandSta().then(res => {
+            this.data_tdlxtj.forEach(i => {
+              res.data.find(j => {
+                if(i.type===j.landType) {
+                  i.count = j.landCnt
+                  i.area = j.landAreaMu.toFixed(2)
+                }
+              })
+            })
+            this.chartData_tdfb.forEach(i => {
+              res.data.find(j => {
+                if(i.name===j.landType) {
+                  i.value = Math.round(j.landAreaMu*10000)
+                }
+              })
+            })
+            this.$nextTick(()=> {
+              setTdfbqk(document.getElementById('chart-crb2'), this.chartData_tdfb)
+            })
           })
         }
       },

+ 1 - 1
src/views/deck/pages/Page_ztgl.vue

@@ -196,7 +196,7 @@ export default {
         let landTypeCn = landTypeMap.get(i.landtype)
         if(landTypeCn&&['粮田','果园','菜田','养殖(水产)','养殖(畜牧)','经作田'].includes(landTypeCn)) {
         // if(landTypeCn) {
-          this.data_nyxz.push({ name: landTypeMap.get(i.landtype), value: Math.round(i.areamu/10000)})
+          this.data_nyxz.push({ name: landTypeMap.get(i.landtype), value: Number((i.areamu/10000).toFixed(2))})
         }
       })
       setNyxz(document.getElementById('chart-clb1'), this.data_nyxz)