emergencyEvacuationBig.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423
  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. <view class="picker-min-box" style="background:#f5f5f5;">
  12. <view>{{collegeArray[deptIndex].name}}</view>
  13. <img src="@/images/icon_06.png">
  14. </view>
  15. </view>
  16. <view class="picker-max-box">
  17. <view class="picker-title-box">
  18. <view></view>
  19. <view>楼层楼栋</view>
  20. </view>
  21. <view class="picker-min-box" style="background:#f5f5f5;">
  22. <view>{{deptArray[deptIndex].name}}</view>
  23. <img src="@/images/icon_06.png">
  24. </view>
  25. </view>
  26. <view class="picker-max-box">
  27. <view class="picker-title-box">
  28. <view></view>
  29. <view>实验室</view>
  30. </view>
  31. <picker @change="fjListChange"
  32. :range-key="'subjectName'" :value="id" :range="fjListArray">
  33. <view class="picker-min-box">
  34. <view>{{fjListIndex?fjListArray[fjListIndex].subjectName:'请选择实验室'}}</view>
  35. <img src="@/images/icon_06.png">
  36. </view>
  37. </picker>
  38. </view>
  39. <!-- <view class="picker-max-box">
  40. <view class="picker-title-box">
  41. <view>*</view>
  42. <view>疏散路径:</view>
  43. </view>
  44. <picker @change="buttonChangeTwo"
  45. :range-key="'name'" :value="id" :range="buttonArray">
  46. <view class="picker-min-box">
  47. <view>{{buttonArrayIndex?buttonArray[buttonArrayIndex].name:'请选择疏散路径'}}</view>
  48. <img src="@/images/icon_06.png">
  49. </view>
  50. </picker>
  51. </view> -->
  52. </view>
  53. <view class="setUpEvacuation-bottom-button" @click="confirmBtn">确认</view>
  54. </view>
  55. <view class="implementEvacuation" v-if="pageType == 2">
  56. <view class="evacuation-max-box">
  57. <!-- 头部 -->
  58. <view class="evacuation-title-box">
  59. <view class="evacuation-title-name-box">{{subName}}</view>
  60. <view class="site"><img src="@/images/icon_14.png">安全学院 环境与气象研究所</view>
  61. </view>
  62. <!-- 视频监控-选择疏散路径 -->
  63. <view class="monito">
  64. <view class="monito_li">
  65. 视频监控
  66. <view class="monito_li_r monito_li_r_text" @click="goVideo()">查看监控<img src="@/images/icon_04.png"></view>
  67. </view>
  68. <view class="monito_li" style="border:0;">
  69. 选择疏散路径
  70. <view class="monito_li_r">
  71. <picker @change="buttonChange"
  72. :range-key="'name'" :value="id" :range="buttonArray">
  73. <view class="evacuation-title-button-box">
  74. <view :class="buttonArrayIndex?'colorB':'colorA'">{{buttonArrayIndex?buttonArray[buttonArrayIndex].name:'修改疏散路径'}}</view>
  75. <img src="@/images/icon_06.png">
  76. </view>
  77. </picker>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 滚动部分 -->
  82. <!-- <view class="evacuation-scroll-box">
  83. <view :class="videoIndex == index?'scroll-box-color':''"
  84. @click="scrollBoxClick(index)"
  85. v-for="(item,index) in videoList" :key="index">{{item.name}}</view>
  86. </view> -->
  87. <!-- 视频部分 -->
  88. <!-- <view class="evacuation-video-box">
  89. <video
  90. :class="index == videoIndex?'video-a':'video-b'"
  91. v-for="(item,index) in videoList" :key="index"
  92. :id="urlList.id" :src="item.url"
  93. poster="http://lab.sxitdlc.com:9300/statics/logo/logo.png"
  94. :custom-cache='false' :autoplay="true" :controls="true"
  95. :enable-danmu="false" :muted="true" :show-fullscreen-btn="true"
  96. :show-center-play-btn="false" :show-play-btn="false"
  97. @error="videoErrorCallback" >
  98. </video>
  99. </view> -->
  100. <!-- 地图部分 -->
  101. <view class="roadmap">
  102. <view class="roadmap_t">
  103. <view class="monito_li_r_l">选择疏散路径</view>
  104. <view class="monito_li_r">
  105. <picker @change="buttonChange"
  106. :range-key="'name'" :value="id" :range="buttonArray">
  107. <view class="evacuation-title-button-box">
  108. <view :class="buttonArrayIndex?'colorB':'colorA'">{{buttonArrayIndex?buttonArray[buttonArrayIndex].name:'修改疏散路径'}}</view>
  109. <img src="@/images/icon_06.png">
  110. </view>
  111. </picker>
  112. </view>
  113. </view>
  114. <view class="evacuation-map-box">
  115. <view class="evacuation-map-big-box">
  116. <view class="evacuation-map-min-for-box" :class="subId == item.subjectId?'evacuation-map-min-for-box-color':''"
  117. v-for="(item,index) in fjList" :key="index">{{item.room}}</view>
  118. <img class="map-min-img" src="@/images/Version2.3/icon_sjt.gif" v-show="lightList[0].type">
  119. <img class="map-min-img" src="@/images/Version2.3/icon_yjt.gif" v-show="lightList[1].type">
  120. <img class="map-min-img" src="@/images/Version2.3/icon_zjt.gif" v-show="lightList[2].type">
  121. <img class="map-min-img" src="@/images/Version2.3/icon_yjt.gif" v-show="lightList[3].type">
  122. <img class="map-min-img" src="@/images/Version2.3/icon_zjt.gif" v-show="lightList[4].type">
  123. <img class="map-min-img" src="@/images/Version2.3/icon_yjt.gif" v-show="lightList[5].type">
  124. </view>
  125. </view>
  126. </view>
  127. <!-- 视频部分 -->
  128. <view class="video-max-box" v-if="urlList[0]">
  129. <video
  130. v-for="(item,index) in urlList" :key="index" :id="urlList.id" :src="item.url"
  131. :poster="videoCover"
  132. :custom-cache='false' :autoplay="true" :controls="true"
  133. :enable-danmu="false" :muted="true" :show-fullscreen-btn="true"
  134. :show-center-play-btn="false" :show-play-btn="false"
  135. @error="videoErrorCallback" >
  136. </video>
  137. </view>
  138. <view class="bottom-button-box">
  139. <view @click="shadeTypeClick()">语音广播</view>
  140. <view @click="lineEvacuate" v-if="isEvacuate">执行疏散</view>
  141. <view @click="closireButton" v-if="!isEvacuate">结束疏散</view>
  142. </view>
  143. </view>
  144. <view class="shade-max-big-box" v-if="broadcastType">
  145. <view class="null-box" @click="shadeTypeClick()"></view>
  146. <!-- 语音广播-执行疏散 -->
  147. <view class="broadcast">
  148. <view class="broadcast_t">语音广播<label>选择喇叭位置</label></view>
  149. <!-- 按钮部分 -->
  150. <view class="trumpet-max-box">
  151. <view @click="trumpetClick(index)"
  152. class="trumpet-for-box" :class="item.type?'trumpet-color-a':'trumpet-color-b'"
  153. v-for="(item,index) in trumpetList" :key="index">
  154. <img src="@/images/icon_sskz_zc.png" v-if="!item.type">
  155. <img src="@/images/icon_sskz_xz.png" v-if="item.type">
  156. {{item.name}}
  157. </view>
  158. </view>
  159. <view class="broadcast_m">
  160. <view class="broadcast_m_t" :class="liveType?'broadcast_m_t_back_a':'broadcast_m_t_back_b'" @longpress.stop="recordButton" @touchmove.stop="cancelButton" @touchend.stop="sendButton">
  161. <!-- <img src="@/images/icon_sskz_azsh.png" v-if="!liveType">
  162. <img src="@/images/icon_sskz_skfs.png" v-if="liveType"> -->
  163. <!-- <label class="slip_color" v-if="!liveType">按住说话</label>
  164. <label class="press_color" v-if="liveType">松开发送</label> -->
  165. {{liveType?'松开发送':'按住说话'}}
  166. </view>
  167. <view class="broadcast_m_b" v-if="!liveType">按住说话,录入广播内容</view>
  168. <view class="broadcast_m_b" v-if="liveType">松开发送,向上滑动取消发送</view>
  169. </view>
  170. </view>
  171. </view>
  172. <!-- <view class="live-button" :class="liveType?'live-color-a':'live-color-b'"
  173. @longpress.stop="recordButton" @touchmove.stop="cancelButton" @touchend.stop="sendButton">开始广播</view> -->
  174. </view>
  175. </view>
  176. </template>
  177. <script>
  178. import { config } from '@/api/request/config.js'
  179. import { lablayout,evacuate,closure,lineEvacuate,getRedis,getDeviceList,textParseUrlIps,getCameraByFloor,jinanGetStartList,nanhuGetStartList,lineEvacuateTow} from '@/api/index.js'
  180. export default {
  181. data() {
  182. return {
  183. videoCover:uni.getStorageSync('videoCover'),
  184. //页面状态
  185. pageType:"",
  186. //学院
  187. collegeArray:[{name:"环境学院-祈福楼",id:"113"}],
  188. //楼栋
  189. deptArray:[{name:"环境与气象研究所",id:"137"}],
  190. deptIndex:0,
  191. //实验室
  192. fjListArray:[],
  193. fjListIndex:"",
  194. //疏散方向
  195. buttonArray:[
  196. {name:"向左疏散",id:"1"},
  197. {name:"向右疏散",id:"2"},
  198. {name:"两侧疏散",id:"0"},
  199. ],
  200. buttonArrayIndex:"2",
  201. //视频数据
  202. urlList:[],
  203. //布局数据
  204. fjList:[],
  205. lightList:[
  206. {
  207. id:"5",
  208. type:false,
  209. },
  210. {
  211. id:"2",
  212. type:false,
  213. },
  214. {
  215. id:"3",
  216. type:false,
  217. },
  218. {
  219. id:"4",
  220. type:false,
  221. },
  222. {
  223. id:"1",
  224. type:false,
  225. },
  226. {
  227. id:"6",
  228. type:false,
  229. },
  230. ],
  231. //接收参数
  232. subId:"",
  233. subName:"",
  234. title:"",
  235. type:"",
  236. //喇叭数据
  237. trumpetList:[],
  238. //广播相关
  239. liveType:false,
  240. sendLock: true, //发送锁,当为true时上锁,false时解锁发送
  241. recorderManager : wx.getRecorderManager(),
  242. isEvacuate:true,//疏散按钮控制,当为true时候执行疏散
  243. //滑动记录
  244. startPoint:{},
  245. //摄像头信息
  246. deptId:'',
  247. itemData:{
  248. hardwareNUM:'',
  249. name:'',
  250. },
  251. broadcastType:false,
  252. }
  253. },
  254. onLoad(option) {
  255. let self = this;
  256. //判断入口(执行疏散)
  257. if(option.item){
  258. let item = JSON.parse(decodeURIComponent(option.item));
  259. this.subId = item.subId;
  260. this.title = item.title;
  261. this.type = item.type;
  262. this.evacuateTwo();
  263. }else{
  264. //判断入口(首页按钮)
  265. this.getRedis();
  266. }
  267. },
  268. onShow(){
  269. this.getAppExitLine();
  270. this.lablayout();
  271. getApp().watch(this.getMqttLineData,'lineData');
  272. this.getCameraByFloor();
  273. },
  274. methods: {
  275. getAppExitLine(){
  276. let list = [{type:"lab/exit/line"}];
  277. getApp().appMqttOn(1,list);
  278. },
  279. shadeTypeClick(){
  280. this.broadcastType = !this.broadcastType
  281. },
  282. async evacuateTwo(){
  283. const {data} = await lineEvacuateTow(this.subId,0)
  284. if(data.code == 200){
  285. if(data.data){
  286. this.pageType = 2;
  287. uni.showToast({
  288. title: '执行成功',
  289. icon:"none",
  290. mask:true,
  291. duration: 2000
  292. });
  293. this.initialization(data.data);
  294. }
  295. }
  296. },
  297. //跳转摄像头列表
  298. goVideo(){
  299. this.itemData.id=this.subId;
  300. uni.navigateTo({
  301. url:'/pages_manage/workbench/laboratory/monitor?item='+encodeURIComponent(JSON.stringify(this.itemData))+'&deptId='+this.deptId
  302. })
  303. },
  304. //获取楼层摄像头列表
  305. async getCameraByFloor(){
  306. const {data} = await getCameraByFloor({floorId:5})
  307. if(data.code == 200){
  308. if(data.data[0]){
  309. //this.nanhuGetStartList(data.data);
  310. this.itemData.hardwareNUM=data.data.join(',')
  311. // this.startUrl(response.data);
  312. }
  313. }
  314. },
  315. async nanhuGetStartList(rows){
  316. let self = this;
  317. let list = "";
  318. for(let i=0;i<rows.length;i++){
  319. list = list + rows[i]+","
  320. }
  321. let obj = {
  322. page:"1",
  323. count:"100",
  324. deviceIds:list,
  325. // deviceIds:'440102004920000000011111,2C440102004920000000011112',
  326. };
  327. const {data} = await jinanGetStartList(obj)
  328. if(data.code == 200){
  329. let list = [];
  330. for(let i=0;i<data.data.length;i++){
  331. let text = 'https://lab.sxitdlc.com/jinandaxue/stream/';
  332. let url = data.data[i].result.body.data.fmp4;
  333. url = url.split("rtp/");
  334. let newUrl = text+'rtp/'+url[1];
  335. let obj = {
  336. name:"楼道监控"+(i+1),
  337. id:data.data[i].result.body.data.deviceID,
  338. url:newUrl,
  339. }
  340. list.push(obj)
  341. }
  342. this.urlList = list;
  343. }
  344. },
  345. //点击选择喇叭
  346. trumpetClick(index){
  347. this.trumpetList[index].type = !this.trumpetList[index].type
  348. },
  349. //录制
  350. recordButton(e){
  351. console.log("按下")
  352. let self = this;
  353. let num = 0;
  354. for(let i=0;i<self.trumpetList.length;i++){
  355. if(self.trumpetList[i].type){
  356. num++
  357. }
  358. }
  359. if(num == 0){
  360. uni.showToast({
  361. title: '请选择喇叭',
  362. icon:"none",
  363. mask:true,
  364. duration: 2000
  365. });
  366. return
  367. }
  368. this.liveType=true;
  369. console.log('录制',e)
  370. this.startPoint = e.touches[0];//记录长按时开始点信息,后面用于计算上划取消时手指滑动的距离。
  371. const options = {
  372. duration: 10000,
  373. sampleRate: 16000,
  374. numberOfChannels: 1,
  375. encodeBitRate: 48000,
  376. format: 'mp3',
  377. frameSize: 50
  378. }
  379. this.recorderManager.start(options);//开始录音
  380. this.recorderManager.onStart(() => {
  381. console.log('recorder start')
  382. })
  383. this.recorderManager.onError((res) => {
  384. console.log(res);
  385. })
  386. wx.showToast({
  387. title: "正在录音,上划取消发送",
  388. icon: "none",
  389. duration: 60000//先定义个60秒,后面可以手动调用wx.hideToast()隐藏
  390. });
  391. this.sendLock = false;//长按时是不上锁的。
  392. },
  393. //取消
  394. cancelButton(e){
  395. console.log("移动")
  396. let self = this;
  397. let num = 0;
  398. for(let i=0;i<self.trumpetList.length;i++){
  399. if(self.trumpetList[i].type){
  400. num++
  401. }
  402. }
  403. if(num == 0){
  404. return
  405. }
  406. this.liveType=false;
  407. console.log('取消',e)
  408. let moveLenght = e.touches[e.touches.length - 1].clientY - this.startPoint.clientY; //移动距离
  409. if (Math.abs(moveLenght) > 50) {
  410. wx.showToast({
  411. title: "松开手指,取消发送",
  412. icon: "none",
  413. duration: 60000
  414. });
  415. this.sendLock = true;//触发了上滑取消发送,上锁
  416. } else {
  417. wx.showToast({
  418. title: "正在录音,上划取消发送",
  419. icon: "none",
  420. duration: 60000
  421. });
  422. this.sendLock = false;//上划距离不足,依然可以发送,不上锁
  423. }
  424. },
  425. //发送
  426. sendButton(e){
  427. console.log("松开")
  428. let self = this;
  429. let num = 0;
  430. for(let i=0;i<self.trumpetList.length;i++){
  431. if(self.trumpetList[i].type){
  432. num++
  433. }
  434. }
  435. if(num == 0){
  436. return
  437. }
  438. this.liveType=false;
  439. console.log('发送',e)
  440. wx.hideToast();//结束录音、隐藏Toast提示框
  441. this.recorderManager.stop();//结束录音
  442. this.recorderManager.onStop((res) => {
  443. if(!this.sendLock){
  444. console.log('1', this.recorderManager)
  445. this.uploadImg(res.tempFilePath);
  446. }
  447. console.log('停止录音', res.tempFilePath)
  448. console.log("sendLock",this.sendLock);
  449. })
  450. },
  451. //上传MP3
  452. async uploadImg(tempFilePaths){
  453. var self = this;
  454. uni.uploadFile({
  455. url: config.base_url+'/file/upload', //仅为示例,非真实的接口地址
  456. header:{'Authorization':uni.getStorageSync('token')},
  457. filePath: tempFilePaths,
  458. name: 'file',
  459. formData: {
  460. 'user': 'test'
  461. },
  462. success: (uploadFileRes) => {
  463. let res = JSON.parse(uploadFileRes.data);
  464. if(res.code == 200){
  465. console.log("上传成功",res)
  466. // self.textParseUrlIps(res.data.url);
  467. self.textParseUrlIps(config.base_url+ '/' +res.data.url);
  468. // self.newData.imgList.push(res.data.url);
  469. }else{
  470. uni.showToast({
  471. title: res.msg,
  472. icon:"none",
  473. mask:true,
  474. duration: 2000
  475. });
  476. }
  477. },
  478. fail: err => {
  479. uni.hideLoading()
  480. },
  481. complete: () => {
  482. }
  483. });
  484. },
  485. //发送语音
  486. async textParseUrlIps(text){
  487. let self = this;
  488. let newList = [];
  489. for(let i=0;i<self.trumpetList.length;i++){
  490. if(self.trumpetList[i].type){
  491. let obj = {
  492. sn:self.trumpetList[i].deviceSn,
  493. port:self.trumpetList[i].port,
  494. deviceIp:self.trumpetList[i].deviceIp,
  495. type:"",
  496. name:"",
  497. speed:"",
  498. params:{
  499. tid:"",
  500. vol:"",
  501. urls:[]
  502. }
  503. };
  504. newList.push(obj);
  505. }
  506. }
  507. const {data} = await textParseUrlIps(newList,text)
  508. if(data.code == 200){
  509. uni.showToast({
  510. title: '发送成功',
  511. icon:"none",
  512. mask:true,
  513. duration: 2000
  514. });
  515. }
  516. },
  517. //监听应急疏散数据变更
  518. getMqttLineData(val){
  519. console.log('收到疏散MQTT')
  520. let self = this;
  521. if(val.EXIT_LINE_MESSAGE){
  522. console.log('数据改变')
  523. this.evacuate();
  524. }else{
  525. console.log('应急疏散已结束')
  526. uni.showToast({
  527. title: '应急疏散已结束',
  528. icon:"none",
  529. mask:true,
  530. duration: 2000
  531. });
  532. setTimeout(function(){
  533. uni.navigateBack();
  534. },2000);
  535. }
  536. },
  537. //获取当前疏散数据
  538. async getRedis(){
  539. let self = this;
  540. const {data} = await getRedis()
  541. if(data.code == 200){
  542. if(data.data){
  543. this.isEvacuate=false;
  544. this.deptId = data.data.deptId;
  545. this.subId = data.data.subId;
  546. this.subName = data.data.subName;
  547. this.evacuate();
  548. }else{
  549. this.pageType = 1;
  550. this.isEvacuate=true;
  551. }
  552. }
  553. },
  554. //实验室选择
  555. fjListChange(e){
  556. this.fjListIndex = e.detail.value;
  557. this.$set(this,'subName',this.fjListArray[this.fjListIndex].subjectName);
  558. this.$set(this,'subId',this.fjListArray[e.detail.value].subjectId);
  559. this.$set(this,'deptId',this.fjListArray[e.detail.value].deptId);
  560. this.itemData.name=this.fjListArray[e.detail.value].subjectName
  561. this.itemData.floorId=this.fjListArray[e.detail.value].floorId
  562. this.itemData.id=this.fjListArray[e.detail.value].id
  563. console.log(this.fjListArray[e.detail.value])
  564. },
  565. //疏散路线选择
  566. buttonChangeTwo(e){
  567. this.buttonArrayIndex = e.detail.value;
  568. },
  569. //执行疏散
  570. async evacuate(){
  571. console.log("执行疏散")
  572. const {data} = await evacuate(this.subId)
  573. if(data.code == 200){
  574. if(data.data){
  575. this.initialization(data.data);
  576. }
  577. }
  578. },
  579. //结束疏散
  580. closireButton(){
  581. let self = this;
  582. uni.showModal({
  583. content: '确认结束疏散吗?',
  584. cancelColor:"#999",
  585. confirmColor:"#0183FA",
  586. success: function (res) {
  587. if (res.confirm) {
  588. self.closure();
  589. this.isEvacuate=true;
  590. console.log('用户点击确定');
  591. } else if (res.cancel) {
  592. console.log('用户点击取消');
  593. }
  594. }
  595. });
  596. },
  597. async closure(){
  598. const {data} = await closure(this.subId)
  599. if(data.code == 200){
  600. uni.showToast({
  601. title: '操作成功',
  602. icon:"none",
  603. mask:true,
  604. duration: 2000
  605. });
  606. setTimeout(function(){
  607. uni.navigateBack();
  608. },2000);
  609. }
  610. },
  611. buttonChange(e){
  612. this.buttonArrayIndex = e.detail.value;
  613. this.lineEvacuate();
  614. },
  615. /* 确认 */
  616. confirmBtn(){
  617. if(!this.subId){
  618. uni.showToast({
  619. title: '请选择实验室',
  620. icon:"none",
  621. mask:true,
  622. duration: 2000
  623. });
  624. return
  625. }
  626. this.lineEvacuateTow();
  627. },
  628. /* 2.5获取疏散线路 */
  629. async lineEvacuateTow(){
  630. if(!this.buttonArrayIndex){
  631. uni.showToast({
  632. title: '请选择疏散路线',
  633. icon:"none",
  634. mask:true,
  635. duration: 2000
  636. });
  637. return
  638. }
  639. const {data} = await lineEvacuateTow(this.subId,this.buttonArray[this.buttonArrayIndex].id)
  640. if(data.code == 200){
  641. if(data.data){
  642. this.pageType = 2;
  643. uni.showToast({
  644. title: '执行成功',
  645. icon:"none",
  646. mask:true,
  647. duration: 2000
  648. });
  649. this.initialization(data.data);
  650. }
  651. }
  652. },
  653. //执行疏散
  654. async lineEvacuate(){
  655. if(!this.subId){
  656. uni.showToast({
  657. title: '请选择实验室',
  658. icon:"none",
  659. mask:true,
  660. duration: 2000
  661. });
  662. return
  663. }
  664. if(!this.buttonArrayIndex){
  665. uni.showToast({
  666. title: '请选择疏散路线',
  667. icon:"none",
  668. mask:true,
  669. duration: 2000
  670. });
  671. return
  672. }
  673. const {data} = await lineEvacuate(this.subId,this.buttonArray[this.buttonArrayIndex].id)
  674. if(data.code == 200){
  675. if(data.data){
  676. console.log('执行疏散')
  677. this.isEvacuate=false;
  678. uni.showToast({
  679. title: '执行成功',
  680. icon:"none",
  681. mask:true,
  682. duration: 2000
  683. });
  684. this.initialization(data.data);
  685. }
  686. }
  687. },
  688. //灯初始化
  689. initialization(list){
  690. console.log('灯数据',list);
  691. let self = this;
  692. let newList = [
  693. {
  694. id:"5",
  695. type:false,
  696. },
  697. {
  698. id:"2",
  699. type:false,
  700. },
  701. {
  702. id:"3",
  703. type:false,
  704. },
  705. {
  706. id:"4",
  707. type:false,
  708. },
  709. {
  710. id:"1",
  711. type:false,
  712. },
  713. {
  714. id:"6",
  715. type:false,
  716. },
  717. ];
  718. for(let i=0;i<list.length;i++){
  719. for(let o=0;o<newList.length;o++){
  720. if(list[i].lightId == newList[o].id){
  721. newList[o].type = true;
  722. }
  723. }
  724. }
  725. this.lightList = newList;
  726. console.log('灯数据改变',this.lightList);
  727. this.pageType = 2;
  728. this.$forceUpdate();
  729. this.getDeviceList();
  730. },
  731. async getDeviceList(){
  732. let obj ={
  733. floorId:5,
  734. page:1,
  735. pageSize:100,
  736. };
  737. const {data} = await getDeviceList(obj)
  738. if(data.code == 200){
  739. for(let i=0;i<data.data.length;i++){
  740. data.data[i].type = false;
  741. }
  742. this.$set(this,'trumpetList',data.data)
  743. }
  744. },
  745. //摄像头切换
  746. scrollBoxClick(index){
  747. this.videoIndex = index;
  748. },
  749. //获取实验室布局
  750. async lablayout(){
  751. let self = this;
  752. const {data} = await lablayout(137)
  753. if(data.code == 200){
  754. for(let i=0;i<data.data.length;i++){
  755. if(data.data[i].id == 5){
  756. self.fjList = data.data[i].list;
  757. let newList = [];
  758. for(let o=0;o<data.data[i].list.length;o++){
  759. if(data.data[i].list[o].subjectId != -1){
  760. newList.push(data.data[i].list[o]);
  761. }
  762. }
  763. this.$set(this,'fjListArray',newList);
  764. }
  765. }
  766. }
  767. },
  768. },
  769. beforeDestroy(){
  770. //断开mqtt连接
  771. getApp().offMQTT();
  772. //删除应急疏散监听
  773. getApp().deleteLineData();
  774. }
  775. }
  776. </script>
  777. <style lang="stylus" scoped>
  778. #emergencyEvacuationBig{
  779. height:100%;
  780. width:100%;
  781. display:flex;
  782. flex-direction:column;
  783. overflow-y:scroll;
  784. .setUpEvacuation{
  785. flex:1;
  786. display:flex;
  787. flex-direction:column;
  788. overflow-y:scroll;
  789. .evacuation-max-box{
  790. width:710rpx;
  791. margin:20rpx 20rpx;
  792. background #fff
  793. border-radius:20rpx;
  794. padding:20rpx 0;
  795. .picker-max-box{
  796. .picker-title-box{
  797. padding:0 20rpx;
  798. display flex
  799. view{
  800. line-height:80rpx;
  801. font-size:28rpx;
  802. }
  803. view:nth-child(1){
  804. color:red;
  805. }
  806. view:nth-child(2){
  807. }
  808. view:nth-child(3){
  809. color:#999;
  810. }
  811. }
  812. .picker-min-box{
  813. display flex;
  814. height:80rpx;
  815. width:667rpx;
  816. border:1rpx solid #a2a2a2;
  817. border-radius:10rpx;
  818. margin:0 20rpx;
  819. view{
  820. flex:1;
  821. line-height:80rpx;
  822. padding:0 20rpx;
  823. color:#999;
  824. font-size:28rpx;
  825. }
  826. img{
  827. width:24rpx;
  828. height:12rpx;
  829. margin:35rpx 23rpx;
  830. }
  831. }
  832. }
  833. }
  834. }
  835. .implementEvacuation{
  836. flex:1;
  837. display:flex;
  838. flex-direction:column;
  839. overflow-y:scroll;
  840. .evacuation-max-box{
  841. width:710rpx;
  842. margin:20rpx 20rpx;
  843. /* background #fff */
  844. border-radius:20rpx;
  845. padding:20rpx 0 30rpx;
  846. .evacuation-title-box{
  847. height:150rpx;
  848. //border-bottom:1rpx solid #dedede;
  849. background: #FFFFFF;
  850. border-radius: 20rpx;
  851. padding-left:22rpx;
  852. padding-top:34rpx;
  853. box-sizing :border-box;
  854. .evacuation-title-name-box{
  855. font-size: 30rpx;
  856. font-family: PingFang SC;
  857. font-weight: 500;
  858. color: #333333;
  859. line-height: 30rpx;
  860. }
  861. .site{
  862. font-size: 28rpx;
  863. font-family: PingFang SC;
  864. font-weight: 500;
  865. color: #999999;
  866. line-height: 30rpx;
  867. margin-top:32rpx;
  868. display :flex;
  869. justify-content :flex-start;
  870. align-items center;
  871. >img{
  872. width: 28rpx;
  873. height: 30rpx;
  874. margin-right:18rpx;
  875. }
  876. }
  877. }
  878. /* 视频监控-选择疏散路线 */
  879. .monito{
  880. width: 710rpx;
  881. height: 161rpx;
  882. background: #FFFFFF;
  883. border-radius: 20rpx;
  884. padding :0 14rpx;
  885. box-sizing border-box;
  886. margin-top :20rpx;
  887. .monito_li{
  888. width: 680rpx;
  889. height: 80rpx;
  890. font-size: 30rpx;
  891. font-family: PingFang SC;
  892. font-weight: 500;
  893. color: #333333;
  894. line-height: 80rpx;
  895. border-bottom: 1rpx solid #E0E0E0;
  896. display :flex;
  897. justify-content :space-between;
  898. .monito_li_r_text{
  899. font-size:28rpx!important;
  900. padding-right:37rpx;
  901. }
  902. .monito_li_r{
  903. width :380rpx;
  904. font-size: 24rpx;
  905. font-family: PingFang SC;
  906. font-weight: 500;
  907. color: #0183FA;
  908. line-height: 80rpx;
  909. display :flex;
  910. justify-content :flex-end;
  911. align-items center;
  912. >img{
  913. width: 9rpx;
  914. height: 22rpx;
  915. margin-left :20rpx;
  916. }
  917. .evacuation-title-button-box{
  918. display flex
  919. overflow hidden
  920. view{
  921. line-height:61rpx;
  922. font-size:28rpx;
  923. }
  924. .colorA{
  925. color: #0183FA;
  926. }
  927. .colorB{
  928. color:#0183FA;
  929. }
  930. img{
  931. margin:28rpx 20rpx 0;
  932. width:24rpx;
  933. height:9rpx;
  934. }
  935. }
  936. }
  937. }
  938. }
  939. .evacuation-scroll-box{
  940. height:95rpx;
  941. overflow-x scroll
  942. overflow-y hidden
  943. white-space:nowrap;
  944. margin:0 20rpx;
  945. view{
  946. line-height:95rpx;
  947. font-size:28rpx;
  948. display inline-block
  949. margin-right:45rpx;
  950. }
  951. .scroll-box-color{
  952. color:#0183FA;
  953. }
  954. }
  955. .evacuation-video-box{
  956. width:668rpx;
  957. height:341rpx;
  958. margin:0 auto;
  959. position relative
  960. video{
  961. position absolute
  962. top:0;
  963. left:0;
  964. width:668rpx;
  965. height:341rpx;
  966. margin:0 auto;
  967. }
  968. .video-a{
  969. z-index:100;
  970. }
  971. .video-b{
  972. z-index:0;
  973. }
  974. }
  975. /* 路线图 */
  976. .roadmap{
  977. width: 710rpx;
  978. height: 464rpx;
  979. background: #FFFFFF;
  980. border-radius: 20rpx;
  981. padding :20rpx 20rpx 0;
  982. box-sizing :border-box;
  983. margin-top :20rpx;
  984. .roadmap_t{
  985. font-size: 30rpx;
  986. font-family: PingFang SC;
  987. font-weight: 500;
  988. color: #333333;
  989. line-height: 30rpx;
  990. display:flex;
  991. .monito_li_r_l{
  992. flex:1;
  993. line-height:61rpx;
  994. font-size:28rpx;
  995. }
  996. .monito_li_r{
  997. width :380rpx;
  998. font-size: 24rpx;
  999. font-family: PingFang SC;
  1000. font-weight: 500;
  1001. color: #0183FA;
  1002. line-height: 80rpx;
  1003. display :flex;
  1004. justify-content :flex-end;
  1005. align-items center;
  1006. >img{
  1007. width: 9rpx;
  1008. height: 22rpx;
  1009. margin-left :20rpx;
  1010. }
  1011. .evacuation-title-button-box{
  1012. display flex
  1013. overflow hidden
  1014. view{
  1015. line-height:61rpx;
  1016. font-size:28rpx;
  1017. }
  1018. .colorA{
  1019. color: #0183FA;
  1020. }
  1021. .colorB{
  1022. color:#0183FA;
  1023. }
  1024. img{
  1025. margin:28rpx 20rpx 0;
  1026. width:24rpx;
  1027. height:9rpx;
  1028. }
  1029. }
  1030. }
  1031. }
  1032. .evacuation-map-box{
  1033. width:668rpx;
  1034. height:348rpx;
  1035. margin:0 auto;
  1036. overflow:hidden;
  1037. border:1rpx solid #E0E0E0;
  1038. margin-top:20rpx;
  1039. .evacuation-map-big-box{
  1040. height:285rpx;
  1041. width:641rpx;
  1042. background:url(../images/Version2.3/icon_bj_syspmtcy_jinan.png);
  1043. background-size 100%
  1044. margin:28rpx 13rpx ;
  1045. position relative
  1046. .evacuation-map-min-for-box{
  1047. overflow: hidden;
  1048. display: inline-block;
  1049. line-height:70rpx;
  1050. text-align: center;
  1051. font-size:14rpx;
  1052. }
  1053. .evacuation-map-min-for-box-color{
  1054. background: rgba(0,189,255,0.3);
  1055. }
  1056. .evacuation-map-min-for-box:nth-child(1){
  1057. margin:4rpx 82rpx 0 0;
  1058. width:91rpx;
  1059. height:91rpx;
  1060. }
  1061. .evacuation-map-min-for-box:nth-child(2){
  1062. margin:4rpx 0 0 0;
  1063. width:57rpx;
  1064. height:91rpx;
  1065. }
  1066. .evacuation-map-min-for-box:nth-child(3){
  1067. margin:4rpx 0 0 0;
  1068. width:57rpx;
  1069. height:91rpx;
  1070. }
  1071. .evacuation-map-min-for-box:nth-child(4){
  1072. margin:4rpx 0 0 0;
  1073. width:57rpx;
  1074. height:91rpx;
  1075. }
  1076. .evacuation-map-min-for-box:nth-child(5){
  1077. margin:4rpx 0 0 0;
  1078. width:58rpx;
  1079. height:91rpx;
  1080. }
  1081. .evacuation-map-min-for-box:nth-child(6){
  1082. margin:4rpx 0 0 0;
  1083. width:57rpx;
  1084. height:91rpx;
  1085. }
  1086. .evacuation-map-min-for-box:nth-child(7){
  1087. margin:4rpx 0 0 0;
  1088. width:57rpx;
  1089. height:91rpx;
  1090. }
  1091. .evacuation-map-min-for-box:nth-child(8){
  1092. margin:4rpx 40rpx 0 0;
  1093. width:57rpx;
  1094. height:91rpx;
  1095. }
  1096. .evacuation-map-min-for-box:nth-child(9){
  1097. margin:47rpx 0 0 0;
  1098. width:51rpx;
  1099. height:136rpx;
  1100. line-height:140rpx;
  1101. }
  1102. .evacuation-map-min-for-box:nth-child(10){
  1103. margin:47rpx 0 0 0;
  1104. width:60rpx;
  1105. height:136rpx;
  1106. line-height:140rpx;
  1107. }
  1108. .evacuation-map-min-for-box:nth-child(11){
  1109. margin:47rpx 0 0 0;
  1110. width:62rpx;
  1111. height:136rpx;
  1112. line-height:140rpx;
  1113. }
  1114. .evacuation-map-min-for-box:nth-child(12){
  1115. margin:47rpx 0 0 0;
  1116. width:58rpx;
  1117. height:136rpx;
  1118. line-height:140rpx;
  1119. }
  1120. .evacuation-map-min-for-box:nth-child(13){
  1121. margin:47rpx 0 0 0;
  1122. width:57rpx;
  1123. height:136rpx;
  1124. line-height:140rpx;
  1125. }
  1126. .evacuation-map-min-for-box:nth-child(14){
  1127. margin:47rpx 0 0 0;
  1128. width:57rpx;
  1129. height:136rpx;
  1130. line-height:140rpx;
  1131. }
  1132. .evacuation-map-min-for-box:nth-child(15){
  1133. margin:47rpx 0 0 0;
  1134. width:57rpx;
  1135. height:136rpx;
  1136. line-height:140rpx;
  1137. }
  1138. .evacuation-map-min-for-box:nth-child(16){
  1139. margin:47rpx 0 0 0;
  1140. width:57rpx;
  1141. height:136rpx;
  1142. line-height:140rpx;
  1143. }
  1144. .evacuation-map-min-for-box:nth-child(17){
  1145. margin:47rpx 0 0 0;
  1146. width:57rpx;
  1147. height:136rpx;
  1148. line-height:140rpx;
  1149. }
  1150. .evacuation-map-min-for-box:nth-child(18){
  1151. margin:47rpx 0 0 0;
  1152. width:57rpx;
  1153. height:136rpx;
  1154. line-height:140rpx;
  1155. }
  1156. .map-min-img{
  1157. position: absolute;
  1158. width:34rpx;
  1159. height:22rpx;
  1160. }
  1161. .map-min-img:nth-child(19){
  1162. top: 64rpx;
  1163. left: 94rpx;
  1164. }
  1165. .map-min-img:nth-child(20){
  1166. top: 109rpx;
  1167. left: 134rpx;
  1168. }
  1169. .map-min-img:nth-child(21){
  1170. top: 109rpx;
  1171. left:290rpx;
  1172. }
  1173. .map-min-img:nth-child(22){
  1174. top: 109rpx;
  1175. left:350rpx;
  1176. }
  1177. .map-min-img:nth-child(23){
  1178. top: 109rpx;
  1179. left:520rpx;
  1180. }
  1181. .map-min-img:nth-child(24){
  1182. top: 109rpx;
  1183. left:580rpx;
  1184. }
  1185. }
  1186. }
  1187. }
  1188. .video-max-box{
  1189. width: 710rpx;
  1190. height: 780rpx;
  1191. overflow-y scroll;
  1192. background: #FFFFFF;
  1193. border-radius: 20rpx;
  1194. padding :22rpx 30rpx 30rpx;
  1195. box-sizing :border-box;
  1196. margin-top :20rpx;
  1197. margin-bottom:120rpx;
  1198. video{
  1199. width:645rpx;
  1200. height:355rpx;
  1201. }
  1202. }
  1203. .bottom-button-box{
  1204. position absolute;
  1205. bottom:20rpx;
  1206. display flex;
  1207. width:670rpx;
  1208. margin:20rpx;
  1209. view{
  1210. width:335rpx;
  1211. height:100rpx;
  1212. line-height:100rpx;
  1213. text-align center;
  1214. color:#fff;
  1215. font-size:28rpx;
  1216. }
  1217. view:nth-child(1){
  1218. border-top-left-radius :50rpx;
  1219. border-bottom-left-radius :50rpx;
  1220. background:#FF9C00;
  1221. }
  1222. view:nth-child(2){
  1223. border-top-right-radius :50rpx;
  1224. border-bottom-right-radius :50rpx;
  1225. background:#0183FA;
  1226. }
  1227. }
  1228. }
  1229. .live-button{
  1230. width:650rpx;
  1231. height:100rpx;
  1232. line-height:100rpx;
  1233. text-align center;
  1234. font-size:28rpx;
  1235. margin:50rpx auto 0;
  1236. border-radius:20rpx;
  1237. }
  1238. .live-color-a{
  1239. color:#fff;
  1240. background:#FF8686;
  1241. }
  1242. .live-color-b{
  1243. color:#fff;
  1244. background:#25C95B;
  1245. }
  1246. .shade-max-big-box{
  1247. height:100%;
  1248. width:100%;
  1249. position fixed
  1250. display flex;
  1251. flex-direction column
  1252. z-index:10;
  1253. background :rgba(0,0,0,0.2);
  1254. .null-box{
  1255. flex:1;
  1256. }
  1257. /* 语音广播-执行疏散 */
  1258. .broadcast{
  1259. width: 100%;
  1260. // height: 532rpx;
  1261. background: #FFFFFF;
  1262. border-top-left-radius :20rpx;
  1263. border-top-right-radius :20rpx
  1264. padding :22rpx 30rpx 30rpx;
  1265. box-sizing :border-box;
  1266. margin-top:20rpx;
  1267. .broadcast_t{
  1268. font-size: 30rpx;
  1269. font-family: PingFang SC;
  1270. font-weight: 500;
  1271. color: #333333;
  1272. line-height: 30rpx;
  1273. >label{
  1274. font-size: 24rpx;
  1275. font-family: PingFang SC;
  1276. font-weight: 500;
  1277. color: #999999;
  1278. line-height: 30rpx;
  1279. margin-left :16rpx;
  1280. }
  1281. }
  1282. .trumpet-max-box{
  1283. display :flex;
  1284. justify-content :flex-start;
  1285. margin-top :22rpx;
  1286. flex-wrap: wrap;
  1287. .trumpet-for-box{
  1288. display:inline-block;
  1289. width:200rpx;
  1290. height:60rpx;
  1291. line-height:60rpx;
  1292. font-size:24rpx;
  1293. text-align center;
  1294. cursor: pointer;
  1295. overflow: hidden;
  1296. border: 1rpx solid #E0E0E0;
  1297. border-radius:10rpx;
  1298. color: #E0E0E0;
  1299. display :flex;
  1300. justify-content :center;
  1301. margin-right :20rpx;
  1302. margin-bottom: 10rpx;
  1303. >img{
  1304. width:36rpx;
  1305. height:34rpx;
  1306. margin :12rpx 20rpx 0 25rpx;
  1307. }
  1308. }
  1309. .trumpet-color-a{
  1310. border:1px solid #0183FA;
  1311. color:#0183FA;
  1312. }
  1313. .trumpet-color-b{
  1314. border:1px solid #CCCCCC;
  1315. color:#999;
  1316. }
  1317. }
  1318. .broadcast_m{
  1319. width :100%;
  1320. .broadcast_m_t{
  1321. width: 142rpx;
  1322. height: 142rpx;
  1323. margin :30rpx 0 0 258rpx;
  1324. position :relative;
  1325. font-size: 24rpx;
  1326. font-family: PingFang SC;
  1327. font-weight: 500;
  1328. line-height: 170rpx;
  1329. text-align center
  1330. >img{
  1331. width: 142rpx;
  1332. height: 142rpx;
  1333. position :absolute;
  1334. }
  1335. >label{
  1336. width :100%;
  1337. font-size: 24rpx;
  1338. font-family: PingFang SC;
  1339. font-weight: 500;
  1340. color: #0183FA;
  1341. line-height: 24rpx;
  1342. display :inline-block;
  1343. text-align :center;
  1344. position :absolute;
  1345. top:76rpx;
  1346. }
  1347. /* 按下 */
  1348. .press_color{
  1349. color: #FFFFFF;
  1350. }
  1351. /* 松开 */
  1352. .slip_color{
  1353. color: #0183FA;
  1354. }
  1355. }
  1356. .broadcast_m_t_back_a{
  1357. background:url(@/images/icon_sskz_skfs.png);
  1358. background-size 100%
  1359. color: #FFFFFF;
  1360. }
  1361. .broadcast_m_t_back_b{
  1362. background:url(@/images/icon_sskz_azsh.png);
  1363. background-size 100%
  1364. color: #0183FA;
  1365. }
  1366. .broadcast_m_b{
  1367. font-size: 24rpx;
  1368. font-family: PingFang SC;
  1369. font-weight: 500;
  1370. color: #999999;
  1371. line-height: 24rpx;
  1372. text-align center;
  1373. margin-top :14rpx;
  1374. }
  1375. }
  1376. /* 疏散按钮 */
  1377. .evacuation-button-box{
  1378. width:650rpx;
  1379. height:100rpx;
  1380. background #0183FA
  1381. color:#fff;
  1382. text-align center;
  1383. line-height:100rpx;
  1384. font-size:28rpx;
  1385. margin:88rpx auto 0;
  1386. border-radius:20rpx;
  1387. }
  1388. }
  1389. }
  1390. }
  1391. .setUpEvacuation-bottom-button{
  1392. width:650rpx;
  1393. height:100rpx;
  1394. background #0183FA
  1395. color:#fff;
  1396. text-align center;
  1397. line-height:100rpx;
  1398. font-size:28rpx;
  1399. margin:50rpx auto;
  1400. border-radius:20rpx;
  1401. }
  1402. }
  1403. </style>