This commit is contained in:
lll 2023-11-07 16:09:03 +08:00
parent f5a17b3395
commit 672924494c
7 changed files with 517 additions and 194 deletions

View File

@ -19,13 +19,15 @@ export default {
}, },
methods: { methods: {
// //
// async queryallanswer() { async queryallanswer() {
// let { data } = await queryallanswer(); let { data } = await queryallanswer();
// let arr = []; console.log(JSON.parse(JSON.stringify(data.data)));
// arr = data.data; let arr = [];
// arr.forEach((item) => { arr = data.data;
// item.answer = JSON.parse(item.answer); arr.forEach((item) => {
// }); item.answer = JSON.parse(item.answer);
});
},
// console.log(arr); // console.log(arr);
// let obj = { // let obj = {
// cjdpz_beilv: "2", // cjdpz_beilv: "2",

View File

@ -2,5 +2,5 @@ import axios from "axios";
//获取正确答案 //获取正确答案
export let queryallanswer = () => export let queryallanswer = () =>
axios.get( axios.get(
"http://172.16.1.254:10014/Handler/Config.ashx?action=queryallanswer" "http://111.229.30.246:10013/Handler/Config.ashx?action=queryallanswer"
); );

View File

@ -1,12 +1,7 @@
<template> <template>
<div> <div>
<div> <div>
<el-dialog <el-dialog title="添加策略" :visible.sync="dialogVisible1" width="82%">
title="添加策略"
:visible.sync="dialogVisible1"
:before-close="handleClose"
width="82%"
>
<el-form <el-form
:model="ruleForm1" :model="ruleForm1"
:rules="rules1" :rules="rules1"
@ -351,7 +346,7 @@
margin-top: 10px; margin-top: 10px;
" "
> >
<h3 style="margin-top: 10px; margin-bottom: 3px; color: #fff"> <h3 style="margin-top: 10px; margin-bottom: 3px; color: #fff4">
命令列表 命令列表
</h3> </h3>
<el-button @click="flag = true">新增命令</el-button> <el-button @click="flag = true">新增命令</el-button>
@ -390,14 +385,8 @@
</el-dialog> </el-dialog>
</div> </div>
<div> <div>
<el-dialog <el-dialog title="新增命令" :visible.sync="flag" width="30%">
title="新增命令"
:visible.sync="flag"
width="30%"
:before-close="handleClose"
>
<el-form <el-form
center
:model="ruleForm2" :model="ruleForm2"
:rules="rules2" :rules="rules2"
ref="ruleForm2" ref="ruleForm2"
@ -467,7 +456,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="saveAll">保存</el-button> <el-button type="primary" @click="saveMl">保存</el-button>
<el-button @click="flag = false"> </el-button> <el-button @click="flag = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -476,7 +465,7 @@
</template> </template>
<script> <script>
import { SaveUserAnswer } from "../api/user"; import { SaveUserAnswer, GetUserAnswer } from "../api/user";
export default { export default {
name: "InternetCompetitionAddPolicy", name: "InternetCompetitionAddPolicy",
@ -635,14 +624,14 @@ export default {
}, },
], ],
tableData1: [ tableData1: [
{ // {
cmdlist_ml: "", // cmdlist_ml: "",
// cmdlist_sbid: "线", // // cmdlist_sbid: "线",
cmdlist_qsdz: "", // cmdlist_qsdz: "",
cmdlist_dzcd: "", // cmdlist_dzcd: "",
cmdlist_ms: "", // cmdlist_ms: "",
cmdlist_dz: "", // cmdlist_dz: "",
}, // },
], ],
ruleForm1: { ruleForm1: {
clgl_name: "有线区策略", clgl_name: "有线区策略",
@ -705,8 +694,6 @@ export default {
clgl_rkip1: [ clgl_rkip1: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
@ -715,8 +702,6 @@ export default {
clgl_rkip2: [ clgl_rkip2: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -725,8 +710,6 @@ export default {
clgl_rkip3: [ clgl_rkip3: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -735,8 +718,6 @@ export default {
clgl_rkip4: [ clgl_rkip4: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -746,8 +727,6 @@ export default {
clgl_ckip1: [ clgl_ckip1: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
@ -756,8 +735,6 @@ export default {
clgl_ckip2: [ clgl_ckip2: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -766,8 +743,6 @@ export default {
clgl_ckip3: [ clgl_ckip3: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -776,8 +751,6 @@ export default {
clgl_ckip4: [ clgl_ckip4: [
{ required: true, trigger: "blur", message: "片段为空" }, { required: true, trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -786,38 +759,30 @@ export default {
clgl_rkwg1: [ clgl_rkwg1: [
{ trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
}, },
], ],
clgl_rkwg2: [ clgl_rkwg2: [
{ required: true, trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
}, },
], ],
clgl_rkwg3: [ clgl_rkwg3: [
{ required: true, trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
}, },
], ],
clgl_rkwg4: [ clgl_rkwg4: [
{ required: true, trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -826,38 +791,30 @@ export default {
clgl_ckwg1: [ clgl_ckwg1: [
{ trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
}, },
], ],
clgl_ckwg2: [ clgl_ckwg2: [
{ required: true, trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
}, },
], ],
clgl_ckwg3: [ clgl_ckwg3: [
{ required: true, trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
}, },
], ],
clgl_ckwg4: [ clgl_ckwg4: [
{ required: true, trigger: "blur", message: "片段为空" }, { trigger: "blur", message: "片段为空" },
{ {
min: 0,
max: 10,
message: "片段无效", message: "片段无效",
trigger: "blur", trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -893,18 +850,28 @@ export default {
}, },
value: "", value: "",
flag: false, flag: false,
json: {},
}; };
}, },
created() {
this.GetUserAnswer();
},
mounted() {}, mounted() {},
methods: { methods: {
//
async saveAll() { async saveAll() {
let { data } = await SaveUserAnswer( this.$refs["ruleForm1"].validate((valid) => {
JSON.stringify({ if (valid) {
mark: "GYWZ_wx", this.SaveUserAnswer();
user_id: "USER202307301109254198", } else {
mark_value: { return false;
}
});
},
//---
async SaveUserAnswer() {
var obj = {
clgl_name: this.ruleForm1.clgl_name, clgl_name: this.ruleForm1.clgl_name,
cmdlist_qsdz: this.ruleForm1.cmdlist_qsdz, cmdlist_qsdz: this.ruleForm1.cmdlist_qsdz,
clgl_xy: this.ruleForm1.clgl_xy, clgl_xy: this.ruleForm1.clgl_xy,
@ -913,43 +880,141 @@ export default {
clgl_ydk: this.ruleForm1.clgl_ydk, clgl_ydk: this.ruleForm1.clgl_ydk,
clgl_rkwk: this.ruleForm1.clgl_rkwk, clgl_rkwk: this.ruleForm1.clgl_rkwk,
clgl_rkip: clgl_rkip:
this.clgl_rkip1 + this.ruleForm1.clgl_rkip1 +
"." + "." +
this.clgl_rkip2 + this.ruleForm1.clgl_rkip2 +
"." + "." +
this.clgl_rkip3 + this.ruleForm1.clgl_rkip3 +
"." + "." +
this.clgl_rkip4, this.ruleForm1.clgl_rkip4,
clgl_rkwg: clgl_rkwg:
this.clgl_rkwg1 + this.ruleForm1.clgl_rkwg1 +
"." + "." +
this.clgl_rkwg2 + this.ruleForm1.clgl_rkwg2 +
"." + "." +
this.clgl_rkwg3 + this.ruleForm1.clgl_rkwg3 +
"." + "." +
this.clgl_rkwg4, this.ruleForm1.clgl_rkwg4,
clgl_ckwk: this.ruleForm1.clgl_ckwk, clgl_ckwk: this.ruleForm1.clgl_ckwk,
clgl_ckip: clgl_ckip:
this.clgl_ckip1 + this.ruleForm1.clgl_ckip1 +
"." + "." +
this.clgl_ckip2 + this.ruleForm1.clgl_ckip2 +
"." + "." +
this.clgl_ckip3 + this.ruleForm1.clgl_ckip3 +
"." + "." +
this.clgl_ckip4, this.ruleForm1.clgl_ckip4,
clgl_ckwg: clgl_ckwg:
this.clgl_ckwg1 + this.ruleForm1.clgl_ckwg1 +
"." + "." +
this.clgl_ckwg2 + this.ruleForm1.clgl_ckwg2 +
"." + "." +
this.clgl_ckwg3 + this.ruleForm1.clgl_ckwg3 +
"." + "." +
this.clgl_ckwg4, this.ruleForm1.clgl_ckwg4,
clgl_mddx: this.ruleForm1.clgl_mddx, clgl_mddx: this.ruleForm1.clgl_mddx,
clgl_mddk: this.ruleForm1.clgl_mddk, clgl_mddk: this.ruleForm1.clgl_mddk,
clgl_wdyml: this.ruleForm1.clgl_wdyml,
};
//
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
let { data } = await SaveUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
mark_value: JSON.stringify({ ...json, ...obj }),
});
if (data.state) {
sessionStorage.setItem("GYWZ_yx", JSON.stringify({ ...json, ...obj }));
this.$message({
message: "缓存成功",
type: "success",
});
this.dialogVisible1 = false;
}
}, },
}) //
); async GetUserAnswer() {
let { data } = await GetUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
});
let res = JSON.parse(data.data.mark_value);
if (res.clgl_ckip) {
this.ruleForm1.clgl_ckip1 = res.clgl_ckip.split(".")[0];
this.ruleForm1.clgl_ckip2 = res.clgl_ckip.split(".")[1];
this.ruleForm1.clgl_ckip3 = res.clgl_ckip.split(".")[2];
this.ruleForm1.clgl_ckip4 = res.clgl_rkip.split(".")[3];
this.ruleForm1.clgl_rkip1 = res.clgl_rkip.split(".")[0];
this.ruleForm1.clgl_rkip2 = res.clgl_rkip.split(".")[1];
this.ruleForm1.clgl_rkip3 = res.clgl_rkip.split(".")[2];
this.ruleForm1.clgl_rkip4 = res.clgl_rkip.split(".")[3];
this.ruleForm1.clgl_rkwg1 = res.clgl_rkwg.split(".")[0];
this.ruleForm1.clgl_rkwg2 = res.clgl_rkwg.split(".")[1];
this.ruleForm1.clgl_rkwg3 = res.clgl_rkwg.split(".")[2];
this.ruleForm1.clgl_rkwg4 = res.clgl_rkwg.split(".")[3];
this.ruleForm1.clgl_ckwg1 = res.clgl_ckwg.split(".")[0];
this.ruleForm1.clgl_ckwg2 = res.clgl_ckwg.split(".")[1];
this.ruleForm1.clgl_ckwg3 = res.clgl_ckwg.split(".")[2];
this.ruleForm1.clgl_ckwg4 = res.clgl_ckwg.split(".")[3];
this.ruleForm1.clgl_name = res.clgl_name;
this.ruleForm1.clgl_xy = res.clgl_xy;
this.ruleForm1.clgl_gzms = res.clgl_gzms;
this.ruleForm1.clgl_mddk = res.clgl_mddk;
this.ruleForm1.clgl_ydx = res.clgl_ydx;
this.ruleForm1.clgl_ydk = res.clgl_ydk;
this.ruleForm1.clgl_mddk = res.clgl_mddk;
this.ruleForm1.clgl_dldk = res.clgl_dldk;
this.ruleForm1.clgl_rkwk = res.clgl_rkwk;
this.ruleForm1.clgl_wdyml = res.clgl_wdyml;
this.ruleForm1.clgl_ckwk = res.clgl_ckwk;
this.tableData1 = [
{
cmdlist_ml: res.cmdlist_ml,
cmdlist_sbid: res.cmdlist_sbid,
cmdlist_qsdz: res.cmdlist_qsdz,
cmdlist_dzcd: res.cmdlist_dzcd,
cmdlist_ms: res.cmdlist_ms,
cmdlist_dz: res.cmdlist_dz,
},
];
}
},
//-
saveMl() {
this.$refs["ruleForm2"].validate((valid) => {
if (valid) {
this.saveMlAnswer();
} else {
return false;
}
});
},
//
async saveMlAnswer() {
var obj = {
cmdlist_ml: this.ruleForm2.cmdlist_ml,
cmdlist_sbid: this.ruleForm2.cmdlist_sbid,
cmdlist_qsdz: this.ruleForm2.cmdlist_qsdz,
cmdlist_dzcd: this.ruleForm2.cmdlist_dzcd,
cmdlist_ms: this.ruleForm2.cmdlist_ms,
cmdlist_dz: this.ruleForm2.cmdlist_dz,
};
//
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
let { data } = await SaveUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
mark_value: JSON.stringify({ ...json, ...obj }),
});
if (data.state) {
this.tableData1 = [obj];
sessionStorage.setItem("GYWZ_yx", JSON.stringify({ ...json, ...obj }));
this.flag = false;
this.$message({
message: "新增成功",
type: "success",
});
}
}, },
}, },
}; };

View File

@ -8,7 +8,7 @@
width="40%" width="40%"
:before-close="handleClose" :before-close="handleClose"
> >
<h3>内网网卡</h3> <h3 style="color: #fff">内网网卡</h3>
<el-divider></el-divider> <el-divider></el-divider>
<el-table :data="tableData" style="width: 100%" border> <el-table :data="tableData" style="width: 100%" border>
<el-table-column prop="wlgl_nw_name" label="网卡名称"> <el-table-column prop="wlgl_nw_name" label="网卡名称">
@ -70,7 +70,7 @@
</div> </template </div> </template
></el-table-column> ></el-table-column>
</el-table> </el-table>
<h3>外网网卡</h3> <h3 style="color: #fff">外网网卡</h3>
<el-divider></el-divider> <el-divider></el-divider>
<el-table :data="tableData1" style="width: 100%" border> <el-table :data="tableData1" style="width: 100%" border>
<el-table-column prop="wlgl_ww_name" label="网卡名称"> <el-table-column prop="wlgl_ww_name" label="网卡名称">
@ -134,26 +134,25 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false" <el-button type="primary" @click="save">保存</el-button>
>保存</el-button
>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { SaveUserAnswer, GetUserAnswer } from "../api/user";
export default { export default {
data() { data() {
return { return {
wlgl_nw_ip1: "192", wlgl_nw_ip1: "",
wlgl_nw_ip2: "168", wlgl_nw_ip2: "",
wlgl_nw_ip3: "1", wlgl_nw_ip3: "",
wlgl_nw_ip4: "1", wlgl_nw_ip4: "",
wlgl_nw_zwym1: "255", wlgl_nw_zwym1: "",
wlgl_nw_zwym2: "255", wlgl_nw_zwym2: "",
wlgl_nw_zwym3: "255", wlgl_nw_zwym3: "",
wlgl_nw_zwym4: "0", wlgl_nw_zwym4: "",
wlgl_ww_ip1: "", wlgl_ww_ip1: "",
wlgl_ww_ip2: "", wlgl_ww_ip2: "",
wlgl_ww_ip3: "", wlgl_ww_ip3: "",
@ -185,20 +184,106 @@ export default {
dialogVisible: true, dialogVisible: true,
tableData: [ tableData: [
{ {
wlgl_nw_name: "有线区网闸(内网)", wlgl_nw_name: "",
wlgl_nw_ip: "192.168.1.1", wlgl_nw_ip: "",
wlgl_nw_zwym: "255.255.255.0", wlgl_nw_zwym: "",
}, },
], ],
tableData1: [ tableData1: [
{ {
wlgl_ww_name: "有线区网闸(外网)", wlgl_ww_name: "",
wlgl_ww_ip: "", wlgl_ww_ip: "",
wlgl_ww_zwym: "", wlgl_ww_zwym: "",
}, },
], ],
}; };
}, },
created() {
this.GetUserAnswer();
},
methods: {
async save() {
var obj = {
wlgl_nw_name: this.tableData[0].wlgl_nw_name,
wlgl_nw_ip:
this.wlgl_nw_ip1 +
"." +
this.wlgl_nw_ip2 +
"." +
this.wlgl_nw_ip3 +
"." +
this.wlgl_nw_ip4,
wlgl_nw_zwym:
this.wlgl_nw_zwym1 +
"." +
this.wlgl_nw_zwym2 +
"." +
this.wlgl_nw_zwym3 +
"." +
this.wlgl_nw_zwym4,
wlgl_ww_name: this.tableData1[0].wlgl_ww_name,
wlgl_ww_ip:
this.wlgl_ww_ip1 +
"." +
this.wlgl_ww_ip2 +
"." +
this.wlgl_ww_ip3 +
"." +
this.wlgl_ww_ip4,
wlgl_ww_zwym:
this.wlgl_ww_zwym1 +
"." +
this.wlgl_ww_zwym2 +
"." +
this.wlgl_ww_zwym3 +
"." +
this.wlgl_ww_zwym4,
};
let { data } = await SaveUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
mark_value: JSON.stringify(obj),
});
if (data.state) {
sessionStorage.setItem("GYWZ_yx", JSON.stringify(obj));
this.$message({
message: "保存成功",
type: "success",
});
this.dialogVisible = false;
}
},
//
async GetUserAnswer() {
let { data } = await GetUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
});
if (data.state) {
let res = JSON.parse(data.data.mark_value);
console.log(res);
this.tableData[0].wlgl_nw_name = res.wlgl_nw_name;
this.wlgl_nw_ip1 = res.wlgl_nw_ip.split(".")[0];
this.wlgl_nw_ip2 = res.wlgl_nw_ip.split(".")[1];
this.wlgl_nw_ip3 = res.wlgl_nw_ip.split(".")[2];
this.wlgl_nw_ip4 = res.wlgl_nw_ip.split(".")[3];
this.wlgl_nw_zwym1 = res.wlgl_nw_zwym.split(".")[0];
this.wlgl_nw_zwym2 = res.wlgl_nw_zwym.split(".")[1];
this.wlgl_nw_zwym3 = res.wlgl_nw_zwym.split(".")[2];
this.wlgl_nw_zwym4 = res.wlgl_nw_zwym.split(".")[3];
this.tableData1[0].wlgl_ww_name = res.wlgl_ww_name;
this.wlgl_ww_ip1 = res.wlgl_ww_ip.split(".")[0];
this.wlgl_ww_ip2 = res.wlgl_ww_ip.split(".")[1];
this.wlgl_ww_ip3 = res.wlgl_ww_ip.split(".")[2];
this.wlgl_ww_ip4 = res.wlgl_ww_ip.split(".")[3];
this.wlgl_ww_zwym1 = res.wlgl_ww_zwym.split(".")[0];
this.wlgl_ww_zwym2 = res.wlgl_ww_zwym.split(".")[1];
this.wlgl_ww_zwym3 = res.wlgl_ww_zwym.split(".")[2];
this.wlgl_ww_zwym4 = res.wlgl_ww_zwym.split(".")[3];
}
},
},
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -8,10 +8,10 @@
:before-close="handleClose" :before-close="handleClose"
> >
<div class="title"> <div class="title">
<el-button style="margin-bottom: 10px" @click="dialogVisible1 = true" <el-button style="margin-bottom: 10px" @click="addObj"
>新增对象</el-button >新增对象</el-button
> >
<p v-if="dxgl.length == 2">只能添加两条数据</p> <p v-if="dxgl.length >= 2">只能添加两条数据</p>
</div> </div>
<el-table :data="dxgl" style="width: 100%" border> <el-table :data="dxgl" style="width: 100%" border>
@ -21,13 +21,18 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="dx_name" label="对象名称"> </el-table-column> <el-table-column prop="dx_name" label="对象名称"> </el-table-column>
<el-table-column prop="address" label="IP地址信息"> </el-table-column> <el-table-column prop="ip" label="IP地址信息"> </el-table-column>
<el-table-column fixed="right" label="操作" width="100"> <el-table-column fixed="right" label="操作" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="text" size="small" <el-button @click="handleClick(scope.row)" type="text" size="small"
>编辑</el-button >编辑</el-button
> >
<el-button type="text" size="small">删除</el-button> <el-button
type="text"
size="small"
@click="deleteRow(scope.$index, scope.row)"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -51,8 +56,8 @@
<el-form-item label="IP类型:" prop="iplx"> <el-form-item label="IP类型:" prop="iplx">
<el-col :span="10"> <el-col :span="10">
<el-select v-model="ruleForm.iplx" style="width: 200px"> <el-select v-model="ruleForm.iplx" style="width: 200px">
<el-option label="IP4" value="IP4"></el-option> <el-option label="IPV4" value="IPV4"></el-option>
<el-option label="IP6" value="IP6"></el-option> <el-option label="IPV6" value="IPV6"></el-option>
</el-select> </el-select>
</el-col> </el-col>
</el-form-item> </el-form-item>
@ -73,9 +78,7 @@
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-row> <el-form-item label="IP" prop="ip">
<el-col :span="24">
<el-form-item label="IP地址:" prop="ip">
<el-row> <el-row>
<el-col :span="5"> <el-col :span="5">
<el-input v-model="ip1"></el-input> <el-input v-model="ip1"></el-input>
@ -94,20 +97,17 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form-item> </el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible1 = false" <el-button type="primary" @click="save">保存</el-button>
>保存</el-button
>
<el-button @click="dialogVisible1 = false"> </el-button> <el-button @click="dialogVisible1 = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { SaveUserAnswer, GetUserAnswer } from "../api/user";
export default { export default {
data() { data() {
return { return {
@ -124,20 +124,96 @@ export default {
// ip: "", // ip: "",
// }, // },
], ],
ip1: "",
ip2: "",
ip3: "",
ip4: "",
ruleForm: { ruleForm: {
iplx: "IP4", iplx: "IPV4",
dxmc: "有线区交换机", dxmc: "有线区交换机",
ip: "", ip: "",
}, },
rules: { rules: {
iplx: [{ required: true, trigger: "change" }], iplx: [
dxmc: [{ required: true, trigger: "blur" }], { required: true, trigger: "change", message: "选择一个ip类型" },
ip: [{ required: true, trigger: "blur" }], ],
dxmc: [
{ required: true, trigger: "blur", message: "选择一个对象名称" },
],
ip: [{ required: true, message: "ip地址是必填项" }],
}, },
json: {},
}; };
}, },
created() {
this.GetUserAnswer();
},
methods: { methods: {
handleClick() {}, handleClick() {},
save() {
this.SaveUserAnswer();
},
async SaveUserAnswer() {
//
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
this.dxgl.push({
dx_name: this.ruleForm.dxmc,
iplx: this.ruleForm.iplx,
ip: this.ip1 + "." + this.ip2 + "." + this.ip3 + "." + this.ip4,
});
let { data } = await SaveUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
});
console.log(data.data);
if (data.state) {
this.$message({
message: "保存成功",
type: "success",
});
this.dialogVisible1 = false;
} else {
this.$message.error("保存失败");
}
},
async GetUserAnswer() {
let { data } = await GetUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
});
if (data.state) {
console.log(JSON.parse(data.data.mark_value).dxgl);
this.dxgl = JSON.parse(data.data.mark_value).dxgl;
}
},
//
async deleteRow(index, rows) {
this.dxgl.splice(index, 1);
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
let { data } = await SaveUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301109254198",
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
});
console.log(data.data);
if (data.state) {
this.$message({
message: "删除成功",
type: "success",
});
} else {
this.$message.error("删除失败");
}
},
addObj() {
if (this.dxgl.length >= 2) {
return;
}
this.dialogVisible1 = true;
},
}, },
}; };
</script> </script>
@ -182,4 +258,19 @@ export default {
color: red; color: red;
} }
} }
.el-col-1 {
padding: 0px 4px;
line-height: 62px;
height: 20px;
text-align: center;
}
.el-input__inner {
height: 30px;
}
.el-col-5 {
width: 43px;
height: 30px;
}
</style> </style>

View File

@ -5,7 +5,7 @@
<el-button style="margin-bottom: 10px" @click="addPolicy" <el-button style="margin-bottom: 10px" @click="addPolicy"
>新增策略</el-button >新增策略</el-button
> >
<p v-if="tableData.length == 2">只能添加两条数据</p> <p v-if="tableData.length >= 2">只能添加两条数据</p>
</div> </div>
<el-table :data="tableData" style="width: 100%" border> <el-table :data="tableData" style="width: 100%" border>
@ -39,7 +39,12 @@
<el-button @click="handleClick(scope.row)" type="text" size="small" <el-button @click="handleClick(scope.row)" type="text" size="small"
>编辑</el-button >编辑</el-button
> >
<el-button type="text" size="small">删除</el-button> <el-button
type="text"
size="small"
@click="del(scope.$index, scope.row)"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -269,15 +274,56 @@ export default {
flag: false, flag: false,
}; };
}, },
watch: { created() {
$route(to, from) { var obj = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
this.dialogVisible = true; console.log(obj);
this.tableData = [
{
clgl_name: obj.clgl_name,
cmdlist_qsdz: obj.cmdlist_qsdz,
clgl_xy: obj.clgl_xy,
clgl_gzms: obj.clgl_gzms,
clgl_ydx: obj.clgl_ydx,
clgl_ydk: obj.clgl_ydk,
clgl_rkwk: obj.clgl_rkwk,
clgl_rkip: obj.clgl_rkip,
clgl_rkwg: obj.clgl_rkwg,
clgl_ckwk: obj.clgl_ckwk,
clgl_ckip: obj.clgl_ckip,
clgl_ckwg: obj.clgl_ckwg,
clgl_mddx: obj.clgl_mddx,
clgl_mddk: obj.clgl_mddk,
}, },
];
}, },
methods: { methods: {
addPolicy() { addPolicy() {
this.$router.push("/addstrategy"); this.$router.push("/addstrategy");
}, },
del(index, a) {
// this.tableData.splice(index, 1);
// var obj = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
// let newSessObj = {
// clgl_name: "",
// cmdlist_qsdz: "",
// clgl_xy: "",
// clgl_gzms: "",
// clgl_ydx: "",
// clgl_ydk: "",
// clgl_rkwk: "",
// clgl_rkip: "",
// clgl_rkwg: "",
// clgl_ckwk: "",
// clgl_ckip: "",
// clgl_ckwg: "",
// clgl_mddx: "",
// clgl_mddk: "",
// };
// sessionStorage.setItem(
// "GYWZ_yx",
// JSON.stringify({ ...obj, ...newSessObj })
// );
},
}, },
}; };
</script> </script>

View File

@ -2,15 +2,25 @@
<div> <div>
<!-- <el-button @click="dialogVisible = true">端口配置</el-button> --> <!-- <el-button @click="dialogVisible = true">端口配置</el-button> -->
<div v-show="dialogVisible" class="tree_menu"> <div v-show="dialogVisible" class="tree_menu">
<el-tree :data="datas" :props="defaultProps" :default-expanded-keys="['keyOfNodeToExpand']" <el-tree
:default-checked-keys="['keyOfNodeToSelect']"></el-tree> :data="datas"
:props="defaultProps"
:default-expanded-keys="['keyOfNodeToExpand']"
:default-checked-keys="['keyOfNodeToSelect']"
></el-tree>
<!-- 树形控件右键组件 --> <!-- 树形控件右键组件 -->
</div> </div>
<div class="port_content"> <div class="port_content">
<el-dialog title="端口配置" :visible.sync="dialogVisible" width="30%"> <el-dialog title="端口配置" :visible.sync="dialogVisible" width="30%">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm" <el-form
:label-position="labelPosition"> :model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="150px"
class="demo-ruleForm"
:label-position="labelPosition"
>
<el-form-item label="波特率(bps)" prop="dkpz_btl"> <el-form-item label="波特率(bps)" prop="dkpz_btl">
<el-col :span="15"> <el-col :span="15">
<el-select v-model="ruleForm.dkpz_btl"> <el-select v-model="ruleForm.dkpz_btl">
@ -39,7 +49,10 @@
<el-form-item label="检验位" prop="dkpz_jyw"> <el-form-item label="检验位" prop="dkpz_jyw">
<el-col :span="15"> <el-col :span="15">
<el-select v-model="ruleForm.dkpz_jyw"> <el-select v-model="ruleForm.dkpz_jyw">
<el-option label="无校验(None)" value="无校验(None)"></el-option> <el-option
label="无校验(None)"
value="无校验(None)"
></el-option>
<el-option label="奇校验" value="奇校验"></el-option> <el-option label="奇校验" value="奇校验"></el-option>
<el-option label="偶校验" value="偶校验"></el-option> <el-option label="偶校验" value="偶校验"></el-option>
</el-select> </el-select>
@ -63,12 +76,18 @@
</el-form-item> </el-form-item>
<el-form-item label="打包长度(bytes)" prop="dkpz_dbcd"> <el-form-item label="打包长度(bytes)" prop="dkpz_dbcd">
<el-col :span="15"> <el-col :span="15">
<el-input v-model="ruleForm.dkpz_dbcd" placeholder="0-1460"></el-input> <el-input
v-model="ruleForm.dkpz_dbcd"
placeholder="0-1460"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="打包时间(ms)" prop="dkpz_dbsj"> <el-form-item label="打包时间(ms)" prop="dkpz_dbsj">
<el-col :span="15"> <el-col :span="15">
<el-input v-model="ruleForm.dkpz_dbsj" placeholder="0-255"></el-input> <el-input
v-model="ruleForm.dkpz_dbsj"
placeholder="0-255"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="同步波特率(RF2217)" prop="dkpz_tbbtl"> <el-form-item label="同步波特率(RF2217)" prop="dkpz_tbbtl">
@ -79,10 +98,18 @@
</el-select> </el-select>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-checkbox label="使能串口心跳包" name="type" v-model="dkpz_snckxtb"></el-checkbox> <el-checkbox
label="使能串口心跳包"
name="type"
v-model="dkpz_snckxtb"
></el-checkbox>
</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 @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -134,10 +161,18 @@ export default {
dkpz_tbbtl: "", dkpz_tbbtl: "",
}, },
rules: { rules: {
dkpz_btl: [{ required: true, message: "请选择波特率", trigger: "change" }], dkpz_btl: [
dkpz_sjw: [{ required: true, message: "请选择数据位", trigger: "change" }], { required: true, message: "请选择波特率", trigger: "change" },
dkpz_tzw: [{ required: true, message: "请选择停止位", trigger: "change" }], ],
dkpz_jyw: [{ required: true, message: "请选择检验位", trigger: "change" }], dkpz_sjw: [
{ required: true, message: "请选择数据位", trigger: "change" },
],
dkpz_tzw: [
{ required: true, message: "请选择停止位", trigger: "change" },
],
dkpz_jyw: [
{ required: true, message: "请选择检验位", trigger: "change" },
],
dkpz_lkms: [ dkpz_lkms: [
{ required: true, message: "请选择流控模式", trigger: "blur" }, { required: true, message: "请选择流控模式", trigger: "blur" },
], ],
@ -207,7 +242,6 @@ export default {
border: 1px solid rgba(220, 220, 220, 1); border: 1px solid rgba(220, 220, 220, 1);
} }
/deep/ .port_content { /deep/ .port_content {
.el-input { .el-input {
width: 200px; width: 200px;