right.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <div>
  3. <CusModule title="上网电价">
  4. <div class="elec-index">
  5. <div class="panel-content" v-for="item, index in priceList" :key="index">
  6. <div class="image-container">
  7. <img :src="require(`@/assets/images/net/price${index + 1}.svg`)" alt="">
  8. </div>
  9. <div class="whitespace-pre">
  10. <span class="value">{{ item.value }}</span>
  11. <span class="unit">{{ item.unit }}</span>
  12. <div class="label">{{ item.name }}</div>
  13. </div>
  14. </div>
  15. </div>
  16. </CusModule>
  17. <CusModule class="module-top" title="上网收益">
  18. <BaseChart height="300px" width="100%" :option="barOptions"/>
  19. </CusModule>
  20. <CusModule class="module-top" title="今年购电费用">
  21. <BaseChart height="300px" width="100%" :option="lineOptions"/>
  22. </CusModule>
  23. </div>
  24. </template>
  25. <script>
  26. import CusModule from '../components/CusModule.vue';
  27. import BaseChart from '@/components/BaseChart/index.vue'
  28. import vueSeamlessScroll from 'vue-seamless-scroll'
  29. import {array2Map} from '@/utils';
  30. import * as echarts from 'echarts'
  31. import {mapState} from 'vuex';
  32. import {getPvPriceConfig} from "@/api/basecfg/elecPvPrice";
  33. import {pgSupplyMonthTotalPg, pgSupplyMonthTotalPv} from "@/api/screen";
  34. import {DateTool} from "@/utils/DateTool";
  35. export default {
  36. name: 'NetRight',
  37. data() {
  38. return {
  39. priceList: [
  40. {
  41. name: "余电上网电价",
  42. unit: "元/度",
  43. },
  44. {
  45. name: "脱硫煤电价",
  46. unit: "元/度",
  47. },
  48. {
  49. name: "国家补贴",
  50. unit: "元/度",
  51. },
  52. {
  53. name: "地方补贴",
  54. unit: "元/度",
  55. },
  56. ],
  57. barData: [],
  58. lineData: []
  59. }
  60. },
  61. components: {
  62. CusModule,
  63. BaseChart,
  64. vueSeamlessScroll
  65. },
  66. computed: {
  67. ...mapState('userState', ['areaType']),
  68. barOptions() {
  69. const xData = this.barData.map(item => item.xData)
  70. const line = this.barData.map(item => item.yData);
  71. return {
  72. tooltip: {
  73. trigger: 'item',
  74. },
  75. grid: {
  76. left: '5%',
  77. top: '10%',
  78. right: '5%',
  79. bottom: 0,
  80. containLabel: true
  81. },
  82. legend: {
  83. show: false,
  84. },
  85. xAxis: {
  86. data: xData,
  87. axisLabel: {
  88. margin: 10, //刻度标签与轴线之间的距离。
  89. },
  90. axisLine: {
  91. show: false //不显示x轴
  92. },
  93. axisTick: {
  94. show: false //不显示刻度
  95. },
  96. boundaryGap: true,
  97. splitLine: {
  98. show: false,
  99. }
  100. },
  101. yAxis: [{
  102. name: '万元',
  103. splitLine: {
  104. show: true,
  105. lineStyle: {
  106. color: '#334E5E'
  107. }
  108. },
  109. axisTick: {
  110. show: false
  111. },
  112. axisLine: {
  113. show: false
  114. },
  115. axisLabel: {
  116. textStyle: {
  117. color: '#888'
  118. },
  119. }
  120. }],
  121. series: [
  122. {//柱底圆片
  123. name: "",
  124. type: "pictorialBar",
  125. symbolSize: [20, 15],
  126. symbolOffset: [0, 5],
  127. z: 12,
  128. itemStyle: {
  129. normal: {
  130. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  131. offset: 0,
  132. color: "rgba(89,211,255,1)"
  133. },
  134. {
  135. offset: 1,
  136. color: "rgba(23,237,194,1)"
  137. }
  138. ])
  139. }
  140. },
  141. data: line
  142. },
  143. //柱体
  144. {
  145. name: '',
  146. type: 'bar',
  147. barWidth: 20,
  148. barGap: '0%',
  149. itemStyle: {
  150. normal: {
  151. color: {
  152. x: 0,
  153. y: 0,
  154. x2: 0,
  155. y2: 1,
  156. type: "linear",
  157. global: false,
  158. colorStops: [{//第一节下面
  159. offset: 0,
  160. color: "rgba(0,255,245,0.5)"
  161. }, {
  162. offset: 1,
  163. color: "#43bafe"
  164. }]
  165. }
  166. }
  167. },
  168. data: line
  169. },
  170. //柱顶圆片
  171. {
  172. name: "",
  173. type: "pictorialBar",
  174. symbolSize: [20, 15],
  175. symbolOffset: [0, -5],
  176. z: 12,
  177. symbolPosition: "end",
  178. itemStyle: {
  179. normal: {
  180. color: new echarts.graphic.LinearGradient(0, 0, 0, 1,
  181. [{
  182. offset: 0,
  183. color: "rgba(89,211,255,1)"
  184. },
  185. {
  186. offset: 1,
  187. color: "rgba(23,237,194,1)"
  188. }
  189. ],
  190. false
  191. ),
  192. }
  193. },
  194. data: line
  195. }
  196. ]
  197. };
  198. },
  199. lineOptions() {
  200. return {
  201. legend: {
  202. show: false,
  203. },
  204. grid: {
  205. top: '10%'
  206. },
  207. tooltip: {
  208. trigger: "axis",
  209. },
  210. yAxis: {
  211. name: "万元",
  212. splitLine: {
  213. show: true,
  214. lineStyle: {
  215. color: '#334E5E'
  216. }
  217. },
  218. },
  219. xAxis: {
  220. splitLine: {
  221. show: false,
  222. },
  223. data: this.lineData.map(item => item.xData),
  224. },
  225. series: [
  226. {
  227. type: 'line',
  228. name: "费用",
  229. smooth: true,
  230. lineStyle: {
  231. normal: {
  232. color: "#80DBE1", // 线条颜色
  233. },
  234. },
  235. itemStyle: {
  236. color: "#80DBE1",
  237. borderColor: "#fff",
  238. borderWidth: 3
  239. },
  240. areaStyle: { //区域填充样式
  241. normal: {
  242. //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。
  243. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  244. offset: 0,
  245. color: "rgba(81, 139, 152,0.8)"
  246. },
  247. {
  248. offset: 1,
  249. color: "rgba(81, 139, 152, 0)"
  250. }
  251. ], false),
  252. shadowColor: 'rgba(81, 139, 152, 0.5)', //阴影颜色
  253. shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
  254. }
  255. },
  256. data: this.lineData.map(item => item.yData),
  257. },
  258. ],
  259. }
  260. }
  261. },
  262. watch: {
  263. areaType() {
  264. this.getNetData()
  265. }
  266. },
  267. mounted() {
  268. this.getNetData()
  269. this.timer && clearInterval(this.timer)
  270. this.timer = setInterval(() => {
  271. this.getNetData()
  272. }, 60000 * 3)
  273. },
  274. beforeDestroy() {
  275. this.timer && clearInterval(this.timer)
  276. },
  277. methods: {
  278. getNetData() {
  279. this.pgSupplyMonthTotalPv()
  280. this.pgSupplyMonthTotalPg()
  281. this.qryGwPriceConfig()
  282. },
  283. async qryGwPriceConfig() {
  284. const {data} = await getPvPriceConfig(1)
  285. if (!data) {
  286. return;
  287. }
  288. const [lessPrice, oriPrice, state, local] = this.priceList
  289. lessPrice.value = data.objPrice + data.stateSubsidy + data.localSubsidy
  290. oriPrice.value = data.objPrice
  291. state.value = data.stateSubsidy
  292. local.value = data.localSubsidy
  293. this.priceList = [lessPrice, oriPrice, state, local]
  294. },
  295. async pgSupplyMonthTotalPv() {
  296. const {data} = await pgSupplyMonthTotalPv({
  297. startRecTime: DateTool.nearYearStartDay(),
  298. endRecTime: DateTool.now(),
  299. areaCode: this.areaType,
  300. })
  301. if (!data) {
  302. return;
  303. }
  304. const month = DateTool.getMonthsOfYearAgo()
  305. const indexMap = array2Map(data, "startRecTime")
  306. this.barData = month.map(item => (
  307. {
  308. xData: item.substring(2),
  309. yData: indexMap[item] ? (indexMap[item].upElecEarn / 10000).toFixed(1) : 0
  310. }
  311. ))
  312. },
  313. async pgSupplyMonthTotalPg() {
  314. const thisThisYearStart = `${DateTool.now(DateTool.DateFormat.YYYY)}-01-01`
  315. const {data} = await pgSupplyMonthTotalPg({
  316. startRecTime: thisThisYearStart,
  317. endRecTime: DateTool.now(),
  318. areaCode: this.areaType,
  319. })
  320. if (!data) {
  321. return;
  322. }
  323. const month = DateTool.getMonthsOfYearAgo()
  324. const indexMap = array2Map(data, "startRecTime")
  325. this.lineData = month.map(item => (
  326. {
  327. xData: item.substring(2),
  328. yData: indexMap[item] ? (indexMap[item].useElecCost / 10000).toFixed(1) : 0
  329. }
  330. ))
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang='scss' scoped>
  336. @import url("../index.scss");
  337. .elec-index {
  338. display: flex;
  339. flex-wrap: wrap;
  340. justify-content: space-between;
  341. padding: 10px 0 0;
  342. .panel-content {
  343. margin-top: 12px;
  344. flex-basis: 48%;
  345. height: 75px;
  346. color: #B3E3E8;
  347. background: url('~@/assets/images/home/l2_item_bg.png') no-repeat;
  348. background-size: 100% 100%;
  349. display: flex;
  350. .whitespace-pre {
  351. margin-top: 15px;
  352. margin-left: 10px;
  353. span.value {
  354. font-size: 18px;
  355. font-weight: bold;
  356. }
  357. }
  358. .label {
  359. margin-top: 5px;
  360. font-size: 14px;
  361. }
  362. .image-container {
  363. width: 65px;
  364. display: flex;
  365. align-items: center;
  366. justify-content: center;
  367. img {
  368. height: 24px;
  369. margin-bottom: 5px;
  370. }
  371. }
  372. }
  373. }
  374. .equip {
  375. display: flex;
  376. justify-content: space-between;
  377. margin-top: 20px;
  378. .equip-item {
  379. display: flex;
  380. flex-direction: column;
  381. align-items: center;
  382. background: #1B4A64;
  383. color: #B3E3E8;
  384. border-radius: 4px;
  385. padding: 5px 13px;
  386. font-size: 14px;
  387. > div:first-of-type {
  388. span:first-of-type {
  389. font-size: 18px;
  390. font-weight: bold;
  391. }
  392. }
  393. }
  394. }
  395. .pie-chart {
  396. margin: 30px;
  397. height: 201px;
  398. background: url("~@/assets/images/device/l1-pie_bg.png") no-repeat;
  399. background-position: center;
  400. }
  401. .seamless-header {
  402. margin-top: 20px;
  403. display: flex;
  404. align-items: center;
  405. justify-content: space-between;
  406. padding: 5px 10px;
  407. color: #7DBAFF;
  408. background: #1B4A64;
  409. font-size: 16px;
  410. > div:first-of-type,
  411. > div:last-of-type {
  412. flex-basis: 35%;
  413. }
  414. > div {
  415. text-align: center;
  416. }
  417. }
  418. .seamless-warp {
  419. overflow: hidden;
  420. height: 200px;
  421. .seamless-item {
  422. display: flex;
  423. align-items: center;
  424. justify-content: space-between;
  425. padding: 5px 0;
  426. &:nth-child(odd) {
  427. background: #000;
  428. }
  429. > div:first-of-type,
  430. > div:last-of-type {
  431. flex-basis: 38%;
  432. }
  433. > div {
  434. text-align: center;
  435. font-size: 13px;
  436. }
  437. }
  438. }
  439. </style>