zpf 1 anno fa
parent
commit
86acca18b3
2 ha cambiato i file con 27 aggiunte e 16 eliminazioni
  1. 12 6
      src/views/cockpitNew1/hysy.vue
  2. 15 10
      src/views/viewer.vue

+ 12 - 6
src/views/cockpitNew1/hysy.vue

@@ -66,8 +66,7 @@ export default {
     //方法集合
     beforeCreate() { }, //生命周期 - 创建之前
     created() {
-        this.label_data();
-        this.echart_data();
+
     }, //生命周期 - 创建完成(可以访问当前this实例)
     beforeMount() { }, //生命周期 - 挂载之前
     methods: {
@@ -341,9 +340,11 @@ export default {
         },
         async label_data() {
             const that = this;
+            console.log(store.state.cockpit_date, "store.state.cockpit_date");
+
             let obj = {
-                beginTime: '20240101',
-                endTime: '20240501',
+                beginTime: store.state.cockpit_date[0],
+                endTime: store.state.cockpit_date[1],
                 jscType: 'jsc_hysyq_ztsh',
                 id: '4602'
             };
@@ -358,8 +359,8 @@ export default {
         async echart_data() {
             const that = this;
             let obj = {
-                beginTime: '20240101',
-                endTime: '20240601',
+                beginTime: store.state.cockpit_date[0],
+                endTime: store.state.cockpit_date[1],
                 jscType: 'jsc_hysyq_yelx',
                 id: '4602'
             }
@@ -382,6 +383,11 @@ export default {
         }
     },
     mounted() {
+        const that = this;
+        this.$nextTick((res) => {
+            that.label_data();
+            that.echart_data();
+        })
     },
     beforeUpdate() { }, //生命周期 - 更新之前
     updated() { }, //生命周期 - 更新之后

+ 15 - 10
src/views/viewer.vue

@@ -53,7 +53,7 @@ export default {
         switch() {
             this.flag = !this.flag;
         },
-        setDatas(){
+        setDatas() {
             this.$refs.gdbh_ref.setData({ id: this.params.id });
             this.$refs.gdbh_ref.setData({ id: this.params.id });
             this.$refs.wpjg_ref.setData(this.params);
@@ -66,8 +66,8 @@ export default {
         async hysyq(address) {
             // 选中xzqh查询
             let obj = {
-                beginTime: '20240101',
-                endTime: '20240501',
+                beginTime: store.state.cockpit_date[0],
+                endTime: store.state.cockpit_date[1],
                 jscType: 'jsc_hysyq_ztsh',
                 id: address
             };
@@ -75,17 +75,16 @@ export default {
 
             let obg_text = {
                 xzqhdm_number: data.data[0].xzqhdm_number,
-                zhmj: data.data[0].zhmj,
+                zhmj: data.data[0].zhmj == undefined ? 0 : data.data[0].zhmj,
 
             }
-            console.log(obg_text, "obg_echart");
-
+            obg_text.zhmj == null ? 0 : obg_text.zhmj;
             store.setCockpitHysyText(obg_text);
 
             // 图表数据
             let obj_echart = {
-                beginTime: '20240101',
-                endTime: '20240501',
+                beginTime: store.state.cockpit_date[0],
+                endTime: store.state.cockpit_date[1],
                 jscType: 'jsc_hysyq_yelx',
                 id: address
             };
@@ -96,6 +95,12 @@ export default {
                 bar: data_echart.data.map(item => item.zhmj)
 
             }
+            console.log(obg_echart.x.length == 0, "obg_echart.x.length");
+
+            obg_echart.x.length == 0 ? obg_echart.x = ['渔业基础设施用海', '开放式养殖用海', '旅游基础设施用海', '浴场用海',
+                '游乐场用海'] : obg_echart.x = obg_echart.x;
+
+            obg_echart.bar.length == 0 ? obg_echart.bar = [0, 0, 0, 0, 0,] : obg_echart.bar = obg_echart.bar;
 
             store.setCockpitHysyEchart(obg_echart);
 
@@ -262,9 +267,9 @@ export default {
                         material: Cesium.Color.fromCssColorString(that.xzqh_color),
                         height: 100,
                         extrudedHeight: 450,
-                        outline : true,
+                        outline: true,
                         // outlineColor : Cesium.Color.BLACK
-                        outlineColor : Cesium.Color.fromCssColorString('#55A1E3')
+                        outlineColor: Cesium.Color.fromCssColorString('#55A1E3')
                     }
                 });