forecast-system.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <div class="forecast-system">
  3. <div class="action-bar mg-b-16">
  4. <div class="selections">
  5. <!-- <div class="item" @click="tabSelect(0)" :class="{ active: tabIndex == 0 }">麻黄山</div>
  6. <div class="item" @click="tabSelect(1)" :class="{ active: tabIndex == 1 }">牛首山</div>
  7. <div class="item" @click="tabSelect(2)" :class="{ active: tabIndex == 2 }">青山</div>
  8. <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 3 }">石板泉</div>
  9. <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 4 }">香山</div> -->
  10. <div
  11. class="item"
  12. v-for="item of wpList"
  13. :key="item"
  14. @click="tabSelect(item)"
  15. :class="{ active: wpId == item.id }"
  16. >
  17. {{ item.name }}
  18. </div>
  19. </div>
  20. </div>
  21. <div class="page-body">
  22. <el-row class="mg-b-16">
  23. <el-col :span="5" class="fc-info">
  24. <div class="fc-item">
  25. <div class="title">{{ wpName }}</div>
  26. <div class="tags">
  27. <div class="tag">
  28. <i class="svg-icon svg-icon-gray-l svg-icon-lg">
  29. <svg-icon :svgid="'svg-' + weatherInfo.tqtp" />
  30. </i>
  31. </div>
  32. <div class="tag">
  33. <div class="tag-title">风速</div>
  34. <div class="tag-value">
  35. {{ weatherInfo.fs }}<span class="unit">m/s</span>
  36. </div>
  37. </div>
  38. <div class="tag">
  39. <div class="tag-title">风向</div>
  40. <div class="tag-value">
  41. {{ weatherInfo.fx }}<span class="unit"></span>
  42. </div>
  43. </div>
  44. <div class="tag">
  45. <div class="tag-title">清晰度</div>
  46. <div class="tag-value">
  47. {{ weatherInfo.qxd }}<span class="unit"></span>
  48. </div>
  49. </div>
  50. <div class="tag">
  51. <div class="tag-title">温度</div>
  52. <div class="tag-value">
  53. {{ weatherInfo.wd }}<span class="unit">℃</span>
  54. </div>
  55. </div>
  56. <div class="tag">
  57. <div class="tag-title">大气压强</div>
  58. <div class="tag-value">
  59. {{ weatherInfo.dqyl }}<span class="unit">hPa</span>
  60. </div>
  61. </div>
  62. <div class="tag">
  63. <div class="tag-title">湿度</div>
  64. <div class="tag-value">
  65. {{ weatherInfo.sd }}<span class="unit">%</span>
  66. </div>
  67. </div>
  68. <div class="tag">
  69. <div class="tag-title">经度</div>
  70. <div class="tag-value">
  71. {{ weatherInfo.jingdu }}<span class="unit"></span>
  72. </div>
  73. </div>
  74. <div class="tag">
  75. <div class="tag-title">纬度</div>
  76. <div class="tag-value">
  77. {{ weatherInfo.weidu }}<span class="unit"></span>
  78. </div>
  79. </div>
  80. <div class="tag">
  81. <div class="tag-title">云量</div>
  82. <div class="tag-value">
  83. {{ weatherInfo.yunliang }}<span class="unit"></span>
  84. </div>
  85. </div>
  86. <div class="tag">
  87. <div class="tag-title">日出时间</div>
  88. <div class="tag-value">
  89. {{ weatherInfo.richushijian }}<span class="unit"></span>
  90. </div>
  91. </div>
  92. <div class="tag">
  93. <div class="tag-title">日落时间</div>
  94. <div class="tag-value">
  95. {{ weatherInfo.riluoshijian }}<span class="unit"></span>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </el-col>
  101. <el-col :span="19">
  102. <panel :title="'损失电量分析'">
  103. <multiple-bar-line-chart
  104. :height="'100%'"
  105. :lineData="chart1Line"
  106. :barData="chart1Bar"
  107. :units="['功率(万kW)', '电量(万kWh)']"
  108. />
  109. </panel>
  110. </el-col>
  111. </el-row>
  112. <el-row class="bottom-charts">
  113. <el-col :span="12">
  114. <panel :title="'超短期风功率预测'">
  115. <arrow-line-chart
  116. :width="'100%'"
  117. :height="'100%'"
  118. :list="chart2List"
  119. :units="['功率(万kW)', '风速(m/s)']"
  120. />
  121. </panel>
  122. </el-col>
  123. <el-col :span="12">
  124. <panel :title="'短期风功率预测'">
  125. <arrow-line-chart
  126. :height="'100%'"
  127. :list="chart3List"
  128. :units="['功率(万kW)', '风速(m/s)']"
  129. />
  130. </panel>
  131. </el-col>
  132. </el-row>
  133. </div>
  134. </div>
  135. </template>
  136. <script>
  137. // import MultipleBarLineChart from "../../components/chart/combination/multiple-bar-line-chart.vue";
  138. import MultipleBarLineChart from "./multiple-bar-line-chart1.vue";
  139. // import ArrowLineChart from "../../components/chart/line/arrow-line-chart.vue";
  140. import ArrowLineChart from "./arrow-line-chart.vue";
  141. import svgIcon from "../../components/coms/icon/svg-icon.vue";
  142. import Panel from "../../components/coms/panel/panel.vue";
  143. import api from "@api/economic/index.js";
  144. export default {
  145. components: { svgIcon, MultipleBarLineChart, Panel, ArrowLineChart },
  146. setup() {},
  147. data() {
  148. return {
  149. wpList: [],
  150. wpId: "MHS_FDC",
  151. wpName: "麻黄山风电场",
  152. weatherInfo: {},
  153. chart1Bar: [],
  154. chart1Line: [],
  155. chart2List: [],
  156. chart3List: [],
  157. timer: null,
  158. };
  159. },
  160. methods: {
  161. tabSelect(item) {
  162. this.wpId = item["id"];
  163. this.wpName = item["name"];
  164. {
  165. this.getData();
  166. this.getChart1();
  167. this.getChart3();
  168. }
  169. },
  170. async getWp() {
  171. const res = await api.powercompareWindfarmAllAjax2({});
  172. // this.API.requestData({
  173. // method: "GET",
  174. // subUrl: "powercompare/windfarmAllAjax"
  175. // });
  176. if (res) {
  177. this.wpList = res.data.data.filter((ele) => {
  178. return ele.id.indexOf("_FDC") > -1;
  179. });
  180. }
  181. },
  182. async getData() {
  183. const res = await api.weatherWeatherInfo({
  184. wpId: this.wpId,
  185. });
  186. // this.API.requestData({
  187. // method: "POST",
  188. // subUrl: "weather/weatherInfo",
  189. // data: {
  190. // wpId: this.wpId
  191. // },
  192. // });
  193. if (res) {
  194. console.log("resWeather:", res);
  195. this.weatherInfo = res.data.data;
  196. }
  197. },
  198. async getChart1() {
  199. // -----------------------------------------------------------------
  200. const res = await
  201. api.weatherPowerChart({
  202. wpId: this.wpId,
  203. });
  204. // this.API.requestData({
  205. // method: "POST",
  206. // subUrl: "weather/powerChart",
  207. // data: { wpId: this.wpId },
  208. // });
  209. if (res) {
  210. const fdlValue = { title: "电量", yAxisIndex: 0, value: [] };
  211. const glValue = { title: "功率", yAxisIndex: 1, value: [] };
  212. const fsValue = { name: "风速", unit: "m/s", data: [] };
  213. res.data.data.forEach((e) => {
  214. if (fdlValue.value.length == 0) {
  215. fdlValue.value.push({
  216. text: new Date(e.time).formatDate("hh:mm"),
  217. value: 0,
  218. });
  219. } else {
  220. fdlValue.value.push({
  221. text: new Date(e.time).formatDate("hh:mm"),
  222. value: e.value1,
  223. });
  224. }
  225. glValue.value.push({
  226. text: new Date(e.time).formatDate("hh:mm"),
  227. value: e.value2,
  228. });
  229. fsValue.data.push(e.value3);
  230. });
  231. this.chart1Bar = [fdlValue, glValue];
  232. this.chart1Line = fsValue;
  233. }
  234. },
  235. async getChart3() {
  236. const res = await api.benchmarkingLineList({
  237. wpId: this.wpId,
  238. });
  239. // this.API.requestData({
  240. // method: "POST",
  241. // subUrl: "weather/weatherChart",
  242. // data: {
  243. // wpId: this.wpId
  244. // },
  245. // });
  246. if (res) {
  247. // 短期预测功率
  248. {
  249. const ycglValue = { title: "预测功率", yAxisIndex: 0, value: [] };
  250. const sjglValue = { title: "实际功率", yAxisIndex: 0, value: [] };
  251. const fsValue = { title: "风速", yAxisIndex: 1, value: [] };
  252. let hour = new Date().getHours();
  253. res.data.data.forEach((e) => {
  254. if (ycglValue.value.length <= 24 + hour) {
  255. ycglValue.value.push({
  256. text: new Date(e.time).formatDate("hh:mm"),
  257. value: e.value7,
  258. });
  259. sjglValue.value.push({
  260. text: new Date(e.time).formatDate("hh:mm"),
  261. value: e.value2,
  262. });
  263. fsValue.value.push({
  264. text: new Date(e.time).formatDate("hh:mm"),
  265. value: e.value6,
  266. });
  267. }
  268. });
  269. this.chart3List = [ycglValue, sjglValue, fsValue];
  270. }
  271. // 超短期预测功率
  272. const cdqGlValue = { title: "预测功率", yAxisIndex: 0, value: [] };
  273. const sjglValue = { title: "实际功率", yAxisIndex: 0, value: [] };
  274. const fsValue = { title: "风速", yAxisIndex: 1, value: [] };
  275. let hour = new Date().getHours();
  276. res.data.data.forEach((e) => {
  277. if (cdqGlValue.value.length <= 4 + hour) {
  278. cdqGlValue.value.push({
  279. text: new Date(e.time).formatDate("hh:mm"),
  280. value: e.value4,
  281. });
  282. sjglValue.value.push({
  283. text: new Date(e.time).formatDate("hh:mm"),
  284. value: e.value2,
  285. });
  286. fsValue.value.push({
  287. text: new Date(e.time).formatDate("hh:mm"),
  288. value: e.value6,
  289. });
  290. }
  291. });
  292. this.chart2List = [cdqGlValue, sjglValue, fsValue];
  293. }
  294. },
  295. },
  296. created() {
  297. this.getWp();
  298. let that = this;
  299. that.$nextTick(() => {
  300. that.getData();
  301. that.getChart1();
  302. that.getChart3();
  303. that.timer = setInterval(() => {
  304. that.getData();
  305. that.getChart1();
  306. that.getChart3();
  307. }, 60000);
  308. });
  309. },
  310. unmounted() {
  311. clearInterval(this.timer);
  312. this.timer = null;
  313. },
  314. };
  315. </script>
  316. <style lang="less">
  317. .forecast-system {
  318. .com-panel {
  319. .panel-body {
  320. height: 43vh;
  321. }
  322. }
  323. .bottom-charts {
  324. .panel-body {
  325. height: 35vh;
  326. }
  327. }
  328. .action-bar {
  329. .selections {
  330. flex: 1 0 auto;
  331. display: flex;
  332. .item {
  333. flex: 0 0 94px;
  334. text-align: center;
  335. height: 33px;
  336. line-height: 33px;
  337. margin-right: 8px;
  338. color: @font-color;
  339. font-size: @fontsize-s;
  340. background: fade(@gray, 20);
  341. border: 1px solid fade(@gray, 20);
  342. &:hover,
  343. &.active {
  344. background: fade(@green, 20);
  345. border: 1px solid @green;
  346. color: @green;
  347. cursor: pointer;
  348. }
  349. }
  350. }
  351. }
  352. // 风场信息
  353. .fc-info {
  354. .fc-item {
  355. & > .title {
  356. background: fade(@gray, 20);
  357. padding: 0 1.4815vh;
  358. line-height: 27px;
  359. color: fade(@white, 75);
  360. font-size: @fontsize-s;
  361. margin-bottom: 0.7407vh;
  362. }
  363. & + .fc-item {
  364. margin-left: 8px;
  365. }
  366. .tags {
  367. display: flex;
  368. flex-wrap: wrap;
  369. .tag {
  370. flex: 1 0 calc(100% / 3 - 8px);
  371. background: fade(@gray, 20);
  372. margin-bottom: 8px;
  373. height: 10vh;
  374. .tag-title {
  375. font-size: 12px;
  376. color: @gray-l;
  377. line-height: 24px;
  378. background: fade(@gray, 40);
  379. text-align: center;
  380. }
  381. .tag-value {
  382. position: relative;
  383. font-size: 20px;
  384. color: @green;
  385. text-align: center;
  386. padding: 3vh 0;
  387. .unit {
  388. position: absolute;
  389. color: @gray;
  390. font-size: 12px;
  391. bottom: 8px;
  392. right: 8px;
  393. top: 40%;
  394. }
  395. }
  396. & + .tag {
  397. margin-left: 8px;
  398. }
  399. &:nth-child(1) {
  400. display: flex;
  401. justify-content: center;
  402. align-items: center;
  403. i {
  404. width: 56px;
  405. height: 56px;
  406. svg {
  407. width: 56px;
  408. height: 56px;
  409. }
  410. }
  411. }
  412. &:nth-child(3n + 1) {
  413. margin-left: 0px;
  414. }
  415. }
  416. }
  417. }
  418. }
  419. }
  420. </style>