emergencyEvacuationBig.vue 38 KB

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