|
@@ -115,7 +115,6 @@
|
|
|
import CtForm from '@/components/CtForm'
|
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
|
-import { cityToProvince } from '@/utils/areaDeal'
|
|
|
import { getTimeStamp, timesTampChange } from '@/utils/date'
|
|
|
import { updatePersonAvatar, saveResumeBasicInfo } from '@/api/recruit/personal/resume'
|
|
|
import { useUserStore } from '@/store/user'
|
|
@@ -330,60 +329,30 @@ const items = ref({
|
|
|
items: []
|
|
|
},
|
|
|
{
|
|
|
- type: 'autocomplete',
|
|
|
- key: 'workAreaProvinceId',
|
|
|
- value: null,
|
|
|
- label: '所在城市:省',
|
|
|
- outlined: true,
|
|
|
- itemText: 'name',
|
|
|
- itemValue: 'id',
|
|
|
- returnSelect: true,
|
|
|
- noParam: true,
|
|
|
- col: 6,
|
|
|
- flexStyle: 'mr-3',
|
|
|
- items: [],
|
|
|
- change: null
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'autocomplete',
|
|
|
+ type: 'cascade',
|
|
|
key: 'areaId',
|
|
|
value: null,
|
|
|
- label: '所在城市:市',
|
|
|
- outlined: true,
|
|
|
- itemText: 'name',
|
|
|
- itemValue: 'id',
|
|
|
- col: 6,
|
|
|
- items: [],
|
|
|
- change: null
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'autocomplete',
|
|
|
- key: 'regProvinceId',
|
|
|
- value: null,
|
|
|
- label: '户籍地:省',
|
|
|
- outlined: true,
|
|
|
- clearable: true,
|
|
|
+ default: null,
|
|
|
+ label: '所在城市',
|
|
|
itemText: 'name',
|
|
|
itemValue: 'id',
|
|
|
- returnSelect: true,
|
|
|
- noParam: true,
|
|
|
+ required: true,
|
|
|
+ clearable: false,
|
|
|
col: 6,
|
|
|
- flexStyle: 'mr-3',
|
|
|
items: [],
|
|
|
- change: null
|
|
|
},
|
|
|
{
|
|
|
- type: 'autocomplete',
|
|
|
+ type: 'cascade',
|
|
|
key: 'regId',
|
|
|
value: null,
|
|
|
- label: '户籍地:市',
|
|
|
- outlined: true,
|
|
|
- clearable: true,
|
|
|
+ default: null,
|
|
|
+ label: '户籍地',
|
|
|
itemText: 'name',
|
|
|
itemValue: 'id',
|
|
|
+ required: false,
|
|
|
+ clearable: true,
|
|
|
col: 6,
|
|
|
items: [],
|
|
|
- change: null
|
|
|
},
|
|
|
{
|
|
|
type: 'datePicker',
|
|
@@ -402,9 +371,7 @@ const handleSave = async () => {
|
|
|
const { valid } = await CtFormRef.value.formRef.validate()
|
|
|
if (!valid) return
|
|
|
const obj = {}
|
|
|
- let clearRegProvinceId = false
|
|
|
items.value.options.forEach(e => {
|
|
|
- if (e.key === 'regId' && !obj[e.key]) clearRegProvinceId = true
|
|
|
if (e.type === 'datepicker') obj[e.key] = getTimeStamp(e.value)
|
|
|
else obj[e.key] = e.value
|
|
|
})
|
|
@@ -415,8 +382,6 @@ const handleSave = async () => {
|
|
|
await userStore.getUserBaseInfos(baseInfo.value.userId || null)
|
|
|
getBasicInfo()
|
|
|
|
|
|
- // 清除户籍地:省
|
|
|
- if (clearRegProvinceId) items.value.options.forEach(e => { if (e.key === 'regProvinceId') e.value = null })
|
|
|
}
|
|
|
|
|
|
// 获取字典内容
|
|
@@ -427,26 +392,6 @@ const getDictData = async (dictTypeName) => {
|
|
|
item.items = data
|
|
|
}
|
|
|
}
|
|
|
-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) => {
|
|
|
if ((index + 2) % 2 === 0) e.flexStyle = 'mr-3'
|
|
@@ -455,45 +400,19 @@ items.value.options.forEach((e, index) => {
|
|
|
if (infoExist && baseInfo.value[e.key]) e.value = baseInfo.value[e.key]
|
|
|
// 日期相关
|
|
|
if (e.type === 'datepicker') e.value = timesTampChange(e.value, 'Y-M-D')
|
|
|
- // 所在城市回显
|
|
|
- if (infoExist && e.key === 'areaId' && baseInfo.value[e.key]) {
|
|
|
- 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')
|
|
|
- }
|
|
|
if (e.value === undefined || e.value === null || e.value === '') completeStatus = false
|
|
|
})
|
|
|
// 完成度展示
|
|
|
|
|
|
-const provinceChange = (value, val, obj) => {
|
|
|
- console.log(obj, 'area')
|
|
|
- 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.value = null
|
|
|
-}
|
|
|
getDict('areaTreeData', null, 'areaTreeData').then(({ data }) => {
|
|
|
data = data?.length && data || []
|
|
|
if (!data?.length) return console.error('areaTreeData获取失败!')
|
|
|
const chinaTreeData = data
|
|
|
if (!chinaTreeData?.length) return console.error('chinaTreeData获取失败!')
|
|
|
- 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
|
|
|
- }
|
|
|
+ const workAreaProvince = items.value.options.find(e => e.key === 'areaId')
|
|
|
+ const regAreaProvince = items.value.options.find(e => e.key === 'regId')
|
|
|
+ if (workAreaProvince?.items) workAreaProvince.items = chinaTreeData
|
|
|
+ if (regAreaProvince?.items) regAreaProvince.items = chinaTreeData
|
|
|
})
|
|
|
</script>
|
|
|
|