QS_FDC.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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. that.when();
  138. }
  139. },
  140. });
  141. },
  142. when: function() {
  143. let jsonObj = dataService.get("arcgis-qs");
  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. switch (item.attributes.state) {
  156. case "0": //待机
  157. item.attributes.rotate = false; // 转
  158. item.attributes.dur = 8; // 转一圈时间
  159. break;
  160. case "1": //运行
  161. item.attributes.rotate = true; // 转
  162. item.attributes.dur = 2; // 转一圈时间
  163. break;
  164. case "2": //故障
  165. item.attributes.rotate = false; // 不转
  166. item.attributes.dur = 8;
  167. break;
  168. case "3": //中断
  169. item.attributes.rotate = false; // 不转
  170. item.attributes.dur = 8;
  171. break;
  172. case "4": //维护
  173. item.attributes.rotate = false; // 不转
  174. item.attributes.dur = 8;
  175. break;
  176. case "5": //限电
  177. item.attributes.rotate = true; // 转
  178. item.attributes.dur = 6;
  179. break;
  180. case "6": //停机
  181. item.attributes.rotate = false; // 不转
  182. item.attributes.dur = 8;
  183. break;
  184. default:
  185. item.attributes.rotate = false;
  186. item.attributes.dur = 8;
  187. break;
  188. }
  189. this.$refs.arcgis.addHtmlPoint(
  190. [item.geometry.x, item.geometry.y],
  191. item.attributes.code,
  192. 33,
  193. 50,
  194. false
  195. );
  196. });
  197. let lineJsonObj = dataService.get("arcgis-qs-line");
  198. this.$refs.arcgis.addFanByJson(jsonObj, lineJsonObj);
  199. },
  200. clickMap: function(info) {
  201. console.log(info);
  202. },
  203. clickFan: function(code) {
  204. let wtId = code.replace("G", "G01_");
  205. this.$router.push(`/monitor/windsite/info/${this.wpId}/${wtId}`);
  206. },
  207. popupBack: function() {
  208. this.showPopup = false;
  209. },
  210. clickMapTool: function(index) {
  211. // this.mapToolIndex = index;
  212. this.showPopup = !this.showPopup;
  213. },
  214. },
  215. watch: {
  216. wpId(res) {
  217. this.sourceId = res;
  218. if (res) {
  219. this.requestData();
  220. }
  221. },
  222. },
  223. };
  224. </script>
  225. <style lang="less" scoped>
  226. @titleHeight: 40px;
  227. .map-1 {
  228. width: 100%;
  229. height: calc(100vh - 90px);
  230. display: flex;
  231. flex-direction: column;
  232. .btn-group-tabs {
  233. display: flex;
  234. flex-direction: row;
  235. }
  236. .can-click {
  237. cursor: pointer;
  238. }
  239. .syz-img {
  240. width: 65px;
  241. height: 47px;
  242. img {
  243. width: 100%;
  244. height: 100%;
  245. }
  246. }
  247. .panel-title {
  248. width: 100%;
  249. background-color: fade(@darkgray, 40%);
  250. margin-top: 16px;
  251. padding: 6px;
  252. display: flex;
  253. align-items: center;
  254. .panel-title-name {
  255. color: @green;
  256. display: flex;
  257. align-items: center;
  258. line-height: 0;
  259. font-size: 0;
  260. i,
  261. span {
  262. margin: 0 0 0 16px;
  263. line-height: 0;
  264. font-size: 13px;
  265. }
  266. }
  267. .sub-title-item {
  268. display: flex;
  269. align-items: center;
  270. margin-left: 16px;
  271. .sub-title {
  272. font-size: 13px;
  273. margin-left: 6px;
  274. }
  275. .sub-count {
  276. font-size: 13px;
  277. font-weight: 500;
  278. }
  279. img {
  280. height: 31px;
  281. }
  282. }
  283. }
  284. .panel-body {
  285. flex-grow: 1;
  286. background-color: fade(@darkgray, 20%);
  287. padding: 8px;
  288. overflow: auto;
  289. position: relative;
  290. .arcgis-layer {
  291. z-index: 1;
  292. }
  293. .map-popup-panel {
  294. width: 760px;
  295. position: absolute;
  296. left: 71px;
  297. top: 22px;
  298. z-index: 2;
  299. .map-popup-panel-header {
  300. width: 100%;
  301. background: fade(#152221, 90%);
  302. display: flex;
  303. .map-popup-panel-title {
  304. padding: 17px 24px;
  305. font-size: @fontsize-s;
  306. position: relative;
  307. &::before,
  308. &::after {
  309. position: absolute;
  310. width: calc(50% - 6px);
  311. bottom: 0;
  312. border-bottom: 2px solid @green;
  313. }
  314. &::before {
  315. content: "";
  316. left: 0;
  317. }
  318. &::after {
  319. content: "";
  320. right: 0;
  321. }
  322. span {
  323. position: absolute;
  324. width: 11.3px;
  325. height: 11.3px;
  326. border-left: 2px solid @green;
  327. border-top: 2px solid @green;
  328. left: calc(50% - 5.65px);
  329. bottom: -3px;
  330. transform: rotate(45deg);
  331. }
  332. }
  333. .map-popup-panel-date {
  334. flex-grow: 1;
  335. padding: 17px 24px;
  336. font-size: @fontsize-s;
  337. text-align: right;
  338. border-bottom: 2px solid @green;
  339. }
  340. .map-popup-panel-back {
  341. margin-left: auto;
  342. width: 54px;
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. position: relative;
  347. cursor: pointer;
  348. &::after {
  349. content: "";
  350. position: absolute;
  351. left: 0;
  352. height: 50%;
  353. border-left: 1px solid @gray;
  354. top: 25%;
  355. }
  356. }
  357. }
  358. .map-popup-panel-body {
  359. background: fade(#152221, 75%);
  360. border: 1px solid fade(@darkgray, 40);
  361. border-top: 0px;
  362. .table-form {
  363. .text,
  364. .unit {
  365. font-weight: 400;
  366. }
  367. .unit {
  368. min-width: auto;
  369. }
  370. .value,
  371. .unit {
  372. text-align: left;
  373. }
  374. }
  375. }
  376. }
  377. .map-tool {
  378. position: absolute;
  379. right: 22px;
  380. top: 22px;
  381. z-index: 2;
  382. background: #152221af;
  383. padding: 18px 14px;
  384. .m-btn {
  385. width: 124px;
  386. height: 44px;
  387. background: #152221bf;
  388. border: 1px solid #152221bf;
  389. color: #ffffff;
  390. transition: all 0.3s;
  391. display: flex;
  392. align-items: center;
  393. justify-content: center;
  394. cursor: pointer;
  395. &:hover,
  396. &.active {
  397. background: #05bb4c33;
  398. border: 1px solid #05bb4c;
  399. color: #05bb4c;
  400. }
  401. +.m-btn {
  402. margin-top: 16px;
  403. }
  404. }
  405. }
  406. }
  407. }
  408. </style>