Agc.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="agc">
  3. <el-scrollbar>
  4. <div class="panel-groups">
  5. <AgcPanel class="panel-item" v-for="(data, index) of datas" :key="index" :data="data"></AgcPanel>
  6. </div>
  7. </el-scrollbar>
  8. </div>
  9. </template>
  10. <script>
  11. import AgcPanel from "./components/agc-panel.vue";
  12. import store from "@store/index.js";
  13. export default {
  14. // 名称
  15. name: "Agc",
  16. // 使用组件
  17. components: {
  18. AgcPanel,
  19. },
  20. // 数据
  21. data() {
  22. return {
  23. timmer: null, // 计时器
  24. datas: [
  25. {
  26. title: "某某风电场",
  27. subTitle: "(调度名称)",
  28. icon: "fa fa-gears",
  29. color: "green",
  30. },
  31. ],
  32. btnGroups: [
  33. {
  34. icon: "fa fa-fire",
  35. btns: [
  36. {
  37. text: "某某风电场",
  38. code: "mmfdc1",
  39. },
  40. {
  41. text: "麻黄山风场",
  42. code: "mhsfc",
  43. },
  44. {
  45. text: "某某风电场",
  46. code: "mmfdc2",
  47. },
  48. {
  49. text: "某某风电场",
  50. code: "mmfdc3",
  51. },
  52. {
  53. text: "某某风电场",
  54. code: "mmfdc4",
  55. },
  56. ],
  57. },
  58. {
  59. icon: "fa fa-fire-extinguisher",
  60. btns: [
  61. {
  62. text: "某某光伏",
  63. code: "mmgf1",
  64. },
  65. {
  66. text: "某某光伏",
  67. code: "mmgf2",
  68. },
  69. {
  70. text: "某某光伏",
  71. code: "mmgf3",
  72. },
  73. {
  74. text: "某某光伏",
  75. code: "mmgf4",
  76. },
  77. ],
  78. },
  79. ],
  80. };
  81. },
  82. // 函数
  83. methods: {
  84. select: function(item) {
  85. // console.log(item);
  86. },
  87. // 请求服务
  88. requestData(showLoading) {
  89. console.log(111111)
  90. let that = this;
  91. that.API.requestData({
  92. showLoading,
  93. method: "POST",
  94. subUrl: "genreset/getAgcValues",
  95. timeout: 600000,
  96. success(res) {
  97. let datas = [];
  98. if (res.data) {
  99. res.data.forEach((pEle) => {
  100. pEle.jcxx.icon = "fa fa-gears";
  101. pEle.jcxx.color = pEle.jcxx.zt === 0 ? "red" : "green";
  102. let keys = ["llgl", "sjgl", "xdzl", "ycgl"];
  103. let tb = [
  104. {
  105. title: "理论功率",
  106. yAxisIndex: 0,
  107. value: [],
  108. },
  109. {
  110. title: "实际功率",
  111. yAxisIndex: 0,
  112. value: [],
  113. },
  114. {
  115. title: "限电指令",
  116. yAxisIndex: 0,
  117. value: [],
  118. },
  119. {
  120. title: "预测功率",
  121. yAxisIndex: 0,
  122. value: [],
  123. },
  124. ];
  125. keys.forEach((key, keyIndex) => {
  126. pEle.tb.forEach((cEle, cIndex) => {
  127. // debugger;
  128. tb[keyIndex].value.push({ text: new Date(cEle.time).formatDate("hh:mm"), value: cEle[keys[keyIndex]] || 0 });
  129. });
  130. });
  131. pEle.tb = tb;
  132. datas.push(pEle);
  133. });
  134. that.datas = datas;
  135. console.log(2222222,datas)
  136. } else {
  137. that.datas = datas;
  138. }
  139. },
  140. });
  141. },
  142. },
  143. created() {
  144. let that = this;
  145. that.$nextTick(() => {
  146. that.requestData(false);
  147. that.timmer = setInterval(() => {
  148. that.requestData(false);
  149. }, 60000);
  150. });
  151. },
  152. mounted() {
  153. // 渲染后
  154. for (let i = 1; i < 12; i++) {
  155. this.datas.push(JSON.parse(JSON.stringify(this.datas[0])));
  156. if (i % 2 == 0) {
  157. this.datas[i].color = "red";
  158. }
  159. }
  160. },
  161. unmounted() {
  162. clearInterval(this.timmer);
  163. this.timmer = null;
  164. },
  165. };
  166. </script>
  167. <style lang="less" scoped>
  168. .agc {
  169. height: calc(100vh - 7.222vh);
  170. overflow: hidden;
  171. .btn-group-tabs {
  172. display: flex;
  173. flex-direction: row;
  174. .photovoltaic {
  175. margin-left: 1.481vh;
  176. }
  177. }
  178. .panel-groups {
  179. display: flex;
  180. flex-direction: row;
  181. width: 100%;
  182. flex-wrap: wrap;
  183. .panel-item {
  184. width: calc(25% - 12px);
  185. height: 29vh;
  186. margin-left: 16px;
  187. margin-bottom: 16px;
  188. &:nth-child(4n + 1) {
  189. margin-left: 0;
  190. }
  191. }
  192. }
  193. }
  194. </style>