index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <!--
  2. - Copyright (c) 2018-2025, lengleng All rights reserved.
  3. -
  4. - Redistribution and use in source and binary forms, with or without
  5. - modification, are permitted provided that the following conditions are met:
  6. -
  7. - Redistributions of source code must retain the above copyright notice,
  8. - this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. - notice, this list of conditions and the following disclaimer in the
  11. - documentation and/or other materials provided with the distribution.
  12. - Neither the name of the pig4cloud.com developer nor the names of its
  13. - contributors may be used to endorse or promote products derived from
  14. - this software without specific prior written permission.
  15. - Author: lengleng (wangiegie@gmail.com)
  16. -->
  17. <template>
  18. <div class="execution">
  19. <div class="filter">
  20. <div class="startTime" style="display: inline-block">
  21. <span class="timeText" style="font-weight: bold;font-size: 14px">&#12288;起始时间:</span>
  22. <el-date-picker
  23. v-model="startTime"
  24. :clearable="false"
  25. type="datetime"
  26. value-format="timestamp"
  27. placeholder="选择日期">
  28. </el-date-picker>
  29. </div>
  30. <div class="endTime" style="display: inline-block">
  31. <span class="timeText" style="font-weight: bold;font-size: 14px">&#12288;截止时间:</span>
  32. <el-date-picker
  33. v-model="endTime"
  34. :clearable="false"
  35. type="datetime"
  36. value-format="timestamp"
  37. placeholder="选择日期">
  38. </el-date-picker>
  39. </div>
  40. <div style="display: inline-block">
  41. <span style="font-weight: bold;font-size: 14px">&#12288;场站名称:</span>
  42. <el-select style="width:250px" v-model="stationCode" size="small" @change="getManufactor">
  43. <el-option
  44. v-for="item in stationList"
  45. :key="item.value"
  46. :label="item.label"
  47. :value="item.value">
  48. <span style="float: left">{{ item.label }}</span>
  49. <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
  50. </el-option>
  51. </el-select>
  52. </div>
  53. &nbsp;
  54. <div style="display: inline-block">
  55. <span style="font-weight: bold;font-size: 14px">&#12288;预测厂家:</span>
  56. <el-select style="width:250px" clearable v-model="forecastManufactor" size="small">
  57. <el-option
  58. v-for="item in forecastManufactorList"
  59. :key="item.sign"
  60. :label="item.name"
  61. :value="item.sign">
  62. <span style="float: left">{{ item.name }}</span>
  63. <span style="float: right; color: #8492a6;font-size: 13px">{{ item.sign }}</span>
  64. </el-option>
  65. </el-select>
  66. </div>
  67. <div style="display: inline-block">
  68. <span style="font-weight: bold;font-size: 14px">&#12288;短期预测点位:</span>
  69. <el-select style="width:150px" v-model="dqQueryPoint" size="small">
  70. <el-option
  71. v-for="item in dqPoint"
  72. :key="item.label"
  73. :label="item.label"
  74. :value="item.value">
  75. </el-option>
  76. </el-select>
  77. </div>
  78. <div style="display: inline-block">
  79. <span style="font-weight: bold;font-size: 14px">&#12288;超短期预测点位:</span>
  80. <el-select style="width:150px" v-model="cdqQueryPoint" size="small">
  81. <el-option
  82. v-for="item in cdqPoint"
  83. :key="item.label"
  84. :label="item.label"
  85. :value="item.value">
  86. </el-option>
  87. </el-select>
  88. </div>
  89. <div class="timeQuery" style="display: inline-block">
  90. &#12288;<el-button size="small" :loading="loading" @click="getCompositeData">查询</el-button>
  91. </div>
  92. </div>
  93. <el-tabs type="card" v-model="activeName">
  94. <el-tab-pane label="图表" name="first">
  95. <div style="width: 100%; height: calc(80vh - 50px)" id="echarts"></div>
  96. </el-tab-pane>
  97. <el-tab-pane label="表格" name="second">
  98. <vxe-table
  99. align="center"
  100. :loading="loading"
  101. ref="xTable"
  102. auto-resize
  103. border
  104. resizable
  105. highlight-current-row
  106. show-overflow
  107. :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
  108. >
  109. <vxe-table-column
  110. v-for="(item, index) in fromHead"
  111. :key="index"
  112. align="center"
  113. :title="item.label"
  114. :field="item.field"
  115. ></vxe-table-column>
  116. </vxe-table>
  117. <vxe-pager
  118. perfect
  119. :current-page.sync="currentPage"
  120. :page-size.sync="pageSize"
  121. :total="total"
  122. :page-sizes=[10,50,100]
  123. :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
  124. @page-change="handlePageChange"
  125. >
  126. </vxe-pager>
  127. </el-tab-pane>
  128. </el-tabs>
  129. </div>
  130. </template>
  131. <script>
  132. import {
  133. getStation,
  134. getCapacity,
  135. // getForecastManufactor,
  136. getCompositeData
  137. } from '@/api/forecastpowerultrashortterm'
  138. import {tableOption} from '@/const/crud/forecastpowerultrashortterm'
  139. import {mapGetters} from 'vuex'
  140. import * as echarts from 'echarts';
  141. import {getManufactorByStationCode} from '@/api/forecastmanufactor'
  142. import cc from '../../../curvecolors'
  143. export default {
  144. name: 'forecastpowerultrashortterm',
  145. data() {
  146. return {
  147. cdqPoint: [
  148. {
  149. value: 0,
  150. label: '实时超短期'
  151. }, {
  152. value: 1,
  153. label: '1'
  154. }, {
  155. value: 2,
  156. label: '2'
  157. }, {
  158. value: 3,
  159. label: '3'
  160. }, {
  161. value: 4,
  162. label: '4'
  163. }, {
  164. value: 5,
  165. label: '5'
  166. }, {
  167. value: 6,
  168. label: '6'
  169. }, {
  170. value: 7,
  171. label: '7'
  172. }, {
  173. value: 8,
  174. label: '8'
  175. }, {
  176. value: 9,
  177. label: '9'
  178. }, {
  179. value: 10,
  180. label: '10'
  181. }, {
  182. value: 11,
  183. label: '11'
  184. }, {
  185. value: 12,
  186. label: '12'
  187. }, {
  188. value: 13,
  189. label: '13'
  190. }, {
  191. value: 14,
  192. label: '14'
  193. }, {
  194. value: 15,
  195. label: '15'
  196. }, {
  197. value: 16,
  198. label: '16'
  199. }],
  200. dqPoint: [
  201. {
  202. value: 0,
  203. label: '实时短期'
  204. }, {
  205. value: 1,
  206. label: '1'
  207. }, {
  208. value: 2,
  209. label: '2'
  210. }, {
  211. value: 3,
  212. label: '3'
  213. }, {
  214. value: 4,
  215. label: '4'
  216. }, {
  217. value: 5,
  218. label: '5'
  219. }, {
  220. value: 6,
  221. label: '6'
  222. }, {
  223. value: 7,
  224. label: '7'
  225. }, {
  226. value: 8,
  227. label: '8'
  228. }, {
  229. value: 9,
  230. label: '9'
  231. }, {
  232. value: 10,
  233. label: '10'
  234. }, {
  235. value: 11,
  236. label: '11'
  237. }, {
  238. value: 12,
  239. label: '12'
  240. }, {
  241. value: 13,
  242. label: '13'
  243. }, {
  244. value: 14,
  245. label: '14'
  246. }, {
  247. value: 15,
  248. label: '15'
  249. }],
  250. cdqQueryPoint: 0,
  251. dqQueryPoint: 0,
  252. searchForm: {},
  253. tableData: [],
  254. total: 0, // 总页数
  255. currentPage: 1, // 当前页数
  256. pageSize: 10, // 每页显示多少条
  257. tableLoading: false,
  258. tableOption: tableOption,
  259. startTime: new Date(new Date().toLocaleDateString()).getTime(),
  260. endTime: new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000 - 1,
  261. stationCode: '',
  262. stationList: [],
  263. forecastManufactor: '',
  264. forecastManufactorList: [],
  265. drawData: {datas: [], times: []},
  266. resizeKey: 1,
  267. activeName: 'first',
  268. loading: false,
  269. ultraShortData: [],
  270. shortData: [],
  271. powerStationStatusData: [],
  272. timeStamp: [],
  273. arrays: [],
  274. fromHead: []
  275. }
  276. },
  277. computed: {
  278. ...mapGetters(['permissions']),
  279. },
  280. mounted() {
  281. this.getStationCode()
  282. // this.getForecastManufactor(this.page)
  283. // this.draw()
  284. },
  285. methods: {
  286. draw(timeaxis, realpower, shortPower, ultraShortPower, cap,nwp,cft) {
  287. this.arrays = []
  288. this.arrays.push({
  289. name: '实际功率',
  290. type: 'line',
  291. smooth: true,
  292. showSymbol:false,
  293. symbolSize: 5,
  294. data: realpower,
  295. itemStyle: {
  296. color: 'red'
  297. }
  298. });
  299. let _this = this
  300. let tempDqLineColor = 1
  301. for (let item in shortPower[0]) {
  302. _this.arrays.push({
  303. name: item + '短期',
  304. type: 'line',
  305. smooth: true,
  306. showSymbol:false,
  307. symbolSize: 5,
  308. data: shortPower[0][item],
  309. itemStyle: {
  310. color: cc["dq"+tempDqLineColor]
  311. }
  312. });
  313. tempDqLineColor=tempDqLineColor+1
  314. }
  315. let tempCdqLineColor = 1
  316. for (let item in ultraShortPower[0]) {
  317. _this.arrays.push({
  318. name: item + '超短期',
  319. type: 'line',
  320. smooth: true,
  321. showSymbol:false,
  322. symbolSize: 5,
  323. data: ultraShortPower[0][item],
  324. itemStyle: {
  325. color: cc["cdq"+tempCdqLineColor]
  326. }
  327. });
  328. tempCdqLineColor = tempCdqLineColor+1
  329. }
  330. this.chart = echarts.init(document.getElementById('echarts'))
  331. const option = {
  332. backgroundColor: 'transparent',
  333. title: {
  334. top: 20,
  335. text: '预测数据查询',
  336. textStyle: {
  337. fontWeight: 'normal',
  338. fontSize: 16,
  339. color: '#040606'
  340. },
  341. left: '1%'
  342. },
  343. tooltip: {
  344. trigger: 'axis',
  345. axisPointer: {
  346. animation:false,
  347. lineStyle: {
  348. color: '#040606'
  349. }
  350. }
  351. },
  352. legend: {
  353. top: 20,
  354. icon: 'rect',
  355. itemWidth: 14,
  356. itemHeight: 5,
  357. itemGap: 13,
  358. // data: ['实际功率', '短期数据', '超短期数据'],
  359. right: '4%',
  360. textStyle: {
  361. fontSize: 12
  362. }
  363. },
  364. dataZoom: [
  365. {
  366. startValue: ''
  367. },
  368. {
  369. type: 'inside'
  370. }],
  371. grid: {
  372. top: 100,
  373. left: '2%',
  374. right: '2%',
  375. bottom: '10%',
  376. containLabel: true
  377. },
  378. xAxis: [{
  379. type: 'category',
  380. boundaryGap: true,
  381. axisLine: {
  382. lineStyle: {
  383. color: '#040606'
  384. }
  385. },
  386. data: timeaxis
  387. }],
  388. yAxis: [{
  389. type: 'value',
  390. name: '(MW)',
  391. max:cap,
  392. min:0,
  393. axisTick: {
  394. show: false
  395. },
  396. axisLine: {
  397. lineStyle: {
  398. color: '#040606'
  399. }
  400. },
  401. axisLabel: {
  402. textStyle: {
  403. fontSize: 14
  404. }
  405. },
  406. splitLine: {
  407. lineStyle: {
  408. color: '#57617B'
  409. }
  410. }
  411. }],
  412. series: this.arrays
  413. };
  414. option.yAxis.push({
  415. type: 'value',
  416. name: '(m/s)',
  417. min: 0,
  418. axisTick: {
  419. show: false
  420. },
  421. axisLine: {
  422. lineStyle: {
  423. color: '#4fe512'
  424. }
  425. },
  426. axisLabel: {
  427. margin: 10,
  428. textStyle: {
  429. fontSize: 14
  430. }
  431. },
  432. splitLine: {
  433. lineStyle: {
  434. color: '#666633'
  435. }
  436. }
  437. })
  438. option.series.push({
  439. yAxisIndex: 1,
  440. name: '中心侧NWP轮毂风速',
  441. type: 'line',
  442. smooth: true,
  443. symbol: 'circle',
  444. symbolSize: 5,
  445. showSymbol: false,
  446. lineStyle: {
  447. normal: {
  448. width: 2
  449. }
  450. },
  451. itemStyle: {
  452. normal: {
  453. color: cc.lggdfs,
  454. borderColor: 'rgba(201,209,210,0.2)',
  455. borderWidth: 12
  456. }
  457. },
  458. data: nwp
  459. })
  460. option.series.push({
  461. yAxisIndex: 1,
  462. name: '测风塔轮毂风速',
  463. type: 'line',
  464. smooth: true,
  465. symbol: 'circle',
  466. symbolSize: 5,
  467. showSymbol: false,
  468. lineStyle: {
  469. normal: {
  470. width: 2
  471. }
  472. },
  473. itemStyle: {
  474. normal: {
  475. color: cc.line24,
  476. borderColor: 'rgba(201,209,210,0.2)',
  477. borderWidth: 12
  478. }
  479. },
  480. data: cft
  481. })
  482. // option.legend.data.push('中心侧NWP')
  483. this.chart.setOption(option, true)
  484. },
  485. getManufactor(val) {
  486. this.forecastManufactorList = []
  487. this.forecastManufactor = []
  488. getManufactorByStationCode(val).then(response => {
  489. this.forecastManufactorList = response.data.data
  490. if (this.forecastManufactorList != '') {
  491. this.forecastManufactor = this.forecastManufactorList[0].sign;
  492. }
  493. this.tableLoading = false
  494. })
  495. },
  496. getCompositeData() {
  497. const param = new URLSearchParams()
  498. param.append('stationCode', this.stationCode)
  499. param.append('startTime', this.startTime)
  500. param.append('endTime', this.endTime)
  501. param.append("cdqPoint", this.cdqQueryPoint)
  502. param.append("dqPoint", this.dqQueryPoint)
  503. param.append("forecastManufactor", this.forecastManufactor)
  504. getCompositeData(param).then(response => {
  505. // this.tableData = response.data.data.composite
  506. // this.page.total = this.tableData.length
  507. Promise.all([this.getCapacity(param)]).then((values) => {
  508. this.fromHead = response.data.data.fromHead
  509. this.tableData = response.data.data.tableList
  510. this.total = response.data.data.tableList.length
  511. this.draw(response.data.data.time, response.data.data.sj, response.data.data.dq, response.data.data.cdq, values[0].capacity,response.data.data.nwp,response.data.data.cft)
  512. });
  513. })
  514. },
  515. getCapacity(param) {
  516. return new Promise(function (resolve, reject) {
  517. getCapacity(param).then(response => {
  518. resolve(response.data.data)
  519. })
  520. })
  521. },
  522. // getForecastManufactor(page, params) {
  523. // this.tableLoading = true
  524. // getForecastManufactor(Object.assign({
  525. // // current: page.currentPage,
  526. // // size: page.pageSize
  527. // }, params, this.searchForm)).then(response => {
  528. // console.log(response)
  529. // this.forecastManufactorList = response.data.data.records
  530. // if (this.forecastManufactorList.length > 0) {
  531. // this.forecastManufactor = this.forecastManufactorList[0].sign
  532. // }
  533. // })
  534. // },
  535. getStationCode() {
  536. this.tableLoading = true
  537. getStation().then(response => {
  538. this.stationList = response.data.data
  539. if (this.stationList.length > 0) {
  540. this.stationCode = this.stationList[0].value
  541. this.getManufactor(this.stationCode)
  542. }
  543. this.tableLoading = false
  544. })
  545. },
  546. handlePageChange({currentPage, pageSize}) {
  547. this.currentPage = currentPage;//当前页
  548. this.pageSize = pageSize//每页显示的条数
  549. },
  550. // sizeChange(pageSize) {
  551. // this.page.pageSize = pageSize
  552. // },
  553. // currentChange(current) {
  554. // this.page.currentPage = current
  555. // },
  556. // searchChange(form, done) {
  557. // this.searchForm = form
  558. // this.page.currentPage = 1
  559. // // this.getCompositeData()
  560. // done()
  561. // },
  562. refreshChange() {
  563. // this.getCompositeData()
  564. this.getStationCode()
  565. }
  566. }
  567. }
  568. </script>