emergencyEvacuationBig.vue 35 KB

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