From ef69e7c282ff25c99f5be735c788aa65fc5085cf Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Tue, 12 Dec 2023 16:38:15 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=8C=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 29 ++-- src/components/BarEchart.vue | 2 - src/components/BarEchart1.vue | 2 - src/components/BarEchartB.vue | 2 - src/components/BarEchartC.vue | 2 - src/components/BarEchartG.vue | 2 - src/components/BarEchartS.vue | 2 - src/components/Flow.vue | 74 ++++------ src/components/Header.vue | 1 - src/components/History1.vue | 3 - src/components/History2.vue | 3 - src/components/History3.vue | 3 - src/components/History4.vue | 3 - src/components/History5.vue | 3 - src/components/ImagePreview.vue | 1 - src/components/Index.vue | 236 +++++++++++++++----------------- src/components/LineEchart.vue | 3 - src/components/Liquid.vue | 77 ++++++----- src/components/Process.vue | 1 - src/components/Quality.vue | 49 +++---- src/components/Zhibiao.vue | 1 - src/components/Zhibiao1.vue | 4 - src/components/Zhibiao3.vue | 4 - src/components/Zhibiao4.vue | 4 - src/components/Zhibiao5.vue | 1 - src/store/index.js | 39 +++++- src/views/History.vue | 1 - src/views/Login.vue | 1 - src/views/page.vue | 4 +- 29 files changed, 255 insertions(+), 302 deletions(-) diff --git a/src/App.vue b/src/App.vue index fb80bc7..e582254 100644 --- a/src/App.vue +++ b/src/App.vue @@ -24,6 +24,7 @@ import Sidebar from '@/components/Sidebar.vue' import { useRouter } from 'vue-router' import { pathMap, localGet } from '@/utils'; import mqtt from 'mqtt/dist/mqtt.min'; +import { useStore } from "vuex"; export default { name: 'App', components: { @@ -32,6 +33,7 @@ export default { Sidebar }, setup() { + const store = useStore(); const noMenu = ['/login'] const router = useRouter(); const state = reactive({ @@ -70,8 +72,8 @@ export default { onMounted(() => { if (localGet('token')) { - state.client = mqtt.connect('ws://www.shikicc.com', { - port: 52194, + state.client = mqtt.connect('ws://www.shikicc.com:52190/mqtt', { + port: 52190, clientId: new Date(), username: 'hsgy', password: "hsgy123", @@ -86,10 +88,10 @@ export default { state.client.on("connect", e => { // qos 是通道 一般有 0,1, 2 const url = `iot/push/plc_01`; - this.client.subscribe([url], { qos: 2 }, error => { + state.client.subscribe([url], { qos: 2 }, error => { if (!error) { console.log("消息订阅成功!"); - this.mqttAll(); + mqttAll(); } else { console.log("消息订阅失败!"); } @@ -100,15 +102,16 @@ export default { // 接收消息 const mqttAll = () => { - this.client.on("message", (topic, message) => { - // var data = JSON.parse(message); - console.log(message); - // if (data) { - // if (data.topic === `iot/push/plc_01`) { - // var res = data.data; - // return; - // } - // } + state.client.on("message", (topic, message) => { + var data = JSON.parse(message); + if (data) { + if (data.topic === `iot/push/plc_01`) { + var res = data.data; + store.commit("setPlcData", res); + + return; + } + } }); } onUnmounted(() => { diff --git a/src/components/BarEchart.vue b/src/components/BarEchart.vue index 0acfecb..f0de1c3 100644 --- a/src/components/BarEchart.vue +++ b/src/components/BarEchart.vue @@ -28,7 +28,6 @@ export default { }); onMounted(() => { bus.on('foo', e => { - console.log(12) getEchart(); }) }) @@ -61,7 +60,6 @@ export default { } }; const loadlineChart = (myChart, data) => { - console.log(data); var option = { grid: { left: "8%", //画布左移位置 diff --git a/src/components/BarEchart1.vue b/src/components/BarEchart1.vue index fd44bcf..b7d10c9 100644 --- a/src/components/BarEchart1.vue +++ b/src/components/BarEchart1.vue @@ -27,7 +27,6 @@ export default { }); onMounted(() => { bus.on('foo', e => { - console.log(e) getEchart(); }) getEchart(); @@ -142,7 +141,6 @@ export default { } }; const loadlineChart = (myChart, data) => { - console.log(data); var option = { grid: { left: "8%", //画布左移位置 diff --git a/src/components/BarEchartB.vue b/src/components/BarEchartB.vue index 6d48dad..ed758c2 100644 --- a/src/components/BarEchartB.vue +++ b/src/components/BarEchartB.vue @@ -27,7 +27,6 @@ export default { }); onMounted(() => { bus.on('foo', e => { - console.log(e) getEchart(); }) getEchart(); @@ -137,7 +136,6 @@ export default { } }; const loadlineChart = (myChart, data) => { - console.log(data); var option = { grid: { left: "8%", //画布左移位置 diff --git a/src/components/BarEchartC.vue b/src/components/BarEchartC.vue index 4b131da..86ae959 100644 --- a/src/components/BarEchartC.vue +++ b/src/components/BarEchartC.vue @@ -27,7 +27,6 @@ export default { }); onMounted(() => { bus.on('foo', e => { - console.log(e) getEchart(); }) getEchart(); @@ -133,7 +132,6 @@ export default { } }; const loadlineChart = (myChart, data) => { - console.log(data); var option = { grid: { left: "8%", //画布左移位置 diff --git a/src/components/BarEchartG.vue b/src/components/BarEchartG.vue index 35c9395..5a27630 100644 --- a/src/components/BarEchartG.vue +++ b/src/components/BarEchartG.vue @@ -27,7 +27,6 @@ export default { }); onMounted(() => { bus.on('foo', e => { - console.log(e) getEchart(); }) getEchart(); @@ -137,7 +136,6 @@ export default { } }; const loadlineChart = (myChart, data) => { - console.log(data); var option = { grid: { left: "8%", //画布左移位置 diff --git a/src/components/BarEchartS.vue b/src/components/BarEchartS.vue index a4523d5..9aa94d2 100644 --- a/src/components/BarEchartS.vue +++ b/src/components/BarEchartS.vue @@ -27,7 +27,6 @@ export default { }); onMounted(() => { bus.on('foo', e => { - console.log(e) getEchart(); }) getEchart(); @@ -137,7 +136,6 @@ export default { } }; const loadlineChart = (myChart, data) => { - console.log(data); var option = { grid: { left: "8%", //画布左移位置 diff --git a/src/components/Flow.vue b/src/components/Flow.vue index 2077c6f..8851b45 100644 --- a/src/components/Flow.vue +++ b/src/components/Flow.vue @@ -4,20 +4,12 @@