historyDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <div class="historysingleMachine">
  3. <div class="historysingleMachine_top">
  4. <div class="stationsv">
  5. <span class="timeaa">时间:</span>
  6. <el-date-picker
  7. v-model="pickerTimer"
  8. type="daterange"
  9. range-separator="To"
  10. start-placeholder="开始时间"
  11. end-placeholder="结束时间"
  12. size="mini"
  13. format="YYYY/MM/DD"
  14. value-format="YYYY-MM-DD"
  15. />
  16. </div>
  17. <div class="but">
  18. <el-button round size="mini" class="buttons" @click="seachData"
  19. >搜 索</el-button
  20. >
  21. <el-button round size="mini" class="buttons" @click="downXlsxFn"
  22. >导出</el-button
  23. >
  24. </div>
  25. </div>
  26. <div class="economicTable1">
  27. <el-table
  28. :data="historysingleMachineData"
  29. stripe
  30. size="mini"
  31. height="calc(100% - 40px)"
  32. ref="historysingleTable"
  33. style="width: 100%"
  34. >
  35. <el-table-column
  36. align="center"
  37. :label="tabIndex === -1 ? '风机' : '逆变器'"
  38. width="80"
  39. fixed="left"
  40. >
  41. <template #default="{ row }">
  42. <span>{{ tabIndex === -1 ? row.wtcode : row.wtname }}</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column
  46. align="center"
  47. prop="recordDate"
  48. label="日期"
  49. width="120"
  50. fixed="left"
  51. >
  52. <template #default="scope">
  53. <span>{{ dateTimeFn(scope.row) }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column
  57. v-for="(item, index) in tabIndex === -1 ? tableHeader : tableHeaderGf"
  58. :key="index"
  59. sortable
  60. :prop="item.code"
  61. :label="item.title"
  62. show-overflow-tooltip
  63. header-align="center"
  64. align="right"
  65. >
  66. <template #header="scope">
  67. <div>{{ scope.column.label }}</div>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <el-pagination
  72. @current-change="handleCurrentChange"
  73. :current-page="page.currentPage"
  74. :page-size="page.pagesize"
  75. @size-change="handleSizeChange"
  76. :page-sizes="[21, 50, 100, 500]"
  77. layout="total, sizes, prev, pager, next, jumper"
  78. :total="page.total"
  79. >
  80. </el-pagination>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. import {
  86. getApihistorywindturbinegoodnesslist,
  87. getApihistorywindturbinegoodnesslistGf,
  88. getApiequipmentListByWp,
  89. } from "@/api/monthlyPerformanceAnalysis";
  90. import utils from "@/utills/downXlsx";
  91. export default {
  92. props: {
  93. // historyCompanyOptions: {
  94. // type: Array,
  95. // default: () => [],
  96. // },
  97. tabIndex: { type: Number, required: true },
  98. historyStationOptions: {
  99. type: Array,
  100. default: () => [],
  101. },
  102. },
  103. data() {
  104. return {
  105. // hiscompanyVal: "",
  106. hisstationVal: "",
  107. hiswindVal: "",
  108. pickerTimer: [],
  109. historysingleMachineData: [],
  110. hisWindOptions: [],
  111. showBtn: true,
  112. page: {
  113. pagesize: 21,
  114. currentPage: 1,
  115. total: 0,
  116. },
  117. // tabOptions: [
  118. // { id: -1, name: "风电" },
  119. // { id: -2, name: "光伏" },
  120. // ],
  121. tableHeader: [
  122. { title: "日发电量", code: "rfdl" },
  123. { title: "月发电量", code: "yfdl" },
  124. { title: "年发电量", code: "nfdl" },
  125. { title: "日应发电量", code: "ryfdl" },
  126. { title: "月应发电量", code: "yyfdl" },
  127. { title: "年应发电量", code: "nyfdl" },
  128. { title: "日平均功率", code: "rpjgl" },
  129. { title: "月平均功率", code: "ypjgl" },
  130. { title: "年平均功率", code: "npjgl" },
  131. { title: "日平均风速", code: "rpjfs" },
  132. { title: "月平均风速", code: "ypjfs" },
  133. { title: "年平均风速", code: "npjfs" },
  134. { title: "日运行小时", code: "ryxxs" },
  135. { title: "月运行小时", code: "yyxxs" },
  136. { title: "年运行小时", code: "nyxxs" },
  137. { title: "日待机小时", code: "rdjxs" },
  138. { title: "月待机小时", code: "ydjxs" },
  139. { title: "年待机小时", code: "ndjxs" },
  140. { title: "日故障小时", code: "rgzxs" },
  141. { title: "月故障小时", code: "ygzxs" },
  142. { title: "年故障小时", code: "ngzxs" },
  143. { title: "日检修小时", code: "rjxxs" },
  144. { title: "月检修小时", code: "yjxxs" },
  145. { title: "年检修小时", code: "njxxs" },
  146. { title: "日中断小时", code: "rzdxs" },
  147. { title: "月中断小时", code: "yzdxs" },
  148. { title: "年中断小时", code: "nzdxs" },
  149. { title: "日有效风时", code: "ryxfs" },
  150. { title: "月有效风时", code: "yyxfs" },
  151. { title: "年有效风时", code: "nyxfs" },
  152. { title: "日损失电量", code: "rssdl" },
  153. { title: "月损失电量", code: "yssdl" },
  154. { title: "年损失电量", code: "nssdl" },
  155. { title: "日报警次数", code: "rbjcs" },
  156. { title: "月报警次数", code: "ybjcs" },
  157. { title: "年报警次数", code: "nbjcs" },
  158. { title: "日停机次数", code: "rtjcs" },
  159. { title: "月停机次数", code: "ytjcs" },
  160. { title: "年停机数", code: "ntjcs" },
  161. { title: "日不饱和数", code: "rbbhcs" },
  162. { title: "月不饱和数", code: "ybbhcs" },
  163. { title: "年不饱和数", code: "nbbhcs" },
  164. { title: "日可利用率", code: "rsbklyl" },
  165. { title: "月可利用率", code: "ysbklyl" },
  166. { title: "年可利用率", code: "nsbklyl" },
  167. { title: "日平均温度", code: "rpjwd" },
  168. { title: "月平均温度", code: "ypjwd" },
  169. { title: "年平均温度", code: "npjwd" },
  170. { title: "日平均湿度", code: "rpjsd" },
  171. { title: "月平均湿度", code: "ypjsd" },
  172. { title: "年平均湿度", code: "npjsd" },
  173. { title: "日平均压强", code: "rpjyq" },
  174. { title: "月平均压强", code: "ypjyq" },
  175. { title: "年平均压强", code: "npjyq" },
  176. { title: "日拟合优度", code: "rnhyd" },
  177. { title: "月拟合优度", code: "ynhyd" },
  178. { title: "年拟合优度", code: "nnhyd" },
  179. { title: "日实际/保证", code: "rsjbz" },
  180. { title: "月实际/保证", code: "ysjbz" },
  181. { title: "年实际/保正", code: "nsjbz" },
  182. ],
  183. tableHeaderGf: [
  184. { title: "型号", code: "model" },
  185. { title: "日系统效率", code: "rxtxl" },
  186. { title: "日离散率", code: "rlsl" },
  187. { title: "日转换效率", code: "rzhxl" },
  188. { title: "月系统效率", code: "yxtxl" },
  189. { title: "月离散率", code: "ylsl" },
  190. { title: "月转换效率", code: "yzhxl" },
  191. { title: "年系统效率", code: "nxtxl" },
  192. { title: "年离散率", code: "nlsl" },
  193. { title: "年转换效率", code: "nzhxl" },
  194. ],
  195. };
  196. },
  197. // watch: {
  198. // tabIndex(val) {
  199. // this.tableHeader = this.tableHeader.map((item) => {
  200. // if (val == -2) {
  201. // if (item.code == "rpjfs") {
  202. // item.title = "日平均光照";
  203. // }
  204. // if (item.code == "ypjfs") {
  205. // item.title = "月平均光照";
  206. // }
  207. // if (item.code == "npjfs") {
  208. // item.title = "年平均光照";
  209. // }
  210. // } else {
  211. // if (item.code == "rpjfs") {
  212. // item.title = "日平均风速";
  213. // }
  214. // if (item.code == "ypjfs") {
  215. // item.title = "月平均风速";
  216. // }
  217. // if (item.code == "npjfs") {
  218. // item.title = "年平均风速";
  219. // }
  220. // }
  221. // return { ...item };
  222. // });
  223. // },
  224. // },
  225. methods: {
  226. async init(row) {
  227. // this.hiscompanyVal = row.companyId;
  228. this.hisstationVal = row.windtpowerstationId;
  229. this.hiswindVal = row.windturbineId;
  230. await this.getTableData();
  231. },
  232. dateTimeFn(row) {
  233. return row.recordDate
  234. ? row.recordDate.substring(0, row.recordDate.indexOf("T"))
  235. : row.date.substring(0, row.date.indexOf("T"));
  236. },
  237. headerArr(label) {
  238. let arr = label.split("");
  239. let Newarr = [];
  240. let num = 0;
  241. let str = "";
  242. arr.forEach((it, index) => {
  243. num++;
  244. str += it;
  245. if (label.indexOf(it) + 1 !== label.length) {
  246. if (num % 2 === 0) {
  247. Newarr.push(str);
  248. str = "";
  249. }
  250. } else {
  251. Newarr.push(str);
  252. }
  253. });
  254. return Newarr;
  255. },
  256. async getWindPowerStation() {
  257. const { data } = await getApiequipmentListByWp({
  258. wpid: this.hisstationVal,
  259. });
  260. this.hisWindOptions = data.data;
  261. if (!this.hiswindVal && data.data.length) {
  262. this.hiswindVal = data.data[0].id;
  263. }
  264. },
  265. // changeBtn(id) {
  266. // this.tabIndex = id;
  267. // this.$emit("getHisStationOptions", this.tabIndex, this.hiscompanyVal);
  268. // this.getTableData();
  269. // },
  270. changeStation(val) {
  271. this.hisstationVal = val;
  272. this.hiswindVal = "";
  273. this.getWindPowerStation();
  274. },
  275. changeWind(val) {
  276. this.hiswindVal = val;
  277. this.getTableData();
  278. },
  279. seachData() {
  280. this.getTableData();
  281. },
  282. async getTableData() {
  283. let params = {
  284. type: this.tabIndex,
  285. pageNum: this.page.currentPage,
  286. pageSize: this.page.pagesize,
  287. beginDate: this.pickerTimer[0],
  288. endDate: this.pickerTimer[1],
  289. wpId: this.hisstationVal,
  290. wtId: this.hiswindVal,
  291. };
  292. let datas = [];
  293. if (this.tabIndex == -1) {
  294. datas = await getApihistorywindturbinegoodnesslist(params);
  295. this.historysingleMachineData = datas.data.data.records;
  296. this.page.total = datas.data.data.total;
  297. } else {
  298. datas = await getApihistorywindturbinegoodnesslistGf(params);
  299. this.historysingleMachineData = datas.data.data;
  300. this.page.total = datas.data.data.length;
  301. }
  302. },
  303. handleSizeChange(val) {
  304. this.page.currentPage = 1;
  305. this.page.pagesize = val;
  306. this.getTableData();
  307. },
  308. handleCurrentChange(val) {
  309. this.page.currentPage = val;
  310. this.getTableData();
  311. },
  312. //转换时间
  313. getchangeTime(date) {
  314. var y = date.getFullYear();
  315. var m = date.getMonth() + 1;
  316. m = m < 10 ? "0" + m : m;
  317. var d = date.getDate();
  318. d = d < 10 ? "0" + d : d;
  319. return y + "-" + m + "-" + d;
  320. },
  321. downXlsxFn() {
  322. let header = ["风机", "日期"];
  323. this.tableHeader.forEach((it) => {
  324. header.push(it.title);
  325. });
  326. utils.exportExcel(
  327. this.$refs["historysingleTable"].$el,
  328. header,
  329. "单机性能历史分析数据"
  330. );
  331. },
  332. },
  333. };
  334. </script>
  335. <style lang="less" scoped>
  336. .historysingleMachine {
  337. height: 100%;
  338. .historysingleMachine_top {
  339. display: flex;
  340. flex-direction: row;
  341. align-items: center;
  342. padding-top: 10px;
  343. padding-bottom: 10px;
  344. .stationsv {
  345. .timeaa {
  346. font-size: 14px;
  347. font-family: Microsoft YaHei;
  348. font-weight: 400;
  349. color: #b3b3b3;
  350. margin-right: 10px;
  351. margin-left: 10px;
  352. }
  353. }
  354. .but {
  355. display: flex;
  356. flex-direction: row;
  357. align-content: center;
  358. margin-left: 20px;
  359. .buttons {
  360. background-color: rgba(5, 187, 76, 0.2);
  361. border: 1px solid #3b6c53;
  362. color: #b3b3b3;
  363. font-size: 14px;
  364. &:hover,
  365. &.active {
  366. background-color: rgba(5, 187, 76, 0.5);
  367. color: #ffffff;
  368. }
  369. }
  370. }
  371. .el-date-editor--daterange {
  372. background: transparent;
  373. border: 1px solid #2a374f;
  374. border-radius: 30px;
  375. height: 25px;
  376. .el-range-input {
  377. background: transparent;
  378. color: #fff;
  379. }
  380. .el-range-separator {
  381. width: 10%;
  382. color: #fff;
  383. position: relative;
  384. }
  385. }
  386. }
  387. .economicTable1 {
  388. height: calc(100% - 58px);
  389. }
  390. }
  391. .el-pagination ::v-deep {
  392. .el-pagination__sizes {
  393. .el-input__inner {
  394. width: 100% !important;
  395. border-radius: 0 !important;
  396. }
  397. }
  398. }
  399. </style>