map.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div class="map">
  3. <div class="back"></div>
  4. <div class="security-days" v-if="fcId === '0'">
  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">
  12. <div class="tab-item" v-for="(tab, index) of tabs" :key="index" :class="{ active: activeTab == index }" @click.stop="selectTab(index, tab.show)">
  13. <span class="svg-icon svg-icon-sm" :class="activeTab == index ? 'svg-icon-green' : 'svg-icon-write'">
  14. <SvgIcon :svgid="tab.icon"></SvgIcon>
  15. </span>
  16. <span>{{ tab.text }}</span>
  17. </div>
  18. </div>
  19. <div class="return" @click="backMap" v-show="!nxmap">
  20. <span class="svg-icon svg-icon-sm">
  21. <svg-icon :svgid="'svg-arrow-dpwn-1'" />
  22. </span>
  23. 返回
  24. </div>
  25. <!-- 指南针 -->
  26. <div class="compass">
  27. <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
  28. <g id="渐变">
  29. <path
  30. fill-rule="evenodd"
  31. clip-rule="evenodd"
  32. fill="#000"
  33. opacity="0"
  34. d="M100.523,18.655c44.661,0,80.865,36.205,80.865,80.866
  35. 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"
  36. />
  37. </g>
  38. <g id="图层_2">
  39. <g>
  40. <g>
  41. <path
  42. fill-rule="evenodd"
  43. clip-rule="evenodd"
  44. fill="#606769"
  45. opacity="0.75"
  46. 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"
  47. />
  48. </g>
  49. </g>
  50. </g>
  51. <g id="图层_3">
  52. <g>
  53. <g>
  54. <path
  55. fill-rule="evenodd"
  56. clip-rule="evenodd"
  57. fill="#05BB4C"
  58. 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"
  59. />
  60. </g>
  61. </g>
  62. </g>
  63. <g id="图层_4">
  64. <g>
  65. <g>
  66. <path
  67. fill-rule="evenodd"
  68. clip-rule="evenodd"
  69. fill="#05BB4C"
  70. opacity="0.2"
  71. 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"
  72. />
  73. </g>
  74. </g>
  75. </g>
  76. <g id="图层_1">
  77. <polyline fill="#606769" points="59.177,142.682 113.678,116.092 84.673,87.663" />
  78. </g>
  79. <g id="图层_7">
  80. <polygon fill="#BD3338" points="139.496,60.156 114.004,115.172 85.004,86.745" />
  81. </g>
  82. </svg>
  83. </div>
  84. <div class="map-img">
  85. <SvgMap v-if="!nxmap"></SvgMap>
  86. <SvgMapNX v-if="nxmap" :show="showType" :data="sourceMap" @clickLabel="clickLabel"></SvgMapNX>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import SvgMap from "./map/svg-map.vue";
  92. import SvgMapNX from "./map/svg-map-nx.vue";
  93. import SvgIcon from "../../../components/coms/icon/svg-icon.vue";
  94. import compassIcon from "@/assets/icon/svg_fill/compass.svg";
  95. export default {
  96. // 名称
  97. name: "Map",
  98. // 使用组件
  99. components: {
  100. SvgMap,
  101. SvgMapNX,
  102. SvgIcon,
  103. },
  104. props:{
  105. wpId:{
  106. type:String,
  107. default:"0"
  108. },
  109. day:{
  110. type:String,
  111. default:"---"
  112. },
  113. data:{
  114. type:Object,
  115. default:() => {}
  116. }
  117. },
  118. mounted(){
  119. this.fcId = this.wpId;
  120. this.safeDay = this.day;
  121. this.sourceMap = this.data;
  122. },
  123. // 数据
  124. data() {
  125. return {
  126. fcId:"",
  127. safeDay:"",
  128. showType: "all",
  129. sourceMap:{},
  130. tabs: [
  131. {
  132. icon: "svg-all",
  133. text: "全部",
  134. show: "all"
  135. },
  136. {
  137. icon: "svg-wind-site",
  138. text: "风场",
  139. show: "fc"
  140. },
  141. {
  142. icon: "svg-photovoltaic",
  143. text: "电站",
  144. show: "gf"
  145. },
  146. ],
  147. compassIcon: compassIcon,
  148. activeTab: 0,
  149. img: require("@assets/map/map-nx.png"),
  150. nxSvgFile: require("@assets/map/map-nx.svg"),
  151. nxmap: true,
  152. };
  153. },
  154. // 函数
  155. methods: {
  156. selectTab(index, showType) {
  157. this.activeTab = index;
  158. this.showType = showType;
  159. let wpId = (showType === "all" ? "0" : showType === "fc" ? "-1" : "-2");
  160. this.safeDay = "---";
  161. this.$emit("mapClick", wpId);
  162. },
  163. backMap: function() {
  164. this.nxmap = true;
  165. },
  166. clickLabel: function() {
  167. this.nxmap = false;
  168. },
  169. },
  170. watch:{
  171. wpId(res){
  172. this.fcId = res;
  173. },
  174. day(res){
  175. this.safeDay = res;
  176. },
  177. data(res){
  178. this.sourceMap = res;
  179. }
  180. }
  181. };
  182. </script>
  183. <style lang="less" scoped>
  184. .map {
  185. position: relative;
  186. width: 100%;
  187. height: 100%;
  188. .back {
  189. position: fixed;
  190. z-index: -1;
  191. width: 100vw;
  192. height: 100vh;
  193. top: 0;
  194. left: 0;
  195. background: url(../../../assets/background-home.png) no-repeat;
  196. background-size: 100% 100%;
  197. }
  198. .security-days {
  199. margin: 1.852vh;
  200. .text {
  201. font-size: 2.222vh;
  202. color: @write;
  203. }
  204. .num {
  205. color: @green;
  206. font-size: 3.704vh;
  207. .unit {
  208. font-size: 2.222vh;
  209. position: relative;
  210. margin-left: 0.556vh;
  211. top: -0.185vh;
  212. }
  213. }
  214. }
  215. .tab-box {
  216. margin: 1.852vh 2.778vh;
  217. .tab-item {
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. font-size: @fontsize-l;
  222. cursor: pointer;
  223. width: 6.481vh;
  224. padding: 0.741vh 0;
  225. &.active {
  226. color: @green;
  227. position: relative;
  228. background-image: @greenLinearTop;
  229. &::after {
  230. content: "";
  231. position: absolute;
  232. width: 100%;
  233. height: 0.463vh;
  234. border: 0.093vh solid @green;
  235. border-top: 0;
  236. left: 0;
  237. bottom: 0;
  238. box-sizing: border-box;
  239. }
  240. }
  241. .svg-icon {
  242. margin-right: 0.556vh;
  243. }
  244. }
  245. }
  246. .return {
  247. position: absolute;
  248. display: flex;
  249. align-items: center;
  250. top: 0;
  251. right: 16px;
  252. font-size: @fontsize-l;
  253. color: fade(@white, 80);
  254. cursor: pointer;
  255. .svg-icon {
  256. margin-right: 0.7407vh;
  257. svg {
  258. transform: rotate(90deg);
  259. }
  260. }
  261. }
  262. .compass {
  263. position: absolute;
  264. right: 16px;
  265. bottom: 32px;
  266. border-radius: 50%;
  267. &::after {
  268. content: "";
  269. position: absolute;
  270. top: 4px;
  271. left: 4px;
  272. border-radius: 50%;
  273. width: 36px;
  274. height: 36px;
  275. box-shadow: inset 0px -5px 10px 0px @green;
  276. }
  277. svg {
  278. height: 45px;
  279. width: 45px;
  280. }
  281. }
  282. .map-img {
  283. width: calc(100% - 14.815vh);
  284. height: calc(100% - 14.815vh);
  285. margin: 7.407vh;
  286. position: absolute;
  287. z-index: 1;
  288. top: 0;
  289. left: 0;
  290. @keyframes rotate {
  291. from {
  292. transform: rotateX(70deg);
  293. }
  294. to {
  295. transform: rotateX(0deg);
  296. }
  297. }
  298. img {
  299. width: 100%;
  300. animation: rotate 3s;
  301. animation-direction: alternate;
  302. animation-iteration-count: infinite;
  303. }
  304. }
  305. }
  306. </style>