management/front/dkha-web-sz-main/node_modules/.cache/babel-loader/4d88ad329c5b24549ee81aa341a...

1 line
21 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{"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.total = this.seriesData.reduce(function(prev, curr, idx, arr) {\n // return prev + curr;\n // });\n // this.draw()\n // };\n // 人数分类分楼层统计\n\n var temList = _this5.uwbLabelTypeList;\n var typeList = {\n studentUwb: [],\n teacherUwb: [],\n // cleaningUwb: [],\n // securityUwb: [],\n visitorUwb: [],\n // importantUwb: [],\n other: []\n }; // 先分类\n // for (var key in typeList) {\n // typeList[key] = data.filter(item => {\n // return temList[key].includes(item.tid.toString())\n // })\n // }\n //先分类\n\n data.forEach(function (item) {\n var uwbId = item.tid.toString(); // 学生\n\n if (temList.studentUwb.includes(uwbId)) {\n typeList.studentUwb.push(item);\n } // 教师\n else if (temList.teacherUwb.includes(uwbId)) {\n typeList.teacherUwb.push(item);\n } // 访客\n else if (temList.visitorUwb.includes(uwbId)) {\n typeList.visitorUwb.push(item);\n } // 其它 供调试使用\n else {\n typeList.other.push(item);\n }\n });\n var series = []; // 再按照分类 统计不同楼层人数\n\n var _loop = function _loop(key) {\n var temp = {};\n typeList[key].forEach(function (item) {\n if (temp[item.floor]) {\n temp[item.floor]++;\n } else {\n temp[item.floor] = 1;\n }\n }); // 获取楼层排序后的键值\n\n var keyArr = _this5.keyArr; // 序列化后的 楼层统计人数\n\n var newXData = [];\n\n for (var i = 0; i < keyArr.length; i++) {\n newXData.push(temp[keyArr[i]] || '');\n } // floors[key] = newXData;\n\n\n series.push({\n name: _this5.uwbLabel[key],\n type: 'bar',\n stack: '总人数',\n barMaxWidth: 20,\n barMinHeight: 20,\n label: {\n show: true,\n position: 'inside'\n },\n data: newXData\n });\n };\n\n for (var key in typeList) {\n _loop(key);\n } // 和上一次提送数据比较如果相同不渲染echarts\n\n\n if (JSON.stringify(_this5.series) != JSON.stringify(series)) {\n _this5.series = series;\n\n _this5.draw();\n }\n }\n }; // 销毁时关闭webscoket\n\n\n _this.$once(\"hook:beforeDestroy\", function () {\n uwb_websockt.close();\n }); // 切换页面时关闭websocket\n\n\n _this.$once(\"hook:deactivated\", function () {\n uwb_websockt.close();\n }); // 关闭或刷新浏览器 结束websocket连接\n\n\n window.addEventListener(\"beforeunload\", function () {\n uwb_websockt.close();\n });\n } catch (error) {\n console.error('链接websocket失败', error);\n _this.uwbCount++; // 失败建立连接 五次内失败 尝试重新连接\n\n if (_this.uwbCount < 5) {\n _this.initUwbWebsocket();\n } else {\n _this.$confirm('建立websocket连接失败无法实时获取楼层人数是否重试?', '提示', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n type: 'warning'\n }).then(function () {\n _this.uwbCount = 0;\n\n _this.initUwbWebsocket();\n }).catch(function () {});\n }\n }\n }\n }\n};",{"version":3,"sources":["C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\websocket\\uwb.js"],"names":["data","uwbCount","keyArr","series","total","uwbLabelTypeList","uwbLabel","studentUwb","teacherUwb","visitorUwb","other","created","initUwbLabelType","then","initUwbWebsocket","activated","timer","setInterval","$once","clearInterval","methods","$http","url","method","res","code","$message","error","msg","_this","uwb_websockt","WebSocket","window","GLOBAL_CONFIG","UWB_WEBSOCKET","onopen","console","log","params","JSON","stringify","type","map_id","send","onclose","onerror","onmessage","parse","temList","typeList","forEach","item","uwbId","tid","toString","includes","push","key","temp","floor","newXData","i","length","name","stack","barMaxWidth","barMinHeight","label","show","position","draw","close","addEventListener","$confirm","confirmButtonText","cancelButtonText","catch"],"mappings":";;;;AAAA,eAAe;AACdA,EAAAA,IADc,kBACP;AACN,WAAO;AACNC,MAAAA,QAAQ,EAAE,CADJ;AACO;AACbC,MAAAA,MAAM,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAFF;AAEkC;AACxCC,MAAAA,MAAM,EAAE,EAHF;AAGM;AACZC,MAAAA,KAAK,EAAE,CAJD;AAII;AACVC,MAAAA,gBAAgB,EAAE,EALZ;AAKgB;AACtBC,MAAAA,QAAQ,EAAE;AACTC,QAAAA,UAAU,EAAE,IADH;AAETC,QAAAA,UAAU,EAAE,IAFH;AAGT;AACA;AACAC,QAAAA,UAAU,EAAE,IALH;AAMT;AACAC,QAAAA,KAAK,EAAE;AAPE;AANJ,KAAP;AAgBA,GAlBa;AAmBdC,EAAAA,OAnBc,qBAmBJ;AAAA;;AACT,SAAKV,QAAL,GAAgB,CAAhB;AACA,SAAKW,gBAAL,GAAwBC,IAAxB,CAA6B,YAAM;AAClC,MAAA,MAAI,CAACC,g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ACf,gBAAN;AACA,SAFD,MAEO;AACNe,UAAAA,KAAK,CAAC4C,QAAN,CAAe,kCAAf,EAAmD,IAAnD,EAAyD;AACxDC,YAAAA,iBAAiB,EAAE,IADqC;AAExDC,YAAAA,gBAAgB,EAAE,IAFsC;AAGxDlC,YAAAA,IAAI,EAAE;AAHkD,WAAzD,EAIG5B,IAJH,CAIQ,YAAM;AACbgB,YAAAA,KAAK,CAAC5B,QAAN,GAAiB,CAAjB;;AACA4B,YAAAA,KAAK,CAACf,gBAAN;AACA,WAPD,EAOG8D,KAPH,CAOS,YAAM,CAEd,CATD;AAUA;AACD;AACD;AAvKO;AArCK,CAAf","sourcesContent":["export default {\n\tdata() {\n\t\treturn {\n\t\t\tuwbCount: 0, // socket连接次数计数\n\t\t\tkeyArr: [\"1f\", \"2f\", \"3f\", \"4f\", \"5f\"], // Y\n\t\t\tseries: [], // X\n\t\t\ttotal: 0, // 楼层总人数\n\t\t\tuwbLabelTypeList: {}, // 后端返回的标签分类及每种类型的标签ID\n\t\t\tuwbLabel: {\n\t\t\t\tstudentUwb: '学生',\n\t\t\t\tteacherUwb: '教师',\n\t\t\t\t// cleaningUwb: '后勤',\n\t\t\t\t// securityUwb: '安保',\n\t\t\t\tvisitorUwb: '访客',\n\t\t\t\t// importantUwb: '重控设施',\n\t\t\t\tother: '其它'\n\t\t\t}\n\t\t}\n\t},\n\tcreated() {\n\t\tthis.uwbCount = 0;\n\t\tthis.initUwbLabelType().then(() => {\n\t\t\tthis.initUwbWebsocket();\n\t\t});\n\t},\n\tactivated() {\n\t\t// 每隔 1分钟 请求最新标签type\n\t\tlet timer = setInterval(() => {\n\t\t\tthis.initUwbLabelType();\n\t\t}, 60 * 1000);\n\t\tthis.$once(\"hook:beforeDestroy\", () => {\n\t\t\tclearInterval(timer)\n\t\t})\n\t\tthis.$once(\"hook:deactivated\", () => {\n\t\t\tclearInterval(timer)\n\t\t})\n\t},\n\tmethods: {\n\t\tinitUwbLabelType() {\n\t\t\treturn this.$http({\n\t\t\t\turl: \"/system/index/uwbLabelType\",\n\t\t\t\tmethod: \"get\"\n\t\t\t}).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code != 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.uwbLabelTypeList = res.data;\n\t\t\t})\n\t\t},\n\t\tinitUwbWebsocket() {\n\t\t\tlet _this = this;\n\t\t\t// 尝试建立websocket连接\n\t\t\ttry {\n\t\t\t\tlet uwb_websockt = new WebSocket(window.GLOBAL_CONFIG.UWB_WEBSOCKET);\n\t\t\t\t// 监听socket连接\n\t\t\t\tuwb_websockt.onopen = () => {\n\t\t\t\t\tconsole.log(\"websocket连接成功\");\n\t\t\t\t\tlet params = JSON.stringify({\n\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\tmap_id: \"14\",\n\t\t\t\t\t})\n\t\t\t\t\tuwb_websockt.send(params)\n\t\t\t\t};\n\t\t\t\tuwb_websockt.onclose = () => {\n\t\t\t\t\tconsole.log(\"websocket连接已关闭\");\n\t\t\t\t};\n\t\t\t\tuwb_websockt.onerror = () => {\n\t\t\t\t\tconsole.log(\"websocket连接失败\");\n\t\t\t\t};\n\t\t\t\tuwb_websockt.onmessage = res => {\n\t\t\t\t\tif (res.data != \"heartbeat\") {\n\t\t\t\t\t\tlet data = JSON.parse(res.data)\n\t\t\t\t\t\t// let statics = {};\n\t\t\t\t\t\t// // 统计对应楼层人数\n\t\t\t\t\t\t// data.forEach(item => {\n\t\t\t\t\t\t// if (statics[item.floor]) {\n\t\t\t\t\t\t// statics[item.floor]++\n\t\t\t\t\t\t// } else {\n\t\t\t\t\t\t// statics[item.floor] = 1\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t// });\n\t\t\t\t\t\t// this.keyArr = Object.keys(statics).sort()\n\t\t\t\t\t\t// let newXData = []\n\t\t\t\t\t\t// for (let i = 0; i < this.keyArr.length; i++) {\n\t\t\t\t\t\t// newXData.push(statics[this.keyArr[i]])\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t// // 和上一次提送数据比较如果相同不渲染echarts\n\t\t\t\t\t\t// if (JSON.stringify(newXData) !== JSON.stringify(this.seriesData)) {\n\t\t\t\t\t\t// this.seriesData = newXData\n\t\t\t\t\t\t// this.total = this.seriesData.reduce(function(prev, curr, idx, arr) {\n\t\t\t\t\t\t// return prev + curr;\n\t\t\t\t\t\t// });\n\t\t\t\t\t\t// this.draw()\n\t\t\t\t\t\t// };\n\t\t\t\t\t\t// 人数分类分楼层统计\n\t\t\t\t\t\tlet temList = this.uwbLabelTypeList;\n\t\t\t\t\t\tlet typeList = {\n\t\t\t\t\t\t\tstudentUwb: [],\n\t\t\t\t\t\t\tteacherUwb: [],\n\t\t\t\t\t\t\t// cleaningUwb: [],\n\t\t\t\t\t\t\t// securityUwb: [],\n\t\t\t\t\t\t\tvisitorUwb: [],\n\t\t\t\t\t\t\t// importantUwb: [],\n\t\t\t\t\t\t\tother: []\n\t\t\t\t\t\t};\n\t\t\t\t\t\t// 先分类\n\t\t\t\t\t\t// for (var key in typeList) {\n\t\t\t\t\t\t// typeList[key] = data.filter(item => {\n\t\t\t\t\t\t// return temList[key].includes(item.tid.toString())\n\t\t\t\t\t\t// })\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t//先分类\n\t\t\t\t\t\tdata.forEach(item => {\n\t\t\t\t\t\t\tlet uwbId = item.tid.toString();\n\t\t\t\t\t\t\t// 学生\n\t\t\t\t\t\t\tif (temList.studentUwb.includes(uwbId)) {\n\t\t\t\t\t\t\t\ttypeList.studentUwb.push(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// 教师\n\t\t\t\t\t\t\telse if (temList.teacherUwb.includes(uwbId)) {\n\t\t\t\t\t\t\t\ttypeList.teacherUwb.push(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// 访客\n\t\t\t\t\t\t\telse if (temList.visitorUwb.includes(uwbId)) {\n\t\t\t\t\t\t\t\ttypeList.visitorUwb.push(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// 其它 供调试使用\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\ttypeList.other.push(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\tlet series = [];\n\t\t\t\t\t\t// 再按照分类 统计不同楼层人数\n\t\t\t\t\t\tfor (let key in typeList) {\n\t\t\t\t\t\t\tlet temp = {};\n\t\t\t\t\t\t\ttypeList[key].forEach(item => {\n\t\t\t\t\t\t\t\tif (temp[item.floor]) {\n\t\t\t\t\t\t\t\t\ttemp[item.floor]++\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttemp[item.floor] = 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t// 获取楼层排序后的键值\n\t\t\t\t\t\t\tlet keyArr = this.keyArr;\n\t\t\t\t\t\t\t// 序列化后的 楼层统计人数\n\t\t\t\t\t\t\tlet newXData = []\n\t\t\t\t\t\t\tfor (let i = 0; i < keyArr.length; i++) {\n\t\t\t\t\t\t\t\tnewXData.push(temp[keyArr[i]] || '')\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// floors[key] = newXData;\n\t\t\t\t\t\t\tseries.push({\n\t\t\t\t\t\t\t\tname: this.uwbLabel[key],\n\t\t\t\t\t\t\t\ttype: 'bar',\n\t\t\t\t\t\t\t\tstack: '总人数',\n\t\t\t\t\t\t\t\tbarMaxWidth: 20,\n\t\t\t\t\t\t\t\tbarMinHeight: 20,\n\t\t\t\t\t\t\t\tlabel: {\n\t\t\t\t\t\t\t\t\tshow: true,\n\t\t\t\t\t\t\t\t\tposition: 'inside'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdata: newXData\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 和上一次提送数据比较如果相同不渲染echarts\n\t\t\t\t\t\tif (JSON.stringify(this.series) != JSON.stringify(series)) {\n\t\t\t\t\t\t\tthis.series = series;\n\t\t\t\t\t\t\tthis.draw();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// 销毁时关闭webscoket\n\t\t\t\t_this.$once(\"hook:beforeDestroy\", () => {\n\t\t\t\t\tuwb_websockt.close();\n\t\t\t\t});\n\t\t\t\t// 切换页面时关闭websocket\n\t\t\t\t_this.$once(\"hook:deactivated\", () => {\n\t\t\t\t\tuwb_websockt.close();\n\t\t\t\t});\n\t\t\t\t// 关闭或刷新浏览器 结束websocket连接\n\t\t\t\twindow.addEventListener(\"beforeunload\", () => {\n\t\t\t\t\tuwb_websockt.close();\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('链接websocket失败', error);\n\t\t\t\t_this.uwbCount++;\n\t\t\t\t// 失败建立连接 五次内失败 尝试重新连接\n\t\t\t\tif (_this.uwbCount < 5) {\n\t\t\t\t\t_this.initUwbWebsocket();\n\t\t\t\t} else {\n\t\t\t\t\t_this.$confirm('建立websocket连接失败无法实时获取楼层人数是否重试?', '提示', {\n\t\t\t\t\t\tconfirmButtonText: '确定',\n\t\t\t\t\t\tcancelButtonText: '取消',\n\t\t\t\t\t\ttype: 'warning'\n\t\t\t\t\t}).then(() => {\n\t\t\t\t\t\t_this.uwbCount = 0;\n\t\t\t\t\t\t_this.initUwbWebsocket();\n\t\t\t\t\t}).catch(() => {\n\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n}\n"]}]}