用户管理 修改

This commit is contained in:
shidongli 2022-11-29 13:51:46 +08:00
parent a358920eef
commit ca49d0c0c2

View File

@ -797,19 +797,23 @@ export default {
const userId = row.userId || this.ids;
getUser(userId).then((response) => {
this.form = response.data;
this.form.nurseStationIds = Number(this.form.nurseStationIds);
if (!this.form.nurseStationIds) {
this.form.nurseStationIds = ''
} else {
this.form.nurseStationIds = Number(this.form.nurseStationIds);
}
// if (
// !this.form.nurseStationIds ||
// this.form.nurseStationIds == null ||
// this.form.nurseStationIds.length == 0
// ) {
// ) {getList
// } else {
// this.form.nurseStationIds = this.form.nurseStationIds.split(",");
// this.form.nurseStationIds = this.form.nurseStationIds.map((e) => {
// return (e = Number(e));
// });
// }
console.log(this.form);
this.postOptions = response.posts;
this.roleOptions = response.roles;
@ -835,7 +839,7 @@ export default {
this.$modal.msgSuccess("修改成功,新密码是:" + value);
});
})
.catch(() => {});
.catch(() => { });
},
/** 分配角色操作 */
handleAuthRole: function (row) {
@ -844,7 +848,6 @@ export default {
},
/** 提交按钮 */
submitForm: function () {
console.log(this.form);
this.$refs["form"].validate((valid) => {
if (valid) {
// this.form.nurseStationIds = this.form.nurseStationIds.join(",");
@ -853,13 +856,28 @@ export default {
// obj.push(this.form.nurseStationIds);
// console.log(obj)
// this.form.nurseStationIds = obj;
console.log(this.form);
if (this.form.userId != undefined) {
updateUser(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
if (!this.form.nurseStationIds) {
this.form.nurseStationIds = null
updateUser(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
// console.log('bbb',this.form)
});
} else {
this.form.nurseStationIds = Number(this.form.nurseStationIds);
updateUser(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
// console.log('bbb',this.form)
});
}
} else {
addUser(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
@ -882,7 +900,7 @@ export default {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
.catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
@ -918,8 +936,8 @@ export default {
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);