Agc.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. let that = this;
  90. that.API.requestData({
  91. showLoading,
  92. method: "POST",
  93. subUrl: "genreset/getAgcValues",
  94. // timeout: 600000,
  95. success(res) {
  96. let datas = [];
  97. if (res.data) {
  98. res.data.forEach((pEle) => {
  99. pEle.jcxx.icon = "fa fa-gears";
  100. pEle.jcxx.color = pEle.jcxx.zt === 0 ? "red" : "green";
  101. let keys = ["llgl", "sjgl", "xdzl", "ycgl"];
  102. let tb = [
  103. {
  104. title: "理论功率",
  105. yAxisIndex: 0,
  106. value: [],
  107. },
  108. {
  109. title: "实际功率",
  110. yAxisIndex: 0,
  111. value: [],
  112. },
  113. {
  114. title: "限电指令",
  115. yAxisIndex: 0,
  116. value: [],
  117. },
  118. {
  119. title: "预测功率",
  120. yAxisIndex: 0,
  121. value: [],
  122. },
  123. ];
  124. keys.forEach((key, keyIndex) => {
  125. pEle.tb.forEach((cEle, cIndex) => {
  126. // debugger;
  127. tb[keyIndex].value.push({ text: new Date(cEle.time).formatDate("hh:mm"), value: cEle[keys[keyIndex]] || 0 });
  128. });
  129. });
  130. pEle.tb = tb;
  131. datas.push(pEle);
  132. });
  133. that.datas = datas;
  134. } else {
  135. that.datas = datas;
  136. }
  137. },
  138. });
  139. },
  140. },
  141. created() {
  142. let that = this;
  143. that.$nextTick(() => {
  144. that.requestData(false);
  145. that.timmer = setInterval(() => {
  146. that.requestData(false);
  147. }, 10000);
  148. });
  149. },
  150. mounted() {
  151. // 渲染后
  152. for (let i = 1; i < 12; i++) {
  153. this.datas.push(JSON.parse(JSON.stringify(this.datas[0])));
  154. if (i % 2 == 0) {
  155. this.datas[i].color = "red";
  156. }
  157. }
  158. },
  159. unmounted() {
  160. clearInterval(this.timmer);
  161. this.timmer = null;
  162. },
  163. };
  164. </script>
  165. <style lang="less" scoped>
  166. .agc {
  167. height: calc(100vh - 7.222vh);
  168. overflow: hidden;
  169. .btn-group-tabs {
  170. display: flex;
  171. flex-direction: row;
  172. .photovoltaic {
  173. margin-left: 1.481vh;
  174. }
  175. }
  176. .panel-groups {
  177. display: flex;
  178. flex-direction: row;
  179. width: 100%;
  180. flex-wrap: wrap;
  181. .panel-item {
  182. width: calc(25% - 12px);
  183. height: 29vh;
  184. margin-left: 16px;
  185. margin-bottom: 16px;
  186. &:nth-child(4n + 1) {
  187. margin-left: 0;
  188. }
  189. }
  190. }
  191. }
  192. </style>