202 lines
5.3 KiB
Vue
202 lines
5.3 KiB
Vue
<!-- 斥候数据采集——有线网关配置 -->
|
|
<template>
|
|
<div>
|
|
<div class="gateway" v-show="isShow" v-loading="loading">
|
|
<div class="title">
|
|
<p class="title_l" style="color: #fff">新建网关</p>
|
|
<i class="el-icon-close title_r" @click="isShow = false"></i>
|
|
</div>
|
|
<el-divider></el-divider>
|
|
<div class="content">
|
|
<el-form :model="formData" :label-position="labelPosition" :rules="rules" ref="ruleForm">
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="网关名称:" :label-width="formLabelWidth" prop="wgpz_wgmc">
|
|
<el-select v-model="formData.wgpz_wgmc" placeholder="请选择" style="width: 200px">
|
|
<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="网关ID:" :label-width="formLabelWidth" prop="wgpz_wgid">
|
|
<el-select v-model="formData.wgpz_wgid" placeholder="请选择" style="width: 200px">
|
|
<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div class="footer">
|
|
<el-button type="primary" @click="innerVisible = true">保 存</el-button>
|
|
<el-button @click="isShow = false">取 消</el-button>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<el-dialog title="系统提示" :visible.sync="innerVisible" append-to-body width="382px">
|
|
<p class="inner_content">
|
|
请确认选择的网关类型与网关实体一致:否则该工程无法下载至实体网关
|
|
</p>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="saveGate">确定</el-button>
|
|
<el-button @click="innerVisible = false">取 消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { SaveUserAnswer, GetUserAnswer } from "@/api/user";
|
|
export default {
|
|
name: "TestChiGate",
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
options1: [
|
|
{
|
|
value: "有线区网关2",
|
|
label: "有线区网关2",
|
|
},
|
|
{
|
|
value: "无线区网关2",
|
|
label: "无线区网关2",
|
|
},
|
|
],
|
|
options2: [
|
|
{
|
|
value: "LAN-BOX2",
|
|
label: "LAN-BOX2",
|
|
},
|
|
{
|
|
value: "WLAN-BOX2",
|
|
label: "WLAN-BOX2",
|
|
},
|
|
],
|
|
formData: {
|
|
wgpz_wgmc: "有线区网关2",
|
|
wgpz_wgid: "LAN-BOX2",
|
|
},
|
|
innerVisible: false,
|
|
labelPosition: "left",
|
|
formLabelWidth: "96px",
|
|
count: 0,
|
|
isShow: true,
|
|
rules: {
|
|
gateway_id: [
|
|
{ required: true, message: "请输入网关ID", trigger: "blur" },
|
|
],
|
|
gateway_name: [
|
|
{ required: true, message: "请输入网关名称", trigger: "blur" },
|
|
],
|
|
},
|
|
};
|
|
},
|
|
|
|
mounted() {
|
|
this.GetUserAnswer();
|
|
},
|
|
methods: {
|
|
async saveGate() {
|
|
let datas = sessionStorage.getItem("CHGYWG_yx");
|
|
this.formData = { ...JSON.parse(datas), ...this.formData };
|
|
let res = SaveUserAnswer({
|
|
mark: "CHGYWG_yx",
|
|
user_id: "USER202307301114011710",
|
|
mark_value: JSON.stringify(this.formData),
|
|
});
|
|
if (res.status == 200) {
|
|
this.$message({
|
|
message: '保存成功',
|
|
type: 'success'
|
|
});
|
|
}
|
|
console.log(res);
|
|
sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.formData));
|
|
this.$router.push("/configuration");
|
|
},
|
|
async GetUserAnswer() {
|
|
this.loading = true;
|
|
let { data } = await GetUserAnswer({
|
|
mark: "CHGYWG_yx",
|
|
user_id: "USER202307301114011710",
|
|
});
|
|
this.loading = false;
|
|
if (data.data && data.state) {
|
|
console.log(JSON.parse(data.data.mark_value));
|
|
let obj = JSON.parse(data.data.mark_value);
|
|
if (obj.wgpz_wgid) {
|
|
this.formData.wgpz_wgid = obj.wgpz_wgid;
|
|
this.formData.wgpz_wgmc = obj.wgpz_wgmc;
|
|
}
|
|
}
|
|
},
|
|
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
/deep/ .gateway {
|
|
position: absolute;
|
|
left: 694px;
|
|
top: 188px;
|
|
width: 382px;
|
|
height: 309px;
|
|
line-height: 20px;
|
|
// background-color: rgba(255, 255, 255, 1);
|
|
background: url(../assets/image/bg.png);
|
|
background-size: 100% 100%;
|
|
text-align: center;
|
|
border: 1px solid rgba(187, 187, 187, 1);
|
|
|
|
.el-divider--horizontal {
|
|
margin: 8px 0;
|
|
}
|
|
|
|
.title {
|
|
margin: 13px 11px 0px 21px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.title_l {
|
|
width: 72px;
|
|
height: 26px;
|
|
color: rgba(16, 16, 16, 1);
|
|
font-size: 18px;
|
|
text-align: left;
|
|
}
|
|
|
|
.title_r {
|
|
width: 24px;
|
|
height: 24px;
|
|
cursor: pointer;
|
|
// color: rgba(111, 103, 103, 1);
|
|
color: rgb(255,255,255);
|
|
}
|
|
}
|
|
|
|
.content {
|
|
margin-left: 50px;
|
|
margin-right: 50px;
|
|
|
|
.el-input__inner {
|
|
width: 200px;
|
|
height: 30px;
|
|
}
|
|
}
|
|
|
|
/deep/ .footer {
|
|
.el-button {
|
|
width: 80px;
|
|
height: 30px;
|
|
line-height: 0.5;
|
|
}
|
|
}
|
|
}
|
|
</style>
|