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