Merge remote-tracking branch 'origin/fencang' into fencang

fencang
anthonywj 3 years ago
commit 012c107f4f

@ -0,0 +1,7 @@
//封装字符串相关的方法
export function isBlank(value) {
value = value.trim();
if (value === "" || value === null || value === "string") {
return true;
}
}

@ -99,6 +99,7 @@
:before-close="hideForm" :before-close="hideForm"
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
v-if="formVisible"
width="70%" width="70%"
top="5vh" top="5vh"
> >
@ -195,6 +196,7 @@ import {
import store from "../../../store/index"; import store from "../../../store/index";
import {findConfig} from "@/api/thrsys/spsSyncStatus"; import {findConfig} from "@/api/thrsys/spsSyncStatus";
import {isBlank} from "@/utils/strUtil";
const formJson = { const formJson = {
id: "", id: "",
@ -333,24 +335,23 @@ export default {
}, },
// //
resetForm() { resetForm() {
if (this.$refs["dataForm"]) { this.$nextTick(() => {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields(); this.$refs["dataForm"].resetFields();
} this.$refs["dataForm"].clearValidate();
})
}, },
// //
hideForm() { hideForm() {
// //
this.formVisible = !this.formVisible; this.formVisible = !this.formVisible;
// //
this.$refs["dataForm"].resetFields(); this.$refs["dataForm"].resetFields(); //
return true; return true;
}, },
// //
handleForm(index, row) { handleForm(index, row) {
this.formVisible = true; this.formVisible = true;
this.resetForm();
this.formData = JSON.parse(JSON.stringify(formJson)); this.formData = JSON.parse(JSON.stringify(formJson));
if (row !== null) { if (row !== null) {
this.formData = Object.assign({}, row); this.formData = Object.assign({}, row);
@ -364,6 +365,20 @@ export default {
} }
}, },
formSubmit() { 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.employeeName)) {
this.$message.error("用户名称不能为空");
return;
} else if (this.formData.roles.length === 0) {
this.$message.error("未指定角色!")
return;
}
this.$refs["dataForm"].validate(valid => { this.$refs["dataForm"].validate(valid => {
if (valid) { if (valid) {
this.formLoading = true; this.formLoading = true;

Loading…
Cancel
Save