emergencyEvacuationBig.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433
  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.evacuate();
  552. }else{
  553. this.pageType = 1;
  554. this.isEvacuate=true;
  555. }
  556. }
  557. },
  558. //实验室选择
  559. fjListChange(e){
  560. this.fjListIndex = e.detail.value;
  561. this.$set(this,'subName',this.fjListArray[this.fjListIndex].subjectName);
  562. this.$set(this,'subId',this.fjListArray[e.detail.value].subjectId);
  563. this.$set(this,'deptId',this.fjListArray[e.detail.value].deptId);
  564. this.itemData.name=this.fjListArray[e.detail.value].subjectName
  565. this.itemData.floorId=this.fjListArray[e.detail.value].floorId
  566. this.itemData.id=this.fjListArray[e.detail.value].id
  567. this.itemData.subjectId=this.fjListArray[e.detail.value].subjectId
  568. },
  569. //疏散路线选择
  570. buttonChangeTwo(e){
  571. this.buttonArrayIndex = e.detail.value;
  572. },
  573. //执行疏散
  574. async evacuate(){
  575. console.log("执行疏散")
  576. const {data} = await evacuate(this.subId)
  577. if(data.code == 200){
  578. if(data.data){
  579. this.initialization(data.data);
  580. }
  581. }
  582. },
  583. //结束疏散
  584. closireButton(){
  585. let self = this;
  586. uni.showModal({
  587. content: '确认结束疏散吗?',
  588. cancelColor:"#999",
  589. confirmColor:"#0183FA",
  590. success: function (res) {
  591. if (res.confirm) {
  592. self.closure();
  593. this.isEvacuate=true;
  594. console.log('用户点击确定');
  595. } else if (res.cancel) {
  596. console.log('用户点击取消');
  597. }
  598. }
  599. });
  600. },
  601. async closure(){
  602. const {data} = await closure(this.subId)
  603. if(data.code == 200){
  604. uni.showToast({
  605. title: '操作成功',
  606. icon:"none",
  607. mask:true,
  608. duration: 2000
  609. });
  610. setTimeout(function(){
  611. uni.navigateBack();
  612. },2000);
  613. }
  614. },
  615. buttonChange(e){
  616. this.buttonArrayIndex = e.detail.value;
  617. this.lineEvacuate();
  618. },
  619. /* 确认 */
  620. confirmBtn(){
  621. if(!this.subId){
  622. uni.showToast({
  623. title: '请选择实验室',
  624. icon:"none",
  625. mask:true,
  626. duration: 2000
  627. });
  628. return
  629. }
  630. this.lineEvacuateTow();
  631. this.laboratoryInfo();
  632. },
  633. /* 2.5获取疏散线路 */
  634. async lineEvacuateTow(){
  635. if(!this.buttonArrayIndex){
  636. uni.showToast({
  637. title: '请选择疏散路线',
  638. icon:"none",
  639. mask:true,
  640. duration: 2000
  641. });
  642. return
  643. }
  644. const {data} = await lineEvacuateTow(this.subId,this.buttonArray[this.buttonArrayIndex].id)
  645. if(data.code == 200){
  646. if(data.data){
  647. this.pageType = 2;
  648. uni.showToast({
  649. title: '执行成功',
  650. icon:"none",
  651. mask:true,
  652. duration: 2000
  653. });
  654. this.initialization(data.data);
  655. }
  656. }
  657. },
  658. //执行疏散
  659. async lineEvacuate(){
  660. if(!this.subId){
  661. uni.showToast({
  662. title: '请选择实验室',
  663. icon:"none",
  664. mask:true,
  665. duration: 2000
  666. });
  667. return
  668. }
  669. if(!this.buttonArrayIndex){
  670. uni.showToast({
  671. title: '请选择疏散路线',
  672. icon:"none",
  673. mask:true,
  674. duration: 2000
  675. });
  676. return
  677. }
  678. const {data} = await lineEvacuate(this.subId,this.buttonArray[this.buttonArrayIndex].id)
  679. if(data.code == 200){
  680. if(data.data){
  681. console.log('执行疏散')
  682. this.isEvacuate=false;
  683. uni.showToast({
  684. title: '执行成功',
  685. icon:"none",
  686. mask:true,
  687. duration: 2000
  688. });
  689. this.initialization(data.data);
  690. }
  691. }
  692. },
  693. //灯初始化
  694. initialization(list){
  695. console.log('灯数据',list);
  696. let self = this;
  697. let newList = [
  698. {
  699. id:"5",
  700. type:false,
  701. },
  702. {
  703. id:"2",
  704. type:false,
  705. },
  706. {
  707. id:"3",
  708. type:false,
  709. },
  710. {
  711. id:"4",
  712. type:false,
  713. },
  714. {
  715. id:"1",
  716. type:false,
  717. },
  718. {
  719. id:"6",
  720. type:false,
  721. },
  722. ];
  723. for(let i=0;i<list.length;i++){
  724. for(let o=0;o<newList.length;o++){
  725. if(list[i].lightId == newList[o].id){
  726. newList[o].type = true;
  727. }
  728. }
  729. }
  730. this.lightList = newList;
  731. console.log('灯数据改变',this.lightList);
  732. this.pageType = 2;
  733. this.$forceUpdate();
  734. this.getDeviceList();
  735. },
  736. async getDeviceList(){
  737. let obj ={
  738. floorId:5,
  739. page:1,
  740. pageSize:100,
  741. };
  742. const {data} = await getDeviceList(obj)
  743. if(data.code == 200){
  744. for(let i=0;i<data.data.length;i++){
  745. data.data[i].type = false;
  746. }
  747. this.$set(this,'trumpetList',data.data)
  748. }
  749. },
  750. //摄像头切换
  751. scrollBoxClick(index){
  752. this.videoIndex = index;
  753. },
  754. //获取实验室布局
  755. async lablayout(){
  756. let self = this;
  757. const {data} = await lablayout(137)
  758. if(data.code == 200){
  759. for(let i=0;i<data.data.length;i++){
  760. if(data.data[i].id == 5){
  761. self.fjList = data.data[i].list;
  762. let newList = [];
  763. for(let o=0;o<data.data[i].list.length;o++){
  764. if(data.data[i].list[o].subjectId != -1){
  765. newList.push(data.data[i].list[o]);
  766. }
  767. }
  768. this.$set(this,'fjListArray',newList);
  769. }
  770. }
  771. }
  772. },
  773. },
  774. beforeDestroy(){
  775. //断开mqtt连接
  776. getApp().offMQTT();
  777. //删除应急疏散监听
  778. getApp().deleteLineData();
  779. }
  780. }
  781. </script>
  782. <style lang="stylus" scoped>
  783. #emergencyEvacuationBig{
  784. height:100%;
  785. width:100%;
  786. display:flex;
  787. flex-direction:column;
  788. overflow-y:scroll;
  789. .setUpEvacuation{
  790. flex:1;
  791. display:flex;
  792. flex-direction:column;
  793. overflow-y:scroll;
  794. .evacuation-max-box{
  795. width:710rpx;
  796. margin:20rpx 20rpx;
  797. background #fff
  798. border-radius:20rpx;
  799. padding:20rpx 0;
  800. .picker-max-box{
  801. .picker-title-box{
  802. padding:0 20rpx;
  803. display flex
  804. view{
  805. line-height:80rpx;
  806. font-size:28rpx;
  807. }
  808. view:nth-child(1){
  809. color:red;
  810. }
  811. view:nth-child(2){
  812. }
  813. view:nth-child(3){
  814. color:#999;
  815. }
  816. }
  817. .picker-min-box{
  818. display flex;
  819. height:80rpx;
  820. width:667rpx;
  821. border:1rpx solid #a2a2a2;
  822. border-radius:10rpx;
  823. margin:0 20rpx;
  824. view{
  825. flex:1;
  826. line-height:80rpx;
  827. padding:0 20rpx;
  828. color:#999;
  829. font-size:28rpx;
  830. }
  831. img{
  832. width:24rpx;
  833. height:12rpx;
  834. margin:35rpx 23rpx;
  835. }
  836. }
  837. }
  838. }
  839. }
  840. .implementEvacuation{
  841. flex:1;
  842. display:flex;
  843. flex-direction:column;
  844. overflow-y:scroll;
  845. .evacuation-max-box{
  846. width:710rpx;
  847. margin:20rpx 20rpx;
  848. /* background #fff */
  849. border-radius:20rpx;
  850. padding:20rpx 0 30rpx;
  851. .evacuation-title-box{
  852. height:150rpx;
  853. //border-bottom:1rpx solid #dedede;
  854. background: #FFFFFF;
  855. border-radius: 20rpx;
  856. padding-left:22rpx;
  857. padding-top:34rpx;
  858. box-sizing :border-box;
  859. .evacuation-title-name-box{
  860. font-size: 30rpx;
  861. font-family: PingFang SC;
  862. font-weight: 500;
  863. color: #333333;
  864. line-height: 30rpx;
  865. }
  866. .site{
  867. font-size: 28rpx;
  868. font-family: PingFang SC;
  869. font-weight: 500;
  870. color: #999999;
  871. line-height: 30rpx;
  872. margin-top:32rpx;
  873. display :flex;
  874. justify-content :flex-start;
  875. align-items center;
  876. >img{
  877. width: 28rpx;
  878. height: 30rpx;
  879. margin-right:18rpx;
  880. }
  881. }
  882. }
  883. /* 视频监控-选择疏散路线 */
  884. .monito{
  885. width: 710rpx;
  886. height: 161rpx;
  887. background: #FFFFFF;
  888. border-radius: 20rpx;
  889. padding :0 14rpx;
  890. box-sizing border-box;
  891. margin-top :20rpx;
  892. .monito_li{
  893. width: 680rpx;
  894. height: 80rpx;
  895. font-size: 30rpx;
  896. font-family: PingFang SC;
  897. font-weight: 500;
  898. color: #333333;
  899. line-height: 80rpx;
  900. border-bottom: 1rpx solid #E0E0E0;
  901. display :flex;
  902. justify-content :space-between;
  903. .monito_li_r_text{
  904. font-size:28rpx!important;
  905. padding-right:37rpx;
  906. }
  907. .monito_li_r{
  908. width :380rpx;
  909. font-size: 24rpx;
  910. font-family: PingFang SC;
  911. font-weight: 500;
  912. color: #0183FA;
  913. line-height: 80rpx;
  914. display :flex;
  915. justify-content :flex-end;
  916. align-items center;
  917. >img{
  918. width: 9rpx;
  919. height: 22rpx;
  920. margin-left :20rpx;
  921. }
  922. .evacuation-title-button-box{
  923. display flex
  924. overflow hidden
  925. view{
  926. line-height:61rpx;
  927. font-size:28rpx;
  928. }
  929. .colorA{
  930. color: #0183FA;
  931. }
  932. .colorB{
  933. color:#0183FA;
  934. }
  935. img{
  936. margin:28rpx 20rpx 0;
  937. width:24rpx;
  938. height:9rpx;
  939. }
  940. }
  941. }
  942. }
  943. }
  944. .evacuation-scroll-box{
  945. height:95rpx;
  946. overflow-x scroll
  947. overflow-y hidden
  948. white-space:nowrap;
  949. margin:0 20rpx;
  950. view{
  951. line-height:95rpx;
  952. font-size:28rpx;
  953. display inline-block
  954. margin-right:45rpx;
  955. }
  956. .scroll-box-color{
  957. color:#0183FA;
  958. }
  959. }
  960. .evacuation-video-box{
  961. width:668rpx;
  962. height:341rpx;
  963. margin:0 auto;
  964. position relative
  965. video{
  966. position absolute
  967. top:0;
  968. left:0;
  969. width:668rpx;
  970. height:341rpx;
  971. margin:0 auto;
  972. }
  973. .video-a{
  974. z-index:100;
  975. }
  976. .video-b{
  977. z-index:0;
  978. }
  979. }
  980. /* 路线图 */
  981. .roadmap{
  982. width: 710rpx;
  983. height: 464rpx;
  984. background: #FFFFFF;
  985. border-radius: 20rpx;
  986. padding :20rpx 20rpx 0;
  987. box-sizing :border-box;
  988. margin-top :20rpx;
  989. .roadmap_t{
  990. font-size: 30rpx;
  991. font-family: PingFang SC;
  992. font-weight: 500;
  993. color: #333333;
  994. line-height: 30rpx;
  995. display:flex;
  996. .monito_li_r_l{
  997. flex:1;
  998. line-height:61rpx;
  999. font-size:28rpx;
  1000. }
  1001. .monito_li_r{
  1002. width :380rpx;
  1003. font-size: 24rpx;
  1004. font-family: PingFang SC;
  1005. font-weight: 500;
  1006. color: #0183FA;
  1007. line-height: 80rpx;
  1008. display :flex;
  1009. justify-content :flex-end;
  1010. align-items center;
  1011. >img{
  1012. width: 9rpx;
  1013. height: 22rpx;
  1014. margin-left :20rpx;
  1015. }
  1016. .evacuation-title-button-box{
  1017. display flex
  1018. overflow hidden
  1019. view{
  1020. line-height:61rpx;
  1021. font-size:28rpx;
  1022. }
  1023. .colorA{
  1024. color: #0183FA;
  1025. }
  1026. .colorB{
  1027. color:#0183FA;
  1028. }
  1029. img{
  1030. margin:28rpx 20rpx 0;
  1031. width:24rpx;
  1032. height:9rpx;
  1033. }
  1034. }
  1035. }
  1036. }
  1037. .evacuation-map-box{
  1038. width:668rpx;
  1039. height:348rpx;
  1040. margin:0 auto;
  1041. overflow:hidden;
  1042. border:1rpx solid #E0E0E0;
  1043. margin-top:20rpx;
  1044. .evacuation-map-big-box{
  1045. height:285rpx;
  1046. width:641rpx;
  1047. background:url(../images/Version2.3/icon_bj_syspmtcy_jinan.png);
  1048. background-size 100%
  1049. margin:28rpx 13rpx ;
  1050. position relative
  1051. .evacuation-map-min-for-box{
  1052. overflow: hidden;
  1053. display: inline-block;
  1054. line-height:70rpx;
  1055. text-align: center;
  1056. font-size:14rpx;
  1057. }
  1058. .evacuation-map-min-for-box-color{
  1059. background: rgba(0,189,255,0.3);
  1060. }
  1061. .evacuation-map-min-for-box:nth-child(1){
  1062. margin:0rpx 80rpx 0 0;
  1063. height:92rpx;
  1064. width:92rpx;
  1065. }
  1066. .evacuation-map-min-for-box:nth-child(2){
  1067. margin: 0rpx 0 0 0;
  1068. height: 92rpx;
  1069. width: 57rpx;
  1070. }
  1071. .evacuation-map-min-for-box:nth-child(3){
  1072. margin: 0rpx 0 0 0;
  1073. width:58rpx;
  1074. height:92rpx;
  1075. }
  1076. .evacuation-map-min-for-box:nth-child(4){
  1077. margin: 0rpx 0 0 0;
  1078. width:58rpx;
  1079. height:92rpx;
  1080. }
  1081. .evacuation-map-min-for-box:nth-child(5){
  1082. margin: 0rpx 0 0 0;
  1083. width:58rpx;
  1084. height:92rpx;
  1085. }
  1086. .evacuation-map-min-for-box:nth-child(6){
  1087. margin: 0rpx 0 0 0;
  1088. width:58rpx;
  1089. height:92rpx;
  1090. }
  1091. .evacuation-map-min-for-box:nth-child(7){
  1092. margin: 0rpx 0 0 0;
  1093. width:58rpx;
  1094. height:92rpx;
  1095. }
  1096. .evacuation-map-min-for-box:nth-child(8){
  1097. margin: 0rpx 50rpx 0 0;
  1098. width:58rpx;
  1099. height:92rpx;
  1100. }
  1101. /* 第二层 */
  1102. .evacuation-map-min-for-box:nth-child(9){
  1103. margin:0rpx 0rpx 0 0;
  1104. width:52rpx;
  1105. height:135rpx;
  1106. }
  1107. .evacuation-map-min-for-box:nth-child(10){
  1108. margin:46rpx 0 0 0rpx;
  1109. width:59rpx;
  1110. height:135rpx;
  1111. }
  1112. .evacuation-map-min-for-box:nth-child(11){
  1113. margin:46rpx 0 0 0rpx;
  1114. width:63rpx;
  1115. height:135rpx;
  1116. }
  1117. .evacuation-map-min-for-box:nth-child(12){
  1118. margin:46rpx 0 0 0rpx;
  1119. width:57rpx;
  1120. height:135rpx;
  1121. }
  1122. .evacuation-map-min-for-box:nth-child(13){
  1123. margin:46rpx 0 0 0rpx;
  1124. width:58rpx;
  1125. height:135rpx;
  1126. }
  1127. .evacuation-map-min-for-box:nth-child(14){
  1128. margin:46rpx 0 0 0rpx;;
  1129. width:58rpx;
  1130. height:135rpx;
  1131. }
  1132. .evacuation-map-min-for-box:nth-child(15){
  1133. margin:46rpx 0 0 0rpx;
  1134. width:60rpx;
  1135. height:135rpx;
  1136. }
  1137. .evacuation-map-min-for-box:nth-child(16){
  1138. margin:46rpx 0 0 0rpx;
  1139. width:57rpx;
  1140. height:135rpx;
  1141. }
  1142. .evacuation-map-min-for-box:nth-child(17){
  1143. margin:46rpx 0 0 0rpx;
  1144. width:58rpx;
  1145. height:135rpx;
  1146. }
  1147. .evacuation-map-min-for-box:nth-child(18){
  1148. margin:46rpx 0 0 0rpx;
  1149. width:58rpx;
  1150. height:135rpx;
  1151. }
  1152. .map-min-img{
  1153. position: absolute;
  1154. width:34rpx;
  1155. height:22rpx;
  1156. }
  1157. .map-min-img:nth-child(19){
  1158. top: 113rpx;
  1159. left: 70rpx;
  1160. }
  1161. .map-min-img:nth-child(20){
  1162. top: 113rpx;
  1163. left: 120rpx;
  1164. }
  1165. .map-min-img:nth-child(21){
  1166. top: 113rpx;
  1167. left:230rpx;
  1168. }
  1169. .map-min-img:nth-child(22){
  1170. top: 113rpx;
  1171. left:280rpx;
  1172. }
  1173. .map-min-img:nth-child(23){
  1174. top: 113rpx;
  1175. left:350rpx;
  1176. }
  1177. .map-min-img:nth-child(24){
  1178. top: 113rpx;
  1179. left:400rpx;
  1180. }
  1181. }
  1182. }
  1183. }
  1184. .video-max-box{
  1185. width: 710rpx;
  1186. height: 780rpx;
  1187. overflow-y scroll;
  1188. background: #FFFFFF;
  1189. border-radius: 20rpx;
  1190. padding :22rpx 30rpx 30rpx;
  1191. box-sizing :border-box;
  1192. margin-top :20rpx;
  1193. margin-bottom:120rpx;
  1194. video{
  1195. width:645rpx;
  1196. height:355rpx;
  1197. }
  1198. }
  1199. .bottom-button-box{
  1200. position absolute;
  1201. bottom:20rpx;
  1202. display flex;
  1203. width:670rpx;
  1204. margin:20rpx;
  1205. view{
  1206. width:335rpx;
  1207. height:100rpx;
  1208. line-height:100rpx;
  1209. text-align center;
  1210. color:#fff;
  1211. font-size:28rpx;
  1212. }
  1213. view:nth-child(1){
  1214. border-top-left-radius :50rpx;
  1215. border-bottom-left-radius :50rpx;
  1216. background:#FF9C00;
  1217. }
  1218. view:nth-child(2){
  1219. border-top-right-radius :50rpx;
  1220. border-bottom-right-radius :50rpx;
  1221. background:#0183FA;
  1222. }
  1223. }
  1224. }
  1225. .live-button{
  1226. width:650rpx;
  1227. height:100rpx;
  1228. line-height:100rpx;
  1229. text-align center;
  1230. font-size:28rpx;
  1231. margin:50rpx auto 0;
  1232. border-radius:20rpx;
  1233. }
  1234. .live-color-a{
  1235. color:#fff;
  1236. background:#FF8686;
  1237. }
  1238. .live-color-b{
  1239. color:#fff;
  1240. background:#25C95B;
  1241. }
  1242. .shade-max-big-box{
  1243. height:100%;
  1244. width:100%;
  1245. position fixed
  1246. display flex;
  1247. flex-direction column
  1248. z-index:10;
  1249. background :rgba(0,0,0,0.2);
  1250. .null-box{
  1251. flex:1;
  1252. }
  1253. /* 语音广播-执行疏散 */
  1254. .broadcast{
  1255. width: 100%;
  1256. // height: 532rpx;
  1257. background: #FFFFFF;
  1258. border-top-left-radius :20rpx;
  1259. border-top-right-radius :20rpx
  1260. padding :22rpx 30rpx 30rpx;
  1261. box-sizing :border-box;
  1262. margin-top:20rpx;
  1263. .broadcast_t{
  1264. font-size: 30rpx;
  1265. font-family: PingFang SC;
  1266. font-weight: 500;
  1267. color: #333333;
  1268. line-height: 30rpx;
  1269. >label{
  1270. font-size: 24rpx;
  1271. font-family: PingFang SC;
  1272. font-weight: 500;
  1273. color: #999999;
  1274. line-height: 30rpx;
  1275. margin-left :16rpx;
  1276. }
  1277. }
  1278. .trumpet-max-box{
  1279. display :flex;
  1280. justify-content :flex-start;
  1281. flex-wrap: wrap;
  1282. margin-top :22rpx;
  1283. .trumpet-for-box{
  1284. display:inline-block;
  1285. width:200rpx;
  1286. height:60rpx;
  1287. line-height:60rpx;
  1288. font-size:24rpx;
  1289. text-align center;
  1290. cursor: pointer;
  1291. overflow: hidden;
  1292. border: 1rpx solid #E0E0E0;
  1293. border-radius:10rpx;
  1294. color: #E0E0E0;
  1295. display :flex;
  1296. justify-content :center;
  1297. margin-right :20rpx;
  1298. margin-bottom: 10rpx;
  1299. >img{
  1300. width:36rpx;
  1301. height:34rpx;
  1302. margin :12rpx 20rpx 0 25rpx;
  1303. }
  1304. }
  1305. .trumpet-color-a{
  1306. border:1px solid #0183FA;
  1307. color:#0183FA;
  1308. }
  1309. .trumpet-color-b{
  1310. border:1px solid #CCCCCC;
  1311. color:#999;
  1312. }
  1313. }
  1314. .broadcast_m{
  1315. width :100%;
  1316. .broadcast_m_t{
  1317. width: 142rpx;
  1318. height: 142rpx;
  1319. margin :30rpx 0 0 258rpx;
  1320. position :relative;
  1321. font-size: 24rpx;
  1322. font-family: PingFang SC;
  1323. font-weight: 500;
  1324. line-height: 170rpx;
  1325. text-align center
  1326. >img{
  1327. width: 142rpx;
  1328. height: 142rpx;
  1329. position :absolute;
  1330. }
  1331. >label{
  1332. width :100%;
  1333. font-size: 24rpx;
  1334. font-family: PingFang SC;
  1335. font-weight: 500;
  1336. color: #0183FA;
  1337. line-height: 24rpx;
  1338. display :inline-block;
  1339. text-align :center;
  1340. position :absolute;
  1341. top:76rpx;
  1342. }
  1343. /* 按下 */
  1344. .press_color{
  1345. color: #FFFFFF;
  1346. }
  1347. /* 松开 */
  1348. .slip_color{
  1349. color: #0183FA;
  1350. }
  1351. }
  1352. .broadcast_m_t_back_a{
  1353. background:url(@/images/icon_sskz_skfs.png);
  1354. background-size 100%
  1355. color: #FFFFFF;
  1356. }
  1357. .broadcast_m_t_back_b{
  1358. background:url(@/images/icon_sskz_azsh.png);
  1359. background-size 100%
  1360. color: #0183FA;
  1361. }
  1362. .broadcast_m_b{
  1363. font-size: 24rpx;
  1364. font-family: PingFang SC;
  1365. font-weight: 500;
  1366. color: #999999;
  1367. line-height: 24rpx;
  1368. text-align center;
  1369. margin-top :14rpx;
  1370. }
  1371. }
  1372. /* 疏散按钮 */
  1373. .evacuation-button-box{
  1374. width:650rpx;
  1375. height:100rpx;
  1376. background #0183FA
  1377. color:#fff;
  1378. text-align center;
  1379. line-height:100rpx;
  1380. font-size:28rpx;
  1381. margin:88rpx auto 0;
  1382. border-radius:20rpx;
  1383. }
  1384. }
  1385. }
  1386. }
  1387. .setUpEvacuation-bottom-button{
  1388. width:650rpx;
  1389. height:100rpx;
  1390. background #0183FA
  1391. color:#fff;
  1392. text-align center;
  1393. line-height:100rpx;
  1394. font-size:28rpx;
  1395. margin:50rpx auto;
  1396. border-radius:20rpx;
  1397. }
  1398. }
  1399. </style>