map.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  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">{{textType}}:</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. textType:'期次',
  211. fcId: "",
  212. safeDay: "",
  213. showType: "all",
  214. sourceMap: {},
  215. mapIndex: -1,
  216. tabs: [
  217. {
  218. icon: "svg-all",
  219. text: "全部",
  220. show: "all",
  221. },
  222. {
  223. icon: "svg-wind-site",
  224. text: "风场",
  225. show: "fc",
  226. },
  227. {
  228. icon: "svg-photovoltaic",
  229. text: "电站",
  230. show: "gf",
  231. },
  232. ],
  233. compassIcon: compassIcon,
  234. activeTab: 0,
  235. img: require("@assets/map/map-nx.png"),
  236. nxSvgFile: require("@assets/map/map-nx.svg"),
  237. nxmap: true,
  238. mapName: "nx",
  239. currentMode: "NX",
  240. currentTitle: "青山风电场",
  241. currentName: "麻黄山",
  242. currentPeriod: "一期",
  243. };
  244. },
  245. emits: {
  246. onEnter: null,
  247. onBack: null,
  248. },
  249. // 函数
  250. methods: {
  251. selectTab(index, showType) {
  252. this.activeTab = index;
  253. this.showType = showType;
  254. let wpId = showType === "all" ? "0" : showType === "fc" ? "-1" : "-2";
  255. this.safeDay = "---";
  256. this.mapName = "nx";
  257. this.$emit("mapClicks", wpId, this.tabs[index].text);
  258. },
  259. backMap(wpId, planBtnName) {
  260. this.currentMode = "NX";
  261. this.mapName = "nx";
  262. this.mapIndex = -1;
  263. this.$emit("mapClickBack");
  264. },
  265. clickLabel(wpId, planBtnName) {
  266. this.mapName = wpId;
  267. this.currentTitle = planBtnName;
  268. this.mapIndex = 1;
  269. this.$emit("mapClick", wpId, planBtnName);
  270. },
  271. clickFj(wpId, planBtnName,textType) {
  272. console.log(textType)
  273. this.$emit("mapClick", wpId, planBtnName);
  274. },
  275. changePeriod: function (name, period,textType) {
  276. console.log(textType)
  277. if(textType){
  278. this.textType = '期次'
  279. }else{
  280. this.textType = '线路'
  281. }
  282. this.currentName = name;
  283. this.currentPeriod = period;
  284. this.currentMode = "SUB";
  285. },
  286. // 返回当前场站
  287. onBackStation(){
  288. this.currentPeriod = "ZERO"
  289. this.$emit("backStation");
  290. }
  291. },
  292. watch: {
  293. wpId(res) {
  294. this.fcId = res;
  295. },
  296. day(res) {
  297. this.safeDay = res;
  298. },
  299. data(res) {
  300. this.sourceMap = res;
  301. },
  302. xtData(res) {
  303. this.xtMap = res;
  304. },
  305. },
  306. };
  307. </script>
  308. <style lang="less">
  309. .map {
  310. position: relative;
  311. width: 100%;
  312. height: 100%;
  313. .back {
  314. position: fixed;
  315. z-index: -1;
  316. width: 100vw;
  317. height: 100vh;
  318. top: 0;
  319. left: 0;
  320. background: url(../../../assets/background-home.png) no-repeat;
  321. background-size: 100% 100%;
  322. }
  323. .security-days {
  324. margin: 1.852vh;
  325. .text {
  326. font-size: 2.222vh;
  327. color: @write;
  328. }
  329. .num {
  330. color: @green;
  331. font-size: 3.704vh;
  332. .unit {
  333. font-size: 2.222vh;
  334. position: relative;
  335. margin-left: 0.556vh;
  336. top: -0.185vh;
  337. }
  338. }
  339. }
  340. .name-box {
  341. margin: 1.852vh;
  342. display: inline-block;
  343. z-index: 2;
  344. position: relative;
  345. .name-box-title {
  346. font-size: 2.222vh;
  347. font-weight: 400;
  348. color: #ffffff;
  349. line-height: 1;
  350. cursor: pointer;
  351. }
  352. .name-box-period {
  353. margin-top: 2.222vh;
  354. .name-box-period-label,
  355. .name-box-period-value {
  356. font-size: 1.481vh;
  357. font-weight: 400;
  358. line-height: 1;
  359. }
  360. .name-box-period-label {
  361. color: #fefefe;
  362. }
  363. .name-box-period-value {
  364. color: #05bb4c;
  365. }
  366. }
  367. }
  368. .tab-box {
  369. margin: 1.852vh 2.778vh;
  370. display: inline-block;
  371. z-index: 2;
  372. position: relative;
  373. .tab-item {
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. font-size: @fontsize;
  378. cursor: pointer;
  379. width: 6.481vh;
  380. padding: 0.3704vh 0;
  381. margin-bottom: 1.4815vh;
  382. &.active {
  383. color: @green;
  384. position: relative;
  385. background-image: @greenLinearTop;
  386. &::after {
  387. content: "";
  388. position: absolute;
  389. width: 100%;
  390. height: 0.463vh;
  391. border: 0.093vh solid @green;
  392. border-top: 0;
  393. left: 0;
  394. bottom: 0;
  395. box-sizing: border-box;
  396. }
  397. }
  398. .svg-icon {
  399. margin-right: 12px;
  400. margin-top: 2px;
  401. }
  402. }
  403. }
  404. .return {
  405. position: absolute;
  406. display: flex;
  407. z-index: 2;
  408. align-items: center;
  409. top: 0;
  410. right: 16px;
  411. font-size: @fontsize-l;
  412. color: fade(@white, 80);
  413. cursor: pointer;
  414. border: 1px solid transparent;
  415. padding: 6px 16px;
  416. .svg-icon {
  417. margin-right: 0.7407vh;
  418. svg {
  419. transform: rotate(90deg);
  420. use {
  421. transition: all 0.3s;
  422. }
  423. }
  424. }
  425. transition: all 0.3s;
  426. &:hover {
  427. color: @green;
  428. border: 1px solid @green;
  429. .svg-icon {
  430. svg {
  431. use {
  432. fill: @green;
  433. }
  434. }
  435. }
  436. }
  437. }
  438. .compass {
  439. position: absolute;
  440. right: 16px;
  441. bottom: 32px;
  442. border-radius: 50%;
  443. &::after {
  444. content: "";
  445. position: absolute;
  446. top: 4px;
  447. left: 4px;
  448. border-radius: 50%;
  449. width: 36px;
  450. height: 36px;
  451. box-shadow: inset 0px -5px 10px 0px @green;
  452. }
  453. svg {
  454. height: 45px;
  455. width: 45px;
  456. }
  457. }
  458. .map-img {
  459. // width: calc(100% - 14.815vh);
  460. width: 100%;
  461. // height: calc(100% - 14.815vh);
  462. height: 100%;
  463. // margin: 7.407vh 0;
  464. position: absolute;
  465. z-index: 1;
  466. top: 0;
  467. left: 0;
  468. @keyframes rotate {
  469. from {
  470. transform: rotateX(70deg);
  471. }
  472. to {
  473. transform: rotateX(0deg);
  474. }
  475. }
  476. img {
  477. width: 100%;
  478. animation: rotate 3s;
  479. animation-direction: alternate;
  480. animation-iteration-count: infinite;
  481. }
  482. }
  483. }
  484. </style>