map.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  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. <CLFDC v-if="mapName === 'CL_FDC'" :data="sourceMap" @clickFj="clickFj" @changePeriod="changePeriod" ></CLFDC>
  124. <!-- 康宝风电场 -->
  125. <KBFDC v-if="mapName === 'KB_FDC'" :data="sourceMap" @clickFj="clickFj" @changePeriod="changePeriod" ></KBFDC>
  126. <!-- 代县风电场 -->
  127. <DXFDC v-if="mapName === 'DX_FDC'" :data="sourceMap" @clickFj="clickFj" @changePeriod="changePeriod" ></DXFDC>
  128. <!-- 寿阳风电场 -->
  129. <SYFDC v-if="mapName === 'SY_FDC'" :data="sourceMap" @clickFj="clickFj" @changePeriod="changePeriod" ></SYFDC>
  130. </div>
  131. </div>
  132. </template>
  133. <script>
  134. // 宁夏地图总览
  135. import SvgMapNX from "./map/svg-map-nx.vue";
  136. // 崇礼风电场
  137. import CLFDC from "./map/CL_FDC.vue";
  138. // 康宝风电场
  139. import KBFDC from "./map/KB_FDC.vue";
  140. // 代县风电场
  141. import DXFDC from "./map/DX_FDC.vue";
  142. // 寿阳风电场
  143. import SYFDC from "./map/SY_FDC.vue";
  144. import SvgIcon from "../../../components/coms/icon/svg-icon.vue";
  145. import compassIcon from "@/assets/icon/svg_fill/compass.svg";
  146. export default {
  147. // 名称
  148. name: "Map",
  149. // 使用组件
  150. components: {
  151. SvgMapNX,
  152. CLFDC,
  153. KBFDC,
  154. DXFDC,
  155. SYFDC,
  156. SvgIcon,
  157. },
  158. props: {
  159. wpId: {
  160. type: String,
  161. default: "0",
  162. },
  163. day: {
  164. type: String,
  165. default: "---",
  166. },
  167. data: {
  168. type: Object,
  169. default: () => {},
  170. },
  171. xtData: {
  172. type: Object,
  173. default: () => {},
  174. },
  175. },
  176. mounted() {
  177. this.fcId = this.wpId;
  178. // console.log('安全天数',this.day);
  179. this.safeDay = this.day;
  180. this.sourceMap = this.data;
  181. this.xtMap = this.xtData;
  182. },
  183. // 数据
  184. data() {
  185. return {
  186. textType:'期次',
  187. fcId: "",
  188. safeDay: "",
  189. showType: "all",
  190. sourceMap: {},
  191. mapIndex: -1,
  192. tabs: [
  193. {
  194. icon: "svg-all",
  195. text: "全部",
  196. show: "all",
  197. },
  198. {
  199. icon: "svg-wind-site",
  200. text: "风场",
  201. show: "fc",
  202. },
  203. {
  204. icon: "svg-photovoltaic",
  205. text: "电站",
  206. show: "gf",
  207. },
  208. ],
  209. compassIcon: compassIcon,
  210. activeTab: 0,
  211. img: require("@assets/map/map-nx.png"),
  212. nxSvgFile: require("@assets/map/map-nx.svg"),
  213. nxmap: true,
  214. mapName: "nx",
  215. currentMode: "NX",
  216. currentTitle: "青山风电场",
  217. currentName: "麻黄山",
  218. currentPeriod: "一期",
  219. };
  220. },
  221. emits: {
  222. onEnter: null,
  223. onBack: null,
  224. },
  225. // 函数
  226. methods: {
  227. selectTab(index, showType) {
  228. this.activeTab = index;
  229. this.showType = showType;
  230. let wpId = showType === "all" ? "0" : showType === "fc" ? "-1" : "-2";
  231. this.safeDay = "---";
  232. this.mapName = "nx";
  233. this.$emit("mapClicks", wpId, this.tabs[index].text);
  234. },
  235. backMap(wpId, planBtnName) {
  236. this.currentMode = "NX";
  237. this.mapName = "nx";
  238. this.mapIndex = -1;
  239. this.$emit("mapClickBack", wpId, planBtnName);
  240. },
  241. clickLabel(wpId, planBtnName) {
  242. this.mapName = wpId;
  243. this.currentTitle = planBtnName;
  244. this.mapIndex = 1;
  245. this.$emit("mapClick", wpId, planBtnName);
  246. },
  247. clickFj(wpId, planBtnName,textType) {
  248. this.$emit("mapClick", wpId, planBtnName);
  249. },
  250. changePeriod: function (name, period,textType) {
  251. if(textType){
  252. this.textType = '期次'
  253. }else{
  254. this.textType = '线路'
  255. }
  256. this.currentName = name;
  257. this.currentPeriod = period;
  258. this.currentMode = "SUB";
  259. },
  260. // 返回当前场站
  261. onBackStation(){
  262. this.currentPeriod = "ZERO"
  263. this.$emit("backStation");
  264. }
  265. },
  266. watch: {
  267. wpId(res) {
  268. this.fcId = res;
  269. },
  270. day(res) {
  271. this.safeDay = res;
  272. },
  273. data(res) {
  274. this.sourceMap = res;
  275. },
  276. xtData(res) {
  277. this.xtMap = res;
  278. },
  279. },
  280. };
  281. </script>
  282. <style lang="less">
  283. .map {
  284. position: relative;
  285. width: 100%;
  286. height: 100%;
  287. .back {
  288. position: fixed;
  289. z-index: -1;
  290. width: 100vw;
  291. height: 100vh;
  292. top: 0;
  293. left: 0;
  294. background: url(../../../assets/background-home.png) no-repeat;
  295. background-size: 100% 100%;
  296. }
  297. .security-days {
  298. margin: 1.852vh;
  299. .text {
  300. font-size: 2.222vh;
  301. color: @write;
  302. }
  303. .num {
  304. color: @green;
  305. font-size: 3.704vh;
  306. .unit {
  307. font-size: 2.222vh;
  308. position: relative;
  309. margin-left: 0.556vh;
  310. top: -0.185vh;
  311. }
  312. }
  313. }
  314. .name-box {
  315. margin: 1.852vh;
  316. display: inline-block;
  317. z-index: 2;
  318. position: relative;
  319. .name-box-title {
  320. font-size: 2.222vh;
  321. font-weight: 400;
  322. color: #ffffff;
  323. line-height: 1;
  324. cursor: pointer;
  325. }
  326. .name-box-period {
  327. margin-top: 2.222vh;
  328. .name-box-period-label,
  329. .name-box-period-value {
  330. font-size: 1.481vh;
  331. font-weight: 400;
  332. line-height: 1;
  333. }
  334. .name-box-period-label {
  335. color: #fefefe;
  336. }
  337. .name-box-period-value {
  338. color: #05bb4c;
  339. }
  340. }
  341. }
  342. .tab-box {
  343. margin: 1.852vh 2.778vh;
  344. display: inline-block;
  345. z-index: 2;
  346. position: relative;
  347. .tab-item {
  348. display: flex;
  349. align-items: center;
  350. justify-content: center;
  351. font-size: @fontsize;
  352. cursor: pointer;
  353. width: 6.481vh;
  354. padding: 0.3704vh 0;
  355. margin-bottom: 1.4815vh;
  356. &.active {
  357. color: @green;
  358. position: relative;
  359. background-image: @greenLinearTop;
  360. &::after {
  361. content: "";
  362. position: absolute;
  363. width: 100%;
  364. height: 0.463vh;
  365. border: 0.093vh solid @green;
  366. border-top: 0;
  367. left: 0;
  368. bottom: 0;
  369. box-sizing: border-box;
  370. }
  371. }
  372. .svg-icon {
  373. margin-right: 12px;
  374. margin-top: 2px;
  375. }
  376. }
  377. }
  378. .return {
  379. position: absolute;
  380. display: flex;
  381. z-index: 2;
  382. align-items: center;
  383. top: 0;
  384. right: 16px;
  385. font-size: @fontsize-l;
  386. color: fade(@white, 80);
  387. cursor: pointer;
  388. border: 1px solid transparent;
  389. padding: 6px 16px;
  390. .svg-icon {
  391. margin-right: 0.7407vh;
  392. svg {
  393. transform: rotate(90deg);
  394. use {
  395. transition: all 0.3s;
  396. }
  397. }
  398. }
  399. transition: all 0.3s;
  400. &:hover {
  401. color: @green;
  402. border: 1px solid @green;
  403. .svg-icon {
  404. svg {
  405. use {
  406. fill: @green;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. .compass {
  413. position: absolute;
  414. right: 16px;
  415. bottom: 32px;
  416. border-radius: 50%;
  417. &::after {
  418. content: "";
  419. position: absolute;
  420. top: 4px;
  421. left: 4px;
  422. border-radius: 50%;
  423. width: 36px;
  424. height: 36px;
  425. box-shadow: inset 0px -5px 10px 0px @green;
  426. }
  427. svg {
  428. height: 45px;
  429. width: 45px;
  430. }
  431. }
  432. .map-img {
  433. // width: calc(100% - 14.815vh);
  434. width: 100%;
  435. // height: calc(100% - 14.815vh);
  436. height: 100%;
  437. // margin: 7.407vh 0;
  438. position: absolute;
  439. z-index: 1;
  440. top: 0;
  441. left: 0;
  442. @keyframes rotate {
  443. from {
  444. transform: rotateX(70deg);
  445. }
  446. to {
  447. transform: rotateX(0deg);
  448. }
  449. }
  450. img {
  451. width: 100%;
  452. animation: rotate 3s;
  453. animation-direction: alternate;
  454. animation-iteration-count: infinite;
  455. }
  456. }
  457. }
  458. </style>