mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 03:52:59 +08:00
Merge pull request #2746 from dataease/pr@dev@fix_format_code
fix(视图-地图): 格式化地图区域映射代码
This commit is contained in:
commit
6e7858b656
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-empty slot="empty" :description="!!currentAreaCode ? $t('map_mapping.empty'): $t('map_mapping.please_select_map')"></el-empty>
|
<el-empty slot="empty" :description="!!currentAreaCode ? $t('map_mapping.empty'): $t('map_mapping.please_select_map')" />
|
||||||
</el-table>
|
</el-table>
|
||||||
<div class="mapping-pagination">
|
<div class="mapping-pagination">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
@ -95,6 +95,26 @@ export default {
|
|||||||
usePage: true
|
usePage: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
chartId() {
|
||||||
|
return this.chart.id
|
||||||
|
},
|
||||||
|
currentAreaCode() {
|
||||||
|
if (this.dynamicAreaCode) {
|
||||||
|
return this.dynamicAreaCode
|
||||||
|
}
|
||||||
|
const customAttr = this.chart.customAttr
|
||||||
|
if (!customAttr) return ''
|
||||||
|
let attr = null
|
||||||
|
if ((typeof customAttr) === 'string') {
|
||||||
|
attr = JSON.parse(customAttr)
|
||||||
|
} else {
|
||||||
|
attr = JSON.parse(JSON.stringify(customAttr))
|
||||||
|
}
|
||||||
|
return attr.areaCode
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'chart': {
|
'chart': {
|
||||||
handler: function() {
|
handler: function() {
|
||||||
@ -108,36 +128,14 @@ export default {
|
|||||||
},
|
},
|
||||||
'dynamicAreaCode': {
|
'dynamicAreaCode': {
|
||||||
handler: function(val, old) {
|
handler: function(val, old) {
|
||||||
if(val !== old) {
|
if (val !== old) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.initData()
|
this.initData()
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
chartId() {
|
|
||||||
return this.chart.id
|
|
||||||
},
|
|
||||||
currentAreaCode() {
|
|
||||||
|
|
||||||
if(this.dynamicAreaCode) {
|
|
||||||
return this.dynamicAreaCode
|
|
||||||
}
|
|
||||||
const customAttr = this.chart.customAttr
|
|
||||||
if(!customAttr) return ''
|
|
||||||
let attr = null
|
|
||||||
if((typeof customAttr) === 'string' ) {
|
|
||||||
attr = JSON.parse(customAttr)
|
|
||||||
} else {
|
|
||||||
attr = JSON.parse(JSON.stringify(customAttr))
|
|
||||||
}
|
|
||||||
return attr.areaCode
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initData()
|
this.initData()
|
||||||
},
|
},
|
||||||
@ -182,7 +180,7 @@ export default {
|
|||||||
},
|
},
|
||||||
buildGridList() {
|
buildGridList() {
|
||||||
this.currentDatas = []
|
this.currentDatas = []
|
||||||
if(!this.currentAreaCode || !this.mappingForm[this.currentAreaCode])return
|
if (!this.currentAreaCode || !this.mappingForm[this.currentAreaCode]) return
|
||||||
this.gridList = Object.keys(this.mappingForm[this.currentAreaCode]).map(key => {
|
this.gridList = Object.keys(this.mappingForm[this.currentAreaCode]).map(key => {
|
||||||
return {
|
return {
|
||||||
mapArea: key,
|
mapArea: key,
|
||||||
@ -204,13 +202,13 @@ export default {
|
|||||||
initMapping() {
|
initMapping() {
|
||||||
const innerCallBack = (json, cCode) => {
|
const innerCallBack = (json, cCode) => {
|
||||||
const features = json.features
|
const features = json.features
|
||||||
if(!this.mappingForm) {
|
if (!this.mappingForm) {
|
||||||
this.mappingForm = {}
|
this.mappingForm = {}
|
||||||
}
|
}
|
||||||
if(!this.mappingForm[cCode]) {
|
if (!this.mappingForm[cCode]) {
|
||||||
this.mappingForm[cCode] = {}
|
this.mappingForm[cCode] = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
features.forEach(feature => {
|
features.forEach(feature => {
|
||||||
this.mappingForm[cCode][feature.properties.name || feature.properties.NAME] = null
|
this.mappingForm[cCode][feature.properties.name || feature.properties.NAME] = null
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user