diff --git a/src/views/system/param/systemParamConfig.vue b/src/views/system/param/systemParamConfig.vue index 4a23a00..4825d53 100644 --- a/src/views/system/param/systemParamConfig.vue +++ b/src/views/system/param/systemParamConfig.vue @@ -4,19 +4,22 @@ - + + 重置 + 重置 - - + @click.native="search" + icon="el-icon-search" + > 搜索 @@ -25,9 +28,17 @@ - + - + - - + @@ -105,12 +122,14 @@ - @@ -136,6 +155,39 @@ const formJson = { }; export default { data() { + //参数分类校验 + var validatePass = (rule, value, callback) => { + let id = this.keyId; + let reg = /^[0-1]{1}$/; + let regtwo = /^(0|[1-9][0-9]*)$/; + if ( + id === "register_company_check" || + id === "sp_combie_products" || + id === "stock_order_detail_count_max" || + id === "sptm_to_di" || + id === "deliveryInstock" + ) { + if (!reg.test(value)) { + callback(new Error("请输入数字0或1")); + } else if (value === "") { + callback(new Error("请输入数字0或1")); + } else { + callback(); + } + } else if ( + id === "clean_system_log" || + id === "clean_thr_log" || + id === "clean_sync_log" + ) { + if (!regtwo.test(value)) { + callback(new Error("请输入大于或等于0的整数")); + } else if (value === "") { + callback(new Error("请输入大于或等于0的整数")); + } else { + callback(); + } + } + }; return { query: { key: null, @@ -157,14 +209,17 @@ export default { formVisible: false, formData: formJson, formRules: { - paramValue: [{required: true, message: "请输入参数值", trigger: "blur"}], + paramValue: [ + { required: true, validator: validatePass, trigger: "blur" }, + ], // , // paramStatus: [ // {required: true, message: "请选择参数状态", trigger: "change"} // ] }, deleteLoading: false, - filterQuery: {} + filterQuery: {}, + keyId: "11", }; }, methods: { @@ -219,6 +274,7 @@ export default { hideForm() { // 更改值 this.formVisible = !this.formVisible; + this.resetForm(); return true; }, // 显示表单 @@ -227,6 +283,7 @@ export default { this.formData = JSON.parse(JSON.stringify(formJson)); if (row !== null) { this.formData = Object.assign({}, row); + this.keyId = row.paramKey; } this.formName = "add"; if (index !== null) { @@ -289,8 +346,7 @@ export default { return paramStatusMap[paramStatus]; }, }, - mounted() { - }, + mounted() {}, created() { // 加载表格数据 this.getList();