InternetCompetition/src/components/NetworkManagement.vue

320 lines
9.7 KiB
Vue

<template>
<div>
<el-dialog title="网络管理" :visible.sync="dialogVisible" width="40%">
<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="网卡名称">
<template slot-scope="scope">
<el-select v-model="scope.row.wlgl_nw_name" placeholder="">
<el-option
v-for="item in options1"
:key="item"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="wlgl_nw_ip" label="IPV4地址">
<template slot-scope="scope">
<div class="net_setting">
<el-row>
<el-col :span="5">
<el-input v-model="wlgl_nw_ip1"></el-input>
</el-col>
<el-col :span="1">. </el-col>
<el-col :span="5">
<el-input v-model="wlgl_nw_ip2"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_nw_ip3"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_nw_ip4"></el-input>
</el-col>
</el-row>
</div>
</template>
</el-table-column>
<el-table-column prop="wlgl_nw_zwym" label="IPV4掩码">
<template slot-scope="scope">
<div class="net_setting">
<el-row>
<el-col :span="5">
<el-input v-model="wlgl_nw_zwym1"></el-input>
</el-col>
<el-col :span="1">. </el-col>
<el-col :span="5">
<el-input v-model="wlgl_nw_zwym2"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_nw_zwym3"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_nw_zwym4"></el-input>
</el-col>
</el-row>
</div> </template
></el-table-column>
</el-table>
<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="网卡名称">
<template slot-scope="scope">
<el-select v-model="scope.row.wlgl_ww_name" placeholder="">
<el-option
v-for="item in options1"
:key="item"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="wlgl_ww_ip" label="IPV4地址">
<template slot-scope="scope">
<div class="net_setting">
<el-row>
<el-col :span="5">
<el-input v-model="wlgl_ww_ip1"></el-input>
</el-col>
<el-col :span="1">. </el-col>
<el-col :span="5">
<el-input v-model="wlgl_ww_ip2"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_ww_ip3"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_ww_ip4"></el-input>
</el-col>
</el-row>
</div>
</template>
</el-table-column>
<el-table-column prop="wlgl_ww_zwym" label="IPV4掩码">
<template slot-scope="scope">
<div class="net_setting">
<el-row>
<el-col :span="5">
<el-input v-model="wlgl_ww_zwym1"></el-input>
</el-col>
<el-col :span="1">. </el-col>
<el-col :span="5">
<el-input v-model="wlgl_ww_zwym2"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_ww_zwym3"></el-input>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="5">
<el-input v-model="wlgl_ww_zwym4"></el-input>
</el-col>
</el-row>
</div>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<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 {
user_id: "",
type: "",
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: "",
wlgl_ww_ip4: "",
wlgl_ww_zwym1: "",
wlgl_ww_zwym2: "",
wlgl_ww_zwym3: "",
wlgl_ww_zwym4: "",
options1: [
{
label: "有线区网闸(内网)",
value: "有线区网闸(内网)",
},
{
label: "无线区网闸(内网)",
value: "无线区网闸(内网)",
},
],
options2: [
{
label: "有线区网闸(外网)",
value: "有线区网闸(外网)",
},
{
label: "无线区网闸(外网)",
value: "无线区网闸(外网)",
},
],
dialogVisible: true,
tableData: [
{
wlgl_nw_name: "",
wlgl_nw_ip: "",
wlgl_nw_zwym: "",
},
],
tableData1: [
{
wlgl_ww_name: "",
wlgl_ww_ip: "",
wlgl_ww_zwym: "",
},
],
};
},
created() {
let that = this;
window.getParameter = that.getParameter;
this.GetUserAnswer();
},
methods: {
getParameter(data) {
this.user_id = data.split("|")[0];
this.type = data.split("|")[1];
if (data.split("|")[1] == 1) {
this.$store.commit("setType", "GYWZ_yx");
} else {
this.$store.commit("setType", "GYWZ_wx");
}
},
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: "USER202307301114011710",
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() {
var { data } = await GetUserAnswer({
mark: "GYWZ_yx",
user_id: "USER202307301114011710",
});
console.log(data);
if (data.data && data.state) {
let res = JSON.parse(data.data.mark_value);
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">
/deep/ .net_setting {
.el-input__inner {
height: 30px;
text-align: center;
padding: 0;
}
.el-col-1 {
padding: 0px 2px;
color: black;
text-align: left;
line-height: 45px;
height: 20px;
}
.el-col-5 {
width: 43px;
height: 30px;
}
.el-col-24 {
padding-right: 152px;
}
}
</style>