From ca6ad2d29b66d1bc179665c79e58938ceb0b6d59 Mon Sep 17 00:00:00 2001 From: x_z Date: Sat, 25 Jun 2022 11:36:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=B7=A5=E5=85=B7=202.=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E6=8F=90=E4=BA=A4=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=203.=E5=88=86=E5=BA=93=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=80=89=E6=8B=A9=E7=94=A8=E6=88=B7=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=85=B3=E9=97=AD=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/strUtil.js | 7 +++++++ src/views/basic/invWarehouse.vue | 26 +++++++++++++----------- src/views/userManage/admin/authAdmin.vue | 22 ++++++++++++++------ 3 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 src/utils/strUtil.js diff --git a/src/utils/strUtil.js b/src/utils/strUtil.js new file mode 100644 index 0000000..255ec28 --- /dev/null +++ b/src/utils/strUtil.js @@ -0,0 +1,7 @@ +//封装字符串相关的方法 +export function isBlank(value) { + value = value.trim(); + if (value === "" || value === null || value === "string") { + return true; + } +} diff --git a/src/views/basic/invWarehouse.vue b/src/views/basic/invWarehouse.vue index b4284ae..8faac80 100644 --- a/src/views/basic/invWarehouse.vue +++ b/src/views/basic/invWarehouse.vue @@ -1155,24 +1155,26 @@ export default { }) }, addUserData() { - this.userFormVisible = false; let query = { code: this.currentCode, userList: JSON.stringify(this.selectUserList) }; saveWarehouseUser(query).then((res) => { - this.$message.success("添加成功"); - let loadParam = { - code: this.currentCode - }; - //重新加载数据 - warehouseUserList(loadParam).then((res) => { - this.userData = res.data; - }).catch((error) => { - console.log(error) - }); + if (res.code === 20000) { + this.userFormVisible = false; + this.$message.success("添加成功"); + let loadParam = { + code: this.currentCode + }; + //重新加载数据 + warehouseUserList(loadParam).then((res) => { + this.userData = res.data; + }).catch((error) => { + }); + } else { + this.$message.error(res.message); + } }).catch((error) => { - console.log(error); this.$message.error("添加失败"); }); }, diff --git a/src/views/userManage/admin/authAdmin.vue b/src/views/userManage/admin/authAdmin.vue index 2db7740..82676f0 100644 --- a/src/views/userManage/admin/authAdmin.vue +++ b/src/views/userManage/admin/authAdmin.vue @@ -175,6 +175,8 @@ import { authAdminDelete } from "../../../api/auth/authAdmin"; import {findConfig} from "@/api/thrsys/spsSyncStatus"; +import {isBlank} from "@/utils/strUtil"; + const formJson = { id: "", passWord: "", @@ -338,12 +340,20 @@ export default { } }, formSubmit() { - console.log( - this.formData.userName + - "-----" + - this.formData.employeeName + - this.formData.userFlag - ); + if (isBlank(this.formData.userName)) { + this.$message.error("用户账号不能为空"); + return; + } else if (isBlank(this.formData.passWord)) { + this.$message.error("密码不能为空") + return; + }else if (isBlank(this.formData.employeeName)) { + this.$message.error("用户名称不能为空"); + return; + } else if (this.formData.roles.length === 0) { + this.$message.error("未指定角色!") + return; + } + this.$refs["dataForm"].validate(valid => { if (valid) { this.formLoading = true;