{"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\\system.js","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\websocket\\system.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.object.get-own-property-descriptors\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.regexp.split\";\nimport _defineProperty from \"C:\\\\Users\\\\27446\\\\Desktop\\\\up\\\\front\\\\dkha-web-sz-main\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nexport default {\n data: function data() {\n return {\n systemCount: 0,\n electricData: {},\n electricArr: [],\n // 电流预警\n thermaArr: [],\n // 管道预警\n temp: {\n pm: 0,\n temperature: 0,\n humidity: 0\n }\n };\n },\n created: function created() {\n this.systemCount = 0;\n this.initSystemWebsocket();\n },\n methods: {\n initSystemWebsocket: function initSystemWebsocket() {\n var _this2 = this;\n\n var _this = this; // 尝试建立websocket连接\n\n\n try {\n var environment_websockt = new WebSocket(window.GLOBAL_CONFIG['socketURL']); // 监听socket连接\n\n environment_websockt.onopen = function () {\n console.log(\"websocket连接成功\");\n };\n\n environment_websockt.onclose = function () {\n console.log(\"websocket连接已关闭\");\n };\n\n environment_websockt.onerror = function () {\n console.log(\"websocket连接失败\");\n };\n\n environment_websockt.onmessage = function (res) {\n var data = JSON.parse(res.data); // 环境传感器数据\n\n if (data.type == 1) {\n // 提交到Vuex\n _this.$store.commit('system/UPDATE_ENVIRONMENT_LIST', data.data.map(function (item) {\n if (item.mbdDevicesn == '20103') {\n _this2.temp = {\n pm: item.pm,\n temperature: item.temperature,\n humidity: item.humidity\n };\n }\n\n return _objectSpread({}, item, {\n coordinate: item.coordinate.split(\",\"),\n floorAddr: item.floorAddr.split(\",\")\n });\n })); // 存储到本地 避免刷新页面的时候 报警数据 消失\n // localStorage.setItem(\"shenzhen_school_environment_wangring\", JSON.stringify(data.data))\n\n } // 宿舍用电报警数据和宿舍管道预警数据\n else if (data.type == 2 || data.type == 4 && data.data.tfDevicetype < 4) {\n console.log(data.type);\n data.data.tfaEcurrent = (data.data.tfaEcurrent * 1).toFixed(2); // 将预警值保留两位小数\n // 当缓存没有值\n\n if (!localStorage.getItem(\"electricData\") && data.data.isAlarm) {\n _this.electricArr.unshift(data.data);\n\n localStorage.setItem(\"electricData\", JSON.stringify(_this.electricArr));\n } // 当缓存有值\n else {\n _this.electricArr = JSON.parse(localStorage.getItem(\"electricData\"));\n _this.electricArr = _this.electricArr.filter(function (item) {\n if (data.type == 4) {\n return item.IP != data.data.IP;\n } else {\n return item.drNum != data.data.drNum;\n }\n });\n\n if (data.data.isAlarm) {\n _this.electricArr.unshift(data.data);\n }\n\n if (_this.electricArr.length === 0) {\n localStorage.setItem(\"electricData\", JSON.stringify([]));\n } else {\n localStorage.setItem(\"electricData\", JSON.stringify(_this.electricArr));\n }\n }\n } // 大力热成像\n else if (data.type == 4 && data.data.tfDevicetype > 3) {\n data.data.tfaEcurrent = (data.data.tfaEcurrent * 1).toFixed(2); // 将预警值保留两位小数\n // 当缓存没有值\n\n if (!localStorage.getItem(\"thermaData\") && data.data.isAlarm) {\n _this.thermaArr.unshift(data.data);\n\n localStorage.setItem(\"thermaData\", JSON.stringify(_this.thermaArr));\n } // 当缓存有值\n else {\n _this.thermaArr = JSON.parse(localStorage.getItem(\"thermaData\"));\n _this.thermaArr = _this.thermaArr.filter(function (item) {\n return item.IP != data.data.IP;\n });\n\n if (data.data.isAlarm) {\n _this.thermaArr.unshift(data.data);\n }\n\n if (_this.thermaArr.length === 0) {\n localStorage.setItem(\"thermaData\", JSON.stringify([]));\n } else {\n localStorage.setItem(\"thermaData\", JSON.stringify(_this.thermaArr));\n }\n }\n }\n }; // 关闭webscoket连接\n\n\n _this.$once(\"hook:beforeDestroy\", function () {\n environment_websockt.close();\n }); // 关闭或刷新浏览器 结束websocket连接\n\n\n window.addEventListener(\"beforeunload\", function () {\n environment_websockt.close();\n });\n } catch (error) {\n console.error('链接websocket失败:', error);\n _this.systemCount++; // 失败建立连接 五次内失败 尝试重新连接\n\n if (_this.systemCount < 5) {\n _this.initSystemWebsocket();\n } else {\n _this.$confirm('建立websocket连接失败,环境传感器数据无法实时更新!是否重试?', '提示', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n type: 'warning'\n }).then(function () {\n _this.systemCount = 0;\n\n _this.initSystemWebsocket();\n }).catch(function () {});\n }\n }\n }\n }\n};",{"version":3,"sources":["C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\websocket\\system.js"],"names":["data","systemCount","electricData","electricArr","thermaArr","temp","pm","temperature","humidity","created","initSystemWebsocket","methods","_this","environment_websockt","WebSocket","window","GLOBAL_CONFIG","onopen","console","log","onclose","onerror","onmessage","res","JSON","parse","type","$store","commit","map","item","mbdDevicesn","coordinate","split","floorAddr","tfDevicetype","tfaEcurrent","toFixed","localStorage","getItem","isAlarm","unshift","setItem","stringify","filter","IP","drNum","length","$once","close","addEventListener","error","$confirm","confirmButtonText","cancelButtonText","then","catch"],"mappings":";;;;;;;;;;AAAA,eAAe;AACdA,EAAAA,IADc,kBACP;AACN,WAAO;AACNC,MAAAA,WAAW,EAAE,CADP;AAENC,MAAAA,YAAY,EAAE,EAFR;AAGNC,MAAAA,WAAW,EAAE,EAHP;AAGW;AACjBC,MAAAA,SAAS,EAAE,EAJL;AAIS;AACfC,MAAAA,IAAI,EAAC;AACJC,QAAAA,EAAE,EAAC,CADC;AAEJC,QAAAA,WAAW,EAAC,CAFR;AAGJC,QAAAA,QAAQ,EAAC;AAHL;AALC,KAAP;AAWA,GAba;AAcdC,EAAAA,OAdc,qBAcJ;AACT,SAAKR,WAAL,GAAmB,CAAnB;AACA,SAAKS,mBAAL;AACA,GAjBa;AAkBdC,EAAAA,OAAO,EAAE;AACRD,IAAAA,mBADQ,iCACc;AAAA;;AACrB,UAAIE,KAAK,GAAG,IAAZ,CADqB,CAErB;;;AACA,UAAI;AACH,YAAIC,oBAAoB,GAAG,IAAIC,SAAJ,CAAcC,MAAM,CAACC,aAAP,CAAqB,WAArB,CAAd,CAA3B,CADG,CAEH;;AACAH,QAAAA,oBAAoB,CAACI,MAArB,GAA8B,YAAM;AACnCC,UAAAA,OAAO,CAACC,GAAR,CAAY,eAAZ;AACA,SAFD;;AAGAN,QAAAA,oBAAoB,CAACO,OAArB,GAA+B,YAAM;AACpCF,UAAAA,OAAO,CAACC,GAAR,CAAY,gBAAZ;AACA,SAFD;;AAGAN,QAAAA,oBAAoB,CAACQ,OAArB,GAA+B,YAAM;AACpCH,UAAAA,OAAO,CAACC,GAAR,CAAY,eAAZ;AACA,SAFD;;AAGAN,QAAAA,oBAAoB,CAACS,SAArB,GAAiC,UAAAC,GAAG,EAAI;AACvC,cAAIvB,IAAI,GAAG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CAACmB,SAAL,CAAe/B,KAAK,CAACR,SAArB,CAAnC;AACA;AACD;AACD;AACD,SA5ED,CAZG,CA0FH;;;AACAQ,QAAAA,KAAK,CAACoC,KAAN,CAAY,oBAAZ,EAAkC,YAAM;AACvCnC,UAAAA,oBAAoB,CAACoC,KAArB;AACA,SAFD,EA3FG,CA8FH;;;AACAlC,QAAAA,MAAM,CAACmC,gBAAP,CAAwB,cAAxB,EAAwC,YAAM;AAC7CrC,UAAAA,oBAAoB,CAACoC,KAArB;AACA,SAFD;AAGA,OAlGD,CAkGE,OAAOE,KAAP,EAAc;AACfjC,QAAAA,OAAO,CAACiC,KAAR,CAAc,gBAAd,EAAgCA,KAAhC;AACAvC,QAAAA,KAAK,CAACX,WAAN,GAFe,CAGf;;AACA,YAAIW,KAAK,CAACX,WAAN,GAAoB,CAAxB,EAA2B;AAC1BW,UAAAA,KAAK,CAACF,mBAAN;AACA,SAFD,MAEO;AACNE,UAAAA,KAAK,CAACwC,QAAN,CAAe,qCAAf,EAAsD,IAAtD,EAA4D;AAC3DC,YAAAA,iBAAiB,EAAE,IADwC;AAE3DC,YAAAA,gBAAgB,EAAE,IAFyC;AAG3D5B,YAAAA,IAAI,EAAE;AAHqD,WAA5D,EAIG6B,IAJH,CAIQ,YAAM;AACb3C,YAAAA,KAAK,CAACX,WAAN,GAAoB,CAApB;;AACAW,YAAAA,KAAK,CAACF,mBAAN;AACA,WAPD,EAOG8C,KAPH,CAOS,YAAM,CAEd,CATD;AAUA;AACD;AACD;AAzHO;AAlBK,CAAf","sourcesContent":["export default {\n\tdata() {\n\t\treturn {\n\t\t\tsystemCount: 0,\n\t\t\telectricData: {},\n\t\t\telectricArr: [], // 电流预警\n\t\t\tthermaArr: [], // 管道预警\n\t\t\ttemp:{\n\t\t\t\tpm:0,\n\t\t\t\ttemperature:0,\n\t\t\t\thumidity:0,\n\t\t\t}\n\t\t}\n\t},\n\tcreated() {\n\t\tthis.systemCount = 0;\n\t\tthis.initSystemWebsocket()\n\t},\n\tmethods: {\n\t\tinitSystemWebsocket() {\n\t\t\tlet _this = this;\n\t\t\t// 尝试建立websocket连接\n\t\t\ttry {\n\t\t\t\tlet environment_websockt = new WebSocket(window.GLOBAL_CONFIG['socketURL']);\n\t\t\t\t// 监听socket连接\n\t\t\t\tenvironment_websockt.onopen = () => {\n\t\t\t\t\tconsole.log(\"websocket连接成功\");\n\t\t\t\t};\n\t\t\t\tenvironment_websockt.onclose = () => {\n\t\t\t\t\tconsole.log(\"websocket连接已关闭\");\n\t\t\t\t};\n\t\t\t\tenvironment_websockt.onerror = () => {\n\t\t\t\t\tconsole.log(\"websocket连接失败\");\n\t\t\t\t};\n\t\t\t\tenvironment_websockt.onmessage = res => {\n\t\t\t\t\tlet data = JSON.parse(res.data);\n\t\t\t\t\t// 环境传感器数据\n\t\t\t\t\tif (data.type == 1) {\n\t\t\t\t\t\t// 提交到Vuex\n\t\t\t\t\t\t_this.$store.commit('system/UPDATE_ENVIRONMENT_LIST', data.data.map(item => {\n\t\t\t\t\t\t\tif(item.mbdDevicesn == '20103'){\n\t\t\t\t\t\t\t\tthis.temp={\n\t\t\t\t\t\t\t\t\tpm:item.pm,\n\t\t\t\t\t\t\t\t\ttemperature:item.temperature,\n\t\t\t\t\t\t\t\t\thumidity:item.humidity\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\treturn {\n\t\t\t\t\t\t\t\t...item,\n\t\t\t\t\t\t\t\tcoordinate: item.coordinate.split(\",\"),\n\t\t\t\t\t\t\t\tfloorAddr: item.floorAddr.split(\",\"),\n\t\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\t// localStorage.setItem(\"shenzhen_school_environment_wangring\", JSON.stringify(data.data))\n\t\t\t\t\t}\n\t\t\t\t\t// 宿舍用电报警数据和宿舍管道预警数据\n\t\t\t\t\telse if (data.type == 2 || (data.type == 4 && data.data.tfDevicetype < 4)) {\n\t\t\t\t\t\tconsole.log(data.type)\n\t\t\t\t\t\tdata.data.tfaEcurrent = (data.data.tfaEcurrent * 1).toFixed(2) // 将预警值保留两位小数\n\t\t\t\t\t\t// 当缓存没有值\n\t\t\t\t\t\tif (!localStorage.getItem(\"electricData\") && data.data.isAlarm) {\n\t\t\t\t\t\t\t_this.electricArr.unshift(data.data)\n\t\t\t\t\t\t\tlocalStorage.setItem(\"electricData\", JSON.stringify(_this.electricArr))\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 当缓存有值\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t_this.electricArr = JSON.parse(localStorage.getItem(\"electricData\"))\n\t\t\t\t\t\t\t_this.electricArr = _this.electricArr.filter(item => {\n\t\t\t\t\t\t\t\tif (data.type == 4) {\n\t\t\t\t\t\t\t\t\treturn item.IP != data.data.IP\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\treturn item.drNum != data.data.drNum\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tif (data.data.isAlarm) {\n\t\t\t\t\t\t\t\t_this.electricArr.unshift(data.data)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (_this.electricArr.length === 0) {\n\t\t\t\t\t\t\t\tlocalStorage.setItem(\"electricData\", JSON.stringify([]))\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tlocalStorage.setItem(\"electricData\", JSON.stringify(_this.electricArr))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// 大力热成像\n\t\t\t\t\telse if (data.type == 4 && data.data.tfDevicetype > 3) {\n\t\t\t\t\t\tdata.data.tfaEcurrent = (data.data.tfaEcurrent * 1).toFixed(2) // 将预警值保留两位小数\n\t\t\t\t\t\t// 当缓存没有值\n\t\t\t\t\t\tif (!localStorage.getItem(\"thermaData\") && data.data.isAlarm) {\n\t\t\t\t\t\t\t_this.thermaArr.unshift(data.data)\n\t\t\t\t\t\t\tlocalStorage.setItem(\"thermaData\", JSON.stringify(_this.thermaArr))\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 当缓存有值\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t_this.thermaArr = JSON.parse(localStorage.getItem(\"thermaData\"))\n\t\t\t\t\t\t\t_this.thermaArr = _this.thermaArr.filter(item => {\n\t\t\t\t\t\t\t\treturn item.IP != data.data.IP\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tif (data.data.isAlarm) {\n\t\t\t\t\t\t\t\t_this.thermaArr.unshift(data.data)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (_this.thermaArr.length === 0) {\n\t\t\t\t\t\t\t\tlocalStorage.setItem(\"thermaData\", JSON.stringify([]))\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tlocalStorage.setItem(\"thermaData\", JSON.stringify(_this.thermaArr))\n\t\t\t\t\t\t\t}\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\tenvironment_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\tenvironment_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.systemCount++;\n\t\t\t\t// 失败建立连接 五次内失败 尝试重新连接\n\t\t\t\tif (_this.systemCount < 5) {\n\t\t\t\t\t_this.initSystemWebsocket();\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.systemCount = 0;\n\t\t\t\t\t\t_this.initSystemWebsocket();\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"]}]}