index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <div class="app-container">
  3. <el-card class="box-carde">
  4. <div slot="header" class="clearfix">
  5. <span>人工干预记录</span>
  6. </div>
  7. <el-container>
  8. <el-header style="padding: 0px;display:flex;justify-content:space-between;align-items: center">
  9. <div style="display: inline">
  10. <el-date-picker
  11. v-model="dateTime"
  12. type="daterange"
  13. range-separator="至"
  14. start-placeholder="开始日期"
  15. end-placeholder="结束日期"/>
  16. <el-select v-model="fileType" :filterable="true" placeholder="请选择文件类型" prop="fileType">
  17. <el-option
  18. v-for="item in fileTypeData"
  19. :key="item.value"
  20. :label="item.label"
  21. :value="item.value"/>
  22. </el-select>
  23. <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="searchEmp">搜索
  24. </el-button>
  25. </div>
  26. </el-header>
  27. <el-tabs v-model="activeName" type="card">
  28. <el-tab-pane label="人工干预数据图表对比" name="first">
  29. <el-main style="padding-left: 0px;padding-top: 0px">
  30. <div class="container">
  31. <div id="MyShortTermRealCharts"/>
  32. </div>
  33. </el-main>
  34. </el-tab-pane>
  35. <el-tab-pane label="人工干预记录列表" name="second">
  36. <div>
  37. <el-table
  38. v-loading="tableLoading"
  39. :data="emps.slice((currentPage-1)*pageSize,currentPage*pageSize)"
  40. height="500px"
  41. border
  42. stripe
  43. size="mini"
  44. style="width: 100%">
  45. <el-table-column
  46. sortable="custom"
  47. :formatter="fileTypeFormat"
  48. prop="fileType"
  49. align="center"
  50. header-align="center"
  51. label="文件类型"/>
  52. <el-table-column
  53. :show-overflow-tooltip="true"
  54. :formatter="dateFormat"
  55. prop="operationalTime"
  56. align="center"
  57. header-align="center"
  58. label="操作时间"/>
  59. <el-table-column
  60. :show-overflow-tooltip="true"
  61. prop="interveneTime"
  62. :formatter="dateFormats"
  63. align="center"
  64. header-align="center"
  65. label="干预数据日期"/>
  66. <el-table-column
  67. :show-overflow-tooltip="true"
  68. :formatter="operationalFormat"
  69. prop="operationalStatus"
  70. align="center"
  71. header-align="center"
  72. label="操作类型"/>
  73. <el-table-column
  74. header-align="center"
  75. align="center"
  76. label="操作">
  77. <template slot-scope="scope">
  78. <el-button
  79. style="padding: 3px 4px 3px 4px;margin: 2px"
  80. size="mini"
  81. icon="el-icon-document"
  82. @click="showErrorInfo(scope.row)">查看内容
  83. </el-button>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <div style="display: flex;justify-content: space-between;margin: 2px;float: right">
  88. <el-pagination
  89. :current-page="currentPage"
  90. :page-size="pageSize"
  91. :page-sizes="[10, 25, 50, 100]"
  92. :total="totalCount"
  93. background
  94. layout="total, sizes, prev, pager, next, jumper"
  95. @size-change="handleSizeChange"
  96. @current-change="currentChange"/>
  97. </div>
  98. </div>
  99. </el-tab-pane>
  100. </el-tabs>
  101. <el-form
  102. ref="addEmpForm"
  103. :model="emp"
  104. style="margin: 0px;padding: 0px;"
  105. label-width="100px">
  106. <el-dialog
  107. :close-on-click-modal="false"
  108. :visible.sync="dialogVisibleErrorInfo"
  109. title="具体信息"
  110. style="padding: 0px;"
  111. label-width="1px"
  112. width="1000px">
  113. <el-input
  114. v-model="emp.operationalContext"
  115. :rows="20"
  116. type="textarea"
  117. style="width: 100%" />
  118. <span
  119. slot="footer"
  120. class="dialog-footer">
  121. <el-button
  122. size="mini"
  123. @click="cancelEidtEI">关 闭</el-button>
  124. </span>
  125. </el-dialog>
  126. </el-form>
  127. </el-container>
  128. </el-card>
  129. </div>
  130. </template>
  131. <script>
  132. export default {
  133. data() {
  134. return {
  135. ef: '',
  136. // 日期选择器
  137. dateTime: [new Date(new Date().toLocaleDateString()).getTime() , new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 3 * 1000],
  138. // 场站信息存储对象
  139. elTableData: [],
  140. efiId: '',
  141. emps: [],
  142. fileType:'',
  143. fileTypeData:[
  144. { value: 0, label: '短期' },
  145. { value: 1, label: '超短期' }
  146. ],
  147. keywords: '',
  148. jType: '',
  149. dialogTitle: '',
  150. dialogVisibleErrorInfo: false,
  151. multipleSelection: [],
  152. depTextColor: '#c0c4cc',
  153. totalCount: -1,
  154. currentPage: 1,
  155. pageSize: 10,
  156. dialogVisible: false,
  157. tableLoading: false,
  158. fileParsing: [],
  159. activeName: 'first',
  160. forecastAndManualInterventionData: [],
  161. forecastValueCorrectAfterData: [],
  162. forecastTimeData: [],
  163. capacityUnit: '',
  164. capacity:'',
  165. emp:{
  166. operationalContext:''
  167. }
  168. }
  169. },
  170. mounted: function() {
  171. this.fileType=0;
  172. this.getAllClass()
  173. },
  174. methods: {
  175. cancelEidtEI () {
  176. this.dialogVisibleErrorInfo = false
  177. },
  178. showErrorInfo (row) {
  179. this.emp.operationalContext = row.operationalContext
  180. this.dialogVisibleErrorInfo = true
  181. },
  182. // // 获取后台所有场站信息
  183. // getELData() {
  184. // this.$axios.post('/electricFieldInfo/findAllElectricFieldInfo').then((res) => {
  185. // this.elTableData = res.data
  186. // this.efiId = res.data[0].id
  187. // // this.capacityUnit=res.data[0].capacityUnit
  188. // // this.type = 'NWP'
  189. // this.getAllClass()
  190. // })
  191. // },
  192. // 表格所属场站,ID转换场站名称
  193. formatStation(row, column) {
  194. let belongTo = '未知的所属场站'
  195. for (let i = 0; i < this.elTableData.length; i++) {
  196. if (row.efiId === this.elTableData[i].id) {
  197. belongTo = this.elTableData[i].name
  198. }
  199. }
  200. return belongTo
  201. },
  202. // 根据类型获取class
  203. getAllClass() {
  204. if (this.dateTime == '' || this.dateTime == null) {
  205. alert('请选择时间')
  206. return
  207. }
  208. this.$axios.get('/electricField/').then((res) => {
  209. this.capacityUnit = 'mw'
  210. this.capacity=res.data.capacity
  211. })
  212. const formData = new FormData()
  213. const startTime = Math.round(this.dateTime[0])
  214. const endTime = Math.round(this.dateTime[1]) + 60 * 60 * 24 * 1000 - 1
  215. this.$axios.get('/manualInterventionLogController/queryManualInterventionLogData/'+ startTime +'/' + endTime +'/'+ this.fileType ).then((res) => {
  216. this.emps = res.data
  217. this.totalCount = this.emps.length
  218. })
  219. const s = Math.round(this.dateTime[1])+ 60 * 60 * 24 * 1000 -1000
  220. this.$axios.get('/manualInterventionLogController/getForecastPowerShortTermDrawing/' + Math.round(this.dateTime[0]) + '/' + s).then(resp => {
  221. var data = resp.data
  222. // 可用预测功率(修正后)
  223. for (let k = 0; k < data.list.length; k++) {
  224. this.forecastValueCorrectAfterData.push(data.list[k].fpValue)
  225. }
  226. for (let i = 0; i < data.list.length; i++) {
  227. this.forecastTimeData.push(this.timestampToTime(data.list[i].forecastTime))
  228. }
  229. const startTime1 = Math.round(this.dateTime[0])
  230. const endTime1 = Math.round(this.dateTime[1]) + 60 * 60 * 24 * 1000 - 1
  231. this.$axios.get('/manualInterventionLogController/queryForecastAndManualInterventionData/'+startTime1+'/'+endTime1+'/'+this.fileType).then(resp => {
  232. for (let i = 0; i < resp.data.length; i++) {
  233. if(resp.data[i].intervention!=null){
  234. this.forecastAndManualInterventionData.push(resp.data[i].intervention)
  235. }
  236. }
  237. this.drawLine(this.forecastValueCorrectAfterData, this.forecastAndManualInterventionData, this.forecastTimeData, this.capacityUnit,this.capacity)
  238. this.forecastValueCorrectAfterData = []
  239. this.forecastAndManualInterventionData=[]
  240. this.forecastTimeData = []
  241. this.capacity=''
  242. })
  243. })
  244. },
  245. drawLine(forecastValueCorrectAfterData, forecastAndManualInterventionData, forecastTimeData, capacityUnit,capacity) {
  246. var echarts = require('echarts')
  247. // 基于准备好的dom,初始化echarts实例
  248. const MyShortTermRealCharts = echarts.init(document.getElementById('MyShortTermRealCharts'))
  249. // 绘制图表
  250. MyShortTermRealCharts.setOption({
  251. // 标题
  252. title: {
  253. text: '人工干预数据对比',
  254. left: '3%', // left 的值可以是像 20 这样的具体像素值,可以是像 '20%' 这样相对于容器高宽的百分比,也可以是 'left', 'center', 'right',如果 left 的值为'left', 'center', 'right',组件会根据相应的位置自动对齐。
  255. top: '10px', // left 的值可以是像 20 这样的具体像素值,可以是像 '20%' 这样相对于容器高宽的百分比,也可以是 'left', 'center', 'right',如果 left 的值为'left', 'center', 'right',组件会根据相应的位置自动对齐。
  256. right: 'auto', // right 的值可以是像 20 这样的具体像素值,可以是像 '20%' 这样相对于容器高宽的百分比。
  257. bottom: 'auto'// bottom 的值可以是像 20 这样的具体像素值,可以是像 '20%' 这样相对于容器高宽的百分比。
  258. },
  259. tooltip: {
  260. trigger: 'axis',
  261. axisPointer: { // 会出现横竖2个方向的指示器
  262. type: 'cross'
  263. }
  264. },
  265. // 图例名
  266. legend: {
  267. top: '2%',
  268. data: ['预测数据', '干预后预测数据']
  269. },
  270. grid: {
  271. top: '70px',
  272. left: '5%', // 图表距边框的距离
  273. right: '5%',
  274. bottom: '20%',
  275. containLabel: true
  276. },
  277. // 工具框,可以选择
  278. toolbox: {
  279. show: true,
  280. feature: {
  281. mark: { show: true },
  282. dataView: { show: true, readOnly: false },
  283. magicType: { show: true, type: ['line', 'bar'] },
  284. restore: { show: true },
  285. saveAsImage: { show: true }
  286. }
  287. },
  288. dataZoom: [{
  289. show: true,
  290. realtime: true,
  291. start: 0,
  292. end: 100,
  293. },{
  294. type: 'inside'
  295. }],
  296. // x轴信息样式
  297. xAxis: {
  298. type: 'category',
  299. boundaryGap: false,
  300. axisLine: { onZero: false },
  301. data: forecastTimeData,
  302. // 坐标轴颜色
  303. axisLine: {
  304. lineStyle: {
  305. color: 'gray'
  306. }
  307. },
  308. // x轴文字旋转
  309. axisLabel: {
  310. rotate: 0,
  311. // interval: 'auto',
  312. show: true, // true为显示字体 false则不显示
  313. textStyle: {// 字体颜色
  314. color: 'gray'
  315. }
  316. }
  317. },
  318. yAxis: [
  319. {
  320. type: 'value',
  321. min:0,
  322. max:capacity,
  323. axisPointer: {
  324. type: 'line'
  325. },
  326. position: 'left',
  327. splitLine: {// 网格线
  328. show: true
  329. },
  330. axisTick: {// y轴刻度线
  331. show: false
  332. },
  333. axisLabel: {// y轴线
  334. formatter: '{value} ' + capacityUnit
  335. },
  336. axisLine: {// y轴线
  337. show: false
  338. }
  339. }
  340. ],
  341. series: [
  342. {
  343. name: '预测数据',
  344. type: 'line',
  345. symbol: 'circle',
  346. showSymbol: false,
  347. symbolSize: 4,
  348. data: forecastValueCorrectAfterData,
  349. color: ['orange'],
  350. smooth: true,
  351. itemStyle: {
  352. normal: {
  353. lineStyle: {
  354. width: 2,
  355. type: 'solid' // 'dotted'虚线 'solid'实线
  356. }
  357. }
  358. }
  359. },
  360. {
  361. name: '干预后预测数据',
  362. type: 'line',
  363. color: ['red'],
  364. symbol: 'circle',
  365. showSymbol: false,
  366. smooth: true,
  367. symbolSize: 4,
  368. data: forecastAndManualInterventionData,
  369. itemStyle: {
  370. normal: {
  371. lineStyle: {
  372. width: 2,
  373. type: 'solid' // 'dotted'虚线 'solid'实线
  374. }
  375. }
  376. }
  377. }
  378. ]
  379. })
  380. window.onresize = MyShortTermRealCharts.resize// 图表自适应浏览器大小
  381. },
  382. // 时间格式化
  383. fileTypeFormat(row, column) {
  384. let belongTo = '未知的文件类型场站'
  385. for (let i = 0; i < this.emps.length; i++) {
  386. if (row.fileType =="0") {
  387. belongTo ="短期"
  388. }
  389. if (row.fileType =="1") {
  390. belongTo ="超短期"
  391. }
  392. }
  393. return belongTo
  394. },
  395. operationalFormat(row, column) {
  396. let belongTo = '未知的文件类型场站'
  397. for (let i = 0; i < this.emps.length; i++) {
  398. if (row.operationalStatus =="0") {
  399. belongTo ="点位新增"
  400. }
  401. if (row.operationalStatus =="1") {
  402. belongTo ="点位修改"
  403. }
  404. if (row.operationalStatus =="2") {
  405. belongTo ="点位删除"
  406. }
  407. if (row.operationalStatus =="3") {
  408. belongTo ="系数"
  409. }
  410. if (row.operationalStatus =="4") {
  411. belongTo ="系数删除"
  412. }
  413. }
  414. return belongTo
  415. },
  416. // 时间格式化
  417. dateFormat(row, column) {
  418. const date = row[column.property]
  419. if (date === undefined) {
  420. return ''
  421. }
  422. return this.$moment(date).format('YYYY-MM-DD HH:mm:ss')// 使用moment插件进行日期格式化
  423. },
  424. timestampToTime(time) {
  425. const a = parseInt(time)
  426. const date = new Date(a) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
  427. const Y = date.getFullYear() + '-'
  428. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
  429. const D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' '
  430. const H = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':'
  431. const m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':'
  432. const s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds())
  433. return Y + M + D + H + m + s
  434. },
  435. // 时间格式化
  436. dateFormats(row, column) {
  437. const date = row[column.property]
  438. if (date === undefined) {
  439. return ''
  440. }
  441. return this.$moment(date).format('YYYY-MM-DD')// 使用moment插件进行日期格式化
  442. },
  443. searchEmp() {
  444. this.getAllClass()
  445. },
  446. currentChange(currentChange) {
  447. this.currentPage = currentChange
  448. this.getAllClass()
  449. },
  450. handleSizeChange(handleSizeChange) {
  451. this.pageSize = handleSizeChange
  452. this.getAllClass()
  453. },
  454. // 自定义排序
  455. }
  456. }
  457. </script>
  458. <style>
  459. .el-dialog__body {
  460. padding-top: 0px;
  461. padding-bottom: 0px;
  462. }
  463. .slide-fade-enter-active {
  464. transition: all .8s ease;
  465. }
  466. .slide-fade-leave-active {
  467. transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
  468. }
  469. .slide-fade-enter, .slide-fade-leave-to {
  470. transform: translateX(10px);
  471. opacity: 0;
  472. }
  473. #MyShortTermRealCharts {
  474. width: 100%;
  475. height: 500px;
  476. }
  477. </style>