map.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <template>
  2. <div class="map">
  3. <div class="back"></div>
  4. <div class="security-days">
  5. <div class="text">安全天数:</div>
  6. <div class="num">
  7. <span class="font-num">{{ safeDay }}</span>
  8. <span class="unit">天</span>
  9. </div>
  10. </div>
  11. <div class="tab-box" v-if="currentMode == 'NX'">
  12. <div
  13. class="tab-item"
  14. v-for="(tab, index) of tabs"
  15. :key="index"
  16. :class="{ active: activeTab == index }"
  17. @click.stop="selectTab(index, tab.show)"
  18. >
  19. <span
  20. class="svg-icon svg-icon-sm"
  21. :class="activeTab == index ? 'svg-icon-green' : 'svg-icon-write'"
  22. >
  23. <SvgIcon :svgid="tab.icon"></SvgIcon>
  24. </span>
  25. <span>{{ tab.text }}</span>
  26. </div>
  27. </div>
  28. <div class="name-box" v-if="currentMode != 'NX'">
  29. <div class="name-box-title" @click="onBackStation">
  30. {{ currentTitle }}
  31. </div>
  32. <div class="name-box-period" v-show="currentPeriod != 'ZERO'">
  33. <span class="name-box-period-label">{{ textType }}:</span>
  34. <span class="name-box-period-value"
  35. >{{ currentName }}{{ currentPeriod }}</span
  36. >
  37. </div>
  38. </div>
  39. <div class="return" @click="backMap('0', '全部')" v-show="mapIndex != -1">
  40. <span class="svg-icon svg-icon-sm">
  41. <svg-icon :svgid="'svg-arrow-dpwn-1'" />
  42. </span>
  43. 返回
  44. </div>
  45. <!-- 指南针 -->
  46. <div class="compass">
  47. <svg
  48. version="1.1"
  49. xmlns="http://www.w3.org/2000/svg"
  50. xmlns:xlink="http://www.w3.org/1999/xlink"
  51. x="0px"
  52. y="0px"
  53. width="200px"
  54. height="200px"
  55. viewBox="0 0 200 200"
  56. enable-background="new 0 0 200 200"
  57. xml:space="preserve"
  58. >
  59. <g id="渐变">
  60. <path
  61. fill-rule="evenodd"
  62. clip-rule="evenodd"
  63. fill="#000"
  64. opacity="0"
  65. d="M100.523,18.655c44.661,0,80.865,36.205,80.865,80.866
  66. c0,44.66-36.204,80.865-80.865,80.865c-44.661,0-80.865-36.205-80.865-80.865C19.658,54.86,55.863,18.655,100.523,18.655z"
  67. />
  68. </g>
  69. <g id="图层_2">
  70. <g>
  71. <g>
  72. <path
  73. fill-rule="evenodd"
  74. clip-rule="evenodd"
  75. fill="#606769"
  76. opacity="0.75"
  77. d="M100.523,56.301c-23.869,0-43.22,19.349-43.22,43.22 c0,23.869,19.351,43.219,43.22,43.219c23.87,0,43.22-19.35,43.22-43.219C143.743,75.65,124.394,56.301,100.523,56.301z M100.954,139.082c-21.765,0-39.414-17.648-39.414-39.416c0-21.77,17.649-39.418,39.414-39.418 c21.772,0,39.417,17.648,39.417,39.418C140.371,121.434,122.727,139.082,100.954,139.082z"
  78. />
  79. </g>
  80. </g>
  81. </g>
  82. <g id="图层_3">
  83. <g>
  84. <g>
  85. <path
  86. fill-rule="evenodd"
  87. clip-rule="evenodd"
  88. fill="#05BB4C"
  89. d="M100.523,18.655c-44.661,0-80.865,36.205-80.865,80.866 c0,44.66,36.205,80.865,80.865,80.865c44.661,0,80.865-36.205,80.865-80.865C181.389,54.86,145.185,18.655,100.523,18.655z M101.156,173.509c-40.862,0-73.988-33.126-73.988-73.987c0-40.863,33.126-73.989,73.988-73.989 c40.862,0,73.988,33.125,73.988,73.989C175.145,140.383,142.019,173.509,101.156,173.509z"
  90. />
  91. </g>
  92. </g>
  93. </g>
  94. <g id="图层_4">
  95. <g>
  96. <g>
  97. <path
  98. fill-rule="evenodd"
  99. clip-rule="evenodd"
  100. fill="#05BB4C"
  101. opacity="0.2"
  102. d="M100.582,4.724h-0.118c-52.356,0-94.797,42.441-94.797,94.798 c0,52.355,42.441,94.797,94.797,94.797h0.118c52.356,0,94.798-42.441,94.798-94.797C195.38,47.165,152.938,4.724,100.582,4.724z M101.169,189.813c-49.76,0-90.1-40.338-90.1-90.095c0-49.76,40.34-90.1,90.1-90.1c49.757,0,90.095,40.34,90.095,90.1 C191.264,149.475,150.926,189.813,101.169,189.813z"
  103. />
  104. </g>
  105. </g>
  106. </g>
  107. <g id="图层_1">
  108. <polyline
  109. fill="#606769"
  110. points="59.177,142.682 113.678,116.092 84.673,87.663"
  111. />
  112. </g>
  113. <g id="图层_7">
  114. <polygon
  115. fill="#BD3338"
  116. points="139.496,60.156 114.004,115.172 85.004,86.745"
  117. />
  118. </g>
  119. </svg>
  120. </div>
  121. <div class="map-img">
  122. <!-- 宁夏地图总览 -->
  123. <SvgMapNX
  124. v-if="mapName === 'nx'"
  125. :show="showType"
  126. :data="sourceMap"
  127. :xtData="xtMap"
  128. @clickLabel="clickLabel"
  129. ></SvgMapNX>
  130. <!-- 麻黄山风电场 -->
  131. <MHSFDC
  132. v-if="mapName === 'MHS_FDC'"
  133. :data="sourceMap"
  134. @clickFj="clickFj"
  135. @changePeriod="changePeriod"
  136. ></MHSFDC>
  137. <!-- 香山风电场 -->
  138. <XSFDC
  139. v-if="mapName === 'XS_FDC'"
  140. :data="sourceMap"
  141. @clickFj="clickFj"
  142. @changePeriod="changePeriod"
  143. ></XSFDC>
  144. <!-- 牛首山风电场 -->
  145. <NSSFDC
  146. v-if="mapName === 'NSS_FDC'"
  147. :data="sourceMap"
  148. @clickFj="clickFj"
  149. @changePeriod="changePeriod"
  150. ></NSSFDC>
  151. <!-- 青山风电场 -->
  152. <QSFDC
  153. v-if="mapName === 'QS_FDC'"
  154. :data="sourceMap"
  155. @clickFj="clickFj"
  156. @changePeriod="changePeriod"
  157. ></QSFDC>
  158. <!-- 石板泉风电场 -->
  159. <SBQFDC
  160. v-if="mapName === 'SBQ_FDC'"
  161. :data="sourceMap"
  162. @clickFj="clickFj"
  163. @changePeriod="changePeriod"
  164. ></SBQFDC>
  165. <!-- 马场湖 -->
  166. <MCHGDC
  167. v-if="mapName === 'MCH_GDC'"
  168. :data="sourceMap"
  169. @clickFj="clickFj"
  170. @changePeriod="changePeriod"
  171. ></MCHGDC>
  172. <!-- 大武口 -->
  173. <DWKGDC
  174. v-if="mapName === 'DWK_GDC'"
  175. :data="sourceMap"
  176. @clickFj="clickFj"
  177. @changePeriod="changePeriod"
  178. ></DWKGDC>
  179. <!-- 平罗 -->
  180. <PLGDC
  181. v-if="mapName === 'PL_GDC'"
  182. :data="sourceMap"
  183. @clickFj="clickFj"
  184. @changePeriod="changePeriod"
  185. ></PLGDC>
  186. <!-- 宣和 -->
  187. <XHGDC
  188. v-if="mapName === 'XH_GDC'"
  189. :data="sourceMap"
  190. @clickFj="clickFj"
  191. @changePeriod="changePeriod"
  192. ></XHGDC>
  193. <!-- 海子井 -->
  194. <HZJGDC
  195. v-if="mapName === 'HZJ_GDC'"
  196. :data="sourceMap"
  197. @clickFj="clickFj"
  198. @changePeriod="changePeriod"
  199. ></HZJGDC>
  200. </div>
  201. </div>
  202. </template>
  203. <script>
  204. // 宁夏地图总览
  205. import SvgMapNX from "./map/svg-map-nx.vue";
  206. // 麻黄山风电场
  207. import MHSFDC from "./map/MHS_FDC.vue";
  208. // 香山风电场
  209. import XSFDC from "./map/XS_FDC.vue";
  210. // 牛首山风电场
  211. import NSSFDC from "./map/NSS_FDC.vue";
  212. // 青山风电场
  213. import QSFDC from "./map/QS_FDC.vue";
  214. // 石板泉风电场
  215. import SBQFDC from "./map/SBQ_FDC.vue";
  216. // 马场湖
  217. import MCHGDC from "./map/MCH_GDC.vue";
  218. // 大武口
  219. import DWKGDC from "./map/DWK_GDC.vue";
  220. // 平罗
  221. import PLGDC from "./map/PL_GDC.vue";
  222. // 宣和
  223. import XHGDC from "./map/XH_GDC.vue";
  224. // 海子井
  225. import HZJGDC from "./map/HZJ_GDC.vue";
  226. import SvgIcon from "../../../components/coms/icon/svg-icon.vue";
  227. import compassIcon from "@/assets/icon/svg_fill/compass.svg";
  228. export default {
  229. // 名称
  230. name: "Map",
  231. // 使用组件
  232. components: {
  233. SvgMapNX,
  234. MHSFDC,
  235. XSFDC,
  236. NSSFDC,
  237. QSFDC,
  238. SBQFDC,
  239. MCHGDC,
  240. DWKGDC,
  241. PLGDC,
  242. XHGDC,
  243. HZJGDC,
  244. SvgIcon,
  245. },
  246. props: {
  247. wpId: {
  248. type: String,
  249. default: "0",
  250. },
  251. day: {
  252. type: String,
  253. default: "---",
  254. },
  255. data: {
  256. type: Object,
  257. default: () => {},
  258. },
  259. xtData: {
  260. type: Object,
  261. default: () => {},
  262. },
  263. },
  264. mounted() {
  265. this.fcId = this.wpId;
  266. this.safeDay = this.day;
  267. this.sourceMap = this.data;
  268. this.xtMap = this.xtData;
  269. },
  270. // 数据
  271. data() {
  272. return {
  273. textType: "期次",
  274. fcId: "",
  275. safeDay: "",
  276. showType: "all",
  277. sourceMap: {},
  278. mapIndex: -1,
  279. tabs: [
  280. {
  281. icon: "svg-all",
  282. text: "全部",
  283. show: "all",
  284. },
  285. {
  286. icon: "svg-wind-site",
  287. text: "风场",
  288. show: "fc",
  289. },
  290. {
  291. icon: "svg-photovoltaic",
  292. text: "电站",
  293. show: "gf",
  294. },
  295. ],
  296. compassIcon: compassIcon,
  297. activeTab: 0,
  298. img: require("@assets/map/map-nx.png"),
  299. nxSvgFile: require("@assets/map/map-nx.svg"),
  300. nxmap: true,
  301. mapName: "nx",
  302. currentMode: "NX",
  303. currentTitle: "青山风电场",
  304. currentName: "麻黄山",
  305. currentPeriod: "一期",
  306. };
  307. },
  308. emits: {
  309. onEnter: null,
  310. onBack: null,
  311. },
  312. // 函数
  313. methods: {
  314. selectTab(index, showType) {
  315. this.activeTab = index;
  316. this.showType = showType;
  317. let wpId = showType === "all" ? "0" : showType === "fc" ? "-1" : "-2";
  318. this.safeDay = "---";
  319. this.mapName = "nx";
  320. this.$emit("mapClicks", wpId, this.tabs[index].text);
  321. },
  322. backMap(wpId, planBtnName) {
  323. this.activeTab = 0;
  324. this.currentMode = "NX";
  325. this.mapName = "nx";
  326. this.mapIndex = -1;
  327. this.$store.dispatch("changeTqmapName", "");
  328. this.$emit("mapClickBack", wpId, planBtnName);
  329. },
  330. clickLabel(wpId, planBtnName) {
  331. this.mapName = wpId;
  332. this.currentTitle = planBtnName;
  333. this.mapIndex = 1;
  334. this.$emit("mapClick", wpId, planBtnName);
  335. },
  336. clickFj(wpId, planBtnName, textType) {
  337. this.$emit("mapClick", wpId, planBtnName);
  338. },
  339. changePeriod: function (name, period, textType) {
  340. if (textType) {
  341. this.textType = "期次";
  342. } else {
  343. this.textType = "线路";
  344. }
  345. this.currentName = name;
  346. this.currentPeriod = period;
  347. this.currentMode = "SUB";
  348. },
  349. // 返回当前场站
  350. onBackStation() {
  351. this.currentPeriod = "ZERO";
  352. this.$emit("backStation");
  353. },
  354. },
  355. watch: {
  356. wpId(res) {
  357. this.fcId = res;
  358. },
  359. day(res) {
  360. this.safeDay = res;
  361. },
  362. data(res) {
  363. this.sourceMap = res;
  364. },
  365. xtData(res) {
  366. this.xtMap = res;
  367. },
  368. },
  369. };
  370. </script>
  371. <style lang="less">
  372. .map {
  373. position: relative;
  374. width: 100%;
  375. height: 100%;
  376. .back {
  377. position: fixed;
  378. z-index: -1;
  379. width: 100vw;
  380. height: 100vh;
  381. top: 0;
  382. left: 0;
  383. background: url(../../../assets/background-home.png) no-repeat;
  384. background-size: 100% 100%;
  385. }
  386. .security-days {
  387. margin: 1.852vh;
  388. .text {
  389. font-size: 2.222vh;
  390. color: @write;
  391. }
  392. .num {
  393. color: @green;
  394. font-size: 3.704vh;
  395. .unit {
  396. font-size: 2.222vh;
  397. position: relative;
  398. margin-left: 0.556vh;
  399. top: -0.185vh;
  400. }
  401. }
  402. }
  403. .name-box {
  404. margin: 1.852vh;
  405. display: inline-block;
  406. z-index: 2;
  407. position: relative;
  408. .name-box-title {
  409. font-size: 2.222vh;
  410. font-weight: 400;
  411. color: #ffffff;
  412. line-height: 1;
  413. cursor: pointer;
  414. }
  415. .name-box-period {
  416. margin-top: 2.222vh;
  417. .name-box-period-label,
  418. .name-box-period-value {
  419. font-size: 1.481vh;
  420. font-weight: 400;
  421. line-height: 1;
  422. }
  423. .name-box-period-label {
  424. color: #fefefe;
  425. }
  426. .name-box-period-value {
  427. color: #05bb4c;
  428. }
  429. }
  430. }
  431. .tab-box {
  432. margin: 1.852vh 2.778vh;
  433. display: inline-block;
  434. z-index: 2;
  435. position: relative;
  436. .tab-item {
  437. display: flex;
  438. align-items: center;
  439. justify-content: center;
  440. font-size: @fontsize;
  441. cursor: pointer;
  442. width: 6.481vh;
  443. padding: 0.3704vh 0;
  444. margin-bottom: 1.4815vh;
  445. &.active {
  446. color: @green;
  447. position: relative;
  448. background-image: @greenLinearTop;
  449. &::after {
  450. content: "";
  451. position: absolute;
  452. width: 100%;
  453. height: 0.463vh;
  454. border: 0.093vh solid @green;
  455. border-top: 0;
  456. left: 0;
  457. bottom: 0;
  458. box-sizing: border-box;
  459. }
  460. }
  461. .svg-icon {
  462. margin-right: 12px;
  463. margin-top: 2px;
  464. }
  465. }
  466. }
  467. .return {
  468. position: absolute;
  469. display: flex;
  470. z-index: 2;
  471. align-items: center;
  472. top: 0;
  473. right: 16px;
  474. font-size: @fontsize-l;
  475. color: fade(@white, 80);
  476. cursor: pointer;
  477. border: 1px solid transparent;
  478. padding: 6px 16px;
  479. .svg-icon {
  480. margin-right: 0.7407vh;
  481. svg {
  482. transform: rotate(90deg);
  483. use {
  484. transition: all 0.3s;
  485. }
  486. }
  487. }
  488. transition: all 0.3s;
  489. &:hover {
  490. color: @green;
  491. border: 1px solid @green;
  492. .svg-icon {
  493. svg {
  494. use {
  495. fill: @green;
  496. }
  497. }
  498. }
  499. }
  500. }
  501. .compass {
  502. position: absolute;
  503. right: 16px;
  504. bottom: 32px;
  505. border-radius: 50%;
  506. &::after {
  507. content: "";
  508. position: absolute;
  509. top: 4px;
  510. left: 4px;
  511. border-radius: 50%;
  512. width: 36px;
  513. height: 36px;
  514. box-shadow: inset 0px -5px 10px 0px @green;
  515. }
  516. svg {
  517. height: 45px;
  518. width: 45px;
  519. }
  520. }
  521. .map-img {
  522. // width: calc(100% - 14.815vh);
  523. width: 100%;
  524. // height: calc(100% - 14.815vh);
  525. height: 100%;
  526. // margin: 7.407vh 0;
  527. position: absolute;
  528. z-index: 1;
  529. top: 0;
  530. left: 0;
  531. @keyframes rotate {
  532. from {
  533. transform: rotateX(70deg);
  534. }
  535. to {
  536. transform: rotateX(0deg);
  537. }
  538. }
  539. img {
  540. width: 100%;
  541. animation: rotate 3s;
  542. animation-direction: alternate;
  543. animation-iteration-count: infinite;
  544. }
  545. }
  546. }
  547. </style>