diff --git a/src/views/martial/project/index.vue b/src/views/martial/project/index.vue index b967d9b..e6c5fd3 100644 --- a/src/views/martial/project/index.vue +++ b/src/views/martial/project/index.vue @@ -669,6 +669,10 @@ const handleEdit = (row) => { Object.keys(form).forEach((key) => { form[key] = row[key] }) + // 处理字段名映射:后端返回 price,表单使用 registrationFee + if (row.price !== undefined) { + form.registrationFee = row.price + } dialogVisible.value = true } @@ -725,11 +729,16 @@ const handleSubmit = async () => { if (valid) { submitLoading.value = true try { + // 构建提交数据,确保字段名与后端一致 + const submitData = { + ...form, + price: form.registrationFee // 后端使用 price 字段 + } if (form.id) { - await submitProject(form) + await submitProject(submitData) ElMessage.success('修改成功') } else { - await submitProject(form) + await submitProject(submitData) ElMessage.success('新增成功') } dialogVisible.value = false