stationIndex.vue 16 KB

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