irrigate.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170
  1. <!-- 灌溉地图展示 -->
  2. <template>
  3. <div class="map">
  4. <div id="container">加载数据,请稍候...</div>
  5. <!-- 设备列表 -->
  6. <div class="equipListBox">
  7. <div class="searchTop">
  8. <div>设备列表</div>
  9. <!-- <div>
  10. <el-input
  11. size="small"
  12. placeholder="请选择设备"
  13. suffix-icon="el-icon-search"
  14. v-model="searchVal"
  15. ></el-input>
  16. </div> -->
  17. </div>
  18. <div class="inner">
  19. <div class="scroll">
  20. <el-scrollbar>
  21. <div class="equipList">
  22. <div class="item"
  23. v-for="(item,index) in equipRelayList" :key="index" @click="lookEquip(item)">
  24. <div class="">
  25. <img :src="require('../../../../static/images/irrigate/navIcon/navIcon'+`${item.type}`+'.png')" alt="">
  26. <span>{{item.name}}</span>
  27. </div>
  28. <span @click.stop="setEquipInfo(item,index)">
  29. <i class="el-icon-setting"></i>
  30. </span>
  31. </div>
  32. <div class="item" v-if="!equipRelayList.length">
  33. 暂无数据
  34. </div>
  35. </div>
  36. </el-scrollbar>
  37. </div>
  38. </div>
  39. </div>
  40. <!-- 环形菜单 -->
  41. <div class="navMenu">
  42. <div class="mainMenu" @click="subMenuToggle">
  43. <div>
  44. <i class="el-icon-menu"></i>
  45. <div>菜单</div>
  46. </div>
  47. </div>
  48. <div class="subMenu" ref="subMenu">
  49. <div class="itemMenu itemMenu1" @click="subMenuState(1)">
  50. <div>预警</div>
  51. </div>
  52. <div class="itemMenu itemMenu2" @click="subMenuState(2)">
  53. <div>状态</div>
  54. </div>
  55. <div class="itemMenu itemMenu3" @click="subMenuState(3)">
  56. <div>要素</div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="popupInner">
  61. <!-- 设备预警 -->
  62. <div v-show="warnShow" class="equipWarnBox suspensionBox">
  63. <div class="top">
  64. <div>设备预警</div>
  65. <div @click="subMenuState(1)">
  66. <i class="el-icon-caret-right"></i>
  67. </div>
  68. </div>
  69. <div class="inner">
  70. <div class="wranTitle">
  71. <div
  72. v-for="(item,index) in wranTitle"
  73. v-bind:key="item"
  74. :class="[index==1?'wranmsg':'']"
  75. >{{item}}</div>
  76. </div>
  77. <div class="equipList">
  78. <div
  79. class="scroll-content"
  80. ref="scrollContent"
  81. :style="{ top }"
  82. @mouseenter="Stop()"
  83. @mouseleave="Up()"
  84. >
  85. <!-- <div class="" @mouseenter="Stop()" @mouseleave="Up()"> -->
  86. <div class="wranInfo" v-for="item in scrollWranList" v-bind:key="item.id">
  87. <div>{{item.equipName}}</div>
  88. <div class="wranmsg">{{item.msg}}{{item.msg}}</div>
  89. <div>{{item.time}}</div>
  90. <div class="state">{{item.state}}</div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <!-- 设备状态 -->
  97. <div v-show="equipShow" class="equipCtrlBox suspensionBox">
  98. <div class="top">
  99. <div>设备状态</div>
  100. <div>
  101. <span class="historyBtn" @click="lookCtrlHistory()">历史数据</span>
  102. <i class="el-icon-caret-right" @click="subMenuState(2)"></i>
  103. </div>
  104. </div>
  105. <div class="inner">
  106. <el-scrollbar :style="{'height':ctrlScrollHeight+'px'}">
  107. <div class="equipList">
  108. <div class="equipState" v-for="item in equipRelayList" v-bind:key="item.id">
  109. <div>
  110. <span class="name">{{item.name}}</span>
  111. <el-switch v-model="item.val" @change="equipStateSwitch(item)" active-color="#0295ff" inactive-color="#b6b6b6"></el-switch>
  112. </div>
  113. </div>
  114. </div>
  115. </el-scrollbar>
  116. </div>
  117. </div>
  118. <!-- 气象要素 -->
  119. <div v-show="qxzElShow" class="qxzEquipBox suspensionBox">
  120. <div class="top">
  121. <div>
  122. <span>水肥要素</span>
  123. <span class="uptime">(2021-04-21 12:00:00)</span>
  124. </div>
  125. <div>
  126. <span class="historyBtn" @click="lookEleHistory()">历史数据</span>
  127. <i class="el-icon-caret-right" @click="subMenuState(3)"></i>
  128. </div>
  129. </div>
  130. <div class="inner">
  131. <el-scrollbar :style="{'height':qxzScrollHeight+'px'}">
  132. <div class="equipList">
  133. <div class="equipState" v-for="item in equipEleList" v-bind:key="item.id">
  134. <div>
  135. <img
  136. :src="`../../../../static/images/irrigate/qxdev/icon_${item.eleNum}.png`"
  137. alt
  138. />
  139. </div>
  140. <div>
  141. <div class="val">{{item.val}}{{item.unit}}</div>
  142. <div class="name">{{item.name}}</div>
  143. </div>
  144. </div>
  145. </div>
  146. </el-scrollbar>
  147. </div>
  148. </div>
  149. </div>
  150. <!-- 设备定位 -->
  151. <el-dialog
  152. title="设置"
  153. custom-class='setlnglatBox'
  154. :visible.sync="setlnglatVisible"
  155. width="660px"
  156. :fullscreen="dialogFull"
  157. v-dialogDrag
  158. >
  159. <setLocation @func="addrSave" v-if="setlnglatVisible" :lnglat="currRelay.lnglat"></setLocation>
  160. </el-dialog>
  161. <!-- 设备提示框 -->
  162. <dcfPopUP ref="dcfPopUP"></dcfPopUP>
  163. <sbPopUP ref="sbPopUP"></sbPopUP>
  164. <sqPopUP ref="sqPopUP"></sqPopUP>
  165. <sfjPopUP ref="sfjPopUP"></sfjPopUP>
  166. <wranPopUP ref="wranPopUP"></wranPopUP>
  167. </div>
  168. </template>
  169. <script>
  170. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  171. //例如:import 《组件名称》 from '《组件路径》';
  172. const dcfPopUP = () => import("./popUp/dcfPopUp");
  173. const sbPopUP = () => import("./popUp/sbPopUp");
  174. const sqPopUP = () => import("./popUp/sqPopUP");
  175. const sfjPopUP = () => import("./popUp/sfjPopUP");
  176. // const setLocation = () => import("./popUp/setLocation");
  177. import setLocation from "./popUp/setLocation";
  178. // const wranPopUP = ()=> import('./wranPopUP')
  179. import wranPopUP from "./popUp/wranPopUP";
  180. // 要素配置表
  181. import eleList from "../../../../static/js/irrigate/eleList.json"
  182. export default {
  183. //import引入的组件需要注入到对象中才能使用
  184. components: {
  185. dcfPopUP,
  186. sbPopUP,
  187. sqPopUP,
  188. sfjPopUP,
  189. wranPopUP,
  190. setLocation
  191. },
  192. data() {
  193. //这里存放数据
  194. return {
  195. id:this.$store.state.irrigate_id,
  196. map: null,
  197. center: [116.3683244, 39.915085],
  198. zoom: 4.5,
  199. tileLayer1: null,
  200. tileLayer2: null,
  201. dialogFull:false,
  202. // 继电器配置表
  203. relayList: {
  204. "0": {
  205. id: 1,
  206. index: 0,
  207. name: "-"
  208. },
  209. "1": {
  210. id: 2,
  211. index: 1,
  212. name: "风机"
  213. },
  214. "2": {
  215. id: 3,
  216. index: 2,
  217. name: "水泵"
  218. },
  219. "3": {
  220. id: 4,
  221. index: 3,
  222. name: "增氧机"
  223. },
  224. "4": {
  225. id: 5,
  226. index: 4,
  227. name: "湿帘"
  228. },
  229. "5": {
  230. id: 6,
  231. index: 5,
  232. name: "遮阳"
  233. },
  234. "6": {
  235. id: 7,
  236. index: 6,
  237. name: "开窗"
  238. },
  239. "7": {
  240. id: 8,
  241. index: 7,
  242. name: "保温"
  243. },
  244. "8": {
  245. id: 9,
  246. index: 8,
  247. name: "投食机"
  248. }
  249. },
  250. relayName: [],
  251. relayNum: [],
  252. relayVal: [],
  253. relayName: [],
  254. relaydevice_addr:[],
  255. equipRelayList: [],
  256. ctrlScrollHeight:"",
  257. // 要素
  258. eleList:eleList,
  259. eleName: [],
  260. eleNum: [],
  261. eleVal: [],
  262. equipEleList: [],
  263. qxzScrollHeight: "",
  264. searchVal: "",
  265. equipData: [],
  266. marker: null,
  267. markerList: [],
  268. infoWindow: null,
  269. // subMenu状态 0是旋转0度 1是180度
  270. subMenu: 0,
  271. warnShow: true,
  272. equipShow: true,
  273. qxzElShow: true,
  274. // 设备预警滚动
  275. wranTitle: ["设备编号", "预警信息", "时间", "状态"],
  276. scrollWranList: [
  277. {
  278. equipName: "水泵123456",
  279. msg: "液体流速≥500mm/s",
  280. time: "2021-4-26",
  281. state: "未读"
  282. },
  283. {
  284. equipName: "水泵654321",
  285. msg: "液体流速≥400mm/s",
  286. time: "2021-4-25",
  287. state: "未读"
  288. },
  289. {
  290. equipName: "水泵456546",
  291. msg: "液体流速≥500mm/s",
  292. time: "2021-4-24",
  293. state: "未读"
  294. },
  295. {
  296. equipName: "水泵123456",
  297. msg: "液体流速≥500mm/s",
  298. time: "2021-4-23",
  299. state: "未读"
  300. },
  301. {
  302. equipName: "水泵123456",
  303. msg: "液体流速≥500mm/s",
  304. time: "2021-4-22",
  305. state: "未读"
  306. },
  307. {
  308. equipName: "水泵123456",
  309. msg: "液体流速≥500mm/s",
  310. time: "2021-4-21",
  311. state: "未读"
  312. },
  313. {
  314. equipName: "水泵123456",
  315. msg: "液体流速≥500mm/s",
  316. time: "2021-4-20",
  317. state: "未读"
  318. },
  319. {
  320. equipName: "水泵123456",
  321. msg: "液体流速≥500mm/s",
  322. time: "2021-4-19",
  323. state: "未读"
  324. },
  325. {
  326. equipName: "水泵123456",
  327. msg: "液体流速≥500mm/s",
  328. time: "2021-4-19",
  329. state: "未读"
  330. },
  331. {
  332. equipName: "水泵123456",
  333. msg: "液体流速≥500mm/s",
  334. time: "2021-4-19",
  335. state: "未读"
  336. },
  337. {
  338. equipName: "水泵123456",
  339. msg: "液体流速≥500mm/s",
  340. time: "2021-4-19",
  341. state: "未读"
  342. },
  343. {
  344. equipName: "水泵123456",
  345. msg: "液体流速≥500mm/s",
  346. time: "2021-4-19",
  347. state: "未读"
  348. },
  349. {
  350. equipName: "水泵123456",
  351. msg: "液体流速≥500mm/s",
  352. time: "2021-4-19",
  353. state: "未读"
  354. },
  355. {
  356. equipName: "水泵123456",
  357. msg: "液体流速≥500mm/s",
  358. time: "2021-4-19",
  359. state: "未读"
  360. }
  361. ],
  362. activeIndex: 0,
  363. intnum: undefined,
  364. // 编辑的继电器
  365. currRelay:{
  366. relayNum:'',
  367. index:'',
  368. lnglat:[],
  369. },
  370. setlnglatVisible:false,
  371. };
  372. },
  373. //监听属性 类似于data概念
  374. computed: {
  375. top() {
  376. return -this.activeIndex * 22 + "px";
  377. }
  378. },
  379. //监控data中的数据变化
  380. watch: {},
  381. //方法集合
  382. methods: {
  383. initMap() {
  384. //创建地图
  385. var that = this;
  386. this.map = new AMap.Map("container", {
  387. resizeEnable: true,
  388. center: that.center,
  389. zoom: that.zoom
  390. });
  391. AMap.plugin(
  392. [
  393. "AMap.ToolBar",
  394. "AMap.Scale",
  395. "AMap.MouseTool",
  396. "AMap.Geocoder",
  397. "AMap.PolyEditor"
  398. ],
  399. () => {
  400. // this.map.addControl(new AMap.ToolBar());
  401. this.map.addControl(new AMap.Scale({ position: "RB" }));
  402. this.geocoder = new AMap.Geocoder({
  403. city: "全国",
  404. radius: 1000
  405. });
  406. }
  407. );
  408. this.tileLayer1 = new AMap.TileLayer({
  409. tileUrl:
  410. "http://t{0,1,2,3,4,5,6,7}.tianditu.gov.cn/DataServer?T=img_w&tk=888bc7de1a5f14aa1b335b02e558d9b3&x=[x]&y=[y]&l=[z]",
  411. zIndex: 10
  412. }); //卫星图层
  413. this.tileLayer2 = new AMap.TileLayer({
  414. // 图块取图地址
  415. tileUrl:
  416. "http://t{0,1,2,3,4,5,6,7}.tianditu.gov.cn/DataServer?T=cta_w&tk=888bc7de1a5f14aa1b335b02e558d9b3&x=[x]&y=[y]&l=[z]",
  417. zIndex: 101
  418. });
  419. // this.map.add(this.tileLayer1);
  420. // this.map.add(this.tileLayer2);
  421. this.getEquipList();
  422. },
  423. getEquipList() {
  424. this.equipData = [
  425. {
  426. imei: 412155155,
  427. type: 1,
  428. name: "水泵设备1",
  429. lnglat: [116.3683244, 39.915085]
  430. },
  431. {
  432. imei: 412155155,
  433. type: 1,
  434. name: "水泵设备2",
  435. lnglat: [116.3667244, 39.915085]
  436. },
  437. {
  438. imei: 412155155,
  439. type: 2,
  440. name: "施肥机设备",
  441. lnglat: [116.3685244, 39.917085]
  442. },
  443. {
  444. imei: 412155155,
  445. type: 3,
  446. name: "电磁阀",
  447. lnglat: [116.3675244, 39.916085]
  448. },
  449. {
  450. imei: 412155155,
  451. type: 4,
  452. name: "墒情站",
  453. lnglat: [116.3695244, 39.916085]
  454. }
  455. ];
  456. this.$axios({
  457. method: "post",
  458. url: "/api/api_gateway?method=weather.weather.sf_status",
  459. data: this.qs.stringify({
  460. device_id: this.id
  461. })
  462. }).then(res => {
  463. var data = res.data.data;
  464. // 要素
  465. this.eleName = data.conf.eleName.split("/");
  466. this.eleNum = data.conf.eleNum.split("/");
  467. this.eleVal = eval("(" + data.dat.device_status + ")");
  468. this.renderEle();
  469. // 继电器
  470. this.relayName = data.conf.relayName.split("/");
  471. this.relayNum = data.conf.relayNum.split("/");
  472. this.relayVal = eval("(" + data.dat.device_status + ")");
  473. if(data.dat.device_addr){
  474. this.relaydevice_addr = data.dat.device_addr.split("/");
  475. this.renderRelay();
  476. }else{
  477. for(var i = 0;i<32;i++){
  478. var defaultlnglat = data.conf.lng+','+data.conf.lat
  479. this.relaydevice_addr.push(defaultlnglat);
  480. if(i==31){
  481. this.renderRelay();
  482. }
  483. }
  484. }
  485. });
  486. },
  487. // 渲染要素
  488. renderEle() {
  489. this.equipEleList = [];
  490. this.eleNum.forEach((item, index) => {
  491. if (item != 100) {
  492. var name = this.eleName[index] || this.eleList[item].name;
  493. var unit = this.eleList[item].unit || '单位'
  494. if(this.eleVal["e" + (index + 1)] == 32767){
  495. var val = 'N/A';
  496. }else{
  497. var val = this.eleVal["e" + (index + 1)];
  498. }
  499. this.equipEleList.push({
  500. eleNum: item,
  501. val: val,
  502. unit: unit,
  503. name: name
  504. });
  505. }
  506. });
  507. this.$nextTick(() => {
  508. if (this.equipEleList.length <= 3) {
  509. this.qxzScrollHeight = 68;
  510. } else if (this.equipEleList.length <= 6) {
  511. this.qxzScrollHeight = 136;
  512. } else{
  513. this.qxzScrollHeight = 204;
  514. }
  515. });
  516. },
  517. // 渲染继电器
  518. renderRelay() {
  519. this.equipRelayList = [];
  520. this.relayNum.forEach((item, index) => {
  521. if (item != 0) {
  522. var name = this.relayName[index] || this.relayList[item].name;
  523. var val = this.eleVal["j" + (index + 1)];
  524. var lnglat = this.relaydevice_addr[index]
  525. this.equipRelayList.push(
  526. {
  527. switchNum:index,
  528. val:val,
  529. name:name,
  530. lnglat:lnglat,
  531. type:item
  532. }
  533. )
  534. }
  535. });
  536. this.$nextTick(() => {
  537. if (this.equipRelayList.length <= 3) {
  538. this.ctrlScrollHeight = 33;
  539. } else if (this.equipRelayList.length <= 6) {
  540. this.ctrlScrollHeight = 66;
  541. } else if (this.equipRelayList.length <= 9) {
  542. this.ctrlScrollHeight = 99;
  543. } else{
  544. this.ctrlScrollHeight = 132;
  545. }
  546. });
  547. this.map.remove(this.markerList);
  548. this.markerList = [];
  549. this.equipRelayList.forEach(item => {
  550. if (item.type == 1) {
  551. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon1.gif";
  552. // var icon = '../../../../static/images/1111.gif'
  553. } else if (item.type == 2) {
  554. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon2.gif";
  555. // var icon = '../../../../static/images/icon5.svg'
  556. } else if (item.type == 3) {
  557. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon3.gif";
  558. } else if (item.type == 4) {
  559. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon4.gif";
  560. } else if (item.type == 5) {
  561. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon5.gif";
  562. } else if (item.type == 6) {
  563. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon6.gif";
  564. } else if (item.type == 7) {
  565. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon7.gif";
  566. } else if (item.type == 8) {
  567. var icon = "../../../../static/images/irrigate/relayIcon/relayIcon8.gif";
  568. }
  569. var itemlnglat = item["lnglat"].split(',');
  570. this.marker = new AMap.Marker({
  571. position: new AMap.LngLat(itemlnglat[0], itemlnglat[1]), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
  572. icon: new AMap.Icon({
  573. image: icon,
  574. size: new AMap.Size(33, 40), //图标大小
  575. imageSize: new AMap.Size(33, 40)
  576. }),
  577. offset: new AMap.Pixel(-13, -30),
  578. title: item["name"]
  579. });
  580. // 设置点标记的动画效果,此处为弹跳效果
  581. // this.marker.setAnimation('AMAP_ANIMATION_BOUNCE');
  582. this.markerList.push(this.marker);
  583. //信息窗体
  584. this.marker.content = item["name"];
  585. // AMap.event.addListener(this.marker, "click", event => {
  586. // this.markerClick(event, item);
  587. // });
  588. // AMap.event.addListener(this.map, "click", event => {
  589. // if (this.infoWindow) {
  590. // this.infoWindow.close();
  591. // }
  592. // });
  593. });
  594. this.$nextTick(() => {
  595. this.map.add(this.markerList);
  596. this.map.setFitView();
  597. });
  598. this.infoWindow = new AMap.InfoWindow({
  599. isCustom: true, //使用自定义窗体
  600. offset: new AMap.Pixel(-105, -20)
  601. // anchor:'bottom-righ'
  602. });
  603. // 预警提示框
  604. // this.$refs.wranPopUP.initialize({
  605. // currEquip: {},
  606. // visible: true,
  607. // infoWindow: this.infoWindow
  608. // });
  609. // this.infoWindow.setContent(this.$refs.wranPopUP.$el);
  610. // this.infoWindow.open(this.map, this.equipData[0].lnglat);
  611. },
  612. markerClick(event, item) {
  613. this.infoWindow = new AMap.InfoWindow({
  614. isCustom: true, //使用自定义窗体
  615. offset: new AMap.Pixel(16, -45)
  616. });
  617. if (item.type == 1) {
  618. this.$refs.dcfPopUP.initialize({
  619. currEquip: {},
  620. visible: true,
  621. infoWindow: this.infoWindow
  622. });
  623. this.infoWindow.setContent(this.$refs.dcfPopUP.$el);
  624. } else if (item.type == 2) {
  625. this.$refs.sbPopUP.initialize({
  626. currEquip: {},
  627. visible: true,
  628. infoWindow: this.infoWindow
  629. });
  630. this.infoWindow.setContent(this.$refs.sbPopUP.$el);
  631. } else if (item.type == 3) {
  632. this.$refs.sqPopUP.initialize({
  633. currEquip: {},
  634. visible: true,
  635. infoWindow: this.infoWindow
  636. });
  637. this.infoWindow.setContent(this.$refs.sqPopUP.$el);
  638. } else if (item.type == 4) {
  639. this.$refs.sfjPopUP.initialize({
  640. currEquip: {},
  641. visible: true,
  642. infoWindow: this.infoWindow
  643. });
  644. this.infoWindow.setContent(this.$refs.sfjPopUP.$el);
  645. }
  646. this.infoWindow.open(this.map, event.target.getPosition());
  647. },
  648. // 环形菜单特效
  649. subMenuToggle() {
  650. if (this.subMenu == 0) {
  651. this.subMenu = 1;
  652. this.$refs.subMenu.style.transform = "rotate(0deg) scale(1)";
  653. } else {
  654. this.subMenu = 0;
  655. this.$refs.subMenu.style.transform = "rotate(124deg) scale(1.4)";
  656. }
  657. },
  658. // 子菜单点击
  659. subMenuState(flag) {
  660. if (flag == 1) {
  661. this.warnShow = !this.warnShow;
  662. } else if (flag == 2) {
  663. this.equipShow = !this.equipShow;
  664. } else if (flag == 3) {
  665. this.qxzElShow = !this.qxzElShow;
  666. }
  667. },
  668. lookEleHistory(){
  669. this.$store.commit('setData',{
  670. name:'ele_history_id',
  671. val:this.id
  672. })
  673. this.$router.push('eleHistory');
  674. },
  675. lookCtrlHistory(){
  676. this.$store.commit('setData',{
  677. name:'ele_operat_id',
  678. val:this.id
  679. })
  680. this.$router.push('operatData');
  681. },
  682. ScrollUp() {
  683. this.intnum = setInterval(_ => {
  684. this.$refs.scrollContent.style.transition = "top 0.5s";
  685. if (this.activeIndex < this.scrollWranList.length - 5) {
  686. this.activeIndex += 1;
  687. } else {
  688. this.$refs.scrollContent.style.transition = "none";
  689. this.activeIndex = 0;
  690. }
  691. }, 1000);
  692. },
  693. Stop() {
  694. clearInterval(this.intnum);
  695. },
  696. Up() {
  697. this.ScrollUp();
  698. },
  699. // 设备控制
  700. equipStateSwitch(item){
  701. var switchNum = item.switchNum;
  702. if(item.val){
  703. var relayState = 1
  704. }else{
  705. var relayState = 0
  706. }
  707. this.$axios({
  708. method: "post",
  709. url: "/api/api_gateway?method=weather.weather.sf_control",
  710. data: this.qs.stringify({
  711. device_id: this.id,
  712. relayNum:switchNum,
  713. relayState:relayState,
  714. })
  715. }).then(res => {
  716. this.$message({
  717. message: '下发成功',
  718. type: 'success'
  719. });
  720. })
  721. },
  722. lookEquip(item){
  723. var addr =this.relaydevice_addr[item.switchNum].split(',');
  724. this.map.setCenter(addr)
  725. this.map.setZoom(17)
  726. },
  727. setEquipInfo(item,index){
  728. this.currRelay.relayNum=item.switchNum;
  729. this.currRelay.index=index;
  730. this.currRelay.lnglat=this.relaydevice_addr[item.switchNum].split(',');
  731. this.setlnglatVisible = true
  732. },
  733. addrSave(data){
  734. var addr = [].concat(this.relaydevice_addr)
  735. addr[this.currRelay.relayNum]=data.lng+','+data.lat
  736. this.$axios({
  737. method: "post",
  738. url: "/api/api_gateway?method=weather.weather.sf_control_addr",
  739. data: this.qs.stringify({
  740. device_id: this.id,
  741. device_addr:addr.join('/')
  742. })
  743. }).then(res => {
  744. if(res.data.data==true){
  745. this.setlnglatVisible = false;
  746. this.relaydevice_addr[this.currRelay.relayNum]=data.lng+','+data.lat
  747. this.renderRelay()
  748. }
  749. })
  750. }
  751. },
  752. //生命周期 - 创建完成(可以访问当前this实例)
  753. created() {
  754. // this.ScrollUp();
  755. },
  756. //生命周期 - 挂载完成(可以访问DOM元素)
  757. mounted() {
  758. this.initMap();
  759. for (var i = 0; i < 4; i++) {
  760. this.scrollWranList.push(this.scrollWranList[i]);
  761. }
  762. this.$nextTick(() => {
  763. this.ScrollUp();
  764. });
  765. },
  766. beforeCreate() {}, //生命周期 - 创建之前
  767. beforeMount() {}, //生命周期 - 挂载之前
  768. beforeUpdate() {}, //生命周期 - 更新之前
  769. updated() {}, //生命周期 - 更新之后
  770. beforeDestroy() {}, //生命周期 - 销毁之前
  771. destroyed() {
  772. this.Stop();
  773. }, //生命周期 - 销毁完成
  774. activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
  775. };
  776. </script>
  777. <style scoped lang='less'>
  778. .map,
  779. #container {
  780. width: 100%;
  781. height: 100%;
  782. }
  783. .equipListBox {
  784. position: absolute;
  785. left: 110px;
  786. top: 160px;
  787. bottom: 3.125rem;
  788. width: 3.5rem;
  789. background: rgba(12, 20, 44, 0.8);
  790. border-radius: 8px;
  791. overflow: hidden;
  792. z-index: 200;
  793. .searchTop {
  794. display: flex;
  795. justify-content: space-between;
  796. color: #fff;
  797. align-items: center;
  798. padding: 10px;
  799. background: #0c142c;
  800. .el-input {
  801. width: 2.25rem;
  802. input {
  803. background: #ececec;
  804. color: #000;
  805. padding: 5px;
  806. height: 27px;
  807. }
  808. /deep/.el-input__inner {
  809. height: 28px;
  810. line-height: 28px;
  811. }
  812. }
  813. }
  814. .inner {
  815. position: absolute;
  816. top: 52px;
  817. bottom: -18px;
  818. left: 0;
  819. right: 0;
  820. .scroll {
  821. height: 100%;
  822. overflow: auto;
  823. .equipList {
  824. .item {
  825. padding: 0.175rem;
  826. color: #fff;
  827. font-size: 0.175rem;
  828. // background: red;
  829. cursor: pointer;
  830. display: flex;
  831. justify-content: space-between;
  832. >div{
  833. width: 72%;
  834. overflow: hidden;
  835. white-space: nowrap;
  836. text-overflow: ellipsis;
  837. }
  838. >span:nth-child(2){
  839. font-size: 14px;
  840. }
  841. img {
  842. vertical-align: middle;
  843. margin-right: 2px;
  844. }
  845. &:hover {
  846. background: #0c142c;
  847. }
  848. }
  849. .item.active {
  850. background: #0c142c;
  851. }
  852. }
  853. }
  854. .scroll {
  855. height: 100%;
  856. overflow-y: hidden;
  857. }
  858. .el-scrollbar {
  859. height: 100%;
  860. }
  861. .el-scrollbar__bar {
  862. &.is-vertical {
  863. width: 100px; //滚动条宽度
  864. }
  865. }
  866. .el-scrollbar__wrap {
  867. overflow-y: auto;
  868. overflow-x: hidden;
  869. }
  870. .el-scrollbar__thumb {
  871. // 可设置滚动条颜色
  872. background: red;
  873. }
  874. }
  875. }
  876. // 悬浮框样式
  877. .suspensionBox {
  878. // position: absolute;
  879. width: 400px;
  880. background: rgba(12, 20, 44, 0.8);
  881. border-radius: 8px;
  882. overflow: hidden;
  883. z-index: 100;
  884. margin-top: 20px;
  885. .top {
  886. display: flex;
  887. justify-content: space-between;
  888. color: #fff;
  889. align-items: center;
  890. padding: 10px;
  891. background: #0c142c;
  892. i {
  893. cursor: pointer;
  894. font-size: 14px;
  895. }
  896. }
  897. }
  898. .popupInner {
  899. position: absolute;
  900. right: 0;
  901. top: 160px;
  902. z-index: 200;
  903. }
  904. // 设备预警
  905. .equipWarnBox {
  906. height: 190px;
  907. right: 10px;
  908. // top: 160px;
  909. .inner {
  910. // height: 82px;
  911. // overflow: hidden;
  912. .wranTitle {
  913. display: flex;
  914. justify-content: space-around;
  915. line-height: 33px;
  916. color: #fff;
  917. .wranmsg {
  918. width: 157px;
  919. }
  920. }
  921. .equipList {
  922. height: 110px;
  923. overflow: hidden;
  924. .scroll-wrap {
  925. height: 150px;
  926. overflow: hidden;
  927. }
  928. .scroll-content {
  929. position: relative;
  930. transition: top 0.5s;
  931. .wranInfo {
  932. line-height: 22px;
  933. color: #92c2f3;
  934. display: flex;
  935. justify-content: space-around;
  936. .wranmsg {
  937. width: 157px;
  938. overflow: hidden;
  939. white-space: nowrap;
  940. text-overflow: ellipsis;
  941. }
  942. .state {
  943. color: red;
  944. }
  945. }
  946. }
  947. .scroll-content p {
  948. line-height: 50px;
  949. text-align: center;
  950. }
  951. }
  952. }
  953. }
  954. .equipCtrlBox {
  955. // height: 180px;
  956. right: 10px;
  957. top: 357px;
  958. .top {
  959. .uptime {
  960. color: #eee;
  961. }
  962. .historyBtn {
  963. border: 1px solid #00c2ff;
  964. color: #00c2ff;
  965. border-radius: 14px;
  966. padding: 2px 4px;
  967. cursor: pointer;
  968. }
  969. }
  970. .inner {
  971. // height: 132px;
  972. overflow: hidden;
  973. padding-bottom: 10px;
  974. .el-scrollbar {
  975. // height: 149px;
  976. /deep/.el-scrollbar__wrap {
  977. overflow-y: auto;
  978. overflow-x: hidden;
  979. }
  980. }
  981. }
  982. .equipList {
  983. display: flex;
  984. flex-wrap: wrap;
  985. .equipState {
  986. color: #fff;
  987. width: 50%;
  988. margin-top: 13px;
  989. text-align: center;
  990. .name {
  991. display: inline-block;
  992. white-space: nowrap;
  993. width: 87px;
  994. overflow: hidden;
  995. text-overflow: ellipsis;
  996. vertical-align: middle;
  997. // text-align: right;
  998. }
  999. /deep/.el-switch__core {
  1000. width: 30px !important;
  1001. height: 15px;
  1002. /*color:#409EFF;*/
  1003. }
  1004. /*设置圆*/
  1005. /deep/.el-switch__core::after {
  1006. width: 14px;
  1007. height: 14px;
  1008. margin-top: -1px;
  1009. margin-bottom: 2px;
  1010. }
  1011. }
  1012. }
  1013. }
  1014. .qxzEquipBox {
  1015. // height: 215px;
  1016. right: 10px;
  1017. top: 542px;
  1018. color: #fff;
  1019. .top {
  1020. .uptime {
  1021. color: #eee;
  1022. }
  1023. .historyBtn {
  1024. border: 1px solid #00c2ff;
  1025. color: #00c2ff;
  1026. border-radius: 14px;
  1027. padding: 2px 4px;
  1028. cursor: pointer;
  1029. }
  1030. }
  1031. .inner {
  1032. .el-scrollbar {
  1033. // height: 198px;
  1034. /deep/.el-scrollbar__wrap {
  1035. overflow-x: hidden;
  1036. }
  1037. }
  1038. .equipList {
  1039. display: flex;
  1040. flex-wrap: wrap;
  1041. padding-bottom: 10px;
  1042. .equipState {
  1043. width: 33.333%;
  1044. display: flex;
  1045. justify-content: center;
  1046. align-items: center;
  1047. margin-top: 10px;
  1048. > div:first-child {
  1049. margin-right: 5px;
  1050. }
  1051. .val {
  1052. font-size: 14px;
  1053. background-image: -webkit-linear-gradient(bottom, #069dff, #09fdff);
  1054. -webkit-background-clip: text;
  1055. -webkit-text-fill-color: transparent;
  1056. font-weight: 700;
  1057. }
  1058. .name {
  1059. color: #92c2f3;
  1060. width: 70px;
  1061. overflow: hidden;
  1062. text-overflow: ellipsis;
  1063. white-space: nowrap;
  1064. }
  1065. }
  1066. }
  1067. }
  1068. }
  1069. // 环形菜单
  1070. .navMenu {
  1071. position: fixed;
  1072. left: 110px;
  1073. bottom: 23px;
  1074. width: 135px;
  1075. height: 135px;
  1076. z-index: 100;
  1077. > div {
  1078. position: absolute;
  1079. cursor: pointer;
  1080. }
  1081. .mainMenu {
  1082. left: 0;
  1083. bottom: 0;
  1084. z-index: 5;
  1085. // transform: scale(.8);
  1086. transition: all 0.3s;
  1087. > div {
  1088. width: 70px;
  1089. height: 70px;
  1090. background: #0c142c;
  1091. border-radius: 50%;
  1092. color: #fff;
  1093. line-height: 18px;
  1094. font-size: 12px;
  1095. text-align: center;
  1096. > i {
  1097. font-size: 30px;
  1098. margin-top: 12px;
  1099. }
  1100. }
  1101. }
  1102. .subMenu {
  1103. transform: rotate(124deg) scale(1.4);
  1104. transform-origin: 30px 100px;
  1105. position: absolute;
  1106. left: 0;
  1107. right: 0;
  1108. top: 0;
  1109. bottom: 0;
  1110. transition: all 0.5s;
  1111. .itemMenu {
  1112. transform: scale(1);
  1113. transition: all 0.3s;
  1114. position: absolute;
  1115. cursor: pointer;
  1116. &:hover {
  1117. transform: scale(1.1);
  1118. }
  1119. > div {
  1120. width: 40px;
  1121. height: 40px;
  1122. background: #0c142c;
  1123. border-radius: 50%;
  1124. color: #fff;
  1125. font-size: 12px;
  1126. line-height: 40px;
  1127. text-align: center;
  1128. }
  1129. }
  1130. .itemMenu1 {
  1131. right: 65px;
  1132. bottom: 96px;
  1133. }
  1134. .itemMenu2 {
  1135. right: 16px;
  1136. bottom: 64px;
  1137. }
  1138. .itemMenu3 {
  1139. right: -1px;
  1140. bottom: 5px;
  1141. }
  1142. }
  1143. }
  1144. // 设备定位弹框
  1145. /deep/.setlnglatBox{
  1146. box-shadow: 0px 0px 4px 0px #0161ff;
  1147. background: rgba(12, 20, 44, 0.8);
  1148. border-radius: 8px;
  1149. }
  1150. /deep/.setlnglatBox .el-dialog__header{
  1151. background: #0c142c;
  1152. padding: 10px 20px;
  1153. border-bottom: 1px solid #0c142c;
  1154. }
  1155. /deep/.setlnglatBox .el-dialog__header .el-dialog__title{
  1156. color: #fff;
  1157. font-size: 14px;
  1158. }
  1159. /deep/.setlnglatBox .el-dialog__headerbtn .el-dialog__close{
  1160. color: #fff;
  1161. }
  1162. </style>