emergencyEvacuationBig.vue 34 KB

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