index.vue 10 KB

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