index.vue 9.4 KB

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