emergencyEvacuationBig.vue 35 KB

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