index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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">
  44. <template v-slot:tr v-if="tableData.data.length > 0">
  45. <tr>
  46. <td v-for="(item, index) in tableData.column" :key="index">
  47. {{ tableDataEnd[item.field] }}
  48. </td>
  49. </tr>
  50. </template>
  51. </ComTable>
  52. </div>
  53. <el-dialog
  54. :title="wtId + '号风机' + year + '年' + month + '月运行指标性能分析'"
  55. v-model="dialogVisible"
  56. width="70%"
  57. top="10vh"
  58. custom-class="modal"
  59. :close-on-click-modal="false"
  60. :destroy-on-close='true'
  61. >
  62. <ZnzhFx :wtId="wtId" :year="year" :month="month" />
  63. </el-dialog>
  64. </div>
  65. </template>
  66. <script>
  67. import ComTable from "../Decision/table.vue";
  68. import ZnzhFx from "./znzhfx.vue";
  69. import api from "@api/economic/index.js";
  70. export default {
  71. // 名称
  72. name: "cutAnalyse",
  73. // 使用组件
  74. components: {
  75. ComTable,
  76. ZnzhFx,
  77. },
  78. // 数据
  79. data() {
  80. const that = this;
  81. return {
  82. isAsc: "asc",
  83. wpArray: [],
  84. wpId: "",
  85. dialogVisible: false,
  86. wtId: "",
  87. year: "",
  88. month: "",
  89. recorddate: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate(
  90. "yyyy-MM-dd"
  91. ),
  92. tableDataEnd: [], //合计
  93. tableData: {
  94. column: [
  95. {
  96. name: "机组编号",
  97. field: "windturbineName",
  98. cursor: "pointer",
  99. is_num: false,
  100. is_light: false,
  101. sortable: true,
  102. click(e, row) {
  103. that.goznzhfx(row);
  104. },
  105. },
  106. {
  107. name: "实际发电量(万千瓦时)",
  108. field: "fdl",
  109. is_num: false,
  110. is_light: false,
  111. sortable: true,
  112. },
  113. {
  114. name: "理论发电量(万千瓦时)",
  115. field: "llfdl",
  116. is_num: false,
  117. is_light: false,
  118. sortable: true,
  119. },
  120. {
  121. name: "设备利用小时数(小时)",
  122. field: "lyxs",
  123. is_num: false,
  124. is_light: false,
  125. sortable: true,
  126. },
  127. {
  128. name: "设备可利用率(%)",
  129. field: "sbklyl",
  130. is_num: false,
  131. is_light: false,
  132. sortable: true,
  133. },
  134. {
  135. name: "等效可用系数(%)",
  136. field: "tjxs",
  137. is_num: false,
  138. is_light: false,
  139. sortable: true,
  140. },
  141. {
  142. name: "平均风速(m/s)",
  143. field: "fs",
  144. is_num: false,
  145. is_light: false,
  146. sortable: true,
  147. },
  148. {
  149. name: "小风切入风速(m/s)",
  150. field: "xfqr",
  151. is_num: false,
  152. is_light: false,
  153. sortable: true,
  154. },
  155. {
  156. name: "有效风时数(小时)",
  157. field: "yxfss",
  158. is_num: false,
  159. is_light: false,
  160. sortable: true,
  161. },
  162. {
  163. name: "故障损失电量(万千瓦时)",
  164. field: "gzss",
  165. is_num: false,
  166. is_light: false,
  167. sortable: true,
  168. },
  169. {
  170. name: "调度限电损失电量(万千瓦时)",
  171. field: "xdss",
  172. is_num: false,
  173. is_light: false,
  174. sortable: true,
  175. },
  176. {
  177. name: "计划检修损失电量(万千瓦时)",
  178. field: "jxss",
  179. is_num: false,
  180. is_light: false,
  181. sortable: true,
  182. },
  183. {
  184. name: "性能未达标损失电量(万千瓦时)",
  185. field: "xnss",
  186. is_num: false,
  187. is_light: false,
  188. sortable: true,
  189. },
  190. {
  191. name: "受累损失电量(万千瓦时)",
  192. field: "slss",
  193. is_num: false,
  194. is_light: false,
  195. sortable: true,
  196. },
  197. {
  198. name: "故障停用时间(小时)",
  199. field: "gzxs",
  200. is_num: false,
  201. is_light: false,
  202. sortable: true,
  203. },
  204. {
  205. name: "检修停用时间(小时)",
  206. field: "jxxs",
  207. is_num: false,
  208. is_light: false,
  209. sortable: true,
  210. },
  211. {
  212. name: "机组功率一致性系数(%)",
  213. field: "glyzxxs",
  214. is_num: false,
  215. is_light: false,
  216. sortable: true,
  217. },
  218. ],
  219. data: [],
  220. },
  221. };
  222. },
  223. // 函数
  224. methods: {
  225. goznzhfx(row) {
  226. let that = this;
  227. that.wtId = row.windturbineid;
  228. that.year = new Date(this.recorddate).formatDate("yyyy");
  229. that.month = new Date(this.recorddate).formatDate("MM");
  230. that.dialogVisible = true;
  231. // this.$router.push({path:`/decision/znzhfx/${row.windturbineid}/${new Date(this.recorddate).formatDate("yyyy")}/${new Date(this.recorddate).formatDate("MM")}`})
  232. },
  233. // 请求服务
  234. requestData() {
  235. api.powercompareWindfarmAjax({
  236. }).then((res) => {
  237. this.wpArray = res.data;
  238. this.wpId = res.data[0].id;
  239. this.getOutputSpeedList(this.wpId);
  240. });
  241. // let that = this;
  242. // that.API.requestData({
  243. // method: "GET",
  244. // subUrl: "powercompare/windfarmAjax",
  245. // success(res) {
  246. // that.wpArray = res.data;
  247. // that.wpId = res.data[0].id;
  248. // that.getOutputSpeedList(that.wpId);
  249. // },
  250. // });
  251. },
  252. getOutputSpeedList(wpId) {
  253. let that = this;
  254. if (!that.wpId || !that.recorddate) {
  255. that.BASE.showMsg({
  256. msg: "场站与日期不可为空",
  257. });
  258. } else {
  259. api.singleanalysisSingleanalysisMain({
  260. wpId,
  261. isAsc: this.isAsc,
  262. year: new Date(this.recorddate).getFullYear(),
  263. month: new Date(this.recorddate).getMonth() + 1,
  264. }).then((res) => {
  265. res.data.forEach((ele) => {
  266. for (let key in ele) {
  267. ele[key] = ele[key] || 0;
  268. }
  269. });
  270. this.tableDataEnd = res.data[res.data.length - 1];
  271. res.data.pop();
  272. this.tableData.data = res.data;
  273. });
  274. // that.API.requestData({
  275. // method: "POST",
  276. // subUrl: "singleanalysis/singleanalysisMain",
  277. // showLoading: true,
  278. // data: {
  279. // wpId,
  280. // isAsc: that.isAsc,
  281. // year: new Date(that.recorddate).getFullYear(),
  282. // month: new Date(that.recorddate).getMonth() + 1,
  283. // },
  284. // success(res) {
  285. // res.data.forEach((ele) => {
  286. // for (let key in ele) {
  287. // ele[key] = ele[key] || 0;
  288. // }
  289. // });
  290. // that.tableDataEnd = res.data[res.data.length - 1];
  291. // res.data.pop();
  292. // that.tableData.data = res.data;
  293. // },
  294. // });
  295. }
  296. },
  297. search() {
  298. this.getOutputSpeedList(this.wpId);
  299. },
  300. // 导出excel
  301. exportExcel() {
  302. let that = this;
  303. const { export_json_to_excel } = require("@tools/excel/Export2Excel.js"); // 注意这个Export2Excel路径
  304. // const tHeader = ['点名', '描述']; // 上面设置Excel的表格第一行的标题
  305. // const filterVal = ['id', 'name']; // 上面的index、nickName、name是tableData里对象的属性key值
  306. let tHeader = []; // 上面设置Excel的表格第一行的标题
  307. let filterVal = []; // 上面的index、nickName、name是tableData里对象的属性key值
  308. that.tableData.column.forEach((ele) => {
  309. if (ele.name !== "操作") {
  310. tHeader.push(ele.name);
  311. filterVal.push(ele.field);
  312. }
  313. });
  314. var list = [];
  315. that.tableData.data.forEach((i, index) => {
  316. list.push(i);
  317. });
  318. list.push(that.tableDataEnd);
  319. const data = that.formatJson(filterVal, list);
  320. export_json_to_excel(tHeader, data, "导出的Excel"); // 最后一个是表名字
  321. },
  322. formatJson(filterVal, jsonData) {
  323. return jsonData.map((v) => filterVal.map((j) => v[j]));
  324. },
  325. },
  326. created() {
  327. this.requestData();
  328. },
  329. mounted() {},
  330. unmounted() {},
  331. };
  332. </script>
  333. <style lang="less" scoped>
  334. .draught-fan-list {
  335. width: 100%;
  336. height: 100%;
  337. display: flex;
  338. flex-direction: column;
  339. .btn-group-tabs {
  340. display: flex;
  341. flex-direction: row;
  342. .photovoltaic {
  343. margin-left: 1.481vh;
  344. }
  345. }
  346. .df-table {
  347. cursor: pointer;
  348. border: 0.093vh solid fade(@darkgray, 50%);
  349. position: relative;
  350. flex-grow: 1;
  351. margin-top: 1.481vh;
  352. &:before {
  353. content: "";
  354. width: 0.37vh;
  355. height: 0.37vh;
  356. background: @write;
  357. position: absolute;
  358. left: 0.278vh;
  359. top: 0.278vh;
  360. }
  361. tbody {
  362. height: calc(100vh - 166px);
  363. }
  364. }
  365. }
  366. </style>
  367. <style lang="less">
  368. .draught-fan-list {
  369. .el-dialog__body {
  370. height: 600px;
  371. max-height: 600px;
  372. overflow-y: scroll;
  373. }
  374. }
  375. </style>