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

master
Romesum 5 years ago
parent 396e0679bd
commit f262efcc77

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

Loading…
Cancel
Save