This commit is contained in:
lll 2023-11-10 11:30:19 +08:00
parent 58f8287f33
commit 5afc5afdcb
9 changed files with 210 additions and 41 deletions

View File

@ -858,11 +858,17 @@ export default {
cmdlist_dz: "", cmdlist_dz: "",
}, },
rules2: { rules2: {
cmdlist_ml: [{ required: true, trigger: "change" }], cmdlist_ml: [{ required: true, trigger: "change", message: "必填项" }],
cmdlist_sbid: [{ required: true, trigger: "change" }], cmdlist_sbid: [
cmdlist_qsdz: [{ required: true, trigger: "change" }], { required: true, trigger: "change", message: "必填项" },
cmdlist_dzcd: [{ required: true, trigger: "change" }], ],
cmdlist_dz: [{ required: true, trigger: "change" }], cmdlist_qsdz: [
{ required: true, trigger: "change", message: "必填项" },
],
cmdlist_dzcd: [
{ required: true, trigger: "change", message: "必填项" },
],
cmdlist_dz: [{ required: true, trigger: "change", message: "必填项" }],
}, },
value: "", value: "",
flag: false, flag: false,
@ -1032,6 +1038,8 @@ export default {
message: "新增成功", message: "新增成功",
type: "success", type: "success",
}); });
} else {
this.$message.error("新增失败");
} }
}, },
// //

View File

@ -271,8 +271,10 @@ export default {
message: "操作成功", message: "操作成功",
type: "success", type: "success",
}); });
this.flag = true;
} else { } else {
this.$message.error("操作失败"); this.$message.error("操作失败");
return;
} }
}, },
}, },

View File

@ -222,7 +222,7 @@ export default {
ruleForm: { ruleForm: {
sswg: "", sswg: "",
csname: "", csname: "",
sfyxbz: "", // sfyxbz: "",
sdz: "", sdz: "",
cskey: "", cskey: "",
xsws: "", xsws: "",
@ -236,9 +236,9 @@ export default {
csname: [ csname: [
{ required: true, trigger: "change", message: "请选择一个选项" }, { required: true, trigger: "change", message: "请选择一个选项" },
], ],
sfyxbz: [ // sfyxbz: [
{ required: true, trigger: "change", message: "请选择一个选项" }, // { required: true, trigger: "change", message: "" },
], // ],
sdz: [{ required: true, trigger: "blur", message: "设定值是必填参数" }], sdz: [{ required: true, trigger: "blur", message: "设定值是必填参数" }],
cskey: [ cskey: [
{ required: true, trigger: "change", message: "请选择一个选项" }, { required: true, trigger: "change", message: "请选择一个选项" },

View File

@ -158,7 +158,7 @@
</el-form> </el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveAll">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -171,6 +171,7 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
//
user_id: "", user_id: "",
ippz_ip1: "192", ippz_ip1: "192",
ippz_ip2: "168", ippz_ip2: "168",
@ -204,8 +205,12 @@ export default {
ippz_dns_by: "", ippz_dns_by: "",
}, },
rules: { rules: {
ippz_ip_hqfs: [{ required: true, message: "", trigger: "blur" }], ippz_ip_hqfs: [
ippz_dns_hqfs: [{ required: true, message: "", trigger: "blur" }], { required: true, message: "请选择一项", trigger: "blur" },
],
ippz_dns_hqfs: [
{ required: true, message: "请选择一项", trigger: "blur" },
],
ippz_ip: [ ippz_ip: [
{ {
required: true, required: true,
@ -241,7 +246,7 @@ export default {
ippz_dns_by: [ ippz_dns_by: [
{ {
required: true, required: true,
validator: this.validatePrimaryDNS, validator: this.validatePrimaryDNS1,
trigger: "blur", trigger: "blur",
message: "", message: "",
}, },
@ -253,6 +258,7 @@ export default {
let that = this; let that = this;
window.getParameter = that.getParameter; window.getParameter = that.getParameter;
}, },
methods: { methods: {
getParameter(data) { getParameter(data) {
this.user_id = data; this.user_id = data;
@ -361,6 +367,7 @@ export default {
submitForm() { submitForm() {
this.$refs["ruleForm"].validate((valid) => { this.$refs["ruleForm"].validate((valid) => {
if (valid) { if (valid) {
this.saveAll();
} else { } else {
console.log("error submit!!"); console.log("error submit!!");
return false; return false;
@ -372,11 +379,26 @@ export default {
}, },
//ip //ip
validateIpAddress(rule, value, callback) { validateIpAddress(rule, value, callback) {
if (value === "") { if (
this.ippz_ip1 +
"." +
this.ippz_ip2 +
"." +
this.ippz_ip3 +
"." +
this.ippz_ip4 ===
""
) {
callback(new Error("请输入IP地址")); callback(new Error("请输入IP地址"));
} else if ( } else if (
!/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test( !/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(
value this.ippz_ip1 +
"." +
this.ippz_ip2 +
"." +
this.ippz_ip3 +
"." +
this.ippz_ip4
) )
) { ) {
callback(new Error("请输入有效的IP地址")); callback(new Error("请输入有效的IP地址"));
@ -386,11 +408,26 @@ export default {
}, },
// //
validateSubnetMask(rule, value, callback) { validateSubnetMask(rule, value, callback) {
if (value === "") { if (
this.ippz_zwym1 +
"." +
this.ippz_zwym2 +
"." +
this.ippz_zwym3 +
"." +
this.ippz_zwym4 ===
""
) {
callback(new Error("请输入子网掩码")); callback(new Error("请输入子网掩码"));
} else if ( } else if (
!/^(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$/.test( !/^(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$/.test(
value this.ippz_zwym1 +
"." +
this.ippz_zwym2 +
"." +
this.ippz_zwym3 +
"." +
this.ippz_zwym4
) )
) { ) {
callback(new Error("请输入有效的子网掩码")); callback(new Error("请输入有效的子网掩码"));
@ -400,24 +437,91 @@ export default {
}, },
// //
validateGateway(rule, value, callback) { validateGateway(rule, value, callback) {
if (value === "") { if (
this.ippz_mrwg1 +
"." +
this.ippz_mrwg2 +
"." +
this.ippz_mrwg3 +
"." +
this.ippz_mrwg4 ===
""
) {
callback(new Error("请输入网关地址")); callback(new Error("请输入网关地址"));
} else if (!/^(\d{1,3}\.){3}\d{1,3}$/.test(value)) { } else if (
!/^(\d{1,3}\.){3}\d{1,3}$/.test(
this.ippz_mrwg1 +
"." +
this.ippz_mrwg2 +
"." +
this.ippz_mrwg3 +
"." +
this.ippz_mrwg4
)
) {
callback(new Error("请输入有效的网关地址")); callback(new Error("请输入有效的网关地址"));
} else { } else {
callback(); callback();
} }
}, },
//dns //dns
validatePrimaryDNS(rule, value, callback) { validatePrimaryDNS(rule, value, callback) {
if (value === "") { if (
this.ippz_dns_zy1 +
"." +
this.ippz_dns_zy2 +
"." +
this.ippz_dns_zy3 +
"." +
this.ippz_dns_zy4 ===
""
) {
callback(new Error("请输入主DNS服务器地址")); callback(new Error("请输入主DNS服务器地址"));
} else if (!isValidPrimaryDNS(value)) { } else if (
!isValidPrimaryDNS(
this.ippz_dns_zy1 +
"." +
this.ippz_dns_zy2 +
"." +
this.ippz_dns_zy3 +
"." +
this.ippz_dns_zy4
)
) {
callback(new Error("请输入有效的主DNS服务器地址")); callback(new Error("请输入有效的主DNS服务器地址"));
} else { } else {
callback(); callback();
} }
}, },
//dns
validatePrimaryDNS1(rule, value, callback) {
if (
this.ippz_dns_by1 +
"." +
this.ippz_dns_by2 +
"." +
this.ippz_dns_by3 +
"." +
this.ippz_dns_by4 ===
""
) {
callback(new Error("请输入备用DNS服务器地址"));
} else if (
!isValidPrimaryDNS(
this.ippz_dns_by1 +
"." +
this.ippz_dns_by2 +
"." +
this.ippz_dns_by3 +
"." +
this.ippz_dns_by4
)
) {
callback(new Error("请输入有效的备用DNS服务器地址"));
} else {
callback();
}
},
}, },
created() { created() {
this.Loading = true; this.Loading = true;

View File

@ -47,7 +47,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveDatas">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -120,6 +120,16 @@ export default {
this.ruleForm.wkms = obj.wkms; this.ruleForm.wkms = obj.wkms;
} }
}, },
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveDatas();
} else {
console.log("error submit!!");
return false;
}
});
},
}, },
}; };
</script> </script>

View File

@ -1,6 +1,5 @@
<template> <template>
<div> <div>
<!-- <el-button @click="dialogVisible = true">对象管理</el-button> -->
<el-dialog title="对象管理" :visible.sync="dialogVisible" width="50%"> <el-dialog title="对象管理" :visible.sync="dialogVisible" width="50%">
<div class="title"> <div class="title">
<el-button style="margin-bottom: 10px" @click="addObj" <el-button style="margin-bottom: 10px" @click="addObj"
@ -90,7 +89,7 @@
</el-form> </el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="SaveUserAnswer">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible1 = false"> </el-button> <el-button @click="dialogVisible1 = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -122,7 +121,12 @@ export default {
dxmc: [ dxmc: [
{ required: true, trigger: "blur", message: "选择一个对象名称" }, { required: true, trigger: "blur", message: "选择一个对象名称" },
], ],
ip: [{ required: true, message: "ip地址是必填项" }], ip: [
{
required: true,
validator: this.validateIpAddress,
},
],
}, },
json: {}, json: {},
}; };
@ -136,9 +140,33 @@ export default {
getParameter(data) { getParameter(data) {
this.user_id = data; this.user_id = data;
}, },
//ip
validateIpAddress(rule, value, callback) {
if (this.ip1 + "." + this.ip2 + "." + this.ip3 + "." + this.ip4 === "") {
callback(new Error("请输入IP地址"));
} else if (
!/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(
this.ip1 + "." + this.ip2 + "." + this.ip3 + "." + this.ip4
)
) {
callback(new Error("请输入有效的IP地址"));
} else {
callback();
}
},
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.SaveUserAnswer();
} else {
console.log("error submit!!");
return false;
}
});
},
async SaveUserAnswer() { async SaveUserAnswer() {
// //
console.log(this.dxgl); // console.log(this.dxgl);
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx")); var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
this.dxgl.push({ this.dxgl.push({
dx_name: this.ruleForm.dxmc, dx_name: this.ruleForm.dxmc,
@ -150,13 +178,12 @@ export default {
user_id: `${this.user_id}`, user_id: `${this.user_id}`,
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }), mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
}); });
console.log(data.data); console.log(data.state);
if (data.state) { if (data.state) {
this.$message({ this.$message({
message: "保存成功", message: "保存成功",
type: "success", type: "success",
}); });
this.dialogVisible1 = false; this.dialogVisible1 = false;
} else { } else {
this.$message.error("保存失败"); this.$message.error("保存失败");
@ -178,11 +205,11 @@ export default {
async deleteRow(index, rows) { async deleteRow(index, rows) {
this.dxgl.splice(index, 1); this.dxgl.splice(index, 1);
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx")); var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
let { data } = await SaveUserAnswer({ let { data } = await {
mark: `${this.$store.state.type}`, mark: `${this.$store.state.type}`,
user_id: `${this.user_id}`, user_id: `${this.user_id}`,
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }), mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
}); };
console.log(data.data); console.log(data.data);
if (data.state) { if (data.state) {
this.$message({ this.$message({

View File

@ -106,7 +106,7 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<!-- <el-button type="primary" @click="submitForm('ruleForm'), (dialogVisible = false)">保存</el-button> --> <!-- <el-button type="primary" @click="submitForm('ruleForm'), (dialogVisible = false)">保存</el-button> -->
<el-button type="primary" @click="savePort"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -179,14 +179,12 @@ export default {
dkpz_dbcd: [ dkpz_dbcd: [
{ required: true, message: "请输入打包长度", trigger: "blur" }, { required: true, message: "请输入打包长度", trigger: "blur" },
// 1000 // 1000
{ validator: this.validatePackagingLength, trigger: "blur" }, // { type: "number", message: "", trigger: "blur" },
{ type: "number", message: "打包长度必须为数字值", trigger: "blur" },
], ],
dkpz_tbbtl: [ dkpz_tbbtl: [
{ required: true, message: "请输入打包时间", trigger: "blur" }, { required: true, message: "请输入打包时间", trigger: "blur" },
{ type: "number", message: "打包时间必须为数字值", trigger: "blur" }, // { type: "number", message: "", trigger: "blur" },
// 1000 // 1000
{ validator: this.validatTime, trigger: "blur" },
], ],
dkpz_tbbtl: [ dkpz_tbbtl: [
{ required: true, message: "请选择同步波特率", trigger: "change" }, { required: true, message: "请选择同步波特率", trigger: "change" },
@ -235,9 +233,9 @@ export default {
localStorage.setItem("CKFWQ_yx", JSON.stringify(datas)); localStorage.setItem("CKFWQ_yx", JSON.stringify(datas));
}, },
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs["ruleForm"].validate((valid) => {
if (valid) { if (valid) {
// alert("submit!"); this.savePort();
} else { } else {
console.log("error submit!!"); console.log("error submit!!");
return false; return false;

View File

@ -57,7 +57,7 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveDatas">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -136,6 +136,16 @@ export default {
console.log(this.ruleForm, "取"); console.log(this.ruleForm, "取");
} }
}, },
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveDatas();
} else {
console.log("error submit!!");
return false;
}
});
},
}, },
}; };
</script> </script>

View File

@ -132,7 +132,7 @@
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveDatas">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -236,6 +236,16 @@ export default {
getParameter(data) { getParameter(data) {
alert(data); alert(data);
}, },
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveDatas();
} else {
console.log("error submit!!");
return false;
}
});
},
}, },
created() { created() {
this.GetUserAnswer(); this.GetUserAnswer();