|
@@ -344,13 +344,21 @@ export default {
|
|
|
/**
|
|
|
* 表单提交处理
|
|
|
*/
|
|
|
- async handleSubmit() {
|
|
|
- try {
|
|
|
- // 表单验证
|
|
|
- const valid = await this.$refs.forecastForm.validate()
|
|
|
+ handleSubmit() {
|
|
|
+ // 表单验证
|
|
|
+ this.$refs.forecastForm.validate((valid) => {
|
|
|
if (!valid) {
|
|
|
return
|
|
|
}
|
|
|
+ this.submitForm()
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 执行表单提交
|
|
|
+ */
|
|
|
+ async submitForm() {
|
|
|
+ try {
|
|
|
|
|
|
// 提交数据
|
|
|
const submitData = { ...this.formData }
|
|
@@ -363,8 +371,8 @@ export default {
|
|
|
this.$message.success('新增销售预测成功')
|
|
|
}
|
|
|
|
|
|
- // 触发成功事件
|
|
|
- this.$emit('success', submitData)
|
|
|
+ // 触发提交成功事件
|
|
|
+ this.$emit('submit', submitData)
|
|
|
} catch (error) {
|
|
|
console.error('提交表单失败:', error)
|
|
|
this.$message.error(error.message || '操作失败,请重试')
|