index.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  1. <template>
  2. <div class="app-container">
  3. <div class="dark-el-input dark-el-button">
  4. <el-form ref="queryForm" size="small" :inline="true">
  5. <el-form-item label="生成日期">
  6. <el-date-picker
  7. v-model="dateTime"
  8. type="date"
  9. placeholder="选择生成日期" popper-class="cpp-popper"
  10. :picker-options="pickerOptions"
  11. >
  12. </el-date-picker>
  13. </el-form-item>
  14. <el-form-item label="场站名称">
  15. <el-select v-model="stationCode" placeholder="请选择" popper-class="cpp-popper">
  16. <el-option
  17. v-for="item in stationList"
  18. :key="item.value"
  19. :label="item.label"
  20. :value="item.value">
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="primary" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
  26. </el-button>
  27. <el-button type="primary" style="margin-left: 5px" icon="el-icon-download" @click="exportFile">导出
  28. </el-button>
  29. </el-form-item>
  30. </el-form>
  31. </div>
  32. <div style="padding-top: 10px">
  33. <div style="display: flex">
  34. <div style="float:left;width: 95%;height: 350px" id="fscharts" ></div>
  35. </div>
  36. <div>
  37. <vxe-table
  38. highlight-hover-row
  39. :keep-source="true"
  40. align="center"
  41. :loading="loading"
  42. ref="xTable"
  43. auto-resize
  44. highlight-current-row
  45. border
  46. resizable
  47. show-overflow
  48. :data="tableData.slice((currentPage-1) * pageSize,currentPage * pageSize)">
  49. <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat" width="200px"
  50. fixed="left"></vxe-table-column>
  51. <vxe-table-column field="time" title="预测时间" width="180" min-width="150" fixed="left" :formatter="timeFormat"></vxe-table-column>
  52. <vxe-table-column field="t" title="温度" min-width="90" ></vxe-table-column>
  53. <vxe-table-column field="rh" title="湿度" min-width="90" ></vxe-table-column>
  54. <vxe-table-column field="globalRadiation" title="总辐射" min-width="90" ></vxe-table-column>
  55. <vxe-table-column field="directRadiation" title="直辐射" min-width="90" ></vxe-table-column>
  56. <vxe-table-column field="diffuseRadiation" title="散辐射" min-width="90" ></vxe-table-column>
  57. <vxe-table-column field="ws10" title="10米风速" min-width="90" ></vxe-table-column>
  58. <vxe-table-column field="ws30" title="30米风速" min-width="90" ></vxe-table-column>
  59. <vxe-table-column field="ws50" title="50米风速" min-width="90" ></vxe-table-column>
  60. <vxe-table-column field="ws70" title="70米风速" min-width="90" ></vxe-table-column>
  61. <vxe-table-column field="ws80" title="80米风速" min-width="90" ></vxe-table-column>
  62. <vxe-table-column field="ws90" title="90米风速" min-width="90" ></vxe-table-column>
  63. <vxe-table-column field="ws100" title="100米风速" min-width="90" ></vxe-table-column>
  64. <vxe-table-column field="wd10" title="10米风向" min-width="90" ></vxe-table-column>
  65. <vxe-table-column field="wd30" title="30米风向" min-width="90" ></vxe-table-column>
  66. <vxe-table-column field="wd50" title="50米风向" min-width="90" ></vxe-table-column>
  67. <vxe-table-column field="wd70" title="70米风向" min-width="90" ></vxe-table-column>
  68. <vxe-table-column field="wd80" title="80米风向" min-width="90" ></vxe-table-column>
  69. <vxe-table-column field="wd90" title="90米风向" min-width="90" ></vxe-table-column>
  70. <vxe-table-column field="wd100" title="100米风向" min-width="90" ></vxe-table-column>
  71. </vxe-table>
  72. <vxe-pager
  73. perfect
  74. :current-page.sync="currentPage"
  75. :page-size.sync="pageSize"
  76. :total="total"
  77. :page-sizes=[10,50,100]
  78. :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
  79. @page-change="handlePageChange"
  80. >
  81. </vxe-pager>
  82. </div>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import * as echarts from "echarts";
  88. export default {
  89. name: 'inverterinfo',
  90. data() {
  91. return {
  92. fsChart: null,
  93. dateTime: new Date(new Date().toLocaleDateString()).getTime(),
  94. total: 0,
  95. sortOrder: 'asc',
  96. pageSize: 7,
  97. currentPage: 1,
  98. stationList: [],
  99. stationCode: [],
  100. searchForm: {},
  101. tableData: [],
  102. loading: false,
  103. // 日期使用
  104. pickerOptions: {
  105. disabledDate: (time) => {
  106. return time.getTime() > Date.now()
  107. }
  108. },
  109. modId: '',//备用id
  110. itemStyle: [
  111. {
  112. itemStyle: {
  113. normal: {
  114. lineStyle: {
  115. color: '#4A99FF',
  116. // shadowColor: '#4A99FF',
  117. // shadowBlur: 10,
  118. },
  119. shadowColor: '#4A99FF',
  120. shadowBlur: 10,
  121. },
  122. },
  123. areaStyle: {
  124. normal: { // 单项区域填充样式
  125. color: {
  126. type: 'linear',
  127. x: 0, //右
  128. y: 0, //下
  129. x2: 1, //左
  130. y2: 1, //上
  131. colorStops: [{
  132. offset: 0,
  133. color: '#4A99FF'
  134. }, {
  135. offset: 0.5,
  136. color: 'rgba(0,0,0,0)'
  137. }, {
  138. offset: 1,
  139. color: '#4A99FF'
  140. }],
  141. globalCoord: false
  142. },
  143. opacity: 1 // 区域透明度
  144. }
  145. }
  146. },
  147. {
  148. itemStyle: {
  149. normal: {
  150. lineStyle: {
  151. color: '#4BFFFC',
  152. // shadowColor: '#4BFFFC',
  153. // shadowBlur: 10,
  154. },
  155. shadowColor: '#4BFFFC',
  156. shadowBlur: 10,
  157. },
  158. },
  159. areaStyle: {
  160. normal: { // 单项区域填充样式
  161. color: {
  162. type: 'linear',
  163. x: 0, //右
  164. y: 0, //下
  165. x2: 1, //左
  166. y2: 1, //上
  167. colorStops: [{
  168. offset: 0,
  169. color: '#4BFFFC'
  170. }, {
  171. offset: 0.5,
  172. color: 'rgba(0,0,0,0)'
  173. }, {
  174. offset: 1,
  175. color: '#4BFFFC'
  176. }],
  177. globalCoord: false
  178. },
  179. opacity: 1 // 区域透明度
  180. }
  181. }
  182. },
  183. {
  184. itemStyle: {
  185. normal: {
  186. lineStyle: {
  187. color: '#ff654a',
  188. // shadowColor: '#4A99FF',
  189. // shadowBlur: 10,
  190. },
  191. shadowColor: '#ff654a',
  192. shadowBlur: 10,
  193. },
  194. },
  195. areaStyle: {
  196. normal: { // 单项区域填充样式
  197. color: {
  198. type: 'linear',
  199. x: 0, //右
  200. y: 0, //下
  201. x2: 1, //左
  202. y2: 1, //上
  203. colorStops: [{
  204. offset: 0,
  205. color: '#ff654a'
  206. }, {
  207. offset: 0.5,
  208. color: 'rgba(0,0,0,0)'
  209. }, {
  210. offset: 1,
  211. color: '#ff654a'
  212. }],
  213. globalCoord: false
  214. },
  215. opacity: 1 // 区域透明度
  216. }
  217. }
  218. },
  219. {
  220. itemStyle: {
  221. normal: {
  222. lineStyle: {
  223. color: '#edff4a',
  224. // shadowColor: '#4A99FF',
  225. // shadowBlur: 10,
  226. },
  227. shadowColor: '#edff4a',
  228. shadowBlur: 10,
  229. },
  230. },
  231. areaStyle: {
  232. normal: { // 单项区域填充样式
  233. color: {
  234. type: 'linear',
  235. x: 0, //右
  236. y: 0, //下
  237. x2: 1, //左
  238. y2: 1, //上
  239. colorStops: [{
  240. offset: 0,
  241. color: '#edff4a'
  242. }, {
  243. offset: 0.5,
  244. color: 'rgba(0,0,0,0)'
  245. }, {
  246. offset: 1,
  247. color: '#edff4a'
  248. }],
  249. globalCoord: false
  250. },
  251. opacity: 1 // 区域透明度
  252. }
  253. }
  254. },
  255. {
  256. itemStyle: {
  257. normal: {
  258. lineStyle: {
  259. color: '#65ff4a',
  260. // shadowColor: '#4A99FF',
  261. // shadowBlur: 10,
  262. },
  263. shadowColor: '#65ff4a',
  264. shadowBlur: 10,
  265. },
  266. },
  267. areaStyle: {
  268. normal: { // 单项区域填充样式
  269. color: {
  270. type: 'linear',
  271. x: 0, //右
  272. y: 0, //下
  273. x2: 1, //左
  274. y2: 1, //上
  275. colorStops: [{
  276. offset: 0,
  277. color: '#65ff4a'
  278. }, {
  279. offset: 0.5,
  280. color: 'rgba(0,0,0,0)'
  281. }, {
  282. offset: 1,
  283. color: '#65ff4a'
  284. }],
  285. globalCoord: false
  286. },
  287. opacity: 1 // 区域透明度
  288. }
  289. }
  290. },
  291. {
  292. itemStyle: {
  293. normal: {
  294. lineStyle: {
  295. color: '#4affea',
  296. // shadowColor: '#4A99FF',
  297. // shadowBlur: 10,
  298. },
  299. shadowColor: '#4affea',
  300. shadowBlur: 10,
  301. },
  302. },
  303. areaStyle: {
  304. normal: { // 单项区域填充样式
  305. color: {
  306. type: 'linear',
  307. x: 0, //右
  308. y: 0, //下
  309. x2: 1, //左
  310. y2: 1, //上
  311. colorStops: [{
  312. offset: 0,
  313. color: '#4affea'
  314. }, {
  315. offset: 0.5,
  316. color: 'rgba(0,0,0,0)'
  317. }, {
  318. offset: 1,
  319. color: '#4affea'
  320. }],
  321. globalCoord: false
  322. },
  323. opacity: 1 // 区域透明度
  324. }
  325. }
  326. },
  327. {
  328. itemStyle: {
  329. normal: {
  330. lineStyle: {
  331. color: '#894aff',
  332. // shadowColor: '#4A99FF',
  333. // shadowBlur: 10,
  334. },
  335. shadowColor: '#894aff',
  336. shadowBlur: 10,
  337. },
  338. },
  339. areaStyle: {
  340. normal: { // 单项区域填充样式
  341. color: {
  342. type: 'linear',
  343. x: 0, //右
  344. y: 0, //下
  345. x2: 1, //左
  346. y2: 1, //上
  347. colorStops: [{
  348. offset: 0,
  349. color: '#894aff'
  350. }, {
  351. offset: 0.5,
  352. color: 'rgba(0,0,0,0)'
  353. }, {
  354. offset: 1,
  355. color: '#894aff'
  356. }],
  357. globalCoord: false
  358. },
  359. opacity: 1 // 区域透明度
  360. }
  361. }
  362. },
  363. {
  364. itemStyle: {
  365. normal: {
  366. lineStyle: {
  367. color: '#d84aff',
  368. // shadowColor: '#4A99FF',
  369. // shadowBlur: 10,
  370. },
  371. shadowColor: '#d84aff',
  372. shadowBlur: 10,
  373. },
  374. },
  375. areaStyle: {
  376. normal: { // 单项区域填充样式
  377. color: {
  378. type: 'linear',
  379. x: 0, //右
  380. y: 0, //下
  381. x2: 1, //左
  382. y2: 1, //上
  383. colorStops: [{
  384. offset: 0,
  385. color: '#d84aff'
  386. }, {
  387. offset: 0.5,
  388. color: 'rgba(0,0,0,0)'
  389. }, {
  390. offset: 1,
  391. color: '#d84aff'
  392. }],
  393. globalCoord: false
  394. },
  395. opacity: 1 // 区域透明度
  396. }
  397. }
  398. },
  399. {
  400. itemStyle: {
  401. normal: {
  402. lineStyle: {
  403. color: '#ff4aae',
  404. // shadowColor: '#4A99FF',
  405. // shadowBlur: 10,
  406. },
  407. shadowColor: '#ff4aae',
  408. shadowBlur: 10,
  409. },
  410. },
  411. areaStyle: {
  412. normal: { // 单项区域填充样式
  413. color: {
  414. type: 'linear',
  415. x: 0, //右
  416. y: 0, //下
  417. x2: 1, //左
  418. y2: 1, //上
  419. colorStops: [{
  420. offset: 0,
  421. color: '#ff4aae'
  422. }, {
  423. offset: 0.5,
  424. color: 'rgba(0,0,0,0)'
  425. }, {
  426. offset: 1,
  427. color: '#ff4aae'
  428. }],
  429. globalCoord: false
  430. },
  431. opacity: 1 // 区域透明度
  432. }
  433. }
  434. },
  435. ],
  436. colorArr: [{
  437. start: "rgba(155, 101, 229,",
  438. end: "rgba(219,44,44,0.5)"
  439. },
  440. {
  441. start: "rgba(71, 173, 245,",
  442. end: "rgba(231,132,46,0.5)"
  443. },
  444. {
  445. start: "rgba(82, 249, 107,",
  446. end: "rgba(190,229,50,0.5)"
  447. },
  448. {
  449. start: "rgba(82, 249, 107,",
  450. end: "rgba(44,214,140,0.5)"
  451. },
  452. {
  453. start: "rgba(82, 249, 107,",
  454. end: "rgba(43,73,221,0.5)"
  455. },
  456. {
  457. start: "rgba(82, 249, 107,",
  458. end: "rgba(40,203,203,0.5)"
  459. },
  460. {
  461. start: "rgba(82, 249, 107,",
  462. end: "rgba(195,42,180,0.5)"
  463. },
  464. {
  465. start: "rgba(82, 249, 107,",
  466. end: "rgba(231,45,119,0.5)"
  467. },
  468. {
  469. start: "rgba(82, 249, 107,",
  470. end: "rgba(229,46,46,0.5)"
  471. },
  472. ],
  473. lineStyle: [
  474. {
  475. areaStyle: {
  476. normal: {
  477. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  478. offset: 0,
  479. color: 'rgba(219,50,51,0.3)'
  480. }, {
  481. offset: 0.8,
  482. color: 'rgba(219, 50, 51, 0)'
  483. }], false),
  484. shadowColor: 'rgba(0, 0, 0, 0.1)',
  485. shadowBlur: 10
  486. }
  487. },
  488. itemStyle: {
  489. normal: {
  490. color: 'rgb(219,50,51)',
  491. borderColor: 'rgba(219,50,51,0.2)',
  492. borderWidth: 12
  493. }
  494. },
  495. },
  496. {
  497. areaStyle: {
  498. normal: {
  499. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  500. offset: 0,
  501. color: 'rgba(219,196,50,0.3)'
  502. }, {
  503. offset: 0.8,
  504. color: 'rgba(219, 50, 51, 0)'
  505. }], false),
  506. shadowColor: 'rgba(0, 0, 0, 0.1)',
  507. shadowBlur: 10
  508. }
  509. },
  510. itemStyle: {
  511. normal: {
  512. color: 'rgb(219,196,50)',
  513. borderColor: 'rgba(219,196,50,0.2)',
  514. borderWidth: 12
  515. }
  516. },
  517. },
  518. {
  519. areaStyle: {
  520. normal: {
  521. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  522. offset: 0,
  523. color: 'rgba(101,219,50,0.3)'
  524. }, {
  525. offset: 0.8,
  526. color: 'rgba(219, 50, 51, 0)'
  527. }], false),
  528. shadowColor: 'rgba(0, 0, 0, 0.1)',
  529. shadowBlur: 10
  530. }
  531. },
  532. itemStyle: {
  533. normal: {
  534. color: 'rgb(101,219,50)',
  535. borderColor: 'rgba(101,219,50,0.2)',
  536. borderWidth: 12
  537. }
  538. },
  539. },
  540. {
  541. areaStyle: {
  542. normal: {
  543. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  544. offset: 0,
  545. color: 'rgba(50,219,171,0.3)'
  546. }, {
  547. offset: 0.8,
  548. color: 'rgba(219, 50, 51, 0)'
  549. }], false),
  550. shadowColor: 'rgba(0, 0, 0, 0.1)',
  551. shadowBlur: 10
  552. }
  553. },
  554. itemStyle: {
  555. normal: {
  556. color: 'rgb(50,219,171)',
  557. borderColor: 'rgba(50,219,171,0.2)',
  558. borderWidth: 12
  559. }
  560. },
  561. },
  562. {
  563. areaStyle: {
  564. normal: {
  565. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  566. offset: 0,
  567. color: 'rgba(50,118,219,0.3)'
  568. }, {
  569. offset: 0.8,
  570. color: 'rgba(219, 50, 51, 0)'
  571. }], false),
  572. shadowColor: 'rgba(0, 0, 0, 0.1)',
  573. shadowBlur: 10
  574. }
  575. },
  576. itemStyle: {
  577. normal: {
  578. color: 'rgb(50,118,219)',
  579. borderColor: 'rgba(50,118,219,0.2)',
  580. borderWidth: 12
  581. }
  582. },
  583. },
  584. {
  585. areaStyle: {
  586. normal: {
  587. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  588. offset: 0,
  589. color: 'rgba(140,50,219,0.3)'
  590. }, {
  591. offset: 0.8,
  592. color: 'rgba(219, 50, 51, 0)'
  593. }], false),
  594. shadowColor: 'rgba(0, 0, 0, 0.1)',
  595. shadowBlur: 10
  596. }
  597. },
  598. itemStyle: {
  599. normal: {
  600. color: 'rgb(140,50,219)',
  601. borderColor: 'rgba(140,50,219,0.2)',
  602. borderWidth: 12
  603. }
  604. },
  605. },
  606. {
  607. areaStyle: {
  608. normal: {
  609. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  610. offset: 0,
  611. color: 'rgba(202,50,219,0.3)'
  612. }, {
  613. offset: 0.8,
  614. color: 'rgba(219, 50, 51, 0)'
  615. }], false),
  616. shadowColor: 'rgba(0, 0, 0, 0.1)',
  617. shadowBlur: 10
  618. }
  619. },
  620. itemStyle: {
  621. normal: {
  622. color: 'rgb(202,50,219)',
  623. borderColor: 'rgba(202,50,219,0.2)',
  624. borderWidth: 12
  625. }
  626. },
  627. },
  628. {
  629. areaStyle: {
  630. normal: {
  631. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  632. offset: 0,
  633. color: 'rgba(50,199,219,0.3)'
  634. }, {
  635. offset: 0.8,
  636. color: 'rgba(219, 50, 51, 0)'
  637. }], false),
  638. shadowColor: 'rgba(0, 0, 0, 0.1)',
  639. shadowBlur: 10
  640. }
  641. },
  642. itemStyle: {
  643. normal: {
  644. color: 'rgb(50,199,219)',
  645. borderColor: 'rgba(50,199,219,0.2)',
  646. borderWidth: 12
  647. }
  648. },
  649. },
  650. {
  651. areaStyle: {
  652. normal: {
  653. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  654. offset: 0,
  655. color: 'rgba(219,143,50,0.3)'
  656. }, {
  657. offset: 0.8,
  658. color: 'rgba(219, 50, 51, 0)'
  659. }], false),
  660. shadowColor: 'rgba(0, 0, 0, 0.1)',
  661. shadowBlur: 10
  662. }
  663. },
  664. itemStyle: {
  665. normal: {
  666. color: 'rgb(219,143,50)',
  667. borderColor: 'rgba(219,143,50,0.2)',
  668. borderWidth: 12
  669. }
  670. },
  671. }
  672. ],
  673. lineColor: '#3b3b3b',
  674. }
  675. },
  676. created() {
  677. this.getStationCode()
  678. },
  679. mounted() {
  680. },
  681. beforeDestroy() {
  682. if (!this.fsChart) {
  683. return
  684. }
  685. this.fsChart.dispose()
  686. this.fsChart = null
  687. },
  688. computed: {},
  689. methods: {
  690. stationCodeFormat({cellValue, row, column}) {
  691. const item = this.stationList.find(item => item.value === cellValue)
  692. return item ? item.label : ''
  693. },
  694. handlePageChange({currentPage, pageSize}) {
  695. this.currentPage = currentPage
  696. this.pageSize = pageSize
  697. },
  698. exportFile(){
  699. if (this.tableData.length>0){
  700. const item = this.stationList.find(item => item.value === this.stationCode)
  701. let filename = item.label
  702. // 文件名日期
  703. let startTime = this.$moment(this.dateTime).format('YYYY-MM-DD')
  704. filename=filename+startTime
  705. this.$refs.xTable.exportData({
  706. filename: filename,
  707. type: 'csv',
  708. isHeader: true,
  709. isFooter: true,
  710. data: this.tableData
  711. })
  712. }
  713. else{
  714. this.$message.error("列表无数据不能导出文件!")
  715. return
  716. }
  717. },
  718. async dataQuery() {
  719. if (this.dateTime==undefined){
  720. this.$message.warning('请选择生成日期')
  721. return
  722. }
  723. let genDate = Math.round(this.dateTime)
  724. this.loading = true
  725. let queryParams = {
  726. "stationCode": this.stationCode,
  727. "genDate": genDate,
  728. }
  729. this.$axios.get('/nwp/queryTableData', {params: queryParams}).then(response => {
  730. this.tableData = response.data.tableList
  731. this.total = response.data.tableList.length
  732. let stationType = response.data.stationType
  733. let timeList = response.data.timeList
  734. let radiationData = response.data.radiationData
  735. if (stationType=='E1'){
  736. // 光伏
  737. this.drawGf(timeList,radiationData)
  738. }
  739. else{
  740. // 风电
  741. this.drawFd(timeList,radiationData)
  742. }
  743. this.loading = false
  744. }).catch(() => {
  745. this.loading = false
  746. })
  747. },
  748. timeFormat({ cellValue, row, column }) {
  749. return this.$moment(cellValue).format('YYYY-MM-DD HH:mm')
  750. },
  751. getStationCode() {
  752. this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
  753. this.stationList = response.data
  754. if (this.stationList.length > 0) {
  755. this.stationCode = this.stationList[0].value
  756. this.dataQuery()
  757. }
  758. })
  759. },
  760. // 画光伏场辐射图
  761. drawGf(timeaxis, radiationData) {
  762. var globalR = []
  763. var directR = []
  764. var diffuseR = []
  765. if (radiationData != null) {
  766. if (radiationData.globalRs != null) {
  767. globalR = radiationData.globalRs
  768. }
  769. if (radiationData.directRs != null) {
  770. directR = radiationData.directRs
  771. }
  772. if (radiationData.diffuseRs != null) {
  773. diffuseR = radiationData.diffuseRs
  774. }
  775. }
  776. this.fsChart = echarts.init(document.getElementById('fscharts'),'dark')
  777. this.fsChart.setOption({}, true)
  778. this.fsChart.setOption({
  779. backgroundColor: 'transparent',
  780. title: {
  781. top: 20,
  782. text: 'NWP辐照度',
  783. textStyle: {
  784. fontWeight: 'normal',
  785. fontSize: 16,
  786. // color: this.lineColor
  787. },
  788. left: '1%'
  789. },
  790. tooltip: {
  791. confine: true,
  792. trigger: 'axis',
  793. axisPointer: {
  794. lineStyle: {
  795. color: '#57617B'
  796. }
  797. }
  798. },
  799. legend: {
  800. left:'center',
  801. top: 20,
  802. icon: 'rect',
  803. itemWidth: 14,
  804. itemHeight: 5,
  805. itemGap: 13,
  806. data: ['总辐射', '直辐射', '散辐射'],
  807. right: '4%',
  808. textStyle: {
  809. fontSize: 12,
  810. // color: this.lineColor
  811. },
  812. selected: {
  813. '总辐射': true,
  814. '直辐射': true,
  815. '散辐射': true,
  816. }
  817. },
  818. dataZoom: [{
  819. show: false,
  820. realtime: true,
  821. start: 0,
  822. end: 100,
  823. left: "15%",
  824. right: "15%",
  825. // textStyle: {
  826. // color: this.lineColor
  827. // }
  828. }, {
  829. type: 'inside'
  830. }],
  831. grid: {
  832. top: 100,
  833. left: '2%',
  834. right: '2%',
  835. bottom: '10%',
  836. containLabel: true
  837. },
  838. xAxis: [{
  839. type: 'category',
  840. boundaryGap: false,
  841. // axisLine: {
  842. // lineStyle: {
  843. // color: this.lineColor
  844. // }
  845. // },
  846. data: timeaxis
  847. }],
  848. yAxis: [{
  849. type: 'value',
  850. name: '瓦/平方米',
  851. axisTick: {
  852. show: false
  853. },
  854. // axisLine: {
  855. // lineStyle: {
  856. // color: this.lineColor
  857. // }
  858. // },
  859. axisLabel: {
  860. margin: 10,
  861. textStyle: {
  862. fontSize: 14
  863. }
  864. },
  865. splitLine: {
  866. lineStyle: {
  867. color: '#57617B'
  868. }
  869. }
  870. }],
  871. series: [{
  872. name: '总辐射',
  873. type: 'line',
  874. smooth: true,
  875. symbol: 'circle',
  876. symbolSize: 5,
  877. showSymbol: false,
  878. connectNulls: true,
  879. lineStyle: {
  880. normal: {
  881. width: 2
  882. }
  883. },
  884. itemStyle: {
  885. normal: {
  886. color: 'rgb(219,50,51)',
  887. borderColor: 'rgba(219,50,51,0.2)',
  888. borderWidth: 12
  889. }
  890. },
  891. data: globalR
  892. },
  893. {
  894. name: '直辐射',
  895. type: 'line',
  896. smooth: true,
  897. symbol: 'circle',
  898. symbolSize: 5,
  899. showSymbol: false,
  900. connectNulls: true,
  901. lineStyle: {
  902. normal: {
  903. width: 2
  904. }
  905. },
  906. itemStyle: {
  907. normal: {
  908. color: 'rgb(0,136,212)',
  909. borderColor: 'rgba(0,136,212,0.2)',
  910. borderWidth: 12
  911. }
  912. },
  913. data: directR
  914. },
  915. {
  916. name: '散辐射',
  917. type: 'line',
  918. smooth: true,
  919. symbol: 'circle',
  920. connectNulls: true,
  921. symbolSize: 5,
  922. showSymbol: false,
  923. lineStyle: {
  924. normal: {
  925. width: 2
  926. }
  927. },
  928. itemStyle: {
  929. normal: {
  930. color: 'rgb(137,189,27)',
  931. borderColor: 'rgba(137,189,2,0.27)',
  932. borderWidth: 12
  933. }
  934. },
  935. data: diffuseR
  936. },
  937. ]
  938. })
  939. },
  940. // 画风电场风速图
  941. drawFd(timeaxis, radiationData) {
  942. this.fsChart = echarts.init(document.getElementById('fscharts'),'dark')
  943. this.fsChart.setOption({}, true)
  944. let option = {
  945. backgroundColor: 'transparent',
  946. title: {
  947. top: 20,
  948. text: 'NWP风速',
  949. textStyle: {
  950. fontWeight: 'normal',
  951. fontSize: 16,
  952. // color: this.lineColor
  953. },
  954. left: '1%'
  955. },
  956. tooltip: {
  957. confine: true,
  958. trigger: 'axis',
  959. axisPointer: {
  960. lineStyle: {
  961. color: '#57617B'
  962. }
  963. }
  964. },
  965. legend: {
  966. left:'center',
  967. top: 20,
  968. width: '70%',
  969. icon: 'rect',
  970. itemWidth: 14,
  971. itemHeight: 5,
  972. itemGap: 13,
  973. data: [],
  974. right: '4%',
  975. textStyle: {
  976. fontSize: 12,
  977. // color: this.lineColor
  978. },
  979. selected: {}
  980. },
  981. dataZoom: [{
  982. show: false,
  983. realtime: true,
  984. start: 0,
  985. end: 100,
  986. left: "15%",
  987. right: "15%",
  988. // textStyle: {
  989. // color: this.lineColor
  990. // }
  991. }, {
  992. type: 'inside'
  993. }],
  994. grid: {
  995. top: 100,
  996. left: '2%',
  997. right: '2%',
  998. bottom: '10%',
  999. containLabel: true
  1000. },
  1001. xAxis: [{
  1002. type: 'category',
  1003. boundaryGap: false,
  1004. // axisLine: {
  1005. // lineStyle: {
  1006. // color: this.lineColor
  1007. // }
  1008. // },
  1009. data: timeaxis
  1010. }],
  1011. yAxis: [{
  1012. type: 'value',
  1013. name: 'm/s',
  1014. axisTick: {
  1015. show: false
  1016. },
  1017. // axisLine: {
  1018. // lineStyle: {
  1019. // color: this.lineColor
  1020. // }
  1021. // },
  1022. axisLabel: {
  1023. margin: 10,
  1024. textStyle: {
  1025. fontSize: 14,
  1026. // color: this.lineColor
  1027. },
  1028. formatter: '{value}',
  1029. },
  1030. splitLine: {
  1031. lineStyle: {
  1032. color: '#57617B'
  1033. }
  1034. }
  1035. }],
  1036. series: []
  1037. }
  1038. var index = 0;
  1039. for (var key in radiationData) {
  1040. for (let i=0;i<radiationData[key].length;i++){
  1041. radiationData[key][i] = radiationData[key][i]==-99?null:radiationData[key][i]
  1042. }
  1043. option.legend.data.push(key)
  1044. var sValue = {
  1045. name: '',
  1046. type: 'line',
  1047. smooth: false,
  1048. symbol: 'circle',
  1049. symbolSize: 5,
  1050. showSymbol: false,
  1051. lineStyle: {
  1052. normal: {
  1053. width: 2
  1054. }
  1055. },
  1056. itemStyle: {},
  1057. data: []
  1058. }
  1059. sValue.name = key
  1060. sValue.data = radiationData[key]
  1061. sValue.itemStyle = this.lineStyle[index].itemStyle
  1062. sValue.connectNulls = true
  1063. option.series.push(sValue)
  1064. index++;
  1065. }
  1066. this.fsChart.setOption(option, true)
  1067. var _this = this
  1068. window.addEventListener("resize", function () {
  1069. _this.fsChart.resize();
  1070. });
  1071. },
  1072. },
  1073. }
  1074. </script>