-
@@ -122,7 +121,12 @@ export default {
dxmc: [
{ required: true, trigger: "blur", message: "选择一个对象名称" },
],
- ip: [{ required: true, message: "ip地址是必填项" }],
+ ip: [
+ {
+ required: true,
+ validator: this.validateIpAddress,
+ },
+ ],
},
json: {},
};
@@ -136,9 +140,33 @@ export default {
getParameter(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() {
//拿本地存的数据
- console.log(this.dxgl);
+ // console.log(this.dxgl);
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
this.dxgl.push({
dx_name: this.ruleForm.dxmc,
@@ -150,13 +178,12 @@ export default {
user_id: `${this.user_id}`,
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
});
- console.log(data.data);
+ console.log(data.state);
if (data.state) {
this.$message({
message: "保存成功",
type: "success",
});
-
this.dialogVisible1 = false;
} else {
this.$message.error("保存失败");
@@ -178,11 +205,11 @@ export default {
async deleteRow(index, rows) {
this.dxgl.splice(index, 1);
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
- let { data } = await SaveUserAnswer({
+ let { data } = await {
mark: `${this.$store.state.type}`,
user_id: `${this.user_id}`,
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
- });
+ };
console.log(data.data);
if (data.state) {
this.$message({
diff --git a/src/components/PortConfiguration.vue b/src/components/PortConfiguration.vue
index a9a40f1..aa68421 100644
--- a/src/components/PortConfiguration.vue
+++ b/src/components/PortConfiguration.vue
@@ -106,7 +106,7 @@
@@ -179,14 +179,12 @@ export default {
dkpz_dbcd: [
{ required: true, message: "请输入打包长度", trigger: "blur" },
// 自定义校验规则,这里限制最大长度为1000
- { validator: this.validatePackagingLength, trigger: "blur" },
- { type: "number", message: "打包长度必须为数字值", trigger: "blur" },
+ // { type: "number", message: "打包长度必须为数字值", trigger: "blur" },
],
dkpz_tbbtl: [
{ required: true, message: "请输入打包时间", trigger: "blur" },
- { type: "number", message: "打包时间必须为数字值", trigger: "blur" },
+ // { type: "number", message: "打包时间必须为数字值", trigger: "blur" },
// 自定义校验规则,这里限制最大长度为1000
- { validator: this.validatTime, trigger: "blur" },
],
dkpz_tbbtl: [
{ required: true, message: "请选择同步波特率", trigger: "change" },
@@ -235,9 +233,9 @@ export default {
localStorage.setItem("CKFWQ_yx", JSON.stringify(datas));
},
submitForm(formName) {
- this.$refs[formName].validate((valid) => {
+ this.$refs["ruleForm"].validate((valid) => {
if (valid) {
- // alert("submit!");
+ this.savePort();
} else {
console.log("error submit!!");
return false;
diff --git a/src/components/Wireles.vue b/src/components/Wireles.vue
index 65815cd..18828ef 100644
--- a/src/components/Wireles.vue
+++ b/src/components/Wireles.vue
@@ -57,7 +57,7 @@
@@ -136,6 +136,16 @@ export default {
console.log(this.ruleForm, "取");
}
},
+ submitForm(formName) {
+ this.$refs["ruleForm"].validate((valid) => {
+ if (valid) {
+ this.saveDatas();
+ } else {
+ console.log("error submit!!");
+ return false;
+ }
+ });
+ },
},
};
diff --git a/src/components/netConfiguration.vue b/src/components/netConfiguration.vue
index af7876f..80af526 100644
--- a/src/components/netConfiguration.vue
+++ b/src/components/netConfiguration.vue
@@ -132,7 +132,7 @@
@@ -236,6 +236,16 @@ export default {
getParameter(data) {
alert(data);
},
+ submitForm(formName) {
+ this.$refs["ruleForm"].validate((valid) => {
+ if (valid) {
+ this.saveDatas();
+ } else {
+ console.log("error submit!!");
+ return false;
+ }
+ });
+ },
},
created() {
this.GetUserAnswer();