emergencyEvacuationBig.vue 51 KB

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