Commit ed905973a513684a4b17290f46008edfff9bfaf5

Authored by xp.Huang
2 parents f40334bd 3f8783f5

Merge branch 'fix/teambition-issure' into 'main_dev'

fix(src/packages/components): 修复地图未开启下钻,选择省市时,回显正常,但是刷新在选择时,回显为地区码了

See merge request yunteng/thingskit-view!241
@@ -43,13 +43,14 @@ onMounted(async () => { @@ -43,13 +43,14 @@ onMounted(async () => {
43 label: '中国', 43 label: '中国',
44 value: 'china' 44 value: 'china'
45 }) 45 })
46 - onHandleSelectProvince('china') 46 + onHandleSelectProvince(props.optionData?.mapRegion.saveSelect['provinceValue'])
47 for (let i in selectValues) Reflect.set(selectValues, i, props.optionData?.mapRegion.saveSelect[i]) 47 for (let i in selectValues) Reflect.set(selectValues, i, props.optionData?.mapRegion.saveSelect[i])
48 }) 48 })
49 49
50 const onHandleSelectProvince = async (value: number | string) => { 50 const onHandleSelectProvince = async (value: number | string) => {
51 selectValues.cityValue = null 51 selectValues.cityValue = null
52 selectValues.countyValue = null 52 selectValues.countyValue = null
  53 + selectOptions.cityOptions = []
53 if (value === 'china') return (selectValues.levelStr = areaEnum.COUNTRY) 54 if (value === 'china') return (selectValues.levelStr = areaEnum.COUNTRY)
54 selectOptions.cityOptions = await getAreaLists(areaEnum.CITY, value) 55 selectOptions.cityOptions = await getAreaLists(areaEnum.CITY, value)
55 selectValues.levelStr = areaEnum.PROVINCE 56 selectValues.levelStr = areaEnum.PROVINCE
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 </template> 55 </template>
56 56
57 <script setup lang="ts"> 57 <script setup lang="ts">
58 -import { PropType, ref, onMounted } from 'vue' 58 +import { PropType, ref, onMounted, watch } from 'vue'
59 import { AccessMode, option, sourceTypeEnum, videoListInterface, sourceTypeNameEnum, Dataset } from './config' 59 import { AccessMode, option, sourceTypeEnum, videoListInterface, sourceTypeNameEnum, Dataset } from './config'
60 import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' 60 import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
61 import { NTreeSelect } from 'naive-ui' 61 import { NTreeSelect } from 'naive-ui'
@@ -135,6 +135,19 @@ const handleSelect = (_: string, e: videoListInterface) => { @@ -135,6 +135,19 @@ const handleSelect = (_: string, e: videoListInterface) => {
135 } 135 }
136 } 136 }
137 137
  138 +watch(()=>props.optionData, (newData)=>{
  139 + if (newData.sourceType === sourceTypeEnum.PLATFORM) {
  140 + getOriginationList()
  141 + if (newData.organization) {
  142 + getVideoLists(newData.organization)
  143 + }
  144 + }
  145 +},
  146 +{
  147 + immediate: true,
  148 + deep: true
  149 +})
  150 +
138 onMounted(() => { 151 onMounted(() => {
139 if (props.optionData.sourceType === sourceTypeEnum.PLATFORM) { 152 if (props.optionData.sourceType === sourceTypeEnum.PLATFORM) {
140 getOriginationList() 153 getOriginationList()
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <!-- <n-input type="textarea" @input="handleTestInput($event, option)" size="small" placeholder="请输入"></n-input> 11 <!-- <n-input type="textarea" @input="handleTestInput($event, option)" size="small" placeholder="请输入"></n-input>
12 <n-code word-wrap :code="toString(testInputValue)" language="json"></n-code> --> 12 <n-code word-wrap :code="toString(testInputValue)" language="json"></n-code> -->
13 <n-divider /> 13 <n-divider />
14 - <div v-for="(item, index) in groupList" :key="item.key + index"> 14 + <div v-for="(item, index) in cacheGroupList" :key="item.key + index">
15 <n-space justify="space-between"> 15 <n-space justify="space-between">
16 <n-ellipsis> 组件id </n-ellipsis> 16 <n-ellipsis> 组件id </n-ellipsis>
17 <n-input size="small" v-model:value="item.id" :disabled="true"></n-input> 17 <n-input size="small" v-model:value="item.id" :disabled="true"></n-input>
@@ -52,12 +52,16 @@ import { SelectOption } from 'naive-ui' @@ -52,12 +52,16 @@ import { SelectOption } from 'naive-ui'
52 52
53 const { targetData } = useTargetData() 53 const { targetData } = useTargetData()
54 54
55 -const { groupList, option } = toRefs(targetData.value) 55 +const { groupList, option } = toRefs(targetData.value as unknown as Recordable)
  56 +
  57 +const cacheGroupList = computed(()=>{
  58 + return (groupList.value as unknown as CreateComponentType[]).reverse()
  59 +})
56 60
57 const saveHistoryInputValueList = ref<saveHistoryInputValueListType>([]) 61 const saveHistoryInputValueList = ref<saveHistoryInputValueListType>([])
58 62
59 const handleSelectDataKey = (key:string, options:SelectOption[], currentComponentId:string, groupList:CreateComponentType[]) => { 63 const handleSelectDataKey = (key:string, options:SelectOption[], currentComponentId:string, groupList:CreateComponentType[]) => {
60 - saveHistoryInputValueList.value.unshift({ 64 + saveHistoryInputValueList.value.push({
61 id:currentComponentId, 65 id:currentComponentId,
62 inputValue:key 66 inputValue:key
63 }) 67 })
@@ -115,6 +119,10 @@ const dataCacheKeys = computed(()=>{ @@ -115,6 +119,10 @@ const dataCacheKeys = computed(()=>{
115 return [] 119 return []
116 }) 120 })
117 121
  122 +const cacheTargetDataGroupList = computed(()=>{
  123 + return (targetData.value?.groupList as unknown as CreateComponentType[]).reverse()
  124 +})
  125 +
118 watch( 126 watch(
119 () => targetData.value, 127 () => targetData.value,
120 (newValue: CreateComponentType | CreateComponentGroupType) => { 128 (newValue: CreateComponentType | CreateComponentGroupType) => {
@@ -124,7 +132,7 @@ watch( @@ -124,7 +132,7 @@ watch(
124 newValue.saveHistoryInput = JSON.stringify(uniqHistoryInputValueList) 132 newValue.saveHistoryInput = JSON.stringify(uniqHistoryInputValueList)
125 window.localStorage.setItem('CACHE_HISTORY_INPUT_VALUE', JSON.stringify(uniqHistoryInputValueList)) 133 window.localStorage.setItem('CACHE_HISTORY_INPUT_VALUE', JSON.stringify(uniqHistoryInputValueList))
126 } 134 }
127 - newValue?.groupList?.forEach((item: CreateComponentType) => { 135 + cacheTargetDataGroupList.value?.forEach((item: CreateComponentType) => {
128 uniqHistoryInputValueList.forEach((uniqueItem: historyInputValue) => { 136 uniqHistoryInputValueList.forEach((uniqueItem: historyInputValue) => {
129 if (uniqueItem.id === item.id) { 137 if (uniqueItem.id === item.id) {
130 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 138 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion