Map2.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div>
  3. <div class="btn-group-tabs">
  4. <BtnGroup2 :gsGroups="gsGroups" :selectValue="gsselectValue" :btnGroups="btnGroups" :rowIndex="rowIndex"
  5. :index="selectIndex" @select="select" @selectChange="selectChange" :wpId="wpId"></BtnGroup2>
  6. </div>
  7. <div class="period">
  8. 期次:
  9. <div class="period-item" :class="{ active: periodIndex == val.id }"
  10. v-for="(val, index) in btnGroups[rowIndex]?.btns[selectIndex]?.pjls" :key="index"
  11. @click="handleChange(val)">{{ val.name }}</div>
  12. </div>
  13. <!-- 羊头崖 -->
  14. <ytyMap v-if="periodIndex === 'YTY01_GC'" ref="maps"></ytyMap>
  15. <!-- 败虎堡三期 -->
  16. <bhb3Map v-if="periodIndex === 'BHB301_GC'" ref="maps"></bhb3Map>
  17. <!-- 高家堰 -->
  18. <gjyMap v-if="periodIndex === 'GJY01_GC'" ref="maps"></gjyMap>
  19. <gjyMap2 v-if="periodIndex === 'GJY02_GC'" ref="maps"></gjyMap2>
  20. <!-- 红石峁 -->
  21. <hsmMap v-if="periodIndex === 'HSM01_GC'" ref="maps"></hsmMap>
  22. <!-- 尹灵芝 -->
  23. <ylzMap v-if="periodIndex === 'YLZ01_GC'" ref="maps"></ylzMap>
  24. <!-- 丁家窑 -->
  25. <djyMap v-if="periodIndex === 'DJY01_GC'" ref="maps"></djyMap>
  26. <djyMap2 v-if="periodIndex === 'DJY02_GC'" ref="maps"></djyMap2>
  27. <!-- 牛家岭 -->
  28. <njlMap v-if="periodIndex === 'NJL01_GC'" ref="maps"></njlMap>
  29. <njlMap2 v-if="periodIndex === 'NJL02_GC'" ref="maps"></njlMap2>
  30. <!-- 盘道梁 -->
  31. <pdlMap v-if="periodIndex === 'PDL01_GC'" ref="maps"></pdlMap>
  32. <!-- 小五台 -->
  33. <xwtMap v-if="periodIndex === 'XWT01_GC'" ref="maps"></xwtMap>
  34. <!-- 败虎堡 一期 -->
  35. <bhbMap v-if="periodIndex === 'BHB01_GC'" ref="maps"></bhbMap>
  36. <!-- 平头镇 -->
  37. <ptzMap v-if="periodIndex === 'PTZ01_GC'" ref="maps"></ptzMap>
  38. <ptzMap2 v-if="periodIndex === 'PTZ02_GC'" ref="maps"></ptzMap2>
  39. <!-- 禹风 败虎堡 -->
  40. <bhbMap2 v-if="periodIndex === 'YF01_GC'" ref="maps"></bhbMap2>
  41. <yfMap2 v-if="periodIndex === 'YF02_GC'" ref="maps"></yfMap2>
  42. <!-- 平鲁大河堡 -->
  43. <pldhbMap v-if="periodIndex === 'GJY03_GC'" ref="maps"></pldhbMap>
  44. <!-- 朱坑一期 -->
  45. <zkyqMap v-if="periodIndex === 'ZK01_GC'" ref="maps"></zkyqMap>
  46. <!-- 米梁局 -->
  47. <mljMap v-if="periodIndex === 'MLJ01_GC'" ref="maps"></mljMap>
  48. <<<<<<< HEAD
  49. =======
  50. <syMap2 v-if="periodIndex === 'SY02_GC'" ref="maps"></syMap2>
  51. <syMap v-if="periodIndex === 'SY01_GC'" ref="maps"></syMap>
  52. >>>>>>> 175216f620cb5801bd29aca761ee667bf6d46820
  53. </div>
  54. </template>
  55. <script>
  56. import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
  57. import api from "@api/cockpit/matrix/index.js";
  58. import gjyMap from "./components/gjy-map.vue";
  59. import gjyMap2 from "./components/gjy-map2.vue";
  60. import hsmMap from "./components/hsm-map.vue";
  61. import ylzMap from "./components/ylz-map.vue";
  62. import ytyMap from "./components/yty-map.vue";
  63. import bhb3Map from "./components/bhb3-map.vue";
  64. import djyMap from "./components/djy-map.vue";
  65. import djyMap2 from "./components/djy-map2.vue";
  66. import njlMap from "./components/njl-map.vue";
  67. import njlMap2 from "./components/njl-map2.vue";
  68. import pdlMap from "./components/pdl-map.vue";
  69. import ptzMap from "./components/ptz-map.vue";
  70. import ptzMap2 from "./components/ptz2-map.vue";
  71. import xwtMap from "./components/xwt-map.vue";
  72. import yfMap2 from "./components/yf2-map.vue";
  73. import bhbMap2 from "./components/bhb2-map.vue";
  74. import bhbMap from "./components/bhb-map.vue";
  75. import pldhbMap from "./components/pldhb-map.vue";
  76. import zkyqMap from "./components/zkyq-map.vue";
  77. import mljMap from "./components/mlj-map.vue";
  78. <<<<<<< HEAD
  79. =======
  80. import syMap2 from "./components/sy2-map.vue";
  81. import syMap from "./components/sy-map.vue";
  82. >>>>>>> 175216f620cb5801bd29aca761ee667bf6d46820
  83. export default {
  84. components: {
  85. mljMap,
  86. zkyqMap,
  87. pldhbMap,
  88. BtnGroup2,
  89. gjyMap,
  90. gjyMap2,
  91. hsmMap,
  92. ylzMap,
  93. ytyMap,
  94. bhb3Map,
  95. djyMap,
  96. djyMap2,
  97. njlMap,
  98. njlMap2,
  99. pdlMap,
  100. ptzMap,
  101. ptzMap2,
  102. xwtMap,
  103. yfMap2,
  104. bhbMap,
  105. <<<<<<< HEAD
  106. bhbMap2
  107. =======
  108. bhbMap2,
  109. syMap2,
  110. syMap
  111. >>>>>>> 175216f620cb5801bd29aca761ee667bf6d46820
  112. },
  113. data() {
  114. return {
  115. // 定时器
  116. timer: "",
  117. gsGroups: [],
  118. gsselectValue: '',
  119. selectIndex: 0,
  120. rowIndex: 0,
  121. periodIndex: '',
  122. windturbineList: [],
  123. btnGroups: [
  124. {
  125. icon: "svg-wind-site",
  126. btns: [],
  127. },
  128. {
  129. icon: "svg-photovoltaic",
  130. btns: [],
  131. },
  132. ],
  133. }
  134. },
  135. created() {
  136. this.wpId = this.$route.params.wpId;
  137. this.$nextTick(() => {
  138. this.getGS();
  139. this.timer = setInterval(() => {
  140. this.getWinds()
  141. }, 3000);
  142. });
  143. },
  144. methods: {
  145. getGS() {
  146. api.companysAjax().then(res => {
  147. if (res.data) {
  148. this.gsselectValue = res.data[0].id
  149. this.gsGroups = res.data
  150. this.getWp()
  151. }
  152. })
  153. },
  154. selectChange(val) {
  155. this.gsselectValue = val
  156. this.getWp()
  157. },
  158. getWp() {
  159. api.windfarmByCmAjax({
  160. cmId: this.gsselectValue
  161. }).then((res) => {
  162. let btnGroups = [
  163. {
  164. icon: "svg-wind-site",
  165. btns: [],
  166. },
  167. {
  168. icon: "svg-photovoltaic",
  169. btns: [],
  170. },
  171. ];
  172. res.data.forEach((ele, index) => {
  173. if (ele.id.indexOf("FDC") !== -1) {
  174. btnGroups[0].btns.push({
  175. text: ele.name,
  176. code: ele.id,
  177. pjls: ele.pjls
  178. });
  179. } else {
  180. btnGroups[1].btns.push({
  181. text: ele.name,
  182. code: ele.id,
  183. pjls: ele.pjls
  184. });
  185. }
  186. });
  187. this.btnGroups = btnGroups;
  188. this.renderBtnActiveIndex();
  189. });
  190. },
  191. getWinds() {
  192. api.windturbineByPjIdAjax({
  193. pjId: this.periodIndex
  194. }).then(res => {
  195. if (res.data.length > 0 && this.$refs.maps) {
  196. this.$refs.maps.dayaDeal(res.data)
  197. }
  198. })
  199. },
  200. renderBtnActiveIndex() {
  201. this.btnGroups.forEach((pEle, pIndex) => {
  202. pEle.btns.forEach((cEle, cIndex) => {
  203. if (cEle.code === this.wpId) {
  204. this.rowIndex = pIndex;
  205. this.selectIndex = cIndex;
  206. }
  207. });
  208. });
  209. this.periodIndex = this.btnGroups[this.rowIndex]?.btns[this.selectIndex]?.pjls[0].id
  210. this.getWinds()
  211. },
  212. handleChange(val) {
  213. this.periodIndex = val.id
  214. this.getWinds()
  215. },
  216. select(res) {
  217. this.$router.replace({
  218. path: `/monitor/windsite/map2/${res.code}`,
  219. });
  220. },
  221. },
  222. unmounted() {
  223. clearInterval(this.timer);
  224. this.timer = null;
  225. },
  226. watch: {
  227. $route(res) {
  228. this.wpId = res.params.wpId;
  229. if (res.params.wpId) {
  230. this.getWp();
  231. }
  232. this.renderBtnActiveIndex();
  233. },
  234. },
  235. }
  236. </script>
  237. <style lang="less" scoped>
  238. .period {
  239. display: flex;
  240. flex-direction: row;
  241. .period-item {
  242. line-height: 23px;
  243. font-size: 12px;
  244. text-align: center;
  245. margin-right: 4px;
  246. border: 1px solid #606769;
  247. border-radius: 2px;
  248. padding: 0px 5px;
  249. margin-bottom: 10px;
  250. &.active {
  251. color: #ffffff;
  252. background-color: rgba(75, 85, 174, 0.6);
  253. border-color: rgba(75, 85, 174, 0.6);
  254. }
  255. }
  256. }
  257. </style>