forecasting-detail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="addEdit-block">
  3. <div
  4. :style="{
  5. border: '0px solid #fff',
  6. width: '100%',
  7. padding: '0 20px 20px',
  8. fontSize: '14px',
  9. color: '#000',
  10. background: '#fff',
  11. }"
  12. >
  13. <el-row
  14. class="actions"
  15. :style="{
  16. padding: '10px',
  17. paddingLeft: '0',
  18. margin: '0px 0',
  19. flexWrap: 'wrap',
  20. background: 'none',
  21. display: 'flex',
  22. }"
  23. >
  24. <el-button class="add" @click="back()"> 返回 </el-button>
  25. </el-row>
  26. <el-table
  27. class="tables"
  28. :stripe="false"
  29. :style="{
  30. padding: '0px 0',
  31. borderColor: '#f0f0f0',
  32. borderRadius: '0',
  33. borderWidth: '0px 0 0 1px',
  34. background: '#fff',
  35. width: '100%',
  36. fontSize: 'inherit',
  37. borderStyle: 'solid',
  38. }"
  39. :border="true"
  40. :data="dataList"
  41. v-loading="dataListLoading"
  42. >
  43. <!-- <el-table-column align="center" :resizable="true" :sortable="true" label="序号" type="index" width="110" /> -->
  44. <el-table-column align="center" :resizable="true" :sortable="true" prop="region" label="所属地区" />
  45. <el-table-column align="center" :resizable="true" :sortable="true" prop="substation" label="变电站名称">
  46. <template slot-scope="scope">
  47. <div style="color: #0977fd; text-decoration: underline; cursor: pointer" @click="handleClick(scope.row)">
  48. {{ scope.row.substation }}
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column align="center" :resizable="true" :sortable="true" prop="voltageLevel" label="电压等级" />
  53. <el-table-column align="center" :resizable="true" :sortable="true" prop="mainNum" label="主变台数" />
  54. <el-table-column align="center" :resizable="true" :sortable="true" width="180" prop="capacity" label="主变容量(MVA)" />
  55. <el-table-column align="center" :resizable="true" v-for="key in columns" :key="key" :label="key">
  56. <el-table-column align="center" :sortable="true" :prop="`${key}_peakLoad`" label="最大负荷">
  57. <template slot-scope="scope">
  58. {{ scope.row[`${key}_peakLoad`] ? scope.row[`${key}_peakLoad`] : '---' }}
  59. </template>
  60. </el-table-column>
  61. <el-table-column align="center" :sortable="true" :prop="`${key}_loadRate`" label="最大负荷率">
  62. <template slot-scope="scope">
  63. {{ scope.row[`${key}_loadRate`] ? scope.row[`${key}_loadRate`] + '%' : '---' }}
  64. </template>
  65. </el-table-column>
  66. </el-table-column>
  67. </el-table>
  68. </div>
  69. <el-dialog :visible.sync="chartVisiable1" title="预测结果详情" width="800">
  70. <div id="accumulatedrainfallChart1" style="width: 100%; height: 600px"></div>
  71. <span slot="footer" class="dialog-footer">
  72. <el-button @click="chartVisiable1 = false">返回</el-button>
  73. </span>
  74. </el-dialog>
  75. </div>
  76. </template>
  77. <script>
  78. import * as echarts from 'echarts';
  79. import publicMixins from '../publicMixins.js';
  80. export default {
  81. mixins: [publicMixins],
  82. data() {
  83. return {
  84. dataList: [],
  85. dataListLoading: false,
  86. chartVisiable1: false,
  87. columns: [],
  88. };
  89. },
  90. props: ['parent'],
  91. methods: {
  92. init(id) {
  93. this.getDataList(id);
  94. },
  95. // 获取数据列表
  96. getDataList(id) {
  97. this.dataListLoading = true;
  98. this.$http({
  99. url: `/voltageLoad/predictList/${id}`,
  100. method: 'get',
  101. }).then(({ data }) => {
  102. if (data && data.code === 0) {
  103. this.dataList = data.data.map(ite => {
  104. const keys = Object.keys(ite.predictions);
  105. this.columns = keys;
  106. keys.forEach(key => {
  107. ite[`${key}_peakLoad`] = ite.predictions[key].peakLoad;
  108. ite[`${key}_loadRate`] = ite.predictions[key].loadRate;
  109. ite[`${key}_confidence`] = ite.predictions[key].confidence;
  110. });
  111. return ite;
  112. });
  113. } else {
  114. this.dataList = [];
  115. }
  116. this.dataListLoading = false;
  117. });
  118. },
  119. // 统计接口
  120. handleClick(row) {
  121. this.chartVisiable1 = !this.chartVisiable1;
  122. this.$nextTick(() => {
  123. var accumulatedrainfallChart1 = echarts.init(document.getElementById('accumulatedrainfallChart1'), 'carp');
  124. accumulatedrainfallChart1.setOption({
  125. legend: {
  126. data: ['最大负荷', '最大负荷率'],
  127. },
  128. grid: { bottom: 20 },
  129. color: ['#0977fd'],
  130. tooltip: { trigger: 'axis', backgroundColor: 'transparent' },
  131. xAxis: {
  132. type: 'category',
  133. data: this.columns,
  134. },
  135. yAxis: [
  136. {
  137. name: 'MW',
  138. nameTextStyle: {
  139. color: '#333',
  140. },
  141. type: 'value',
  142. },
  143. {
  144. name: '%',
  145. nameTextStyle: {
  146. color: '#333',
  147. },
  148. type: 'value',
  149. },
  150. ],
  151. series: [
  152. {
  153. name: '最大负荷',
  154. data: this.columns.map(key => row[`${key}_peakLoad`]),
  155. type: 'line',
  156. yAxisIndex: 0,
  157. },
  158. {
  159. name: '最大负荷率',
  160. data: this.columns.map(key => row[`${key}_loadRate`]),
  161. type: 'line',
  162. yAxisIndex: 1,
  163. },
  164. // {
  165. // name: '置信度',
  166. // data: this.columns.map(key => row[`${key}_confidence`]),
  167. // type: 'line',
  168. // yAxisIndex: 1,
  169. // },
  170. ],
  171. });
  172. });
  173. },
  174. search() {
  175. this.pageIndex = 1;
  176. this.getDataList();
  177. },
  178. // 返回
  179. back() {
  180. this.parent.showForecastingFlag = false;
  181. this.resetForm();
  182. },
  183. },
  184. };
  185. </script>
  186. <style lang="scss" scoped>
  187. @import '@/assets/css/page.scss';
  188. ::v-deep {
  189. .el-table__header-wrapper thead tr th {
  190. border-color: #f0f0f0 !important;
  191. border-width: 1px !important;
  192. text-align: center !important;
  193. }
  194. .el-table__body-wrapper tbody tr td {
  195. border-width: 1px !important;
  196. }
  197. .el-table .el-table__cell.is-center {
  198. text-align: center;
  199. }
  200. .el-table__body-wrapper tbody tr:hover td {
  201. text-align: center !important;
  202. }
  203. .el-table__header-wrapper thead tr th .cell {
  204. justify-content: center !important;
  205. }
  206. }
  207. </style>