运行参数分类校验

ywj_dev
曹晨晨 2 years ago
parent 96e8ca81da
commit ab2c468ad5

@ -4,19 +4,22 @@
<el-form :inline="true" :model="query" class="query-form" size="mini">
<el-row>
<el-form-item class="query-form-item" label="关键字搜索:">
<el-input v-model="query.key" placeholder="参数关键字搜索" clearable></el-input>
<el-input
v-model="query.key"
placeholder="参数关键字搜索"
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"
>重置
</el-button>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
>重置
</el-button>
<el-button type="primary"
@click.native="search"
icon="el-icon-search">
@click.native="search"
icon="el-icon-search"
>
搜索
</el-button>
</el-button-group>
@ -25,9 +28,17 @@
</el-form>
<el-table v-loading="loading" :data="list" style="width: 100%" border>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="参数名" prop="paramName" width="320"></el-table-column>
<el-table-column
label="参数名"
prop="paramName"
width="320"
></el-table-column>
<!-- <el-table-column label="参数键" prop="paramKey" width="200"></el-table-column>-->
<el-table-column label="参数值" prop="paramValue" width="100"></el-table-column>
<el-table-column
label="参数值"
prop="paramValue"
width="100"
></el-table-column>
<el-table-column label="参数说明" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.paramExplain }}</span>
@ -39,13 +50,13 @@
type="text"
size="small"
@click.native="handleForm(scope.$index, scope.row)"
>设置
>设置
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="query.page"
:limit.sync="query.limit"
@ -72,28 +83,34 @@
style="width: 90%"
></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="参数键:" prop="paramKey" label-width="100px">
<el-input
v-model="formData.paramKey"
auto-complete="off" style="width: 90%"
auto-complete="off"
style="width: 90%"
:disabled="true"
></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="参数值" prop="paramValue" label-width="100px">
<el-input type="" v-model="formData.paramValue" auto-complete="off" style="width: 90%"></el-input>
<el-input
type=""
v-model="formData.paramValue"
auto-complete="off"
style="width: 90%"
></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="参数说明:" label-width="100px">
<el-input
type="textarea"
v-model="formData.paramExplain" style="width: 90%"
v-model="formData.paramExplain"
style="width: 90%"
:disabled="true"
></el-input>
</el-form-item>
@ -105,12 +122,14 @@
<!--<el-radio :label="1">正常</el-radio>-->
<!--</el-radio-group>-->
<!--</el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button type="primary" @click.native="formSubmit()" :loading="formLoading"
>提交
<el-button
type="primary"
@click.native="formSubmit()"
:loading="formLoading"
>提交
</el-button>
</div>
</el-dialog>
@ -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();

Loading…
Cancel
Save