From ca49d0c0c2920f58e0966a65893d3b4c19b98a20 Mon Sep 17 00:00:00 2001 From: shidongli Date: Tue, 29 Nov 2022 13:51:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/user/index.vue | 46 +++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index e816e11..214bdc4 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -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( "
" + - response.msg + - "
", + response.msg + + "", "导入结果", { dangerouslyUseHTMLString: true } );