BoosterStation.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="booster-station">
  3. <div class="btn-group-tabs">
  4. <BtnGroup2
  5. :btnGroups="btnGroups"
  6. :rowIndex="rowIndex"
  7. :index="selectIndex"
  8. @select="select"
  9. ></BtnGroup2>
  10. </div>
  11. <!-- 麻黄山 -->
  12. <MHS class="booster-station-body" v-if="wpId === 'MHS_FDC'" />
  13. <!-- 牛首山 -->
  14. <NSS class="booster-station-body" v-if="wpId === 'NSS_FDC'" />
  15. <!-- 青山 -->
  16. <QS class="booster-station-body" v-if="wpId === 'QS_FDC'" />
  17. <!-- 石板泉 -->
  18. <SBQ class="booster-station-body" v-if="wpId === 'SBQ_FDC'" />
  19. <!-- 香山 -->
  20. <XS class="booster-station-body" v-if="wpId === 'XS_FDC'" />
  21. <!-- 宋堡第六 -->
  22. <SBDL class="booster-station-body" v-if="wpId === 'QS3_FDC'" />
  23. <!-- 大武口 -->
  24. <DWK class="booster-station-body" v-if="wpId === 'DWK_GDC'" />
  25. <!-- 平罗一期 -->
  26. <PL1 class="booster-station-body" v-if="wpId === 'PL_GDC'" />
  27. <!-- 平罗二期 -->
  28. <PL2 class="booster-station-body" v-if="wpId === 'PL2_GDC'" />
  29. <!-- 宣和 -->
  30. <XH class="booster-station-body" v-if="wpId === 'XH_GDC'" />
  31. <!-- 马场湖 -->
  32. <MCH class="booster-station-body" v-if="wpId === 'MCH_GDC'" />
  33. <!-- 海子井 -->
  34. <HZJ class="booster-station-body" v-if="wpId === 'HZJ_GDC'" />
  35. </div>
  36. </template>
  37. <script>
  38. import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
  39. import MHS from "../components/boosterstation/mhs.vue";
  40. import NSS from "../components/boosterstation/nss.vue";
  41. import QS from "../components/boosterstation/qs.vue";
  42. import SBQ from "../components/boosterstation/sbq.vue";
  43. import SBDL from "../components/boosterstation/sbdl.vue";
  44. import XS from "../components/boosterstation/xs.vue";
  45. import DWK from "../components/boosterstation/dwk.vue";
  46. import PL1 from "../components/boosterstation/pl1.vue";
  47. import PL2 from "../components/boosterstation/pl2.vue";
  48. import XH from "../components/boosterstation/xh.vue";
  49. import MCH from "../components/boosterstation/mch.vue";
  50. import HZJ from "../components/boosterstation/hzj.vue";
  51. export default {
  52. // 名称
  53. name: "BoosterStation",
  54. // 使用组件
  55. components: {
  56. BtnGroup2,
  57. MHS,
  58. NSS,
  59. QS,
  60. SBQ,
  61. SBDL,
  62. XS,
  63. DWK,
  64. PL1,
  65. PL2,
  66. XH,
  67. MCH,
  68. HZJ
  69. },
  70. // 数据
  71. data() {
  72. return {
  73. wpId: undefined,
  74. selectIndex: 0,
  75. rowIndex: 0,
  76. btnGroups: [
  77. {
  78. icon: "svg-wind-site",
  79. btns: [],
  80. },
  81. {
  82. icon: "svg-photovoltaic",
  83. btns: [],
  84. },
  85. ],
  86. };
  87. },
  88. created() {
  89. let that = this;
  90. that.wpId = that.$route.params.wpId;
  91. that.$nextTick(() => {
  92. that.getWp();
  93. });
  94. },
  95. // 函数
  96. methods: {
  97. select(res) {
  98. this.$router.replace({
  99. path: `/monitor/windsite/boosterstation/${res.code}`,
  100. });
  101. },
  102. getWp() {
  103. let that = this;
  104. that.API.requestData({
  105. method: "GET",
  106. subUrl: "powercompare/windfarmAllAjax",
  107. success(res) {
  108. let btnGroup = [
  109. {
  110. icon: "svg-wind-site",
  111. btns: [],
  112. },
  113. {
  114. icon: "svg-photovoltaic",
  115. btns: [],
  116. },
  117. ];
  118. res.data.forEach((ele, index) => {
  119. if (ele.id.indexOf("FDC") !== -1) {
  120. btnGroup[0].btns.push({
  121. text: ele.name,
  122. code: ele.id,
  123. });
  124. if(ele.id == 'QS_FDC'){
  125. // 当点击为宋六时
  126. btnGroup[0].btns.push({
  127. text: '宋堡第六风电场',
  128. code: 'QS3_FDC',
  129. });
  130. }
  131. } else {
  132. btnGroup[1].btns.push({
  133. text: ele.name,
  134. code: ele.id,
  135. });
  136. if(ele.id == 'PL_GDC'){
  137. btnGroup[1].btns.push({
  138. text: '平罗二期光伏电站',
  139. code: 'PL2_GDC',
  140. });
  141. }
  142. }
  143. });
  144. that.btnGroups = btnGroup;
  145. that.renderBtnActiveIndex();
  146. },
  147. });
  148. },
  149. renderBtnActiveIndex() {
  150. this.btnGroups.forEach((pEle, pIndex) => {
  151. pEle.btns.forEach((cEle, cIndex) => {
  152. if (cEle.code === this.wpId) {
  153. this.rowIndex = pIndex;
  154. this.selectIndex = cIndex;
  155. }
  156. });
  157. });
  158. },
  159. },
  160. // 生命周期钩子
  161. beforeCreate() {
  162. // 创建前
  163. },
  164. beforeMount() {
  165. // 渲染前
  166. },
  167. mounted() {
  168. // 渲染后
  169. },
  170. beforeUpdate() {
  171. // 数据更新前
  172. },
  173. updated() {
  174. // 数据更新后
  175. },
  176. watch: {
  177. $route(res) {
  178. this.wpId = res.params.wpId;
  179. if (res.params.wpId) {
  180. this.renderBtnActiveIndex();
  181. }
  182. },
  183. },
  184. };
  185. </script>
  186. <style lang="less" scoped>
  187. .booster-station {
  188. width: 100%;
  189. height: calc(100vh - 90px);
  190. display: flex;
  191. flex-direction: column;
  192. .btn-group-tabs {
  193. display: flex;
  194. flex-direction: row;
  195. }
  196. .booster-station-body {
  197. flex-grow: 1;
  198. margin-top: 20px;
  199. }
  200. }
  201. </style>