BoosterStation.vue 4.5 KB

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