diff --git a/src/utils/strUtil.js b/src/utils/strUtil.js new file mode 100644 index 0000000..85395bb --- /dev/null +++ b/src/utils/strUtil.js @@ -0,0 +1,11 @@ +//封装字符串相关的方法 +export function isBlank(value) { + if (value === "" || value === null || value === undefined) { + return true; + } + value = value + ""; + value = value.trim(); + if ("" === value || value === "string" || value === "undefined") { + return true; + } +} diff --git a/src/views/basic/BussinessType.vue b/src/views/basic/BussinessType.vue index 0ac9e5b..171a6b5 100644 --- a/src/views/basic/BussinessType.vue +++ b/src/views/basic/BussinessType.vue @@ -234,6 +234,10 @@ export default { this.filterQuery.page = 1; this.getList(); }, + handleCurrentChange(val) { + this.filterQuery.page = val; + this.getList(); + }, getList() { this.loading = true; getBussinessType(this.filterQuery) diff --git a/src/views/basic/BussinessTypeModify.vue b/src/views/basic/BussinessTypeModify.vue index 75e335e..554360a 100644 --- a/src/views/basic/BussinessTypeModify.vue +++ b/src/views/basic/BussinessTypeModify.vue @@ -212,8 +212,7 @@ export default { if (type != 2) { this.inputQuery.genUnit = false; } - } - , + }, //获取单据类型 getOrderType() { this.orderTypeList = []; diff --git a/src/views/userManage/admin/authAdmin.vue b/src/views/userManage/admin/authAdmin.vue index ba92d4f..699cb1d 100644 --- a/src/views/userManage/admin/authAdmin.vue +++ b/src/views/userManage/admin/authAdmin.vue @@ -76,11 +76,11 @@ @@ -202,6 +202,7 @@ import { } from "../../../api/auth/authAdmin"; import store from "../../../store/index"; +import {isBlank} from "@/utils/strUtil"; const formJson = { id: "", @@ -338,12 +339,10 @@ export default { }, // 刷新表单 resetForm() { - if (this.$refs["dataForm"]) { - // 清空验证信息表单 - this.$refs["dataForm"].clearValidate(); - // 刷新表单 + this.$nextTick(() => { this.$refs["dataForm"].resetFields(); - } + this.$refs["dataForm"].clearValidate(); + }); }, // 隐藏表单 hideForm() { @@ -356,6 +355,7 @@ export default { // 显示表单 handleForm(index, row) { this.formVisible = true; + this.resetForm(); this.formData = JSON.parse(JSON.stringify(formJson)); if (row !== null) { this.formData = Object.assign({}, row); @@ -372,6 +372,26 @@ export default { } }, formSubmit() { + if (isBlank(this.formData.userName)) { + this.$message.error("用户账号不能为空"); + return; + } else if (isBlank(this.formData.passWord)) { + this.$message.error("密码不能为空") + return; + }else if (isBlank(this.formData.checkPassword)) { + this.$message.error("请再次确认密码"); + return; + } else if (isBlank(this.formData.employeeName)) { + this.$message.error("用户名称不能为空"); + return; + } else if (this.formData.passWord != this.formData.checkPassword) { + 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; @@ -424,7 +444,6 @@ export default { }); }) .catch(() => { - this.$message.info("取消删除"); }); } } diff --git a/src/views/userManage/admin/authRole.vue b/src/views/userManage/admin/authRole.vue index 7cf770f..62f89b2 100644 --- a/src/views/userManage/admin/authRole.vue +++ b/src/views/userManage/admin/authRole.vue @@ -242,6 +242,7 @@ import { } from "../../../api/auth/authRole"; import {getBussinessType} from "../../../api/basic/bussinessType"; import {getBussinessTypeRole, updateBussinessTypeRole} from "../../../api/basic/bussinessTypeRole"; +import {isBlank} from "@/utils/strUtil"; const formJson = { id: "", @@ -435,13 +436,10 @@ export default { }, // 刷新表单 resetForm() { - if (this.$refs["dataForm"]) { - // 清空验证信息表单 - this.$refs["dataForm"].clearValidate(); - // 刷新表单 + this.$nextTick(() => { this.$refs["dataForm"].resetFields(); - this.getList(); - } + this.$refs["dataForm"].clearValidate(); + }); }, // 隐藏表单 hideForm() { @@ -451,6 +449,7 @@ export default { }, // 显示表单 handleForm(index, row) { + this.resetForm(); this.formVisible = true; if (null != index) { //编辑弹窗,禁用是否客户角色按钮 @@ -469,37 +468,38 @@ export default { } }, formSubmit() { - this.$refs["dataForm"].validate(valid => { - if (valid) { - this.formLoading = true; - let data = Object.assign({}, this.formData); - authRoleSave(data, this.formName) - .then(response => { - this.formLoading = false; - if (response.code !== 20000) { - this.$message.error(response.message); - return false; - } - this.$message.success("操作成功"); - this.formVisible = false; - if (this.formName === "add") { - // 向头部添加数据 - if (response.data && response.data.id) { - data.id = response.data.id; - this.list.unshift(data); - } - } else { - this.list.splice(this.index, 1, data); - } - // 刷新表单 - this.resetForm(); - this.getList(); - }) - .catch(() => { - this.formLoading = false; - }); - } - }); + if (isBlank(this.formData.name)) { + this.$message.error("角色名称为必填项!"); + return; + } + + this.formLoading = true; + let data = Object.assign({}, this.formData); + authRoleSave(data, this.formName) + .then(response => { + this.formLoading = false; + if (response.code !== 20000) { + this.$message.error(response.message); + return false; + } + this.$message.success("操作成功"); + this.formVisible = false; + if (this.formName === "add") { + // 向头部添加数据 + if (response.data && response.data.id) { + data.id = response.data.id; + this.list.unshift(data); + } + } else { + this.list.splice(this.index, 1, data); + } + // 刷新表单 + this.resetForm(); + this.getList(); + }) + .catch(() => { + this.formLoading = false; + }); }, // 删除 handleDel(index, row) { @@ -526,7 +526,6 @@ export default { }); }) .catch(() => { - this.$message.info("取消删除"); }); } }, diff --git a/src/views/userManage/customerManage.vue b/src/views/userManage/customerManage.vue index 40d88b2..7449ed9 100644 --- a/src/views/userManage/customerManage.vue +++ b/src/views/userManage/customerManage.vue @@ -7,6 +7,7 @@ style="width: 400px" v-model="filterQuery.key" placeholder="请输入" + clearable > - - - - - - - + + +