1 line
21 KiB
JSON
1 line
21 KiB
JSON
|
{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\websocket\\uwb.js","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\websocket\\uwb.js","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.array.includes\";\nimport \"core-js/modules/es6.string.includes\";\nimport \"core-js/modules/es6.regexp.to-string\";\nimport \"core-js/modules/web.dom.iterable\";\nexport default {\n data: function data() {\n return {\n uwbCount: 0,\n // socket连接次数计数\n keyArr: [\"1f\", \"2f\", \"3f\", \"4f\", \"5f\"],\n // Y\n series: [],\n // X\n total: 0,\n // 楼层总人数\n uwbLabelTypeList: {},\n // 后端返回的标签分类及每种类型的标签ID\n uwbLabel: {\n studentUwb: '学生',\n teacherUwb: '教师',\n // cleaningUwb: '后勤',\n // securityUwb: '安保',\n visitorUwb: '访客',\n // importantUwb: '重控设施',\n other: '其它'\n }\n };\n },\n created: function created() {\n var _this2 = this;\n\n this.uwbCount = 0;\n this.initUwbLabelType().then(function () {\n _this2.initUwbWebsocket();\n });\n },\n activated: function activated() {\n var _this3 = this;\n\n // 每隔 1分钟 请求最新标签type\n var timer = setInterval(function () {\n _this3.initUwbLabelType();\n }, 60 * 1000);\n this.$once(\"hook:beforeDestroy\", function () {\n clearInterval(timer);\n });\n this.$once(\"hook:deactivated\", function () {\n clearInterval(timer);\n });\n },\n methods: {\n initUwbLabelType: function initUwbLabelType() {\n var _this4 = this;\n\n return this.$http({\n url: \"/system/index/uwbLabelType\",\n method: \"get\"\n }).then(function (_ref) {\n var res = _ref.data;\n\n if (res.code != 0) {\n return _this4.$message.error(res.msg);\n }\n\n _this4.uwbLabelTypeList = res.data;\n });\n },\n initUwbWebsocket: function initUwbWebsocket() {\n var _this5 = this;\n\n var _this = this; // 尝试建立websocket连接\n\n\n try {\n var uwb_websockt = new WebSocket(window.GLOBAL_CONFIG.UWB_WEBSOCKET); // 监听socket连接\n\n uwb_websockt.onopen = function () {\n console.log(\"websocket连接成功\");\n var params = JSON.stringify({\n type: 1,\n map_id: \"14\"\n });\n uwb_websockt.send(params);\n };\n\n uwb_websockt.onclose = function () {\n console.log(\"websocket连接已关闭\");\n };\n\n uwb_websockt.onerror = function () {\n console.log(\"websocket连接失败\");\n };\n\n uwb_websockt.onmessage = function (res) {\n if (res.data != \"heartbeat\") {\n var data = JSON.parse(res.data); // let statics = {};\n // // 统计对应楼层人数\n // data.forEach(item => {\n // if (statics[item.floor]) {\n // statics[item.floor]++\n // } else {\n // statics[item.floor] = 1\n // }\n // });\n // this.keyArr = Object.keys(statics).sort()\n // let newXData = []\n // for (let i = 0; i < this.keyArr.length; i++) {\n // newXData.push(statics[this.keyArr[i]])\n // }\n // // 和上一次提送数据比较,如果相同,不渲染echarts\n // if (JSON.stringify(newXData) !== JSON.stringify(this.seriesData)) {\n // this.seriesData = newXData\n // this.tota
|