index.vue 16 KB

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