emergencyEvacuationBig.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061
  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:'',// //灭火设备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: 6000
  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. console.log('用户点击确定');
  433. _this.firedeviceStart(); //启动灭火设备
  434. } else if (res.cancel) {
  435. console.log('用户点击取消');
  436. }
  437. }
  438. });
  439. },
  440. //一键灭火弹出层关闭
  441. dialogOutfire() {
  442. this.dialogVisible = !this.dialogVisible
  443. this.clearTimer(); //关闭定时器
  444. },
  445. //取消一键灭火
  446. cancelOutfire() {
  447. this.dialogVisible = false;
  448. this.clearTimer(); //关闭定时器
  449. this.firedeviceCancel()
  450. },
  451. //倒计时
  452. sendCode() {
  453. let _this = this;
  454. _this.loading(); //启动定时器
  455. _this.timer2 = setInterval(() => {
  456. //创建定时器
  457. if (_this.countdown === 1) {
  458. _this.clearTimer(); //关闭定时器
  459. } else {
  460. _this.loading();
  461. }
  462. }, 1000);
  463. },
  464. loading() {
  465. //启动定时器
  466. this.countdown--; //定时器减1
  467. },
  468. clearTimer() {
  469. //清除定时器
  470. clearInterval(this.timer2);
  471. this.timer2 = null;
  472. this.dialogVisible = false;
  473. this.countdown = 6;
  474. },
  475. //进行中倒计时
  476. sendCode2(time) {
  477. let _this = this;
  478. _this.$set(self,'conductCountdown',time);
  479. _this.loading2(); //启动定时器
  480. _this.timer3 = setInterval(() => {
  481. //创建定时器
  482. if (_this.conductCountdown === 1) {
  483. _this.clearTimer2(); //关闭定时器
  484. _this.outfireEnd = true; //灭火倒计时结束
  485. } else {
  486. _this.loading2();
  487. }
  488. }, 1000);
  489. },
  490. loading2() {
  491. //启动定时器
  492. this.conductCountdown--; //定时器减1
  493. },
  494. clearTimer2() {
  495. //清除定时器
  496. clearInterval(this.timer3);
  497. this.timer3 = null;
  498. },
  499. //获取楼栋数据
  500. async treeselectByUser(option) {
  501. const { data } = await getBuildOrFloorList({type:2,parentId:''})
  502. this.$set(this, 'buildingList', data.data);
  503. this.$set(this, 'buildingName', "");
  504. this.$set(this, 'buildingId', "");
  505. this.$set(this, 'deptId', "");
  506. this.$set(this, 'floorList', []);
  507. this.$set(this, 'floorName', "");
  508. this.$set(this, 'floorId', "");
  509. this.$set(this, 'fjListArray', []);
  510. this.$set(this, 'subName', "");
  511. this.$set(this, 'subId', "");
  512. },
  513. //获取楼层数据
  514. async getBuilding(buildingId) {
  515. const { data } = await getBuildOrFloorList({type:3,parentId:buildingId})
  516. this.$set(this, 'floorList', data.data);
  517. this.$set(this, 'floorName', "");
  518. this.$set(this, 'floorId', "");
  519. this.$set(this, 'fjListArray', []);
  520. this.$set(this, 'subName', "");
  521. this.$set(this, 'subId', "");
  522. },
  523. //楼栋选中
  524. buildingChange(e) {
  525. this.$set(this, 'buildingName', this.buildingList[e.detail.value].name);
  526. this.$set(this, 'buildingId', this.buildingList[e.detail.value].id);
  527. this.$set(this, 'deptId', this.buildingList[e.detail.value].id);
  528. this.getBuilding(this.buildingList[e.detail.value].id);
  529. },
  530. //楼层选中
  531. floorChange(e) {
  532. this.$set(this, 'floorName', this.floorList[e.detail.value].name);
  533. this.$set(this, 'floorId', this.floorList[e.detail.value].id);
  534. this.getBuildingData();
  535. },
  536. //实验室选择
  537. fjListChange(e) {
  538. this.$set(this, 'subName', this.fjListArray[e.detail.value].subName);
  539. this.$set(this, 'subId', this.fjListArray[e.detail.value].subId);
  540. this.$set(this.itemData, 'subjectId', this.fjListArray[e.detail.value].subId);
  541. },
  542. getAppExitLine() {
  543. let list = [{
  544. type: "lab/exit/line"
  545. }, {
  546. type: "lab/fireDevice/Warn/"
  547. }];
  548. getApp().appMqttOn(1, list);
  549. },
  550. getAppOutfire() {
  551. // let list = [{type:"lab/fireDevice/Warn/"}]
  552. let list = [{
  553. type: "lab/function/data"
  554. }];
  555. getApp().appMqttOn(1, list);
  556. },
  557. shadeTypeClick() {
  558. this.broadcastType = !this.broadcastType
  559. },
  560. //获取实验室摄像头
  561. async laboratoryInfo() {
  562. let _this = this;
  563. const {
  564. data
  565. } = await laboratoryInfo(_this.itemData.subjectId);
  566. if (data.code == 200) {
  567. let list = data.data[0];
  568. list.labHardwareVOList.forEach(function(item) {
  569. if (item.hardwareTypeEnum.enumName == 'VIDEO_MONITOR') {
  570. console.log(item.hardwareNUM)
  571. _this.videoHardwareNUM.push(item.hardwareNUM)
  572. }
  573. })
  574. this.getCameraByFloor();
  575. }
  576. },
  577. //获取楼层摄像头列表
  578. async getCameraByFloor() {
  579. let _this = this;
  580. const {
  581. data
  582. } = await getCameraByFloor({
  583. floorId: this.floorId
  584. })
  585. if (data.code == 200) {
  586. if (data.data[0]) {
  587. let list = _this.videoHardwareNUM.concat(data.data)
  588. let qc = []
  589. for (var i = 0; i < list.length - 1; i++) {
  590. for (var j = i + 1; j < list.length; j++) {
  591. if (list[i] === list[j]) {
  592. list.splice(j, 1);
  593. j--;
  594. }
  595. }
  596. }
  597. this.GetStartList(list);
  598. } else {
  599. this.GetStartList(_this.videoHardwareNUM);
  600. }
  601. }
  602. },
  603. async GetStartList(rows) {
  604. let self = this;
  605. let list = "";
  606. for (let i = 0; i < rows.length; i++) {
  607. list = list + rows[i] + ","
  608. }
  609. let obj = {
  610. page: "1",
  611. count: "100",
  612. deviceIds: list,
  613. };
  614. const {
  615. data
  616. } = await GetStartList(obj)
  617. if (data.code == 200) {
  618. let list = [];
  619. for (let i = 0; i < data.data.length; i++) {
  620. let text = uni.getStorageSync('cameraUrl');
  621. let url = data.data[i].result.body.data.hls;
  622. url = url.split("rtp/");
  623. let newUrl = text + 'rtp/' + url[1];
  624. let obj = {
  625. name: "楼道监控" + (i + 1),
  626. id: data.data[i].result.body.data.deviceID,
  627. url: newUrl,
  628. }
  629. list.push(obj)
  630. }
  631. this.urlList = list;
  632. }
  633. },
  634. //点击选择喇叭
  635. trumpetClick(index) {
  636. this.trumpetList[index].type = !this.trumpetList[index].type
  637. let _this = this;
  638. if (_this.trumpetList[index].type == true) {
  639. _this.trumpetList.forEach(function(item2) {
  640. if (item2.deviceSn == _this.trumpetList[index].deviceSn) {
  641. item2.type = true
  642. } else {
  643. item2.type = false
  644. }
  645. })
  646. }
  647. },
  648. //录制
  649. recordButton(e) {
  650. console.log("按下")
  651. let self = this;
  652. let num = 0;
  653. for (let i = 0; i < self.trumpetList.length; i++) {
  654. if (self.trumpetList[i].type) {
  655. num++
  656. }
  657. }
  658. if (num == 0) {
  659. uni.showToast({
  660. title: '请选择喇叭',
  661. icon: "none",
  662. mask: true,
  663. duration: 2000
  664. });
  665. return
  666. }
  667. this.liveType = true;
  668. console.log('录制', e)
  669. this.startPoint = e.touches[0]; //记录长按时开始点信息,后面用于计算上划取消时手指滑动的距离。
  670. const options = {
  671. duration: 10000,
  672. sampleRate: 16000,
  673. numberOfChannels: 1,
  674. encodeBitRate: 48000,
  675. format: 'mp3',
  676. frameSize: 50
  677. }
  678. this.recorderManager.start(options); //开始录音
  679. this.recorderManager.onStart(() => {
  680. console.log('recorder start')
  681. })
  682. this.recorderManager.onError((res) => {
  683. console.log(res);
  684. })
  685. wx.showToast({
  686. title: "正在录音,上划取消发送",
  687. icon: "none",
  688. duration: 60000 //先定义个60秒,后面可以手动调用wx.hideToast()隐藏
  689. });
  690. this.sendLock = false; //长按时是不上锁的。
  691. },
  692. //取消
  693. cancelButton(e) {
  694. console.log("移动")
  695. let self = this;
  696. let num = 0;
  697. for (let i = 0; i < self.trumpetList.length; i++) {
  698. if (self.trumpetList[i].type) {
  699. num++
  700. }
  701. }
  702. if (num == 0) {
  703. return
  704. }
  705. this.liveType = false;
  706. console.log('取消', e)
  707. let moveLenght = e.touches[e.touches.length - 1].clientY - this.startPoint.clientY; //移动距离
  708. if (Math.abs(moveLenght) > 50) {
  709. wx.showToast({
  710. title: "松开手指,取消发送",
  711. icon: "none",
  712. duration: 60000
  713. });
  714. this.sendLock = true; //触发了上滑取消发送,上锁
  715. } else {
  716. wx.showToast({
  717. title: "正在录音,上划取消发送",
  718. icon: "none",
  719. duration: 60000
  720. });
  721. this.sendLock = false; //上划距离不足,依然可以发送,不上锁
  722. }
  723. },
  724. //发送
  725. sendButton(e) {
  726. console.log("松开")
  727. let self = this;
  728. let num = 0;
  729. for (let i = 0; i < self.trumpetList.length; i++) {
  730. if (self.trumpetList[i].type) {
  731. num++
  732. }
  733. }
  734. if (num == 0) {
  735. return
  736. }
  737. this.liveType = false;
  738. console.log('发送', e)
  739. wx.hideToast(); //结束录音、隐藏Toast提示框
  740. this.recorderManager.stop(); //结束录音
  741. this.recorderManager.onStop((res) => {
  742. if (!this.sendLock) {
  743. console.log('1', this.recorderManager)
  744. this.uploadImg(res.tempFilePath);
  745. }
  746. console.log('停止录音', res.tempFilePath)
  747. console.log("sendLock", this.sendLock);
  748. })
  749. },
  750. //上传MP3
  751. async uploadImg(tempFilePaths) {
  752. var self = this;
  753. uni.uploadFile({
  754. url: config.base_url + '/file/upload', //仅为示例,非真实的接口地址
  755. header: {
  756. 'Authorization': uni.getStorageSync('token')
  757. },
  758. filePath: tempFilePaths,
  759. name: 'file',
  760. formData: {
  761. 'user': 'test'
  762. },
  763. success: (uploadFileRes) => {
  764. let res = JSON.parse(uploadFileRes.data);
  765. if (res.code == 200) {
  766. console.log("上传成功", res)
  767. self.textParseUrlIps(config.base_url + '/' + res.data.url);
  768. } else {
  769. uni.showToast({
  770. title: res.msg,
  771. icon: "none",
  772. mask: true,
  773. duration: 2000
  774. });
  775. }
  776. },
  777. fail: err => {
  778. uni.hideLoading()
  779. },
  780. complete: () => {}
  781. });
  782. },
  783. //发送语音
  784. async textParseUrlIps(text) {
  785. let self = this;
  786. let newList = [];
  787. for (let i = 0; i < self.trumpetList.length; i++) {
  788. if (self.trumpetList[i].type) {
  789. let obj = {
  790. sn: self.trumpetList[i].deviceSn,
  791. port: self.trumpetList[i].port,
  792. deviceIp: self.trumpetList[i].deviceIp,
  793. type: "",
  794. name: "",
  795. speed: "",
  796. params: {
  797. tid: "",
  798. vol: self.trumpetList[i].deviceVol,
  799. urls: []
  800. }
  801. };
  802. newList.push(obj);
  803. }
  804. }
  805. const {
  806. data
  807. } = await textParseUrlIps(newList, text)
  808. if (data.code == 200) {
  809. uni.showToast({
  810. title: '发送成功',
  811. icon: "none",
  812. mask: true,
  813. duration: 2000
  814. });
  815. }
  816. },
  817. //监听应急疏散数据变更
  818. getMqttLineData(val) {
  819. console.log('收到疏散MQTT')
  820. let self = this;
  821. if (val.EXIT_LINE_MESSAGE) {
  822. console.log('数据改变')
  823. this.evacuate();
  824. } else {
  825. console.log('应急疏散已结束')
  826. uni.showToast({
  827. title: '应急疏散已结束',
  828. icon: "none",
  829. mask: true,
  830. duration: 2000
  831. });
  832. setTimeout(function() {
  833. uni.navigateBack();
  834. }, 2000);
  835. }
  836. },
  837. /* 确认 */
  838. confirmBtn() {
  839. if (!this.subId) {
  840. uni.showToast({
  841. title: '请选择实验室',
  842. icon: "none",
  843. mask: true,
  844. duration: 2000
  845. });
  846. return
  847. }
  848. this.$set(this,'address',this.buildingName + '' + this.floorName);
  849. this.$set(this,'pageType',2);
  850. this.getDeviceList();
  851. this.laboratoryInfo();
  852. this.offMQTT('on');
  853. },
  854. //执行疏散
  855. async lineEvacuate() {
  856. if (!this.subId) {
  857. uni.showToast({
  858. title: '请选择实验室',
  859. icon: "none",
  860. mask: true,
  861. duration: 2000
  862. });
  863. return
  864. }
  865. if (!this.buttonArrayIndex) {
  866. uni.showToast({
  867. title: '请选择疏散路线',
  868. icon: "none",
  869. mask: true,
  870. duration: 2000
  871. });
  872. return
  873. }
  874. const {
  875. data
  876. } = await lineEvacuate(this.subId, this.buttonArray[this.buttonArrayIndex].id)
  877. if (data.code == 200) {
  878. if (data.data) {
  879. console.log('执行疏散')
  880. this.initialization(data.data);
  881. }
  882. }
  883. },
  884. //获取喇叭列表
  885. async getDeviceList() {
  886. let obj = {
  887. subId: this.itemData.subjectId,
  888. floorId: this.floorId,
  889. page: 1,
  890. pageSize: 100,
  891. };
  892. const {
  893. data
  894. } = await getDeviceListBySub(obj)
  895. if (data.code == 200) {
  896. for (let i = 0; i < data.data.length; i++) {
  897. data.data[i].type = false;
  898. }
  899. this.$set(this, 'trumpetList', data.data)
  900. }
  901. },
  902. //摄像头切换
  903. scrollBoxClick(index) {
  904. this.videoIndex = index;
  905. },
  906. /*新疏散相关接口*/
  907. //地图数据
  908. async getBuildingData() {
  909. let self = this;
  910. const {
  911. data
  912. } = await getFloorData(this.floorId)
  913. console.log('data', data)
  914. if (data.code == 200) {
  915. if (data.data.buildFloorLayoutVoList[0]) {
  916. let list = JSON.parse(data.data.labExitLineVertex.layoutJoinData)
  917. this.zoomCalculate(list, 348, 668);
  918. for (let i = 0; i < list.length; i++) {
  919. if (list[i].type == '2') {
  920. //楼道
  921. for (let o = 0; o < list[i].lightList.length; o++) {
  922. list[i].lightList[o].openType = false;
  923. }
  924. } else if (list[i].type == '1') {
  925. for (let o = 0; o < data.data.buildFloorLayoutVoList.length; o++) {
  926. if (list[i].key == data.data.buildFloorLayoutVoList[o].pointName) {
  927. list[i].id = data.data.buildFloorLayoutVoList[o].id;
  928. list[i].buildId = data.data.buildFloorLayoutVoList[o].buildId;
  929. list[i].floorId = data.data.buildFloorLayoutVoList[o].floorId;
  930. list[i].roomType = data.data.buildFloorLayoutVoList[o].roomType;
  931. list[i].roomName = data.data.buildFloorLayoutVoList[o].roomName;
  932. list[i].roomNum = data.data.buildFloorLayoutVoList[o].roomNum;
  933. list[i].subName = data.data.buildFloorLayoutVoList[o].subName;
  934. list[i].subId = data.data.buildFloorLayoutVoList[o].subId;
  935. list[i].online = data.data.buildFloorLayoutVoList[o].online;
  936. list[i].loginAdmin = data.data.buildFloorLayoutVoList[o].loginAdmin;
  937. list[i].policeType = false;
  938. }
  939. }
  940. } else if (list[i].type == 3) {
  941. list[i].roomCheckType = false;
  942. }
  943. }
  944. let subList = [];
  945. for (let o = 0; o < data.data.buildFloorLayoutVoList.length; o++) {
  946. if(data.data.buildFloorLayoutVoList[o].loginAdmin){
  947. subList.push(data.data.buildFloorLayoutVoList[o])
  948. }
  949. }
  950. this.$set(this,'fjListArray', subList);
  951. this.$set(this, 'mapList', JSON.parse(JSON.stringify(list)));
  952. // this.$set(this, 'shadeMapList', JSON.parse(JSON.stringify(list)));
  953. this.$set(this, 'mapType', true);
  954. setTimeout(function() {
  955. self.getRedisEvacuation();
  956. }, 500);
  957. }
  958. }
  959. },
  960. //获取疏散数据
  961. async getRedisEvacuation() {
  962. let self = this;
  963. let obj = {
  964. buildId: this.buildingId,
  965. floorId: this.floorId,
  966. }
  967. const {
  968. data
  969. } = await getRedisEvacuation(obj)
  970. if (data.code == 200) {
  971. if (data.data.doorPointNames) {
  972. for (let o = 0; o < self.mapList.length; o++) {
  973. if (self.mapList[o].type == 2) {
  974. for (let x = 0; x < self.mapList[o].lightList.length; x++) {
  975. let num = 0;
  976. for (let i = 0; i < data.data.lightPointSet.length; i++) {
  977. if (data.data.lightPointSet[i]) { //处理后端返回的异常的NULL
  978. if (self.mapList[o].lightList[x].key == data.data.lightPointSet[i].key) {
  979. num++
  980. }
  981. }
  982. }
  983. console.log('灯',num)
  984. self.mapList[o].lightList[x].openType = num != 0;
  985. }
  986. }
  987. }
  988. for (let i = 0; i < data.data.doorPointNames.length; i++) {
  989. for (let o = 0; o < self.mapList.length; o++) {
  990. if (self.mapList[o].type == 3) {
  991. if (data.data.doorPointNames[i] == self.mapList[o].key) {
  992. self.mapList[o].roomCheckType = true;
  993. }
  994. }
  995. }
  996. }
  997. this.$forceUpdate();
  998. }
  999. };
  1000. },
  1001. //缩放计算
  1002. zoomCalculate(list, height, width) {
  1003. let maxWidth = 0
  1004. let maxHeight = 0
  1005. let zoomData = 1;
  1006. for (let i = 0; i < list.length; i++) {
  1007. if ((list[i].x + list[i].w) > maxWidth) {
  1008. maxWidth = list[i].x + list[i].w
  1009. }
  1010. if ((list[i].y + list[i].h) > maxHeight) {
  1011. maxHeight = list[i].y + list[i].h
  1012. }
  1013. }
  1014. //处理等值数据
  1015. if(maxHeight == height){
  1016. maxHeight--
  1017. }
  1018. if(maxWidth == width){
  1019. maxWidth--
  1020. }
  1021. this.$set(this, 'mapWidth', maxWidth);
  1022. this.$set(this, 'mapHeight', maxHeight);
  1023. //缩放判断
  1024. if(maxHeight>height&&maxWidth>width){
  1025. if((maxHeight-height)>(maxWidth-width)){
  1026. zoomData = height/maxHeight;
  1027. this.$set(this,'zoomData',height/maxHeight);
  1028. }else{
  1029. zoomData = width / maxWidth;
  1030. this.$set(this,'zoomData',width / maxWidth);
  1031. }
  1032. }else if(maxHeight<height&&maxWidth<width){
  1033. if((height-maxHeight)>(width-maxWidth)){
  1034. zoomData = width / maxWidth;
  1035. this.$set(this,'zoomData',width / maxWidth);
  1036. }else{
  1037. zoomData = height / maxHeight;
  1038. this.$set(this,'zoomData',height / maxHeight);
  1039. }
  1040. }else if(maxHeight<height&&maxWidth>width){
  1041. zoomData = width / maxWidth;
  1042. this.$set(this,'zoomData',width / maxWidth);
  1043. }else if(maxHeight>height&&maxWidth<width){
  1044. zoomData = height / maxHeight;
  1045. this.$set(this,'zoomData',height / maxHeight);
  1046. }
  1047. },
  1048. //结束疏散
  1049. evacuationButton() {
  1050. let self = this;
  1051. uni.showModal({
  1052. content: '确认'+(this.isEvacuate?'执行':'结束')+'疏散吗?',
  1053. cancelColor: "#999",
  1054. confirmColor: "#0183FA",
  1055. success: function(res) {
  1056. if (res.confirm) {
  1057. if(self.isEvacuate){
  1058. self.executeEvacuation();
  1059. }else{
  1060. self.endEvacuation();
  1061. }
  1062. console.log('用户点击确定');
  1063. } else if (res.cancel) {
  1064. console.log('用户点击取消');
  1065. }
  1066. }
  1067. });
  1068. },
  1069. //开始疏散
  1070. async executeEvacuation(){
  1071. let self = this;
  1072. let doorPointNames = [];
  1073. for(let i=0;i<self.mapList.length;i++){
  1074. if(self.mapList[i].type == 3){
  1075. doorPointNames.push(self.mapList[i].key)
  1076. }
  1077. }
  1078. let obj = {
  1079. buildId:this.buildingId,
  1080. floorId:this.floorId,
  1081. subId: this.subId,
  1082. badPointNames:[],
  1083. doorPointNames:doorPointNames,
  1084. }
  1085. const { data } = await executeEvacuation(obj)
  1086. console.log('data', data)
  1087. if (data.code == 200) {
  1088. this.$set(this,'isEvacuate',false);
  1089. uni.showToast({
  1090. title: '执行成功',
  1091. icon: "none",
  1092. mask: true,
  1093. duration: 2000
  1094. });
  1095. }
  1096. },
  1097. //结束疏散
  1098. async endEvacuation(){
  1099. let self = this;
  1100. let obj = {
  1101. buildId:this.buildingId,
  1102. floorId:this.floorId,
  1103. }
  1104. const { data } = await endEvacuation(obj)
  1105. console.log('data', data)
  1106. if (data.code == 200) {
  1107. this.$set(this,'isEvacuate',true);
  1108. uni.showToast({
  1109. title: '执行成功',
  1110. icon: "none",
  1111. mask: true,
  1112. duration: 2000
  1113. });
  1114. }
  1115. },
  1116. /*MQTT*/
  1117. //订阅
  1118. onMQTT() {
  1119. let self = this;
  1120. const mqttOptions = {
  1121. keepalive: 30,
  1122. clean: true, //保留会话
  1123. connectTimeout: 60000, // 超时时间
  1124. reconnectPeriod: 5000, // 重连间隔
  1125. clientId: uni.getStorageSync('token') + 'lab/function/data',
  1126. username: uni.getStorageSync('mqttUrl'),
  1127. password: uni.getStorageSync('mqttUrl'),
  1128. }
  1129. const connectUrl = uni.getStorageSync('mqttUrl');
  1130. this.floorClient = $mqtt.connect('wxs://' + connectUrl, mqttOptions);
  1131. this.floorClient.on('connect', () => {
  1132. this.floorClient.subscribe(this.evacuationTopic + this.floorId, (err) => {
  1133. if (!err) {
  1134. console.log("疏散-订阅成功", )
  1135. this.getBuildingData();
  1136. }
  1137. });
  1138. this.floorClient.subscribe(this.fireTopic+this.fireCode, (err) => {
  1139. if (!err) {
  1140. console.log("火灾传感器状态-订阅成功:" + this.fireTopic+this.fireCode);
  1141. }
  1142. });
  1143. this.floorClient.subscribe(this.fireOnlineTopic+this.fireCode, (err) => {
  1144. if (!err) {
  1145. console.log("火灾设备是否在线-订阅成功:" + this.fireOnlineTopic+this.fireCode);
  1146. }
  1147. });
  1148. this.floorClient.subscribe(this.firePerformTopic+this.fireCode, (err) => {
  1149. if (!err) {
  1150. console.log("火灾是否正在执行灭火操作-订阅成功:" + this.firePerformTopic+this.fireCode);
  1151. }
  1152. });
  1153. });
  1154. // 自动重连
  1155. this.floorClient.on('reconnect', (msg) => {
  1156. console.log('自动重连-reconnect-1', msg)
  1157. });
  1158. // 错误
  1159. this.floorClient.on('error', () => {
  1160. console.log('错误-error-1')
  1161. });
  1162. // 断开
  1163. this.floorClient.on('end', () => {
  1164. console.log('断开-end-1')
  1165. });
  1166. // 掉线
  1167. this.floorClient.on('offline', (msg) => {
  1168. console.log('掉线-offline-1', msg)
  1169. });
  1170. // 收到消息
  1171. this.floorClient.on('message', (topic, message) => {
  1172. let data = JSON.parse(message)
  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. //灭火执行操作
  1199. if(data.fireStatus == 1){
  1200. if(!self.fireStartType){
  1201. self.$set(self,'fireStartType',true);
  1202. self.$set(self,'fireStartText','灭火中');
  1203. self.fireStartTimeFunction(data.direTime);
  1204. }else if(data.fireStatus == 0){
  1205. self.msgError('一键灭火启动失败')
  1206. }
  1207. }
  1208. }
  1209. }
  1210. });
  1211. // 全局监听是否有关闭mqtt的消息的事件
  1212. uni.$on('closeMqtt', () => {
  1213. this.floorClient.end(true); // 主动断开连接
  1214. })
  1215. },
  1216. //关闭MQTT连接
  1217. offMQTT(type) {
  1218. let self = this;
  1219. if (this.floorClient.unsubscribe) {
  1220. this.floorClient.unsubscribe(this.evacuationTopic + this.floorId, error => {
  1221. if (error) {
  1222. console.log('疏散连接-关闭错误', error)
  1223. }
  1224. });
  1225. this.floorClient.unsubscribe(self.fireTopic+self.fireCode, error => {
  1226. if (error) {
  1227. console.log('火灾传感器状态-MQTT断开报错=>', error)
  1228. }
  1229. })
  1230. this.floorClient.unsubscribe(self.fireOnlineTopic+self.fireCode, error => {
  1231. if (error) {
  1232. console.log('火灾设备是否在线-MQTT断开报错=>', error)
  1233. }
  1234. })
  1235. this.floorClient.unsubscribe(self.firePerformTopic+self.fireCode, error => {
  1236. if (error) {
  1237. console.log('火灾是否正在执行灭火操作-MQTT断开报错=>', error)
  1238. }
  1239. })
  1240. this.floorClient.end(true);
  1241. this.$set(this, 'floorClient', {});
  1242. }
  1243. if (type) {
  1244. this.onMQTT();
  1245. }
  1246. },
  1247. },
  1248. beforeDestroy() {
  1249. this.offMQTT();
  1250. //断开mqtt连接
  1251. // getApp().offMQTT();
  1252. //删除应急疏散监听
  1253. // getApp().deleteLineData();
  1254. }
  1255. }
  1256. </script>
  1257. <style lang="stylus" scoped>
  1258. #emergencyEvacuationBig {
  1259. height: 100%;
  1260. width: 100%;
  1261. display: flex;
  1262. flex-direction: column;
  1263. overflow-y: scroll;
  1264. .setUpEvacuation {
  1265. flex: 1;
  1266. display: flex;
  1267. flex-direction: column;
  1268. overflow-y: scroll;
  1269. .evacuation-max-box {
  1270. width: 710rpx;
  1271. margin: 20rpx 20rpx;
  1272. background: #fff;
  1273. border-radius: 20rpx;
  1274. padding: 20rpx 0;
  1275. .picker-max-box {
  1276. .picker-title-box {
  1277. padding: 0 20rpx;
  1278. display: flex;
  1279. view {
  1280. line-height: 80rpx;
  1281. font-size: 28rpx;
  1282. }
  1283. view:nth-child(1) {
  1284. color: red;
  1285. }
  1286. view:nth-child(2) {}
  1287. view:nth-child(3) {
  1288. color: #999;
  1289. }
  1290. }
  1291. .picker-min-box {
  1292. display: flex;
  1293. height: 80rpx;
  1294. width: 667rpx;
  1295. border: 1rpx solid #a2a2a2;
  1296. border-radius: 10rpx;
  1297. margin: 0 20rpx;
  1298. view {
  1299. flex: 1;
  1300. line-height: 80rpx;
  1301. padding: 0 20rpx;
  1302. color: #999;
  1303. font-size: 28rpx;
  1304. overflow: hidden;
  1305. }
  1306. img {
  1307. width: 24rpx;
  1308. height: 12rpx;
  1309. margin: 35rpx 23rpx;
  1310. }
  1311. }
  1312. }
  1313. }
  1314. }
  1315. .implementEvacuation {
  1316. flex: 1;
  1317. display: flex;
  1318. flex-direction: column;
  1319. overflow-y: scroll;
  1320. .evacuation-max-box {
  1321. width: 710rpx;
  1322. margin: 20rpx 20rpx;
  1323. /* background #fff */
  1324. border-radius: 20rpx;
  1325. padding: 20rpx 0 30rpx;
  1326. .evacuation-title-box {
  1327. // height:150rpx;
  1328. //border-bottom:1rpx solid #dedede;
  1329. background: #FFFFFF;
  1330. border-radius: 20rpx;
  1331. padding: 34rpx 22rpx;
  1332. box-sizing: border-box;
  1333. .evacuation-title-name-box {
  1334. font-size: 30rpx;
  1335. font-family: PingFang SC;
  1336. font-weight: 500;
  1337. color: #333333;
  1338. line-height: 30rpx;
  1339. }
  1340. .site {
  1341. font-size: 28rpx;
  1342. font-family: PingFang SC;
  1343. font-weight: 500;
  1344. color: #999999;
  1345. line-height: 30rpx;
  1346. margin-top: 32rpx;
  1347. display: flex;
  1348. justify-content: flex-start;
  1349. align-items: center;
  1350. >img {
  1351. width: 28rpx;
  1352. height: 30rpx;
  1353. margin-right: 18rpx;
  1354. }
  1355. }
  1356. }
  1357. /* 一键灭火 */
  1358. .outfire {
  1359. width: 710rpx;
  1360. height: 80rpx;
  1361. background: #FFFFFF;
  1362. border-radius: 20rpx;
  1363. margin: 20rpx 0;
  1364. padding: 0 10rpx;
  1365. box-sizing: border-box;
  1366. display: flex;
  1367. justify-content: space-between;
  1368. align-items: center;
  1369. .outfire_li {
  1370. display: flex;
  1371. justify-content: flex-start;
  1372. align-items: center;
  1373. >img {
  1374. width: 24rpx;
  1375. height: 30rpx;
  1376. margin-right: 12rpx;
  1377. }
  1378. .normal {
  1379. font-size: 24rpx;
  1380. font-family: PingFang SC;
  1381. font-weight: 500;
  1382. color: #333333;
  1383. }
  1384. .abnormal {
  1385. font-size: 24rpx;
  1386. font-family: PingFang SC;
  1387. font-weight: 500;
  1388. color: #F11C00;
  1389. }
  1390. }
  1391. .outfire_li:nth-of-type(1) {
  1392. >img {
  1393. width: 30rpx;
  1394. height: 28rpx;
  1395. margin-right: 12rpx;
  1396. }
  1397. }
  1398. .outfire_yes_btn {
  1399. width: 120rpx;
  1400. height: 40rpx;
  1401. font-size: 24rpx;
  1402. font-family: PingFang SC;
  1403. font-weight: 500;
  1404. color: #F21C00;
  1405. line-height: 40rpx;
  1406. border: 1px solid #F21C00;
  1407. border-radius: 8rpx;
  1408. text-align: center;
  1409. margin-left: 54rpx;
  1410. }
  1411. .outfire_no_btn {
  1412. width: 120rpx;
  1413. height: 40rpx;
  1414. font-size: 24rpx;
  1415. font-family: PingFang SC;
  1416. font-weight: 500;
  1417. color: #CCCCCC;
  1418. line-height: 40rpx;
  1419. border: 1px solid #E0E0E0;
  1420. border-radius: 8rpx;
  1421. text-align: center;
  1422. margin-left: 54rpx;
  1423. }
  1424. }
  1425. .evacuation-scroll-box {
  1426. height: 95rpx;
  1427. overflow-x: scroll;
  1428. overflow-y: hidden;
  1429. white-space: nowrap;
  1430. margin: 0 20rpx;
  1431. view {
  1432. line-height: 95rpx;
  1433. font-size: 28rpx;
  1434. display: inline-block;
  1435. margin-right: 45rpx;
  1436. }
  1437. .scroll-box-color {
  1438. color: #0183FA;
  1439. }
  1440. }
  1441. .evacuation-video-box {
  1442. width: 668rpx;
  1443. height: 341rpx;
  1444. margin: 0 auto;
  1445. position: relative;
  1446. video {
  1447. position: absolute;
  1448. top: 0;
  1449. left: 0;
  1450. width: 668rpx;
  1451. height: 341rpx;
  1452. margin: 0 auto;
  1453. }
  1454. .video-a {
  1455. z-index: 100;
  1456. }
  1457. .video-b {
  1458. z-index: 0;
  1459. }
  1460. }
  1461. /* 路线图 */
  1462. .roadmap {
  1463. width: 710rpx;
  1464. height: 464rpx;
  1465. background: #FFFFFF;
  1466. border-radius: 20rpx;
  1467. padding: 20rpx 20rpx 0;
  1468. box-sizing: border-box;
  1469. margin-top: 20rpx;
  1470. .roadmap_t {
  1471. font-size: 30rpx;
  1472. font-family: PingFang SC;
  1473. font-weight: 500;
  1474. color: #333333;
  1475. line-height: 30rpx;
  1476. display: flex;
  1477. .monito_li_r_l {
  1478. flex: 1;
  1479. line-height: 61rpx;
  1480. font-size: 28rpx;
  1481. }
  1482. .monito_li_r_r_button {
  1483. width: 100rpx;
  1484. text-align: center;
  1485. line-height: 61rpx;
  1486. font-size: 28rpx;
  1487. color: #0183FA;
  1488. }
  1489. .monito_li_r {
  1490. width: 380rpx;
  1491. font-size: 24rpx;
  1492. font-family: PingFang SC;
  1493. font-weight: 500;
  1494. color: #0183FA;
  1495. line-height: 80rpx;
  1496. display: flex;
  1497. justify-content: flex-end;
  1498. align-items: center;
  1499. >img {
  1500. width: 9rpx;
  1501. height: 22rpx;
  1502. margin-left: 20rpx;
  1503. }
  1504. .evacuation-title-button-box {
  1505. display: flex;
  1506. overflow: hidden;
  1507. view {
  1508. line-height: 61rpx;
  1509. font-size: 28rpx;
  1510. }
  1511. .colorA {
  1512. color: #0183FA;
  1513. }
  1514. .colorB {
  1515. color: #0183FA;
  1516. }
  1517. img {
  1518. margin: 28rpx 20rpx 0;
  1519. width: 24rpx;
  1520. height: 9rpx;
  1521. }
  1522. }
  1523. }
  1524. }
  1525. .evacuation-map-box {
  1526. width: 668rpx;
  1527. height: 348rpx;
  1528. margin: 0 auto;
  1529. overflow: hidden;
  1530. border: 1rpx solid #E0E0E0;
  1531. margin-top: 20rpx;
  1532. position: relative;
  1533. .emergencyEvacuationBigFullScreen-page {
  1534. // overflow: scroll;
  1535. overflow: hidden;
  1536. position: absolute;
  1537. top: 50%;
  1538. left: 50%;
  1539. .map-max-box {
  1540. position: relative;
  1541. .map-max-for-box {
  1542. position: absolute;
  1543. display: flex;
  1544. flex-direction: column;
  1545. .map-max-for-min-box {
  1546. position: relative;
  1547. .position-box {
  1548. position: absolute;
  1549. }
  1550. .map-for-name-p {
  1551. padding: 0 10rpx;
  1552. height: 20rpx;
  1553. line-height: 20rpx;
  1554. font-size: 14rpx;
  1555. text-align: center;
  1556. color: #333;
  1557. overflow: hidden;
  1558. text-overflow: ellipsis;
  1559. white-space: nowrap;
  1560. }
  1561. .map-for-num-p {
  1562. padding: 0 10rpx;
  1563. height: 20rpx;
  1564. line-height: 20rpx;
  1565. font-size: 14rpx;
  1566. text-align: center;
  1567. color: #333;
  1568. overflow: hidden;
  1569. text-overflow: ellipsis;
  1570. white-space: nowrap;
  1571. }
  1572. .center-move-door-p-t {
  1573. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1574. background-size: 100% !important;
  1575. transform: rotate(180deg);
  1576. }
  1577. .center-move-door-p-b {
  1578. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1579. background-size: 100% !important;
  1580. }
  1581. .center-move-door-p-l {
  1582. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1583. background-size: 100% !important;
  1584. transform: rotate(90deg);
  1585. }
  1586. .center-move-door-p-r {
  1587. background: url("../images/evacuation3_2/icon_sysbjt_m.png") !important;
  1588. background-size: 100% !important;
  1589. transform: rotateZ(270deg);
  1590. }
  1591. .lightTopOn {
  1592. background: url("../images/evacuation3_2//icon_sjt.png");
  1593. background-size: 100%;
  1594. }
  1595. .lightTopOff {
  1596. background: url("../images/evacuation3_2//icon_shang_hs.png");
  1597. background-size: 100%;
  1598. }
  1599. .lightBottomOn {
  1600. background: url("../images/evacuation3_2//icon_xjt.png");
  1601. background-size: 100%;
  1602. }
  1603. .lightBottomOff {
  1604. background: url("../images/evacuation3_2//icon_xia_hs.png");
  1605. background-size: 100%;
  1606. }
  1607. .lightLeftOn {
  1608. background: url("../images/evacuation3_2//icon_zuo.png");
  1609. background-size: 100%;
  1610. }
  1611. .lightLeftOff {
  1612. background: url("../images/evacuation3_2//icon_zou_hs.png");
  1613. background-size: 100%;
  1614. }
  1615. .lightRightOn {
  1616. background: url("../images/evacuation3_2//icon_yuo.png");
  1617. background-size: 100%;
  1618. }
  1619. .lightRightOff {
  1620. background: url("../images/evacuation3_2//icon_you_hs.png");
  1621. background-size: 100%;
  1622. }
  1623. }
  1624. }
  1625. .for-map-box {
  1626. border: 2rpx solid #fff;
  1627. background: #CEF2FD;
  1628. }
  1629. .for-map-box-one {
  1630. background: #CEFDD5;
  1631. }
  1632. .for-map-box-two {
  1633. background: url("../images/evacuation3_2/icon_yjtd.png") center center no-repeat #006400;
  1634. background-size: 60rpx 60rpx;
  1635. }
  1636. .for-map-box-two-check {
  1637. background: url("../images/evacuation3_2/icon_yjtd.png") center center no-repeat rgba(50, 205, 50, 1);
  1638. background-size: 80rpx 80rpx;
  1639. }
  1640. .room-type-one {
  1641. //选中
  1642. background: rgba(178, 235, 255, 1);
  1643. }
  1644. .room-type-two {
  1645. //报警
  1646. background: rgba(232, 0, 0, 0.4);
  1647. box-shadow: 0 0 10rpx 1rpx #E80000 inset;
  1648. }
  1649. .room-type-three {
  1650. //选中报警
  1651. background: rgba(178, 235, 255, 1);
  1652. box-shadow: 0 0 10rpx 1rpx #E80000 inset;
  1653. }
  1654. }
  1655. }
  1656. }
  1657. }
  1658. .video-max-box {
  1659. width: 710rpx;
  1660. height: 780rpx;
  1661. overflow-y: scroll;
  1662. background: #FFFFFF;
  1663. border-radius: 20rpx;
  1664. padding: 22rpx 30rpx 30rpx;
  1665. box-sizing: border-box;
  1666. margin-top: 20rpx;
  1667. margin-bottom: 120rpx;
  1668. video {
  1669. width: 645rpx;
  1670. height: 355rpx;
  1671. }
  1672. }
  1673. .bottom-button-box {
  1674. position: absolute;
  1675. bottom: 20rpx;
  1676. display: flex;
  1677. width: 670rpx;
  1678. margin: 20rpx;
  1679. view {
  1680. width: 335rpx;
  1681. height: 100rpx;
  1682. line-height: 100rpx;
  1683. text-align: center;
  1684. color: #fff;
  1685. font-size: 28rpx;
  1686. }
  1687. view:nth-child(1) {
  1688. border-top-left-radius: 50rpx;
  1689. border-bottom-left-radius: 50rpx;
  1690. background: #FF9C00;
  1691. }
  1692. view:nth-child(2) {
  1693. border-top-right-radius: 50rpx;
  1694. border-bottom-right-radius: 50rpx;
  1695. background: #0183FA;
  1696. }
  1697. }
  1698. }
  1699. .live-button {
  1700. width: 650rpx;
  1701. height: 100rpx;
  1702. line-height: 100rpx;
  1703. text-align: center;
  1704. font-size: 28rpx;
  1705. margin: 50rpx auto 0;
  1706. border-radius: 20rpx;
  1707. }
  1708. .live-color-a {
  1709. color: #fff;
  1710. background: #FF8686;
  1711. }
  1712. .live-color-b {
  1713. color: #fff;
  1714. background: #25C95B;
  1715. }
  1716. /* 语音广播 */
  1717. .shade-max-big-box {
  1718. height: 100%;
  1719. width: 100%;
  1720. position: fixed;
  1721. display: flex;
  1722. flex-direction: column;
  1723. z-index: 10;
  1724. background: rgba(0, 0, 0, 0.2);
  1725. .null-box {
  1726. flex: 1;
  1727. }
  1728. /* 语音广播-执行疏散 */
  1729. .broadcast {
  1730. width: 100%;
  1731. // height: 532rpx;
  1732. background: #FFFFFF;
  1733. border-top-left-radius: 20rpx;
  1734. border-top-right-radius: 20rpx;
  1735. padding:22rpx 30rpx 30rpx;
  1736. box-sizing: border-box;
  1737. margin-top: 20rpx;
  1738. .broadcast_t {
  1739. font-size: 30rpx;
  1740. font-family: PingFang SC;
  1741. font-weight: 500;
  1742. color: #333333;
  1743. line-height: 30rpx;
  1744. >label {
  1745. font-size: 24rpx;
  1746. font-family: PingFang SC;
  1747. font-weight: 500;
  1748. color: #999999;
  1749. line-height: 30rpx;
  1750. margin-left: 16rpx;
  1751. }
  1752. }
  1753. .trumpet-max-box {
  1754. display: flex;
  1755. justify-content: flex-start;
  1756. margin-top: 22rpx;
  1757. flex-wrap: wrap;
  1758. .trumpet-for-box {
  1759. display: inline-block;
  1760. width: 200rpx;
  1761. height: 60rpx;
  1762. line-height: 60rpx;
  1763. font-size: 24rpx;
  1764. text-align: center;
  1765. cursor: pointer;
  1766. overflow: hidden;
  1767. border: 1rpx solid #E0E0E0;
  1768. border-radius: 10rpx;
  1769. color: #E0E0E0;
  1770. display: flex;
  1771. justify-content: center;
  1772. margin-right: 20rpx;
  1773. margin-bottom: 10rpx;
  1774. >img {
  1775. width: 36rpx;
  1776. height: 34rpx;
  1777. margin: 12rpx 20rpx 0 25rpx;
  1778. }
  1779. }
  1780. .trumpet-color-a {
  1781. border: 1px solid #0183FA;
  1782. color: #0183FA;
  1783. }
  1784. .trumpet-color-b {
  1785. border: 1px solid #CCCCCC;
  1786. color: #999;
  1787. }
  1788. }
  1789. .broadcast_m {
  1790. width: 100%;
  1791. .broadcast_m_t {
  1792. width: 142rpx;
  1793. height: 142rpx;
  1794. margin: 30rpx 0 0 258rpx;
  1795. position: relative;
  1796. font-size: 24rpx;
  1797. font-family: PingFang SC;
  1798. font-weight: 500;
  1799. line-height: 170rpx;
  1800. text-align: center;
  1801. >img {
  1802. width: 142rpx;
  1803. height: 142rpx;
  1804. position: absolute;
  1805. }
  1806. >label {
  1807. width: 100%;
  1808. font-size: 24rpx;
  1809. font-family: PingFang SC;
  1810. font-weight: 500;
  1811. color: #0183FA;
  1812. line-height: 24rpx;
  1813. display: inline-block;
  1814. text-align: center;
  1815. position: absolute;
  1816. top: 76rpx;
  1817. }
  1818. /* 按下 */
  1819. .press_color {
  1820. color: #FFFFFF;
  1821. }
  1822. /* 松开 */
  1823. .slip_color {
  1824. color: #0183FA;
  1825. }
  1826. }
  1827. .broadcast_m_t_back_a {
  1828. background: url(@/images/icon_sskz_skfs.png);
  1829. background-size: 100%;
  1830. color: #FFFFFF;
  1831. }
  1832. .broadcast_m_t_back_b {
  1833. background: url(@/images/icon_sskz_azsh.png);
  1834. background-size: 100%;
  1835. color: #0183FA;
  1836. }
  1837. .broadcast_m_b {
  1838. font-size: 24rpx;
  1839. font-family: PingFang SC;
  1840. font-weight: 500;
  1841. color: #999999;
  1842. line-height: 24rpx;
  1843. text-align: center;
  1844. margin-top: 14rpx;
  1845. }
  1846. }
  1847. /* 疏散按钮 */
  1848. .evacuation-button-box {
  1849. width: 650rpx;
  1850. height: 100rpx;
  1851. background: #0183FA;
  1852. color: #fff;
  1853. text-align center;
  1854. line-height: 100rpx;
  1855. font-size: 28rpx;
  1856. margin: 88rpx auto 0;
  1857. border-radius: 20rpx;
  1858. }
  1859. }
  1860. }
  1861. /* 一键灭火 */
  1862. .shade-outfire {
  1863. height: 100%;
  1864. width: 100%;
  1865. position: fixed;
  1866. display: flex;
  1867. flex-direction: column;
  1868. z-index: 10;
  1869. background: rgba(0, 0, 0, 0.2);
  1870. .null-box {
  1871. flex: 1;
  1872. }
  1873. /* 语音广播-执行疏散 */
  1874. .shade-outfire-n {
  1875. width: 625rpx;
  1876. height: 450rpx;
  1877. background: #FFFFFF;
  1878. border-radius: 20rpx;
  1879. position: absolute;
  1880. top: 370rpx;
  1881. left: 62rpx;
  1882. .shade-outfire-n-t {
  1883. width: 172rpx;
  1884. height: 172rpx;
  1885. margin: 38rpx 0 0 226rpx;
  1886. }
  1887. .shade-outfire-n-m {
  1888. font-size: 30rpx;
  1889. font-family: PingFang SC;
  1890. font-weight: 500;
  1891. color: #E30000;
  1892. line-height: 84rpx;
  1893. text-align: center;
  1894. border-bottom: 1px solid #E0E0E0;
  1895. >text {
  1896. font-size: 40rpx;
  1897. }
  1898. }
  1899. .shade-outfire-n-b {
  1900. width: 402rpx;
  1901. height: 82rpx;
  1902. background: #FFFFFF;
  1903. border: 2rpx solid #0183FA;
  1904. border-radius: 10rpx;
  1905. font-size: 28rpx;
  1906. line-height: 82rpx;
  1907. font-family: PingFang SC;
  1908. font-weight: 500;
  1909. color: #0183FA;
  1910. text-align: center;
  1911. margin: 30rpx 0 0 112rpx;
  1912. }
  1913. }
  1914. }
  1915. }
  1916. .setUpEvacuation-bottom-button {
  1917. width: 650rpx;
  1918. height: 100rpx;
  1919. background: #0183FA;
  1920. color:#fff;
  1921. text-align: center;
  1922. line-height: 100rpx;
  1923. font-size: 28rpx;
  1924. margin: 50rpx auto;
  1925. border-radius: 20rpx;
  1926. }
  1927. }
  1928. </style>