From 16be6d13b7f61ead50b0d2834770f53e7cbae3a0 Mon Sep 17 00:00:00 2001 From: zhangqun <179111901@qq.com> Date: Tue, 14 Mar 2023 13:11:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=BD=E8=80=97=E5=88=86=E6=9E=90-=E5=9B=AD?= =?UTF-8?q?=E5=8C=BA=E6=80=BB=E8=83=BD=E8=80=97=E5=88=86=E6=9E=90=E6=80=BB?= =?UTF-8?q?=E8=83=BD=E8=80=97=E6=9C=80=E5=A4=9A=E4=BF=9D=E7=95=99=E4=B8=A4?= =?UTF-8?q?=E4=BD=8D=E5=B0=8F=E6=95=B0=E7=82=B9=EF=BC=9B=E5=88=86=E9=A1=B9?= =?UTF-8?q?=E6=80=BB=E8=83=BD=E8=80=97=E8=BF=9114=E5=A4=A9=E9=9D=9E?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=B6=E6=AE=B5=E8=AE=BE=E5=A4=87=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=87=8D=E6=96=B0=E8=81=94=E8=B0=83=EF=BC=88=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=A1=A8=E6=9B=B4=E6=8D=A2=EF=BC=89=EF=BC=9B=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=99=BB=E5=BD=95=E6=B3=A8=E9=87=8A=E6=8E=89=E6=9C=AA?= =?UTF-8?q?=E7=94=A8=E5=88=B0=E7=9A=84=E7=A7=9F=E6=88=B7=E5=92=8C=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8=EF=BC=9B?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=A8=A1=E5=BC=8F-=E7=85=A7=E6=98=8E?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E7=8A=B6=E6=80=81=E5=9B=9E=E6=89=A7=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E4=B8=BAsocket=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=BA=9F?= =?UTF-8?q?=E5=BC=83=E4=BB=A5=E5=89=8D=E7=9A=84=E8=BD=AE=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/monitoring/light.vue | 70 +++++++++++++++-- src/page/login/userlogin.vue | 8 +- src/router/axios.js | 8 +- src/util/bfHelper.js | 26 ++++--- .../sourceAnaly/components/buildWarm.vue | 4 +- .../sourceAnaly/components/conditionAnaly.vue | 75 ++++++++++--------- .../sourceAnaly/components/consumeAnaly.vue | 6 +- vue.config.js | 11 ++- 8 files changed, 149 insertions(+), 59 deletions(-) diff --git a/src/components/monitoring/light.vue b/src/components/monitoring/light.vue index 5cd0b8e..af8ad66 100644 --- a/src/components/monitoring/light.vue +++ b/src/components/monitoring/light.vue @@ -310,6 +310,7 @@ export default { }, data() { return { + path:'ws://192.168.1.12/blade-datahttp/ws',//socket地址 build: "00", //楼 floored: null, //楼层 controlAll: 2, //批量控制开关 @@ -455,8 +456,13 @@ export default { }, mounted() { this.getNavigationMap(); + this.initSocket(); }, beforeDestroy() { + if (this.socket) { + this.socket.close(); + this.socket = ""; + } if (this.setInterval) { clearInterval(this.setInterval); } @@ -465,6 +471,47 @@ export default { } }, methods: { + //socket 接收空开状态 + initSocket() { + if (typeof (WebSocket) === "undefined") { + alert("您的浏览器不支持socket"); + } else { + this.socket = new WebSocket(this.path); + // 监听socket连接 + this.socket.onopen = this.open; + // 监听socket错误信息 + this.socket.onerror = this.error; + // 监听socket消息 + this.socket.onmessage = this.getMessage; + } + }, + open() { + console.log("socket连接成功") + }, + error() { + console.log("socket连接错误") + }, + getMessage(msg) { + console.log('scoket 模拟',msg) + let retData = JSON.parse(msg.data); + if (this.tableData.floorData && this.tableData.floorData.length > 0) { + this.tableData.floorData.map((item1,index) => { + let lightObjIndex = item1.lightList.findIndex(item2 => item2.code == retData.code); + if(lightObjIndex > -1 && item1.lightList[lightObjIndex].openStatus != retData.openStatus){ + item1.lightList[lightObjIndex].openStatus = retData.openStatus; + if(retData.openStatus == 1){ + //开灯 + console.log(item1.lightList[lightObjIndex].name,'开灯') + this.getLight([{arr: item1.lightList[lightObjIndex].ctrlList.split(','),build: item1.lightList[lightObjIndex].build}]); + }else{ + //关灯 + console.log(item1.lightList[lightObjIndex].name,'关灯') + this.cleanLight([{arr: item1.lightList[lightObjIndex].ctrlList.split(','),build: item1.lightList[lightObjIndex].build}]); + } + } + }) + } + }, //关闭告警 - 重新查询告警列表 doCancelWarn(id) { getCancelWarn(id).then((res) => { @@ -567,6 +614,7 @@ export default { bfHelper.setColor("#a5bbe5", offList); }, getNavigationMap() { + // bfHelper.mapDestroy(); setTimeout(() => { commonValue.getNavigationMap("water"); }); @@ -606,6 +654,7 @@ export default { } } if (arr.length > 0) { + // console.log('arr', arr) bfHelper.setGlowEffectById(arr); //根据构件ID设置发光效果 bfHelper.setColor("#fff99a", arr); bfHelper.restoreComponentsOpacityById(arr); @@ -693,7 +742,11 @@ export default { this.$message.success("指令发送成功"); if (res.data.data[0].status == 1) { // this.getSblb(); - this.checkLight(); + // this.checkLight(); + //模拟 + // setTimeout(() => { + // this.getMessage({code: row.code, openStatus: 1, ctrlList: row.ctrlList, build: row.build}); + // },10*1000) } else { this.$message.warning(res.data.data[0].msg); } @@ -705,7 +758,11 @@ export default { this.$message.success("指令发送成功"); if (res.data.data[0].status == 1) { // this.getSblb(); - this.checkLight(); + // this.checkLight(); + //模拟 + // setTimeout(() => { + // this.getMessage({code: row.code, openStatus: 2, ctrlList: row.ctrlList, build: row.build}); + // },10*1000) } else { this.$message.warning(res.data.data[0].msg); } @@ -734,7 +791,7 @@ export default { } } // this.getSblb(); - this.checkLight(); + // this.checkLight(); } }); } else { @@ -761,7 +818,7 @@ export default { } } // this.getSblb(); - this.checkLight(); + // this.checkLight(); } }); } else { @@ -786,7 +843,7 @@ export default { } } // this.getSblb(); - this.checkLight(); + // this.checkLight(); } }); }, @@ -808,13 +865,14 @@ export default { } } // this.getSblb(); - this.checkLight(); + // this.checkLight(); } }); }, /** * 定时轮询空开状态 * 15秒执行一次,执行5次 + * 废弃 - 变更使用socket 20230313 */ checkLight() { if (this.intervalCheckLight == 0) { diff --git a/src/page/login/userlogin.vue b/src/page/login/userlogin.vue index 5463efe..b722ead 100644 --- a/src/page/login/userlogin.vue +++ b/src/page/login/userlogin.vue @@ -101,8 +101,8 @@ }; }, created() { - this.getTenant(); - this.refreshCode(); + // this.getTenant(); + // this.refreshCode(); }, mounted() {}, computed: { @@ -137,7 +137,7 @@ loading.close(); }).catch(() => { loading.close(); - this.refreshCode(); + // this.refreshCode(); }); } }); @@ -194,4 +194,4 @@ transform: translateY(-50%); width: 100px; } - + diff --git a/src/router/axios.js b/src/router/axios.js index 6f50964..b5c7b8f 100644 --- a/src/router/axios.js +++ b/src/router/axios.js @@ -16,6 +16,7 @@ import {Base64} from 'js-base64'; import NProgress from 'nprogress'; import 'nprogress/nprogress.css'; +var needLoadingRequestCount = 0 //当前正在请求的数量 //默认超时时间 axios.defaults.timeout = 60*1000; //返回其他状态码 @@ -31,6 +32,7 @@ NProgress.configure({ //http request拦截 axios.interceptors.request.use(config => { //开启 progress bar + needLoadingRequestCount++; NProgress.start(); const meta = (config.meta || {}); const isToken = meta.isToken === false; @@ -54,7 +56,10 @@ axios.interceptors.request.use(config => { //http response 拦截 axios.interceptors.response.use(res => { //关闭 progress bar - NProgress.done(); + needLoadingRequestCount-- //调用完一个接口就进行-1 + if(needLoadingRequestCount <= 0){ + NProgress.done(); + } //获取状态码 const status = res.data.code || res.status; const statusWhiteList = website.statusWhiteList || []; @@ -73,6 +78,7 @@ axios.interceptors.response.use(res => { } return res; }, error => { + needLoadingRequestCount = 0; NProgress.done(); return Promise.reject(new Error(error)); }); diff --git a/src/util/bfHelper.js b/src/util/bfHelper.js index 9d1339c..4c2267c 100644 --- a/src/util/bfHelper.js +++ b/src/util/bfHelper.js @@ -2862,18 +2862,23 @@ const loadModel = (i) => { // BimfaceLoaderConfig.APIHost = "http://10.90.100.203:8080"; BimfaceLoaderConfig.dataEnvType = BimfaceEnvOption.Local; BimfaceLoaderConfig.sdkPath = "static/jssdk@3.6.191/jssdk"; - BimfaceLoaderConfig.path = i == 1 ? 'http://47.103.199.45:8000/face/ywq/viewToken.json' : - 'http://47.103.199.45:8000/face/tt/viewToken.json'; + BimfaceLoaderConfig.path = i == 1 ? '/bimfaceApi/ywq/viewToken.json' : + '/bimfaceApi/tt/viewToken.json'; + // BimfaceLoaderConfig.path = i == 1 ? 'http://47.103.199.45:8000/face/ywq/viewToken.json' : + // 'http://47.103.199.45:8000/face/tt/viewToken.json'; // BimfaceLoaderConfig.path = // i == 1 // ? "http://10.90.100.203:8080/ywq/viewToken.json" // : "http://10.90.100.203:8080/tt/viewToken.json"; - BimfaceSDKLoader.load(BimfaceLoaderConfig, onSDKLoadSucceeded); + BimfaceSDKLoader.load(BimfaceLoaderConfig, onSDKLoadSucceeded, (err) => { + console.log('err', err) + }); }; // 加载模型 const onSDKLoadSucceeded = (viewMetaData) => { + // console.log('load success',viewMetaData) if (viewMetaData.viewType == "3DView") { if (!viewer3D) { let dom4restore = document.getElementById("domId"); @@ -2892,6 +2897,7 @@ const onSDKLoadSucceeded = (viewMetaData) => { // 改变背景图 bimBgType = null; setBimBg(1); + // console.log('laod end') // 加载完成监听事件 viewer3D.addEventListener( Glodon.Bimface.Viewer.Viewer3DEvent.ViewAdded, @@ -3482,12 +3488,14 @@ const navigationMap = (dom, img, build, floor) => { viewer3D.render(); }; const mapUpdate = (img, mapAnchors, modelAnchors) => { - navigationMap2.associateModel({ - url: img, - mapAnchors: mapAnchors, - modelAnchors: modelAnchors, - }); - viewer3D.render(); + if (navigationMap2) { + navigationMap2.associateModel({ + url: img, + mapAnchors: mapAnchors, + modelAnchors: modelAnchors, + }); + viewer3D.render(); + } }; //销毁地图 const mapDestroy = () => { diff --git a/src/views/sourceAnaly/components/buildWarm.vue b/src/views/sourceAnaly/components/buildWarm.vue index 81a5326..3359749 100644 --- a/src/views/sourceAnaly/components/buildWarm.vue +++ b/src/views/sourceAnaly/components/buildWarm.vue @@ -59,8 +59,8 @@
- {{ warmTotal }}MJ -

耗热量

+ {{ warmTotal }}MJ +

耗热量

空调开机时长
diff --git a/src/views/sourceAnaly/components/conditionAnaly.vue b/src/views/sourceAnaly/components/conditionAnaly.vue index f1c8358..22da64e 100644 --- a/src/views/sourceAnaly/components/conditionAnaly.vue +++ b/src/views/sourceAnaly/components/conditionAnaly.vue @@ -152,7 +152,7 @@ class="total-source-table" :header-row-style="headerStyle" :row-style="rowStyle" - height="200" + height="240" v-loaddata="loadData" > { - this.closeData = res.data.data.records; - for (let i = 0; i < this.closeData.length; i++) { - this.closeData[i].date = this.closeData[i].startTime.substring(0, 10); - this.closeData[i].startTime = this.closeData[i].startTime.substring( + if(this.current > res.data.data.page || res.data.data.records.length == 0){ + return; + } + let _retData = res.data.data.records; + for (let i = 0; i < _retData.length; i++) { + _retData[i].date = _retData[i].createTime.substring(0, 10); + _retData[i].startTime = _retData[i].createTime.substring( 11, - 16 - ); - this.closeData[i].endTime = this.closeData[i].endTime.substring( + 13 + )+':00'; + _retData[i].endTime = _retData[i].createTime.substring( 11, - 16 - ); - this.closeData[i].location = - Number(this.closeData[i].buildNumber) + + 13 + )+':59'; + _retData[i].location = + Number(_retData[i].buildNumber) + "#" + - Number(this.closeData[i].floorNumber) + + Number(_retData[i].floorNumber) + "层"; } + this.closeData = this.closeData.concat(_retData); }); }, loadData() { this.current += 1; - getDailyList( - this.area, - this.value1[0], - this.value1[1], - this.current, - this.size - ).then((res) => { - if (this.current <= res.data.data.pages) { - const results = res.data.data.records; - results.forEach((item) => { - item.date = item.startTime.substring(0, 10); - item.startTime = item.startTime.substring(11, 16); - item.endTime = item.endTime.substring(11, 16); - item.location = - Number(item.buildNumber) + "#" + Number(item.floorNumber) + "层"; - this.closeData.push(item); - }); - } - }); + this.getConditionTableData(); + // getDailyList( + // this.area, + // this.value1[0], + // this.value1[1], + // this.current, + // this.size + // ).then((res) => { + // if (this.current <= res.data.data.pages) { + // const results = res.data.data.records; + // results.forEach((item) => { + // item.date = item.startTime.substring(0, 10); + // item.startTime = item.startTime.substring(11, 16); + // item.endTime = item.endTime.substring(11, 16); + // item.location = + // Number(item.buildNumber) + "#" + Number(item.floorNumber) + "层"; + // this.closeData.push(item); + // }); + // } + // }); }, searchCondition() { //废弃 20221022 @@ -619,7 +626,7 @@ export default { show: true, trigger: "item", formatter: function (params) { - console.info(params); + // console.info(params); let result = params.name + ":
"; // let result = params[0].name + ":
"; // for (let i = 0; i < params.length; i++) { @@ -1183,7 +1190,7 @@ export default { .total-source-table { background-color: transparent; width: 100%; - max-height: 10rem; + max-height: 12rem; overflow-y: auto; margin-top: 0.937rem; } diff --git a/src/views/sourceAnaly/components/consumeAnaly.vue b/src/views/sourceAnaly/components/consumeAnaly.vue index 105dca0..cc4ed03 100644 --- a/src/views/sourceAnaly/components/consumeAnaly.vue +++ b/src/views/sourceAnaly/components/consumeAnaly.vue @@ -14,7 +14,11 @@ v-loaddata="loadData"> - + + + diff --git a/vue.config.js b/vue.config.js index df512da..8314fb8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -26,6 +26,13 @@ module.exports = { devServer: { port: 1888, proxy: { + "/bimfaceApi": { + target: 'http://192.168.1.3:8088', + ws: true, + pathRewrite: { + "^/bimfaceApi": "/bimface", + }, + }, "/epiHome": { target: 'http://10.90.100.201:8116', ws: true, @@ -38,8 +45,8 @@ module.exports = { // target: 'http://180.76.231.175:8000', // target: 'http://192.168.0.105:80', // target: "http://192.168.43.35", - // target: 'http://192.168.1.106', - target: "http://192.168.1.3", + target: 'http://192.168.1.106', + // target: "http://192.168.1.3", // target: "http://10.90.100.204", // target: "http://rsvz4t.natappfree.cc", //远程演示服务地址,可用于直接启动项目