添加 保存并新增

dev
张同海 2 years ago
parent 349c21aa82
commit c7f7d40de7

@ -9,10 +9,15 @@
> -->
<!-- <a-spin :spinning="confirmLoading"> -->
<a-form :form="form" class="CsForm">
<a-row type="flex" justify="end">
<a-row type="flex" justify="end" :gutter="16">
<a-col :span="2" v-if="!id">
<a-button type="primary" @click="handleSubmit('New')">
保存并新增
</a-button>
</a-col>
<a-col :span="1">
<a-button type="primary" @click="handleSubmit">
{{ this.id ? '修改' : '新增' }}
{{ this.id ? '修改' : '保存' }}
</a-button>
</a-col>
</a-row>
@ -367,7 +372,7 @@ export default {
/**
* 提交表单
*/
handleSubmit() {
handleSubmit(WebType) {
const {
form: { validateFields }
} = this
@ -421,10 +426,15 @@ export default {
DjyCustomerAdd({ ...values, propString: propString, contacts: this.ContactsData })
.then(res => {
if (res.success) {
this.id = res.data
this.$message.success('新增成功')
this.confirmLoading = false
this.$emit('ok', values)
if (WebType == 'New') {
this.form.resetFields()
this.ContactsData = []
} else {
this.id = res.data
}
} else {
this.$message.error(`新增失败,${res.message}`)
}

Loading…
Cancel
Save