|
@@ -70,6 +70,10 @@
|
|
|
<span class="mdi mdi-cake-variant-outline"></span>
|
|
|
<span>{{ baseInfo?.birthdayText || $t('common.currentlyUnavailable') }}</span>
|
|
|
</div>
|
|
|
+ <div>
|
|
|
+ <span class="mdi mdi-home-map-marker"></span>
|
|
|
+ <span>{{ baseInfo?.regName || $t('common.currentlyUnavailable') }}</span>
|
|
|
+ </div>
|
|
|
<div>
|
|
|
<span class="mdi mdi-account-heart"></span>
|
|
|
<span>{{ baseInfo?.maritalText || $t('common.currentlyUnavailable') }}</span>
|
|
@@ -226,16 +230,6 @@ const items = ref({
|
|
|
// disabled: true,
|
|
|
// slotName: 'phone',
|
|
|
},
|
|
|
- // {
|
|
|
- // slotName: 'areaType',
|
|
|
- // key: 'areaId',
|
|
|
- // value: null,
|
|
|
- // label: '所在城市 *',
|
|
|
- // nameKey: 'areaName', // 展示出来id对应的内容
|
|
|
- // col: 6,
|
|
|
- // flexStyle: 'mr-3',
|
|
|
- // rules: [v => !!v || '请选择所在城市']
|
|
|
- // },
|
|
|
{
|
|
|
type: 'text',
|
|
|
key: 'email',
|
|
@@ -345,6 +339,35 @@ const items = ref({
|
|
|
items: [],
|
|
|
change: null
|
|
|
},
|
|
|
+ {
|
|
|
+ type: 'autocomplete',
|
|
|
+ key: 'regProvinceId',
|
|
|
+ value: null,
|
|
|
+ label: '户籍地:省 *',
|
|
|
+ outlined: true,
|
|
|
+ clearable: true,
|
|
|
+ itemText: 'name',
|
|
|
+ itemValue: 'id',
|
|
|
+ returnSelect: true,
|
|
|
+ noParam: true,
|
|
|
+ col: 6,
|
|
|
+ flexStyle: 'mr-3',
|
|
|
+ items: [],
|
|
|
+ change: null
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'autocomplete',
|
|
|
+ key: 'regId',
|
|
|
+ value: null,
|
|
|
+ label: '户籍地:市 *',
|
|
|
+ outlined: true,
|
|
|
+ clearable: true,
|
|
|
+ itemText: 'name',
|
|
|
+ itemValue: 'id',
|
|
|
+ col: 6,
|
|
|
+ items: [],
|
|
|
+ change: null
|
|
|
+ },
|
|
|
{
|
|
|
type: 'datePicker',
|
|
|
dateType: 'month',
|
|
@@ -386,24 +409,24 @@ const getDictData = async (dictTypeName) => {
|
|
|
item.items = data
|
|
|
}
|
|
|
}
|
|
|
-let timeCount = 0
|
|
|
-let workAreaId = ''
|
|
|
-const deal = async () => {
|
|
|
- if (workAreaId) { // 省份回显
|
|
|
- const province = items.value.options.find(pv => pv.key === 'workAreaProvinceId')
|
|
|
- if (!province?.items.length) { // 字典数据未获取
|
|
|
- setTimeout(() => {
|
|
|
- timeCount++
|
|
|
- if (timeCount < 6) deal()
|
|
|
- }, 2000)
|
|
|
- return
|
|
|
- }
|
|
|
- if (province) {
|
|
|
- const dealReturnObj = await cityToProvince(workAreaId, {}, province.items || [])
|
|
|
- const city = items.value.options.find(pv => pv.key === 'areaId')
|
|
|
- if (city) city.items = dealReturnObj.cityList || []
|
|
|
- province.value = dealReturnObj.pid || ''
|
|
|
- }
|
|
|
+const timeCount = {}
|
|
|
+const deal = async (id, cityKey, provinceKey) => {
|
|
|
+ if (!id && id !== 0) return
|
|
|
+ // 省份回显
|
|
|
+ const province = items.value.options.find(pv => pv.key === provinceKey)
|
|
|
+ if (!province?.items.length) { // 字典数据未获取
|
|
|
+ timeCount[provinceKey] = 0
|
|
|
+ setTimeout(() => {
|
|
|
+ timeCount[provinceKey]++
|
|
|
+ if (timeCount[provinceKey] < 6) deal(id, cityKey, provinceKey)
|
|
|
+ }, 2000)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (province) {
|
|
|
+ const dealReturnObj = await cityToProvince(id, {}, province.items || [])
|
|
|
+ const city = items.value.options.find(pv => pv.key === cityKey)
|
|
|
+ if (city) city.items = dealReturnObj.cityList || []
|
|
|
+ province.value = dealReturnObj.pid || ''
|
|
|
}
|
|
|
}
|
|
|
items.value.options.forEach((e, index) => {
|
|
@@ -417,15 +440,23 @@ items.value.options.forEach((e, index) => {
|
|
|
// 所在城市回显
|
|
|
// if (infoExist && e.nameKey) e[e.nameKey] = baseInfo.value[e.nameKey]
|
|
|
if (infoExist && e.key === 'areaId' && baseInfo.value[e.key]) {
|
|
|
- workAreaId = baseInfo.value[e.key]
|
|
|
- deal()
|
|
|
+ const id = baseInfo.value[e.key]
|
|
|
+ deal(id, e.key, 'workAreaProvinceId')
|
|
|
+ }
|
|
|
+ if (infoExist && e.key === 'regId' && baseInfo.value[e.key]) {
|
|
|
+ const id = baseInfo.value[e.key]
|
|
|
+ deal(id, e.key, 'regProvinceId')
|
|
|
}
|
|
|
})
|
|
|
|
|
|
const provinceChange = (value, val, obj) => {
|
|
|
- const item = items.value.options.find(e => e.key === 'areaId')
|
|
|
+ let cityKey
|
|
|
+ if (val?.key === 'workAreaProvinceId') cityKey = 'areaId'
|
|
|
+ if (val?.key === 'regProvinceId') cityKey = 'regId'
|
|
|
+ if (!cityKey) return
|
|
|
+ const item = items.value.options.find(e => e.key === cityKey)
|
|
|
if (!item) return
|
|
|
- item.items = obj.children || []
|
|
|
+ item.items = obj?.children || []
|
|
|
item.value = null
|
|
|
}
|
|
|
getDict('areaTreeData', null, 'areaTreeData').then(({ data }) => {
|
|
@@ -437,10 +468,15 @@ getDict('areaTreeData', null, 'areaTreeData').then(({ data }) => {
|
|
|
const chinaTreeData = data
|
|
|
//
|
|
|
if (!chinaTreeData?.length) return console.error('chinaTreeData获取失败!')
|
|
|
- const item = items.value.options.find(e => e.key === 'workAreaProvinceId')
|
|
|
- if (item?.items) {
|
|
|
- item.items = chinaTreeData
|
|
|
- item.change = provinceChange
|
|
|
+ const workAreaProvince = items.value.options.find(e => e.key === 'workAreaProvinceId')
|
|
|
+ const regAreaProvince = items.value.options.find(e => e.key === 'regProvinceId')
|
|
|
+ if (workAreaProvince?.items) {
|
|
|
+ workAreaProvince.items = chinaTreeData
|
|
|
+ workAreaProvince.change = provinceChange
|
|
|
+ }
|
|
|
+ if (regAreaProvince?.items) {
|
|
|
+ regAreaProvince.items = chinaTreeData
|
|
|
+ regAreaProvince.change = provinceChange
|
|
|
}
|
|
|
})
|
|
|
</script>
|