From 75026d1c1c71e3ddfa742aa507b3468ae9a8cc35 Mon Sep 17 00:00:00 2001 From: shidongli Date: Tue, 29 Nov 2022 14:02:13 +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 | 35 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index e816e11..5672a8f 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -797,7 +797,12 @@ 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 || @@ -843,8 +848,7 @@ export default { this.$router.push("/system/user-auth/role/" + userId); }, /** 提交按钮 */ - submitForm: function () { - console.log(this.form); + submitForm: function () { this.$refs["form"].validate((valid) => { if (valid) { // this.form.nurseStationIds = this.form.nurseStationIds.join(","); @@ -853,13 +857,26 @@ 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("新增成功");