QS_FDC.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <div style="width: 100%; height: 100%">
  3. <arcgis class="arcgis-layer" @when="when" ref="arcgis" :data="arcgisData" @clickMap="clickMap">
  4. <template v-for="(fan, index) of fans" :key="index" v-slot:[fan.attributes.code]>
  5. <svg v-if="fan.attributes.code != '升压站'" @click="clickFan(fan.attributes.code)"
  6. class="can-click esri-component" version="1.1" xmlns="http://www.w3.org/2000/svg"
  7. xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 240" enable-background="new 0 0 200 240"
  8. xml:space="preserve" width="66" height="66">
  9. <!-- 底座 -->
  10. <g>
  11. <path fill-rule="evenodd" clip-rule="evenodd" :fill="colors[fan.attributes.state][2]"
  12. d="M100.681,156.137c24.579,0,44.505,8.548,44.505,19.094
  13. c0,10.545-19.926,19.093-44.505,19.093c-24.577,0-42.878-8.548-42.878-19.093C57.803,164.685,76.104,156.137,100.681,156.137z" />
  14. </g>
  15. <!-- 后面的脑袋 -->
  16. <g>
  17. <path fill-rule="evenodd" clip-rule="evenodd" :fill="colors[fan.attributes.state][0]" d="M92.875,76.372l27.897-18.417c0,0,4.108-0.096,7.891,2.681
  18. c4.305,3.156,1.86,9.235,1.86,9.235l-24.374,23.292L92.875,76.372z" />
  19. </g>
  20. <!-- 柱 -->
  21. <g>
  22. <path fill-rule="evenodd" clip-rule="evenodd" :fill="colors[fan.attributes.state][0]"
  23. d="M92.152,175.229h18.689l-4.876-94.254H97.84L92.152,175.229z" />
  24. </g>
  25. <!-- 风扇 -->
  26. <g>
  27. <path fill-rule="evenodd" clip-rule="evenodd" :fill="colors[fan.attributes.state][1]"
  28. d="M109.007,85.525l-16.061,0.268l7.396-83.773L109.007,85.525z" />
  29. <path fill-rule="evenodd" clip-rule="evenodd" :fill="colors[fan.attributes.state][1]" d="M95.219,75.597l8.265,13.771l-76.25,35.483L95.219,75.597z
  30. M99.108,89.634l7.795-14.04l68.854,48.291L99.108,89.634z" />
  31. <animateTransform v-if="fan.attributes.rotate" attributeName="transform" attributeType="XML"
  32. type="rotate" from="0 100 82" to="359 100 82" :dur="fan.attributes.dur + 's'"
  33. repeatCount="indefinite" />
  34. </g>
  35. <!-- 前面的尖 -->
  36. <g>
  37. <path fill-rule="evenodd" clip-rule="evenodd" :fill="colors[fan.attributes.state][2]" d="M92.863,72.903c0,0,13.912-0.343,17.098,4.352
  38. c2.984,4.397-2.58,15.473-2.58,15.473l-24.376,0.436L92.863,72.903z" />
  39. </g>
  40. <!-- 文字 -->
  41. <g>
  42. <text x="100" y="240" fill="#ffffff" font-size="40" text-anchor="middle"
  43. alignment-baseline="baseline">
  44. {{ fan.attributes.code }}
  45. </text>
  46. </g>
  47. </svg>
  48. <div v-if="fan.attributes.code == '升压站'">
  49. <div class="syz-img">
  50. <img :src="syzImg" />
  51. </div>
  52. <div class="white font-sm mr-t-8" style="text-align: center">
  53. {{ fan.attributes.code }}
  54. </div>
  55. </div>
  56. </template>
  57. </arcgis>
  58. </div>
  59. </template>
  60. <script>
  61. import arcgis from "./arcgis.vue";
  62. import dataService from "@/helper/data.js";
  63. export default {
  64. // 名称
  65. name: "Map",
  66. // 使用组件
  67. components: {
  68. arcgis,
  69. },
  70. props: {
  71. wpId: {
  72. type: String,
  73. default: "",
  74. },
  75. },
  76. // 数据
  77. data() {
  78. return {
  79. wpnumMap: {}, //风机监视数量
  80. wpInfoMap: {}, //风机详情
  81. fjmap: [], // 风机名
  82. sourceId: "",
  83. arcgisData: {
  84. mode: "2D", // 模式 2D 3D
  85. title: "宁夏地图", // 标题
  86. center: [107.217636108398, 37.5134917819943], // 初始中心点 106.230909, 38.487193
  87. height: 654, // 3D地图初始相机高度
  88. tilt: 65, // 俯视角
  89. scale: 55000,
  90. rotation: -45,
  91. ox: -600,
  92. oy: -50,
  93. },
  94. showPopup: false,
  95. mapToolIndex: 0,
  96. fans: [],
  97. colors: {
  98. 0: ["#05bb4c", "#4ad476", "#9fedb2"],
  99. 1: ["#4b55ae", "#959dc7", "#d3d6e0"],
  100. 2: ["#BA3237", "#d4807d", "#eddad8"],
  101. 3: ["#606769", "#757575", "#AFAFAF"],
  102. 4: ["#e17e23", "#fabf78", "#ffebcc"],
  103. 5: ["#c531c7", "#e080dc", "#fadef7"],
  104. 6: ["#c531c7", "#e080dc", "#fadef7"],
  105. },
  106. syzImg: require("@assets/png/booster-station.png"),
  107. };
  108. },
  109. created() {
  110. let that = this;
  111. that.sourceId = this.wpId;
  112. that.$nextTick(() => {
  113. that.requestData();
  114. });
  115. },
  116. // 函数
  117. methods: {
  118. select(res) {
  119. this.$router.replace({
  120. path: `/monitor/windsite/map/${res.code}`,
  121. });
  122. },
  123. // 风机状态监视
  124. requestData() {
  125. let that = this;
  126. that.API.requestData({
  127. method: "POST",
  128. subUrl: "monitor/findGeneralAppearance",
  129. data: {
  130. wpId: that.wpId,
  131. },
  132. success(res) {
  133. if (res.code == 200) {
  134. that.wpnumMap = res.data.fczbmap.jczbmap;
  135. that.wpInfoMap = res.data.wxssmap;
  136. that.fjmap = res.data.fjmap[0];
  137. }
  138. },
  139. });
  140. },
  141. when: function() {
  142. let jsonObj = dataService.get("arcgis-qs");
  143. console.log(jsonObj)
  144. this.fans = jsonObj;
  145. jsonObj.forEach((item) => {
  146. let obj = this.fjmap.find((t) => {
  147. let wtid = t.wtId.replace("01_", "");
  148. if (wtid == item.attributes.code) return t;
  149. });
  150. if (obj) {
  151. item.attributes.state = String(obj.fjzt);
  152. } else {
  153. item.attributes.state = "4";
  154. }
  155. console.log(item.attributes.state)
  156. switch (item.attributes.state) {
  157. case "0": //待机
  158. item.attributes.rotate = false; // 转
  159. item.attributes.dur = 8; // 转一圈时间
  160. break;
  161. case "1": //运行
  162. item.attributes.rotate = true; // 转
  163. item.attributes.dur = 2; // 转一圈时间
  164. break;
  165. case "2": //故障
  166. item.attributes.rotate = false; // 不转
  167. item.attributes.dur = 8;
  168. break;
  169. case "3": //中断
  170. item.attributes.rotate = false; // 不转
  171. item.attributes.dur = 8;
  172. break;
  173. case "4": //维护
  174. item.attributes.rotate = false; // 不转
  175. item.attributes.dur = 8;
  176. break;
  177. case "5": //限电
  178. item.attributes.rotate = true; // 转
  179. item.attributes.dur = 6;
  180. break;
  181. case "6": //停机
  182. item.attributes.rotate = false; // 不转
  183. item.attributes.dur = 8;
  184. break;
  185. default:
  186. item.attributes.rotate = false;
  187. item.attributes.dur = 8;
  188. break;
  189. }
  190. this.$refs.arcgis.addHtmlPoint(
  191. [item.geometry.x, item.geometry.y],
  192. item.attributes.code,
  193. 33,
  194. 50,
  195. false
  196. );
  197. });
  198. let lineJsonObj = dataService.get("arcgis-qs-line");
  199. this.$refs.arcgis.addFanByJson(jsonObj, lineJsonObj);
  200. },
  201. clickMap: function(info) {
  202. console.log(info);
  203. },
  204. clickFan: function(code) {
  205. let wtId = code.replace("G", "G01_");
  206. this.$router.push(`/monitor/windsite/info/${this.wpId}/${wtId}`);
  207. },
  208. popupBack: function() {
  209. this.showPopup = false;
  210. },
  211. clickMapTool: function(index) {
  212. // this.mapToolIndex = index;
  213. this.showPopup = !this.showPopup;
  214. },
  215. },
  216. watch: {
  217. wpId(res) {
  218. this.sourceId = res;
  219. if (res) {
  220. this.requestData();
  221. }
  222. },
  223. },
  224. };
  225. </script>
  226. <style lang="less" scoped>
  227. @titleHeight: 40px;
  228. .map-1 {
  229. width: 100%;
  230. height: calc(100vh - 90px);
  231. display: flex;
  232. flex-direction: column;
  233. .btn-group-tabs {
  234. display: flex;
  235. flex-direction: row;
  236. }
  237. .can-click {
  238. cursor: pointer;
  239. }
  240. .syz-img {
  241. width: 65px;
  242. height: 47px;
  243. img {
  244. width: 100%;
  245. height: 100%;
  246. }
  247. }
  248. .panel-title {
  249. width: 100%;
  250. background-color: fade(@darkgray, 40%);
  251. margin-top: 16px;
  252. padding: 6px;
  253. display: flex;
  254. align-items: center;
  255. .panel-title-name {
  256. color: @green;
  257. display: flex;
  258. align-items: center;
  259. line-height: 0;
  260. font-size: 0;
  261. i,
  262. span {
  263. margin: 0 0 0 16px;
  264. line-height: 0;
  265. font-size: 13px;
  266. }
  267. }
  268. .sub-title-item {
  269. display: flex;
  270. align-items: center;
  271. margin-left: 16px;
  272. .sub-title {
  273. font-size: 13px;
  274. margin-left: 6px;
  275. }
  276. .sub-count {
  277. font-size: 13px;
  278. font-weight: 500;
  279. }
  280. img {
  281. height: 31px;
  282. }
  283. }
  284. }
  285. .panel-body {
  286. flex-grow: 1;
  287. background-color: fade(@darkgray, 20%);
  288. padding: 8px;
  289. overflow: auto;
  290. position: relative;
  291. .arcgis-layer {
  292. z-index: 1;
  293. }
  294. .map-popup-panel {
  295. width: 760px;
  296. position: absolute;
  297. left: 71px;
  298. top: 22px;
  299. z-index: 2;
  300. .map-popup-panel-header {
  301. width: 100%;
  302. background: fade(#152221, 90%);
  303. display: flex;
  304. .map-popup-panel-title {
  305. padding: 17px 24px;
  306. font-size: @fontsize-s;
  307. position: relative;
  308. &::before,
  309. &::after {
  310. position: absolute;
  311. width: calc(50% - 6px);
  312. bottom: 0;
  313. border-bottom: 2px solid @green;
  314. }
  315. &::before {
  316. content: "";
  317. left: 0;
  318. }
  319. &::after {
  320. content: "";
  321. right: 0;
  322. }
  323. span {
  324. position: absolute;
  325. width: 11.3px;
  326. height: 11.3px;
  327. border-left: 2px solid @green;
  328. border-top: 2px solid @green;
  329. left: calc(50% - 5.65px);
  330. bottom: -3px;
  331. transform: rotate(45deg);
  332. }
  333. }
  334. .map-popup-panel-date {
  335. flex-grow: 1;
  336. padding: 17px 24px;
  337. font-size: @fontsize-s;
  338. text-align: right;
  339. border-bottom: 2px solid @green;
  340. }
  341. .map-popup-panel-back {
  342. margin-left: auto;
  343. width: 54px;
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. position: relative;
  348. cursor: pointer;
  349. &::after {
  350. content: "";
  351. position: absolute;
  352. left: 0;
  353. height: 50%;
  354. border-left: 1px solid @gray;
  355. top: 25%;
  356. }
  357. }
  358. }
  359. .map-popup-panel-body {
  360. background: fade(#152221, 75%);
  361. border: 1px solid fade(@darkgray, 40);
  362. border-top: 0px;
  363. .table-form {
  364. .text,
  365. .unit {
  366. font-weight: 400;
  367. }
  368. .unit {
  369. min-width: auto;
  370. }
  371. .value,
  372. .unit {
  373. text-align: left;
  374. }
  375. }
  376. }
  377. }
  378. .map-tool {
  379. position: absolute;
  380. right: 22px;
  381. top: 22px;
  382. z-index: 2;
  383. background: #152221af;
  384. padding: 18px 14px;
  385. .m-btn {
  386. width: 124px;
  387. height: 44px;
  388. background: #152221bf;
  389. border: 1px solid #152221bf;
  390. color: #ffffff;
  391. transition: all 0.3s;
  392. display: flex;
  393. align-items: center;
  394. justify-content: center;
  395. cursor: pointer;
  396. &:hover,
  397. &.active {
  398. background: #05bb4c33;
  399. border: 1px solid #05bb4c;
  400. color: #05bb4c;
  401. }
  402. +.m-btn {
  403. margin-top: 16px;
  404. }
  405. }
  406. }
  407. }
  408. }
  409. </style>