powergrid.vue 9.1 KB

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