emergencyEvacuationBig.vue 36 KB

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