index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  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>{{itv.dayPowerForecast}}</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. axisLineColor: "#A49EAC",
  339. fontColor: "#A49EAC",
  340. fontSize: 10,
  341. marginTop: 5
  342. },
  343. yAxis: {
  344. showTitle: true,
  345. disabled: false,
  346. disableGrid: false,
  347. splitNumber: 5,
  348. gridType: "dash",
  349. dashLength: 4,
  350. gridColor: "#CCCCCC",
  351. padding: 10,
  352. data: [{
  353. position: "left",
  354. title: "MW",
  355. fontColor: "#A49EAC",
  356. titleFontColor: "#A49EAC",
  357. titleFontSize: 10
  358. }]
  359. },
  360. extra: {
  361. mix: {
  362. column: {
  363. width: 20
  364. }
  365. }
  366. }
  367. }
  368. let sjglArr = []
  369. let ycglArr = []
  370. let xAxisArr = []
  371. if (values.length > 0) {
  372. values.forEach((item, index) => {
  373. xAxisArr.push(this.changTimeSV(index + 1))
  374. sjglArr.push(item.sjgl)
  375. ycglArr.push(item.bzgl)
  376. })
  377. }
  378. let res = {
  379. categories: xAxisArr,
  380. series: [{
  381. name: "实际功率",
  382. type: "line",
  383. color: "#25a1ff",
  384. data: sjglArr
  385. },
  386. {
  387. name: "预测功率",
  388. type: "line",
  389. color: "#bc39aa",
  390. data: ycglArr
  391. }
  392. ]
  393. };
  394. this.optsLine = opts
  395. this.chartDataLine = JSON.parse(JSON.stringify(res));
  396. },
  397. changTimeSV(date) {
  398. let str = ''
  399. if (date < 10) {
  400. str = '0' + date + ':00'
  401. } else {
  402. str = date + ':00'
  403. }
  404. return str
  405. },
  406. changePowerTab(item) {
  407. this.powerTabData.forEach(it => {
  408. it.showColor = false
  409. if (it.nameEN === item.nameEN) {
  410. item.showColor = true
  411. this.powerTab = it.nameEN
  412. }
  413. })
  414. if (this.powerTab === 'DL') {
  415. this.getCompanyData()
  416. } else {
  417. this.getCompanyEleData()
  418. this.getcockpitPowercurve()
  419. }
  420. },
  421. changeYearTab(item) {
  422. this.powerProgressData = []
  423. this.yearData.forEach(it => {
  424. it.showColor = false
  425. if (it.nameEN === item.nameEN) {
  426. item.showColor = true
  427. this.yearTab = it.nameEN
  428. }
  429. })
  430. this.getCompanyData()
  431. },
  432. showProgress(item, index) {
  433. let indexX = index
  434. if (index > 9) {
  435. indexX = index - 9
  436. }
  437. let proColor = ['#6C4B9E', '#323A97', '#4951B2', '#4287FF', '#3CB8FE', '#1AA7B5', '#5183B6', '#9F65C1',
  438. '#766FF1'
  439. ]
  440. let pro = ((item.inPower / item.allPower).toFixed(2)) * 100
  441. if (pro > 100) {
  442. pro = '100%'
  443. } else {
  444. pro = pro + '%'
  445. }
  446. let showColor = proColor[indexX]
  447. let ss = `width: ${pro};background: ${showColor}`
  448. return ss
  449. },
  450. },
  451. }
  452. </script>
  453. <style lang="scss">
  454. page {
  455. background-color: #202246;
  456. }
  457. .power {
  458. width: 100vw;
  459. background: url('../../static/jnImage/loginPage/windBack.png'), url('../../static/jnImage/loginPage/backWav.png');
  460. background-repeat: no-repeat, repeat;
  461. background-size: 100% 260px, 100% 5px;
  462. .power_main {
  463. padding: 0 20px;
  464. .power_tab {
  465. text {
  466. display: inline-block;
  467. width: 80px;
  468. height: 25px;
  469. border: 1px solid #4287FF;
  470. text-align: center;
  471. color: #4287FF;
  472. line-height: 25px;
  473. letter-spacing: 2px;
  474. }
  475. }
  476. .fdwcl {
  477. .fdwcl_title {
  478. width: 130px;
  479. height: 45px;
  480. padding-left: 10px;
  481. margin-top: 10px;
  482. background: linear-gradient(90deg, #333976, transparent);
  483. align-items: center;
  484. image {
  485. width: 24px;
  486. height: 22px;
  487. }
  488. text {
  489. margin-left: 10px;
  490. font-size: 16px;
  491. color: #fff;
  492. }
  493. }
  494. .yearTab {
  495. width: 80px;
  496. height: 25px;
  497. border-radius: 20px;
  498. background: #0B143E;
  499. margin-top: 20px;
  500. text {
  501. display: inline-block;
  502. width: 40px;
  503. height: 25px;
  504. border-radius: 20px;
  505. text-align: center;
  506. color: #4287FF;
  507. line-height: 25px;
  508. }
  509. }
  510. .fdwcl_DataAll {
  511. margin-top: 10px;
  512. .fdwcl_Data {
  513. .fdwcl_Data_1 {
  514. image {
  515. width: 18px;
  516. height: 18px;
  517. }
  518. text {
  519. margin-left: 5px;
  520. font-size: 28upx;
  521. color: #A49EAC;
  522. position: relative;
  523. top: 0px;
  524. }
  525. }
  526. .fdwcl_Data_2 {
  527. text {
  528. font-size: 32upx;
  529. color: #A49EAC;
  530. }
  531. }
  532. .fdwcl_Data_3 {
  533. text {
  534. font-size: 28upx;
  535. color: #A49EAC;
  536. }
  537. }
  538. }
  539. .fdwcl_Data_msg {
  540. width: 100%;
  541. height: 20px;
  542. border-radius: 5px;
  543. background: #0B143E;
  544. .show_msg {
  545. height: 20px;
  546. background: #6C4B9E;
  547. border-radius: 5px 0 0 5px;
  548. }
  549. }
  550. }
  551. }
  552. .rdldb {
  553. padding-bottom: 20px;
  554. .rdldb_title {
  555. width: 130px;
  556. height: 45px;
  557. padding-left: 10px;
  558. margin-top: 10px;
  559. background: linear-gradient(90deg, #333976, transparent);
  560. align-items: center;
  561. image {
  562. width: 24px;
  563. height: 22px;
  564. }
  565. text {
  566. margin-left: 10px;
  567. font-size: 16px;
  568. color: #fff;
  569. }
  570. }
  571. .qiun-charts {
  572. width: 100%;
  573. height: 300px;
  574. margin: 10px 0;
  575. }
  576. }
  577. .ycdl {
  578. margin-top: 10px;
  579. .ycdl_msg {
  580. .ycdl_title {
  581. image {
  582. width: 15px;
  583. height: 15px;
  584. position: relative;
  585. top: 3px;
  586. }
  587. text {
  588. font-size: 32upx;
  589. color: #676D9C;
  590. margin-left: 10px;
  591. }
  592. }
  593. .ycdl_data {
  594. margin-top: 5px;
  595. .ycdl_data_row {
  596. .ycdl_data_col {
  597. width: 98%;
  598. height: 20px;
  599. margin-bottom: 5px;
  600. background: #2E336D;
  601. border-radius: 5px;
  602. .ycdl_data_col_left {
  603. width: 50%;
  604. height: 20px;
  605. color: #fff;
  606. font-size: 30upx;
  607. background: #3F4572;
  608. border-radius: 5px;
  609. text {
  610. margin-left: 5px;
  611. width: 100%;
  612. display: inline-block;
  613. overflow: hidden;
  614. white-space: nowrap;
  615. text-overflow: ellipsis;
  616. }
  617. }
  618. .ycdl_data_col_right {
  619. height: 20px;
  620. color: #fff;
  621. font-size: 32upx;
  622. width: 48%;
  623. text:nth-of-type(1) {
  624. margin-left: 5px;
  625. width: 50%;
  626. font-size: 32upx;
  627. color: #fff;
  628. position: relative;
  629. top: 3px;
  630. }
  631. text:nth-of-type(2) {
  632. font-size: 22upx;
  633. color: #96B5D5;
  634. position: relative;
  635. top: 4px;
  636. }
  637. }
  638. }
  639. }
  640. }
  641. }
  642. }
  643. .xsfsgl {
  644. padding-bottom: 20px;
  645. .xsfsgl_title {
  646. width: 160px;
  647. height: 45px;
  648. padding-left: 10px;
  649. margin-top: 10px;
  650. background: linear-gradient(90deg, #333976, transparent);
  651. align-items: center;
  652. image {
  653. width: 24px;
  654. height: 22px;
  655. }
  656. text {
  657. margin-left: 10px;
  658. font-size: 16px;
  659. color: #fff;
  660. }
  661. }
  662. .qiun-chartsLine {
  663. width: 100%;
  664. height: 300px;
  665. margin: 10px 0;
  666. }
  667. }
  668. }
  669. }
  670. </style>