Commit bdaf2a5a14ece9355330e1834f943df20495c90f

Authored by 张 峰林
Committed by xp.Huang
1 parent 948cd75b

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

... ... @@ -51,6 +51,9 @@ onMounted(async () => {
51 51 const onHandleSelectProvince = async (value: number | string, options: Recordable) => {
52 52 selectValues.cityValue = null
53 53 selectValues.countyValue = null
  54 + // if(props.drillingIn){
  55 + // emits('handleSelectArea',{value,options})
  56 + // }
54 57 if (value === 'china') return (selectValues.levelStr = areaEnum.COUNTRY)
55 58 selectOptions.cityOptions = await getAreaLists(areaEnum.CITY, value as number)
56 59 selectValues.levelStr = areaEnum.PROVINCE
... ...
... ... @@ -160,7 +160,7 @@
160 160 <CollapseItem name="地区配置" :expanded="true">
161 161 <SettingItemBox name="地区配置" :alone="true">
162 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 164 <n-select
165 165 @change="(v:number,o:Recordable,w:Recordable,s1:number)=> onHandleSelectProvince(v,o,item, map3DIndex)"
166 166 placeholder="请选择省份"
... ... @@ -233,6 +233,7 @@ import { regionInfo } from './config'
233 233 import { cloneDeep } from 'lodash'
234 234 import { getAreaList } from '@/api/external/common/index'
235 235 import { areaEnum } from '../../../Decorates/Mores/Weather/config'
  236 +import { unref } from 'vue'
236 237
237 238 const props = defineProps({
238 239 optionData: {
... ... @@ -298,7 +299,7 @@ const mapRegionCache = computed(() => {
298 299 return props.optionData.mapRegion
299 300 })
300 301
301   -const onHandleSelectValues = (values: regionInfo) => {
  302 +const onHandleSelectValues = async (values: regionInfo) => {
302 303 const { cityValue, countyValue, provinceValue, areaName } = values
303 304 mapRegionCache.value.areaName = areaName
304 305 mapRegionCache.value.saveSelect = values
... ... @@ -310,6 +311,17 @@ const onHandleSelectValues = (values: regionInfo) => {
310 311 ? 'china'
311 312 : provinceValue
312 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 327 const handleChangeDrillingIn = () => {
... ...