forecast-system.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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. export default {
  144. components: { svgIcon, MultipleBarLineChart, Panel, ArrowLineChart },
  145. setup() {},
  146. data() {
  147. return {
  148. wpList: [],
  149. wpId: "MHS_FDC",
  150. wpName: "麻黄山风电场",
  151. weatherInfo: {},
  152. chart1Bar: [],
  153. chart1Line: [],
  154. chart2List: [],
  155. chart3List: [],
  156. timer: null,
  157. };
  158. },
  159. methods: {
  160. tabSelect(item) {
  161. this.wpId = item["id"];
  162. this.wpName = item["name"];
  163. {
  164. this.getData();
  165. this.getChart1();
  166. this.getChart3();
  167. }
  168. },
  169. async getWp() {
  170. const res = await api.powercompareWindfarmAllAjax2({});
  171. // this.API.requestData({
  172. // method: "GET",
  173. // subUrl: "powercompare/windfarmAllAjax"
  174. // });
  175. if (res) {
  176. this.wpList = res.data.data.filter((ele) => {
  177. return ele.id.indexOf("_FDC") > -1;
  178. });
  179. }
  180. },
  181. async getData() {
  182. const res = await api.weatherWeatherInfo({
  183. wpId: this.wpId,
  184. });
  185. // this.API.requestData({
  186. // method: "POST",
  187. // subUrl: "weather/weatherInfo",
  188. // data: {
  189. // wpId: this.wpId
  190. // },
  191. // });
  192. if (res) {
  193. console.log("resWeather:", res);
  194. this.weatherInfo = res.data.data;
  195. }
  196. },
  197. async getChart1() {
  198. const res = await this.API.requestData({
  199. method: "POST",
  200. subUrl: "weather/powerChart",
  201. data: { wpId: this.wpId },
  202. });
  203. if (res) {
  204. const fdlValue = { title: "电量", yAxisIndex: 0, value: [] };
  205. const glValue = { title: "功率", yAxisIndex: 1, value: [] };
  206. const fsValue = { name: "风速", unit: "m/s", data: [] };
  207. res.data.data.forEach((e) => {
  208. if (fdlValue.value.length == 0) {
  209. fdlValue.value.push({
  210. text: new Date(e.time).formatDate("hh:mm"),
  211. value: 0,
  212. });
  213. } else {
  214. fdlValue.value.push({
  215. text: new Date(e.time).formatDate("hh:mm"),
  216. value: e.value1,
  217. });
  218. }
  219. glValue.value.push({
  220. text: new Date(e.time).formatDate("hh:mm"),
  221. value: e.value2,
  222. });
  223. fsValue.data.push(e.value3);
  224. });
  225. this.chart1Bar = [fdlValue, glValue];
  226. this.chart1Line = fsValue;
  227. }
  228. },
  229. async getChart3() {
  230. const res = await api.benchmarkingLineList({
  231. wpId: this.wpId,
  232. });
  233. // this.API.requestData({
  234. // method: "POST",
  235. // subUrl: "weather/weatherChart",
  236. // data: {
  237. // wpId: this.wpId
  238. // },
  239. // });
  240. if (res) {
  241. // 短期预测功率
  242. {
  243. const ycglValue = { title: "预测功率", yAxisIndex: 0, value: [] };
  244. const sjglValue = { title: "实际功率", yAxisIndex: 0, value: [] };
  245. const fsValue = { title: "风速", yAxisIndex: 1, value: [] };
  246. let hour = new Date().getHours();
  247. res.data.data.forEach((e) => {
  248. if (ycglValue.value.length <= 24 + hour) {
  249. ycglValue.value.push({
  250. text: new Date(e.time).formatDate("hh:mm"),
  251. value: e.value7,
  252. });
  253. sjglValue.value.push({
  254. text: new Date(e.time).formatDate("hh:mm"),
  255. value: e.value2,
  256. });
  257. fsValue.value.push({
  258. text: new Date(e.time).formatDate("hh:mm"),
  259. value: e.value6,
  260. });
  261. }
  262. });
  263. this.chart3List = [ycglValue, sjglValue, fsValue];
  264. }
  265. // 超短期预测功率
  266. const cdqGlValue = { title: "预测功率", yAxisIndex: 0, value: [] };
  267. const sjglValue = { title: "实际功率", yAxisIndex: 0, value: [] };
  268. const fsValue = { title: "风速", yAxisIndex: 1, value: [] };
  269. let hour = new Date().getHours();
  270. res.data.data.forEach((e) => {
  271. if (cdqGlValue.value.length <= 4 + hour) {
  272. cdqGlValue.value.push({
  273. text: new Date(e.time).formatDate("hh:mm"),
  274. value: e.value4,
  275. });
  276. sjglValue.value.push({
  277. text: new Date(e.time).formatDate("hh:mm"),
  278. value: e.value2,
  279. });
  280. fsValue.value.push({
  281. text: new Date(e.time).formatDate("hh:mm"),
  282. value: e.value6,
  283. });
  284. }
  285. });
  286. this.chart2List = [cdqGlValue, sjglValue, fsValue];
  287. }
  288. },
  289. },
  290. created() {
  291. this.getWp();
  292. let that = this;
  293. that.$nextTick(() => {
  294. that.getData();
  295. that.getChart1();
  296. that.getChart3();
  297. that.timer = setInterval(() => {
  298. that.getData();
  299. that.getChart1();
  300. that.getChart3();
  301. }, 60000);
  302. });
  303. },
  304. unmounted() {
  305. clearInterval(this.timer);
  306. this.timer = null;
  307. },
  308. };
  309. </script>
  310. <style lang="less">
  311. .forecast-system {
  312. .com-panel {
  313. .panel-body {
  314. height: 43vh;
  315. }
  316. }
  317. .bottom-charts {
  318. .panel-body {
  319. height: 35vh;
  320. }
  321. }
  322. .action-bar {
  323. .selections {
  324. flex: 1 0 auto;
  325. display: flex;
  326. .item {
  327. flex: 0 0 94px;
  328. text-align: center;
  329. height: 33px;
  330. line-height: 33px;
  331. margin-right: 8px;
  332. color: @font-color;
  333. font-size: @fontsize-s;
  334. background: fade(@gray, 20);
  335. border: 1px solid fade(@gray, 20);
  336. &:hover,
  337. &.active {
  338. background: fade(@green, 20);
  339. border: 1px solid @green;
  340. color: @green;
  341. cursor: pointer;
  342. }
  343. }
  344. }
  345. }
  346. // 风场信息
  347. .fc-info {
  348. .fc-item {
  349. & > .title {
  350. background: fade(@gray, 20);
  351. padding: 0 1.4815vh;
  352. line-height: 27px;
  353. color: fade(@white, 75);
  354. font-size: @fontsize-s;
  355. margin-bottom: 0.7407vh;
  356. }
  357. & + .fc-item {
  358. margin-left: 8px;
  359. }
  360. .tags {
  361. display: flex;
  362. flex-wrap: wrap;
  363. .tag {
  364. flex: 1 0 calc(100% / 3 - 8px);
  365. background: fade(@gray, 20);
  366. margin-bottom: 8px;
  367. height: 10vh;
  368. .tag-title {
  369. font-size: 12px;
  370. color: @gray-l;
  371. line-height: 24px;
  372. background: fade(@gray, 40);
  373. text-align: center;
  374. }
  375. .tag-value {
  376. position: relative;
  377. font-size: 20px;
  378. color: @green;
  379. text-align: center;
  380. padding: 3vh 0;
  381. .unit {
  382. position: absolute;
  383. color: @gray;
  384. font-size: 12px;
  385. bottom: 8px;
  386. right: 8px;
  387. top: 40%;
  388. }
  389. }
  390. & + .tag {
  391. margin-left: 8px;
  392. }
  393. &:nth-child(1) {
  394. display: flex;
  395. justify-content: center;
  396. align-items: center;
  397. i {
  398. width: 56px;
  399. height: 56px;
  400. svg {
  401. width: 56px;
  402. height: 56px;
  403. }
  404. }
  405. }
  406. &:nth-child(3n + 1) {
  407. margin-left: 0px;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. }
  414. </style>