|
@@ -56,7 +56,6 @@ defineOptions({ name: 'position-add-job-requirements'})
|
|
import CtForm from '@/components/CtForm'
|
|
import CtForm from '@/components/CtForm'
|
|
import { reactive, ref, watch } from 'vue'
|
|
import { reactive, ref, watch } from 'vue'
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
-import { cityToProvince } from '@/utils/areaDeal'
|
|
|
|
import { getTagTreeDataApi } from '@/api/enterprise'
|
|
import { getTagTreeDataApi } from '@/api/enterprise'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -164,33 +163,15 @@ const items = ref({
|
|
items: []
|
|
items: []
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- type: 'autocomplete',
|
|
|
|
- key: 'workAreaProvinceId',
|
|
|
|
- value: null,
|
|
|
|
- label: '工作城市:省 *',
|
|
|
|
- outlined: true,
|
|
|
|
- itemText: 'name',
|
|
|
|
- itemValue: 'id',
|
|
|
|
- returnSelect: true,
|
|
|
|
- noParam: true,
|
|
|
|
- col: 6,
|
|
|
|
- flexStyle: 'mr-3',
|
|
|
|
- rules: [v => !!v || '请选择工作城市:省'],
|
|
|
|
- items: [],
|
|
|
|
- change: null
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- type: 'autocomplete',
|
|
|
|
|
|
+ type: 'cascade',
|
|
key: 'areaId',
|
|
key: 'areaId',
|
|
value: null,
|
|
value: null,
|
|
- label: '工作城市:市 *',
|
|
|
|
- outlined: true,
|
|
|
|
|
|
+ default: null,
|
|
|
|
+ label: '工作城市 *',
|
|
itemText: 'name',
|
|
itemText: 'name',
|
|
itemValue: 'id',
|
|
itemValue: 'id',
|
|
- col: 6,
|
|
|
|
- rules: [v => !!v || '请选择工作城市:市'],
|
|
|
|
|
|
+ clearable: false,
|
|
items: [],
|
|
items: [],
|
|
- change: null
|
|
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: 'text',
|
|
type: 'text',
|
|
@@ -225,25 +206,13 @@ const getDictData = async () => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-const provinceChange = (value, val, obj) => {
|
|
|
|
- const item = items.value.options.find(e => e.key === 'areaId')
|
|
|
|
- if (!item) return
|
|
|
|
- item.items = obj.children || []
|
|
|
|
- item.value = null
|
|
|
|
-}
|
|
|
|
getDict('areaTreeData', null, 'areaTreeData').then(({ data }) => {
|
|
getDict('areaTreeData', null, 'areaTreeData').then(({ data }) => {
|
|
data = data?.length && data || []
|
|
data = data?.length && data || []
|
|
if (!data?.length) return console.error('areaTreeData获取失败!')
|
|
if (!data?.length) return console.error('areaTreeData获取失败!')
|
|
- // const china = data.find(e => e.id === '1')
|
|
|
|
- // const chinaTreeData = china?.children?.length ? china.children : []
|
|
|
|
const chinaTreeData = data
|
|
const chinaTreeData = data
|
|
- //
|
|
|
|
if (!chinaTreeData?.length) return console.error('chinaTreeData获取失败!')
|
|
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 item = items.value.options.find(e => e.key === 'areaId')
|
|
|
|
+ if (item?.items) item.items = chinaTreeData
|
|
})
|
|
})
|
|
|
|
|
|
const getQuery = async () => {
|
|
const getQuery = async () => {
|
|
@@ -268,7 +237,6 @@ watch(
|
|
await getDictData()
|
|
await getDictData()
|
|
if (!Object.keys(val).length) return
|
|
if (!Object.keys(val).length) return
|
|
// 编辑
|
|
// 编辑
|
|
- let workAreaId = ''
|
|
|
|
items.value.options.forEach(e => {
|
|
items.value.options.forEach(e => {
|
|
if (e.labelKey) {
|
|
if (e.labelKey) {
|
|
query[e.key] = val[e.key]
|
|
query[e.key] = val[e.key]
|
|
@@ -277,20 +245,10 @@ watch(
|
|
}
|
|
}
|
|
if (e.noParam) return
|
|
if (e.noParam) return
|
|
e.value = val[e.key]
|
|
e.value = val[e.key]
|
|
- if (e.key === 'areaId' && val[e.key]) workAreaId = val[e.key]
|
|
|
|
if (e.key === 'tagList' && val[e.key] && val[e.key].length) {
|
|
if (e.key === 'tagList' && val[e.key] && val[e.key].length) {
|
|
tag.value = val[e.key] && val[e.key].length ? val[e.key] : []
|
|
tag.value = val[e.key] && val[e.key].length ? val[e.key] : []
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- if (workAreaId) { // 省份回显
|
|
|
|
- const province = items.value.options.find(pv => pv.key === 'workAreaProvinceId')
|
|
|
|
- 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 || ''
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
{ immediate: true },
|
|
{ immediate: true },
|
|
{ deep: true }
|
|
{ deep: true }
|