From df249fa0a8f13f618c7450ecdc262df1f29f89c3 Mon Sep 17 00:00:00 2001 From: lll Date: Mon, 13 Nov 2023 19:47:06 +0800 Subject: [PATCH] 11 --- src/components/ChiClone.vue | 374 +++++++++++++++++++++++-------- src/components/ChiCollection.vue | 174 ++++++++------ src/components/ChiDevice.vue | 10 +- 3 files changed, 384 insertions(+), 174 deletions(-) diff --git a/src/components/ChiClone.vue b/src/components/ChiClone.vue index 43e9266..6e7a492 100644 --- a/src/components/ChiClone.vue +++ b/src/components/ChiClone.vue @@ -5,8 +5,15 @@
- + @@ -159,16 +237,24 @@ @@ -179,8 +265,14 @@
- + 保 存 @@ -192,16 +284,40 @@
- + - - + + - - + + @@ -237,16 +353,55 @@ export default { gateway: "", trees: [], user_id: "", + mqtt_qiyong: false, formData: { - mqtt_qiyong: false, mqtt_ip: "", mqtt_wgsn: "", mqtt_port: "", mqtt_keepalive: "", mqtt_sssjfbzt: "", - // mqtt_tls: false, - // mqtt_clearsession: false, - mqtt_qos: "0", + mqtt_qos: "", + + 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_ip2: "", @@ -492,15 +647,13 @@ export default { required: true, message: "", validator: this.validateIp, - trigger: "blur" + trigger: "blur", }, ], mqtt_wgsn: [ { required: true, message: "请输入网关SN", trigger: "blur" }, ], - mqtt_port: [ - { required: true, message: "请输入端口", trigger: "blur" }, - ], + mqtt_port: [{ required: true, message: "请输入端口", trigger: "blur" }], mqtt_keepalive: [ { required: true, message: "请输入KeepAlive", trigger: "blur" }, ], @@ -561,31 +714,31 @@ export default { console.log(res); console.log(JSON.parse(res.data.data.data)); this.trees = JSON.parse(res.data.data.data); - }) + }); }, methods: { //ip地址验证 validateIp(rule, value, callback) { if ( this.mqtt_ip1 + - "." + - this.mqtt_ip2 + - "." + - this.mqtt_ip3 + - "." + - this.mqtt_ip4 === + "." + + this.mqtt_ip2 + + "." + + this.mqtt_ip3 + + "." + + this.mqtt_ip4 === "..." ) { callback(new Error("请输入IP地址")); } 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( this.mqtt_ip1 + - "." + - this.mqtt_ip2 + - "." + - this.mqtt_ip3 + - "." + - this.mqtt_ip4 + "." + + this.mqtt_ip2 + + "." + + this.mqtt_ip3 + + "." + + this.mqtt_ip4 ) ) { callback(new Error("请输入有效的IP地址")); @@ -604,27 +757,28 @@ export default { } }); }, - changeInput() { - this.flag = false; - this.trees[0].label = this.gateway; - this.sendTree(); - }, + // changeInput() { + // this.flag = false; + // this.trees[0].label = this.gateway; + // this.sendTree(); + // }, async rightClick(e, data, node) { console.log(node); if (data.editing) { this.outerVisible = true; - let res2 = await GetUserAnswer({ - mark: "CHGYWG_yx", - user_id: this.user_id, - // user_id: "USER202307301114011710", - }); - if (res2.data.data && res2.data.state) { - console.log(res2.data.data.mark_value); - let res3 = JSON.parse(res2.data.data.mark_value); - this.gateWay.wgpz_wgid = res3.wgpz_wgid; - // console.log(this.formData.wgpz_wgid); - this.gateWay.wgpz_wgmc = res3.wgpz_wgmc; - } + this.GetUserAnswer(); + // let res2 = await GetUserAnswer({ + // mark: "CHGYWG_yx", + // user_id: this.user_id, + // // user_id: "USER202307301114011710", + // }); + // if (res2.data.data && res2.data.state) { + // console.log(res2.data.data.mark_value); + // let res3 = JSON.parse(res2.data.data.mark_value); + // this.gateWay.wgpz_wgid = res3.wgpz_wgid; + // // console.log(this.formData.wgpz_wgid); + // this.gateWay.wgpz_wgmc = res3.wgpz_wgmc; + // } } }, getParameter(data) { @@ -664,17 +818,17 @@ export default { type: "success", }); }, - async handleSelect() { - let datas = sessionStorage.getItem("CHGYWG_yx"); - datas = { ...JSON.parse(datas), ...this.tableData[0] }; - let res = await SaveUserAnswer({ - mark: "CHGYWG_yx", - user_id: this.user_id, - mark_value: JSON.stringify(datas), - }); - console.log(res); - sessionStorage.setItem("CHGYWG_yx", JSON.stringify(datas)); - }, + // async handleSelect() { + // let datas = sessionStorage.getItem("CHGYWG_yx"); + // datas = { ...JSON.parse(datas), ...this.tableData[0] }; + // let res = await SaveUserAnswer({ + // mark: "CHGYWG_yx", + // user_id: this.user_id, + // mark_value: JSON.stringify(datas), + // }); + // console.log(res); + // sessionStorage.setItem("CHGYWG_yx", JSON.stringify(datas)); + // }, async saveClone() { var obj = { // 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_tagid: this.tableData[0].mqtt_cjd_tagid, }; - let datas = sessionStorage.getItem("CHGYWG_yx"); - datas = { ...JSON.parse(datas), ...obj }; + let datas = { ...this.formData, ...obj }; let res = await SaveUserAnswer({ mark: "CHGYWG_yx", user_id: this.user_id, @@ -714,7 +867,6 @@ export default { type: "error", }); } - }, async GetUserAnswer() { this.loading = true; @@ -734,12 +886,44 @@ export default { this.mqtt_ip2 = obj.mqtt_ip.split(".")[1]; this.mqtt_ip3 = obj.mqtt_ip.split(".")[2]; 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_port = obj.mqtt_port; this.formData.mqtt_keepalive = obj.mqtt_keepalive; this.formData.mqtt_sssjfbzt = obj.mqtt_sssjfbzt; 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) { this.tableData[0].mqtt_cjd_sbmc = obj.mqtt_cjd_sbmc; } else { @@ -757,7 +941,7 @@ export default { user_id: this.user_id, data: JSON.stringify(this.trees), type: "3", - }) + }); console.log(result); }, //网关配置的信息 @@ -772,28 +956,29 @@ export default { } }); }, - // + // async saveGates() { this.outerVisible = false; // this.innerVisible = false; - let datas = sessionStorage.getItem("CHGYWG_yx"); + // let datas = sessionStorage.getItem("CHGYWG_yx"); // console.log(JSON.parse(datas)); - datas = { ...JSON.parse(datas), ...this.gateWay }; - console.log(datas); + // datas = { ...JSON.parse(datas), ...this.gateWay }; + // console.log(datas); let res = await SaveUserAnswer({ mark: "CHGYWG_yx", user_id: this.user_id, // user_id: "USER202307301114011710", - mark_value: JSON.stringify(datas), + mark_value: JSON.stringify(this.formData), }); + console.log(res); if (res.data.state) { this.$message({ message: "修改成功", type: "success", }); - this.trees[0].label = this.gateWay.wgpz_wgid; + this.trees[0].label = this.formData.wgpz_wgid; this.sendTree(); - sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.gateWay)); + sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.formData)); } else { this.$message({ message: `保存失败,原因是${res.data.message}`, @@ -801,7 +986,7 @@ export default { }); } console.log(res); - } + }, }, mounted() { this.GetUserAnswer(); @@ -874,7 +1059,6 @@ export default { padding-right: 348px; } - .el-row { height: 54px; display: flex; diff --git a/src/components/ChiCollection.vue b/src/components/ChiCollection.vue index bd36910..30e9cc3 100644 --- a/src/components/ChiCollection.vue +++ b/src/components/ChiCollection.vue @@ -134,7 +134,7 @@
@@ -157,7 +157,7 @@ @@ -575,56 +575,55 @@ export default { 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_ip: "", + mqtt_wgsn: "", + mqtt_port: "", + mqtt_keepalive: "", + mqtt_tls: "", + mqtt_clearsession: "", + mqtt_sssjfbzt: "", + mqtt_qos: "", + + mqtt_cjd_sbmc: "", + mqtt_cjd_tagid: "", }, ], // 网关配置的出现 outerVisible: false, - 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: "", - }, + // gateWay: {}, rulesGate: { wgpz_wgmc: [ { required: true, message: "请选择网关名称", trigger: "blur" }, @@ -665,18 +664,19 @@ export default { console.log(node); if (data.editing) { this.outerVisible = true; - let res2 = await GetUserAnswer({ - mark: "CHGYWG_yx", - user_id: this.user_id, - // user_id: "USER202307301114011710", - }); - if (res2.data.data && res2.data.state) { - console.log(res2.data.data.mark_value); - let res3 = JSON.parse(res2.data.data.mark_value); - this.gateWay.wgpz_wgid = res3.wgpz_wgid; - // console.log(this.formData.wgpz_wgid); - this.gateWay.wgpz_wgmc = res3.wgpz_wgmc; - } + this.GetUserAnswer(); + // let res2 = await GetUserAnswer({ + // mark: "CHGYWG_yx", + // user_id: this.user_id, + // // user_id: "USER202307301114011710", + // }); + // if (res2.data.data && res2.data.state) { + // console.log(res2.data.data.mark_value); + // let res3 = JSON.parse(res2.data.data.mark_value); + // this.gateWay.wgpz_wgid = res3.wgpz_wgid; + // // console.log(this.formData.wgpz_wgid); + // this.gateWay.wgpz_wgmc = res3.wgpz_wgmc; + // } } }, treeNodeClick() { @@ -686,13 +686,13 @@ export default { this.diag_drive = true; }, async handleSelect() { - let datas = sessionStorage.getItem("CHGYWG_yx"); + // let datas = sessionStorage.getItem("CHGYWG_yx"); // console.log(JSON.parse(datas)); - datas = { ...JSON.parse(datas), ...this.tableData[0] }; + // datas = { ...JSON.parse(datas), ...this.tableData[0] }; let res = await SaveUserAnswer({ mark: "CHGYWG_yx", user_id: this.user_id, - mark_value: JSON.stringify(datas), + mark_value: JSON.stringify(this.tableData[0]), }); if (res.data.state) { this.$message({ @@ -700,7 +700,7 @@ export default { type: "success", }); console.log(res); - sessionStorage.setItem("CHGYWG_yx", JSON.stringify(datas)); + sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.tableData[0])); } else { this.$message({ message: `保存失败`, @@ -728,6 +728,38 @@ export default { this.tableData[0].cjdpz_scms = obj.cjdpz_scms; 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() { @@ -754,24 +786,24 @@ export default { async saveGates() { this.outerVisible = false; // this.innerVisible = false; - let datas = sessionStorage.getItem("CHGYWG_yx"); + // datas = sessionStorage.getItem("CHGYWG_yx"); // console.log(JSON.parse(datas)); - datas = { ...JSON.parse(datas), ...this.gateWay }; - console.log(datas); + // let datas = { ...this.tableData[0], ...this.gateWay }; + // console.log(datas); let res = await SaveUserAnswer({ mark: "CHGYWG_yx", user_id: this.user_id, // user_id: "USER202307301114011710", - mark_value: JSON.stringify(datas), + mark_value: JSON.stringify(this.tableData[0]), }); if (res.data.state) { this.$message({ message: "修改成功", type: "success", }); - this.trees[0].label = this.gateWay.wgpz_wgid; + this.trees[0].label = this.tableData[0].wgpz_wgid; this.sendTree(); - sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.gateWay)); + sessionStorage.setItem("CHGYWG_yx", JSON.stringify(this.tableData[0])); } else { this.$message({ message: `保存失败,原因是${res.data.message}`, diff --git a/src/components/ChiDevice.vue b/src/components/ChiDevice.vue index f446d50..e52dbf1 100644 --- a/src/components/ChiDevice.vue +++ b/src/components/ChiDevice.vue @@ -14,12 +14,6 @@ @node-click="treeNodeClick" ref="tree" > -
@@ -853,7 +847,7 @@ export default { sbpz_xqjcqxr: this.formData.sbpz_xqjcqxr, sbpz_bcjcqxr: this.formData.sbpz_bcjcqxr, }; - datas = { ...formData, ...obj }; + let datas = { ...this.formData, ...obj }; let res = await SaveUserAnswer({ mark: "CHGYWG_yx", user_id: this.user_id, @@ -1004,7 +998,7 @@ export default { mounted() { this.user_id = this.$route.query.user_id; console.log(this.user_id); - console.log(this.$route.query.firstlabel); + // console.log(this.$route.query.firstlabel); this.getTree(); // this.trees[0].label = this.$route.query.firstlabel; this.GetUserAnswer();