index.vue 17 KB

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