historyDetail.vue 12 KB

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