index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  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>万MW</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. padding: [15, 15, 0, 5],
  219. enableScroll: false,
  220. legend: {
  221. show: false
  222. },
  223. xAxis: {
  224. disableGrid: true,
  225. rotateLabel: true,
  226. rotateAngle: 90,
  227. axisLineColor: "#A49EAC",
  228. fontColor: "#A49EAC",
  229. fontSize: 10,
  230. marginTop: 5
  231. },
  232. yAxis: {
  233. showTitle: true,
  234. data: [{
  235. min: 0,
  236. fontColor: "#A49EAC",
  237. title: "(万kwh)",
  238. titleFontColor: "#A49EAC",
  239. titleFontSize: 10
  240. }]
  241. },
  242. extra: {
  243. column: {
  244. type: "group",
  245. width: 15,
  246. activeBgColor: "#000000",
  247. activeBgOpacity: 0.08
  248. }
  249. }
  250. }
  251. let proColor = ['#6C4B9E', '#323A97', '#4951B2', '#4287FF', '#3CB8FE', '#1AA7B5', '#5183B6', '#9F65C1',
  252. '#766FF1', '#4951B2',
  253. ]
  254. let xAxis = []
  255. let series = []
  256. allData.forEach((item, index) => {
  257. xAxis.push(item.wpname)
  258. let obj = {
  259. color: '',
  260. name: '',
  261. textSize: 10,
  262. textColor: "#A49EAC",
  263. value: item.rjhdl.toFixed(2)
  264. }
  265. proColor.forEach((it, idx) => {
  266. if (index.toString().length > 1) {
  267. obj.color = proColor[index.toString().slice(-1)]
  268. } else {
  269. obj.color = proColor[index]
  270. }
  271. })
  272. series.push(obj)
  273. })
  274. let res = {
  275. categories: xAxis,
  276. series: [{
  277. name: '日计划电量',
  278. textColor: "#FFFFFF",
  279. textSize: 6,
  280. data: series
  281. }]
  282. };
  283. this.opts = opts
  284. this.chartData = JSON.parse(JSON.stringify(res));
  285. },
  286. //获取公司预测电量
  287. getCompanyEleData() {
  288. let that = this
  289. bulletinappForecastApi({
  290. type: 0,
  291. wpId: '1'
  292. }).then(res => {
  293. if (res && res.data) {
  294. for (let i in res.data) {
  295. let obj = {
  296. date: res.data[i][0].recordDate,
  297. values: res.data[i]
  298. }
  299. that.powerFulterData.push(obj)
  300. }
  301. }
  302. })
  303. },
  304. showStationZH(stationId) {
  305. let allStation = [...this.windData, ...this.powerData]
  306. let str = ''
  307. allStation.forEach(item => {
  308. if (item.wpid === stationId) {
  309. str = item.wpname
  310. }
  311. })
  312. return str
  313. },
  314. // 获取公司24小时功率预测
  315. getcockpitPowercurve() {
  316. let that = this
  317. cockpitPowercurve24Api({
  318. wpId: 'KGDL_FGS0'
  319. }).then(res => {
  320. if (res && res.data) {
  321. this.getLineBar(res.data)
  322. }
  323. })
  324. },
  325. getLineBar(values) {
  326. let opts = {
  327. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  328. "#ea7ccc"
  329. ],
  330. padding: [15, 15, 0, 5],
  331. enableScroll: false,
  332. legend: {
  333. show: true
  334. },
  335. xAxis: {
  336. disableGrid: true,
  337. rotateLabel: true,
  338. rotateAngle: 90,
  339. axisLineColor: "#A49EAC",
  340. fontColor: "#A49EAC",
  341. fontSize: 10,
  342. marginTop: 5
  343. },
  344. yAxis: {
  345. showTitle: true,
  346. disabled: false,
  347. disableGrid: false,
  348. splitNumber: 5,
  349. gridType: "dash",
  350. dashLength: 4,
  351. gridColor: "#CCCCCC",
  352. padding: 10,
  353. data: [{
  354. position: "left",
  355. title: "MW",
  356. fontColor: "#A49EAC",
  357. titleFontColor: "#A49EAC",
  358. titleFontSize: 10
  359. }]
  360. },
  361. extra: {
  362. mix: {
  363. column: {
  364. width: 20
  365. }
  366. }
  367. }
  368. }
  369. let sjglArr = []
  370. let ycglArr = []
  371. let xAxisArr = []
  372. if (values.length > 0) {
  373. values.forEach((item, index) => {
  374. xAxisArr.push(this.changTimeSV(index + 1))
  375. sjglArr.push(item.sjgl)
  376. ycglArr.push(item.bzgl)
  377. })
  378. }
  379. let res = {
  380. categories: xAxisArr,
  381. series: [{
  382. name: "实际功率",
  383. type: "line",
  384. textColor: "#FFFFFF",
  385. textSize: 6,
  386. data: sjglArr
  387. },
  388. {
  389. name: "预测功率",
  390. type: "line",
  391. textColor: "#FFFFFF",
  392. textSize: 6,
  393. data: ycglArr
  394. }
  395. ]
  396. };
  397. this.optsLine = opts
  398. this.chartDataLine = JSON.parse(JSON.stringify(res));
  399. },
  400. changTimeSV(date) {
  401. let str = ''
  402. if (date < 10) {
  403. str = '0' + date + ':00'
  404. } else {
  405. str = date + ':00'
  406. }
  407. return str
  408. },
  409. changePowerTab(item) {
  410. this.powerTabData.forEach(it => {
  411. it.showColor = false
  412. if (it.nameEN === item.nameEN) {
  413. item.showColor = true
  414. this.powerTab = it.nameEN
  415. }
  416. })
  417. if (this.powerTab === 'DL') {
  418. this.getCompanyData()
  419. } else {
  420. this.getCompanyEleData()
  421. this.getcockpitPowercurve()
  422. }
  423. },
  424. changeYearTab(item) {
  425. this.powerProgressData = []
  426. this.yearData.forEach(it => {
  427. it.showColor = false
  428. if (it.nameEN === item.nameEN) {
  429. item.showColor = true
  430. this.yearTab = it.nameEN
  431. }
  432. })
  433. this.getCompanyData()
  434. },
  435. showProgress(item, index) {
  436. let indexX = index
  437. if (index > 9) {
  438. indexX = index - 9
  439. }
  440. let proColor = ['#6C4B9E', '#323A97', '#4951B2', '#4287FF', '#3CB8FE', '#1AA7B5', '#5183B6', '#9F65C1',
  441. '#766FF1'
  442. ]
  443. let pro = ((item.inPower / item.allPower).toFixed(2)) * 100
  444. if (pro > 100) {
  445. pro = '100%'
  446. } else {
  447. pro = pro + '%'
  448. }
  449. let showColor = proColor[indexX]
  450. let ss = `width: ${pro};background: ${showColor}`
  451. return ss
  452. },
  453. },
  454. }
  455. </script>
  456. <style lang="scss">
  457. page {
  458. background-color: #202246;
  459. }
  460. .power {
  461. width: 100vw;
  462. background: url('../../static/jnImage/loginPage/windBack.png'), url('../../static/jnImage/loginPage/backWav.png');
  463. background-repeat: no-repeat, repeat;
  464. background-size: 100% 260px, 100% 5px;
  465. .power_main {
  466. padding: 0 20px;
  467. .power_tab {
  468. text {
  469. display: inline-block;
  470. width: 80px;
  471. height: 25px;
  472. border: 1px solid #4287FF;
  473. text-align: center;
  474. color: #4287FF;
  475. line-height: 25px;
  476. letter-spacing: 2px;
  477. }
  478. }
  479. .fdwcl {
  480. .fdwcl_title {
  481. width: 130px;
  482. height: 45px;
  483. padding-left: 10px;
  484. margin-top: 10px;
  485. background: linear-gradient(90deg, #333976, transparent);
  486. align-items: center;
  487. image {
  488. width: 24px;
  489. height: 22px;
  490. }
  491. text {
  492. margin-left: 10px;
  493. font-size: 16px;
  494. color: #fff;
  495. }
  496. }
  497. .yearTab {
  498. width: 80px;
  499. height: 25px;
  500. border-radius: 20px;
  501. background: #0B143E;
  502. margin-top: 20px;
  503. text {
  504. display: inline-block;
  505. width: 40px;
  506. height: 25px;
  507. border-radius: 20px;
  508. text-align: center;
  509. color: #4287FF;
  510. line-height: 25px;
  511. }
  512. }
  513. .fdwcl_DataAll {
  514. margin-top: 10px;
  515. .fdwcl_Data {
  516. .fdwcl_Data_1 {
  517. image {
  518. width: 18px;
  519. height: 18px;
  520. }
  521. text {
  522. margin-left: 5px;
  523. font-size: 28upx;
  524. color: #A49EAC;
  525. position: relative;
  526. top: 0px;
  527. }
  528. }
  529. .fdwcl_Data_2 {
  530. text {
  531. font-size: 32upx;
  532. color: #A49EAC;
  533. }
  534. }
  535. .fdwcl_Data_3 {
  536. text {
  537. font-size: 28upx;
  538. color: #A49EAC;
  539. }
  540. }
  541. }
  542. .fdwcl_Data_msg {
  543. width: 100%;
  544. height: 20px;
  545. border-radius: 5px;
  546. background: #0B143E;
  547. .show_msg {
  548. height: 20px;
  549. background: #6C4B9E;
  550. border-radius: 5px 0 0 5px;
  551. }
  552. }
  553. }
  554. }
  555. .rdldb {
  556. padding-bottom: 20px;
  557. .rdldb_title {
  558. width: 130px;
  559. height: 45px;
  560. padding-left: 10px;
  561. margin-top: 10px;
  562. background: linear-gradient(90deg, #333976, transparent);
  563. align-items: center;
  564. image {
  565. width: 24px;
  566. height: 22px;
  567. }
  568. text {
  569. margin-left: 10px;
  570. font-size: 16px;
  571. color: #fff;
  572. }
  573. }
  574. .qiun-charts {
  575. width: 100%;
  576. height: 300px;
  577. margin: 10px 0;
  578. }
  579. }
  580. .ycdl {
  581. margin-top: 10px;
  582. .ycdl_msg {
  583. .ycdl_title {
  584. image {
  585. width: 15px;
  586. height: 15px;
  587. position: relative;
  588. top: 3px;
  589. }
  590. text {
  591. font-size: 32upx;
  592. color: #676D9C;
  593. margin-left: 10px;
  594. }
  595. }
  596. .ycdl_data {
  597. margin-top: 5px;
  598. .ycdl_data_row {
  599. .ycdl_data_col {
  600. width: 98%;
  601. height: 20px;
  602. margin-bottom: 5px;
  603. background: #2E336D;
  604. border-radius: 5px;
  605. .ycdl_data_col_left {
  606. width: 50%;
  607. height: 20px;
  608. color: #fff;
  609. font-size: 30upx;
  610. background: #3F4572;
  611. border-radius: 5px;
  612. text {
  613. margin-left: 5px;
  614. width: 100%;
  615. display: inline-block;
  616. overflow: hidden;
  617. white-space: nowrap;
  618. text-overflow: ellipsis;
  619. }
  620. }
  621. .ycdl_data_col_right {
  622. height: 20px;
  623. color: #fff;
  624. font-size: 32upx;
  625. width: 48%;
  626. text:nth-of-type(1) {
  627. margin-left: 5px;
  628. width: 50%;
  629. font-size: 32upx;
  630. color: #fff;
  631. position: relative;
  632. top: 3px;
  633. }
  634. text:nth-of-type(2) {
  635. font-size: 22upx;
  636. color: #96B5D5;
  637. position: relative;
  638. top: 4px;
  639. }
  640. }
  641. }
  642. }
  643. }
  644. }
  645. }
  646. .xsfsgl {
  647. padding-bottom: 20px;
  648. .xsfsgl_title {
  649. width: 160px;
  650. height: 45px;
  651. padding-left: 10px;
  652. margin-top: 10px;
  653. background: linear-gradient(90deg, #333976, transparent);
  654. align-items: center;
  655. image {
  656. width: 24px;
  657. height: 22px;
  658. }
  659. text {
  660. margin-left: 10px;
  661. font-size: 16px;
  662. color: #fff;
  663. }
  664. }
  665. .qiun-chartsLine {
  666. width: 100%;
  667. height: 300px;
  668. margin: 10px 0;
  669. }
  670. }
  671. }
  672. }
  673. </style>