SBQ_FDC.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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: [106.4515667, 37.60171667], // 初始中心点 106.230909, 38.487193
  146. height: 654, // 3D地图初始相机高度
  147. tilt: 65, // 俯视角
  148. scale: 120000,
  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-sbq");
  202. this.fans = jsonObj;
  203. jsonObj.forEach((item) => {
  204. let obj = this.fjmap.find((t) => {
  205. let wtid = t.wtId.replace("01_", "");
  206. if (wtid == item.attributes.code) return t;
  207. });
  208. if (obj) {
  209. item.attributes.state = String(obj.fjzt);
  210. } else {
  211. item.attributes.state = "4";
  212. }
  213. switch (item.attributes.state) {
  214. case "0": //待机
  215. item.attributes.rotate = false; // 转
  216. item.attributes.dur = 8; // 转一圈时间
  217. break;
  218. case "1": //运行
  219. item.attributes.rotate = true; // 转
  220. item.attributes.dur = 2; // 转一圈时间
  221. break;
  222. case "2": //故障
  223. item.attributes.rotate = false; // 不转
  224. item.attributes.dur = 8;
  225. break;
  226. case "3": //中断
  227. item.attributes.rotate = false; // 不转
  228. item.attributes.dur = 8;
  229. break;
  230. case "4": //维护
  231. item.attributes.rotate = false; // 不转
  232. item.attributes.dur = 8;
  233. break;
  234. case "5": //限电
  235. item.attributes.rotate = true; // 转
  236. item.attributes.dur = 6;
  237. break;
  238. case "6": //停机
  239. item.attributes.rotate = false; // 不转
  240. item.attributes.dur = 8;
  241. break;
  242. default:
  243. item.attributes.rotate = false;
  244. item.attributes.dur = 8;
  245. break;
  246. }
  247. this.$refs.arcgis.addHtmlPoint(
  248. [item.geometry.x, item.geometry.y],
  249. item.attributes.code,
  250. 33,
  251. 50,
  252. false
  253. );
  254. });
  255. let lineJsonObj = dataService.get("arcgis-sbq-line");
  256. this.$refs.arcgis.addFanByJson(jsonObj, lineJsonObj);
  257. },
  258. clickMap: function (info) {
  259. console.log(info);
  260. },
  261. clickFan: function (code) {
  262. let wtId = code.replace("G", "G01_");
  263. this.$router.push(`/monitor/windsite/info/${this.wpId}/${wtId}`);
  264. },
  265. popupBack: function () {
  266. this.showPopup = false;
  267. },
  268. clickMapTool: function (index) {
  269. // this.mapToolIndex = index;
  270. this.showPopup = !this.showPopup;
  271. },
  272. },
  273. watch: {
  274. wpId(res) {
  275. this.sourceId = res;
  276. if (res) {
  277. this.requestData();
  278. }
  279. },
  280. },
  281. };
  282. </script>
  283. <style lang="less" scoped>
  284. @titleHeight: 40px;
  285. .map-1 {
  286. width: 100%;
  287. height: calc(100vh - 90px);
  288. display: flex;
  289. flex-direction: column;
  290. .btn-group-tabs {
  291. display: flex;
  292. flex-direction: row;
  293. }
  294. .can-click {
  295. cursor: pointer;
  296. }
  297. .syz-img {
  298. width: 65px;
  299. height: 47px;
  300. img {
  301. width: 100%;
  302. height: 100%;
  303. }
  304. }
  305. .panel-title {
  306. width: 100%;
  307. background-color: fade(@darkgray, 40%);
  308. margin-top: 16px;
  309. padding: 6px;
  310. display: flex;
  311. align-items: center;
  312. .panel-title-name {
  313. color: @green;
  314. display: flex;
  315. align-items: center;
  316. line-height: 0;
  317. font-size: 0;
  318. i,
  319. span {
  320. margin: 0 0 0 16px;
  321. line-height: 0;
  322. font-size: 13px;
  323. }
  324. }
  325. .sub-title-item {
  326. display: flex;
  327. align-items: center;
  328. margin-left: 16px;
  329. .sub-title {
  330. font-size: 13px;
  331. margin-left: 6px;
  332. }
  333. .sub-count {
  334. font-size: 13px;
  335. font-weight: 500;
  336. }
  337. img {
  338. height: 31px;
  339. }
  340. }
  341. }
  342. .panel-body {
  343. flex-grow: 1;
  344. background-color: fade(@darkgray, 20%);
  345. padding: 8px;
  346. overflow: auto;
  347. position: relative;
  348. .arcgis-layer {
  349. z-index: 1;
  350. }
  351. .map-popup-panel {
  352. width: 760px;
  353. position: absolute;
  354. left: 71px;
  355. top: 22px;
  356. z-index: 2;
  357. .map-popup-panel-header {
  358. width: 100%;
  359. background: fade(#152221, 90%);
  360. display: flex;
  361. .map-popup-panel-title {
  362. padding: 17px 24px;
  363. font-size: @fontsize-s;
  364. position: relative;
  365. &::before,
  366. &::after {
  367. position: absolute;
  368. width: calc(50% - 6px);
  369. bottom: 0;
  370. border-bottom: 2px solid @green;
  371. }
  372. &::before {
  373. content: "";
  374. left: 0;
  375. }
  376. &::after {
  377. content: "";
  378. right: 0;
  379. }
  380. span {
  381. position: absolute;
  382. width: 11.3px;
  383. height: 11.3px;
  384. border-left: 2px solid @green;
  385. border-top: 2px solid @green;
  386. left: calc(50% - 5.65px);
  387. bottom: -3px;
  388. transform: rotate(45deg);
  389. }
  390. }
  391. .map-popup-panel-date {
  392. flex-grow: 1;
  393. padding: 17px 24px;
  394. font-size: @fontsize-s;
  395. text-align: right;
  396. border-bottom: 2px solid @green;
  397. }
  398. .map-popup-panel-back {
  399. margin-left: auto;
  400. width: 54px;
  401. display: flex;
  402. align-items: center;
  403. justify-content: center;
  404. position: relative;
  405. cursor: pointer;
  406. &::after {
  407. content: "";
  408. position: absolute;
  409. left: 0;
  410. height: 50%;
  411. border-left: 1px solid @gray;
  412. top: 25%;
  413. }
  414. }
  415. }
  416. .map-popup-panel-body {
  417. background: fade(#152221, 75%);
  418. border: 1px solid fade(@darkgray, 40);
  419. border-top: 0px;
  420. .table-form {
  421. .text,
  422. .unit {
  423. font-weight: 400;
  424. }
  425. .unit {
  426. min-width: auto;
  427. }
  428. .value,
  429. .unit {
  430. text-align: left;
  431. }
  432. }
  433. }
  434. }
  435. .map-tool {
  436. position: absolute;
  437. right: 22px;
  438. top: 22px;
  439. z-index: 2;
  440. background: #152221af;
  441. padding: 18px 14px;
  442. .m-btn {
  443. width: 124px;
  444. height: 44px;
  445. background: #152221bf;
  446. border: 1px solid #152221bf;
  447. color: #ffffff;
  448. transition: all 0.3s;
  449. display: flex;
  450. align-items: center;
  451. justify-content: center;
  452. cursor: pointer;
  453. &:hover,
  454. &.active {
  455. background: #05bb4c33;
  456. border: 1px solid #05bb4c;
  457. color: #05bb4c;
  458. }
  459. + .m-btn {
  460. margin-top: 16px;
  461. }
  462. }
  463. }
  464. }
  465. }
  466. </style>