1.修复部分页面数据未加校验的问题

2.修复部分分页相关问题
master
x_z 3 years ago
parent fea23b6123
commit f4a1420388

@ -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;
}
}

@ -234,6 +234,10 @@ export default {
this.filterQuery.page = 1; this.filterQuery.page = 1;
this.getList(); this.getList();
}, },
handleCurrentChange(val) {
this.filterQuery.page = val;
this.getList();
},
getList() { getList() {
this.loading = true; this.loading = true;
getBussinessType(this.filterQuery) getBussinessType(this.filterQuery)

@ -212,8 +212,7 @@ export default {
if (type != 2) { if (type != 2) {
this.inputQuery.genUnit = false; this.inputQuery.genUnit = false;
} }
} },
,
// //
getOrderType() { getOrderType() {
this.orderTypeList = []; this.orderTypeList = [];

@ -76,11 +76,11 @@
</el-table> </el-table>
<el-pagination <el-pagination
:current-page="query.page"
:page-size="query.limit" :page-size="query.limit"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
layout="prev, pager, next" layout="prev, pager, next"
:total="total" :total="total"
:current-page="query.page"
> >
</el-pagination> </el-pagination>
@ -202,6 +202,7 @@ import {
} from "../../../api/auth/authAdmin"; } from "../../../api/auth/authAdmin";
import store from "../../../store/index"; import store from "../../../store/index";
import {isBlank} from "@/utils/strUtil";
const formJson = { const formJson = {
id: "", id: "",
@ -338,12 +339,10 @@ 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() {
@ -356,6 +355,7 @@ export default {
// //
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);
@ -372,6 +372,26 @@ 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.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 => { this.$refs["dataForm"].validate(valid => {
if (valid) { if (valid) {
this.formLoading = true; this.formLoading = true;
@ -424,7 +444,6 @@ export default {
}); });
}) })
.catch(() => { .catch(() => {
this.$message.info("取消删除");
}); });
} }
} }

@ -242,6 +242,7 @@ import {
} from "../../../api/auth/authRole"; } from "../../../api/auth/authRole";
import {getBussinessType} from "../../../api/basic/bussinessType"; import {getBussinessType} from "../../../api/basic/bussinessType";
import {getBussinessTypeRole, updateBussinessTypeRole} from "../../../api/basic/bussinessTypeRole"; import {getBussinessTypeRole, updateBussinessTypeRole} from "../../../api/basic/bussinessTypeRole";
import {isBlank} from "@/utils/strUtil";
const formJson = { const formJson = {
id: "", id: "",
@ -435,13 +436,10 @@ export default {
}, },
// //
resetForm() { resetForm() {
if (this.$refs["dataForm"]) { this.$nextTick(() => {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields(); this.$refs["dataForm"].resetFields();
this.getList(); this.$refs["dataForm"].clearValidate();
} });
}, },
// //
hideForm() { hideForm() {
@ -451,6 +449,7 @@ export default {
}, },
// //
handleForm(index, row) { handleForm(index, row) {
this.resetForm();
this.formVisible = true; this.formVisible = true;
if (null != index) { if (null != index) {
// //
@ -469,37 +468,38 @@ export default {
} }
}, },
formSubmit() { formSubmit() {
this.$refs["dataForm"].validate(valid => { if (isBlank(this.formData.name)) {
if (valid) { this.$message.error("角色名称为必填项!");
this.formLoading = true; return;
let data = Object.assign({}, this.formData); }
authRoleSave(data, this.formName)
.then(response => { this.formLoading = true;
this.formLoading = false; let data = Object.assign({}, this.formData);
if (response.code !== 20000) { authRoleSave(data, this.formName)
this.$message.error(response.message); .then(response => {
return false; this.formLoading = false;
} if (response.code !== 20000) {
this.$message.success("操作成功"); this.$message.error(response.message);
this.formVisible = false; return false;
if (this.formName === "add") { }
// this.$message.success("操作成功");
if (response.data && response.data.id) { this.formVisible = false;
data.id = response.data.id; if (this.formName === "add") {
this.list.unshift(data); //
} if (response.data && response.data.id) {
} else { data.id = response.data.id;
this.list.splice(this.index, 1, data); this.list.unshift(data);
} }
// } else {
this.resetForm(); this.list.splice(this.index, 1, data);
this.getList(); }
}) //
.catch(() => { this.resetForm();
this.formLoading = false; this.getList();
}); })
} .catch(() => {
}); this.formLoading = false;
});
}, },
// //
handleDel(index, row) { handleDel(index, row) {
@ -526,7 +526,6 @@ export default {
}); });
}) })
.catch(() => { .catch(() => {
this.$message.info("取消删除");
}); });
} }
}, },

@ -7,6 +7,7 @@
style="width: 400px" style="width: 400px"
v-model="filterQuery.key" v-model="filterQuery.key"
placeholder="请输入" placeholder="请输入"
clearable
></el-input> ></el-input>
<el-select style="margin: 0px 15px 0px 15px;" v-model="filterQuery.bussinessStatus" clearable <el-select style="margin: 0px 15px 0px 15px;" v-model="filterQuery.bussinessStatus" clearable
@ -74,13 +75,9 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="角色" prop="roleName" width="120"></el-table-column>
<el-table-column label="角色" prop="role" width="120"></el-table-column> <el-table-column label="最大用户数" prop="userMax" width="120"></el-table-column>
<el-table-column label="最大用户数" prop="userMax" width="120"> <el-table-column label="当前用户数" prop="currentUserCount" width="120"></el-table-column>
</el-table-column>
<el-table-column label="当前用户数" prop="count" width="120">
</el-table-column>
<el-table-column label="操作" width="120" fixed="right"> <el-table-column label="操作" width="120" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button-group> <el-button-group>
@ -152,6 +149,7 @@
size="small" size="small"
style="width: 40%" style="width: 40%"
type="number" type="number"
@change="verifyUserMax"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</div> </div>
@ -299,12 +297,12 @@ export default {
}, },
value: "", value: "",
total: 0, total: 0,
loading: false,
checkFlag: { checkFlag: {
0: "未审核", 0: "未审核",
1: "已通过", 1: "已通过",
2: "已拒绝" 2: "已拒绝"
}, },
userflag: { userflag: {
0: "禁用", 0: "禁用",
1: "正常" 1: "正常"
@ -431,7 +429,6 @@ export default {
this.formVisible = false; this.formVisible = false;
this.contractVisible = false; this.contractVisible = false;
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.filterQuery.limit = val; this.filterQuery.limit = val;
this.getList(); this.getList();
@ -492,7 +489,12 @@ export default {
}), }),
(this.contractVisible = true); (this.contractVisible = true);
}, },
verifyUserMax() {
if (this.formData.userMax < 0) {
this.$message.warning("最大用户数不能小于0");
this.formData.userMax = 0;
}
},
deleteDialog(row) { deleteDialog(row) {
this.$confirm("删除后将清空该客户下所有用户?", "提示", { this.$confirm("删除后将清空该客户下所有用户?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",

@ -163,7 +163,7 @@
</el-col> </el-col>
</el-row> </el-row>
<span slot="footer" class="dialog-footer" style="margin-top: 40px"> <span slot="footer" class="dialog-footer" style="margin-top: 40px">
<el-button @click="editDialogVisible = false">取消</el-button> <el-button @click="cancelDialog"></el-button>
<el-button type="primary" @click="confirmEdit"></el-button> <el-button type="primary" @click="confirmEdit"></el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -197,10 +197,7 @@ export default {
1: "已通过", 1: "已通过",
2: "已拒绝" 2: "已拒绝"
}, },
list: [], list: [],
addDialogVisible: false,
centerDialogVisible: false, centerDialogVisible: false,
check: "", check: "",
checkQuery: { checkQuery: {
@ -248,7 +245,8 @@ export default {
this.editDialogVisible = true; this.editDialogVisible = true;
}, },
cancelDialog() { cancelDialog() {
this.addDialogVisible = false; this.editDialogVisible = false
this.getList();
}, },
handleCheckedChange(val) { handleCheckedChange(val) {
@ -265,10 +263,10 @@ export default {
checkRegister() { checkRegister() {
this.loading = true; this.loading = true;
check(this.checkQuery) check(this.checkQuery)
.then((response) => { .then((response) => {
if (response.code === 20000) { if (response.code === 20000) {
this.editDialogVisible = false;
this.getList(); this.getList();
this.$message({ this.$message({
type: "success", type: "success",
@ -287,7 +285,6 @@ export default {
this.centerDialogVisible = true; this.centerDialogVisible = true;
}, },
confirmEdit() { confirmEdit() {
this.ch;
this.checkRegister(); this.checkRegister();
}, },

@ -41,8 +41,6 @@
prop="host" prop="host"
width="260" width="260"
></el-table-column> ></el-table-column>
<el-table-column label="操作" width="120"> <el-table-column label="操作" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -110,7 +108,6 @@
</div> </div>
</el-dialog> </el-dialog>
<el-pagination <el-pagination
:current-page="filterQuery.page" :current-page="filterQuery.page"
:page-size="filterQuery.limit" :page-size="filterQuery.limit"
@ -122,8 +119,6 @@
</template> </template>
<script> <script>
import {checkPass} from "../../api/auth/register";
import {authAdminRoleList} from "../../api/auth/authAdmin";
import { import {
getPlatform, getPlatform,
updatePlatform, updatePlatform,
@ -148,16 +143,13 @@ export default {
id: "", id: "",
name: "", name: "",
host: "" host: ""
}, },
check: "", check: "",
roles: [], roles: [],
formRules: { formRules: {
name: [{required: true, message: "请输入平台名称", trigger: "blur"}], name: [{required: true, message: "请输入平台名称", trigger: "blur"}],
host: [{required: true, message: "请输入平台访问地址", trigger: "blur"}] host: [{required: true, message: "请输入平台访问地址", trigger: "blur"}]
} }
}; };
}, },
filters: { filters: {
@ -169,7 +161,6 @@ export default {
}; };
return statusMap[status]; return statusMap[status];
} }
}, },
methods: { methods: {
onReset() { onReset() {
@ -183,6 +174,12 @@ export default {
}; };
this.getList(); this.getList();
}, },
resetForm() {
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.$refs["dataForm"].clearValidate();
});
},
formSubmit() { formSubmit() {
this.$refs["dataForm"].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
if (valid) { if (valid) {
@ -221,35 +218,29 @@ export default {
cancelDialog() { cancelDialog() {
this.formVisible = false; this.formVisible = false;
}, },
handleAddClick() { handleAddClick() {
this.editType = 0; this.editType = 0;
this.formVisible = true; this.formVisible = true;
this.resetForm();
this.formData = { this.formData = {
id: null, id: null,
name: null, name: null,
host: null host: null
}; };
}, },
handleModifyClick(row) { handleModifyClick(row) {
(this.formData = { this.formData = {
id: row.id, id: row.id,
name: row.name, name: row.name,
host: row.host host: row.host
};
}), this.resetForm();
this.formVisible = true;
this.formVisible = true;
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.query.page = val; this.filterQuery.page = val;
this.getList(); this.getList();
}, },
deleteDialog(row) { deleteDialog(row) {
this.$confirm("确认删除该自助平台信息?", "提示", { this.$confirm("确认删除该自助平台信息?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
@ -267,10 +258,7 @@ export default {
.catch(() => { .catch(() => {
}); });
} }
}, },
mounted() { mounted() {
}, },
created() { created() {

@ -4,7 +4,7 @@
<el-row> <el-row>
<el-form-item class="query-form-item"> <el-form-item class="query-form-item">
<el-input <el-input
v-model="filterQuery.batchNo" v-model="filterQuery.companyName"
placeholder="企业名称" placeholder="企业名称"
></el-input> ></el-input>
</el-form-item> </el-form-item>

@ -422,9 +422,7 @@ export default {
.catch(() => { .catch(() => {
this.deleteLoading = false; this.deleteLoading = false;
}); });
}) }).catch(() => {
.catch(() => {
this.$message.info("取消删除");
}); });
} }
}, },

Loading…
Cancel
Save