index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. <template>
  2. <div class="draught-fan-list">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select v-model="wpId" clearable placeholder="请选择"
  9. popper-class="select">
  10. <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
  11. </el-select>
  12. </div>
  13. </div>
  14. <div class="query-item">
  15. <div class="lable">日期:</div>
  16. <div class="search-input">
  17. <el-date-picker v-model="recorddate" type="date"
  18. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  19. </el-date-picker>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="query-actions">
  24. <button class="btn green" @click="search">查询</button>
  25. <button class="btn green" @click="exportExcel">导出</button>
  26. </div>
  27. </div>
  28. <div class="df-table">
  29. <ComTable height="78vh" :data="tableData"></ComTable>
  30. </div>
  31. <el-dialog title="切入切出风速整合历史" v-model="dialogShow" width="85%" top="10vh" custom-class="modal" :close-on-click-modal="true" @closed="dialogType = ''">
  32. <div class="query mg-b-8">
  33. <div class="query-items">
  34. <div class="query-item">
  35. <div class="lable">场站:</div>
  36. <div class="search-input">
  37. <el-select v-model="wpId2" clearable placeholder="请选择"
  38. popper-class="select" @change="reGetWtArray">
  39. <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
  40. </el-select>
  41. </div>
  42. </div>
  43. <div class="query-item">
  44. <div class="lable">风机:</div>
  45. <div class="search-input">
  46. <el-select v-model="wtId" clearable placeholder="请选择"
  47. popper-class="select">
  48. <el-option v-for="item in wtArray" :key="item.id" :value="item.id" :label="item.name" />
  49. </el-select>
  50. </div>
  51. </div>
  52. <div class="query-item">
  53. <div class="lable">开始日期:</div>
  54. <div class="search-input">
  55. <el-date-picker v-model="beginDate" type="date"
  56. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  57. </el-date-picker>
  58. </div>
  59. </div>
  60. <div class="query-item">
  61. <div class="lable">结束日期:</div>
  62. <div class="search-input">
  63. <el-date-picker v-model="endDate" type="date"
  64. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  65. </el-date-picker>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="query-actions">
  70. <button class="btn green" @click="reGetHistoryTableData">查询</button>
  71. <button class="btn green" @click="exportExcel2">导出</button>
  72. </div>
  73. </div>
  74. <ComTable height="78vh" :data="historyTableData"></ComTable>
  75. </el-dialog>
  76. </div>
  77. </template>
  78. <script>
  79. import ComTable from "@com/coms/table/table.vue";
  80. export default {
  81. // 名称
  82. name: "cutAnalyse",
  83. // 使用组件
  84. components: {
  85. ComTable
  86. },
  87. // 数据
  88. data() {
  89. const that = this;
  90. return {
  91. isAsc:"asc",
  92. wpArray:[],
  93. wtArray:[],
  94. wpId:"",
  95. wtId:"",
  96. wpId2:"",
  97. recorddate:new Date((new Date().getTime() - 3600 * 1000 * 24)).formatDate("yyyy-MM-dd"),
  98. beginDate:"",
  99. endDate:"",
  100. dialogShow:false,
  101. tableData: {
  102. column: [
  103. {
  104. name: "风场",
  105. field: "name",
  106. is_num: false,
  107. is_light: false,
  108. sortable: true
  109. },
  110. {
  111. name: "风机",
  112. field: "windturbineid",
  113. is_num: false,
  114. is_light: false,
  115. sortable: true
  116. },
  117. {
  118. name: "型号",
  119. field: "modelid",
  120. is_num: false,
  121. is_light: false,
  122. sortable: true
  123. },
  124. {
  125. name: "日排行榜",
  126. field: "daytop",
  127. is_num: false,
  128. is_light: false,
  129. sortable: true
  130. },
  131. {
  132. name: "日拟合优度(%)",
  133. field: "daygoodness",
  134. is_num: false,
  135. is_light: false,
  136. sortable: true
  137. },
  138. {
  139. name: "日风速(m/s)",
  140. field: "dayspeed",
  141. is_num: false,
  142. is_light: false,
  143. sortable: true
  144. },
  145. {
  146. name: "月排行榜",
  147. field: "monthtop",
  148. is_num: false,
  149. is_light: false,
  150. sortable: true
  151. },
  152. {
  153. name: "月拟合优度(%)",
  154. field: "monthgoodness",
  155. is_num: false,
  156. is_light: false,
  157. sortable: true
  158. },
  159. {
  160. name: "月风速(m/s)",
  161. field: "monthspeed",
  162. is_num: false,
  163. is_light: false,
  164. sortable: true
  165. },
  166. {
  167. name: "年排行榜",
  168. field: "yeartop",
  169. is_num: false,
  170. is_light: false,
  171. sortable: true
  172. },
  173. {
  174. name: "年拟合优度(%)",
  175. field: "yeargoodness",
  176. is_num: false,
  177. is_light: false,
  178. sortable: true
  179. },
  180. {
  181. name: "年风速(m/s)",
  182. field: "yearspeed",
  183. is_num: false,
  184. is_light: false,
  185. sortable: true
  186. },
  187. {
  188. name: "操作",
  189. field: "",
  190. is_num: false,
  191. is_light: false,
  192. template() {
  193. return "<el-button type='text' style='cursor: pointer;'>详情</el-button>";
  194. },
  195. click(e, row){
  196. that.jumpUrl(row);
  197. }
  198. },
  199. {
  200. name: "操作",
  201. field: "",
  202. is_num: false,
  203. is_light: false,
  204. template() {
  205. return "<el-button type='text' style='cursor: pointer;'>历史</el-button>";
  206. },
  207. click(e, row){
  208. that.getOutputspeedHistoryList(row);
  209. }
  210. }
  211. ],
  212. data: [],
  213. },
  214. historyTableData: {
  215. column: [
  216. {
  217. name: "日期",
  218. field: "time",
  219. is_num: false,
  220. is_light: false,
  221. sortable: true
  222. },
  223. {
  224. name: "风机",
  225. field: "windturbineid",
  226. is_num: false,
  227. is_light: false,
  228. sortable: true
  229. },
  230. {
  231. name: "日发电量",
  232. field: "c1",
  233. is_num: false,
  234. is_light: false,
  235. sortable: true
  236. },
  237. {
  238. name: "日理论发电量",
  239. field: "c2",
  240. is_num: false,
  241. is_light: false,
  242. sortable: true
  243. },
  244. {
  245. name: "日平均功率",
  246. field: "c3",
  247. is_num: false,
  248. is_light: false,
  249. sortable: true
  250. },
  251. {
  252. name: "日运行小时",
  253. field: "c4",
  254. is_num: false,
  255. is_light: false,
  256. sortable: true
  257. },
  258. {
  259. name: "日待机小时",
  260. field: "c5",
  261. is_num: false,
  262. is_light: false,
  263. sortable: true
  264. },
  265. {
  266. name: "日故障小时",
  267. field: "c6",
  268. is_num: false,
  269. is_light: false,
  270. sortable: true
  271. },
  272. {
  273. name: "日维护小时",
  274. field: "c7",
  275. is_num: false,
  276. is_light: false,
  277. sortable: true
  278. },
  279. {
  280. name: "日终端小时",
  281. field: "c8",
  282. is_num: false,
  283. is_light: false,
  284. sortable: true
  285. },
  286. {
  287. name: "日有效风时",
  288. field: "c9",
  289. is_num: false,
  290. is_light: false,
  291. sortable: true
  292. },
  293. {
  294. name: "日损失电量",
  295. field: "c10",
  296. is_num: false,
  297. is_light: false,
  298. sortable: true
  299. },
  300. {
  301. name: "日报警次数",
  302. field: "c11",
  303. is_num: false,
  304. is_light: false,
  305. sortable: true
  306. },
  307. {
  308. name: "日停机次数",
  309. field: "c12",
  310. is_num: false,
  311. is_light: false,
  312. sortable: true
  313. },
  314. {
  315. name: "日不饱和次数",
  316. field: "c13",
  317. is_num: false,
  318. is_light: false,
  319. sortable: true
  320. },
  321. {
  322. name: "日设备可利用率",
  323. field: "c14",
  324. is_num: false,
  325. is_light: false,
  326. sortable: true
  327. },
  328. {
  329. name: "日平均温度",
  330. field: "c15",
  331. is_num: false,
  332. is_light: false,
  333. sortable: true
  334. },
  335. {
  336. name: "日平均湿度",
  337. field: "c16",
  338. is_num: false,
  339. is_light: false,
  340. sortable: true
  341. },
  342. {
  343. name: "日平均压强",
  344. field: "c17",
  345. is_num: false,
  346. is_light: false,
  347. sortable: true
  348. },
  349. {
  350. name: "日拟合优度",
  351. field: "c18",
  352. is_num: false,
  353. is_light: false,
  354. sortable: true
  355. },
  356. {
  357. name: "日实际/保证",
  358. field: "c19",
  359. is_num: false,
  360. is_light: false,
  361. sortable: true
  362. },
  363. ],
  364. data: [],
  365. },
  366. };
  367. },
  368. // 函数
  369. methods: {
  370. // 请求服务
  371. requestData() {
  372. let that = this;
  373. that.API.requestData({
  374. method: "GET",
  375. subUrl: "powercompare/windfarmAjax",
  376. success(res) {
  377. that.wpArray=res.data;
  378. that.wpId=res.data[0].id;
  379. that.getOutputSpeedList(that.wpId)
  380. }
  381. });
  382. },
  383. getOutputSpeedList(wpId){
  384. let that = this;
  385. if(!that.wpId || !that.recorddate){
  386. that.BASE.showMsg({
  387. msg:"场站与日期不可为空"
  388. });
  389. }else{
  390. that.API.requestData({
  391. method: "POST",
  392. subUrl: "goodness/windturbinegoodness",
  393. data:{
  394. wpId,
  395. isAsc:that.isAsc,
  396. recorddate:that.recorddate
  397. },
  398. success(res) {
  399. that.tableData.data = res.data.list;
  400. }
  401. });
  402. }
  403. },
  404. getOutputspeedHistoryList (item){
  405. let that = this;
  406. that.API.requestData({
  407. method: "GET",
  408. subUrl: "powercompare/windturbineAjax",
  409. data:{
  410. wpId: item.windtpowerstationid
  411. },
  412. success(res) {
  413. that.wtArray=res.data;
  414. that.wpId2 = item.windtpowerstationid;
  415. that.wtId = item.windturbineid;
  416. that.beginDate = (new Date().formatDate("yyyy-MM") + '-01');
  417. that.endDate = new Date().formatDate("yyyy-MM-dd");
  418. that.API.requestData({
  419. method: "POST",
  420. subUrl: "goodness/goodhistorylist",
  421. data:{
  422. wpId: that.wpId2,
  423. wtId: that.wtId,
  424. beginDate: that.beginDate,
  425. endDate: that.endDate
  426. },
  427. success(res) {
  428. res.data.forEach(ele=>{
  429. ele.time=new Date(ele.recorddate).formatDate("yyyy-MM-dd");
  430. });
  431. that.historyTableData.data = res.data;
  432. that.dialogShow = true;
  433. }
  434. });
  435. }
  436. });
  437. },
  438. reGetWtArray(){
  439. let that = this;
  440. that.API.requestData({
  441. method: "GET",
  442. subUrl: "powercompare/windturbineAjax",
  443. data:{
  444. wpId: that.wpId2
  445. },
  446. success(res) {
  447. that.wtArray=res.data;
  448. that.wtId = res.data[0].id;
  449. }
  450. });
  451. },
  452. reGetHistoryTableData(){
  453. let that=this;
  454. if(!that.wpId2){
  455. that.BASE.showMgs({
  456. msg:"场站不可为空"
  457. });
  458. }else if(!that.wtId){
  459. that.BASE.showMgs({
  460. msg:"风机不可为空"
  461. });
  462. }else if(!that.beginDate || !that.endDate){
  463. that.BASE.showMgs({
  464. msg:"开始日期与结束日期不可为空"
  465. });
  466. }else{
  467. that.API.requestData({
  468. method: "POST",
  469. subUrl: "goodness/goodhistorylist",
  470. data:{
  471. wpId: that.wpId2,
  472. wtId: that.wtId,
  473. beginDate: that.beginDate,
  474. endDate: that.endDate
  475. },
  476. success(res) {
  477. res.data.forEach(ele=>{
  478. ele.time=new Date(ele.recorddate).formatDate("yyyy-MM-dd");
  479. });
  480. that.historyTableData.data = res.data;
  481. that.dialogShow = true;
  482. }
  483. });
  484. }
  485. },
  486. search(){
  487. this.getOutputSpeedList(this.wpId);
  488. },
  489. // 外围表格导出excel
  490. exportExcel () {
  491. let that = this;
  492. const { export_json_to_excel } = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径
  493. // const tHeader = ['点名', '描述']; // 上面设置Excel的表格第一行的标题
  494. // const filterVal = ['id', 'name']; // 上面的index、nickName、name是tableData里对象的属性key值
  495. let tHeader = []; // 上面设置Excel的表格第一行的标题
  496. let filterVal = []; // 上面的index、nickName、name是tableData里对象的属性key值
  497. that.tableData.column.forEach(ele=>{
  498. if(ele.name !== "操作"){
  499. tHeader.push(ele.name);
  500. filterVal.push(ele.field);
  501. }
  502. });
  503. const list = that.tableData.data; //把要导出的数据tableData存到list
  504. const data = that.formatJson(filterVal, list);
  505. export_json_to_excel(tHeader, data, '导出的Excel'); // 最后一个是表名字
  506. },
  507. // 弹窗表格导出excel
  508. exportExcel2 () {
  509. let that = this;
  510. const { export_json_to_excel } = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径
  511. // const tHeader = ['点名', '描述']; // 上面设置Excel的表格第一行的标题
  512. // const filterVal = ['id', 'name']; // 上面的index、nickName、name是tableData里对象的属性key值
  513. let tHeader = []; // 上面设置Excel的表格第一行的标题
  514. let filterVal = []; // 上面的index、nickName、name是tableData里对象的属性key值
  515. that.historyTableData.column.forEach(ele=>{
  516. if(ele.name !== "操作"){
  517. tHeader.push(ele.name);
  518. filterVal.push(ele.field);
  519. }
  520. });
  521. const list = that.historyTableData.data; //把要导出的数据tableData存到list
  522. const data = that.formatJson(filterVal, list);
  523. export_json_to_excel(tHeader, data, '导出的Excel'); // 最后一个是表名字
  524. },
  525. formatJson (filterVal, jsonData) {
  526. return jsonData.map(v => filterVal.map(j => v[j]));
  527. },
  528. // 页面跳转
  529. jumpUrl(item){
  530. this.$router.push(`/new/dj1/${item.windtpowerstationid}`);
  531. }
  532. },
  533. created() {
  534. this.requestData();
  535. },
  536. mounted() {},
  537. unmounted() {},
  538. };
  539. </script>
  540. <style lang="less" scoped>
  541. .draught-fan-list {
  542. width: 100%;
  543. height: 100%;
  544. display: flex;
  545. flex-direction: column;
  546. .btn-group-tabs {
  547. display: flex;
  548. flex-direction: row;
  549. .photovoltaic {
  550. margin-left: 1.481vh;
  551. }
  552. }
  553. .df-table {
  554. border: 0.093vh solid fade(@darkgray, 50%);
  555. position: relative;
  556. overflow: auto;
  557. flex-grow: 1;
  558. margin-top: 1.481vh;
  559. &:before {
  560. content: "";
  561. width: 0.37vh;
  562. height: 0.37vh;
  563. background: @write;
  564. position: absolute;
  565. left: 0.278vh;
  566. top: 0.278vh;
  567. }
  568. tbody {
  569. height: calc(100vh - 166px);
  570. }
  571. }
  572. }
  573. </style>