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;