forecasting-detail.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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" :sortable="true" v-for="key in columns" :key="key" :label="key">
  56. <el-table-column align="center" :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" :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 :prop="`${key}_confidence`" label="置信度">
  67. <template slot-scope="scope">
  68. {{ scope.row[`${key}_confidence`] ? scope.row[`${key}_confidence`] + '%' : '---' }}
  69. </template>
  70. </el-table-column> -->
  71. </el-table-column>
  72. </el-table>
  73. </div>
  74. <el-dialog :visible.sync="chartVisiable1" title="预测结果详情" width="800">
  75. <div id="accumulatedrainfallChart1" style="width: 100%; height: 600px"></div>
  76. <span slot="footer" class="dialog-footer">
  77. <el-button @click="chartVisiable1 = false">返回</el-button>
  78. </span>
  79. </el-dialog>
  80. </div>
  81. </template>
  82. <script>
  83. import * as echarts from 'echarts';
  84. import publicMixins from '../publicMixins.js';
  85. export default {
  86. mixins: [publicMixins],
  87. data() {
  88. return {
  89. dataList: [],
  90. dataListLoading: false,
  91. chartVisiable1: false,
  92. columns: [],
  93. };
  94. },
  95. props: ['parent'],
  96. methods: {
  97. init(id) {
  98. this.getDataList(id);
  99. },
  100. // 获取数据列表
  101. getDataList(id) {
  102. this.dataListLoading = true;
  103. this.$http({
  104. url: `/voltageLoad/predictList/${id}`,
  105. method: 'get',
  106. }).then(({ data }) => {
  107. if (data && data.code === 0) {
  108. this.dataList = data.data.map(ite => {
  109. const keys = Object.keys(ite.predictions);
  110. this.columns = keys;
  111. keys.forEach(key => {
  112. ite[`${key}_peakLoad`] = ite.predictions[key].peakLoad;
  113. ite[`${key}_loadRate`] = ite.predictions[key].loadRate;
  114. ite[`${key}_confidence`] = ite.predictions[key].confidence;
  115. });
  116. return ite;
  117. });
  118. } else {
  119. this.dataList = [];
  120. }
  121. this.dataListLoading = false;
  122. });
  123. },
  124. // 统计接口
  125. handleClick(row) {
  126. this.chartVisiable1 = !this.chartVisiable1;
  127. this.$nextTick(() => {
  128. var accumulatedrainfallChart1 = echarts.init(document.getElementById('accumulatedrainfallChart1'), 'carp');
  129. accumulatedrainfallChart1.setOption({
  130. legend: {
  131. data: ['最大负荷', '最大负荷率'],
  132. },
  133. grid: { bottom: 20 },
  134. color: ['#0977fd'],
  135. tooltip: { trigger: 'axis', backgroundColor: 'transparent' },
  136. xAxis: {
  137. type: 'category',
  138. data: this.columns.reverse(),
  139. },
  140. yAxis: [
  141. {
  142. name: 'MW',
  143. nameTextStyle: {
  144. color: '#333',
  145. },
  146. type: 'value',
  147. },
  148. {
  149. name: '%',
  150. nameTextStyle: {
  151. color: '#333',
  152. },
  153. type: 'value',
  154. },
  155. ],
  156. series: [
  157. {
  158. name: '最大负荷',
  159. data: this.columns.reverse().map(key => row[`${key}_peakLoad`]),
  160. type: 'line',
  161. yAxisIndex: 0,
  162. },
  163. {
  164. name: '最大负荷率',
  165. data: this.columns.reverse().map(key => row[`${key}_loadRate`]),
  166. type: 'line',
  167. yAxisIndex: 1,
  168. },
  169. // {
  170. // name: '置信度',
  171. // data: this.columns.map(key => row[`${key}_confidence`]),
  172. // type: 'line',
  173. // yAxisIndex: 1,
  174. // },
  175. ],
  176. });
  177. });
  178. },
  179. search() {
  180. this.pageIndex = 1;
  181. this.getDataList();
  182. },
  183. // 返回
  184. back() {
  185. this.parent.showForecastingFlag = false;
  186. this.resetForm();
  187. },
  188. },
  189. };
  190. </script>
  191. <style lang="scss" scoped>
  192. @import '@/assets/css/page.scss';
  193. ::v-deep {
  194. .el-table__header-wrapper thead tr th {
  195. border-color: #f0f0f0 !important;
  196. border-width: 1px !important;
  197. text-align: center !important;
  198. }
  199. .el-table__body-wrapper tbody tr td {
  200. border-width: 1px !important;
  201. }
  202. .el-table .el-table__cell.is-center {
  203. text-align: center;
  204. }
  205. .el-table__body-wrapper tbody tr:hover td {
  206. text-align: center !important;
  207. }
  208. .el-table__header-wrapper thead tr th .cell {
  209. justify-content: center !important;
  210. }
  211. }
  212. </style>