powergrid.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="activeName" @tab-click="getList">
  4. <el-tab-pane label="电网" name="first">
  5. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
  6. <el-form-item label="服务区" prop="areaCode">
  7. <el-select v-model="queryParams.areaCode" placeholder="请选择服务区" @change="handleQuery">
  8. <el-option v-for="item in areaOptions" :key="item.areaCode" :label="item.areaName" :value="item.areaCode" />
  9. </el-select>
  10. </el-form-item>
  11. </el-form>
  12. <BaseChart width="100%" height="300px" :option="elecOptions" />
  13. <el-table v-loading="loading" :data="pgSupplyHList">
  14. <el-table-column label="设施" align="center" prop="facsName" />
  15. <el-table-column label="日期" align="center" prop="date" width="180">
  16. <template slot-scope="scope">
  17. <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
  18. </template>
  19. </el-table-column>
  20. <el-table-column label="时间" align="center" prop="time">
  21. <template slot-scope="scope">
  22. <span>{{ scope.row.time }}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="计量类型" align="center" prop="meterType" >
  26. <template slot-scope="scope">
  27. <span>{{ getMeterTypeName(scope.row.meterType) }}</span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="单位电价" align="center" prop="meterUnitPrice" />
  31. <el-table-column label="供电量" align="center" prop="useElecQuantity" />
  32. <el-table-column label="供电电费" align="center" prop="useElecCost" />
  33. </el-table>
  34. </el-tab-pane>
  35. <el-tab-pane label="光伏" name="second">
  36. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
  37. <el-form-item label="服务区" prop="areaCode">
  38. <el-select v-model="queryParams.areaCode" placeholder="请选择服务区" @change="handleQuery">
  39. <el-option v-for="item in areaOptions" :key="item.areaCode" :label="item.areaName" :value="item.areaCode" />
  40. </el-select>
  41. </el-form-item>
  42. </el-form>
  43. <BaseChart width="100%" height="300px" :option="pvOptions" />
  44. <el-table v-loading="loading" :data="pvSupplyHList">
  45. <el-table-column label="设施" align="center" prop="facsName" />
  46. <el-table-column label="日期" align="center" prop="date" width="180">
  47. <template slot-scope="scope">
  48. <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="时间" align="center" prop="time">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.time }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="总发电量" align="center" prop="genElecQuantity" />
  57. <el-table-column label="自用电量" align="center" prop="useElecQuantity" />
  58. <el-table-column label="上网电量" align="center" prop="upElecQuantity" />
  59. <el-table-column label="上网收益" align="center" prop="upElecEarn" />
  60. </el-table>
  61. </el-tab-pane>
  62. </el-tabs>
  63. <!-- <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> -->
  64. </div>
  65. </template>
  66. <script>
  67. import { listPgSupplyH, listPvSupplyH } from '@/api/mgr/pgSupplyH'
  68. import BaseChart from '@/components/BaseChart'
  69. import { areaWithFacsCategory } from '@/api/basecfg/area'
  70. export default {
  71. name: 'PgSupplyH',
  72. dicts: ['meter_type'],
  73. components: {
  74. BaseChart
  75. },
  76. data() {
  77. return {
  78. activeName: 'first',
  79. // 遮罩层
  80. loading: true,
  81. // 总条数
  82. total: 0,
  83. facsCategory: '',
  84. facsSubCategory: '',
  85. pgSupplyHList: [],
  86. pvSupplyHList: [],
  87. // 查询参数
  88. queryParams: {
  89. areaCode: null
  90. },
  91. areaOptions: [],
  92. elecData: []
  93. }
  94. },
  95. computed: {
  96. elecOptions() {
  97. const xData = this.pgSupplyHList.map(item => item.time)
  98. const quantity = this.pgSupplyHList.map(item => item.useElecQuantity)
  99. const cost = this.pgSupplyHList.map(item => item.useElecCost)
  100. const option = {
  101. tooltip: {
  102. trigger: 'axis',
  103. axisPointer: {
  104. type: 'cross',
  105. crossStyle: {
  106. color: '#999'
  107. }
  108. }
  109. },
  110. legend: {
  111. data: ['供电量', '供电电费']
  112. },
  113. xAxis: {
  114. type: 'category',
  115. data: xData,
  116. axisPointer: {
  117. type: 'shadow'
  118. }
  119. },
  120. yAxis: [
  121. {
  122. name: 'kW-h(千瓦时)',
  123. type: 'value'
  124. },
  125. {
  126. name: '¥(元)',
  127. type: 'value'
  128. }
  129. ],
  130. series: [
  131. {
  132. name: '用电量',
  133. type: 'bar',
  134. data: quantity,
  135. barWidth: 30,
  136. itemStyle: {
  137. normal: {
  138. color: '#6395FA'
  139. }
  140. }
  141. },
  142. {
  143. name: '用电电费',
  144. type: 'line',
  145. yAxisIndex: 1,
  146. data: cost,
  147. showSymbol: true,
  148. itemStyle: {
  149. normal: {
  150. color: '#5BD9A5'
  151. }
  152. }
  153. }
  154. ]
  155. }
  156. return option
  157. },
  158. pvOptions() {
  159. const option = {
  160. tooltip: {
  161. trigger: 'axis',
  162. axisPointer: {
  163. type: 'cross',
  164. crossStyle: {
  165. color: '#999'
  166. }
  167. }
  168. },
  169. legend: {
  170. data: ['自用电量', '上网电量', '上网收益']
  171. },
  172. xAxis: {
  173. type: 'category',
  174. data: this.pvSupplyHList.map(item => item.time),
  175. axisPointer: {
  176. type: 'shadow'
  177. }
  178. },
  179. yAxis: [
  180. {
  181. name: 'kW-h(千瓦时)',
  182. type: 'value'
  183. },
  184. {
  185. name: '¥(元)',
  186. type: 'value'
  187. }
  188. ],
  189. series: [
  190. {
  191. name: '自用电量',
  192. type: 'bar',
  193. stack: '总数',
  194. barWidth: 30,
  195. label: {
  196. show: false,
  197. position: 'insideRight'
  198. },
  199. data: this.pvSupplyHList.map(item => item.useElecQuantity),
  200. itemStyle: {
  201. normal: {
  202. color: '#6395FA',
  203. label: {
  204. show: true, // 开启显示
  205. position: 'top', // 在上方显示
  206. textStyle: {
  207. // 数值样式
  208. color: '#000',
  209. fontSize: 14,
  210. fontWeight: 600
  211. }
  212. }
  213. }
  214. }
  215. },
  216. {
  217. name: '上网电量',
  218. type: 'bar',
  219. stack: '总数',
  220. barWidth: 30,
  221. label: {
  222. show: false,
  223. position: 'insideRight'
  224. },
  225. data: this.pvSupplyHList.map(item => item.upElecQuantity),
  226. itemStyle: {
  227. normal: {
  228. color: '#8CDF6C',
  229. label: {
  230. show: true, // 开启显示
  231. position: 'top', // 在上方显示
  232. textStyle: {
  233. // 数值样式
  234. color: '#000',
  235. fontSize: 14,
  236. fontWeight: 600
  237. }
  238. }
  239. }
  240. }
  241. },
  242. {
  243. name: '上网收益',
  244. type: 'line',
  245. yAxisIndex: 1,
  246. data: this.pvSupplyHList.map(item => item.upElecEarn),
  247. smooth: false
  248. }
  249. ]
  250. }
  251. return option
  252. }
  253. },
  254. async created() {
  255. this.facsCategory = 'W'
  256. await this.getAreaList()
  257. this.getList()
  258. },
  259. methods: {
  260. // 查询区域列表
  261. async getAreaList() {
  262. await areaWithFacsCategory(this.facsCategory, this.facsSubCategory).then(response => {
  263. this.areaOptions = response.data
  264. this.queryParams.areaCode = this.areaOptions[0].areaCode
  265. })
  266. },
  267. getList() {
  268. this.loading = true
  269. if (this.activeName === 'first') {
  270. areaWithFacsCategory('W', '')
  271. listPgSupplyH(this.queryParams).then(response => {
  272. this.pgSupplyHList = response.rows
  273. this.loading = false
  274. })
  275. } else {
  276. areaWithFacsCategory('E', '')
  277. listPvSupplyH(this.queryParams).then(response => {
  278. this.pvSupplyHList = response.data
  279. this.loading = false
  280. })
  281. }
  282. },
  283. /** 搜索按钮操作 */
  284. handleQuery() {
  285. this.getList()
  286. },
  287. getMeterTypeName(meterType) {
  288. const meterTypeMap = {
  289. '-1': '低谷电',
  290. '0': '平峰电',
  291. '1': '高峰点',
  292. '2': '尖峰电',
  293. };
  294. return meterTypeMap[meterType] || '平峰电';
  295. }
  296. }
  297. }
  298. </script>
  299. <style lang="scss" scoped>
  300. .app-container {
  301. ::v-deep .el-tabs__content {
  302. overflow: initial;
  303. }
  304. }
  305. </style>