This commit is contained in:
lll 2023-11-13 19:47:06 +08:00
parent a14abdf350
commit df249fa0a8
3 changed files with 384 additions and 174 deletions

View File

@ -5,8 +5,15 @@
<!-- <div v-click-outside="closeMenu"> --> <!-- <div v-click-outside="closeMenu"> -->
<!-- <el-button type="info" plain @click="dialogVisible = true">斥侯MQTT云</el-button> --> <!-- <el-button type="info" plain @click="dialogVisible = true">斥侯MQTT云</el-button> -->
<div v-show="dialogVisible" class="tree_menu"> <div v-show="dialogVisible" class="tree_menu">
<el-tree :data="trees" node-key="id" :props="defaultProps" default-expand-all @node-contextmenu="rightClick" <el-tree
@node-click="treeNodeClick" ref="tree"> :data="trees"
node-key="id"
:props="defaultProps"
default-expand-all
@node-contextmenu="rightClick"
@node-click="treeNodeClick"
ref="tree"
>
<!-- <span class="custom-tree-node" slot-scope="{ node, data }"> <!-- <span class="custom-tree-node" slot-scope="{ node, data }">
<template v-if="data.editing == 1 && flag"> <template v-if="data.editing == 1 && flag">
<el-input style="width: 260px;" v-model="gateway" @change="changeInput"></el-input> <el-input style="width: 260px;" v-model="gateway" @change="changeInput"></el-input>
@ -22,32 +29,57 @@
<div class="con_left"> <div class="con_left">
<h3 class="mqtt" style="margin-top: 20px; color: white">标准 MQTT</h3> <h3 class="mqtt" style="margin-top: 20px; color: white">标准 MQTT</h3>
<el-divider></el-divider> <el-divider></el-divider>
<el-form :model="formData" :label-position="labelPosition" :rules="rules" ref="formData"> <el-form
:model="formData"
:label-position="labelPosition"
:rules="rules"
ref="formData"
>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item> <el-form-item>
<el-checkbox v-model="formData.mqtt_qiyong">启用</el-checkbox> <el-checkbox v-model="mqtt_qiyong">启用</el-checkbox>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row class="serveIp"> <el-row class="serveIp">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="服务器IP:" :label-width="formLabelWidth" prop="mqtt_ip"> <el-form-item
label="服务器IP:"
:label-width="formLabelWidth"
prop="mqtt_ip"
>
<el-row> <el-row>
<el-col :span="5"> <el-col :span="5">
<el-input v-model="mqtt_ip1" style="width: 43px; height: 30px" maxlength="3"></el-input> <el-input
v-model="mqtt_ip1"
style="width: 43px; height: 30px"
maxlength="3"
></el-input>
</el-col> </el-col>
<el-col :span="1">. </el-col> <el-col :span="1">. </el-col>
<el-col :span="5"> <el-col :span="5">
<el-input v-model="mqtt_ip2" style="width: 43px; height: 30px" maxlength="3"></el-input> <el-input
v-model="mqtt_ip2"
style="width: 43px; height: 30px"
maxlength="3"
></el-input>
</el-col> </el-col>
<el-col :span="1">.</el-col> <el-col :span="1">.</el-col>
<el-col :span="5"> <el-col :span="5">
<el-input v-model="mqtt_ip3" style="width: 43px; height: 30px" maxlength="3"></el-input> <el-input
v-model="mqtt_ip3"
style="width: 43px; height: 30px"
maxlength="3"
></el-input>
</el-col> </el-col>
<el-col :span="1">.</el-col> <el-col :span="1">.</el-col>
<el-col :span="5"> <el-col :span="5">
<el-input v-model="mqtt_ip4" style="width: 43px; height: 30px" maxlength="3"></el-input> <el-input
v-model="mqtt_ip4"
style="width: 43px; height: 30px"
maxlength="3"
></el-input>
</el-col> </el-col>
</el-row> </el-row>
</el-form-item> </el-form-item>
@ -55,31 +87,62 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="网关SN:" :label-width="formLabelWidth" prop="mqtt_wgsn"> <el-form-item
<el-input v-model="formData.mqtt_wgsn" placeholder="" style="width: 200px; height: 30px"></el-input> label="网关SN:"
:label-width="formLabelWidth"
prop="mqtt_wgsn"
>
<el-input
v-model="formData.mqtt_wgsn"
placeholder=""
style="width: 200px; height: 30px"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="端口:" :label-width="formLabelWidth" prop="mqtt_port"> <el-form-item
<el-input v-model="formData.mqtt_port" placeholder="" style="width: 200px; height: 30px"></el-input> label="端口:"
:label-width="formLabelWidth"
prop="mqtt_port"
>
<el-input
v-model="formData.mqtt_port"
placeholder=""
style="width: 200px; height: 30px"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="Keep Alive(s):" :label-width="formLabelWidth" prop="mqtt_keepalive"> <el-form-item
<el-input v-model="formData.mqtt_keepalive" placeholder="" label="Keep Alive(s):"
style="width: 200px; height: 30px"></el-input> :label-width="formLabelWidth"
prop="mqtt_keepalive"
>
<el-input
v-model="formData.mqtt_keepalive"
placeholder=""
style="width: 200px; height: 30px"
></el-input>
<div class="infos">2-60000</div> <div class="infos">2-60000</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="实施数据发布主题:" :label-width="formLabelWidth" prop="mqtt_keepalive"> <el-form-item
<el-input v-model="formData.mqtt_sssjfbzt" placeholder="" style="width: 200px; height: 30px"></el-input> label="实施数据发布主题:"
:label-width="formLabelWidth"
prop="mqtt_keepalive"
>
<el-input
v-model="formData.mqtt_sssjfbzt"
placeholder=""
style="width: 200px; height: 30px"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -105,9 +168,22 @@
<el-form-item> <el-form-item>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="Qos(MQTT):" :label-width="formLabelWidth" prop="upload_week"> <el-form-item
<el-select v-model="formData.mqtt_qos" placeholder="请选择" style="width: 200px"> label="Qos(MQTT):"
<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"> :label-width="formLabelWidth"
prop="upload_week"
>
<el-select
v-model="formData.mqtt_qos"
placeholder="请选择"
style="width: 200px"
>
<el-option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -144,7 +220,9 @@
</div> </div>
<div> <div>
<div class="con_right"> <div class="con_right">
<h3 class="mqtt" style="margin-top: 20px; color: white">标准MQTT采集点</h3> <h3 class="mqtt" style="margin-top: 20px; color: white">
标准MQTT采集点
</h3>
<el-divider></el-divider> <el-divider></el-divider>
<!-- <el-button type="info" plain @click="handleSelect">保存</el-button> --> <!-- <el-button type="info" plain @click="handleSelect">保存</el-button> -->
@ -159,16 +237,24 @@
<el-table-column property="mqtt_cjd_sbmc" label="设备名称"> <el-table-column property="mqtt_cjd_sbmc" label="设备名称">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.mqtt_cjd_sbmc" placeholder=""> <el-select v-model="scope.row.mqtt_cjd_sbmc" placeholder="">
<el-option v-for="(option, index) in options2" :key="index" :label="option.label" <el-option
:value="option.value"></el-option> v-for="(option, index) in options2"
:key="index"
:label="option.label"
:value="option.value"
></el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="mqtt_cjd_tagid" label="TagID"> <el-table-column property="mqtt_cjd_tagid" label="TagID">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.mqtt_cjd_tagid" placeholder=""> <el-select v-model="scope.row.mqtt_cjd_tagid" placeholder="">
<el-option v-for="(option, index) in options3" :key="index" :label="option.label" <el-option
:value="option.value"></el-option> v-for="(option, index) in options3"
:key="index"
:label="option.label"
:value="option.value"
></el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
@ -179,8 +265,14 @@
<!-- 添加按钮下显示出来的弹框信息 --> <!-- 添加按钮下显示出来的弹框信息 -->
<div> <div>
<el-dialog title="选择点" :visible.sync="choose_point" width="30%"> <el-dialog title="选择点" :visible.sync="choose_point" width="30%">
<el-tree :data="points" show-checkbox node-key="id" :default-expanded-keys="[1, 2]" <el-tree
:default-checked-keys="[3, 4, 5, 6]" :props="defaultProps"> :data="points"
show-checkbox
node-key="id"
:default-expanded-keys="[1, 2]"
:default-checked-keys="[3, 4, 5, 6]"
:props="defaultProps"
>
</el-tree> </el-tree>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="savePoint"> </el-button> <el-button type="primary" @click="savePoint"> </el-button>
@ -192,16 +284,40 @@
<!-- 网关信息 --> <!-- 网关信息 -->
<div class="gateway"> <div class="gateway">
<el-dialog title="新建网关" :visible.sync="outerVisible" width="382px"> <el-dialog title="新建网关" :visible.sync="outerVisible" width="382px">
<el-form :model="gateWay" :rules="rulesGate" ref="gateWay" label-width="85px" class="demo-ruleForm"> <el-form
:model="formData"
:rules="rulesGate"
ref="gateWay"
label-width="85px"
class="demo-ruleForm"
>
<el-form-item label="网关名称:" prop="wgpz_wgmc"> <el-form-item label="网关名称:" prop="wgpz_wgmc">
<el-select v-model="gateWay.wgpz_wgmc" placeholder="请选择" style="width: 200px"> <el-select
<el-option v-for="item in opts1" :key="item.value" :label="item.label" :value="item.value"> v-model="formData.wgpz_wgmc"
placeholder="请选择"
style="width: 200px"
>
<el-option
v-for="item in opts1"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="网关ID:" prop="wgpz_wgid"> <el-form-item label="网关ID:" prop="wgpz_wgid">
<el-select v-model="gateWay.wgpz_wgid" placeholder="请选择" style="width: 200px"> <el-select
<el-option v-for="item in opts2" :key="item.value" :label="item.label" :value="item.value"> v-model="formData.wgpz_wgid"
placeholder="请选择"
style="width: 200px"
>
<el-option
v-for="item in opts2"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -237,16 +353,55 @@ export default {
gateway: "", gateway: "",
trees: [], trees: [],
user_id: "", user_id: "",
mqtt_qiyong: false,
formData: { formData: {
mqtt_qiyong: false,
mqtt_ip: "", mqtt_ip: "",
mqtt_wgsn: "", mqtt_wgsn: "",
mqtt_port: "", mqtt_port: "",
mqtt_keepalive: "", mqtt_keepalive: "",
mqtt_sssjfbzt: "", mqtt_sssjfbzt: "",
// mqtt_tls: false, mqtt_qos: "",
// mqtt_clearsession: false,
mqtt_qos: "0", cjdpz_tagid: "",
cjdpz_mc: "",
cjdpz_dz: "",
cjdpz_jcqdz: "",
cjdpz_cjsjlx: "",
cjdpz_dxsx: "",
cjdpz_scms: "",
cjdpz_dw: "",
wgpz_wgmc: "",
wgpz_wgid: "",
ippz_wllx: "",
ippz_ip: "",
ippz_zwym: "",
ippz_wg: "",
ippz_dns: "",
ippz_dns_by: "",
sbpz_sbmc: "",
sbpz_kzqxy: "",
sbpz_ip: "",
sbpz_port: "",
sbpz_czdz: "",
sbpz_lxzq: "",
sbpz_qyhmcj: "",
sbpz_qyplcj: "",
sbpz_zdplcjs: "",
sbpz_cjcgsj: "",
sbpz_zqsbonchange: "",
sbpz_txsjjg: "",
sbpz_xqjcqxr: "",
sbpz_bcjcqxr: "",
cjdpz_tagid: "",
cjdpz_mc: "",
cjdpz_sjq: "",
cjdpz_jcqdz: "",
cjdpz_cjsjlx: "",
cjdpz_dxsx: "",
cjdpz_scms: "",
}, },
mqtt_ip1: "", mqtt_ip1: "",
mqtt_ip2: "", mqtt_ip2: "",
@ -492,15 +647,13 @@ export default {
required: true, required: true,
message: "", message: "",
validator: this.validateIp, validator: this.validateIp,
trigger: "blur" trigger: "blur",
}, },
], ],
mqtt_wgsn: [ mqtt_wgsn: [
{ required: true, message: "请输入网关SN", trigger: "blur" }, { required: true, message: "请输入网关SN", trigger: "blur" },
], ],
mqtt_port: [ mqtt_port: [{ required: true, message: "请输入端口", trigger: "blur" }],
{ required: true, message: "请输入端口", trigger: "blur" },
],
mqtt_keepalive: [ mqtt_keepalive: [
{ required: true, message: "请输入KeepAlive", trigger: "blur" }, { required: true, message: "请输入KeepAlive", trigger: "blur" },
], ],
@ -561,31 +714,31 @@ export default {
console.log(res); console.log(res);
console.log(JSON.parse(res.data.data.data)); console.log(JSON.parse(res.data.data.data));
this.trees = JSON.parse(res.data.data.data); this.trees = JSON.parse(res.data.data.data);
}) });
}, },
methods: { methods: {
//ip //ip
validateIp(rule, value, callback) { validateIp(rule, value, callback) {
if ( if (
this.mqtt_ip1 + this.mqtt_ip1 +
"." + "." +
this.mqtt_ip2 + this.mqtt_ip2 +
"." + "." +
this.mqtt_ip3 + this.mqtt_ip3 +
"." + "." +
this.mqtt_ip4 === this.mqtt_ip4 ===
"..." "..."
) { ) {
callback(new Error("请输入IP地址")); callback(new Error("请输入IP地址"));
} else if ( } else if (
!/^(\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( !/^(\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.mqtt_ip1 + this.mqtt_ip1 +
"." + "." +
this.mqtt_ip2 + this.mqtt_ip2 +
"." + "." +
this.mqtt_ip3 + this.mqtt_ip3 +
"." + "." +
this.mqtt_ip4 this.mqtt_ip4
) )
) { ) {
callback(new Error("请输入有效的IP地址")); callback(new Error("请输入有效的IP地址"));
@ -604,27 +757,28 @@ export default {
} }
}); });
}, },
changeInput() { // changeInput() {
this.flag = false; // this.flag = false;
this.trees[0].label = this.gateway; // this.trees[0].label = this.gateway;
this.sendTree(); // this.sendTree();
}, // },
async rightClick(e, data, node) { async rightClick(e, data, node) {
console.log(node); console.log(node);
if (data.editing) { if (data.editing) {
this.outerVisible = true; this.outerVisible = true;
let res2 = await GetUserAnswer({ this.GetUserAnswer();
mark: "CHGYWG_yx", // let res2 = await GetUserAnswer({
user_id: this.user_id, // mark: "CHGYWG_yx",
// user_id: "USER202307301114011710", // user_id: this.user_id,
}); // // user_id: "USER202307301114011710",
if (res2.data.data && res2.data.state) { // });
console.log(res2.data.data.mark_value); // if (res2.data.data && res2.data.state) {
let res3 = JSON.parse(res2.data.data.mark_value); // console.log(res2.data.data.mark_value);
this.gateWay.wgpz_wgid = res3.wgpz_wgid; // let res3 = JSON.parse(res2.data.data.mark_value);
// console.log(this.formData.wgpz_wgid); // this.gateWay.wgpz_wgid = res3.wgpz_wgid;
this.gateWay.wgpz_wgmc = res3.wgpz_wgmc; // // console.log(this.formData.wgpz_wgid);
} // this.gateWay.wgpz_wgmc = res3.wgpz_wgmc;
// }
} }
}, },
getParameter(data) { getParameter(data) {
@ -664,17 +818,17 @@ export default {
type: "success", type: "success",
}); });
}, },
async handleSelect() { // async handleSelect() {
let datas = sessionStorage.getItem("CHGYWG_yx"); // let datas = sessionStorage.getItem("CHGYWG_yx");
datas = { ...JSON.parse(datas), ...this.tableData[0] }; // datas = { ...JSON.parse(datas), ...this.tableData[0] };
let res = await SaveUserAnswer({ // let res = await SaveUserAnswer({
mark: "CHGYWG_yx", // mark: "CHGYWG_yx",
user_id: this.user_id, // user_id: this.user_id,
mark_value: JSON.stringify(datas), // mark_value: JSON.stringify(datas),
}); // });
console.log(res); // console.log(res);
sessionStorage.setItem("CHGYWG_yx", JSON.stringify(datas)); // sessionStorage.setItem("CHGYWG_yx", JSON.stringify(datas));
}, // },
async saveClone() { async saveClone() {
var obj = { var obj = {
// mqtt_qiyong: String(Number(this.formData.mqtt_qiyong)), // mqtt_qiyong: String(Number(this.formData.mqtt_qiyong)),
@ -694,8 +848,7 @@ export default {
mqtt_cjd_sbmc: this.tableData[0].mqtt_cjd_sbmc, mqtt_cjd_sbmc: this.tableData[0].mqtt_cjd_sbmc,
mqtt_cjd_tagid: this.tableData[0].mqtt_cjd_tagid, mqtt_cjd_tagid: this.tableData[0].mqtt_cjd_tagid,
}; };
let datas = sessionStorage.getItem("CHGYWG_yx"); let datas = { ...this.formData, ...obj };
datas = { ...JSON.parse(datas), ...obj };
let res = await SaveUserAnswer({ let res = await SaveUserAnswer({
mark: "CHGYWG_yx", mark: "CHGYWG_yx",
user_id: this.user_id, user_id: this.user_id,
@ -714,7 +867,6 @@ export default {
type: "error", type: "error",
}); });
} }
}, },
async GetUserAnswer() { async GetUserAnswer() {
this.loading = true; this.loading = true;
@ -734,12 +886,44 @@ export default {
this.mqtt_ip2 = obj.mqtt_ip.split(".")[1]; this.mqtt_ip2 = obj.mqtt_ip.split(".")[1];
this.mqtt_ip3 = obj.mqtt_ip.split(".")[2]; this.mqtt_ip3 = obj.mqtt_ip.split(".")[2];
this.mqtt_ip4 = obj.mqtt_ip.split(".")[3]; this.mqtt_ip4 = obj.mqtt_ip.split(".")[3];
this.formData.mqtt_ip = obj.mqtt_ip;
this.formData.mqtt_wgsn = obj.mqtt_wgsn; this.formData.mqtt_wgsn = obj.mqtt_wgsn;
this.formData.mqtt_port = obj.mqtt_port; this.formData.mqtt_port = obj.mqtt_port;
this.formData.mqtt_keepalive = obj.mqtt_keepalive; this.formData.mqtt_keepalive = obj.mqtt_keepalive;
this.formData.mqtt_sssjfbzt = obj.mqtt_sssjfbzt; this.formData.mqtt_sssjfbzt = obj.mqtt_sssjfbzt;
this.formData.mqtt_qos = obj.mqtt_qos; this.formData.mqtt_qos = obj.mqtt_qos;
} }
this.formData.sbpz_sbmc = obj.sbpz_sbmc;
this.formData.sbpz_kzqxy = obj.sbpz_kzqxy;
this.formData.sbpz_ip = obj.sbpz_ip;
this.formData.sbpz_port = obj.sbpz_port;
this.formData.sbpz_czdz = obj.sbpz_czdz;
this.formData.sbpz_lxzq = obj.sbpz_lxzq;
this.formData.sbpz_qyhmcj = obj.sbpz_qyhmcj;
this.formData.sbpz_qyplcj = obj.sbpz_qyplcj;
this.formData.sbpz_zdplcjs = obj.sbpz_zdplcjs;
this.formData.sbpz_cjcgsj = obj.sbpz_cjcgsj;
this.formData.sbpz_zqsbonchange = obj.sbpz_zqsbonchange;
this.formData.sbpz_txsjjg = obj.sbpz_txsjjg;
this.formData.sbpz_xqjcqxr = obj.sbpz_xqjcqxr;
this.formData.sbpz_bcjcqxr = obj.sbpz_bcjcqxr;
this.formData.wgpz_wgid = obj.wgpz_wgid;
this.formData.wgpz_wgmc = obj.wgpz_wgmc;
this.formData.ippz_wllx = obj.ippz_wllx;
this.formData.ippz_ip = obj.ippz_ip;
this.formData.ippz_zwym = obj.ippz_zwym;
this.formData.ippz_wg = obj.ippz_wg;
this.formData.ippz_dns = obj.ippz_dns;
this.formData.ippz_dns_by = obj.ippz_dns_by;
this.formData.cjdpz_tagid = obj.mqtt_cjd_tagid;
this.formData.cjdpz_mc = obj.cjdpz_mc;
this.formData.cjdpz_sjq = obj.cjdpz_sjq;
this.formData.cjdpz_jcqdz = obj.cjdpz_cjsjlx;
this.formData.cjdpz_cjsjlx = obj.cjdpz_cjsjlx;
this.formData.cjdpz_dxsx = obj.cjdpz_dxsx;
this.formData.cjdpz_scms = obj.cjdpz_scms;
if (obj.mqtt_cjd_sbmc) { if (obj.mqtt_cjd_sbmc) {
this.tableData[0].mqtt_cjd_sbmc = obj.mqtt_cjd_sbmc; this.tableData[0].mqtt_cjd_sbmc = obj.mqtt_cjd_sbmc;
} else { } else {
@ -757,7 +941,7 @@ export default {
user_id: this.user_id, user_id: this.user_id,
data: JSON.stringify(this.trees), data: JSON.stringify(this.trees),
type: "3", type: "3",
}) });
console.log(result); console.log(result);
}, },
// //
@ -776,24 +960,25 @@ export default {
async saveGates() { async saveGates() {
this.outerVisible = false; this.outerVisible = false;
// this.innerVisible = false; // this.innerVisible = false;
let datas = sessionStorage.getItem("CHGYWG_yx"); // let datas = sessionStorage.getItem("CHGYWG_yx");
// console.log(JSON.parse(datas)); // console.log(JSON.parse(datas));
datas = { ...JSON.parse(datas), ...this.gateWay }; // datas = { ...JSON.parse(datas), ...this.gateWay };
console.log(datas); // console.log(datas);
let res = await SaveUserAnswer({ let res = await SaveUserAnswer({
mark: "CHGYWG_yx", mark: "CHGYWG_yx",
user_id: this.user_id, user_id: this.user_id,
// user_id: "USER202307301114011710", // user_id: "USER202307301114011710",
mark_value: JSON.stringify(datas), mark_value: JSON.stringify(this.formData),
}); });
console.log(res);
if (res.data.state) { if (res.data.state) {
this.$message({ this.$message({
message: "修改成功", message: "修改成功",
type: "success", type: "success",
}); });
this.trees[0].label = this.gateWay.wgpz_wgid; this.trees[0].label = this.formData.wgpz_wgid;
this.sendTree(); this.sendTree();
sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.gateWay)); sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.formData));
} else { } else {
this.$message({ this.$message({
message: `保存失败,原因是${res.data.message}`, message: `保存失败,原因是${res.data.message}`,
@ -801,7 +986,7 @@ export default {
}); });
} }
console.log(res); console.log(res);
} },
}, },
mounted() { mounted() {
this.GetUserAnswer(); this.GetUserAnswer();
@ -874,7 +1059,6 @@ export default {
padding-right: 348px; padding-right: 348px;
} }
.el-row { .el-row {
height: 54px; height: 54px;
display: flex; display: flex;

View File

@ -134,7 +134,7 @@
<div class="gateway"> <div class="gateway">
<el-dialog title="新建网关" :visible.sync="outerVisible" width="382px"> <el-dialog title="新建网关" :visible.sync="outerVisible" width="382px">
<el-form <el-form
:model="gateWay" :model="tableData[0]"
:rules="rulesGate" :rules="rulesGate"
ref="gateWay" ref="gateWay"
label-width="85px" label-width="85px"
@ -142,7 +142,7 @@
> >
<el-form-item label="网关名称:" prop="wgpz_wgmc"> <el-form-item label="网关名称:" prop="wgpz_wgmc">
<el-select <el-select
v-model="gateWay.wgpz_wgmc" v-model="tableData[0].wgpz_wgmc"
placeholder="请选择" placeholder="请选择"
style="width: 200px" style="width: 200px"
> >
@ -157,7 +157,7 @@
</el-form-item> </el-form-item>
<el-form-item label="网关ID:" prop="wgpz_wgid"> <el-form-item label="网关ID:" prop="wgpz_wgid">
<el-select <el-select
v-model="gateWay.wgpz_wgid" v-model="tableData[0].wgpz_wgid"
placeholder="请选择" placeholder="请选择"
style="width: 200px" style="width: 200px"
> >
@ -575,56 +575,55 @@ export default {
cjdpz_dxsx: "", cjdpz_dxsx: "",
cjdpz_scms: "", cjdpz_scms: "",
cjdpz_dw: "", cjdpz_dw: "",
wgpz_wgmc: "",
wgpz_wgid: "",
ippz_wllx: "",
ippz_ip: "",
ippz_zwym: "",
ippz_wg: "",
ippz_dns: "",
ippz_dns_by: "",
sbpz_sbmc: "",
sbpz_kzqxy: "",
sbpz_ip: "",
sbpz_port: "",
sbpz_czdz: "",
sbpz_lxzq: "",
sbpz_qyhmcj: "",
sbpz_qyplcj: "",
sbpz_zdplcjs: "",
sbpz_cjcgsj: "",
sbpz_zqsbonchange: "",
sbpz_txsjjg: "",
sbpz_xqjcqxr: "",
sbpz_bcjcqxr: "",
cjdpz_tagid: "",
cjdpz_mc: "",
cjdpz_sjq: "",
cjdpz_jcqdz: "",
cjdpz_cjsjlx: "",
cjdpz_dxsx: "",
cjdpz_scms: "",
mqtt_ip: "",
mqtt_wgsn: "",
mqtt_port: "",
mqtt_keepalive: "",
mqtt_tls: "",
mqtt_clearsession: "",
mqtt_sssjfbzt: "",
mqtt_qos: "",
mqtt_cjd_sbmc: "",
mqtt_cjd_tagid: "",
}, },
], ],
// //
outerVisible: false, outerVisible: false,
gateWay: { // gateWay: {},
wgpz_wgmc: "",
wgpz_wgid: "",
ippz_wllx: "",
ippz_ip: "",
ippz_zwym: "",
ippz_wg: "",
ippz_dns: "",
ippz_dns_by: "",
sbpz_sbmc: "",
sbpz_kzqxy: "",
sbpz_ip: "",
sbpz_port: "",
sbpz_czdz: "",
sbpz_lxzq: "",
sbpz_qyhmcj: "",
sbpz_qyplcj: "",
sbpz_zdplcjs: "",
sbpz_cjcgsj: "",
sbpz_zqsbonchange: "",
sbpz_txsjjg: "",
sbpz_xqjcqxr: "",
sbpz_bcjcqxr: "",
cjdpz_tagid: "",
cjdpz_mc: "",
cjdpz_sjq: "",
cjdpz_jcqdz: "",
cjdpz_cjsjlx: "",
cjdpz_dxsx: "",
cjdpz_scms: "",
mqtt_ip: "",
mqtt_wgsn: "",
mqtt_port: "",
mqtt_keepalive: "",
mqtt_tls: "",
mqtt_clearsession: "",
mqtt_sssjfbzt: "",
mqtt_qos: "",
mqtt_cjd_sbmc: "",
mqtt_cjd_tagid: "",
},
rulesGate: { rulesGate: {
wgpz_wgmc: [ wgpz_wgmc: [
{ required: true, message: "请选择网关名称", trigger: "blur" }, { required: true, message: "请选择网关名称", trigger: "blur" },
@ -665,18 +664,19 @@ export default {
console.log(node); console.log(node);
if (data.editing) { if (data.editing) {
this.outerVisible = true; this.outerVisible = true;
let res2 = await GetUserAnswer({ this.GetUserAnswer();
mark: "CHGYWG_yx", // let res2 = await GetUserAnswer({
user_id: this.user_id, // mark: "CHGYWG_yx",
// user_id: "USER202307301114011710", // user_id: this.user_id,
}); // // user_id: "USER202307301114011710",
if (res2.data.data && res2.data.state) { // });
console.log(res2.data.data.mark_value); // if (res2.data.data && res2.data.state) {
let res3 = JSON.parse(res2.data.data.mark_value); // console.log(res2.data.data.mark_value);
this.gateWay.wgpz_wgid = res3.wgpz_wgid; // let res3 = JSON.parse(res2.data.data.mark_value);
// console.log(this.formData.wgpz_wgid); // this.gateWay.wgpz_wgid = res3.wgpz_wgid;
this.gateWay.wgpz_wgmc = res3.wgpz_wgmc; // // console.log(this.formData.wgpz_wgid);
} // this.gateWay.wgpz_wgmc = res3.wgpz_wgmc;
// }
} }
}, },
treeNodeClick() { treeNodeClick() {
@ -686,13 +686,13 @@ export default {
this.diag_drive = true; this.diag_drive = true;
}, },
async handleSelect() { async handleSelect() {
let datas = sessionStorage.getItem("CHGYWG_yx"); // let datas = sessionStorage.getItem("CHGYWG_yx");
// console.log(JSON.parse(datas)); // console.log(JSON.parse(datas));
datas = { ...JSON.parse(datas), ...this.tableData[0] }; // datas = { ...JSON.parse(datas), ...this.tableData[0] };
let res = await SaveUserAnswer({ let res = await SaveUserAnswer({
mark: "CHGYWG_yx", mark: "CHGYWG_yx",
user_id: this.user_id, user_id: this.user_id,
mark_value: JSON.stringify(datas), mark_value: JSON.stringify(this.tableData[0]),
}); });
if (res.data.state) { if (res.data.state) {
this.$message({ this.$message({
@ -700,7 +700,7 @@ export default {
type: "success", type: "success",
}); });
console.log(res); console.log(res);
sessionStorage.setItem("CHGYWG_yx", JSON.stringify(datas)); sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.tableData[0]));
} else { } else {
this.$message({ this.$message({
message: `保存失败`, message: `保存失败`,
@ -728,6 +728,38 @@ export default {
this.tableData[0].cjdpz_scms = obj.cjdpz_scms; this.tableData[0].cjdpz_scms = obj.cjdpz_scms;
this.tableData[0].cjdpz_dw = obj.cjdpz_dw; this.tableData[0].cjdpz_dw = obj.cjdpz_dw;
} }
this.tableData[0].sbpz_sbmc = obj.sbpz_sbmc;
this.tableData[0].sbpz_kzqxy = obj.sbpz_kzqxy;
this.tableData[0].sbpz_ip = obj.sbpz_ip;
this.tableData[0].sbpz_port = obj.sbpz_port;
this.tableData[0].sbpz_czdz = obj.sbpz_czdz;
this.tableData[0].sbpz_lxzq = obj.sbpz_lxzq;
this.tableData[0].sbpz_qyhmcj = obj.sbpz_qyhmcj;
this.tableData[0].sbpz_qyplcj = obj.sbpz_qyplcj;
this.tableData[0].sbpz_zdplcjs = obj.sbpz_zdplcjs;
this.tableData[0].sbpz_cjcgsj = obj.sbpz_cjcgsj;
this.tableData[0].sbpz_zqsbonchange = obj.sbpz_zqsbonchange;
this.tableData[0].sbpz_txsjjg = obj.sbpz_txsjjg;
this.tableData[0].sbpz_xqjcqxr = obj.sbpz_xqjcqxr;
this.tableData[0].sbpz_bcjcqxr = obj.sbpz_bcjcqxr;
this.tableData[0].wgpz_wgid = obj.wgpz_wgid;
this.tableData[0].wgpz_wgmc = obj.wgpz_wgmc;
this.tableData[0].ippz_wllx = obj.ippz_wllx;
this.tableData[0].ippz_ip = obj.ippz_ip;
this.tableData[0].ippz_zwym = obj.ippz_zwym;
this.tableData[0].ippz_wg = obj.ippz_wg;
this.tableData[0].ippz_dns = obj.ippz_dns;
this.tableData[0].ippz_dns_by = obj.ippz_dns_by;
this.tableData[0].mqtt_ip = obj.mqtt_ip;
this.tableData[0].mqtt_wgsn = obj.mqtt_wgsn;
this.tableData[0].mqtt_port = obj.mqtt_port;
this.tableData[0].mqtt_keepalive = obj.mqtt_keepalive;
this.tableData[0].mqtt_tls = obj.mqtt_tls;
this.tableData[0].mqtt_clearsession = obj.mqtt_clearsession;
this.tableData[0].mqtt_sssjfbzt = obj.mqtt_sssjfbzt;
this.tableData[0].mqtt_qos = obj.mqtt_qos;
this.tableData[0].mqtt_cjd_sbmc = obj.mqtt_cjd_sbmc;
this.tableData[0].mqtt_cjd_tagid = obj.mqtt_cjd_tagid;
} }
}, },
async sendTree() { async sendTree() {
@ -754,24 +786,24 @@ export default {
async saveGates() { async saveGates() {
this.outerVisible = false; this.outerVisible = false;
// this.innerVisible = false; // this.innerVisible = false;
let datas = sessionStorage.getItem("CHGYWG_yx"); // datas = sessionStorage.getItem("CHGYWG_yx");
// console.log(JSON.parse(datas)); // console.log(JSON.parse(datas));
datas = { ...JSON.parse(datas), ...this.gateWay }; // let datas = { ...this.tableData[0], ...this.gateWay };
console.log(datas); // console.log(datas);
let res = await SaveUserAnswer({ let res = await SaveUserAnswer({
mark: "CHGYWG_yx", mark: "CHGYWG_yx",
user_id: this.user_id, user_id: this.user_id,
// user_id: "USER202307301114011710", // user_id: "USER202307301114011710",
mark_value: JSON.stringify(datas), mark_value: JSON.stringify(this.tableData[0]),
}); });
if (res.data.state) { if (res.data.state) {
this.$message({ this.$message({
message: "修改成功", message: "修改成功",
type: "success", type: "success",
}); });
this.trees[0].label = this.gateWay.wgpz_wgid; this.trees[0].label = this.tableData[0].wgpz_wgid;
this.sendTree(); this.sendTree();
sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.gateWay)); sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.tableData[0]));
} else { } else {
this.$message({ this.$message({
message: `保存失败,原因是${res.data.message}`, message: `保存失败,原因是${res.data.message}`,

View File

@ -14,12 +14,6 @@
@node-click="treeNodeClick" @node-click="treeNodeClick"
ref="tree" ref="tree"
> >
<!-- <span class="custom-tree-node" slot-scope="{ node, data }">
<template v-if="data.editing == 1 && flag">
<el-input style="width: 260px;" v-model="gateway" @change="changeInput"></el-input>
</template>
<template v-else>{{ data.label }}</template>
</span> -->
</el-tree> </el-tree>
<!-- 树形控件右键组件 --> <!-- 树形控件右键组件 -->
<div v-show="menuShow" class="tree_rightmenu" :style="{ ...rightMenu }"> <div v-show="menuShow" class="tree_rightmenu" :style="{ ...rightMenu }">
@ -853,7 +847,7 @@ export default {
sbpz_xqjcqxr: this.formData.sbpz_xqjcqxr, sbpz_xqjcqxr: this.formData.sbpz_xqjcqxr,
sbpz_bcjcqxr: this.formData.sbpz_bcjcqxr, sbpz_bcjcqxr: this.formData.sbpz_bcjcqxr,
}; };
datas = { ...formData, ...obj }; let datas = { ...this.formData, ...obj };
let res = await SaveUserAnswer({ let res = await SaveUserAnswer({
mark: "CHGYWG_yx", mark: "CHGYWG_yx",
user_id: this.user_id, user_id: this.user_id,
@ -1004,7 +998,7 @@ export default {
mounted() { mounted() {
this.user_id = this.$route.query.user_id; this.user_id = this.$route.query.user_id;
console.log(this.user_id); console.log(this.user_id);
console.log(this.$route.query.firstlabel); // console.log(this.$route.query.firstlabel);
this.getTree(); this.getTree();
// this.trees[0].label = this.$route.query.firstlabel; // this.trees[0].label = this.$route.query.firstlabel;
this.GetUserAnswer(); this.GetUserAnswer();