loadRate.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div>
  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="query.stationId" clearable placeholder="请选择" popper-class="select">
  9. <el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name">
  10. </el-option>
  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="query.date" type="date" placeholder="日期" popper-class="date-select"
  18. value-format="YYYY-MM-DD"></el-date-picker>
  19. </div>
  20. </div>
  21. <div class="query-item">
  22. <div class="lable"></div>
  23. <div class="search-input">
  24. <el-select v-model="query.useType" style="width: 120px" placeholder="请选择" popper-class="select">
  25. <el-option value="1" label="负荷率"></el-option>
  26. <el-option value="2200" label="利用小时"></el-option>
  27. </el-select>
  28. </div>
  29. </div>
  30. <div class="query-item">
  31. <div class="lable"></div>
  32. <div class="search-input">
  33. <el-select v-model="query.time" style="width: 120px" placeholder="请选择" v-if="query.useType!=='2200'" popper-class="select">
  34. <el-option value="0930" label="早"></el-option>
  35. <el-option value="1230" label="中"></el-option>
  36. <el-option value="1830" label="晚"></el-option>
  37. </el-select>
  38. </div>
  39. </div>
  40. <div class="query-actions">
  41. <button class="btn green" @click="getTable()">查询</button>
  42. <button class="btn green" @click="exportCsv('now')">当前导出</button>
  43. <button class="btn green" @click="exportCsv('all')">全天导出</button>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="table-box">
  48. <!-- <div class="title">光伏负荷率</div> -->
  49. <ComTable
  50. ref="curRef"
  51. :data="tableData"
  52. :pageSize="-1"
  53. height="85vh"
  54. v-loading="tableLoading"
  55. element-loading-text="拼命加载中.."
  56. element-loading-background="rgba(0, 0, 0, 0.8)"
  57. ></ComTable>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import ComTable from "@/components/coms/table/table.vue";
  63. import { ElMessage } from 'element-plus';
  64. import Papa from 'papaparse';
  65. export default {
  66. name: "boosterAlarm",
  67. components: {
  68. ComTable,
  69. Papa
  70. },
  71. data() {
  72. let that = this;
  73. return {
  74. ChangZhan: [],
  75. query: {
  76. stationId: 'DWK_GDC',
  77. date: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate("yyyy-MM-dd"),
  78. useType: '1',
  79. time: '0930'
  80. // stationId: 'DWK_GDC',
  81. // date: '2022-11-10',
  82. // time: '1830'
  83. // useType: '1',
  84. },
  85. tableLoading: true,
  86. pageIndex: 1,
  87. pageSize: 20,
  88. tableData: {
  89. column: [],
  90. data: [],
  91. currentPageTotal: 0
  92. }
  93. };
  94. },
  95. created() {
  96. this.ChangZhanVal();
  97. this.getTable();
  98. },
  99. methods: {
  100. exportCsv(type) {
  101. switch(type){
  102. case 'now':
  103. this.BASE.exportExcel(this.tableData, "光伏负荷率");
  104. break;
  105. case 'all':
  106. let el = document.createElement("a");
  107. //链接赋值
  108. el.href = window.__MODE__.baseURL + 'loadrate/down?date=' + this.query.date;
  109. el.download = '';
  110. el.target = '_blank'
  111. document.body.appendChild(el)
  112. el.click()
  113. document.body.removeChild(el)
  114. break;
  115. }
  116. },
  117. // 场站
  118. ChangZhanVal() {
  119. var that = this;
  120. that.API.requestData({
  121. method: "GET",
  122. subUrl: "powercompare/windfarmAllAjax",
  123. success(res) {
  124. that.ChangZhan = res.data.filter(o => o.id.includes('GDC'));
  125. that.query.stationId = that.ChangZhan[0].id;
  126. }
  127. });
  128. },
  129. getTable() {
  130. let that = this;
  131. this.tableLoading = true;
  132. if(this.query.useType!=='2200'){
  133. this.tableData.column = [{
  134. name: "逆变器编号",
  135. field: "id",
  136. is_num: false,
  137. is_light: false,
  138. },{
  139. name: "支路数量",
  140. field: "branchcount",
  141. is_num: false,
  142. is_light: false,
  143. },{
  144. name: "板件数量",
  145. field: "platecount",
  146. is_num: false,
  147. is_light: false,
  148. },{
  149. name: "逆变器所带光伏板总容量(kw)",
  150. field: "platecapacity",
  151. is_num: false,
  152. is_light: false,
  153. },{
  154. name: "时间",
  155. field: "time",
  156. is_num: false,
  157. is_light: false,
  158. },{
  159. name: "当前逆变器功率(kw)",
  160. field: "power",
  161. is_num: false,
  162. is_light: false,
  163. },{
  164. name: "负荷率(%)",
  165. field: "loadfactor",
  166. is_num: false,
  167. is_light: false,
  168. sortable: true
  169. } ]
  170. }else{
  171. this.tableData.column = [{
  172. name: "逆变器编号",
  173. field: "id",
  174. is_num: false,
  175. is_light: false,
  176. },{
  177. name: "支路数量",
  178. field: "branchcount",
  179. is_num: false,
  180. is_light: false,
  181. },{
  182. name: "板件数量",
  183. field: "platecount",
  184. is_num: false,
  185. is_light: false,
  186. },{
  187. name: "逆变器所带光伏板总容量(kw)",
  188. field: "platecapacity",
  189. is_num: false,
  190. is_light: false,
  191. },{
  192. name: "时间",
  193. field: "time",
  194. is_num: false,
  195. is_light: false,
  196. },{
  197. name: "逆变器发电量(kw·h)",
  198. field: "generatedenergy",
  199. is_num: false,
  200. is_light: false,
  201. },{
  202. name: "利用小时",
  203. field: "utilizationhour",
  204. is_num: false,
  205. is_light: false,
  206. sortable: true
  207. } ]
  208. }
  209. this.API.requestData({
  210. timeout: 30000,
  211. method: "GET",
  212. subUrl: "loadrate/info",
  213. showLoading: true,
  214. data: {
  215. stationid: that.query.stationId,
  216. date: that.query.date,
  217. time: that.query.useType!=='2200'? that.query.time: that.query.useType,
  218. },
  219. success(res) {
  220. var dataTab = [];
  221. if (res.data) {
  222. res.data.forEach(item => {
  223. dataTab.push({ //表格
  224. branchcount: item.branchcount,
  225. generatedenergy: item.generatedenergy,
  226. id: item.id,
  227. loadfactor: item.loadfactor,
  228. platecapacity: item.platecapacity,
  229. platecount: item.platecount,
  230. power: item.power,
  231. time: item.time,
  232. utilizationhour: item.utilizationhour,
  233. })
  234. })
  235. that.tableData.data = dataTab;
  236. that.tableData.total = 0;
  237. } else {
  238. that.tableData.data = [];
  239. that.tableData.total = 0;
  240. }
  241. that.tableLoading = false;
  242. },
  243. fail(err){
  244. that.tableData.data = [];
  245. that.tableData.total = 0;
  246. that.tableLoading = false;
  247. }
  248. })
  249. },
  250. formatTime(value) {
  251. if (typeof(value) == 'undefined') {
  252. return ''
  253. } else {
  254. let date = new Date(parseInt(value))
  255. let y = date.getFullYear()
  256. let MM = date.getMonth() + 1
  257. MM = MM < 10 ? ('0' + MM) : MM
  258. let d = date.getDate()
  259. d = d < 10 ? ('0' + d) : d
  260. return y + '-' + MM + '-' + d
  261. }
  262. },
  263. // onChangePage(params) {
  264. // this.pageIndex = params.pageIndex;
  265. // this.pageSize = params.pageSize;
  266. // this.getTable();
  267. // },
  268. }
  269. };
  270. </script>
  271. <style scoped>
  272. .title {
  273. background: rgba(255, 255, 255, 0.1);
  274. margin-bottom: 8px;
  275. padding: 1vh;
  276. }
  277. </style>