emergencyEvacuationBig.vue 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066
  1. <!-- 应急疏散 -->
  2. <template>
  3. <view id="emergencyEvacuationBig">
  4. <view class="setUpEvacuation" v-if="pageType == 1">
  5. <view class="evacuation-max-box">
  6. <view class="picker-max-box">
  7. <view class="picker-title-box">
  8. <view></view>
  9. <view>学院楼栋</view>
  10. </view>
  11. <picker @change="buildingChange" :range-key="'name'" :value="id" :range="buildingList">
  12. <view class="picker-min-box">
  13. <view>{{buildingName?buildingName:'请选择学院楼栋'}}</view>
  14. <img src="@/images/icon_06.png">
  15. </view>
  16. </picker>
  17. </view>
  18. <view class="picker-max-box">
  19. <view class="picker-title-box">
  20. <view></view>
  21. <view>楼层</view>
  22. </view>
  23. <picker @change="floorChange" :disabled="!buildingId" :range-key="'name'" :value="id"
  24. :range="floorList">
  25. <view class="picker-min-box">
  26. <view>{{floorName?floorName:'请选择楼层'}}</view>
  27. <img src="@/images/icon_06.png">
  28. </view>
  29. </picker>
  30. </view>
  31. <view class="picker-max-box">
  32. <view class="picker-title-box">
  33. <view></view>
  34. <view>实验室</view>
  35. </view>
  36. <picker @change="fjListChange" :disabled="!floorId" :range-key="'subName'" :value="subId"
  37. :range="fjListArray">
  38. <view class="picker-min-box">
  39. <view>{{subName?subName:'请选择实验室'}}</view>
  40. <img src="@/images/icon_06.png">
  41. </view>
  42. </picker>
  43. </view>
  44. </view>
  45. <view class="setUpEvacuation-bottom-button" @click="confirmBtn">确认</view>
  46. </view>
  47. <view class="implementEvacuation" v-if="pageType == 2">
  48. <view class="evacuation-max-box">
  49. <!-- 头部 -->
  50. <view class="evacuation-title-box">
  51. <view class="evacuation-title-name-box">{{subName}}</view>
  52. <view class="site"><img src="@/images/icon_14.png">{{address}}</view>
  53. </view>
  54. <!-- 地图部分 -->
  55. <view class="roadmap">
  56. <view class="roadmap_t">
  57. <view class="monito_li_r_l"></view>
  58. <view class="monito_li_r_r_button" @click="goAllPage">全屏</view>
  59. </view>
  60. <view class="evacuation-map-box">
  61. <view class="emergencyEvacuationBigFullScreen-page" v-if="mapType"
  62. :style="'width:'+mapWidth+'rpx;height:'+mapHeight+'rpx;transform: scale('+zoomData+');margin-top:-'+mapHeight/2+'rpx;margin-left:-'+mapWidth/2+'rpx;'">
  63. <view class="map-max-box" :style="'width:'+mapWidth+'rpx;height:'+mapHeight+'rpx;'">
  64. <view class="map-max-for-box for-map-box" v-if="item.type == 1"
  65. v-for="(item,index) in mapList":key="index"
  66. :class="!item.policeType && checkSubId ==item.subId ? 'room-type-one':(
  67. item.policeType && checkSubId !=item.subId ? 'room-type-two':(
  68. item.policeType && checkSubId ==item.subId ? 'room-type-three':(
  69. !item.loginAdmin ? 'room-type-noe':'')))"
  70. :style="'top:'+item.y+'rpx;left:'+item.x+'rpx;width:'+(item.w-4)+'rpx;height:'+(item.h-4)+'rpx;'">
  71. <view class="map-max-for-min-box">
  72. <view class="map-for-name-p" :style="'margin-top:'+((item.h/2)-20)+'rpx;'">
  73. {{item.roomType == '-99'?item.roomName:item.subName}}</view>
  74. <view class="map-for-num-p">({{item.roomNum}})</view>
  75. <view class="position-box" src="@/images/evacuation3_2/icon_sysbjt_m.png"
  76. :class="minItem.toward=='top'?'center-move-door-p-t':(minItem.toward=='bottom'?'center-move-door-p-b':(minItem.toward=='left'?'center-move-door-p-l':(minItem.toward=='right'?'center-move-door-p-r':'')))"
  77. v-for="(minItem,minIndex) in item.doorList" :key="minIndex"
  78. :style="'top:'+minItem.y+'rpx;left:'+minItem.x+'rpx;width:'+minItem.w+'rpx;height:'+minItem.h+'rpx;'">
  79. </view>
  80. </view>
  81. </view>
  82. <view class="map-max-for-box for-map-box-one" v-if="item.type == 2" v-for="(item,index) in mapList"
  83. :key="index" :style="'top:'+item.y+'rpx;left:'+item.x+'rpx;width:'+item.w+'rpx;height:'+item.h+'rpx;'">
  84. <view class="map-max-for-min-box">
  85. <view class="position-box"
  86. :class="minItem.state=='1'&&minItem.openType?'lightTopOn':(minItem.state=='1'&&!minItem.openType?'lightTopOff':
  87. (minItem.state=='2'&&minItem.openType?'lightBottomOn':(minItem.state=='2'&&!minItem.openType?'lightBottomOff':
  88. (minItem.state=='3'&&minItem.openType?'lightLeftOn':(minItem.state=='3'&&!minItem.openType?'lightLeftOff':
  89. (minItem.state=='4'&&minItem.openType?'lightRightOn':(minItem.state=='4'&&!minItem.openType?'lightRightOff':'')))))))"
  90. v-for="(minItem,minIndex) in item.lightList" :key="minIndex"
  91. :style="'top:'+minItem.y+'rpx;left:'+minItem.x+'rpx;width:'+minItem.w+'rpx;height:'+minItem.h+'rpx;'">
  92. </view>
  93. </view>
  94. </view>
  95. <view class="map-max-for-box for-map-box-two" v-if="item.type == 3" v-for="(item,index) in mapList"
  96. :key="index" :class="item.roomCheckType?'for-map-box-two-check':''"
  97. :style="'top:'+item.y+'rpx;left:'+item.x+'rpx;width:'+item.w+'rpx;height:'+item.h+'rpx;'">
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <!-- 一键灭火 -->
  104. <view class="outfire" v-if='fireType'>
  105. <view class="outfire_li" v-if="!fireListType">
  106. <img src="@/images/icon_sy_wt.png">
  107. <text style="color: #FF7B1A;">设备已离线,请及时处理。</text>
  108. </view>
  109. <view class="outfire_li" v-if="fireStartType">
  110. <img src="@/images/icon_sy_mhwc.png">
  111. <text style="color: #FF2333;">灭火中,灭火程序将于<text>{{conductCountdown}}</text>秒后结束</text>
  112. </view>
  113. <view class="outfire_li" v-if="outfireEnd">
  114. <img src="@/images/icon_sy_mhwc.png">
  115. <text style="color: #FF2333;">灭火完成,请您及时补充灭火设备耗材</text>
  116. </view>
  117. <template v-if="fireListType">
  118. <view class="outfire_li">
  119. <img v-if='!outfireData.smoke' src="@/images/icon_yw_zc.png">
  120. <img v-if='outfireData.smoke' src="@/images/icon_yw_yc.png">
  121. <text
  122. :class="outfireData.smoke?'abnormal':'normal'">{{outfireData.smoke?'有烟雾':'无烟雾'}}</text>
  123. </view>
  124. <view class="outfire_li">
  125. <img v-if='!outfireData.temperature' src="@/images/icon_wd_zc.png">
  126. <img v-if='outfireData.temperature' src="@/images/icon_wd_yc.png">
  127. <text
  128. :class="outfireData.temperature?'abnormal':'normal'">{{outfireData.temperature?'温度异常':'温度正常'}}</text>
  129. </view>
  130. <view class="outfire_li">
  131. <img v-if='!outfireData.fire' src="@/images/icon_hy_zc.png">
  132. <img v-if='outfireData.fire' src="@/images/icon_hy_yc.png">
  133. <text :class="outfireData.fire?'abnormal':'normal'">{{outfireData.fire?'发现火焰':'无火焰'}}</text>
  134. </view>
  135. </template>
  136. <view v-if="fireListType"
  137. :class="fireListType?'outfire_yes_btn':'outfire_no_btn'" @click="outfireFun()">一键灭火
  138. </view>
  139. </view>
  140. <!-- 视频部分 -->
  141. <view class="video-max-box" v-if="urlList[0]">
  142. <video v-for="(item,index) in urlList" :key="index" :id="urlList.id" :src="item.url"
  143. :poster="videoCover" :custom-cache='false' :autoplay="true" :controls="true"
  144. :enable-danmu="false" :muted="true" :show-fullscreen-btn="true" :show-center-play-btn="false"
  145. :show-play-btn="false" @error="videoErrorCallback">
  146. </video>
  147. </view>
  148. <view class="bottom-button-box">
  149. <view @click="shadeTypeClick()">语音广播</view>
  150. <view @click="evacuationButton(1)" v-if="isEvacuate">执行疏散</view>
  151. <view @click="evacuationButton(2)" v-if="!isEvacuate">结束疏散</view>
  152. </view>
  153. </view>
  154. <!-- 语音广播-->
  155. <view class="shade-max-big-box" v-if="broadcastType">
  156. <view class="null-box" @click="shadeTypeClick()"></view>
  157. <!-- 语音广播-执行疏散 -->
  158. <view class="broadcast">
  159. <view class="broadcast_t">语音广播<label>选择喇叭位置</label></view>
  160. <!-- 按钮部分 -->
  161. <view class="trumpet-max-box">
  162. <view @click="trumpetClick(index)" class="trumpet-for-box"
  163. :class="item.type?'trumpet-color-a':'trumpet-color-b'" v-for="(item,index) in trumpetList"
  164. :key="index">
  165. <img src="@/images/icon_sskz_zc.png" v-if="!item.type">
  166. <img src="@/images/icon_sskz_xz.png" v-if="item.type">
  167. {{item.name}}
  168. </view>
  169. </view>
  170. <view class="broadcast_m">
  171. <view class="broadcast_m_t" :class="liveType?'broadcast_m_t_back_a':'broadcast_m_t_back_b'"
  172. @longpress.stop="recordButton" @touchmove.stop="cancelButton" @touchend.stop="sendButton">
  173. {{liveType?'松开发送':'按住说话'}}
  174. </view>
  175. <view class="broadcast_m_b" v-if="!liveType">按住说话,录入广播内容</view>
  176. <view class="broadcast_m_b" v-if="liveType">松开发送,向上滑动取消发送</view>
  177. </view>
  178. </view>
  179. </view>
  180. <!-- 一键灭火遮罩-->
  181. <view class="shade-outfire" v-if="dialogVisible">
  182. <view class="null-box" @click="dialogOutfire()"></view>
  183. <view class="shade-outfire-n">
  184. <img class="shade-outfire-n-t" src="@/images/icon_mh.png" />
  185. <view class="shade-outfire-n-m">一键灭火启动中,倒计时<text>{{countdown}}</text>秒</view>
  186. <view class="shade-outfire-n-b" @click="cancelOutfire()">放弃一键灭火</view>
  187. </view>
  188. </view>
  189. </view>
  190. <view></view>
  191. </view>
  192. </template>
  193. <script>
  194. import $mqtt from '@/utils/mqtt.min.js';
  195. import {
  196. config
  197. } from '@/api/request/config.js'
  198. import {
  199. lablayout,
  200. evacuate,
  201. closure,
  202. lineEvacuate,
  203. getRedis,
  204. getDeviceList,
  205. textParseUrlIps,
  206. laboratoryInfo,
  207. getCameraByFloor,
  208. lineEvacuateTow,
  209. treeselectByUser,
  210. getBuilding,
  211. getDeviceListBySub,
  212. GetStartList,
  213. firedeviceStatus,
  214. firedeviceStatusTiming,
  215. firedeviceStart,
  216. firedeviceCancel
  217. } from '@/api/index.js'
  218. import {
  219. getBuildOrFloorList,
  220. getFloorData,
  221. getRedisEvacuation,
  222. openLight,
  223. closeLight,
  224. executeEvacuation,
  225. endEvacuation
  226. } from '@/api/index.js'
  227. export default {
  228. data() {
  229. return {
  230. videoCover: uni.getStorageSync('videoCover'),
  231. //页面状态
  232. pageType: "1",
  233. deptIndex: 0,
  234. //院系楼栋数据
  235. buildingList: [],
  236. buildingName: "",
  237. buildingId: "",
  238. //楼层数据
  239. floorList: [],
  240. floorName: "",
  241. floorId: "",
  242. //实验室
  243. fjListArray: [],
  244. //疏散方向
  245. buttonArray: [{
  246. name: "向左疏散",
  247. id: "1"
  248. },
  249. {
  250. name: "向右疏散",
  251. id: "2"
  252. },
  253. {
  254. name: "两侧疏散",
  255. id: "0"
  256. },
  257. ],
  258. buttonArrayIndex: "2",
  259. //视频数据
  260. urlList: [],
  261. //布局数据
  262. fjList: [],
  263. lightList: [{
  264. id: "5",
  265. type: false,
  266. },
  267. {
  268. id: "2",
  269. type: false,
  270. },
  271. {
  272. id: "3",
  273. type: false,
  274. },
  275. {
  276. id: "4",
  277. type: false,
  278. },
  279. {
  280. id: "1",
  281. type: false,
  282. },
  283. {
  284. id: "6",
  285. type: false,
  286. },
  287. ],
  288. //接收参数
  289. subId: "",
  290. subName: "",
  291. title: "",
  292. type: "",
  293. //喇叭数据
  294. trumpetList: [],
  295. //广播相关
  296. liveType: false,
  297. sendLock: true, //发送锁,当为true时上锁,false时解锁发送
  298. recorderManager: wx.getRecorderManager(),
  299. isEvacuate: true, //疏散按钮控制,当为true时候执行疏散
  300. //滑动记录
  301. startPoint: {},
  302. //摄像头信息
  303. deptId: '',
  304. itemData: {
  305. hardwareNUM: '',
  306. name: '',
  307. },
  308. broadcastType: false,
  309. address: "",
  310. videoHardwareNUM: [], //实验室和楼道摄像头编码
  311. countdown: '', //倒计时
  312. timer2: null, //倒计时
  313. dialogVisible: false, //一键灭火弹出层
  314. conductCountdown: '',
  315. timer3: null, //倒计时
  316. outfireEnd: false, //灭火结束状态
  317. //新布局地图相关数据
  318. zoomData: null,
  319. mapType:false,
  320. mapList: [],
  321. mapWidth: null, //40边框距离
  322. mapHeight: null, //40边框距离
  323. //新MQTT
  324. floorClient: {},
  325. evacuationTopic: "lab/newexit/line", //疏散
  326. //灭火设备MQTT相关
  327. fireClient:{},
  328. fireTopic:"lab/fireDevice/Warn/",//传感器状态异常
  329. fireOnlineTopic:"lab/fireDevice/isOnline/",//设备是否在线
  330. firePerformTopic:"lab/fireDevice/executing/",//是否正在执行灭火操作
  331. fireType:false,//有无火焰设备状态
  332. fireListType:false,//灭火设备在线离线
  333. fireCode:null,// //灭火设备code
  334. fireStartType:false, //灭火启动状态
  335. outfireData: {}, //一键灭火
  336. }
  337. },
  338. onLoad(option) {
  339. this.treeselectByUser();
  340. //一键灭火正式使用需要注销
  341. // this.itemData.subjectId=85
  342. // this.firedeviceStatus();
  343. },
  344. onShow() {
  345. },
  346. onUnload() {
  347. },
  348. methods: {
  349. //全屏疏散页面
  350. goAllPage() {
  351. let obj = {
  352. buildingId:this.buildingId,
  353. floorId:this.floorId
  354. }
  355. uni.navigateTo({
  356. url: '/pages/emergencyEvacuationBigFullScreen?item='+encodeURIComponent(JSON.stringify(obj)),
  357. });
  358. },
  359. //一键灭火-查询设备状态
  360. async firedeviceStatus() {
  361. let _this = this;
  362. const {data} = await firedeviceStatus(_this.itemData.subjectId)
  363. if (data.code == 200) {
  364. if(data.data.isexist){//是否有灭火设备
  365. this.$set(this,'fireType',data.data.isexist);
  366. if(data.data.online){
  367. _this.outfireData = data.data
  368. _this.$set(this,'fireListType',data.data.online);
  369. _this.$set(this,'fireCode',data.data.fireDevice.deviceCode);
  370. _this.offMQTT('on');
  371. if(data.data.temperature && data.data.smoke){
  372. if(!this.fireStartType){
  373. this.$set(this,'fireStartType',true);
  374. this.sendCode2(data.data.timeDifference);
  375. }
  376. }
  377. }else{
  378. this.$set(this,'fireListType',false);
  379. this.$set(this,'fireCode',null);
  380. this.offMQTT('on');
  381. }
  382. }else{
  383. this.$set(this,'fireType',false);
  384. this.offMQTT('on');
  385. }
  386. }
  387. },
  388. //启动灭火设备
  389. async firedeviceStart() {
  390. let _this = this;
  391. let obj={
  392. subjectId:_this.itemData.subjectId,
  393. deviceCode:_this.fireCode
  394. }
  395. const {data} = await firedeviceStart(obj)
  396. if (data.code == 200) {
  397. if (data.data.online) {
  398. _this.dialogVisible = true;
  399. _this.countdown = data.data.waitTime;//灭火倒计时
  400. _this.sendCode() //倒计时
  401. } else {
  402. wx.showToast({
  403. title: '一键灭火启动失败!',
  404. icon: "none",
  405. duration: 6000
  406. });
  407. }
  408. }
  409. },
  410. //取消灭火设备
  411. async firedeviceCancel() {
  412. let _this = this;
  413. const {data} = await firedeviceCancel(_this.itemData.subjectId)
  414. if (data.code == 200) {
  415. wx.showToast({
  416. title: '放弃一键灭火!',
  417. icon: "none",
  418. duration: 2000
  419. });
  420. }
  421. },
  422. //一键灭火按钮
  423. outfireFun() {
  424. let _this = this;
  425. uni.showModal({
  426. title: "是否确认执行一键灭火?",
  427. content: '该操作存在风险,请您务必确认实验室内人员已安全撤离?',
  428. cancelColor: "#999",
  429. confirmColor: "#0183FA",
  430. success: function(res) {
  431. if (res.confirm) {
  432. _this.firedeviceStart(); //启动灭火设备
  433. } else if (res.cancel) {
  434. }
  435. }
  436. });
  437. },
  438. //一键灭火弹出层关闭
  439. dialogOutfire() {
  440. this.dialogVisible = !this.dialogVisible
  441. this.clearTimer(); //关闭定时器
  442. },
  443. //取消一键灭火
  444. cancelOutfire() {
  445. this.dialogVisible = false;
  446. this.clearTimer(); //关闭定时器
  447. this.firedeviceCancel()
  448. },
  449. //倒计时
  450. sendCode() {
  451. let _this = this;
  452. _this.loading(); //启动定时器
  453. _this.timer2 = setInterval(() => {
  454. //创建定时器
  455. if (_this.countdown === 1) {
  456. _this.clearTimer(); //关闭定时器
  457. } else {
  458. _this.loading();
  459. }
  460. }, 1000);
  461. },
  462. loading() {
  463. //启动定时器
  464. this.countdown--; //定时器减1
  465. },
  466. clearTimer() {
  467. //清除定时器
  468. clearInterval(this.timer2);
  469. this.timer2 = null;
  470. this.dialogVisible = false;
  471. },
  472. //进行中倒计时
  473. sendCode2(time) {
  474. let _this = this;
  475. _this.conductCountdown=time
  476. _this.loading2(); //启动定时器
  477. _this.timer3 = setInterval(() => {
  478. //创建定时器
  479. if (_this.conductCountdown === 1) {
  480. _this.clearTimer2(); //关闭定时器
  481. _this.outfireEnd = true; //灭火倒计时结束
  482. _this.fireStartType = false; //灭火状态
  483. console.log()
  484. } else {
  485. _this.loading2();
  486. }
  487. }, 1000);
  488. },
  489. loading2() {
  490. //启动定时器
  491. this.conductCountdown--; //定时器减1
  492. },
  493. clearTimer2() {
  494. //清除定时器
  495. clearInterval(this.timer3);
  496. this.timer3 = null;
  497. },
  498. //获取楼栋数据
  499. async treeselectByUser(option) {
  500. const { data } = await getBuildOrFloorList({type:2,parentId:''})
  501. this.$set(this, 'buildingList', data.data);
  502. this.$set(this, 'buildingName', "");
  503. this.$set(this, 'buildingId', "");
  504. this.$set(this, 'deptId', "");
  505. this.$set(this, 'floorList', []);
  506. this.$set(this, 'floorName', "");
  507. this.$set(this, 'floorId', "");
  508. this.$set(this, 'fjListArray', []);
  509. this.$set(this, 'subName', "");
  510. this.$set(this, 'subId', "");
  511. },
  512. //获取楼层数据
  513. async getBuilding(buildingId) {
  514. const { data } = await getBuildOrFloorList({type:3,parentId:buildingId})
  515. this.$set(this, 'floorList', data.data);
  516. this.$set(this, 'floorName', "");
  517. this.$set(this, 'floorId', "");
  518. this.$set(this, 'fjListArray', []);
  519. this.$set(this, 'subName', "");
  520. this.$set(this, 'subId', "");
  521. },
  522. //楼栋选中
  523. buildingChange(e) {
  524. this.$set(this, 'buildingName', this.buildingList[e.detail.value].name);
  525. this.$set(this, 'buildingId', this.buildingList[e.detail.value].id);
  526. this.$set(this, 'deptId', this.buildingList[e.detail.value].id);
  527. this.getBuilding(this.buildingList[e.detail.value].id);
  528. },
  529. //楼层选中
  530. floorChange(e) {
  531. this.$set(this, 'floorName', this.floorList[e.detail.value].name);
  532. this.$set(this, 'floorId', this.floorList[e.detail.value].id);
  533. this.getBuildingData();
  534. },
  535. //实验室选择
  536. fjListChange(e) {
  537. this.$set(this, 'subName', this.fjListArray[e.detail.value].subName);
  538. this.$set(this, 'subId', this.fjListArray[e.detail.value].subId);
  539. this.$set(this.itemData, 'subjectId', this.fjListArray[e.detail.value].subId);
  540. },
  541. getAppExitLine() {
  542. let list = [{
  543. type: "lab/exit/line"
  544. }, {
  545. type: "lab/fireDevice/Warn/"
  546. }];
  547. getApp().appMqttOn(1, list);
  548. },
  549. getAppOutfire() {
  550. // let list = [{type:"lab/fireDevice/Warn/"}]
  551. let list = [{
  552. type: "lab/function/data"
  553. }];
  554. getApp().appMqttOn(1, list);
  555. },
  556. shadeTypeClick() {
  557. this.broadcastType = !this.broadcastType
  558. },
  559. //获取实验室摄像头
  560. async laboratoryInfo() {
  561. let _this = this;
  562. const {
  563. data
  564. } = await laboratoryInfo(_this.itemData.subjectId);
  565. if (data.code == 200) {
  566. let list = data.data[0];
  567. list.labHardwareVOList.forEach(function(item) {
  568. if (item.hardwareTypeEnum.enumName == 'VIDEO_MONITOR') {
  569. console.log(item.hardwareNUM)
  570. _this.videoHardwareNUM.push(item.hardwareNUM)
  571. }
  572. })
  573. this.getCameraByFloor();
  574. }
  575. },
  576. //获取楼层摄像头列表
  577. async getCameraByFloor() {
  578. let _this = this;
  579. const {
  580. data
  581. } = await getCameraByFloor({
  582. floorId: this.floorId
  583. })
  584. if (data.code == 200) {
  585. if (data.data[0]) {
  586. let list = _this.videoHardwareNUM.concat(data.data)
  587. let qc = []
  588. for (var i = 0; i < list.length - 1; i++) {
  589. for (var j = i + 1; j < list.length; j++) {
  590. if (list[i] === list[j]) {
  591. list.splice(j, 1);
  592. j--;
  593. }
  594. }
  595. }
  596. this.GetStartList(list);
  597. } else {
  598. this.GetStartList(_this.videoHardwareNUM);
  599. }
  600. }
  601. },
  602. async GetStartList(rows) {
  603. let self = this;
  604. let list = "";
  605. for (let i = 0; i < rows.length; i++) {
  606. list = list + rows[i] + ","
  607. }
  608. let obj = {
  609. page: "1",
  610. count: "100",
  611. deviceIds: list,
  612. };
  613. const {
  614. data
  615. } = await GetStartList(obj)
  616. if (data.code == 200) {
  617. let list = [];
  618. for (let i = 0; i < data.data.length; i++) {
  619. let text = uni.getStorageSync('cameraUrl');
  620. let url = data.data[i].result.body.data.hls;
  621. url = url.split("rtp/");
  622. let newUrl = text + 'rtp/' + url[1];
  623. let obj = {
  624. name: "楼道监控" + (i + 1),
  625. id: data.data[i].result.body.data.deviceID,
  626. url: newUrl,
  627. }
  628. list.push(obj)
  629. }
  630. this.urlList = list;
  631. }
  632. },
  633. //点击选择喇叭
  634. trumpetClick(index) {
  635. this.trumpetList[index].type = !this.trumpetList[index].type
  636. let _this = this;
  637. if (_this.trumpetList[index].type == true) {
  638. _this.trumpetList.forEach(function(item2) {
  639. if (item2.deviceSn == _this.trumpetList[index].deviceSn) {
  640. item2.type = true
  641. } else {
  642. item2.type = false
  643. }
  644. })
  645. }
  646. },
  647. //录制
  648. recordButton(e) {
  649. console.log("按下")
  650. let self = this;
  651. let num = 0;
  652. for (let i = 0; i < self.trumpetList.length; i++) {
  653. if (self.trumpetList[i].type) {
  654. num++
  655. }
  656. }
  657. if (num == 0) {
  658. uni.showToast({
  659. title: '请选择喇叭',
  660. icon: "none",
  661. mask: true,
  662. duration: 2000
  663. });
  664. return
  665. }
  666. this.liveType = true;
  667. console.log('录制', e)
  668. this.startPoint = e.touches[0]; //记录长按时开始点信息,后面用于计算上划取消时手指滑动的距离。
  669. const options = {
  670. duration: 10000,
  671. sampleRate: 16000,
  672. numberOfChannels: 1,
  673. encodeBitRate: 48000,
  674. format: 'mp3',
  675. frameSize: 50
  676. }
  677. this.recorderManager.start(options); //开始录音
  678. this.recorderManager.onStart(() => {
  679. console.log('recorder start')
  680. })
  681. this.recorderManager.onError((res) => {
  682. console.log(res);
  683. })
  684. wx.showToast({
  685. title: "正在录音,上划取消发送",
  686. icon: "none",
  687. duration: 60000 //先定义个60秒,后面可以手动调用wx.hideToast()隐藏
  688. });
  689. this.sendLock = false; //长按时是不上锁的。
  690. },
  691. //取消
  692. cancelButton(e) {
  693. console.log("移动")
  694. let self = this;
  695. let num = 0;
  696. for (let i = 0; i < self.trumpetList.length; i++) {
  697. if (self.trumpetList[i].type) {
  698. num++
  699. }
  700. }
  701. if (num == 0) {
  702. return
  703. }
  704. this.liveType = false;
  705. console.log('取消', e)
  706. let moveLenght = e.touches[e.touches.length - 1].clientY - this.startPoint.clientY; //移动距离
  707. if (Math.abs(moveLenght) > 50) {
  708. wx.showToast({
  709. title: "松开手指,取消发送",
  710. icon: "none",
  711. duration: 60000
  712. });
  713. this.sendLock = true; //触发了上滑取消发送,上锁
  714. } else {
  715. wx.showToast({
  716. title: "正在录音,上划取消发送",
  717. icon: "none",
  718. duration: 60000
  719. });
  720. this.sendLock = false; //上划距离不足,依然可以发送,不上锁
  721. }
  722. },
  723. //发送
  724. sendButton(e) {
  725. console.log("松开")
  726. let self = this;
  727. let num = 0;
  728. for (let i = 0; i < self.trumpetList.length; i++) {
  729. if (self.trumpetList[i].type) {
  730. num++
  731. }
  732. }
  733. if (num == 0) {
  734. return
  735. }
  736. this.liveType = false;
  737. console.log('发送', e)
  738. wx.hideToast(); //结束录音、隐藏Toast提示框
  739. this.recorderManager.stop(); //结束录音
  740. this.recorderManager.onStop((res) => {
  741. if (!this.sendLock) {
  742. console.log('1', this.recorderManager)
  743. this.uploadImg(res.tempFilePath);
  744. }
  745. console.log('停止录音', res.tempFilePath)
  746. console.log("sendLock", this.sendLock);
  747. })
  748. },
  749. //上传MP3
  750. async uploadImg(tempFilePaths) {
  751. var self = this;
  752. uni.uploadFile({
  753. url: config.base_url + '/file/upload', //仅为示例,非真实的接口地址
  754. header: {
  755. 'Authorization': uni.getStorageSync('token')
  756. },
  757. filePath: tempFilePaths,
  758. name: 'file',
  759. formData: {
  760. 'user': 'test'
  761. },
  762. success: (uploadFileRes) => {
  763. let res = JSON.parse(uploadFileRes.data);
  764. if (res.code == 200) {
  765. console.log("上传成功", res)
  766. self.textParseUrlIps(config.base_url + '/' + res.data.url);
  767. } else {
  768. uni.showToast({
  769. title: res.msg,
  770. icon: "none",
  771. mask: true,
  772. duration: 2000
  773. });
  774. }
  775. },
  776. fail: err => {
  777. uni.hideLoading()
  778. },
  779. complete: () => {}
  780. });
  781. },
  782. //发送语音
  783. async textParseUrlIps(text) {
  784. let self = this;
  785. let newList = [];
  786. for (let i = 0; i < self.trumpetList.length; i++) {
  787. if (self.trumpetList[i].type) {
  788. let obj = {
  789. sn: self.trumpetList[i].deviceSn,
  790. port: self.trumpetList[i].port,
  791. deviceIp: self.trumpetList[i].deviceIp,
  792. type: "",
  793. name: "",
  794. speed: "",
  795. params: {
  796. tid: "",
  797. vol: self.trumpetList[i].deviceVol,
  798. urls: []
  799. }
  800. };
  801. newList.push(obj);
  802. }
  803. }
  804. const {
  805. data
  806. } = await textParseUrlIps(newList, text)
  807. if (data.code == 200) {
  808. uni.showToast({
  809. title: '发送成功',
  810. icon: "none",
  811. mask: true,
  812. duration: 2000
  813. });
  814. }
  815. },
  816. //监听应急疏散数据变更
  817. getMqttLineData(val) {
  818. console.log('收到疏散MQTT')
  819. let self = this;
  820. if (val.EXIT_LINE_MESSAGE) {
  821. console.log('数据改变')
  822. this.evacuate();
  823. } else {
  824. console.log('应急疏散已结束')
  825. uni.showToast({
  826. title: '应急疏散已结束',
  827. icon: "none",
  828. mask: true,
  829. duration: 2000
  830. });
  831. setTimeout(function() {
  832. uni.navigateBack();
  833. }, 2000);
  834. }
  835. },
  836. /* 确认 */
  837. confirmBtn() {
  838. if (!this.subId) {
  839. uni.showToast({
  840. title: '请选择实验室',
  841. icon: "none",
  842. mask: true,
  843. duration: 2000
  844. });
  845. return
  846. }
  847. this.$set(this,'address',this.buildingName + '' + this.floorName);
  848. this.$set(this,'pageType',2);
  849. this.getDeviceList();
  850. this.laboratoryInfo();
  851. this.firedeviceStatus();
  852. },
  853. //执行疏散
  854. async lineEvacuate() {
  855. if (!this.subId) {
  856. uni.showToast({
  857. title: '请选择实验室',
  858. icon: "none",
  859. mask: true,
  860. duration: 2000
  861. });
  862. return
  863. }
  864. if (!this.buttonArrayIndex) {
  865. uni.showToast({
  866. title: '请选择疏散路线',
  867. icon: "none",
  868. mask: true,
  869. duration: 2000
  870. });
  871. return
  872. }
  873. const {
  874. data
  875. } = await lineEvacuate(this.subId, this.buttonArray[this.buttonArrayIndex].id)
  876. if (data.code == 200) {
  877. if (data.data) {
  878. console.log('执行疏散')
  879. this.initialization(data.data);
  880. }
  881. }
  882. },
  883. //获取喇叭列表
  884. async getDeviceList() {
  885. let obj = {
  886. subId: this.itemData.subjectId,
  887. floorId: this.floorId,
  888. page: 1,
  889. pageSize: 100,
  890. };
  891. const {
  892. data
  893. } = await getDeviceListBySub(obj)
  894. if (data.code == 200) {
  895. for (let i = 0; i < data.data.length; i++) {
  896. data.data[i].type = false;
  897. }
  898. this.$set(this, 'trumpetList', data.data)
  899. }
  900. },
  901. //摄像头切换
  902. scrollBoxClick(index) {
  903. this.videoIndex = index;
  904. },
  905. /*新疏散相关接口*/
  906. //地图数据
  907. async getBuildingData() {
  908. let self = this;
  909. const {
  910. data
  911. } = await getFloorData(this.floorId)
  912. console.log('data', data)
  913. if (data.code == 200) {
  914. if (data.data.buildFloorLayoutVoList[0]) {
  915. let list = JSON.parse(data.data.labExitLineVertex.layoutJoinData)
  916. this.zoomCalculate(list, 348, 668);
  917. for (let i = 0; i < list.length; i++) {
  918. if (list[i].type == '2') {
  919. //楼道
  920. for (let o = 0; o < list[i].lightList.length; o++) {
  921. list[i].lightList[o].openType = false;
  922. }
  923. } else if (list[i].type == '1') {
  924. for (let o = 0; o < data.data.buildFloorLayoutVoList.length; o++) {
  925. if (list[i].key == data.data.buildFloorLayoutVoList[o].pointName) {
  926. list[i].id = data.data.buildFloorLayoutVoList[o].id;
  927. list[i].buildId = data.data.buildFloorLayoutVoList[o].buildId;
  928. list[i].floorId = data.data.buildFloorLayoutVoList[o].floorId;
  929. list[i].roomType = data.data.buildFloorLayoutVoList[o].roomType;
  930. list[i].roomName = data.data.buildFloorLayoutVoList[o].roomName;
  931. list[i].roomNum = data.data.buildFloorLayoutVoList[o].roomNum;
  932. list[i].subName = data.data.buildFloorLayoutVoList[o].subName;
  933. list[i].subId = data.data.buildFloorLayoutVoList[o].subId;
  934. list[i].online = data.data.buildFloorLayoutVoList[o].online;
  935. list[i].loginAdmin = data.data.buildFloorLayoutVoList[o].loginAdmin;
  936. list[i].policeType = false;
  937. }
  938. }
  939. } else if (list[i].type == 3) {
  940. list[i].roomCheckType = false;
  941. }
  942. }
  943. let subList = [];
  944. for (let o = 0; o < data.data.buildFloorLayoutVoList.length; o++) {
  945. if(data.data.buildFloorLayoutVoList[o].loginAdmin){
  946. subList.push(data.data.buildFloorLayoutVoList[o])
  947. }
  948. }
  949. this.$set(this,'fjListArray', subList);
  950. this.$set(this, 'mapList', JSON.parse(JSON.stringify(list)));
  951. // this.$set(this, 'shadeMapList', JSON.parse(JSON.stringify(list)));
  952. this.$set(this, 'mapType', true);
  953. setTimeout(function() {
  954. self.getRedisEvacuation();
  955. }, 500);
  956. }
  957. }
  958. },
  959. //获取疏散数据
  960. async getRedisEvacuation() {
  961. let self = this;
  962. let obj = {
  963. buildId: this.buildingId,
  964. floorId: this.floorId,
  965. }
  966. const {
  967. data
  968. } = await getRedisEvacuation(obj)
  969. if (data.code == 200) {
  970. if (data.data.doorPointNames) {
  971. for (let o = 0; o < self.mapList.length; o++) {
  972. if (self.mapList[o].type == 2) {
  973. for (let x = 0; x < self.mapList[o].lightList.length; x++) {
  974. let num = 0;
  975. for (let i = 0; i < data.data.lightPointSet.length; i++) {
  976. if (data.data.lightPointSet[i]) { //处理后端返回的异常的NULL
  977. if (self.mapList[o].lightList[x].key == data.data.lightPointSet[i].key) {
  978. num++
  979. }
  980. }
  981. }
  982. console.log('灯',num)
  983. self.mapList[o].lightList[x].openType = num != 0;
  984. }
  985. }
  986. }
  987. for (let i = 0; i < data.data.doorPointNames.length; i++) {
  988. for (let o = 0; o < self.mapList.length; o++) {
  989. if (self.mapList[o].type == 3) {
  990. if (data.data.doorPointNames[i] == self.mapList[o].key) {
  991. self.mapList[o].roomCheckType = true;
  992. }
  993. }
  994. }
  995. }
  996. this.$forceUpdate();
  997. }
  998. };
  999. },
  1000. //缩放计算
  1001. zoomCalculate(list, height, width) {
  1002. let maxWidth = 0
  1003. let maxHeight = 0
  1004. let zoomData = 1;
  1005. for (let i = 0; i < list.length; i++) {
  1006. if ((list[i].x + list[i].w) > maxWidth) {
  1007. maxWidth = list[i].x + list[i].w
  1008. }
  1009. if ((list[i].y + list[i].h) > maxHeight) {
  1010. maxHeight = list[i].y + list[i].h
  1011. }
  1012. }
  1013. //处理等值数据
  1014. if(maxHeight == height){
  1015. maxHeight--
  1016. }
  1017. if(maxWidth == width){
  1018. maxWidth--
  1019. }
  1020. this.$set(this, 'mapWidth', maxWidth);
  1021. this.$set(this, 'mapHeight', maxHeight);
  1022. //缩放判断
  1023. if(maxHeight>height&&maxWidth>width){
  1024. if((maxHeight-height)>(maxWidth-width)){
  1025. zoomData = height/maxHeight;
  1026. this.$set(this,'zoomData',height/maxHeight);
  1027. }else{
  1028. zoomData = width / maxWidth;
  1029. this.$set(this,'zoomData',width / maxWidth);
  1030. }
  1031. }else if(maxHeight<height&&maxWidth<width){
  1032. if((height-maxHeight)>(width-maxWidth)){
  1033. zoomData = width / maxWidth;
  1034. this.$set(this,'zoomData',width / maxWidth);
  1035. }else{
  1036. zoomData = height / maxHeight;
  1037. this.$set(this,'zoomData',height / maxHeight);
  1038. }
  1039. }else if(maxHeight<height&&maxWidth>width){
  1040. zoomData = width / maxWidth;
  1041. this.$set(this,'zoomData',width / maxWidth);
  1042. }else if(maxHeight>height&&maxWidth<width){
  1043. zoomData = height / maxHeight;
  1044. this.$set(this,'zoomData',height / maxHeight);
  1045. }
  1046. },
  1047. //结束疏散
  1048. evacuationButton() {
  1049. let self = this;
  1050. uni.showModal({
  1051. content: '确认'+(this.isEvacuate?'执行':'结束')+'疏散吗?',
  1052. cancelColor: "#999",
  1053. confirmColor: "#0183FA",
  1054. success: function(res) {
  1055. if (res.confirm) {
  1056. if(self.isEvacuate){
  1057. self.executeEvacuation();
  1058. }else{
  1059. self.endEvacuation();
  1060. }
  1061. console.log('用户点击确定');
  1062. } else if (res.cancel) {
  1063. console.log('用户点击取消');
  1064. }
  1065. }
  1066. });
  1067. },
  1068. //开始疏散
  1069. async executeEvacuation(){
  1070. let self = this;
  1071. let doorPointNames = [];
  1072. for(let i=0;i<self.mapList.length;i++){
  1073. if(self.mapList[i].type == 3){
  1074. doorPointNames.push(self.mapList[i].key)
  1075. }
  1076. }
  1077. let obj = {
  1078. buildId:this.buildingId,
  1079. floorId:this.floorId,
  1080. subId: this.subId,
  1081. badPointNames:[],
  1082. doorPointNames:doorPointNames,
  1083. }
  1084. const { data } = await executeEvacuation(obj)
  1085. console.log('data', data)
  1086. if (data.code == 200) {
  1087. this.$set(this,'isEvacuate',false);
  1088. uni.showToast({
  1089. title: '执行成功',
  1090. icon: "none",
  1091. mask: true,
  1092. duration: 2000
  1093. });
  1094. }
  1095. },
  1096. //结束疏散
  1097. async endEvacuation(){
  1098. let self = this;
  1099. let obj = {
  1100. buildId:this.buildingId,
  1101. floorId:this.floorId,
  1102. }
  1103. const { data } = await endEvacuation(obj)
  1104. console.log('data', data)
  1105. if (data.code == 200) {
  1106. this.$set(this,'isEvacuate',true);
  1107. uni.showToast({
  1108. title: '执行成功',
  1109. icon: "none",
  1110. mask: true,
  1111. duration: 2000
  1112. });
  1113. }
  1114. },
  1115. /*MQTT*/
  1116. //订阅
  1117. onMQTT() {
  1118. let self = this;
  1119. const mqttOptions = {
  1120. keepalive: 30,
  1121. clean: true, //保留会话
  1122. connectTimeout: 60000, // 超时时间
  1123. reconnectPeriod: 5000, // 重连间隔
  1124. clientId: uni.getStorageSync('token') + 'lab/function/data',
  1125. username: uni.getStorageSync('mqttUrl'),
  1126. password: uni.getStorageSync('mqttUrl'),
  1127. }
  1128. const connectUrl = uni.getStorageSync('mqttUrl');
  1129. self.floorClient = $mqtt.connect('wxs://' + connectUrl, mqttOptions);
  1130. self.floorClient.on('connect', () => {
  1131. self.floorClient.subscribe(self.evacuationTopic + self.floorId, (err) => {
  1132. if (!err) {
  1133. console.log("疏散-订阅成功", )
  1134. self.getBuildingData();
  1135. }
  1136. });
  1137. self.floorClient.subscribe(self.fireTopic+self.fireCode, (err) => {
  1138. if (!err) {
  1139. console.log("火灾传感器状态-订阅成功:" + self.fireTopic+self.fireCode);
  1140. }
  1141. });
  1142. self.floorClient.subscribe(self.fireOnlineTopic+self.fireCode, (err) => {
  1143. if (!err) {
  1144. console.log("火灾设备是否在线-订阅成功:" + self.fireOnlineTopic+self.fireCode);
  1145. }
  1146. });
  1147. self.floorClient.subscribe(self.firePerformTopic+self.fireCode, (err) => {
  1148. if (!err) {
  1149. console.log("火灾是否正在执行灭火操作-订阅成功:" + self.firePerformTopic+self.fireCode);
  1150. }
  1151. });
  1152. });
  1153. // 自动重连
  1154. this.floorClient.on('reconnect', (msg) => {
  1155. console.log('自动重连-reconnect-1', msg)
  1156. });
  1157. // 错误
  1158. this.floorClient.on('error', () => {
  1159. console.log('错误-error-1')
  1160. });
  1161. // 断开
  1162. this.floorClient.on('end', () => {
  1163. console.log('断开-end-1')
  1164. });
  1165. // 掉线
  1166. this.floorClient.on('offline', (msg) => {
  1167. console.log('掉线-offline-1', msg)
  1168. });
  1169. // 收到消息
  1170. this.floorClient.on('message', (topic, message) => {
  1171. let data = JSON.parse(message)
  1172. console.log(data)
  1173. if (data) {
  1174. if (topic == (this.evacuationTopic + this.floorId)) {
  1175. console.log('疏散通知', data)
  1176. //疏散消息
  1177. if (data.data == 'FLOOR_EXITLINE') {
  1178. this.getRedisEvacuation();
  1179. } else if (data.data == 'FLOOR_OVER_EXITLINE') {
  1180. uni.showToast({
  1181. title: '疏散已结束',
  1182. icon: "none",
  1183. mask: true,
  1184. duration: 2000
  1185. });
  1186. setTimeout(function() {
  1187. self.getBuildingData();
  1188. }, 2000);
  1189. }
  1190. }else if(topic == (self.fireTopic + self.fireCode)){
  1191. //传感器状态
  1192. console.log('传感器状态');
  1193. self.firedeviceStatus();
  1194. }else if(topic == (self.fireOnlineTopic + self.fireCode)){
  1195. //设备在线状态
  1196. console.log('设备在线状态');
  1197. }else if(topic == (self.firePerformTopic + self.fireCode)){
  1198. console.log('灭火中')
  1199. //灭火执行操作
  1200. if(data.fireStatus == 1){
  1201. if(!self.fireStartType){
  1202. self.$set(self,'fireStartType',true);
  1203. self.$set(self,'fireListType',false);
  1204. self.sendCode2(data.direTime);
  1205. }else if(data.fireStatus == 0){
  1206. self.msgError('一键灭火启动失败')
  1207. }
  1208. }
  1209. }
  1210. }
  1211. });
  1212. // 全局监听是否有关闭mqtt的消息的事件
  1213. uni.$on('closeMqtt', () => {
  1214. this.floorClient.end(true); // 主动断开连接
  1215. })
  1216. },
  1217. //关闭MQTT连接
  1218. offMQTT(type) {
  1219. let self = this;
  1220. if (this.floorClient.unsubscribe) {
  1221. this.floorClient.unsubscribe(this.evacuationTopic + this.floorId, error => {
  1222. if (error) {
  1223. console.log('疏散连接-关闭错误', error)
  1224. }
  1225. });
  1226. if(self.fireCode){
  1227. this.floorClient.unsubscribe(self.fireTopic+self.fireCode, error => {
  1228. if (error) {
  1229. console.log('火灾传感器状态-MQTT断开报错=>', error)
  1230. }
  1231. })
  1232. this.floorClient.unsubscribe(self.fireOnlineTopic+self.fireCode, error => {
  1233. if (error) {
  1234. console.log('火灾设备是否在线-MQTT断开报错=>', error)
  1235. }
  1236. })
  1237. this.floorClient.unsubscribe(self.firePerformTopic+self.fireCode, error => {
  1238. if (error) {
  1239. console.log('火灾是否正在执行灭火操作-MQTT断开报错=>', error)
  1240. }
  1241. })
  1242. }
  1243. this.floorClient.end(true);
  1244. this.$set(this, 'floorClient', {});
  1245. }
  1246. if (type) {
  1247. this.onMQTT();
  1248. }
  1249. },
  1250. },
  1251. beforeDestroy() {
  1252. this.offMQTT();
  1253. //断开mqtt连接
  1254. // getApp().offMQTT();
  1255. //删除应急疏散监听
  1256. // getApp().deleteLineData();
  1257. }
  1258. }
  1259. </script>
  1260. <style lang="stylus" scoped>
  1261. #emergencyEvacuationBig {
  1262. height: 100%;
  1263. width: 100%;
  1264. display: flex;
  1265. flex-direction: column;
  1266. overflow-y: scroll;
  1267. .setUpEvacuation {
  1268. flex: 1;
  1269. display: flex;
  1270. flex-direction: column;
  1271. overflow-y: scroll;
  1272. .evacuation-max-box {
  1273. width: 710rpx;
  1274. margin: 20rpx 20rpx;
  1275. background: #fff;
  1276. border-radius: 20rpx;
  1277. padding: 20rpx 0;
  1278. .picker-max-box {
  1279. .picker-title-box {
  1280. padding: 0 20rpx;
  1281. display: flex;
  1282. view {
  1283. line-height: 80rpx;
  1284. font-size: 28rpx;
  1285. }
  1286. view:nth-child(1) {
  1287. color: red;
  1288. }
  1289. view:nth-child(2) {}
  1290. view:nth-child(3) {
  1291. color: #999;
  1292. }
  1293. }
  1294. .picker-min-box {
  1295. display: flex;
  1296. height: 80rpx;
  1297. width: 667rpx;
  1298. border: 1rpx solid #a2a2a2;
  1299. border-radius: 10rpx;
  1300. margin: 0 20rpx;
  1301. view {
  1302. flex: 1;
  1303. line-height: 80rpx;
  1304. padding: 0 20rpx;
  1305. color: #999;
  1306. font-size: 28rpx;
  1307. overflow: hidden;
  1308. }
  1309. img {
  1310. width: 24rpx;
  1311. height: 12rpx;
  1312. margin: 35rpx 23rpx;
  1313. }
  1314. }
  1315. }
  1316. }
  1317. }
  1318. .implementEvacuation {
  1319. flex: 1;
  1320. display: flex;
  1321. flex-direction: column;
  1322. overflow-y: scroll;
  1323. .evacuation-max-box {
  1324. width: 710rpx;
  1325. margin: 20rpx 20rpx;
  1326. /* background #fff */
  1327. border-radius: 20rpx;
  1328. padding: 20rpx 0 30rpx;
  1329. .evacuation-title-box {
  1330. // height:150rpx;
  1331. //border-bottom:1rpx solid #dedede;
  1332. background: #FFFFFF;
  1333. border-radius: 20rpx;
  1334. padding: 34rpx 22rpx;
  1335. box-sizing: border-box;
  1336. .evacuation-title-name-box {
  1337. font-size: 30rpx;
  1338. font-family: PingFang SC;
  1339. font-weight: 500;
  1340. color: #333333;
  1341. line-height: 30rpx;
  1342. }
  1343. .site {
  1344. font-size: 28rpx;
  1345. font-family: PingFang SC;
  1346. font-weight: 500;
  1347. color: #999999;
  1348. line-height: 30rpx;
  1349. margin-top: 32rpx;
  1350. display: flex;
  1351. justify-content: flex-start;
  1352. align-items: center;
  1353. >img {
  1354. width: 28rpx;
  1355. height: 30rpx;
  1356. margin-right: 18rpx;
  1357. }
  1358. }
  1359. }
  1360. /* 一键灭火 */
  1361. .outfire {
  1362. width: 710rpx;
  1363. height: 80rpx;
  1364. background: #FFFFFF;
  1365. border-radius: 20rpx;
  1366. margin: 20rpx 0;
  1367. padding: 0 10rpx;
  1368. box-sizing: border-box;
  1369. display: flex;
  1370. justify-content: space-between;
  1371. align-items: center;
  1372. .outfire_li {
  1373. display: flex;
  1374. justify-content: flex-start;
  1375. align-items: center;
  1376. >img {
  1377. width: 24rpx;
  1378. height: 30rpx;
  1379. margin-right: 12rpx;
  1380. }
  1381. .normal {
  1382. font-size: 24rpx;
  1383. font-family: PingFang SC;
  1384. font-weight: 500;
  1385. color: #333333;
  1386. }
  1387. .abnormal {
  1388. font-size: 24rpx;
  1389. font-family: PingFang SC;
  1390. font-weight: 500;
  1391. color: #F11C00;
  1392. }
  1393. }
  1394. .outfire_li:nth-of-type(1) {
  1395. >img {
  1396. width: 30rpx;
  1397. height: 28rpx;
  1398. margin-right: 12rpx;
  1399. }
  1400. }
  1401. .outfire_yes_btn {
  1402. width: 120rpx;
  1403. height: 40rpx;
  1404. font-size: 24rpx;
  1405. font-family: PingFang SC;
  1406. font-weight: 500;
  1407. color: #F21C00;
  1408. line-height: 40rpx;
  1409. border: 1px solid #F21C00;
  1410. border-radius: 8rpx;
  1411. text-align: center;
  1412. margin-left: 54rpx;
  1413. }
  1414. .outfire_no_btn {
  1415. width: 120rpx;
  1416. height: 40rpx;
  1417. font-size: 24rpx;
  1418. font-family: PingFang SC;
  1419. font-weight: 500;
  1420. color: #CCCCCC;
  1421. line-height: 40rpx;
  1422. border: 1px solid #E0E0E0;
  1423. border-radius: 8rpx;
  1424. text-align: center;
  1425. margin-left: 54rpx;
  1426. }
  1427. }
  1428. .evacuation-scroll-box {
  1429. height: 95rpx;
  1430. overflow-x: scroll;
  1431. overflow-y: hidden;
  1432. white-space: nowrap;
  1433. margin: 0 20rpx;
  1434. view {
  1435. line-height: 95rpx;
  1436. font-size: 28rpx;
  1437. display: inline-block;
  1438. margin-right: 45rpx;
  1439. }
  1440. .scroll-box-color {
  1441. color: #0183FA;
  1442. }
  1443. }
  1444. .evacuation-video-box {
  1445. width: 668rpx;
  1446. height: 341rpx;
  1447. margin: 0 auto;
  1448. position: relative;
  1449. video {
  1450. position: absolute;
  1451. top: 0;
  1452. left: 0;
  1453. width: 668rpx;
  1454. height: 341rpx;
  1455. margin: 0 auto;
  1456. }
  1457. .video-a {
  1458. z-index: 100;
  1459. }
  1460. .video-b {
  1461. z-index: 0;
  1462. }
  1463. }
  1464. /* 路线图 */
  1465. .roadmap {
  1466. width: 710rpx;
  1467. height: 464rpx;
  1468. background: #FFFFFF;
  1469. border-radius: 20rpx;
  1470. padding: 20rpx 20rpx 0;
  1471. box-sizing: border-box;
  1472. margin-top: 20rpx;
  1473. .roadmap_t {
  1474. font-size: 30rpx;
  1475. font-family: PingFang SC;
  1476. font-weight: 500;
  1477. color: #333333;
  1478. line-height: 30rpx;
  1479. display: flex;
  1480. .monito_li_r_l {
  1481. flex: 1;
  1482. line-height: 61rpx;
  1483. font-size: 28rpx;
  1484. }
  1485. .monito_li_r_r_button {
  1486. width: 100rpx;
  1487. text-align: center;
  1488. line-height: 61rpx;
  1489. font-size: 28rpx;
  1490. color: #0183FA;
  1491. }
  1492. .monito_li_r {
  1493. width: 380rpx;
  1494. font-size: 24rpx;
  1495. font-family: PingFang SC;
  1496. font-weight: 500;
  1497. color: #0183FA;
  1498. line-height: 80rpx;
  1499. display: flex;
  1500. justify-content: flex-end;
  1501. align-items: center;
  1502. >img {
  1503. width: 9rpx;
  1504. height: 22rpx;
  1505. margin-left: 20rpx;
  1506. }
  1507. .evacuation-title-button-box {
  1508. display: flex;
  1509. overflow: hidden;
  1510. view {
  1511. line-height: 61rpx;
  1512. font-size: 28rpx;
  1513. }
  1514. .colorA {
  1515. color: #0183FA;
  1516. }
  1517. .colorB {
  1518. color: #0183FA;
  1519. }
  1520. img {
  1521. margin: 28rpx 20rpx 0;
  1522. width: 24rpx;
  1523. height: 9rpx;
  1524. }
  1525. }
  1526. }
  1527. }
  1528. .evacuation-map-box {
  1529. width: 668rpx;
  1530. height: 348rpx;
  1531. margin: 0 auto;
  1532. overflow: hidden;
  1533. border: 1rpx solid #E0E0E0;
  1534. margin-top: 20rpx;
  1535. position: relative;
  1536. .emergencyEvacuationBigFullScreen-page {
  1537. // overflow: scroll;
  1538. overflow: hidden;
  1539. position: absolute;
  1540. top: 50%;
  1541. left: 50%;
  1542. .map-max-box {
  1543. position: relative;
  1544. .map-max-for-box {
  1545. position: absolute;
  1546. display: flex;
  1547. flex-direction: column;
  1548. .map-max-for-min-box {
  1549. position: relative;
  1550. .position-box {
  1551. position: absolute;
  1552. }
  1553. .map-for-name-p {
  1554. padding: 0 10rpx;
  1555. height: 20rpx;
  1556. line-height: 20rpx;
  1557. font-size: 14rpx;
  1558. text-align: center;
  1559. color: #333;
  1560. overflow: hidden;
  1561. text-overflow: ellipsis;
  1562. white-space: nowrap;
  1563. }
  1564. .map-for-num-p {
  1565. padding: 0 10rpx;
  1566. height: 20rpx;
  1567. line-height: 20rpx;
  1568. font-size: 14rpx;
  1569. text-align: center;
  1570. color: #333;
  1571. overflow: hidden;
  1572. text-overflow: ellipsis;
  1573. white-space: nowrap;
  1574. }
  1575. .center-move-door-p-t {
  1576. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1577. background-size: 100% !important;
  1578. transform: rotate(180deg);
  1579. }
  1580. .center-move-door-p-b {
  1581. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1582. background-size: 100% !important;
  1583. }
  1584. .center-move-door-p-l {
  1585. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1586. background-size: 100% !important;
  1587. transform: rotate(90deg);
  1588. }
  1589. .center-move-door-p-r {
  1590. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1591. background-size: 100% !important;
  1592. transform: rotateZ(270deg);
  1593. }
  1594. .lightTopOn {
  1595. background: url("../images/evacuation3_2//icon_sjt.png");
  1596. background-size: 100%;
  1597. }
  1598. .lightTopOff {
  1599. background: url("../images/evacuation3_2//icon_shang_hs.png");
  1600. background-size: 100%;
  1601. }
  1602. .lightBottomOn {
  1603. background: url("../images/evacuation3_2//icon_xjt.png");
  1604. background-size: 100%;
  1605. }
  1606. .lightBottomOff {
  1607. background: url("../images/evacuation3_2//icon_xia_hs.png");
  1608. background-size: 100%;
  1609. }
  1610. .lightLeftOn {
  1611. background: url("../images/evacuation3_2//icon_zuo.png");
  1612. background-size: 100%;
  1613. }
  1614. .lightLeftOff {
  1615. background: url("../images/evacuation3_2//icon_zou_hs.png");
  1616. background-size: 100%;
  1617. }
  1618. .lightRightOn {
  1619. background: url("../images/evacuation3_2//icon_yuo.png");
  1620. background-size: 100%;
  1621. }
  1622. .lightRightOff {
  1623. background: url("../images/evacuation3_2//icon_you_hs.png");
  1624. background-size: 100%;
  1625. }
  1626. }
  1627. }
  1628. .for-map-box {
  1629. border: 2rpx solid #fff;
  1630. background: #CEF2FD;
  1631. }
  1632. .for-map-box-one {
  1633. background: #CEFDD5;
  1634. }
  1635. .for-map-box-two {
  1636. background: url("../images/evacuation3_2/icon_yjtd.png") center center no-repeat #006400;
  1637. background-size: 60rpx 60rpx;
  1638. }
  1639. .for-map-box-two-check {
  1640. background: url("../images/evacuation3_2/icon_yjtd.png") center center no-repeat rgba(50, 205, 50, 1);
  1641. background-size: 80rpx 80rpx;
  1642. }
  1643. .room-type-one {
  1644. //选中
  1645. background: rgba(178, 235, 255, 1);
  1646. }
  1647. .room-type-two {
  1648. //报警
  1649. background: rgba(232, 0, 0, 0.4);
  1650. box-shadow: 0 0 10rpx 1rpx #E80000 inset;
  1651. }
  1652. .room-type-three {
  1653. //选中报警
  1654. background: rgba(178, 235, 255, 1);
  1655. box-shadow: 0 0 10rpx 1rpx #E80000 inset;
  1656. }
  1657. }
  1658. }
  1659. }
  1660. }
  1661. .video-max-box {
  1662. width: 710rpx;
  1663. height: 780rpx;
  1664. overflow-y: scroll;
  1665. background: #FFFFFF;
  1666. border-radius: 20rpx;
  1667. padding: 22rpx 30rpx 30rpx;
  1668. box-sizing: border-box;
  1669. margin-top: 20rpx;
  1670. margin-bottom: 120rpx;
  1671. video {
  1672. width: 645rpx;
  1673. height: 355rpx;
  1674. }
  1675. }
  1676. .bottom-button-box {
  1677. position: absolute;
  1678. bottom: 20rpx;
  1679. display: flex;
  1680. width: 670rpx;
  1681. margin: 20rpx;
  1682. view {
  1683. width: 335rpx;
  1684. height: 100rpx;
  1685. line-height: 100rpx;
  1686. text-align: center;
  1687. color: #fff;
  1688. font-size: 28rpx;
  1689. }
  1690. view:nth-child(1) {
  1691. border-top-left-radius: 50rpx;
  1692. border-bottom-left-radius: 50rpx;
  1693. background: #FF9C00;
  1694. }
  1695. view:nth-child(2) {
  1696. border-top-right-radius: 50rpx;
  1697. border-bottom-right-radius: 50rpx;
  1698. background: #0183FA;
  1699. }
  1700. }
  1701. }
  1702. .live-button {
  1703. width: 650rpx;
  1704. height: 100rpx;
  1705. line-height: 100rpx;
  1706. text-align: center;
  1707. font-size: 28rpx;
  1708. margin: 50rpx auto 0;
  1709. border-radius: 20rpx;
  1710. }
  1711. .live-color-a {
  1712. color: #fff;
  1713. background: #FF8686;
  1714. }
  1715. .live-color-b {
  1716. color: #fff;
  1717. background: #25C95B;
  1718. }
  1719. /* 语音广播 */
  1720. .shade-max-big-box {
  1721. height: 100%;
  1722. width: 100%;
  1723. position: fixed;
  1724. display: flex;
  1725. flex-direction: column;
  1726. z-index: 10;
  1727. background: rgba(0, 0, 0, 0.2);
  1728. .null-box {
  1729. flex: 1;
  1730. }
  1731. /* 语音广播-执行疏散 */
  1732. .broadcast {
  1733. width: 100%;
  1734. // height: 532rpx;
  1735. background: #FFFFFF;
  1736. border-top-left-radius: 20rpx;
  1737. border-top-right-radius: 20rpx;
  1738. padding:22rpx 30rpx 30rpx;
  1739. box-sizing: border-box;
  1740. margin-top: 20rpx;
  1741. .broadcast_t {
  1742. font-size: 30rpx;
  1743. font-family: PingFang SC;
  1744. font-weight: 500;
  1745. color: #333333;
  1746. line-height: 30rpx;
  1747. >label {
  1748. font-size: 24rpx;
  1749. font-family: PingFang SC;
  1750. font-weight: 500;
  1751. color: #999999;
  1752. line-height: 30rpx;
  1753. margin-left: 16rpx;
  1754. }
  1755. }
  1756. .trumpet-max-box {
  1757. display: flex;
  1758. justify-content: flex-start;
  1759. margin-top: 22rpx;
  1760. flex-wrap: wrap;
  1761. .trumpet-for-box {
  1762. display: inline-block;
  1763. width: 200rpx;
  1764. height: 60rpx;
  1765. line-height: 60rpx;
  1766. font-size: 24rpx;
  1767. text-align: center;
  1768. cursor: pointer;
  1769. overflow: hidden;
  1770. border: 1rpx solid #E0E0E0;
  1771. border-radius: 10rpx;
  1772. color: #E0E0E0;
  1773. display: flex;
  1774. justify-content: center;
  1775. margin-right: 20rpx;
  1776. margin-bottom: 10rpx;
  1777. >img {
  1778. width: 36rpx;
  1779. height: 34rpx;
  1780. margin: 12rpx 20rpx 0 25rpx;
  1781. }
  1782. }
  1783. .trumpet-color-a {
  1784. border: 1px solid #0183FA;
  1785. color: #0183FA;
  1786. }
  1787. .trumpet-color-b {
  1788. border: 1px solid #CCCCCC;
  1789. color: #999;
  1790. }
  1791. }
  1792. .broadcast_m {
  1793. width: 100%;
  1794. .broadcast_m_t {
  1795. width: 142rpx;
  1796. height: 142rpx;
  1797. margin: 30rpx 0 0 258rpx;
  1798. position: relative;
  1799. font-size: 24rpx;
  1800. font-family: PingFang SC;
  1801. font-weight: 500;
  1802. line-height: 170rpx;
  1803. text-align: center;
  1804. >img {
  1805. width: 142rpx;
  1806. height: 142rpx;
  1807. position: absolute;
  1808. }
  1809. >label {
  1810. width: 100%;
  1811. font-size: 24rpx;
  1812. font-family: PingFang SC;
  1813. font-weight: 500;
  1814. color: #0183FA;
  1815. line-height: 24rpx;
  1816. display: inline-block;
  1817. text-align: center;
  1818. position: absolute;
  1819. top: 76rpx;
  1820. }
  1821. /* 按下 */
  1822. .press_color {
  1823. color: #FFFFFF;
  1824. }
  1825. /* 松开 */
  1826. .slip_color {
  1827. color: #0183FA;
  1828. }
  1829. }
  1830. .broadcast_m_t_back_a {
  1831. background: url(@/images/icon_sskz_skfs.png);
  1832. background-size: 100%;
  1833. color: #FFFFFF;
  1834. }
  1835. .broadcast_m_t_back_b {
  1836. background: url(@/images/icon_sskz_azsh.png);
  1837. background-size: 100%;
  1838. color: #0183FA;
  1839. }
  1840. .broadcast_m_b {
  1841. font-size: 24rpx;
  1842. font-family: PingFang SC;
  1843. font-weight: 500;
  1844. color: #999999;
  1845. line-height: 24rpx;
  1846. text-align: center;
  1847. margin-top: 14rpx;
  1848. }
  1849. }
  1850. /* 疏散按钮 */
  1851. .evacuation-button-box {
  1852. width: 650rpx;
  1853. height: 100rpx;
  1854. background: #0183FA;
  1855. color: #fff;
  1856. text-align center;
  1857. line-height: 100rpx;
  1858. font-size: 28rpx;
  1859. margin: 88rpx auto 0;
  1860. border-radius: 20rpx;
  1861. }
  1862. }
  1863. }
  1864. /* 一键灭火 */
  1865. .shade-outfire {
  1866. height: 100%;
  1867. width: 100%;
  1868. position: fixed;
  1869. display: flex;
  1870. flex-direction: column;
  1871. z-index: 10;
  1872. background: rgba(0, 0, 0, 0.2);
  1873. .null-box {
  1874. flex: 1;
  1875. }
  1876. /* 语音广播-执行疏散 */
  1877. .shade-outfire-n {
  1878. width: 625rpx;
  1879. height: 450rpx;
  1880. background: #FFFFFF;
  1881. border-radius: 20rpx;
  1882. position: absolute;
  1883. top: 370rpx;
  1884. left: 62rpx;
  1885. .shade-outfire-n-t {
  1886. width: 172rpx;
  1887. height: 172rpx;
  1888. margin: 38rpx 0 0 226rpx;
  1889. }
  1890. .shade-outfire-n-m {
  1891. font-size: 30rpx;
  1892. font-family: PingFang SC;
  1893. font-weight: 500;
  1894. color: #E30000;
  1895. line-height: 84rpx;
  1896. text-align: center;
  1897. border-bottom: 1px solid #E0E0E0;
  1898. >text {
  1899. font-size: 40rpx;
  1900. }
  1901. }
  1902. .shade-outfire-n-b {
  1903. width: 402rpx;
  1904. height: 82rpx;
  1905. background: #FFFFFF;
  1906. border: 2rpx solid #0183FA;
  1907. border-radius: 10rpx;
  1908. font-size: 28rpx;
  1909. line-height: 82rpx;
  1910. font-family: PingFang SC;
  1911. font-weight: 500;
  1912. color: #0183FA;
  1913. text-align: center;
  1914. margin: 30rpx 0 0 112rpx;
  1915. }
  1916. }
  1917. }
  1918. }
  1919. .setUpEvacuation-bottom-button {
  1920. width: 650rpx;
  1921. height: 100rpx;
  1922. background: #0183FA;
  1923. color:#fff;
  1924. text-align: center;
  1925. line-height: 100rpx;
  1926. font-size: 28rpx;
  1927. margin: 50rpx auto;
  1928. border-radius: 20rpx;
  1929. }
  1930. }
  1931. </style>