index.vue 30 KB

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