[style][V]:简化代码

master
Romesum 5 years ago
parent 9df456f9b1
commit a304eadc65

@ -69,30 +69,16 @@
await showDialog("确定要" + (this.edit ? '编辑' : '新增') + '吗?', this) await showDialog("确定要" + (this.edit ? '编辑' : '新增') + '吗?', this)
// //
if (this.edit) { if (this.edit) {
await post('lb/user/updateUser', { //
nickname: this.userForm.nickname, this.userForm.uId = this.userForm.uid
tel: this.userForm.tel, await post('lb/user/updateUser', this.userForm).catch(async e => {
email: this.userForm.email,
username: this.userForm.username,
office: this.userForm.office,
position: parseInt(this.userForm.position),
uId: this.userForm.uid
}).catch(async e => {
await showFail(e.msg, this) await showFail(e.msg, this)
await stop() await stop()
}) })
showSuccess('编辑完成', this) showSuccess('编辑完成', this)
} else { } else {
// //
await post('lb/user/addUser', { await post('lb/user/addUser', this.userForm).catch(async e => {
nickname: this.userForm.nickname,
tel: this.userForm.tel,
email: this.userForm.email,
username: this.userForm.username,
office: this.userForm.office,
position: parseInt(this.userForm.position),
password: this.userForm.password
}).catch(async e => {
await showFail(e.msg, this) await showFail(e.msg, this)
await stop() await stop()
}) })

Loading…
Cancel
Save