用户管理 修改

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