index.vue 13 KB

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