Commit 4d0c90f4 authored by 李文光's avatar 李文光

feat: 新建岗位必填项未填时阻止提交并跳转对应Tab

parent ef75212d
......@@ -59,6 +59,17 @@ const form = reactive({
reportTo: '',
})
// 新建岗位必填项:与表单里 required 标记保持一致,缺失时阻止提交并跳到对应 Tab
const REQUIRED_CREATE_FIELDS = [
{ key: 'title', label: '岗位名称', tab: 'base' },
{ key: 'department', label: '所属部门', tab: 'base' },
{ key: 'workLocation', label: '工作地点', tab: 'base' },
{ key: 'headcount', label: '招聘人数', tab: 'base', check: (value) => Number(value) >= 1 },
{ key: 'jd', label: '岗位说明 / JD', tab: 'jd' },
{ key: 'responsibilities', label: '核心职责', tab: 'jd' },
{ key: 'requirements', label: '任职要求', tab: 'jd' },
]
const syncForm = () => {
const job = existing.value
form.jobId = job?.id || ''
......@@ -143,6 +154,19 @@ const submit = async (saveMode = 'update') => {
return
}
// 新建岗位:必填项未填不得提交
if (isNew.value) {
for (const field of REQUIRED_CREATE_FIELDS) {
const value = form[field.key]
const empty = field.check ? !field.check(value) : !String(value ?? '').trim()
if (empty) {
showToast(`请填写${field.label}`, 'warning')
if (activeTab.value !== field.tab) activeTab.value = field.tab
return
}
}
}
// JD 质量检查:缺失关键信息时二次确认,不硬阻断
const quality = jdQualityCheck({
title: form.title,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment