emergencyEvacuationBig.vue 51 KB

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