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

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

View File

@ -2,5 +2,5 @@ import axios from "axios";
//获取正确答案
export let queryallanswer = () =>
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>
<div>
<div>
<el-dialog
title="添加策略"
:visible.sync="dialogVisible1"
:before-close="handleClose"
width="82%"
>
<el-dialog title="添加策略" :visible.sync="dialogVisible1" width="82%">
<el-form
:model="ruleForm1"
:rules="rules1"
@ -351,7 +346,7 @@
margin-top: 10px;
"
>
<h3 style="margin-top: 10px; margin-bottom: 3px; color: #fff">
<h3 style="margin-top: 10px; margin-bottom: 3px; color: #fff4">
命令列表
</h3>
<el-button @click="flag = true">新增命令</el-button>
@ -390,14 +385,8 @@
</el-dialog>
</div>
<div>
<el-dialog
title="新增命令"
:visible.sync="flag"
width="30%"
:before-close="handleClose"
>
<el-dialog title="新增命令" :visible.sync="flag" width="30%">
<el-form
center
:model="ruleForm2"
:rules="rules2"
ref="ruleForm2"
@ -467,7 +456,7 @@
</el-form-item>
</el-form>
<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>
</span>
</el-dialog>
@ -476,7 +465,7 @@
</template>
<script>
import { SaveUserAnswer } from "../api/user";
import { SaveUserAnswer, GetUserAnswer } from "../api/user";
export default {
name: "InternetCompetitionAddPolicy",
@ -635,14 +624,14 @@ export default {
},
],
tableData1: [
{
cmdlist_ml: "",
// cmdlist_sbid: "线",
cmdlist_qsdz: "",
cmdlist_dzcd: "",
cmdlist_ms: "",
cmdlist_dz: "",
},
// {
// cmdlist_ml: "",
// // cmdlist_sbid: "线",
// cmdlist_qsdz: "",
// cmdlist_dzcd: "",
// cmdlist_ms: "",
// cmdlist_dz: "",
// },
],
ruleForm1: {
clgl_name: "有线区策略",
@ -705,8 +694,6 @@ export default {
clgl_rkip1: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
@ -715,8 +702,6 @@ export default {
clgl_rkip2: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -725,8 +710,6 @@ export default {
clgl_rkip3: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -735,8 +718,6 @@ export default {
clgl_rkip4: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -746,8 +727,6 @@ export default {
clgl_ckip1: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
@ -756,8 +735,6 @@ export default {
clgl_ckip2: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -766,8 +743,6 @@ export default {
clgl_ckip3: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -776,8 +751,6 @@ export default {
clgl_ckip4: [
{ required: true, trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -786,38 +759,30 @@ export default {
clgl_rkwg1: [
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
},
],
clgl_rkwg2: [
{ required: true, trigger: "blur", message: "片段为空" },
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
},
],
clgl_rkwg3: [
{ required: true, trigger: "blur", message: "片段为空" },
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
},
],
clgl_rkwg4: [
{ required: true, trigger: "blur", message: "片段为空" },
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -826,38 +791,30 @@ export default {
clgl_ckwg1: [
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[1-9][0-9]?)$/,
},
],
clgl_ckwg2: [
{ required: true, trigger: "blur", message: "片段为空" },
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
},
],
clgl_ckwg3: [
{ required: true, trigger: "blur", message: "片段为空" },
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
},
],
clgl_ckwg4: [
{ required: true, trigger: "blur", message: "片段为空" },
{ trigger: "blur", message: "片段为空" },
{
min: 0,
max: 10,
message: "片段无效",
trigger: "blur",
pattern: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
@ -893,63 +850,171 @@ export default {
},
value: "",
flag: false,
json: {},
};
},
created() {
this.GetUserAnswer();
},
mounted() {},
methods: {
//
async saveAll() {
let { data } = await SaveUserAnswer(
JSON.stringify({
mark: "GYWZ_wx",
user_id: "USER202307301109254198",
mark_value: {
clgl_name: this.ruleForm1.clgl_name,
cmdlist_qsdz: this.ruleForm1.cmdlist_qsdz,
clgl_xy: this.ruleForm1.clgl_xy,
clgl_gzms: this.ruleForm1.clgl_gzms,
clgl_ydx: this.ruleForm1.clgl_ydx,
clgl_ydk: this.ruleForm1.clgl_ydk,
clgl_rkwk: this.ruleForm1.clgl_rkwk,
clgl_rkip:
this.clgl_rkip1 +
"." +
this.clgl_rkip2 +
"." +
this.clgl_rkip3 +
"." +
this.clgl_rkip4,
clgl_rkwg:
this.clgl_rkwg1 +
"." +
this.clgl_rkwg2 +
"." +
this.clgl_rkwg3 +
"." +
this.clgl_rkwg4,
clgl_ckwk: this.ruleForm1.clgl_ckwk,
clgl_ckip:
this.clgl_ckip1 +
"." +
this.clgl_ckip2 +
"." +
this.clgl_ckip3 +
"." +
this.clgl_ckip4,
clgl_ckwg:
this.clgl_ckwg1 +
"." +
this.clgl_ckwg2 +
"." +
this.clgl_ckwg3 +
"." +
this.clgl_ckwg4,
clgl_mddx: this.ruleForm1.clgl_mddx,
clgl_mddk: this.ruleForm1.clgl_mddk,
this.$refs["ruleForm1"].validate((valid) => {
if (valid) {
this.SaveUserAnswer();
} else {
return false;
}
});
},
//---
async SaveUserAnswer() {
var obj = {
clgl_name: this.ruleForm1.clgl_name,
cmdlist_qsdz: this.ruleForm1.cmdlist_qsdz,
clgl_xy: this.ruleForm1.clgl_xy,
clgl_gzms: this.ruleForm1.clgl_gzms,
clgl_ydx: this.ruleForm1.clgl_ydx,
clgl_ydk: this.ruleForm1.clgl_ydk,
clgl_rkwk: this.ruleForm1.clgl_rkwk,
clgl_rkip:
this.ruleForm1.clgl_rkip1 +
"." +
this.ruleForm1.clgl_rkip2 +
"." +
this.ruleForm1.clgl_rkip3 +
"." +
this.ruleForm1.clgl_rkip4,
clgl_rkwg:
this.ruleForm1.clgl_rkwg1 +
"." +
this.ruleForm1.clgl_rkwg2 +
"." +
this.ruleForm1.clgl_rkwg3 +
"." +
this.ruleForm1.clgl_rkwg4,
clgl_ckwk: this.ruleForm1.clgl_ckwk,
clgl_ckip:
this.ruleForm1.clgl_ckip1 +
"." +
this.ruleForm1.clgl_ckip2 +
"." +
this.ruleForm1.clgl_ckip3 +
"." +
this.ruleForm1.clgl_ckip4,
clgl_ckwg:
this.ruleForm1.clgl_ckwg1 +
"." +
this.ruleForm1.clgl_ckwg2 +
"." +
this.ruleForm1.clgl_ckwg3 +
"." +
this.ruleForm1.clgl_ckwg4,
clgl_mddx: this.ruleForm1.clgl_mddx,
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%"
:before-close="handleClose"
>
<h3>内网网卡</h3>
<h3 style="color: #fff">内网网卡</h3>
<el-divider></el-divider>
<el-table :data="tableData" style="width: 100%" border>
<el-table-column prop="wlgl_nw_name" label="网卡名称">
@ -70,7 +70,7 @@
</div> </template
></el-table-column>
</el-table>
<h3>外网网卡</h3>
<h3 style="color: #fff">外网网卡</h3>
<el-divider></el-divider>
<el-table :data="tableData1" style="width: 100%" border>
<el-table-column prop="wlgl_ww_name" label="网卡名称">
@ -134,26 +134,25 @@
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false"
>保存</el-button
>
<el-button type="primary" @click="save">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { SaveUserAnswer, GetUserAnswer } from "../api/user";
export default {
data() {
return {
wlgl_nw_ip1: "192",
wlgl_nw_ip2: "168",
wlgl_nw_ip3: "1",
wlgl_nw_ip4: "1",
wlgl_nw_zwym1: "255",
wlgl_nw_zwym2: "255",
wlgl_nw_zwym3: "255",
wlgl_nw_zwym4: "0",
wlgl_nw_ip1: "",
wlgl_nw_ip2: "",
wlgl_nw_ip3: "",
wlgl_nw_ip4: "",
wlgl_nw_zwym1: "",
wlgl_nw_zwym2: "",
wlgl_nw_zwym3: "",
wlgl_nw_zwym4: "",
wlgl_ww_ip1: "",
wlgl_ww_ip2: "",
wlgl_ww_ip3: "",
@ -185,20 +184,106 @@ export default {
dialogVisible: true,
tableData: [
{
wlgl_nw_name: "有线区网闸(内网)",
wlgl_nw_ip: "192.168.1.1",
wlgl_nw_zwym: "255.255.255.0",
wlgl_nw_name: "",
wlgl_nw_ip: "",
wlgl_nw_zwym: "",
},
],
tableData1: [
{
wlgl_ww_name: "有线区网闸(外网)",
wlgl_ww_name: "",
wlgl_ww_ip: "",
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>
<style scoped lang="less">

View File

@ -8,10 +8,10 @@
:before-close="handleClose"
>
<div class="title">
<el-button style="margin-bottom: 10px" @click="dialogVisible1 = true"
<el-button style="margin-bottom: 10px" @click="addObj"
>新增对象</el-button
>
<p v-if="dxgl.length == 2">只能添加两条数据</p>
<p v-if="dxgl.length >= 2">只能添加两条数据</p>
</div>
<el-table :data="dxgl" style="width: 100%" border>
@ -21,13 +21,18 @@
</template>
</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">
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="text" size="small"
>编辑</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>
</el-table-column>
</el-table>
@ -51,8 +56,8 @@
<el-form-item label="IP类型:" prop="iplx">
<el-col :span="10">
<el-select v-model="ruleForm.iplx" style="width: 200px">
<el-option label="IP4" value="IP4"></el-option>
<el-option label="IP6" value="IP6"></el-option>
<el-option label="IPV4" value="IPV4"></el-option>
<el-option label="IPV6" value="IPV6"></el-option>
</el-select>
</el-col>
</el-form-item>
@ -73,41 +78,36 @@
</el-col>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item label="IP地址:" prop="ip">
<el-row>
<el-col :span="5">
<el-input v-model="ip1"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="ip2"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="ip3"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="ip4"></el-input>
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="IP" prop="ip">
<el-row>
<el-col :span="5">
<el-input v-model="ip1"></el-input>
</el-col>
<el-col :span="1">. </el-col>
<el-col :span="5">
<el-input v-model="ip2"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="ip3"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="ip4"></el-input>
</el-col>
</el-row>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible1 = false"
>保存</el-button
>
<el-button type="primary" @click="save">保存</el-button>
<el-button @click="dialogVisible1 = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { SaveUserAnswer, GetUserAnswer } from "../api/user";
export default {
data() {
return {
@ -124,20 +124,96 @@ export default {
// ip: "",
// },
],
ip1: "",
ip2: "",
ip3: "",
ip4: "",
ruleForm: {
iplx: "IP4",
iplx: "IPV4",
dxmc: "有线区交换机",
ip: "",
},
rules: {
iplx: [{ required: true, trigger: "change" }],
dxmc: [{ required: true, trigger: "blur" }],
ip: [{ required: true, trigger: "blur" }],
iplx: [
{ required: true, trigger: "change", message: "选择一个ip类型" },
],
dxmc: [
{ required: true, trigger: "blur", message: "选择一个对象名称" },
],
ip: [{ required: true, message: "ip地址是必填项" }],
},
json: {},
};
},
created() {
this.GetUserAnswer();
},
methods: {
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>
@ -182,4 +258,19 @@ export default {
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>

View File

@ -5,7 +5,7 @@
<el-button style="margin-bottom: 10px" @click="addPolicy"
>新增策略</el-button
>
<p v-if="tableData.length == 2">只能添加两条数据</p>
<p v-if="tableData.length >= 2">只能添加两条数据</p>
</div>
<el-table :data="tableData" style="width: 100%" border>
@ -39,7 +39,12 @@
<el-button @click="handleClick(scope.row)" type="text" size="small"
>编辑</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>
</el-table-column>
</el-table>
@ -269,15 +274,56 @@ export default {
flag: false,
};
},
watch: {
$route(to, from) {
this.dialogVisible = true;
},
created() {
var obj = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
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: {
addPolicy() {
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>

View File

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