emergencyEvacuationBig.vue 36 KB

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