emergencyEvacuationBig.vue 36 KB

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