From 21b357a97c423faa4e51ea3d7aa2f1273da24c74 Mon Sep 17 00:00:00 2001 From: huang <1724659546@qq.com> Date: Sun, 21 Sep 2025 20:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcontent=5Ftype=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PlanForm.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/PlanForm.vue b/src/components/PlanForm.vue index eea64205..064b3f68 100644 --- a/src/components/PlanForm.vue +++ b/src/components/PlanForm.vue @@ -117,7 +117,8 @@ export default { description: '', execution_type: 'automatic', // 默认自动执行 execute_num: 0, // 0表示无限执行 - cron_expression: '' // cron表达式 + cron_expression: '', // cron表达式 + content_type: 'tasks' // 默认类型为tasks }); // 表单验证规则 @@ -171,6 +172,11 @@ export default { ...formData }; + // 确保content_type字段有默认值 + if (!submitData.content_type) { + submitData.content_type = 'tasks'; + } + // 如果是手动执行,清除执行次数和cron表达式 if (formData.execution_type === 'manual') { submitData.execute_num = 0; @@ -198,17 +204,24 @@ export default { formData[key] = newVal[key]; } }); + // 确保content_type字段有默认值 + if (!formData.content_type) { + formData.content_type = 'tasks'; + } } else { // 重置表单数据 Object.keys(formData).forEach(key => { if (key === 'execute_num') { formData[key] = 0; + } else if (key === 'content_type') { + formData[key] = 'tasks'; // 默认类型为tasks } else { formData[key] = ''; } }); // 默认值 formData.execution_type = 'automatic'; + formData.content_type = 'tasks'; // 确保content_type有默认值 } }, { immediate: true });