浏览代码

Merge branch 'master' of http://114.244.114.158:8802/siwei/real3d-portalsite

wanger 1 年之前
父节点
当前提交
6e3bf1e5ff
共有 2 个文件被更改,包括 51 次插入16 次删除
  1. 8 4
      src/store/store.js
  2. 43 12
      src/views/cockpit/hysy.vue

+ 8 - 4
src/store/store.js

@@ -61,12 +61,16 @@ var store2 = {
         },
         cockpit_hysy: {//海域使用
             info: {
-                jh_mj:0,//计划出让海域
-                sj_number:0,//实际出让海域面积
-                jh_number:0,//计划出让项目
-                sj_mj:0,//完成出让海域面积
+                jh_mj: 0,//计划出让海域
+                sj_number: 0,//实际出让海域面积
+                jh_number: 0,//计划出让项目
+                sj_mj: 0,//完成出让海域面积
 
             },
+            echart: {
+                xdata: [],
+                result: [],
+            }
         },
         regional_information: {
             id: 4602,

+ 43 - 12
src/views/cockpit/hysy.vue

@@ -70,12 +70,8 @@ export default {
             var myChart = window.echarts.init(dom);
             // Mock数据
             const mockData = {
-                xdata: ['渔业用海', '工业用海', '交通运输用海', '旅游娱乐用海', '海底工程用海', '排污倾倒用海', '造地工程用海', '特殊用海', '其它用海'],
-
-                result: [
-                    { name: '计划出让', data: [...new Array(33)].map((item, i) => +(Math.random(0, 10) * 1000).toFixed(0)) },
-                    { name: '完成出让', data: [...new Array(33)].map((item, i) => +(Math.random(0, 0.5) * 1000).toFixed(0)) },
-                ]
+                xdata: store.state.cockpit_hysy.echart.xdata,
+                result: store.state.cockpit_hysy.echart.result
             }
 
             const color = [
@@ -141,10 +137,10 @@ export default {
                 axisLine: { show: false },
                 axisTick: { show: false },
             }]
-            const diamondData = mockData.result.reduce((pre, cur, index) => {
-                pre[index] = cur.data.map((el, id) => el + (pre[index - 1] ? pre[index - 1][id] : 0))
-                return pre
-            }, [])
+            // const diamondData = mockData.result.reduce((pre, cur, index) => {
+            //     pre[index] = cur.data.map((el, id) => el + (pre[index - 1] ? pre[index - 1][id] : 0))
+            //     return pre
+            // }, [])
 
             let series = mockData.result.reduce((p, c, i, array) => {
                 p.push({
@@ -163,7 +159,7 @@ export default {
                     symbol: 'diamond',
                     symbolOffset: [0, '-50%'],
                     symbolSize: [18, 12],
-                    data: diamondData[i],
+                    data: mockData.result[i],
                     itemStyle: { color: color2[i] },
                     tooltip: { show: false },
                 })
@@ -411,15 +407,50 @@ export default {
             };
             let data = await QueryList(obj);
             store.state.cockpit_hysy.info = data.data[0]
+        },
+        async init_echart_data(params) {
+            const that = this;
+            let obj = {
+                jscType: 'jsc_hysyq_yelx',
+                beginTime: params ? params.beginTime : store.state.cockpit_date[0],
+                endTime: params ? params.endTime : store.state.cockpit_date[1],
+                id: params ? params.id : '4602'
+            };
+            let data = await QueryList(obj);
+            console.log('data: ', data);
+
+            let xdata = [];
+            let result = [
+                {
+                    name: "计划出让",
+                    data: []
+                },
+                {
+                    name: "完成出让",
+                    data: []
+                }
+            ];
+            data.data.forEach((res) => {
+                xdata.push(res.yhlx_name);
+                result[0].data.push(res.jh_mj);
+                result[1].data.push(res.sj_mj);
+
+            })
+
+            store.state.cockpit_hysy.echart.xdata = xdata
+            store.state.cockpit_hysy.echart.result = result
+            that.init_hysyEchart();
+
         }
     },
     mounted() {
         const that = this;
         this.$nextTick((res) => {
-            that.init_hysyEchart();
             that.init_dial_watch_hysy();
 
             this.init_info();
+            this.init_echart_data();
+
         })
     },
     beforeUpdate() { }, //生命周期 - 更新之前