[fix][V]:完善表单提交提示逻辑

master
Romesum 5 years ago
parent 396e0679bd
commit f262efcc77

@ -36,20 +36,14 @@
</template> </template>
<script> <script>
import {get, post} from "~/utils"; import {get, post,stop} from "~/utils";
import {showDialog, showFail, showSuccess} from "~/utils/dialog"; import {showDialog, showFail, showSuccess} from "~/utils/dialog";
export default { export default {
props: { props: {
dialogFormVisible: { dialogFormVisible: {required: true},
required: true userForm: {required: true},
}, edit: {required: true}
userForm: {
required: true
},
edit: {
required: true
}
}, },
data() { data() {
return { return {
@ -59,7 +53,7 @@
}, },
methods: { methods: {
async confirm() { async confirm() {
await showDialog("确定要" +(this.edit ? '编辑' : '新增') + '吗?', this) await showDialog("确定要" + (this.edit ? '编辑' : '新增') + '吗?', this)
if (this.edit) { if (this.edit) {
await post('lb/user/updateUser', { await post('lb/user/updateUser', {
nickname: this.userForm.nickname, nickname: this.userForm.nickname,
@ -69,6 +63,9 @@
office: this.userForm.office, office: this.userForm.office,
position: parseInt(this.userForm.position), position: parseInt(this.userForm.position),
uid: this.userForm.uid uid: this.userForm.uid
}).catch(async e => {
await showFail(e.msg,this)
await stop()
}) })
showSuccess('编辑完成', this) showSuccess('编辑完成', this)
} else { } else {
@ -80,6 +77,9 @@
office: this.userForm.office, office: this.userForm.office,
position: parseInt(this.userForm.position), position: parseInt(this.userForm.position),
password: this.password password: this.password
}).catch(async e => {
await showFail(e.msg,this)
await stop()
}) })
showSuccess('新增完成', this) showSuccess('新增完成', this)
} }

Loading…
Cancel
Save