index.vue 16 KB

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