loadRate.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. } ]
  169. }else{
  170. this.tableData.column = [{
  171. name: "逆变器编号",
  172. field: "id",
  173. is_num: false,
  174. is_light: false,
  175. },{
  176. name: "支路数量",
  177. field: "branchcount",
  178. is_num: false,
  179. is_light: false,
  180. },{
  181. name: "板件数量",
  182. field: "platecount",
  183. is_num: false,
  184. is_light: false,
  185. },{
  186. name: "逆变器所带光伏板总容量(kw)",
  187. field: "platecapacity",
  188. is_num: false,
  189. is_light: false,
  190. },{
  191. name: "时间",
  192. field: "time",
  193. is_num: false,
  194. is_light: false,
  195. },{
  196. name: "逆变器发电量(kw·h)",
  197. field: "generatedenergy",
  198. is_num: false,
  199. is_light: false,
  200. },{
  201. name: "利用小时",
  202. field: "utilizationhour",
  203. is_num: false,
  204. is_light: false,
  205. } ]
  206. }
  207. this.API.requestData({
  208. timeout: 30000,
  209. method: "GET",
  210. subUrl: "loadrate/info",
  211. showLoading: true,
  212. data: {
  213. stationid: that.query.stationId,
  214. date: that.query.date,
  215. time: that.query.useType!=='2200'? that.query.time: that.query.useType,
  216. },
  217. success(res) {
  218. var dataTab = [];
  219. if (res.data) {
  220. res.data.forEach(item => {
  221. dataTab.push({ //表格
  222. branchcount: item.branchcount,
  223. generatedenergy: item.generatedenergy,
  224. id: item.id,
  225. loadfactor: item.loadfactor,
  226. platecapacity: item.platecapacity,
  227. platecount: item.platecount,
  228. power: item.power,
  229. time: item.time,
  230. utilizationhour: item.utilizationhour,
  231. })
  232. })
  233. that.tableData.data = dataTab;
  234. that.tableData.total = 0;
  235. } else {
  236. that.tableData.data = [];
  237. that.tableData.total = 0;
  238. }
  239. that.tableLoading = false;
  240. },
  241. fail(err){
  242. that.tableData.data = [];
  243. that.tableData.total = 0;
  244. that.tableLoading = false;
  245. }
  246. })
  247. },
  248. formatTime(value) {
  249. if (typeof(value) == 'undefined') {
  250. return ''
  251. } else {
  252. let date = new Date(parseInt(value))
  253. let y = date.getFullYear()
  254. let MM = date.getMonth() + 1
  255. MM = MM < 10 ? ('0' + MM) : MM
  256. let d = date.getDate()
  257. d = d < 10 ? ('0' + d) : d
  258. return y + '-' + MM + '-' + d
  259. }
  260. },
  261. // onChangePage(params) {
  262. // this.pageIndex = params.pageIndex;
  263. // this.pageSize = params.pageSize;
  264. // this.getTable();
  265. // },
  266. }
  267. };
  268. </script>
  269. <style scoped>
  270. .title {
  271. background: rgba(255, 255, 255, 0.1);
  272. margin-bottom: 8px;
  273. padding: 1vh;
  274. }
  275. </style>