Agc.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="agc">
  3. <div class="btn-group-tabs">
  4. <!-- <BtnGroup2 :btnGroups="btnGroups" :rowIndex="0" :index="1" @select="select"></BtnGroup2> -->
  5. </div>
  6. <div class="panel-groups">
  7. <AgcPanel class="panel-item" v-for="(data, index) of datas" :key="index" :data="data" chartType="multiple" :chartData="data.tb"></AgcPanel>
  8. </div>
  9. </div>
  10. </template>
  11. <script>
  12. import AgcPanel from "./components/agc-panel.vue";
  13. import store from "@store/index.js";
  14. export default {
  15. // 名称
  16. name: "Agc",
  17. // 使用组件
  18. components: {
  19. AgcPanel,
  20. },
  21. // 数据
  22. data() {
  23. return {
  24. timmer: null, // 计时器
  25. datas: [
  26. {
  27. title: "某某风电场",
  28. subTitle: "(调度名称)",
  29. icon: "fa fa-gears",
  30. color: "green",
  31. },
  32. ],
  33. btnGroups: [
  34. {
  35. icon: "fa fa-fire",
  36. btns: [
  37. {
  38. text: "某某风电场",
  39. code: "mmfdc1",
  40. },
  41. {
  42. text: "麻黄山风场",
  43. code: "mhsfc",
  44. },
  45. {
  46. text: "某某风电场",
  47. code: "mmfdc2",
  48. },
  49. {
  50. text: "某某风电场",
  51. code: "mmfdc3",
  52. },
  53. {
  54. text: "某某风电场",
  55. code: "mmfdc4",
  56. },
  57. ],
  58. },
  59. {
  60. icon: "fa fa-fire-extinguisher",
  61. btns: [
  62. {
  63. text: "某某光伏",
  64. code: "mmgf1",
  65. },
  66. {
  67. text: "某某光伏",
  68. code: "mmgf2",
  69. },
  70. {
  71. text: "某某光伏",
  72. code: "mmgf3",
  73. },
  74. {
  75. text: "某某光伏",
  76. code: "mmgf4",
  77. },
  78. ],
  79. },
  80. ],
  81. };
  82. },
  83. // 函数
  84. methods: {
  85. select: function(item) {
  86. // console.log(item);
  87. },
  88. // 请求服务
  89. requestData(showLoading) {
  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. } else {
  136. that.datas = datas;
  137. }
  138. },
  139. });
  140. },
  141. },
  142. created() {
  143. let that = this;
  144. that.$nextTick(() => {
  145. that.requestData(false);
  146. that.timmer = setInterval(() => {
  147. that.requestData(false);
  148. }, 10000);
  149. });
  150. },
  151. mounted() {
  152. // 渲染后
  153. for (let i = 1; i < 12; i++) {
  154. this.datas.push(JSON.parse(JSON.stringify(this.datas[0])));
  155. if (i % 2 == 0) {
  156. this.datas[i].color = "red";
  157. }
  158. }
  159. },
  160. unmounted() {
  161. clearInterval(this.timmer);
  162. this.timmer = null;
  163. },
  164. };
  165. </script>
  166. <style lang="less" scoped>
  167. .agc {
  168. height: calc(100vh - 7.222vh);
  169. overflow: auto;
  170. .btn-group-tabs {
  171. display: flex;
  172. flex-direction: row;
  173. .photovoltaic {
  174. margin-left: 1.481vh;
  175. }
  176. }
  177. .panel-groups {
  178. display: flex;
  179. flex-direction: row;
  180. width: 100%;
  181. flex-wrap: wrap;
  182. .panel-item {
  183. width: calc(25% - 1.204vh);
  184. height: 29vh;
  185. margin-left: 1.481vh;
  186. margin-bottom: 1.481vh;
  187. &:nth-child(4n + 1) {
  188. margin-left: 0;
  189. }
  190. }
  191. }
  192. }
  193. </style>