From 6094c0ed1baa40ffa0ce587704660b2a6d493bbf Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期一, 25 七月 2022 19:15:38 +0800 Subject: [PATCH] #D --- src/components/Tab/index.vue | 6 +++++- src/components/Tab/Plot.vue | 2 ++ src/views/doublePreventAction/riskLevelManage/fourColorMap/sixty/index.vue | 14 +++++++++++++- src/views/doublePreventAction/riskLevelManage/fourColorMap/oneHundredAndThirty/index.vue | 36 +++++++++++++++++++++++------------- 4 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/components/Tab/Plot.vue b/src/components/Tab/Plot.vue index ff73016..02cc09e 100644 --- a/src/components/Tab/Plot.vue +++ b/src/components/Tab/Plot.vue @@ -176,6 +176,7 @@ this.showCreatePanel = true; }, removeHandle(label) { + debugger if (!global.map) return; for(let i in this.colorMapList){ if(JSON.parse(this.colorMapList[i].properties).attr.id === label.attr.id){ @@ -263,6 +264,7 @@ message:'四色图新增成功', }) } + this.$emit('getList') }) } ); diff --git a/src/components/Tab/index.vue b/src/components/Tab/index.vue index 42ab835..475a75a 100644 --- a/src/components/Tab/index.vue +++ b/src/components/Tab/index.vue @@ -20,7 +20,7 @@ <label-panel /> </el-tab-pane> --> <el-tab-pane label="四色图" name="plot"> - <plot-panel :type='type' :colorMapList='colorMapList'/> + <plot-panel :type='type' :colorMapList='colorMapList' @getList="getList"/> </el-tab-pane> <el-tab-pane label="图标" name="marker"> <marker-panel /> @@ -72,6 +72,10 @@ }; }, methods : { + getList(){ + debugger + this.$emit('getList') + } } }; </script> diff --git a/src/views/doublePreventAction/riskLevelManage/fourColorMap/oneHundredAndThirty/index.vue b/src/views/doublePreventAction/riskLevelManage/fourColorMap/oneHundredAndThirty/index.vue index fa3ea0d..569de60 100644 --- a/src/views/doublePreventAction/riskLevelManage/fourColorMap/oneHundredAndThirty/index.vue +++ b/src/views/doublePreventAction/riskLevelManage/fourColorMap/oneHundredAndThirty/index.vue @@ -2,7 +2,7 @@ <div class="map-layout"> <Map @init="init" :option="option" v-if="option" /> - <Tab v-if="loaded" :type='type' :colorMapList='colorMapList'/> + <Tab v-if="loaded" :type='type' :colorMapList='colorMapList' @getList="testLoaded"/> </div> @@ -120,24 +120,34 @@ if (!map) return; let params = {} params['eType'] = 2 - getMap(params).then(res =>{ - this.colorMapList = res.data.result - const list = res.data.result.map(item =>{ - return{ - type:item.type, - geometry:JSON.parse(item.geometry), - properties:JSON.parse(item.properties) + getMap(params).then(res => { + debugger + this.colorMapList = JSON.parse(JSON.stringify(res.data.result)) + const list = this.colorMapList.map(item => { + return { + type: item.type, + geometry: JSON.parse(item.geometry), + properties: JSON.parse(item.properties) } }) const fourMapList = { - "type": "FeatureCollection", - "features": list + "type": "FeatureCollection", + "features": JSON.parse(JSON.stringify(list)) } map.loadGeoJSON(fourMapList) }) - // $.get('./public/data/plots_namisuo.geojson', res => { - // map.loadGeoJSON(res); - // }); + }, + testLoaded() { + const map = global.map; + if (!map) return; + let params = {} + params['eType'] = 2 + getMap(params).then(res => { + this.colorMapList = JSON.parse(JSON.stringify(res.data.result)) + }) + // $.get('./public/data/plots_namisuo.geojson', res => { + // map.loadGeoJSON(res); + // }); }, initEvent(map) { let popup = null; diff --git a/src/views/doublePreventAction/riskLevelManage/fourColorMap/sixty/index.vue b/src/views/doublePreventAction/riskLevelManage/fourColorMap/sixty/index.vue index c0e4e5e..7f2ad45 100644 --- a/src/views/doublePreventAction/riskLevelManage/fourColorMap/sixty/index.vue +++ b/src/views/doublePreventAction/riskLevelManage/fourColorMap/sixty/index.vue @@ -2,7 +2,7 @@ <div class="map-layout"> <Map @init="init" :option="option" v-if="option" /> - <Tab v-if="loaded" :type='type' :colorMapList='colorMapList'/> + <Tab v-if="loaded" :type='type' :colorMapList='colorMapList' @getList="testLoaded"/> </div> @@ -173,6 +173,18 @@ // }); }) }, + testLoaded() { + const map = global.map; + if (!map) return; + let params = {} + params['eType'] = 2 + getMap(params).then(res => { + this.colorMapList = JSON.parse(JSON.stringify(res.data.result)) + }) + // $.get('./public/data/plots_namisuo.geojson', res => { + // map.loadGeoJSON(res); + // }); + }, initEvent(map) { let popup = null; const _this = this; -- Gitblit v1.9.2