index.vue 27 KB

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