浏览代码

小网格不显示问题修复

13127578837 9 月之前
父节点
当前提交
31636e91b7
共有 2 个文件被更改,包括 46 次插入90 次删除
  1. 13 56
      src/components/mixins/map-data1.js
  2. 33 34
      src/views/security-plan.vue

+ 13 - 56
src/components/mixins/map-data1.js

@@ -8,6 +8,7 @@ export default {
             map: null,
             oldPopup: null,
             oldPopupId: null,
+            // JmapQuery:null
         };
     },
     mounted() {
@@ -1426,53 +1427,15 @@ export default {
          */
         anbao(status, id, query) {
             var that = this
-            var color = [
-                "#2c6395",
-                "#1b6cb6",
-                "#40a4ff",
-                "#8ac7ff",
-                "#b1cce5",
-
-                "#a03523",
-                "#d7le00",
-                "#ffa192",
-                "#dba197",
-
-                "#009081",
-                "#00ae9c",
-                "#50fed",
-
-                "#4d6700",
-                "#729900",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-                // "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1",
-                // "#5081c5", "#c3a102", "#d17100", , "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100",
-
-
-            ];
-            var JmapQuery = new JMapQuery(window.jMap); // JMap为初始化地图时,实例化的JMap对象
+            var JMapQuery2 = new JMapQuery(window.jMap); // JMap为初始化地图时,实例化的JMap对象
+            window.jMap.removeLayer()
             if (status) {
                 window.jMap.Locate.clearLocate(); //清楚分布
-                // window.jMap.removeLayer();    //  空值清除所有已添加图层
+                window.jMap.removeLayer();    //  空值清除所有已添加图层
             }
-
-
+            // return
             //中网格
             if (id == 1) {
-                setTimeout(() => {
                     // 例: 8.1 2 查询图层列表
                     var qp2 = new JMapQueryParam({
                         queryMapService: "mh_dyn_cywg",
@@ -1482,7 +1445,7 @@ export default {
                         outFields: ["*"], //  返回字段信息
                         callBack: testQueryCallBack2
                     });
-                    JmapQuery.execQuery(qp2);
+                    JMapQuery2.execQuery(qp2);
                     // 图层查询完毕的回调函数
                     function testQueryCallBack2(obj) {
                         var bigNewArr = [];
@@ -1627,18 +1590,15 @@ export default {
                             }, idx * 1)
                         })
                     }
-                }, 1000)
             }
 
             //小网格(居委会)
             if (id == 2 && query) {
-                let dataddd = []
-                    // console.log(query)
-                let queryName = ""
-                for (let i = 0; i < query.length; i++) {
-                    // console.log(query[i].mapGridName)
-                    queryName = queryName ? `${queryName},'${query[i].mapGridName}'` : `'${query[i].mapGridName}'`
-                }
+                // let queryName = ""
+                // for (let i = 0; i < query.length; i++) {
+                //     // console.log(query[i].mapGridName)
+                //     queryName = queryName ? `${queryName},'${query[i].mapGridName}'` : `'${query[i].mapGridName}'`
+                // }
                 // queryName = queryName + ",'涞港星苑筹备组','爱博四村居委','爱博五村居委','爱博二村居委','爱博一村居委','爱博三村居委','万科润园居委','华美路一居委','华美路二居委','沙茂居委','航华一村2居委','航华一村5居委','航华一村7居委','航华一村6居委'"
                 // console.log(queryName)
                 setTimeout(() => {
@@ -1657,7 +1617,7 @@ export default {
                         outFields: ["*"], //  返回字段信息
                         callBack: testQueryCallBack3
                     });
-                    JmapQuery.execQuery(qp3);
+                    JMapQuery2.execQuery(qp3);
 
                     function testQueryCallBack3(obj) {
                         let a = []
@@ -1791,7 +1751,7 @@ export default {
                         outFields: ["*"], //  返回字段信息
                         callBack: testQueryCallBack2
                     });
-                    JmapQuery.execQuery(qp2);
+                    JMapQuery2.execQuery(qp2);
                     // 图层查询完毕的回调函数
                     function testQueryCallBack2(obj) {
                         var bigNewArr = [];
@@ -2385,7 +2345,6 @@ export default {
                         if (pageType == "self-management") {
                             if (val.attrbutes.type == "重点单位") {
                                 // this.elementInfo(val.attrbutes, "重点单位")
-                                console.log(234, val.attrbutes)
                                 that.stores.zddwIdSD(val.attrbutes.companyId);
                             } else if (val.attrbutes.type == "大型综合体") {
                                 let msgParse = JSON.parse(val.attrbutes.extendData)
@@ -3399,7 +3358,6 @@ export default {
                 },
                 click: (val) => {
                     //大型安保 、火灾数据分析
-                    console.log(val)
                     if (pageType == "security-plan") {
                         if (type == "大网格街镇名称&国家会展中心") {
                             if (val._attrbutes.type2 == "大网格") {
@@ -3741,7 +3699,6 @@ export default {
                 }, { isZoom: false, offset: [0, -40] });
             }
             if (type == "重点单位") {
-                console.log(123, value)
                 _this.stores.zddwIdSD(value.companyId);
                 // localStorage.setItem("zddw",)
                 // window.jMap.Popup.show({

+ 33 - 34
src/views/security-plan.vue

@@ -99,7 +99,7 @@
                     <div style="display: flex;">
                         <h4>疏导区社会单位情况</h4>
                         <div style="display: flex; border-bottom: 0.0125rem solid rgba(115, 251, 253, 0.5);">
-                            <el-form class="titleElForm" :inline="true" size="mini" :model="barForm" style="height: 0">
+                            <el-form class="titleElForm" :inline="true" size="mini"  style="height: 0">
                                 <el-form-item>
                                     <!-- <el-select v-model="barForm.fireType" @change="getHouse()" filterable clearable placeholder="场所">
                                         <el-option v-for="(item, ind) in fireTypeList" :key="ind" :label="item" :value="item"></el-option>
@@ -2194,7 +2194,6 @@ export default {
             this.$axios.post(this.$api.water.baseGgpFacilityList,{
                                 "facilityType": [type ] 
                         }).then((res) => {
-                                
                                 let arr = []
                                 if(res.data.length>0){
                                         arr = res.data;
@@ -2268,48 +2267,50 @@ export default {
                     let arr = []
                     if(res.data.length>0){
                             arr = res.data;
-                            this.arrayData= res.data;
                             let data = {
                                 gisX: 121.302183,
                                 gisY: 31.189991,
                                 type: "国家会展中心",
                             };
-                            arr.push(data)
+                            // arr.push(data)
+                            if(type == "29" || type == "30"){
+                                this.arrayData= res.data;
+                            }
                             //新消监
                             if(type == "新消监"){
                                 this.addMarker(arr, "security-plan", type)
                             }else{
                                 let dataOther = [data]
-                            if(type == 39){ //九小场所
-                                this.anbaoSDUWG()//疏导区网格
+                                if(type == 39){ //九小场所
+                                    
+                                    this.anbaoSDUWG()//疏导区网格
                                     if(name){
-                                            for(let i=0;i<arr.length;i++){
-                                                if(arr[i].checkComment){
-                                                    if(name == arr[i].checkComment){
-                                                            dataOther.push(arr[i])
-                                                    }
+                                        for(let i=0;i<arr.length;i++){
+                                            if(arr[i].checkComment){
+                                                if(name == arr[i].checkComment){
+                                                    dataOther.push(arr[i])
                                                 }
                                             }
-                                            this.addMarker(dataOther, "security-plan", name)
+                                        }
+                                        this.addMarker(dataOther, "security-plan", name)
                                     }else{
-                                            this.jxcstj = [0,0,0,0]
-                                            for(let i=0;i<arr.length;i++){
-                                                    if(arr[i].checkComment){
-                                                        if(arr[i].checkComment == "高风险"){
-                                                                this.jxcstj[0] ++
-                                                        }
-                                                        if(arr[i].checkComment == "较高风险"){
-                                                                this.jxcstj[1] ++
-                                                        }
-                                                        if(arr[i].checkComment == "一般风险"){
-                                                                this.jxcstj[2] ++
-                                                        }
-                                                        if(arr[i].checkComment == "低风险"){
-                                                                this.jxcstj[3] ++
-                                                        }
-                                                    }
+                                        this.jxcstj = [0,0,0,0]
+                                        for(let i=0;i<arr.length;i++){
+                                            if(arr[i].checkComment){
+                                                if(arr[i].checkComment == "高风险"){
+                                                        this.jxcstj[0] ++
+                                                }
+                                                if(arr[i].checkComment == "较高风险"){
+                                                        this.jxcstj[1] ++
+                                                }
+                                                if(arr[i].checkComment == "一般风险"){
+                                                        this.jxcstj[2] ++
+                                                }
+                                                if(arr[i].checkComment == "低风险"){
+                                                        this.jxcstj[3] ++
+                                                }
                                             }
-                                        
+                                        }
                                     }
                                 }else{
                                     this.addMarker(arr, "security-plan", name)
@@ -2768,7 +2769,7 @@ export default {
                 setTimeout(()=>{
                     this.hzzxtb()
                     this.anbaoSDUWG()//疏导区网格
-                },2000)
+                },3000)
                 
             } else if (id == 17) {
                 this.surveillance()
@@ -3150,7 +3151,7 @@ export default {
                     { prop: "type2", name: "小网格长" },
                 ];
                 querySearch = {
-                    mapGridName: area,
+                    // mapGridName: area,
                     gridGrade: 3,
                 };
             }
@@ -3248,7 +3249,6 @@ export default {
                             }
                         }
                     }
-                    console.log(gridData)
                     // if(id == 19){
                     //     let arr = {};
                     //     arr.type = id;
@@ -3279,7 +3279,7 @@ export default {
                     var queryData = [];
                     let qw = []
                     for (let i = 0; i < gridData.length; i++) {
-                        if (gridData[i].mapGridName) {
+                        if (gridData[i]?.mapGridName) {
                             queryData.push(gridData[i]);
                         }else{
                             qw.push(gridData[i])
@@ -3470,7 +3470,6 @@ export default {
 
     watch: {
         "stores.$state.gridData": function (newValue, oldValue) {
-            console.log(this.gridStatus)
             if (this.gridStatus == 19) {
                 this.grid(19, newValue.name, newValue.position);
             }