emergencyEvacuationBig.vue 34 KB

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