11
This commit is contained in:
@@ -42,39 +42,50 @@ const useDictStore = defineStore("dict", () => {
|
||||
noticeType: []
|
||||
})
|
||||
// political_affiliation
|
||||
const getDictData = async (dictType, dictName) => {
|
||||
try {
|
||||
if (dictType && dictName) {
|
||||
return getDictSelectOption(dictType).then((data) => {
|
||||
state[dictName] = data
|
||||
return data
|
||||
})
|
||||
}
|
||||
const [education, experience, area, scale, sex, affiliation, nature, noticeType] =
|
||||
await Promise.all([
|
||||
getDictSelectOption('education'),
|
||||
getDictSelectOption('experience'),
|
||||
getDictSelectOption('area', true),
|
||||
getDictSelectOption('scale'),
|
||||
getDictSelectOption('app_sex'),
|
||||
getDictSelectOption('political_affiliation'),
|
||||
getDictSelectOption('company_nature'),
|
||||
getDictSelectOption('sys_notice_type'),
|
||||
]);
|
||||
|
||||
state.education = education;
|
||||
state.experience = experience;
|
||||
state.area = area;
|
||||
state.scale = scale;
|
||||
state.sex = sex;
|
||||
state.affiliation = affiliation;
|
||||
state.nature = nature
|
||||
state.noticeType = noticeType
|
||||
complete.value = true
|
||||
getIndustryDict() // 获取行业
|
||||
} catch (error) {
|
||||
console.error('Error fetching dictionary data:', error);
|
||||
}
|
||||
const getDictData = async (dictType, dictName) => {
|
||||
try {
|
||||
if (dictType && dictName) {
|
||||
return getDictSelectOption(dictType).then((data) => {
|
||||
state[dictName] = data
|
||||
return data
|
||||
})
|
||||
}
|
||||
const [education, experience, area, scale, sex, affiliation, nature, noticeType] =
|
||||
await Promise.all([
|
||||
getDictSelectOption('education'),
|
||||
getDictSelectOption('experience'),
|
||||
getDictSelectOption('area', true),
|
||||
getDictSelectOption('scale'),
|
||||
getDictSelectOption('app_sex'),
|
||||
getDictSelectOption('political_affiliation'),
|
||||
getDictSelectOption('company_nature'),
|
||||
getDictSelectOption('sys_notice_type'),
|
||||
]);
|
||||
|
||||
state.education = education;
|
||||
state.experience = experience;
|
||||
state.area = area;
|
||||
state.scale = scale;
|
||||
state.sex = sex;
|
||||
state.affiliation = affiliation;
|
||||
state.nature = nature
|
||||
state.noticeType = noticeType
|
||||
complete.value = true
|
||||
getIndustryDict() // 获取行业
|
||||
} catch (error) {
|
||||
console.error('Error fetching dictionary data:', error);
|
||||
// 确保即使出错也能返回空数组
|
||||
if (!dictType && !dictName) {
|
||||
state.education = [];
|
||||
state.experience = [];
|
||||
state.area = [];
|
||||
state.scale = [];
|
||||
state.sex = [];
|
||||
state.affiliation = [];
|
||||
state.nature = [];
|
||||
state.noticeType = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
async function getIndustryDict() {
|
||||
@@ -129,7 +140,7 @@ const useDictStore = defineStore("dict", () => {
|
||||
return {
|
||||
label: title,
|
||||
key: key || dictType,
|
||||
options: state[dictType],
|
||||
options: state[dictType] || [],
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user