SingleMachinePower.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. <template>
  2. <div class="box">
  3. <div class="searchBar">
  4. <el-tabs v-model="activeName" @tab-click="handleClick" type="card">
  5. <el-tab-pane label="总功率情况" name="first" :key="'first'">
  6. <el-card class="box-card">
  7. <el-form :inline="true" :model="formInline" class="demo-form-inline" style="height:30px">
  8. <el-row :gutter="1">
  9. <el-form-item label="查询条件:">
  10. </el-form-item>
  11. <el-form-item label="风电电场:">
  12. <el-select v-model="value"
  13. @change="queryApData()" placeholder="请选择">
  14. <el-option
  15. v-for="item in options"
  16. :key="item.name"
  17. :label="item.name"
  18. :value="item.id"
  19. >
  20. </el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="风机:">
  24. <el-select v-model="value2"
  25. @change="queryApData()" placeholder="请选择">
  26. <el-option
  27. v-for="item in options2"
  28. :key="item.name"
  29. :label="item.name"
  30. :value="item.id"
  31. >
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button type="primary" @click="queryApData" :plain="true"
  37. >查询</el-button
  38. >
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button type="primary" @click="toExcel()">导出</el-button>
  42. </el-form-item>
  43. </el-row>
  44. </el-form>
  45. </el-card>
  46. </el-tab-pane>
  47. <el-tab-pane label="月功率情况" name="second" :key="'second'">
  48. <el-card class="box-card">
  49. <el-form :inline="true" :model="formInline" class="demo-form-inline" style="height:30px">
  50. <el-row :gutter="1">
  51. <el-form-item label="查询条件:">
  52. </el-form-item>
  53. <el-form-item label="风场">
  54. <el-select v-model="value"
  55. @change="queryApData()" placeholder="请选择">
  56. <el-option
  57. v-for="item in options"
  58. :key="item.name"
  59. :label="item.name"
  60. :value="item.id"
  61. >
  62. </el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item label="风机:">
  66. <el-select v-model="value2"
  67. @change="queryApData()" placeholder="请选择">
  68. <el-option
  69. v-for="item in options2"
  70. :key="item.name"
  71. :label="item.name"
  72. :value="item.id"
  73. >
  74. </el-option>
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="年份:">
  78. <el-date-picker
  79. value-format="yyyy"
  80. v-model="timeyear"
  81. type="year"
  82. placeholder="选择年"
  83. format="yyyy"
  84. >
  85. </el-date-picker>
  86. </el-form-item>
  87. <el-form-item label="月份:">
  88. <el-date-picker
  89. value-format="yyyy-MM"
  90. v-model="month"
  91. type="month"
  92. placeholder="选择月"
  93. format="yyyy-MM"
  94. >
  95. </el-date-picker>
  96. </el-form-item>
  97. <el-form-item>
  98. <el-button type="primary" @click="queryApData" :plain="true"
  99. >查询</el-button
  100. >
  101. </el-form-item>
  102. <el-form-item>
  103. <el-button type="primary" @click="toExcel()">导出</el-button>
  104. </el-form-item>
  105. </el-row>
  106. </el-form>
  107. </el-card>
  108. </el-tab-pane>
  109. <el-tab-pane label="日功率情况" name="cord" :key="'cord'">
  110. <el-card class="box-card">
  111. <el-form :inline="true" :model="formInline" class="demo-form-inline" style="height:30px">
  112. <el-row :gutter="1">
  113. <el-form-item label="查询条件:">
  114. </el-form-item>
  115. <el-form-item label="风场">
  116. <el-select v-model="value"
  117. @change="queryApData()" placeholder="请选择">
  118. <el-option
  119. v-for="item in options"
  120. :key="item.name"
  121. :label="item.name"
  122. :value="item.id"
  123. >
  124. </el-option>
  125. </el-select>
  126. </el-form-item>
  127. <el-form-item label="风机:">
  128. <el-select v-model="value2"
  129. @change="queryApData()" placeholder="请选择">
  130. <el-option
  131. v-for="item in options2"
  132. :key="item.name"
  133. :label="item.name"
  134. :value="item.id"
  135. >
  136. </el-option>
  137. </el-select>
  138. </el-form-item>
  139. <el-form-item label="选择时间:">
  140. <el-date-picker
  141. value-format="yyyy-MM-dd"
  142. v-model="time"
  143. type="date"
  144. placeholder="选择日期"
  145. format="yyyy-MM-dd">
  146. </el-date-picker>
  147. </el-form-item>
  148. <el-form-item>
  149. <el-button type="primary" @click="queryApData" :plain="true"
  150. >查询</el-button
  151. >
  152. </el-form-item>
  153. <el-form-item>
  154. <el-button type="primary" @click="toExcel()">导出</el-button>
  155. </el-form-item>
  156. </el-row>
  157. </el-form>
  158. </el-card>
  159. </el-tab-pane>
  160. </el-tabs>
  161. <el-table v-if="switchtableall"
  162. id="singlemachinepower"
  163. :data="gridData"
  164. :row-style="{ height: '10px' }"
  165. :cell-style="{ textAlign: 'center',padding:'1px' }"
  166. :header-cell-style="headStyle"
  167. @sort-change="changeTableSort"
  168. style="font-size: 10px;margin-top:0.5%">
  169. <el-table-column :label=title>
  170. <el-table-column
  171. type="index"
  172. width="40">
  173. </el-table-column>
  174. <el-table-column
  175. prop="windturbineid"
  176. label="风机"
  177. width="460">
  178. </el-table-column>
  179. <el-table-column
  180. :sortable="'custom'"
  181. prop="speed"
  182. label="风速"
  183. width="460">
  184. </el-table-column>
  185. <el-table-column
  186. prop="actualpower"
  187. label="实际拟合功率"
  188. width="460">
  189. </el-table-column>
  190. <el-table-column
  191. prop="optimalpower"
  192. label="最优拟合功率"
  193. width="460">
  194. </el-table-column>
  195. </el-table-column>
  196. </el-table>
  197. <el-table v-if="switchtableday"
  198. id="singlemachinepower"
  199. :data="gridData"
  200. :row-style="{ height: '10px' }"
  201. :cell-style="{ textAlign: 'center',padding:'1px' }"
  202. :header-cell-style="headStyle"
  203. @sort-change="changeTableSort"
  204. style="font-size: 10px;margin-top:0.5%">
  205. <el-table-column :label=title>
  206. <el-table-column
  207. type="index"
  208. width="40">
  209. </el-table-column>
  210. <el-table-column
  211. prop="windturbineid"
  212. label="风机"
  213. width="370">
  214. </el-table-column>
  215. <el-table-column
  216. :sortable="'custom'"
  217. prop="speed"
  218. label="风速"
  219. width="370">
  220. </el-table-column>
  221. <el-table-column
  222. prop="actualpower"
  223. label="实际拟合功率"
  224. width="370">
  225. </el-table-column>
  226. <el-table-column
  227. prop="optimalpower"
  228. label="最优拟合功率"
  229. width="370">
  230. </el-table-column>
  231. <el-table-column
  232. prop="address"
  233. label="操作"
  234. width="370">
  235. <template slot-scope="scope">
  236. <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改</el-button>
  237. </template>
  238. </el-table-column>
  239. </el-table-column>
  240. </el-table>
  241. <el-table v-if="switchtablemonth"
  242. id="singlemachinepower"
  243. :data="gridData"
  244. :row-style="{ height: '10px' }"
  245. :cell-style="{ textAlign: 'center',padding:'1px' }"
  246. :header-cell-style="headStyle"
  247. @sort-change="changeTableSort"
  248. style="font-size: 10px;margin-top:0.5%">
  249. <el-table-column :label=title>
  250. <el-table-column
  251. type="index"
  252. width="40">
  253. </el-table-column>
  254. <el-table-column
  255. prop="windturbineid"
  256. label="风机"
  257. width="370">
  258. </el-table-column>
  259. <el-table-column
  260. :sortable="'custom'"
  261. prop="speed"
  262. label="风速"
  263. width="370">
  264. </el-table-column>
  265. <el-table-column
  266. prop="actualpower"
  267. label="实际拟合功率"
  268. width="370">
  269. </el-table-column>
  270. <el-table-column
  271. prop="optimalpower"
  272. label="最优拟合功率"
  273. width="370">
  274. </el-table-column>
  275. <el-table-column
  276. prop="address"
  277. label="操作"
  278. width="370">
  279. <template slot-scope="scope">
  280. <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改</el-button>
  281. </template>
  282. </el-table-column>
  283. </el-table-column>
  284. </el-table>
  285. <div style="text-align: center;">
  286. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage2"
  287. :page-sizes="[10, 50, 100, 1000]"
  288. :page-size="pagesize" layout="total,sizes, prev, pager, next" :total="total">
  289. </el-pagination>
  290. </div>
  291. <div id="leiDaTu" class="echart"></div>
  292. </div>
  293. </div>
  294. </template>
  295. <script>
  296. import excelHelper from "@/utils/excelHelper";
  297. export default {
  298. data(){
  299. return {
  300. formInline: {
  301. windfarm: "",
  302. project: "",
  303. line: "",
  304. },
  305. activeName: 'first',
  306. information:'first',
  307. value:'MHS_FDC',
  308. value2:'MG01_01',
  309. options: [],
  310. options2:[],
  311. month:'',
  312. time:'',
  313. timemonth:'',
  314. timeyear:'',
  315. updateTime:'',
  316. title:'月曲线偏差率排行榜',
  317. daymonth:'',
  318. dayyear:'',
  319. currentPage2: 1,
  320. pagesize: 10,
  321. orderByColumn:'',
  322. isAsc: '',
  323. gridData:[],
  324. gridDataChart:[],
  325. gridDataChartX:[],
  326. gridDataChartYsjnh:[],
  327. gridDataChartYzynh:[],
  328. gridDataChartYbzgl:[],
  329. switchtableall:true,
  330. switchtableday:false,
  331. switchtablemonth:false,
  332. total:'',
  333. }
  334. },
  335. created(){
  336. this.singleMachinePower();
  337. },
  338. methods:{
  339. queryApData() {
  340. this.singleMachinePower();
  341. },
  342. handleSizeChange(val) {
  343. console.log(`每页 ${val} 条`);
  344. this.pagesize = val;
  345. this.singleMachinePower();
  346. },
  347. handleCurrentChange(val) {
  348. // console.log(`当前页: ${val}`);
  349. this.singleMachinePower();
  350. },
  351. headStyle() {
  352. return "text-align:center"
  353. },
  354. handleClick(tab) {
  355. // console.log(tab.name)
  356. this.information = tab.name;
  357. this.singleMachinePower();
  358. },
  359. changeTableSort(column){
  360. this.orderByColumn = column.prop;
  361. if(column.order == "descending"){
  362. this.isAsc = 'desc';
  363. }else if(column.order == "ascending"){
  364. this.isAsc = "asc";
  365. }
  366. this.singleMachinePower();
  367. },
  368. singleMachinePower(){
  369. this.gridDataChartX = [];
  370. this.gridDataChartYsjnh = [];
  371. this.gridDataChartYzynh = [];
  372. this.gridDataChartYbzgl = [];
  373. this.$http.get('/powercompare/windfarmAjax').then((res) => {
  374. this.options = res.data.data;
  375. })
  376. this.$http.get('/powercompare/windturbineAjax?wpId=' + this.value).then((res) => {
  377. this.options2 = res.data.data;
  378. })
  379. var singleMachinePowerData = new URLSearchParams();
  380. var singleMachinePowerDataChart = new URLSearchParams();
  381. if(this.information == 'first'){
  382. this.title = '单机总功率信息列表';
  383. this.switchtableall = true;
  384. this.switchtableday = false;
  385. this.switchtablemonth = false;
  386. singleMachinePowerData.append('pageNum',this.currentPage2);
  387. singleMachinePowerData.append('pageSize',this.pagesize);
  388. singleMachinePowerData.append('orderByColumn',this.orderByColumn);
  389. singleMachinePowerData.append('isAsc',this.isAsc);
  390. singleMachinePowerData.append('wtId',this.value2);
  391. this.$http.post("/powersaturation/powersaturationamonutlist",singleMachinePowerData).then((res) => {
  392. this.gridData = res.data.data.list;
  393. this.total = res.data.data.total;
  394. })
  395. singleMachinePowerDataChart.append('wtId',this.value2);
  396. this.$http.post("/powersaturation/powersaturationamonutchart",singleMachinePowerDataChart).then((res) => {
  397. this.gridDataChart = res.data.data;
  398. for(let i=0;i<this.gridDataChart.length;i++){
  399. this.gridDataChartX.push(this.gridDataChart[i].value1);
  400. this.gridDataChartYsjnh.push(this.gridDataChart[i].value2);
  401. this.gridDataChartYzynh.push(this.gridDataChart[i].value3);
  402. this.gridDataChartYbzgl.push(this.gridDataChart[i].value4);
  403. }
  404. this.$nextTick(function() {
  405. this.drawPie('leiDaTu')
  406. })
  407. })
  408. }else if(this.information == 'second'){
  409. this.title = '单机月功率信息列表';
  410. this.switchtableall = false;
  411. this.switchtableday = true;
  412. this.switchtablemonth = false;
  413. const nowDate = new Date();
  414. const date = {
  415. year: nowDate.getFullYear(),
  416. month: nowDate.getMonth() + 1,
  417. date: nowDate.getDate(),
  418. }
  419. const newmonth = date.month>10?date.month:'0'+date.month
  420. const day = date.date>10?date.date - 1:'0'+date.date
  421. this.updateTime = date.year + '-' + newmonth + '-' + day
  422. singleMachinePowerData.append('pageNum',this.currentPage2);
  423. singleMachinePowerData.append('pageSize',this.pagesize);
  424. singleMachinePowerData.append('orderByColumn',this.orderByColumn);
  425. singleMachinePowerData.append('isAsc',this.isAsc);
  426. singleMachinePowerData.append('wtId',this.value2);
  427. if(this.timeyear == ''){
  428. this.timeyear = this.updateTime;
  429. this.timeyear = this.timeyear.slice(0,4);
  430. }else{
  431. this.timeyear = this.timeyear.toString();
  432. }
  433. singleMachinePowerData.append('year',this.timeyear);
  434. if(this.month == ''){
  435. this.month = this.updateTime;
  436. if(this.month.substring(5,7) < 10 ){
  437. this.timemonth = this.month.substring(6,7);
  438. }else{
  439. this.timemonth = this.month.substring(5,7);
  440. }
  441. }else{
  442. this.timemonth = this.month.toString();
  443. if(this.timemonth.substring(5,7) < 10){
  444. this.timemonth = this.timemonth.substring(6,7);
  445. }else{
  446. this.timemonth = this.timemonth.substring(5,7)
  447. }
  448. }
  449. console.log(this.timemonth)
  450. singleMachinePowerData.append('month',this.timemonth);
  451. this.$http.post("/powersaturation/powersaturationmonthlist",singleMachinePowerData).then((res) =>{
  452. this.gridData = res.data.data.list;
  453. this.total = res.data.data.total;
  454. })
  455. singleMachinePowerDataChart.append('wtId',this.value2);
  456. singleMachinePowerDataChart.append('year',this.timeyear);
  457. singleMachinePowerDataChart.append('month',this.timemonth);
  458. this.$http.post("/powersaturation/powersaturationmonthchart",singleMachinePowerDataChart).then((res) => {
  459. this.gridDataChart = res.data.data;
  460. for(let i=0;i<this.gridDataChart.length;i++){
  461. this.gridDataChartX.push(this.gridDataChart[i].value1);
  462. this.gridDataChartYsjnh.push(this.gridDataChart[i].value2);
  463. this.gridDataChartYzynh.push(this.gridDataChart[i].value3);
  464. this.gridDataChartYbzgl.push(this.gridDataChart[i].value4);
  465. }
  466. console.log(this.gridDataChart)
  467. this.$nextTick(function() {
  468. this.drawPie('leiDaTu')
  469. })
  470. })
  471. }else if(this.information == 'cord'){
  472. this.title = '单机日功率信息列表';
  473. this.switchtableall = false;
  474. this.switchtableday = false;
  475. this.switchtablemonth = true;
  476. const nowDate = new Date();
  477. const date = {
  478. year: nowDate.getFullYear(),
  479. month: nowDate.getMonth() + 1,
  480. date: nowDate.getDate(),
  481. }
  482. const newmonth = date.month>10?date.month:'0'+date.month
  483. const day = date.date>10?date.date - 1:'0'+date.date
  484. this.updateTime = date.year + '-' + newmonth + '-' + day
  485. if(this.time == ''){
  486. this.time = this.updateTime;
  487. }
  488. singleMachinePowerData.append('pageNum',this.currentPage2);
  489. singleMachinePowerData.append('pageSize',this.pagesize);
  490. singleMachinePowerData.append('orderByColumn',this.orderByColumn);
  491. singleMachinePowerData.append('isAsc',this.isAsc);
  492. singleMachinePowerData.append('wtId',this.value2);
  493. singleMachinePowerData.append('recorddate',this.time);
  494. this.$http.post("/powersaturation/powersaturationlist",singleMachinePowerData).then((res) =>{
  495. this.gridData = res.data.data.list;
  496. this.total = res.data.data.total;
  497. })
  498. singleMachinePowerDataChart.append('wtId',this.value2);
  499. singleMachinePowerDataChart.append('recorddate',this.time);
  500. this.$http.post("/powersaturation/powersaturationchart",singleMachinePowerDataChart).then((res) => {
  501. this.gridDataChart = res.data.data;
  502. for(let i=0;i<this.gridDataChart.length;i++){
  503. this.gridDataChartX.push(this.gridDataChart[i].value1);
  504. this.gridDataChartYsjnh.push(this.gridDataChart[i].value2);
  505. this.gridDataChartYzynh.push(this.gridDataChart[i].value3);
  506. this.gridDataChartYbzgl.push(this.gridDataChart[i].value4);
  507. }
  508. this.$nextTick(function() {
  509. this.drawPie('leiDaTu')
  510. })
  511. })
  512. }
  513. },
  514. toExcel(){
  515. excelHelper.exportExcel("singlemachinepower","负荷率排行榜",".xls",true);
  516. },
  517. drawPie() {
  518. var charts;
  519. if (charts != null && charts != "" && charts != undefined){
  520. charts.dispose();
  521. }
  522. charts= this.$echarts.init(document.getElementById('leiDaTu'));
  523. let option = {
  524. title: {
  525. left: 'center',
  526. text: '功率曲线'
  527. },
  528. tooltip: {
  529. trigger: 'axis'
  530. },
  531. legend: {
  532. data: ['实际拟合功率', '最优拟合功率', '保证功率'],
  533. x: 'right',
  534. },
  535. grid: {
  536. left: '3%',
  537. right: '4%',
  538. bottom: '1%',
  539. containLabel: true
  540. },
  541. xAxis: {
  542. type: 'category',
  543. boundaryGap: false,
  544. data: this.gridDataChartX
  545. },
  546. yAxis: {
  547. type: 'value',
  548. name:'功率(KW)',
  549. nameLocation :'center',
  550. nameTextStyle: {
  551. padding: [0, 0, 30, 0] // 四个数字分别为上右下左与原位置距离
  552. },
  553. max: 2000,
  554. axisLabel:{
  555. formatter: function (value) {
  556. var texts = [];
  557. if (value < 1000) {
  558. value = value / 1000;
  559. texts.push(value+'k');
  560. }
  561. if (value >= 1000) {
  562. value = value / 1000;
  563. texts.push(value+'k');
  564. }
  565. return texts;
  566. }
  567. },
  568. },
  569. series: [
  570. {
  571. name: '实际拟合功率',
  572. type: 'line',
  573. stack: '总量',
  574. data: this.gridDataChartYsjnh
  575. },
  576. {
  577. name: '最优拟合功率',
  578. type: 'line',
  579. stack: '总量',
  580. data: this.gridDataChartYzynh
  581. },
  582. {
  583. name: '保证功率',
  584. type: 'line',
  585. stack: '总量',
  586. data: this.gridDataChartYbzgl
  587. },
  588. ]
  589. }
  590. charts.clear();
  591. charts.setOption(option);
  592. },
  593. }
  594. }
  595. </script>
  596. <style lang="scss" scoped>
  597. .box{
  598. width: 100%;
  599. display: flex;
  600. justify-content: space-around;
  601. align-items: center;
  602. overflow: hidden;
  603. }
  604. .searchBar{
  605. margin-top: 1%;
  606. }
  607. #leiDaTu {
  608. margin-left: 5%;
  609. height: 200px;
  610. width: 90%;
  611. float: left;
  612. }
  613. </style>