historyDetail.vue 12 KB

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