Commit da7263e4f2bb4523c5bb9d49dab142c2610937c6

Authored by xp.Huang
2 parents 948cd75b bdaf2a5a

Merge branch 'fix/select-province-area' into 'main_dev'

fix: 修复选择省份时和地区配置的选择省份联动

See merge request yunteng/thingskit-view!186
@@ -51,6 +51,9 @@ onMounted(async () => { @@ -51,6 +51,9 @@ onMounted(async () => {
51 const onHandleSelectProvince = async (value: number | string, options: Recordable) => { 51 const onHandleSelectProvince = async (value: number | string, options: Recordable) => {
52 selectValues.cityValue = null 52 selectValues.cityValue = null
53 selectValues.countyValue = null 53 selectValues.countyValue = null
  54 + // if(props.drillingIn){
  55 + // emits('handleSelectArea',{value,options})
  56 + // }
54 if (value === 'china') return (selectValues.levelStr = areaEnum.COUNTRY) 57 if (value === 'china') return (selectValues.levelStr = areaEnum.COUNTRY)
55 selectOptions.cityOptions = await getAreaLists(areaEnum.CITY, value as number) 58 selectOptions.cityOptions = await getAreaLists(areaEnum.CITY, value as number)
56 selectValues.levelStr = areaEnum.PROVINCE 59 selectValues.levelStr = areaEnum.PROVINCE
@@ -160,7 +160,7 @@ @@ -160,7 +160,7 @@
160 <CollapseItem name="地区配置" :expanded="true"> 160 <CollapseItem name="地区配置" :expanded="true">
161 <SettingItemBox name="地区配置" :alone="true"> 161 <SettingItemBox name="地区配置" :alone="true">
162 <template v-for="(item, map3DIndex) in optionData.dataset.map3D" :key="map3DIndex"> 162 <template v-for="(item, map3DIndex) in optionData.dataset.map3D" :key="map3DIndex">
163 - <setting-item name="省份名称"> 163 + <setting-item name="省份名称" v-if="mapRegionCache.adcode=='china'">
164 <n-select 164 <n-select
165 @change="(v:number,o:Recordable,w:Recordable,s1:number)=> onHandleSelectProvince(v,o,item, map3DIndex)" 165 @change="(v:number,o:Recordable,w:Recordable,s1:number)=> onHandleSelectProvince(v,o,item, map3DIndex)"
166 placeholder="请选择省份" 166 placeholder="请选择省份"
@@ -233,6 +233,7 @@ import { regionInfo } from './config' @@ -233,6 +233,7 @@ import { regionInfo } from './config'
233 import { cloneDeep } from 'lodash' 233 import { cloneDeep } from 'lodash'
234 import { getAreaList } from '@/api/external/common/index' 234 import { getAreaList } from '@/api/external/common/index'
235 import { areaEnum } from '../../../Decorates/Mores/Weather/config' 235 import { areaEnum } from '../../../Decorates/Mores/Weather/config'
  236 +import { unref } from 'vue'
236 237
237 const props = defineProps({ 238 const props = defineProps({
238 optionData: { 239 optionData: {
@@ -298,7 +299,7 @@ const mapRegionCache = computed(() => { @@ -298,7 +299,7 @@ const mapRegionCache = computed(() => {
298 return props.optionData.mapRegion 299 return props.optionData.mapRegion
299 }) 300 })
300 301
301 -const onHandleSelectValues = (values: regionInfo) => { 302 +const onHandleSelectValues = async (values: regionInfo) => {
302 const { cityValue, countyValue, provinceValue, areaName } = values 303 const { cityValue, countyValue, provinceValue, areaName } = values
303 mapRegionCache.value.areaName = areaName 304 mapRegionCache.value.areaName = areaName
304 mapRegionCache.value.saveSelect = values 305 mapRegionCache.value.saveSelect = values
@@ -310,6 +311,17 @@ const onHandleSelectValues = (values: regionInfo) => { @@ -310,6 +311,17 @@ const onHandleSelectValues = (values: regionInfo) => {
310 ? 'china' 311 ? 'china'
311 : provinceValue 312 : provinceValue
312 props.optionData.mapRegion = mapRegionCache.value 313 props.optionData.mapRegion = mapRegionCache.value
  314 + if(mapRegionCache.value.adcode!=='china'){
  315 + const {adcode,areaName} = unref(mapRegionCache) || {}
  316 + const cityOptions = await getAreaLists(areaEnum.CITY, adcode)
  317 + console.log(cityOptions,'cityOptions')
  318 + datasetMap3DList.value.forEach((item:any)=>{
  319 + item.name=areaName
  320 + item.city_name=areaName?areaName:null
  321 + item.adcode=adcode,
  322 + item.cityOptions = cityOptions && cityOptions.length?cityOptions:[{adcode,label:areaName,value:areaName}]
  323 + })
  324 + }
313 } 325 }
314 326
315 const handleChangeDrillingIn = () => { 327 const handleChangeDrillingIn = () => {