newEvacuationBigDataHome.vue 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586
  1. <template>
  2. <div class="newEvacuationBigDataHome" ref="maxBox">
  3. <newEvacuationBigDataSubPageKYDXNH v-if="versionField() === 'kuangYeDaXue_nanHu'"></newEvacuationBigDataSubPageKYDXNH>
  4. <newEvacuationBigDataSubPagePublic v-else></newEvacuationBigDataSubPagePublic>
  5. <div class="evacuation-out-button-position-box">
  6. <i class="el-icon-switch-button"></i>
  7. <p @click="goRoute">{{routeType?'退出全屏':'全屏'}}</p>
  8. </div>
  9. <div class="left-max-big-box">
  10. <div class="left-top-big-box">
  11. <div class="big-title-box">
  12. <img src="@/assets/ZDimages/bigData3_2/icon_znjc_tb.png">
  13. <p>智能监测</p>
  14. </div>
  15. <div class="left-top-for-big-box scrollbar-box">
  16. <div class="left-top-for-box" v-for="(item,index) in lotStaticList" :key="index">
  17. <p>{{item.sensorTotal}}</p>
  18. <p>{{item.sensorName}}</p>
  19. <img v-if="item.sensorType == 1" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_zcbg.png">
  20. <img v-if="item.sensorType == 2" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_hyjc.png">
  21. <img v-if="item.sensorType == 3" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_qtjc.png">
  22. <img v-if="item.sensorType == 4" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_wsd.png">
  23. <img v-if="item.sensorType == 5" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_wsd(1).png">
  24. <img v-if="item.sensorType == 6" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_fcjc.png">
  25. <img v-if="item.sensorType == 7" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_znjk.png">
  26. <img v-if="item.sensorType == 8" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_znmj.png">
  27. <img v-if="item.sensorType == 9" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_ytj.png">
  28. <img v-if="item.sensorType == 10" src="@/assets/ZDimages/bigData3_2/home/icon_dqkz.png">
  29. <img v-if="item.sensorType == 11" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_zntf.png">
  30. <img v-if="item.sensorType == 12" src="@/assets/ZDimages/bigData3_2/home/img_zdmh_znmh.png">
  31. <img src="@/assets/ZDimages/bigData3_2/home/icon_znjc_bg.png">
  32. </div>
  33. </div>
  34. <p class="hazardSum-p" v-if="lotStaticSum">总数:{{lotStaticSum}}</p>
  35. </div>
  36. <div class="left-bottom-big-box">
  37. <div class="big-title-box">
  38. <img src="@/assets/ZDimages/bigData3_2/icon_znjc_tb.png">
  39. <p>危险源</p>
  40. </div>
  41. <div id="eCharts"></div>
  42. <p class="hazardSum-p" v-if="hazardSum">总数:{{hazardSum}}</p>
  43. <p class="eCharts-null-p" v-if="!eChartsData.nameList[0]">暂无数据</p>
  44. </div>
  45. </div>
  46. <div class="center-max-big-box">
  47. <div class="top-button-box">
  48. <div class="top-button-left-select-box">
  49. <el-select v-model="buildingId" placeholder="请选择"
  50. :popper-append-to-body="false"
  51. @change="buildingChange"
  52. class="building-select-box">
  53. <el-option
  54. v-for="item in buildingOptions"
  55. :key="item.id"
  56. :label="item.name"
  57. :value="item.id">
  58. </el-option>
  59. </el-select>
  60. </div>
  61. <div class="top-button-right-num-box">
  62. </div>
  63. </div>
  64. <div id="container" ref="container" @mousedown="getMouseXY($event)">
  65. </div>
  66. <div class="position-floor-user-box">
  67. <img src="@/assets/ZDimages/bigData3_2/icon_zhpt_rs.png">
  68. <p>实时人数:</p>
  69. <p>{{userNum}}人</p>
  70. </div>
  71. <div class="position-floor-button-box" v-if="mapList[0]">
  72. <p class="position-floor-for-button-p" :class="item.checkType?'check-button-box':''"
  73. @click="dataDispose(item.index)"
  74. v-for="(item,index) in maxMapButtonList" :key="index">
  75. {{item.indexName}}
  76. </p>
  77. </div>
  78. </div>
  79. <div class="right-max-big-box scrollbar-box">
  80. <p class="null-p" v-if="!monitorNumList[0]">暂无数据</p>
  81. <div class="monitor-max-for-box" v-for="(item,index) in monitorNumList" :key="index">
  82. <div class="monitor-title-box">
  83. <p>{{item.name}}</p>
  84. <i :class="index == monitorType?'el-icon-arrow-up':'el-icon-arrow-down'" @click="getMonitorUrl(index)"></i>
  85. </div>
  86. <div class="video-mx-big-box" v-show="index == monitorType"
  87. v-for="(videoItem,videoIndex) in item.hardwareList" :key="videoIndex">
  88. <video class="video-box" :id="videoItem" ref="videoRef" :poster="videoCover"
  89. autoplay controls muted width="366px" height="210px"></video>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. import mqtt from 'mqtt'
  97. import flvjs from 'flv.js'
  98. import { subjectInfo,startUrl } from "@/api/laboratory/subject";
  99. import { getBuildOrFloorList,exitHazardTotalByBuildId,getLotStatis,
  100. getBuildOrFloorDetailList,getBuildOrFloorInfo,selectTriggerInfo } from '@/api/evacuationBigData/index.js'
  101. import * as Three from 'three'
  102. import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
  103. import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
  104. import { mergeBufferGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils'
  105. import { SceneUtils } from 'three/examples/jsm/utils/SceneUtils.js'
  106. import newEvacuationBigDataSubPageKYDXNH from './differenceComponent/newEvacuationBigDataSubPageKYDXNH.vue'
  107. import newEvacuationBigDataSubPagePublic from './differenceComponent/newEvacuationBigDataSubPagePublic.vue'
  108. export default {
  109. name: 'newEvacuationBigDataHome',
  110. components: {
  111. newEvacuationBigDataSubPageKYDXNH,
  112. newEvacuationBigDataSubPagePublic,
  113. },
  114. computed:{
  115. Obj(){
  116. return this.$store.state.settings.planData
  117. }
  118. },
  119. watch:{
  120. Obj(newVal,oldVal){
  121. //可以对数据执行相应的操作
  122. console.log(newVal,oldVal)
  123. this.selectTriggerInfo();
  124. }
  125. },
  126. data() {
  127. return {
  128. videoCover:window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/admin/" + localStorage.getItem('videoCover'),
  129. //当前路由状态
  130. routeType:false,
  131. containerType:false,
  132. buttonIndex:null,
  133. mapData:[{"x":1,"y":160,"w":797,"h":100,"type":"2","lightList":[{"type":"light","state":"4","w":40,"h":40,"x":520,"y":30,"relayType":2,"configName":"2","configStatus":"2","key":"light0","openType":false},{"type":"light","state":"3","w":40,"h":40,"x":266,"y":30,"relayType":2,"configName":"1","configStatus":"1","key":"light1","openType":false}],"key":"corridor0"},{"x":1,"y":1,"w":398,"h":159,"type":"1","doorList":[{"type":"door","toward":"bottom","w":34,"h":34,"x":193,"y":123}],"roomType":1,"roomNum":"1-1","roomName":null,"subId":160,"subName":"管理员测试实验室1","key":"lab0","id":486,"buildId":48,"floorId":49,"online":0,"loginAdmin":true,"planType":false},{"x":399,"y":1,"w":398,"h":159,"type":"1","doorList":[{"type":"door","toward":"bottom","w":34,"h":34,"x":181,"y":123}],"roomType":-99,"roomNum":"1-2","roomName":"其他房间","subId":-1,"subName":null,"key":"lab1","id":487,"buildId":48,"floorId":49,"online":null,"loginAdmin":false,"planType":false},{"x":1,"y":260,"w":301,"h":139,"type":"1","doorList":[{"type":"door","toward":"top","w":34,"h":34,"x":131,"y":2}],"roomType":-99,"roomNum":"1-3","roomName":"其他房间","subId":-1,"subName":null,"key":"lab2","id":488,"buildId":48,"floorId":49,"online":null,"loginAdmin":false,"planType":false},{"x":302,"y":260,"w":316,"h":139,"type":"1","doorList":[{"type":"door","toward":"top","w":34,"h":34,"x":153,"y":2}],"roomType":-99,"roomNum":"1-4","roomName":"其他房间","subId":-1,"subName":null,"key":"lab3","id":489,"buildId":48,"floorId":49,"online":null,"loginAdmin":false,"planType":false},{"x":618,"y":260,"w":181,"h":139,"type":"3","doorList":[{"type":"door","toward":"top","w":34,"h":34,"x":80,"y":2}],"key":"escape0","roomCheckType":false}],
  134. maxMapButtonList:[],
  135. maxMapList:[],
  136. mapList:[],
  137. // 地基数据
  138. foundation:{
  139. bgColor:'#999',
  140. bgOpacity:1,
  141. x:null,//镜头位置
  142. y:null,//镜头位置
  143. spacing:300,
  144. visualDistance:null,
  145. planColor:'#f15b6c'
  146. },
  147. //数据类型1.实验室
  148. roomData_1:{
  149. bgColor:'#2a5caa',
  150. bgOpacity:0.4,
  151. },
  152. //数据类型 2.走廊
  153. roomData_2:{
  154. bgColor:'#84bf96',
  155. bgOpacity:1,
  156. },
  157. //数据类型 3.逃生通道
  158. roomData_3:{
  159. bgColor:'#007d65',
  160. bgOpacity:0.4,
  161. },
  162. //dom
  163. container:null,
  164. //场景
  165. scene: null,
  166. camera:null,
  167. controls:null,
  168. renderer:null,
  169. //楼栋数据
  170. buildingId:null,
  171. buildingOptions:[],
  172. //楼栋下传感器数据
  173. lotStaticSum:null,
  174. lotStaticList:[],
  175. //楼栋下危险源数量
  176. hazardSum:null,
  177. //实时人数
  178. userNum:null,
  179. //eCharts
  180. eChartsData:{
  181. nameList: [],
  182. numList: [],
  183. maxNumList: [],
  184. },
  185. //mqtt
  186. //全局MQTT相关
  187. allClient:{},
  188. planTopic:"lab/newexit/line",//预案
  189. //楼栋MQTT相关
  190. buildingClient:{},
  191. userTopic:"lab/horn",//消息
  192. //摄像头数据
  193. monitorNumList:[],
  194. monitorType:null,
  195. videoList:[],
  196. videoPlayList:[],
  197. //动画数据
  198. animateData:null,
  199. }
  200. },
  201. created() {
  202. if(this.$route.path == '/newEvacuationBigData'){
  203. this.$set(this,'routeType',true);
  204. }else{
  205. this.$set(this,'routeType',false);
  206. }
  207. },
  208. mounted(){
  209. // this.offAllMQTT('on');
  210. //获取楼栋数据
  211. this.getBuilding();
  212. },
  213. methods: {
  214. //数据处理
  215. dataDispose(num){
  216. let self = this;
  217. if(this.maxMapList[num]){
  218. let list = [];
  219. let index = 0;
  220. if(num == self.maxMapList.length-1){
  221. index = 0
  222. }else if(num-2<=0 && num+2>=(self.maxMapList.length-1)){
  223. index = 0;
  224. }else if (num > (self.maxMapList.length-6) && (num-2) > 0){
  225. if(num + 2 > (self.maxMapList.length-1)){
  226. index = self.maxMapList.length-5;
  227. }else{
  228. index = num - 2;
  229. }
  230. }else{
  231. if(num - 2 > 0){
  232. index = num - 2;
  233. }else{
  234. index = 0;
  235. }
  236. }
  237. let pushNum = 0
  238. for (let i=0 ;i < self.maxMapList.length;i++){
  239. if(index == i && pushNum < 5){
  240. list.push(self.maxMapList[i])
  241. self.maxMapList[i].checkType = true;
  242. pushNum ++
  243. index ++
  244. }else{
  245. self.maxMapList[i].checkType = false;
  246. }
  247. }
  248. this.$set(this,'mapList',list);
  249. if(this.mapList[0]){
  250. let newList = [];
  251. for(let i=0;i<self.maxMapList.length;i++){
  252. let obj = JSON.parse(JSON.stringify(self.maxMapList[i]))
  253. obj.index = i;
  254. newList.unshift(obj);
  255. }
  256. this.$set(this,'maxMapButtonList',newList);
  257. this.$set(this,'buttonIndex',num);
  258. this.selectTriggerInfo();
  259. }
  260. }
  261. },
  262. //初始化
  263. initAdd(){
  264. let self = this;
  265. let maxWidth = 0;
  266. let maxHeight = 0;
  267. let minWidth = 0;
  268. let minHeight = 0;
  269. //数据初始化
  270. for(let i=0;i<self.mapList.length;i++){
  271. self.mapList[i].maxWidth = 0;
  272. self.mapList[i].maxHeight = 0;
  273. for(let o=0;o<self.mapList[i].relationalData.length;o++){
  274. if ((self.mapList[i].relationalData[o].x + self.mapList[i].relationalData[o].w) > self.mapList[i].maxWidth) {
  275. self.mapList[i].maxWidth = self.mapList[i].relationalData[o].x + self.mapList[i].relationalData[o].w
  276. }
  277. if ((self.mapList[i].relationalData[o].y + self.mapList[i].relationalData[o].h) > self.mapList[i].maxHeight) {
  278. self.mapList[i].maxHeight = self.mapList[i].relationalData[o].y + self.mapList[i].relationalData[o].h
  279. }
  280. }
  281. //找出最大高度
  282. if(self.mapList[i].maxHeight > maxHeight){
  283. maxHeight = self.mapList[i].maxHeight;
  284. }
  285. //找出最大宽度
  286. if(self.mapList[i].maxWidth > maxWidth){
  287. maxWidth = self.mapList[i].maxWidth;
  288. }
  289. //找出最小高度
  290. if(minHeight == 0){
  291. minHeight = self.mapList[i].maxHeight;
  292. }else if(self.mapList[i].maxHeight < minHeight){
  293. minHeight = self.mapList[i].maxHeight;
  294. }
  295. //找出最小宽度
  296. if(minWidth == 0){
  297. minWidth = self.mapList[i].maxWidth;
  298. }else if(self.mapList[i].maxWidth < minWidth){
  299. minWidth = self.mapList[i].maxWidth;
  300. }
  301. }
  302. this.$set(this.foundation,'x',maxHeight);
  303. this.$set(this.foundation,'y',maxWidth);
  304. //根据楼层宽度或高度来设定每层之间的间距
  305. // this.$set(this.foundation,'spacing',minWidth>minHeight?minHeight:minWidth);
  306. if(maxWidth>maxHeight){
  307. if(maxWidth>1120){
  308. maxWidth/1120
  309. }else{
  310. }
  311. }else{
  312. if(maxHeight>1120){
  313. }else{
  314. }
  315. }
  316. this.$set(this.foundation,'spacing',maxWidth>maxHeight?maxHeight*0.6:maxWidth*0.6);
  317. this.$set(this.foundation,'visualDistance',maxWidth>maxHeight?maxWidth:maxHeight);
  318. /*
  319. * 创建场景对象Scene
  320. */
  321. // this.scene = new Three.Scene()
  322. //创建层数据
  323. let maxList = [];
  324. for(let i=0;i<self.mapList.length;i++){
  325. /*
  326. * 创建楼层地基
  327. */
  328. let geometryList = [];
  329. let materialList = [];
  330. let geometry = new Three.BoxGeometry(self.mapList[i].maxWidth, 4, self.mapList[i].maxHeight);
  331. //位置偏移
  332. geometry.translate((self.mapList[i].maxWidth/2)-self.mapList[i].maxWidth/2,
  333. (i*self.foundation.spacing),
  334. (self.mapList[i].maxHeight/2)-self.mapList[i].maxHeight/2)
  335. //材质
  336. let material = new Three.MeshLambertMaterial()
  337. //透明度开启关闭
  338. material.transparent = true;
  339. //透明度
  340. material.opacity = self.foundation.bgOpacity;
  341. material.emissive.setStyle(self.foundation.bgColor);
  342. //添加
  343. geometryList.push(geometry)
  344. materialList.push(material)
  345. /*
  346. * 创建楼层房间
  347. */
  348. for(let o=0;o<self.mapList[i].relationalData.length;o++){
  349. let geometry = new Three.BoxGeometry(self.mapList[i].relationalData[o].w, self.mapList[i].relationalData[o].type == 2?4:1, self.mapList[i].relationalData[o].h);
  350. //位置偏移
  351. geometry.translate((self.mapList[i].relationalData[o].x+(self.mapList[i].relationalData[o].w/2))-self.mapList[i].maxWidth/2,
  352. ((i*self.foundation.spacing)+(self.mapList[i].relationalData[o].type == 2?4:20)),
  353. (self.mapList[i].relationalData[o].y+(self.mapList[i].relationalData[o].h/2))-self.mapList[i].maxHeight/2)
  354. //材质
  355. let material = new Three.MeshPhongMaterial()
  356. //区分房间类型 生成文字
  357. //透明度开启关闭
  358. material.transparent = true;
  359. //透明度
  360. material.opacity = self.mapList[i].relationalData[o].type == 1?self.roomData_1.bgOpacity:(self.mapList[i].relationalData[o].type == 2?self.roomData_2.bgOpacity:(self.mapList[i].relationalData[o].type == 3?self.roomData_3.bgOpacity:''))
  361. if(self.mapList[i].relationalData[o].planType){
  362. material.emissive.setStyle(self.foundation.planColor);
  363. }else{
  364. material.emissive.setStyle(self.mapList[i].relationalData[o].type == 1?self.roomData_1.bgColor:(self.mapList[i].relationalData[o].type == 2?self.roomData_2.bgColor:(self.mapList[i].relationalData[o].type == 3?self.roomData_3.bgColor:'')));
  365. }
  366. //添加
  367. geometryList.push(geometry)
  368. materialList.push(material)
  369. if(self.mapList[i].relationalData[o].type != 2){
  370. //生成墙体
  371. let qt_1 = new Three.BoxGeometry(self.mapList[i].relationalData[o].w, 20, 2);
  372. qt_1.translate((self.mapList[i].relationalData[o].x+(self.mapList[i].relationalData[o].w/2))-self.mapList[i].maxWidth/2,
  373. ((i*self.foundation.spacing)+10),
  374. self.mapList[i].relationalData[o].y-self.mapList[i].maxHeight/2)
  375. let cz_1 = new Three.MeshLambertMaterial()
  376. cz_1.opacity = 1
  377. if(self.mapList[i].relationalData[o].planType){
  378. cz_1.emissive.setStyle(self.foundation.planColor);
  379. }else{
  380. cz_1.emissive.setStyle(self.mapList[i].relationalData[o].type == 1?self.roomData_1.bgColor:(self.mapList[i].relationalData[o].type == 2?self.roomData_2.bgColor:(self.mapList[i].relationalData[o].type == 3?self.roomData_3.bgColor:'')));
  381. }
  382. geometryList.push(qt_1)
  383. materialList.push(cz_1)
  384. let qt_2 = new Three.BoxGeometry(self.mapList[i].relationalData[o].w, 20, 2);
  385. qt_2.translate(self.mapList[i].relationalData[o].x+(self.mapList[i].relationalData[o].w/2)-self.mapList[i].maxWidth/2,
  386. ((i*self.foundation.spacing)+10),
  387. self.mapList[i].relationalData[o].y+self.mapList[i].relationalData[o].h-self.mapList[i].maxHeight/2)
  388. let cz_2 = new Three.MeshLambertMaterial()
  389. cz_2.opacity = 1
  390. if(self.mapList[i].relationalData[o].planType){
  391. cz_2.emissive.setStyle(self.foundation.planColor);
  392. }else{
  393. cz_2.emissive.setStyle(self.mapList[i].relationalData[o].type == 1?self.roomData_1.bgColor:(self.mapList[i].relationalData[o].type == 2?self.roomData_2.bgColor:(self.mapList[i].relationalData[o].type == 3?self.roomData_3.bgColor:'')));
  394. }
  395. geometryList.push(qt_2)
  396. materialList.push(cz_2)
  397. let qt_3 = new Three.BoxGeometry(2, 20, self.mapList[i].relationalData[o].h);
  398. qt_3.translate(self.mapList[i].relationalData[o].x-self.mapList[i].maxWidth/2,
  399. ((i*self.foundation.spacing)+10),
  400. self.mapList[i].relationalData[o].y+(self.mapList[i].relationalData[o].h/2)-self.mapList[i].maxHeight/2)
  401. let cz_3 = new Three.MeshLambertMaterial()
  402. cz_3.opacity = 1
  403. if(self.mapList[i].relationalData[o].planType){
  404. cz_3.emissive.setStyle(self.foundation.planColor);
  405. }else{
  406. cz_3.emissive.setStyle(self.mapList[i].relationalData[o].type == 1?self.roomData_1.bgColor:(self.mapList[i].relationalData[o].type == 2?self.roomData_2.bgColor:(self.mapList[i].relationalData[o].type == 3?self.roomData_3.bgColor:'')));
  407. }
  408. geometryList.push(qt_3)
  409. materialList.push(cz_3)
  410. let qt_4 = new Three.BoxGeometry(2, 20, self.mapList[i].relationalData[o].h);
  411. qt_4.translate(self.mapList[i].relationalData[o].x+self.mapList[i].relationalData[o].w-self.mapList[i].maxWidth/2,
  412. ((i*self.foundation.spacing)+10),
  413. self.mapList[i].relationalData[o].y+(self.mapList[i].relationalData[o].h/2)-self.mapList[i].maxHeight/2)
  414. let cz_4 = new Three.MeshLambertMaterial()
  415. cz_4.opacity = 1
  416. if(self.mapList[i].relationalData[o].planType){
  417. cz_4.emissive.setStyle(self.foundation.planColor);
  418. }else{
  419. cz_4.emissive.setStyle(self.mapList[i].relationalData[o].type == 1?self.roomData_1.bgColor:(self.mapList[i].relationalData[o].type == 2?self.roomData_2.bgColor:(self.mapList[i].relationalData[o].type == 3?self.roomData_3.bgColor:'')));
  420. }
  421. geometryList.push(qt_4)
  422. materialList.push(cz_4)
  423. //生成文字图片
  424. let canvas = document.createElement("canvas");
  425. let ctx = canvas.getContext('2d')
  426. canvas.width = self.mapList[i].relationalData[o].w/2
  427. canvas.height = self.mapList[i].relationalData[o].h/2
  428. //制作矩形
  429. ctx.fillStyle = "gray";
  430. ctx.fillRect(0, 0, 0, 0)
  431. //设置文字
  432. ctx.fillStyle = "white";
  433. ctx.font = 'normal 14px "楷体"'
  434. ctx.fillText(self.mapList[i].relationalData[o].type==3?'紧急出口':(self.mapList[i].relationalData[o].roomName?self.mapList[i].relationalData[o].roomName:self.mapList[i].relationalData[o].subName),0, 20)
  435. //生成图片
  436. let url = canvas.toDataURL('image/png');
  437. let geometry1 = new Three.PlaneGeometry(self.mapList[i].relationalData[o].w/2, 60)
  438. geometry1.translate(self.mapList[i].relationalData[o].x+(self.mapList[i].relationalData[o].w/2)-self.mapList[i].maxWidth/2,
  439. ((i*self.foundation.spacing)+10),
  440. self.mapList[i].relationalData[o].y+(self.mapList[i].relationalData[o].h/2)-self.mapList[i].maxHeight/2)
  441. let material1 = new Three.MeshBasicMaterial({
  442. map: new Three.TextureLoader().load(url),
  443. side: Three.DoubleSide,
  444. opacity: 1,
  445. transparent: true, // 设为透明
  446. })
  447. geometryList.push(geometry1)
  448. materialList.push(material1)
  449. }
  450. }
  451. maxList.push({
  452. geometryList:geometryList,
  453. materialList:materialList,
  454. name:self.mapList[i].name,
  455. floorId:self.mapList[i].id,
  456. subNum:self.mapList[i].subNum,
  457. })
  458. // //合并数据
  459. // let merged = mergeBufferGeometries(geometryList, true)
  460. // let mergeMesh = new Three.Mesh(merged, materialList)
  461. // //给合并项增加名称
  462. // mergeMesh.name = self.mapList[i].name;
  463. // mergeMesh.floorId = self.mapList[i].id;
  464. // mergeMesh.subNum = self.mapList[i].subNum;
  465. // //插入合并数据
  466. // self.scene.add(mergeMesh);
  467. }
  468. //清除动画数据
  469. if(this.renderer){
  470. cancelAnimationFrame(this.animateData);
  471. this.scene.traverse((child) => {
  472. if (child.material) {
  473. for(let i=0;i<child.material.length;i++){
  474. child.material[i].dispose();
  475. }
  476. }
  477. if (child.geometry) {
  478. child.geometry.dispose();
  479. }
  480. child = null;
  481. });
  482. this.container.innerHTML = '';
  483. this.renderer.forceContextLoss();
  484. this.renderer.dispose();
  485. this.scene.clear();
  486. this.$set(this,'scene',null);
  487. this.$set(this,'camera',null);
  488. this.$set(this,'controls',null);
  489. this.$set(this.renderer,'domElement',null);
  490. this.$set(this,'renderer',null);
  491. this.$set(this,'animateData',null);
  492. this.$set(this,'container',null);
  493. }
  494. this.scene = new Three.Scene()
  495. for(let i=0;i<maxList.length;i++){
  496. //合并数据
  497. let merged = mergeBufferGeometries(maxList[i].geometryList, true)
  498. let mergeMesh = new Three.Mesh(merged, maxList[i].materialList)
  499. //给合并项增加名称
  500. mergeMesh.name = maxList[i].name;
  501. mergeMesh.floorId = maxList[i].floorId;
  502. mergeMesh.subNum = maxList[i].subNum;
  503. //插入合并数据
  504. self.scene.add(mergeMesh);
  505. }
  506. this.lens();
  507. },
  508. //镜头
  509. lens(){
  510. this.container = document.getElementById('container')
  511. /*
  512. * 创建相机对象
  513. */
  514. this.camera = new Three.PerspectiveCamera(75, this.container.clientWidth / this.container.clientHeight, 0.1, 3000)
  515. //根据楼层间距与显示层数设定相机距离
  516. this.camera.position.set(0,
  517. this.foundation.visualDistance+(this.foundation.spacing*this.maxMapButtonList.length)*0.2,
  518. this.foundation.visualDistance+(this.foundation.spacing*this.maxMapButtonList.length)*0.2)
  519. /*
  520. * 创建渲染器对象
  521. */
  522. this.renderer = new Three.WebGLRenderer({antialias: true})
  523. this.renderer.setClearColor(0xf4f4f4, 0)
  524. //设置渲染区域尺寸
  525. this.renderer.setSize(this.container.clientWidth, this.container.clientHeight)
  526. //设置背景颜色
  527. //body元素中插入canvas对象
  528. this.container.appendChild(this.renderer.domElement)
  529. //执行渲染操作 指定场景、相机作为参数
  530. this.renderer.render(this.scene, this.camera)
  531. //镜头控制器
  532. this.createControls();
  533. //执行渲染
  534. // this.render();
  535. },
  536. //渲染
  537. render() {
  538. this.renderer.render(this.scene,this.camera);//执行渲染操作
  539. },
  540. // 创建控件对象
  541. createControls() {
  542. this.controls = new OrbitControls(this.camera, this.renderer.domElement)
  543. this.controls.enablePan = false // 是否开启右键拖拽
  544. this.controls.maxPolarAngle = 1 // 上下翻转的最大角度
  545. this.controls.minPolarAngle = 1 // 上下翻转的最小角度
  546. this.controls.autoRotate = true // 是否自动旋转
  547. this.controls.enableZoom = true // 是否可以缩放 默认是true
  548. this.controls.dampingFactor = 0.5 // 动态阻尼系数 就是鼠标拖拽旋转灵敏度,阻尼越小越灵敏
  549. // this.controls.addEventListener('change', this.render)
  550. this.animate();
  551. },
  552. //旋转动画
  553. animate() {
  554. let t0 = new Date()
  555. this.controls.update();
  556. let t1 = new Date(); //本次时间
  557. let t = t1 - t0; // 时间差
  558. this.camera.rotateY(0.0001 * t / 3); //物体的均匀从左到又平移可以用相机旋转Y轴来实现
  559. this.controls.target = new Three.Vector3(0,((this.foundation.visualDistance/40)*(this.maxMapButtonList.length*4)),0);
  560. this.renderer.render(this.scene, this.camera);
  561. this.animateData = requestAnimationFrame(this.animate);
  562. },
  563. // 点击事件
  564. getMouseXY(event){
  565. let self = this;
  566. let dom = document.getElementById('container');
  567. var mouse=new Three.Vector3();
  568. var raycaster=new Three.Raycaster();
  569. if(this.routeType){
  570. mouse.x = ((event.clientX - dom.offsetParent.offsetLeft) / dom.clientWidth) * 2 - 1;//因为布局原因获取父级的offsetLeft
  571. mouse.y = -((event.clientY - dom.offsetTop) / dom.clientHeight) * 2 + 1;
  572. }else{
  573. let borderLeft = Math.round(this.$refs.maxBox.getBoundingClientRect().left);
  574. let borderTop = Math.round(this.$refs.maxBox.getBoundingClientRect().top);
  575. let str = this.$refs.maxBox.style.transform + '';
  576. let index1=str.indexOf('(')
  577. let index2=str.indexOf(')')
  578. str = this.accMul(parseFloat(str.substring(index1+1,index2)),100)
  579. let x = event.clientX - borderLeft;
  580. x = x/str
  581. x = this.accMul(x,100)
  582. x = x - dom.offsetParent.offsetLeft
  583. let y = event.clientY - borderTop;
  584. y = y/str
  585. y = this.accMul(y,100)
  586. y = y - dom.offsetTop
  587. mouse.x = (x / dom.clientWidth) * 2 - 1
  588. mouse.y = -(y / dom.clientHeight) * 2 + 1;
  589. }
  590. raycaster.setFromCamera(mouse, this.camera);
  591. const intersects = raycaster.intersectObjects(this.scene.children);
  592. if(intersects[0]){
  593. if(intersects[0].object.subNum > 0){
  594. for(let i=0;i<self.mapList.length;i++){
  595. if(self.mapList[i].id == intersects[0].object.floorId){
  596. for(let o=0;o<self.mapList[i].relationalData.length;o++){
  597. if(self.mapList[i].relationalData[o].type == '1'){
  598. if(self.mapList[i].relationalData[o].roomType != '-99'){
  599. if(self.mapList[i].relationalData[o].planType){
  600. for(let x=0;x<self.mapList[i].buildFloorLayoutVoList.length;x++){
  601. if(self.mapList[i].buildFloorLayoutVoList[x].loginAdmin){
  602. if(self.mapList[i].buildFloorLayoutVoList[x].subId == self.mapList[i].relationalData[o].subId){
  603. if(self.$route.query.buildId){
  604. delete self.$route.query.buildId;
  605. }
  606. if(self.$route.query.subId){
  607. delete self.$route.query.subId;
  608. }
  609. if(self.$route.query.floorId){
  610. delete self.$route.query.floorId;
  611. }
  612. if(self.$route.query.groupId){
  613. delete self.$route.query.groupId;
  614. }
  615. let obj = {
  616. buildId:self.buildingId,
  617. floorId:self.mapList[i].id,
  618. subId:self.mapList[i].buildFloorLayoutVoList[x].subId,
  619. planType:true
  620. }
  621. self.$parent.goPage(2,obj);
  622. return
  623. }
  624. }
  625. }
  626. }
  627. }
  628. }
  629. }
  630. for(let o=0;o<self.mapList[i].buildFloorLayoutVoList.length;o++){
  631. if(self.mapList[i].buildFloorLayoutVoList[o].loginAdmin){
  632. if(self.$route.query.buildId){
  633. delete self.$route.query.buildId;
  634. }
  635. if(self.$route.query.subId){
  636. delete self.$route.query.subId;
  637. }
  638. if(self.$route.query.floorId){
  639. delete self.$route.query.floorId;
  640. }
  641. if(self.$route.query.groupId){
  642. delete self.$route.query.groupId;
  643. }
  644. let obj = {
  645. buildId:self.buildingId,
  646. floorId:self.mapList[i].id,
  647. subId:self.mapList[i].buildFloorLayoutVoList[o].subId,
  648. planType:false
  649. }
  650. self.$parent.goPage(2,obj);
  651. return
  652. }
  653. }
  654. }
  655. }
  656. }
  657. }
  658. },
  659. //获取楼栋数据
  660. getBuilding(){
  661. getBuildOrFloorList({type:2,parentId:''}).then(response => {
  662. if(response.data[0]){
  663. this.$set(this,'buildingOptions',response.data);
  664. this.$set(this,'buildingId',response.data[0].id);
  665. //获取楼层数据
  666. this.getFloor();
  667. //获取楼栋人数
  668. this.getBuildOrFloorInfo();
  669. //获取eCharts数据
  670. this.exitHazardTotalByBuildId();
  671. //获取楼栋传感器数据接口
  672. this.getLotStatis();
  673. //楼栋MQTT
  674. this.offBuildingMQTT('on');
  675. }
  676. })
  677. },
  678. //楼栋数据选择
  679. buildingChange(){
  680. this.$set(this,'monitorType',null);
  681. //获取楼层数据
  682. this.getFloor();
  683. //获取楼栋人数
  684. this.getBuildOrFloorInfo();
  685. //获取eCharts数据
  686. this.exitHazardTotalByBuildId();
  687. //获取楼栋传感器数据接口
  688. this.getLotStatis();
  689. //楼栋MQTT
  690. this.offBuildingMQTT('on');
  691. },
  692. //获取楼栋人数
  693. getBuildOrFloorInfo(){
  694. let obj = {
  695. type:2,
  696. id:this.buildingId
  697. }
  698. getBuildOrFloorInfo(obj).then(response => {
  699. this.$set(this,'userNum',response.data.online);
  700. })
  701. },
  702. //获取楼层数据
  703. getFloor(){
  704. getBuildOrFloorDetailList({parentId : this.buildingId}).then(response => {
  705. let list = [];
  706. let monitorList = [];
  707. for(let i=0;i<response.data.length;i++){
  708. let obj = {
  709. id:response.data[i].id,
  710. name:response.data[i].name,
  711. parentId:response.data[i].parentId,
  712. subNum:response.data[i].subNum,
  713. buildFloorLayoutVoList:response.data[i].buildFloorLayoutVoList,
  714. relationalData:JSON.parse(response.data[i].exitLineVertexList[0].layoutJoinData),
  715. checkType:false,
  716. indexName:i+1,
  717. }
  718. list.push(obj);
  719. //处理楼层摄像头
  720. if(response.data[i].sparseHardwareList[0]){
  721. let newObj = {
  722. name:response.data[i].name,
  723. type:i==0?true:false,
  724. hardwareList:[],
  725. urlList:[],
  726. }
  727. for(let o=0;o<response.data[i].sparseHardwareList.length;o++){
  728. newObj.hardwareList.push(response.data[i].sparseHardwareList[o].hardwareNum)
  729. }
  730. monitorList.push(newObj)
  731. }
  732. }
  733. this.$set(this,'maxMapList',list);
  734. //处理楼层摄像头
  735. this.$set(this,'monitorNumList',monitorList);
  736. if(monitorList[0]){
  737. this.getMonitorUrl(0);
  738. }
  739. //初始化
  740. this.dataDispose(0);
  741. })
  742. },
  743. //获取楼栋摄像头
  744. async getMonitorUrl(index){
  745. let self = this;
  746. if(index !== this.monitorType){
  747. this.videoOff()
  748. let obj = {
  749. page:"1",
  750. count:"100",
  751. deviceIds:this.monitorNumList[index].hardwareList+'',
  752. };
  753. const { data } = await startUrl(obj);
  754. if(data){
  755. let newData = data;
  756. let urlText = window.location.href;
  757. let videoList = [];
  758. if(urlText.indexOf(localStorage.getItem('ipIdentify')) != -1){
  759. for(let i=0;i<newData.length;i++){
  760. let obj = {
  761. divId:newData[i].deviceID,
  762. hasAudio:false,
  763. height:false,
  764. videoUrl:newData[i].ws_flv,
  765. }
  766. videoList.push(obj)
  767. }
  768. }else{
  769. for(let i=0;i<newData.length;i++){
  770. let text = localStorage.getItem('cameraUrl');
  771. let url = newData[i].ws_flv;
  772. url = url.split("rtp/");
  773. let newUrl = text+'rtp/'+url[1];
  774. let obj = {
  775. divId:newData[i].deviceID,
  776. hasAudio:false,
  777. height:false,
  778. videoUrl:newUrl,
  779. }
  780. videoList.push(obj)
  781. }
  782. }
  783. this.$set(this,'videoList',videoList);
  784. this.$set(this,'monitorType',index);
  785. setTimeout(function(){
  786. self.videoPlay();
  787. },300);
  788. }
  789. }
  790. },
  791. //播放视频流
  792. videoPlay(){
  793. let self = this;
  794. this.loading = false;
  795. let videoList = JSON.parse(JSON.stringify(this.videoList))
  796. for(let i=0;i<videoList.length;i++){
  797. let obj = {
  798. player :{},
  799. flvPlayer:{}
  800. };
  801. obj.player = document.getElementById(videoList[i].divId);
  802. obj.flvPlayer = flvjs.createPlayer(
  803. {
  804. // isLive: true, //=> 是否为直播流
  805. // hasAudio: false, //=> 是否开启声音
  806. type: 'flv', //媒体类型 flv 或 mp4
  807. url: videoList[i].videoUrl //视频流地址
  808. },
  809. {
  810. enableStashBuffer: true,//启用 IO 存储缓冲区。 如果您需要实时流播放(最小延迟),请设置为 false,但如果存在网络抖动,则可能会停止。
  811. stashInitialSize: 128,//IO 存储缓冲区初始大小。 默认值为 384KB。 指示合适的大小可以改善视频加载/搜索时间。
  812. isLive: true,//是否是直播
  813. lazyLoadRecoverDuration: 30,//指示以秒为单位的lazyLoad 恢复时间边界。
  814. autoCleanupSourceBuffer: true,//进行自动清理
  815. autoCleanupMaxBackwardDuration: 3 * 60,//3 * 60 当向后缓冲持续时间超过这个值(以秒为单位)时,对 SourceBuffer 进行自动清理
  816. autoCleanupMinBackwardDuration: 2 * 60,//2 * 60 指示在执行自动清理时为后向缓冲区保留的持续时间(以秒为单位)。
  817. }
  818. );
  819. self.videoPlayList.push(obj);
  820. }
  821. for(let i=0;i<self.videoPlayList.length;i++){
  822. self.videoPlayList[i].flvPlayer.attachMediaElement(self.videoPlayList[i].player);
  823. self.videoPlayList[i].flvPlayer.load(); //加载
  824. self.videoPlayList[i].flvPlayer.play(); //加载
  825. }
  826. },
  827. //断开视频流
  828. videoOff(){
  829. let self = this;
  830. if(self.videoPlayList[0]){
  831. for(let i=0;i<self.videoPlayList.length;i++){
  832. if(self.videoPlayList[i].flvPlayer){
  833. self.videoPlayList[i].flvPlayer.pause();
  834. self.videoPlayList[i].flvPlayer.unload();
  835. self.videoPlayList[i].flvPlayer.detachMediaElement();
  836. self.videoPlayList[i].flvPlayer.destroy();
  837. self.videoPlayList[i].flvPlayer = null;
  838. }
  839. }
  840. self.$set(self,'videoList',[]);
  841. self.$set(self,'videoPlayList',[]);
  842. }
  843. },
  844. //获取楼栋下传感器数据
  845. getLotStatis(){
  846. getLotStatis({buildId:this.buildingId}).then(response => {
  847. this.$set(this,'lotStaticList',response.data.lotStaticList);
  848. this.$set(this,'lotStaticSum',response.data.lotStaticSum);
  849. })
  850. },
  851. //获取eCharts数据
  852. exitHazardTotalByBuildId(){
  853. exitHazardTotalByBuildId({buildId:this.buildingId}).then(response => {
  854. if(response.data.hazardTotal[0]){
  855. this.$set(this,'hazardSum',response.data.hazardSum);
  856. let obj = {
  857. nameList: [],
  858. numList: [],
  859. maxNumList: [],
  860. }
  861. for(let i=0;i<response.data.hazardTotal.length;i++){
  862. obj.nameList.push(response.data.hazardTotal[i].name)
  863. obj.numList.push(response.data.hazardTotal[i].percentage)
  864. obj.maxNumList.push(100)
  865. }
  866. this.$set(this,'eChartsData',obj);
  867. this.eChartsFunction(this.eChartsData);
  868. }else{
  869. this.$set(this,'hazardSum',0);
  870. let obj = {
  871. nameList: [],
  872. numList: [],
  873. maxNumList: [],
  874. }
  875. this.$set(this,'eChartsData',obj);
  876. this.eChartsFunction(this.eChartsData);
  877. }
  878. });
  879. },
  880. //eCharts表格
  881. eChartsFunction(obj){
  882. let self = this;
  883. // document.getElementById('eCharts').innerHTML = '';
  884. this.myChart = this.$echarts.init(document.getElementById('eCharts'));
  885. let option = {
  886. backgroundColor: 'rgba(0,0,0,0)',
  887. grid: {
  888. left: '10%',
  889. right: '10%',
  890. bottom: '10%',
  891. top: '10%',
  892. containLabel: true,
  893. },
  894. legend: [{
  895. show: false,
  896. }],
  897. xAxis: [
  898. {
  899. type: 'category',
  900. data: obj.nameList,
  901. axisLine: {
  902. lineStyle: {
  903. color: 'rgba(5, 80, 93, 1)',
  904. },
  905. },
  906. axisLabel: {
  907. fontSize: 12,
  908. // color: 'black',
  909. color: '#fff',
  910. fontFamily: 'DIN-Medium',
  911. padding: [3, 0, 0, 0]
  912. },
  913. axisTick: {
  914. show: false,
  915. },
  916. },
  917. {
  918. type: 'category',
  919. data: obj.nameList,
  920. show: false,
  921. },],
  922. yAxis: [{
  923. type: 'value',
  924. name: "",
  925. nameTextStyle: {
  926. fontSize: 14,
  927. fontFamily: 'Source Han Sans CN',
  928. fontWeight: '400',
  929. color: 'rgba(255, 255, 255, 1)',
  930. padding: [0, 75, -8, 0]
  931. },
  932. nameGap: 24,
  933. axisLine: {
  934. show: true,
  935. lineStyle: {
  936. color: 'rgba(5, 80, 93, 1)',
  937. }
  938. },
  939. axisTick: {
  940. show: false,
  941. },
  942. splitLine: {
  943. show: false,
  944. lineStyle: {
  945. color: 'rgba(5, 80, 93, 1)',
  946. type: "dashed",
  947. },
  948. },
  949. alignTicks: true,
  950. axisLabel: {
  951. fontSize: 12,
  952. color: 'rgba(255, 255, 255, 1)',
  953. fontFamily: 'DIN-Medium',
  954. padding: [0, 7, 0, 0]
  955. },
  956. splitArea: {
  957. show: false,
  958. },
  959. }],
  960. series: [
  961. {
  962. type: 'bar',
  963. label: {
  964. normal: {
  965. show: true,
  966. position: 'top',
  967. fontSize: 12,
  968. color: 'rgba(16, 213, 223, 1)',
  969. formatter: function (params) {
  970. return params.value + '%'
  971. },
  972. offset: [0, -10],
  973. },
  974. },
  975. tooltip: {
  976. show: false
  977. },
  978. barWidth: 14,
  979. itemStyle: {
  980. color: {
  981. type: 'linear',
  982. x: 0, x2: 0, y: 0, y2: 1,
  983. colorStops: [
  984. { offset: 0, color: '#00FCFC' },
  985. { offset: 1, color: '#016FCC' }
  986. ]
  987. },
  988. },
  989. name: '',
  990. data: obj.numList
  991. },
  992. {
  993. // 分隔
  994. type: 'pictorialBar',
  995. itemStyle: {
  996. normal: {
  997. color: 'rgba(3, 72, 84, 0.5)',
  998. },
  999. },
  1000. symbolRepeat: 'fixed',//重复
  1001. symbolMargin: 2,//上下间隔
  1002. symbol: 'rect',//图形类型
  1003. symbolClip: true,//是否裁剪
  1004. symbolSize: [20, 2],//图形的大小,可以用数组分开表示宽和高
  1005. symbolPosition: 'center',//图形的定位位置
  1006. symbolOffset: [0, 2],//图形相对于原本位置的偏移
  1007. data: obj.numList,
  1008. z: 0,
  1009. zlevel: 1,
  1010. },
  1011. {
  1012. type: 'bar',
  1013. barWidth: 40,
  1014. xAxisIndex: 1,
  1015. itemStyle: {
  1016. color: 'rgba(0, 0, 0, 0)'
  1017. },
  1018. name: '',
  1019. data: obj.maxNumList
  1020. },
  1021. ],
  1022. }
  1023. this.myChart.setOption(option);
  1024. },
  1025. //查询预案发生
  1026. selectTriggerInfo(){
  1027. let self = this;
  1028. selectTriggerInfo().then(response => {
  1029. if(response.data[0]){
  1030. for(let i=0;i<response.data.length;i++){
  1031. for(let o=0;o<self.mapList.length;o++){
  1032. for(let x=0;x<self.mapList[o].relationalData.length;x++){
  1033. if (self.mapList[o].relationalData[x].type == '1' && self.mapList[o].relationalData[x].roomType!='-99'){
  1034. if(response.data[i].subId == self.mapList[o].relationalData[x].subId){
  1035. self.mapList[o].relationalData[x].planType = true;
  1036. //判断预案是否进入过
  1037. for(let s=0;s<response.data.length;s++){
  1038. if(response.data[s].riskAttribute != '1'&&response.data[s].ifCheck != '1'){
  1039. setTimeout(function (){
  1040. if(self.$route.query.buildId){
  1041. delete self.$route.query.buildId;
  1042. }
  1043. if(self.$route.query.subId){
  1044. delete self.$route.query.subId;
  1045. }
  1046. if(self.$route.query.floorId){
  1047. delete self.$route.query.floorId;
  1048. }
  1049. if(self.$route.query.groupId){
  1050. delete self.$route.query.groupId;
  1051. }
  1052. let obj = {
  1053. buildId:response.data[s].buildId,
  1054. floorId:response.data[s].floorId,
  1055. subId:response.data[s].subId,
  1056. groupId:response.data[s].groupId,
  1057. planType:true
  1058. }
  1059. self.$parent.goPage(2,obj);
  1060. },5000)
  1061. break
  1062. }
  1063. }
  1064. }else{
  1065. self.mapList[o].relationalData[x].planType = false;
  1066. }
  1067. }
  1068. }
  1069. }
  1070. }
  1071. }else{
  1072. for(let o=0;o<self.mapList.length;o++){
  1073. for(let x=0;x<self.mapList[o].relationalData.length;x++){
  1074. if (self.mapList[o].relationalData[x].type == '1' && self.mapList[o].relationalData[x].roomType!='-99'){
  1075. self.mapList[o].relationalData[x].planType = false;
  1076. }
  1077. }
  1078. }
  1079. }
  1080. this.initAdd();
  1081. })
  1082. },
  1083. //全局-MQTT订阅
  1084. onAllMQTT(){
  1085. let self = this;
  1086. this.allClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
  1087. username: localStorage.getItem('mqttUser'),
  1088. password: localStorage.getItem('mqttPassword')
  1089. });
  1090. this.allClient.on("connect", e =>{
  1091. console.log("连接成功");
  1092. this.allClient.subscribe(self.planTopic, (err) => {
  1093. if (!err) {
  1094. console.log("预案-订阅成功:" + self.planTopic);
  1095. }
  1096. });
  1097. });
  1098. this.allClient.on("message", (topic, message) => {
  1099. if (message){
  1100. let data = JSON.parse(message)
  1101. if(data){
  1102. console.log('data',data);
  1103. if(topic == self.planTopic){
  1104. //传感器状态
  1105. console.log('预案-状态');
  1106. self.selectTriggerInfo();
  1107. }
  1108. }
  1109. }
  1110. });
  1111. },
  1112. //楼层-MQTT订阅
  1113. onBuildingMQTT(){
  1114. let self = this;
  1115. this.buildingClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
  1116. username: localStorage.getItem('mqttUser'),
  1117. password: localStorage.getItem('mqttPassword')
  1118. });
  1119. this.buildingClient.subscribe(self.userTopic+self.buildingId, (err) => {
  1120. if (!err) {
  1121. console.log("实验室人数-订阅成功:" + self.userTopic+self.buildingId);
  1122. }
  1123. });
  1124. this.buildingClient.on("message", (topic, message) => {
  1125. if (message){
  1126. let data = JSON.parse(message)
  1127. if(data){
  1128. console.log('data',data);
  1129. if(topic == (self.userTopic+self.buildingId)){
  1130. console.log('实验室人数-状态');
  1131. //实验室人数
  1132. self.getBuildOrFloorInfo();
  1133. }
  1134. }
  1135. }
  1136. });
  1137. },
  1138. //取消订阅-全局-关闭MQTT连接
  1139. offAllMQTT(type){
  1140. console.log('type',type)
  1141. let self = this;
  1142. //判断是否已有连接如果有责断开
  1143. if(this.allClient.unsubscribe){
  1144. this.allClient.unsubscribe(self.planTopic, error => {
  1145. if (error) {
  1146. console.log('预案-MQTT断开报错=>', error)
  1147. }
  1148. })
  1149. this.allClient.end();
  1150. this.$set(this,'allClient',{});
  1151. }
  1152. //判断传入参数如果存在 发起一次新的连接
  1153. if(type){
  1154. this.onAllMQTT();
  1155. }
  1156. },
  1157. //取消订阅-楼层-关闭MQTT连接
  1158. offBuildingMQTT(type){
  1159. let self = this;
  1160. //判断是否已有连接如果有责断开
  1161. if(this.buildingClient.unsubscribe){
  1162. this.buildingClient.unsubscribe(self.userTopic+self.buildingId, error => {
  1163. if (error) {
  1164. console.log('实验室人数-MQTT断开报错=>', error)
  1165. }
  1166. })
  1167. this.buildingClient.end();
  1168. this.$set(this,'buildingClient',{});
  1169. }
  1170. //判断传入参数如果存在 发起一次新的连接
  1171. if(type){
  1172. this.onBuildingMQTT();
  1173. }
  1174. },
  1175. //跳转
  1176. goRoute(){
  1177. if(this.routeType){
  1178. this.$router.push({
  1179. path: "/emergencyManagement/newPerformEvacuation"
  1180. })
  1181. }else{
  1182. this.$router.push({
  1183. path: "/newEvacuationBigData"
  1184. })
  1185. }
  1186. },
  1187. accMul(arg1,arg2){
  1188. var m=0,s1=arg1.toString(),s2=arg2.toString();
  1189. try{m+=s1.split(".")[1].length}catch(e){}
  1190. try{m+=s2.split(".")[1].length}catch(e){}
  1191. return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
  1192. },
  1193. },
  1194. beforeDestroy() {
  1195. //清除定时器
  1196. let self = this;
  1197. self.videoOff();
  1198. // self.offAllMQTT();
  1199. self.offBuildingMQTT();
  1200. cancelAnimationFrame(self.animateData);
  1201. self.scene.traverse((child) => {
  1202. if (child.material) {
  1203. for(let i=0;i<child.material.length;i++){
  1204. child.material[i].dispose();
  1205. }
  1206. }
  1207. if (child.geometry) {
  1208. child.geometry.dispose();
  1209. }
  1210. child = null;
  1211. });
  1212. self.container.innerHTML = '';
  1213. self.renderer.forceContextLoss();
  1214. self.renderer.dispose();
  1215. self.scene.clear();
  1216. self.$set(self,'scene',null);
  1217. self.$set(self,'camera',null);
  1218. self.$set(self,'controls',null);
  1219. self.$set(self.renderer,'domElement',null);
  1220. self.$set(self,'renderer',null);
  1221. self.$set(self,'animateData',null);
  1222. self.$set(self,'container',null);
  1223. console.log("beforeDestroy");
  1224. },
  1225. }
  1226. </script>
  1227. <style scoped lang="scss">
  1228. .newEvacuationBigDataHome{
  1229. flex:1;
  1230. position: relative;
  1231. display: flex;
  1232. width:1920px;
  1233. height:1080px;
  1234. background: url("../assets/ZDimages/bigData3_2/img_bg.png") repeat;
  1235. background-size: 100% 100%;
  1236. p{
  1237. margin:0;
  1238. }
  1239. .evacuation-title-position-box{
  1240. position: absolute;
  1241. top:0;
  1242. height:92px;
  1243. left:41px;
  1244. width: 1837px;
  1245. background: url("../assets/ZDimages/bigData3_2/sy_db_bg.png");
  1246. background-size: 100% 100%;
  1247. text-align: center;
  1248. font-size:40px;
  1249. line-height:82px;
  1250. color:#24d1f9;
  1251. font-weight:900;
  1252. letter-spacing:10px
  1253. }
  1254. .evacuation-out-button-position-box{
  1255. display: flex;
  1256. position: absolute;
  1257. top:0;
  1258. right:0;
  1259. width:110px;
  1260. cursor: pointer;
  1261. i{
  1262. margin:0 10px;
  1263. line-height:40px;
  1264. color:#24D1F9;
  1265. font-size:18px;
  1266. }
  1267. p{
  1268. line-height:40px;
  1269. color:#24D1F9;
  1270. font-size:14px;
  1271. }
  1272. }
  1273. .left-max-big-box{
  1274. width:400px;
  1275. .left-top-big-box{
  1276. height:688px;
  1277. margin-top:71px;
  1278. position: relative;
  1279. .left-top-for-big-box{
  1280. .left-top-for-box{
  1281. display: inline-block;
  1282. width:78px;
  1283. height:118px;
  1284. position: relative;
  1285. margin:30px 0 0 43px;
  1286. p:nth-child(1){
  1287. line-height: 32px;
  1288. font-size:20px;
  1289. font-weight:700;
  1290. text-align: center;
  1291. color:#24d1f9;
  1292. }
  1293. p:nth-child(2){
  1294. line-height: 18px;
  1295. font-size:16px;
  1296. font-weight:500;
  1297. text-align: center;
  1298. color:#fff;
  1299. }
  1300. img:nth-child(3){
  1301. position: absolute;
  1302. bottom:14px;
  1303. left:19px;
  1304. width:40px;
  1305. height:40px;
  1306. }
  1307. img:nth-child(4){
  1308. position: absolute;
  1309. bottom:0;
  1310. left:0;
  1311. width:78px;
  1312. height:86px;
  1313. }
  1314. }
  1315. }
  1316. .hazardSum-p{
  1317. position: absolute;
  1318. top:26px;
  1319. right:60px;
  1320. color:#fff;
  1321. font-size:14px;
  1322. text-align: right;
  1323. }
  1324. }
  1325. .left-bottom-big-box{
  1326. height:321px;
  1327. position: relative;
  1328. #eCharts{
  1329. height:262px;
  1330. }
  1331. .eCharts-null-p{
  1332. position: absolute;
  1333. top:180px;
  1334. left:165px;
  1335. color:#fff;
  1336. font-size:14px;
  1337. }
  1338. .hazardSum-p{
  1339. position: absolute;
  1340. top:26px;
  1341. right:60px;
  1342. color:#fff;
  1343. font-size:14px;
  1344. text-align: right;
  1345. }
  1346. }
  1347. .big-title-box{
  1348. margin:0 0 0 29px;
  1349. width:181px;
  1350. height:59px;
  1351. background: url("../assets/ZDimages/bigData3_2/img_zjdp_bg.png");
  1352. background-size: 100%;
  1353. display: flex;
  1354. img{
  1355. width:18px;
  1356. height:18px;
  1357. margin:27px 16px 0 20px;
  1358. }
  1359. p{
  1360. margin-top:16px;
  1361. line-height:40px;
  1362. color:#fff;
  1363. font-size:16px;
  1364. }
  1365. }
  1366. }
  1367. .center-max-big-box{
  1368. flex:1;
  1369. display: flex;
  1370. flex-direction: column;
  1371. overflow: hidden;
  1372. position: relative;
  1373. .top-button-box{
  1374. height:226px;
  1375. position: relative;
  1376. .top-button-left-select-box{
  1377. position: absolute;
  1378. top:146px;
  1379. left:69px;
  1380. }
  1381. .top-button-right-num-box{
  1382. }
  1383. }
  1384. #container{
  1385. flex:1;
  1386. background: rgba(0,0,0,0)!important;
  1387. }
  1388. .position-floor-user-box{
  1389. position: absolute;
  1390. right:120px;
  1391. top:146px;
  1392. height:40px;
  1393. display: flex;
  1394. img{
  1395. width:26px;
  1396. height:24px;
  1397. margin:8px 16px 0 0;
  1398. }
  1399. p:nth-child(2){
  1400. font-size:16px;
  1401. color:#24D1F9;
  1402. line-height: 40px;
  1403. }
  1404. p:nth-child(3){
  1405. margin-left:10px;
  1406. font-size:20px;
  1407. color:#24D1F9;
  1408. line-height: 40px;
  1409. font-weight:900;
  1410. }
  1411. }
  1412. .position-floor-button-box{
  1413. position: absolute;
  1414. right:90px;
  1415. top:300px;
  1416. .position-floor-for-button-p:first-child{
  1417. border-top:2px solid #1e7790;
  1418. border-top-left-radius: 4px;
  1419. border-top-right-radius: 4px;
  1420. }
  1421. .position-floor-for-button-p:last-child{
  1422. border-bottom:2px solid #1e7790;
  1423. border-bottom-left-radius: 4px;
  1424. border-bottom-right-radius: 4px;
  1425. }
  1426. .check-button-box:first-child{
  1427. border-top:2px solid #24d1f9;
  1428. border-top-left-radius: 4px;
  1429. border-top-right-radius: 4px;
  1430. }
  1431. .check-button-box:last-child{
  1432. border-bottom:2px solid #24d1f9;
  1433. border-bottom-left-radius: 4px;
  1434. border-bottom-right-radius: 4px;
  1435. }
  1436. .position-floor-for-button-p{
  1437. width:38px;
  1438. height:36px;
  1439. text-align: center;
  1440. line-height:36px;
  1441. color:#1e7790;
  1442. border-left:2px solid #1e7790;
  1443. border-right:2px solid #1e7790;
  1444. border-bottom:1px solid #1e7790;
  1445. border-top:1px solid #1e7790;
  1446. font-size:12px;
  1447. cursor: pointer;
  1448. }
  1449. .check-button-box{
  1450. border-left:2px solid #24d1f9;
  1451. border-right:2px solid #24d1f9;
  1452. border-bottom:1px solid #24d1f9;
  1453. border-top:1px solid #24d1f9;
  1454. color:#fff;
  1455. box-shadow:0 0 6px 1px #24D1F9 inset;
  1456. }
  1457. }
  1458. }
  1459. .right-max-big-box{
  1460. width:400px;
  1461. margin-top:71px;
  1462. .null-p{
  1463. text-align: center;
  1464. line-height:500px;
  1465. color:#fff;
  1466. }
  1467. .monitor-max-for-box:nth-child(1){
  1468. .monitor-title-box{
  1469. border-top:none;
  1470. }
  1471. }
  1472. .monitor-max-for-box{
  1473. width:366px;
  1474. .monitor-title-box{
  1475. display: flex;
  1476. border-top:1px dashed #24D1F9;
  1477. border-bottom:1px dashed #24D1F9;
  1478. p{
  1479. color:#24D1F9;
  1480. font-size:16px;
  1481. line-height:54px;
  1482. flex:1;
  1483. margin-left:7px;
  1484. }
  1485. i{
  1486. color:#24D1F9;
  1487. font-size:18px;
  1488. line-height:54px;
  1489. text-align: center;
  1490. width:20px;
  1491. cursor: pointer;
  1492. margin-right:32px;
  1493. }
  1494. }
  1495. .video-mx-big-box:nth-child(2){
  1496. margin-top:20px;
  1497. }
  1498. .video-mx-big-box{
  1499. margin-bottom:20px;
  1500. }
  1501. }
  1502. }
  1503. }
  1504. </style>
  1505. <style lang="scss">
  1506. .newEvacuationBigDataHome{
  1507. .building-select-box{
  1508. .el-input__inner{
  1509. background:rgba(0,0,0,0);
  1510. border:1px solid #24D1F9;
  1511. box-shadow:0 0 5px 1px #24D1F9 inset;
  1512. color:#fff;
  1513. }
  1514. .el-input__inner:hover{
  1515. border:1px solid #24D1F9;
  1516. box-shadow:0 0 5px 1px #24D1F9 inset;
  1517. }
  1518. }
  1519. .floor-select-box{
  1520. width:100px;
  1521. .el-input__inner{
  1522. background:rgba(0,0,0,0);
  1523. border:1px solid #24D1F9;
  1524. box-shadow:0 0 5px 1px #24D1F9 inset;
  1525. color:#fff;
  1526. }
  1527. .el-input__inner:hover{
  1528. border:1px solid #24D1F9;
  1529. box-shadow:0 0 5px 1px #24D1F9 inset;
  1530. }
  1531. }
  1532. .el-select-dropdown{
  1533. background:#01294d;
  1534. border:1px solid #24D1F9;
  1535. .el-select-dropdown__item{
  1536. background: rgba(0,0,0,0);
  1537. color:#fff;
  1538. }
  1539. .el-select-dropdown__item:hover{
  1540. background: #24D1F9;
  1541. }
  1542. }
  1543. .popper__arrow{
  1544. top:-7px;
  1545. border-bottom-color:#24D1F9!important;
  1546. }
  1547. ::after{
  1548. border-bottom-color:#24D1F9!important;
  1549. }
  1550. ::placeholder{
  1551. color: #fff;
  1552. }
  1553. .scrollbar-box::-webkit-scrollbar{
  1554. width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
  1555. height: 4px;
  1556. }
  1557. .scrollbar-box::-webkit-scrollbar-thumb{
  1558. border-radius: 5px;
  1559. -webkit-box-shadow: inset 0 0 5px #116e8e;
  1560. background: #116e8e;
  1561. }
  1562. .scrollbar-box::-webkit-scrollbar-track{
  1563. -webkit-box-shadow: inset 0 0 5px rgba(255,255,255,0);
  1564. border-radius: 0;
  1565. background: rgba(255,255,255,0);
  1566. }
  1567. }
  1568. </style>