index.vue 11 KB

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