NSS_FDC.vue 12 KB

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