index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="24">
  4. <!--用户数据-->
  5. <el-col :span="24" :xs="24">
  6. <el-form ref="queryForm" size="small" :inline="true" label-width="68px">
  7. <el-form-item label="起始时间" prop="startTime">
  8. <el-date-picker
  9. v-model="startTime"
  10. :clearable="false"
  11. type="datetime"
  12. value-format="timestamp"
  13. placeholder="选择日期">
  14. </el-date-picker>
  15. </el-form-item>
  16. <el-form-item label="截止时间" prop="endTime">
  17. <el-date-picker
  18. v-model="endTime"
  19. :clearable="false"
  20. type="datetime"
  21. value-format="timestamp"
  22. placeholder="选择日期">
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button type="primary" icon="el-icon-search" size="mini" @click="dateQuery">查询</el-button>
  27. </el-form-item>
  28. </el-form>
  29. </el-col>
  30. </el-row>
  31. <div class="content">
  32. <el-tabs type="card" v-model="activeName" @tab-click="Byresize">
  33. <el-tab-pane label="图表" name="first">
  34. <chart :drawData = this.drawData :resizeKey=this.resizeKey />
  35. </el-tab-pane>
  36. <el-tab-pane label="表格" name="second">
  37. <div class="tableContent">
  38. <vxe-table
  39. id="fstTable"
  40. ref="fstRef"
  41. border
  42. export-config
  43. beforeExportMethod=""
  44. :auto-resize="true"
  45. highlight-hover-row
  46. max-height="90%"
  47. align="center"
  48. :data="tableData">
  49. <vxe-table-column field="forecastTime" title="预测时间" :formatter="dateFormat" width="250" sortable min-width="250"></vxe-table-column>
  50. <vxe-table-column field="fpValue" title="预测功率" min-width="60" ></vxe-table-column>
  51. </vxe-table>
  52. <vxe-pager
  53. v-show="showTable"
  54. perfect
  55. :current-page.sync="currentPage"
  56. :page-size.sync="pageSize"
  57. :total="total"
  58. :page-sizes="[10,50,100]"
  59. :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
  60. @page-change="handlePageChange"
  61. >
  62. </vxe-pager>
  63. </div>
  64. <!-- <Table height="100%" width="100%" :queryTime=this.queryTime @sendLoading="getLoadingFormTable"></Table>-->
  65. </el-tab-pane>
  66. </el-tabs>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import Chart from './charts'
  72. import resize from '../../../components/Charts/mixins/resize'
  73. import moment from "moment";
  74. export default {
  75. name: 'nwp',
  76. components: { Chart},
  77. mixins: [resize],
  78. data(){
  79. return{
  80. showTable: true,
  81. chart: null,
  82. queryStartTime:'',
  83. queryEndTime:'',
  84. startTime:new Date(new Date().toLocaleDateString()).getTime()+ 60 * 60 * 24 * 1000,
  85. endTime:new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000*4-1,
  86. loading:false,
  87. drawLoading:true,
  88. tableLoading:true,
  89. resizeKey:1,
  90. activeName: 'first',
  91. drawData:{datas:[],times:[]},
  92. tableData:[],
  93. total:0,
  94. sortOrder:'asc',
  95. pageSize: 10,
  96. currentPage: 1,
  97. showToolBar:false,
  98. /*menuKey:1,
  99. isRenderingTime : new Date().getTime()*/
  100. }
  101. },
  102. created () {
  103. },
  104. mounted() {
  105. this.queryStartTime = this.startTime
  106. this.queryEndTime = this.endTime
  107. this.getDraw()
  108. this.getTable()
  109. },
  110. methods:{
  111. getDraw(){
  112. this.drawLoading = true
  113. var searchParams = {
  114. startTime: this.queryStartTime,
  115. endTime: this.queryEndTime
  116. }
  117. this.$axios.get('/forecastPowerShortTermController/getDraw',{params: searchParams}).then((res) => {
  118. this.drawData = res.data
  119. }).catch((error) => {
  120. this.$message.error('查询实时预测短期echarts出错' + error)
  121. })
  122. },
  123. getTable(){
  124. var searchParams = {
  125. currentPage: this.currentPage,
  126. pageSize: this.pageSize,
  127. startTime: this.queryStartTime,
  128. endTime: this.queryEndTime
  129. }
  130. this.$axios.get('/forecastPowerShortTermController/getAll',
  131. {params: searchParams}).then((res) => {
  132. this.tableData = res.data.records
  133. this.total = res.data.total
  134. }).catch((error) => {
  135. // this.$message.error(error)
  136. })
  137. },
  138. handlePageChange ({ currentPage, pageSize }) {
  139. this.currentPage = currentPage
  140. this.pageSize = pageSize
  141. this.startTime = this.queryStartTime
  142. this.endTime = this.queryEndTime
  143. this.loading = true
  144. this.getTable();
  145. },
  146. dateFormat({ cellValue, row, column }) {
  147. return this.$XEUtils.toDateString(cellValue, 'yyyy-MM-dd HH:mm:ss')
  148. },
  149. enumToWord({ cellValue, row, column }) {
  150. if(cellValue == "E1"){
  151. return "云端模型"
  152. }
  153. if(cellValue == 'E2'){
  154. return "物理模型"
  155. }
  156. if(cellValue == 'E3'){
  157. return "统计模型"
  158. }
  159. if(cellValue == 'E4'){
  160. return "补录数据"
  161. }
  162. if(cellValue == 'E5'){
  163. return "差值模型"
  164. }
  165. },
  166. dateMoment({ cellValue, row, column }) {
  167. return moment(cellValue).format('YYYY-MM-DD HH:mm:ss')
  168. },
  169. sortChangeEvent ({ column, property, order }) {
  170. if(order == null){
  171. order = 'asc'
  172. }
  173. this.currentPage = 1
  174. this.sortOrder = order
  175. this.loading = true
  176. this.getTable()
  177. },
  178. checkColumnMethod ({ column }) {
  179. if (column.property === 'preTime') {
  180. return false
  181. }
  182. return true
  183. },
  184. dateQuery(){
  185. this.loading = true
  186. if(this.endTime<=this.startTime){
  187. this.$message.error("开始时间不能大于结束时间")
  188. // this.startTime = this.queryStartTime
  189. // this.endTime = this.queryEndTime
  190. this.loading = false
  191. return
  192. }
  193. if(this.endTime-this.startTime> 60 * 60 * 24 * 1000*3){
  194. // this.startTime = this.queryStartTime
  195. // this.endTime = this.queryEndTime
  196. this.$message.error("只能最多查询3天的数据哦")
  197. this.loading = false
  198. return
  199. }
  200. this.queryStartTime = this.startTime
  201. this.queryEndTime = this.endTime
  202. this.getDraw(this.queryStartTime,this.queryEndTime)
  203. this.getTable()
  204. },
  205. Byresize(tab){
  206. if(tab.name =='first'){
  207. this.resizeKey++
  208. this.showToolBar = false
  209. }else{
  210. this.showToolBar = true
  211. }
  212. },
  213. }
  214. }
  215. </script>
  216. <style scoped>
  217. .chart-container{
  218. position:relative;
  219. width:100%;
  220. height:calc(100vh - 50px);
  221. }
  222. .filter{
  223. position:relative;
  224. display:flex;
  225. padding:20px 0 10px 15px;
  226. font-size:12px;
  227. line-height:11px;
  228. color:white;
  229. }
  230. input{
  231. background:transparent;
  232. border:none;
  233. color:white;
  234. }
  235. .timeText{
  236. opacity:0.69;
  237. padding-right:7px;
  238. font-size:14px;
  239. }
  240. .startTime{
  241. display:inline-block;
  242. }
  243. .endTime{
  244. display:inline-block;
  245. padding-left:42px;
  246. }
  247. .timeQuery{
  248. background:transparent;
  249. }
  250. .filter{
  251. width: 100%;background-color: transparent;height: 10%
  252. }
  253. .filter >>> input{
  254. background:transparent;
  255. border:none;
  256. color:white;
  257. }
  258. .content{
  259. width: 100%;
  260. background-color: transparent;
  261. height: 90%;
  262. padding-left: 5px;
  263. padding-right: 5px;
  264. }
  265. .tableContent{
  266. width: 100%;
  267. height:calc(80vh - 50px);
  268. }
  269. .tableContent >>> td{
  270. border:1px solid #ffffff;
  271. }
  272. .rtPageturning >>> button,
  273. .rtPageturning >>> span,
  274. .rtPageturning >>> input,
  275. .rtPageturning >>> .vxe-pager--btn-wrapper li{
  276. background-color: transparent !important;
  277. color: #ffffff !important;
  278. border: 1px solid #ffffff;
  279. }
  280. .rtPageturning >>> span{
  281. border:none
  282. }
  283. .rtPageturning >>> .vxe-pager--wrapper .vxe-pager--btn-wrapper li:not(.disabled).is--active {
  284. background-color: #9f9fa0 !important;
  285. }
  286. .toolbar{
  287. position:absolute;right:0px;
  288. }
  289. .toolbar >>> .vxe-button.type--button.is--circle {
  290. padding: 0 .5em;
  291. min-width: 34px;
  292. border-radius: 10%;
  293. border: none;
  294. background: transparent;
  295. color: white;
  296. }
  297. </style>