map.vue 13 KB

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