This commit is contained in:
unknown 2023-11-10 19:17:45 +08:00
commit 587849810d
12 changed files with 253 additions and 49 deletions

View File

@ -26,6 +26,7 @@ export default {
},
created() {
// this.queryallanswer();
console.log(this.$annswerObj, "变化没用");
},
methods: {
//

5
src/answerObj.js Normal file
View File

@ -0,0 +1,5 @@
export let answer = {
kqwk: "",
wkgzfs: "",
wkms: "",
};

View File

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

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-dialog title="网关配置" :visible.sync="dialogVisible">
<el-dialog title="网关配置" :visible.sync="dialogVisible" width="70%">
<el-dialog title="详情" :visible.sync="xqFlag" width="30%">
<div class="xqbox">
<p>
@ -41,7 +41,7 @@
{{ scope.$index + 1 }}
</template></el-table-column
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="selection" width="40"> </el-table-column>
<el-table-column prop="wgid" label="网关ID"> </el-table-column>
<el-table-column prop="wgbh" label="网关编号"> </el-table-column>
<el-table-column prop="wgmc" label="网关名称"> </el-table-column>
@ -81,7 +81,7 @@
</el-table>
</el-dialog>
<el-dialog title="新建网关" :visible.sync="flag" width="30%">
<el-dialog title="新建网关" :visible.sync="flag">
<el-form
:model="ruleForm"
:rules="rules"
@ -167,6 +167,7 @@ export default {
user_id: "",
wgpz: [],
FormData: [],
multipleSelection: [],
search: "",
rowDate: {},
ruleForm: {
@ -207,7 +208,6 @@ export default {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
if (this.wgpz.length < 4) {
this.wgpz.push(this.ruleForm);
localStorage.setItem("wgpz", JSON.stringify(this.wgpz));
this.SaveUserAnswer();
this.flag = false;
@ -219,7 +219,6 @@ export default {
return false;
}
} else {
console.log("error submit!!");
return false;
}
});
@ -236,6 +235,13 @@ export default {
},
//
deleteSelectedRows() {
if (this.multipleSelection.length == 0) {
this.$message({
message: "请先选择数据",
type: "warning",
});
return false;
}
this.wgpz = this.wgpz.filter(
(row) => !this.multipleSelection.includes(row)
);
@ -267,12 +273,15 @@ export default {
mark_value: JSON.stringify(this.wgpz),
});
if (data.state) {
this.wgpz.push(this.ruleForm);
this.$message({
message: "操作成功",
type: "success",
});
this.flag = true;
} else {
this.$message.error("操作失败");
return;
}
},
},
@ -301,4 +310,7 @@ export default {
}
}
}
.el-table {
height: 400px;
}
</style>

View File

@ -39,6 +39,7 @@
title="网关维护"
:visible.sync="dialogVisible"
:append-to-body="true"
width="90%"
>
<div class="title">
<div class="left">
@ -222,7 +223,7 @@ export default {
ruleForm: {
sswg: "",
csname: "",
sfyxbz: "",
// sfyxbz: "",
sdz: "",
cskey: "",
xsws: "",
@ -236,9 +237,9 @@ export default {
csname: [
{ required: true, trigger: "change", message: "请选择一个选项" },
],
sfyxbz: [
{ required: true, trigger: "change", message: "请选择一个选项" },
],
// sfyxbz: [
// { required: true, trigger: "change", message: "" },
// ],
sdz: [{ required: true, trigger: "blur", message: "设定值是必填参数" }],
cskey: [
{ required: true, trigger: "change", message: "请选择一个选项" },
@ -277,9 +278,8 @@ export default {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
if (this.tableData.length < 4) {
this.tableData.push(this.ruleForm);
localStorage.setItem("wgwh", JSON.stringify(this.tableData));
this.SaveUserAnswer();
localStorage.setItem("wgwh", JSON.stringify(this.tableData));
this.flag = false;
} else {
this.$message({
@ -333,6 +333,7 @@ export default {
mark_value: JSON.stringify(this.tableData),
});
if (data.state) {
this.tableData.push(this.ruleForm);
this.$message({
message: "操作成功",
type: "success",
@ -373,4 +374,7 @@ export default {
}
}
}
.el-table {
height: 400px;
}
</style>

View File

@ -158,7 +158,7 @@
</el-form>
</div>
<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>
</span>
</el-dialog>
@ -171,6 +171,7 @@ export default {
data() {
return {
loading: false,
//
user_id: "",
ippz_ip1: "192",
ippz_ip2: "168",
@ -204,8 +205,12 @@ export default {
ippz_dns_by: "",
},
rules: {
ippz_ip_hqfs: [{ required: true, message: "", trigger: "blur" }],
ippz_dns_hqfs: [{ required: true, message: "", trigger: "blur" }],
ippz_ip_hqfs: [
{ required: true, message: "请选择一项", trigger: "blur" },
],
ippz_dns_hqfs: [
{ required: true, message: "请选择一项", trigger: "blur" },
],
ippz_ip: [
{
required: true,
@ -241,7 +246,7 @@ export default {
ippz_dns_by: [
{
required: true,
validator: this.validatePrimaryDNS,
validator: this.validatePrimaryDNS1,
trigger: "blur",
message: "",
},
@ -253,6 +258,7 @@ export default {
let that = this;
window.getParameter = that.getParameter;
},
methods: {
getParameter(data) {
this.user_id = data;
@ -361,6 +367,7 @@ export default {
submitForm() {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveAll();
} else {
console.log("error submit!!");
return false;
@ -372,11 +379,26 @@ export default {
},
//ip
validateIpAddress(rule, value, callback) {
if (value === "") {
if (
this.ippz_ip1 +
"." +
this.ippz_ip2 +
"." +
this.ippz_ip3 +
"." +
this.ippz_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(
value
!/^(\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(
this.ippz_ip1 +
"." +
this.ippz_ip2 +
"." +
this.ippz_ip3 +
"." +
this.ippz_ip4
)
) {
callback(new Error("请输入有效的IP地址"));
@ -386,11 +408,26 @@ export default {
},
//
validateSubnetMask(rule, value, callback) {
if (value === "") {
if (
this.ippz_zwym1 +
"." +
this.ippz_zwym2 +
"." +
this.ippz_zwym3 +
"." +
this.ippz_zwym4 ===
""
) {
callback(new Error("请输入子网掩码"));
} 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(
value
this.ippz_zwym1 +
"." +
this.ippz_zwym2 +
"." +
this.ippz_zwym3 +
"." +
this.ippz_zwym4
)
) {
callback(new Error("请输入有效的子网掩码"));
@ -400,24 +437,91 @@ export default {
},
//
validateGateway(rule, value, callback) {
if (value === "") {
if (
this.ippz_mrwg1 +
"." +
this.ippz_mrwg2 +
"." +
this.ippz_mrwg3 +
"." +
this.ippz_mrwg4 ===
""
) {
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("请输入有效的网关地址"));
} else {
callback();
}
},
//dns
//dns
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服务器地址"));
} 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服务器地址"));
} else {
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() {
this.Loading = true;

View File

@ -47,8 +47,9 @@
</el-form-item>
</el-form>
<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="change">改变</el-button> -->
</span>
</el-dialog>
</div>
@ -67,6 +68,11 @@ export default {
wkgzfs: "LAN口",
wkms: "n",
},
// $answerObj: {
// kqwk: "",
// wkgzfs: "",
// wkms: "",
// },
rules: {
kqwk: [{ required: true, trigger: "change", message: "必填项" }],
wkgzfs: [{ required: true, trigger: "change", message: "必填项" }],
@ -75,6 +81,9 @@ export default {
};
},
created() {
// this.$answerObj.kqwk = "";
// console.log(this.$answerObj);
let that = this;
window.getParameter = that;
this.GetUserAnswer();
@ -83,6 +92,9 @@ export default {
getParameter(data) {
this.user_id = data;
},
change() {
console.log(this.$answerObj);
},
async saveDatas() {
let datas = JSON.parse(sessionStorage.getItem("CKFWQ_wx"));
let res = await SaveUserAnswer({
@ -106,7 +118,7 @@ export default {
this.$message.error("保存失败");
}
},
//
//
async GetUserAnswer() {
let res = await GetUserAnswer({
mark: "CKFWQ_wx",
@ -120,6 +132,16 @@ export default {
this.ruleForm.wkms = obj.wkms;
}
},
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveDatas();
} else {
console.log("error submit!!");
return false;
}
});
},
},
};
</script>

View File

@ -1,6 +1,5 @@
<template>
<div>
<!-- <el-button @click="dialogVisible = true">对象管理</el-button> -->
<el-dialog title="对象管理" :visible.sync="dialogVisible" width="50%">
<div class="title">
<el-button style="margin-bottom: 10px" @click="addObj"
@ -90,7 +89,7 @@
</el-form>
</div>
<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>
</span>
</el-dialog>
@ -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({

View File

@ -106,7 +106,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<!-- <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>
</span>
</el-dialog>
@ -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;

View File

@ -57,7 +57,7 @@
</el-form>
<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>
</span>
</el-dialog>
@ -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;
}
});
},
},
};
</script>

View File

@ -132,7 +132,7 @@
</div>
</div>
<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>
</span>
</el-dialog>
@ -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();

View File

@ -6,6 +6,8 @@ import "element-ui/lib/theme-chalk/index.css";
import store from "./store";
Vue.config.productionTip = false;
import moment from "moment";
import { answer } from "./answerObj";
let answerObj = Vue.observable(answer);
//定义一个全局过滤器实现日期格式化
Vue.filter("datefmt", function (input, fmtstring) {
//当input为时间戳时需转为Number类型
@ -14,6 +16,7 @@ Vue.filter("datefmt", function (input, fmtstring) {
});
Vue.prototype.$moment = moment;
Vue.prototype.$store = store;
Vue.prototype.$answerObj = answerObj;
Vue.use(ElementUI);
new Vue({
router,