index.vue 9.4 KB

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