index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <view class="power">
  3. <view class="home_header">
  4. <view class="header_message">
  5. <image src="../../static/jnImage/indexPage/message.png"></image>
  6. </view>
  7. <view class="header_title">
  8. <image src="../../static/jnImage/loginPage/logo.png" mode=""></image>
  9. <text class="titleName">晋能新能源蒙东分公司</text>
  10. </view>
  11. <view class="header_more">
  12. <image src="../../static/jnImage/indexPage/more.png"></image>
  13. </view>
  14. </view>
  15. <view class="power_main">
  16. <view class="flex justify-center">
  17. <view class="power_tab">
  18. <text v-for="(item,index) in powerTabData" :key="index" @click="changePowerTab(item)"
  19. :style="item.showColor ? 'background: #4287FF;color:#fff': ''">{{item.nameZN}}</text>
  20. </view>
  21. </view>
  22. <view class="fdwcl" v-if="powerTab === 'DL'">
  23. <view class="flex justify-between">
  24. <view class="fdwcl_title flex justify-center">
  25. <image src="../../static/jnImage/powerPage/powerTu.png" mode=""></image>
  26. <text>发电完成率</text>
  27. </view>
  28. <view class="yearTab">
  29. <text v-for="(item,index) in yearData" :key="index" @click="changeYearTab(item)"
  30. :style="item.showColor ? 'background: #4287FF;color:#fff': ''">{{item.nameZN}}</text>
  31. </view>
  32. </view>
  33. <view class="fdwcl_DataAll" v-for="(item,index) in powerProgressData" :key="index">
  34. <view class="fdwcl_Data flex justify-between">
  35. <view class="fdwcl_Data_1 flex">
  36. <image src="../../static/jnImage/indexPage/windIcon.png" mode=""></image>
  37. <text>{{item.inPower}}万kWh</text>
  38. </view>
  39. <view class="fdwcl_Data_2">
  40. <text>{{item.name}}</text>
  41. </view>
  42. <view class="fdwcl_Data_3">
  43. <text>{{item.allPower}}万kWh</text>
  44. </view>
  45. </view>
  46. <view class="fdwcl_Data_msg">
  47. <view class="show_msg" :style="showProgress(item, index)">
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="ycdl" v-else>
  53. <view class="ycdl_msg" v-for="(item,index) in 3" :key="index">
  54. <view class="ycdl_title flex">
  55. <image src="../../static/jnImage/powerPage/clock.png" mode=""></image>
  56. <text>11月22日</text>
  57. <text>预测电量</text>
  58. </view>
  59. <view class="ycdl_data">
  60. <uni-row class="ycdl_data_row">
  61. <uni-col :span="12" v-for="(item,index) in powerProgressData" :key="index">
  62. <view class="ycdl_data_col flex">
  63. <view class="ycdl_data_col_left">
  64. <text>{{item.name}}</text>
  65. </view>
  66. <view class="ycdl_data_col_right flex justify-between">
  67. <text>{{item.inPower}}</text>
  68. <text>MW</text>
  69. </view>
  70. </view>
  71. </uni-col>
  72. </uni-row>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="rdldb" v-if="powerTab === 'DL'">
  77. <view class="rdldb_title flex justify-center">
  78. <image src="../../static/jnImage/powerPage/powerDayIcon.png" mode=""></image>
  79. <text>日电量对比</text>
  80. </view>
  81. <view class="qiun-charts">
  82. <qiun-data-charts type="column" :opts="opts" :chartData="chartData" />
  83. </view>
  84. </view>
  85. <view class="xsfsgl" v-else>
  86. <view class="xsfsgl_title flex justify-center">
  87. <image src="../../static/jnImage/powerPage/72clock.png" mode=""></image>
  88. <text>72小时风速功率</text>
  89. </view>
  90. <view class="qiun-chartsLine">
  91. <qiun-data-charts type="mix" :opts="optsLine" :chartData="chartDataLine" />
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. // import * as echarts from 'echarts'
  99. // import uCharts from '../../components/u-charts/u-charts.js';
  100. // import qCharts from '../../components/u-charts/component.vue';
  101. var uChartsInstance = {};
  102. export default {
  103. onLoad: function() {},
  104. data() {
  105. return {
  106. powerTab: 'DL',
  107. yearTab: 'month',
  108. powerTabData: [],
  109. yearData: [],
  110. powerProgressData: [],
  111. chartData: {},
  112. chartDataLine: {},
  113. opts: {},
  114. optsLine: {},
  115. }
  116. },
  117. created() {
  118. this.powerTabData = [{
  119. nameZN: '电量',
  120. nameEN: 'DL',
  121. showColor: true
  122. },
  123. {
  124. nameZN: '预测',
  125. nameEN: 'YC',
  126. showColor: false
  127. }
  128. ]
  129. this.yearData = [{
  130. nameZN: '月',
  131. nameEN: 'month',
  132. showColor: true
  133. },
  134. {
  135. nameZN: '年',
  136. nameEN: 'year',
  137. showColor: false
  138. }
  139. ],
  140. this.powerProgressData = [{
  141. type: 'wind',
  142. inPower: 961,
  143. allPower: 1865,
  144. name: '宝龙山'
  145. },
  146. {
  147. type: 'wind',
  148. inPower: 852,
  149. allPower: 1865,
  150. name: '乌力吉'
  151. },
  152. {
  153. type: 'wind',
  154. inPower: 696,
  155. allPower: 1865,
  156. name: '浩日格吐'
  157. },
  158. {
  159. type: 'wind',
  160. inPower: 527,
  161. allPower: 1865,
  162. name: '开鲁'
  163. },
  164. {
  165. type: 'wind',
  166. inPower: 935,
  167. allPower: 1865,
  168. name: '景观'
  169. },
  170. {
  171. type: 'wind',
  172. inPower: 1022,
  173. allPower: 1865,
  174. name: '高力板'
  175. },
  176. {
  177. type: 'wind',
  178. inPower: 752,
  179. allPower: 1865,
  180. name: '书声'
  181. },
  182. {
  183. type: 'wind',
  184. inPower: 1520,
  185. allPower: 1865,
  186. name: '宝力根花'
  187. },
  188. {
  189. type: 'wind',
  190. inPower: 365.6,
  191. allPower: 1865,
  192. name: '振发'
  193. },
  194. ]
  195. },
  196. onReady() {
  197. this.getPowerBar()
  198. },
  199. methods: {
  200. getPowerBar() {
  201. let opts = {
  202. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  203. "#ea7ccc"
  204. ],
  205. padding: [15, 15, 0, 5],
  206. enableScroll: false,
  207. legend: {
  208. show: false
  209. },
  210. xAxis: {
  211. disableGrid: true,
  212. rotateLabel: true,
  213. axisLineColor: "#A49EAC",
  214. fontColor: "#A49EAC",
  215. fontSize: 10,
  216. marginTop: 5
  217. },
  218. yAxis: {
  219. showTitle: true,
  220. data: [{
  221. min: 0,
  222. fontColor: "#A49EAC",
  223. title: "(万kwh)",
  224. titleFontColor: "#A49EAC",
  225. titleFontSize: 10
  226. }]
  227. },
  228. extra: {
  229. column: {
  230. type: "group",
  231. width: 15,
  232. activeBgColor: "#000000",
  233. activeBgOpacity: 0.08
  234. }
  235. }
  236. }
  237. let proColor = ['#6C4B9E', '#323A97', '#4951B2', '#4287FF', '#3CB8FE', '#1AA7B5', '#5183B6', '#9F65C1',
  238. '#766FF1', '#4951B2',
  239. ]
  240. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  241. let xAxis = []
  242. let series = []
  243. this.powerProgressData.forEach((item, index) => {
  244. xAxis.push(item.name)
  245. let obj = {
  246. color: '',
  247. name: '',
  248. textSize: 10,
  249. textColor: "#A49EAC",
  250. value: item.inPower
  251. }
  252. proColor.forEach((it, idx) => {
  253. if (index.toString().length > 1) {
  254. obj.color = proColor[index.toString().slice(-1)]
  255. } else {
  256. obj.color = proColor[index]
  257. }
  258. })
  259. series.push(obj)
  260. })
  261. let res = {
  262. categories: xAxis,
  263. series: [{
  264. data: series
  265. }]
  266. };
  267. this.opts = opts
  268. this.chartData = JSON.parse(JSON.stringify(res));
  269. },
  270. getLineBar() {
  271. let opts = {
  272. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  273. "#ea7ccc"
  274. ],
  275. padding: [15, 15, 0, 5],
  276. enableScroll: false,
  277. legend: {
  278. show: true
  279. },
  280. xAxis: {
  281. disableGrid: true,
  282. axisLineColor: "#A49EAC",
  283. fontColor: "#A49EAC",
  284. fontSize: 10,
  285. marginTop: 5
  286. },
  287. yAxis: {
  288. showTitle: true,
  289. disabled: false,
  290. disableGrid: false,
  291. splitNumber: 5,
  292. gridType: "dash",
  293. dashLength: 4,
  294. gridColor: "#CCCCCC",
  295. padding: 10,
  296. data: [{
  297. position: "left",
  298. title: "折线",
  299. fontColor: "#A49EAC",
  300. titleFontColor: "#A49EAC",
  301. titleFontSize: 10
  302. },
  303. {
  304. position: "right",
  305. min: 0,
  306. max: 200,
  307. title: "点",
  308. textAlign: "left",
  309. fontColor: "#A49EAC",
  310. titleFontColor: "#A49EAC",
  311. titleFontSize: 10
  312. }
  313. ]
  314. },
  315. extra: {
  316. mix: {
  317. column: {
  318. width: 20
  319. }
  320. }
  321. }
  322. }
  323. let proColor = ['#6C4B9E', '#323A97', '#4951B2', '#4287FF', '#3CB8FE', '#1AA7B5', '#5183B6', '#9F65C1',
  324. '#766FF1', '#4951B2',
  325. ]
  326. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  327. let res = {
  328. categories: ["2018", "2019", "2020", "2021", "2022", "2023"],
  329. series: [{
  330. name: "折线",
  331. type: "line",
  332. color: "#2fc25b",
  333. data: [150, 186, 205, 155, 96, 84]
  334. },
  335. {
  336. name: "折线",
  337. type: "line",
  338. color: "#2fc25b",
  339. data: [120, 140, 105, 170, 95, 160]
  340. },
  341. {
  342. name: "点",
  343. index: 2,
  344. type: "point",
  345. color: "#f04864",
  346. data: [100, 80, 125, 150, 112, 132]
  347. }
  348. ]
  349. };
  350. this.optsLine = opts
  351. this.chartDataLine = JSON.parse(JSON.stringify(res));
  352. },
  353. changePowerTab(item) {
  354. this.powerTabData.forEach(it => {
  355. it.showColor = false
  356. if (it.nameEN === item.nameEN) {
  357. item.showColor = true
  358. this.powerTab = it.nameEN
  359. }
  360. })
  361. if (this.powerTab === 'DL') {
  362. this.getPowerBar()
  363. } else {
  364. this.getLineBar()
  365. }
  366. },
  367. changeYearTab(item) {
  368. this.yearData.forEach(it => {
  369. it.showColor = false
  370. if (it.nameEN === item.nameEN) {
  371. item.showColor = true
  372. this.yearTab = it.nameEN
  373. }
  374. })
  375. },
  376. showProgress(item, index) {
  377. let indexX = index
  378. if (index > 9) {
  379. indexX = index - 9
  380. }
  381. let proColor = ['#6C4B9E', '#323A97', '#4951B2', '#4287FF', '#3CB8FE', '#1AA7B5', '#5183B6', '#9F65C1',
  382. '#766FF1'
  383. ]
  384. let pro = ((item.inPower / item.allPower).toFixed(2)) * 100 + '%'
  385. let showColor = proColor[indexX]
  386. let ss = `width: ${pro};background: ${showColor}`
  387. return ss
  388. },
  389. },
  390. }
  391. </script>
  392. <style lang="scss">
  393. page {
  394. background-color: #202246;
  395. }
  396. .power {
  397. width: 100vw;
  398. background: url('../../static/jnImage/loginPage/windBack.png'), url('../../static/jnImage/loginPage/backWav.png');
  399. background-repeat: no-repeat, repeat;
  400. background-size: 100% 260px, 100% 5px;
  401. .home_header {
  402. width: calc(100% -32px);
  403. display: flex;
  404. justify-content: space-between;
  405. height: 60px;
  406. padding-top: 16px;
  407. // position: fixed;
  408. .header_message {
  409. width: 15%;
  410. image {
  411. position: relative;
  412. top: 0px;
  413. left: 10px;
  414. width: 30px;
  415. height: 30px;
  416. }
  417. }
  418. .header_title {
  419. width: 70%;
  420. position: relative;
  421. left: 10px;
  422. image {
  423. width: 28px;
  424. height: 22px;
  425. position: relative;
  426. top: 5px;
  427. }
  428. .titleName {
  429. line-height: 20px;
  430. margin-left: 5px;
  431. font-size: 36upx;
  432. font-family: FZZhengHeiS-M-GB;
  433. font-weight: 600;
  434. letter-spacing: 2px;
  435. color: #fff;
  436. }
  437. }
  438. .header_more {
  439. width: 15%;
  440. position: relative;
  441. top: 5px;
  442. left: 10px;
  443. image {
  444. width: 30px;
  445. height: 20px;
  446. }
  447. }
  448. }
  449. .power_main {
  450. padding: 0 20px;
  451. .power_tab {
  452. text {
  453. display: inline-block;
  454. width: 80px;
  455. height: 25px;
  456. border: 1px solid #4287FF;
  457. text-align: center;
  458. color: #4287FF;
  459. line-height: 25px;
  460. letter-spacing: 2px;
  461. }
  462. }
  463. .fdwcl {
  464. .fdwcl_title {
  465. width: 130px;
  466. height: 45px;
  467. padding-left: 10px;
  468. margin-top: 10px;
  469. background: linear-gradient(90deg, #333976, #202246);
  470. align-items: center;
  471. image {
  472. width: 24px;
  473. height: 22px;
  474. }
  475. text {
  476. margin-left: 10px;
  477. font-size: 16px;
  478. color: #fff;
  479. }
  480. }
  481. .yearTab {
  482. width: 80px;
  483. height: 25px;
  484. border-radius: 20px;
  485. background: #0B143E;
  486. margin-top: 20px;
  487. text {
  488. display: inline-block;
  489. width: 40px;
  490. height: 25px;
  491. border-radius: 20px;
  492. text-align: center;
  493. color: #4287FF;
  494. line-height: 25px;
  495. }
  496. }
  497. .fdwcl_DataAll {
  498. margin-top: 10px;
  499. .fdwcl_Data {
  500. .fdwcl_Data_1 {
  501. image {
  502. width: 18px;
  503. height: 18px;
  504. }
  505. text {
  506. margin-left: 5px;
  507. font-size: 28upx;
  508. color: #A49EAC;
  509. position: relative;
  510. top: 0px;
  511. }
  512. }
  513. .fdwcl_Data_2 {
  514. text {
  515. font-size: 32upx;
  516. color: #A49EAC;
  517. }
  518. }
  519. .fdwcl_Data_3 {
  520. text {
  521. font-size: 28upx;
  522. color: #A49EAC;
  523. }
  524. }
  525. }
  526. .fdwcl_Data_msg {
  527. width: 100%;
  528. height: 20px;
  529. border-radius: 5px;
  530. background: #0B143E;
  531. .show_msg {
  532. height: 20px;
  533. background: #6C4B9E;
  534. border-radius: 5px 0 0 5px;
  535. }
  536. }
  537. }
  538. }
  539. .rdldb {
  540. padding-bottom: 20px;
  541. .rdldb_title {
  542. width: 130px;
  543. height: 45px;
  544. padding-left: 10px;
  545. margin-top: 10px;
  546. background: linear-gradient(90deg, #333976, #202246);
  547. align-items: center;
  548. image {
  549. width: 24px;
  550. height: 22px;
  551. }
  552. text {
  553. margin-left: 10px;
  554. font-size: 16px;
  555. color: #fff;
  556. }
  557. }
  558. .qiun-charts {
  559. width: 100%;
  560. height: 300px;
  561. margin: 10px 0;
  562. }
  563. }
  564. .ycdl {
  565. margin-top: 10px;
  566. .ycdl_msg {
  567. .ycdl_title {
  568. image {
  569. width: 15px;
  570. height: 15px;
  571. position: relative;
  572. top: 3px;
  573. }
  574. text {
  575. font-size: 32upx;
  576. color: #676D9C;
  577. margin-left: 10px;
  578. }
  579. }
  580. .ycdl_data {
  581. margin-top: 5px;
  582. .ycdl_data_row {
  583. .ycdl_data_col {
  584. width: 98%;
  585. height: 20px;
  586. margin-bottom: 5px;
  587. background: #2E336D;
  588. border-radius: 5px;
  589. .ycdl_data_col_left {
  590. width: 50%;
  591. height: 20px;
  592. color: #fff;
  593. font-size: 30upx;
  594. background: #3F4572;
  595. border-radius: 5px;
  596. text {
  597. margin-left: 5px;
  598. }
  599. }
  600. .ycdl_data_col_right {
  601. height: 20px;
  602. color: #fff;
  603. font-size: 32upx;
  604. width: 48%;
  605. text:nth-of-type(1) {
  606. margin-left: 5px;
  607. width: 50%;
  608. font-size: 32upx;
  609. color: #fff;
  610. position: relative;
  611. top: 3px;
  612. }
  613. text:nth-of-type(2) {
  614. font-size: 22upx;
  615. color: #96B5D5;
  616. position: relative;
  617. top: 4px;
  618. }
  619. }
  620. }
  621. }
  622. }
  623. }
  624. }
  625. .xsfsgl {
  626. padding-bottom: 20px;
  627. .xsfsgl_title {
  628. width: 160px;
  629. height: 45px;
  630. padding-left: 10px;
  631. margin-top: 10px;
  632. background: linear-gradient(90deg, #333976, #202246);
  633. align-items: center;
  634. image {
  635. width: 24px;
  636. height: 22px;
  637. }
  638. text {
  639. margin-left: 10px;
  640. font-size: 16px;
  641. color: #fff;
  642. }
  643. }
  644. .qiun-chartsLine {
  645. width: 100%;
  646. height: 300px;
  647. margin: 10px 0;
  648. }
  649. }
  650. }
  651. }
  652. </style>