index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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="wpIps" clearable placeholder="请选择" popper-class="select"
  9. @change="renderWprray">
  10. <el-option v-for="item in typeArray" :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-select v-model="wpId" clearable multiple collapse-tags placeholder="请选择"
  18. popper-class="select">
  19. <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
  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 v-model="beginDate" type="date" value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  27. </el-date-picker>
  28. </div>
  29. </div>
  30. <div class="query-item">
  31. <div class="lable">结束日期:</div>
  32. <div class="search-input">
  33. <el-date-picker v-model="endDate" type="date" value-format="YYYY-MM-DD" placeholder="选择日期"
  34. popper-class="date-select">
  35. </el-date-picker>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="query-actions">
  40. <button class="btn green" @click="search()">搜索</button>
  41. </div>
  42. </div>
  43. <div class="df-table">
  44. <ComTable height="100vh" :data="tableData"></ComTable>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import ComTable from "@com/coms/table/table.vue";
  50. export default {
  51. // 名称
  52. name: "cutAnalyse",
  53. // 使用组件
  54. components: {
  55. ComTable,
  56. },
  57. // 数据
  58. data() {
  59. return {
  60. isAsc: "asc",
  61. typeArray: [],
  62. wpIps: "",
  63. wpArray: [],
  64. wpId: [],
  65. beginDate: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate("yyyy-MM-dd"),
  66. endDate: new Date().formatDate("yyyy-MM-dd"),
  67. dialogShow: false,
  68. tableData: {
  69. column: [{
  70. name: "场站",
  71. field: "windfarm",
  72. is_num: false,
  73. is_light: false,
  74. sortable: true,
  75. },
  76. {
  77. name: "设备",
  78. field: "windturbine",
  79. is_num: false,
  80. is_light: false,
  81. sortable: true,
  82. },
  83. {
  84. name: "开始日期",
  85. field: "beginDate",
  86. is_num: false,
  87. is_light: false,
  88. sortable: true,
  89. },
  90. {
  91. name: "截止日期",
  92. field: "endDate",
  93. is_num: false,
  94. is_light: false,
  95. sortable: true,
  96. },
  97. {
  98. name: "平均风速/日照强度",
  99. field: "speed",
  100. is_num: false,
  101. is_light: false,
  102. sortable: true,
  103. },
  104. {
  105. name: "发电量(万kwh)",
  106. field: "generatingCapacity",
  107. is_num: false,
  108. is_light: false,
  109. sortable: true,
  110. },
  111. ],
  112. data: [],
  113. },
  114. };
  115. },
  116. // 函数
  117. methods: {
  118. // 请求服务
  119. requestData() {
  120. let that = this;
  121. that.API.requestData({
  122. method: "GET",
  123. subUrl: "powercompare/windfarmAllAjax",
  124. data: {
  125. type: that.typeId,
  126. },
  127. success(res) {
  128. that.allWpArray = res.data;
  129. let fdc = [];
  130. let gf = [];
  131. res.data.forEach((ele) => {
  132. if (ele.id.indexOf("FDC") !== -1) {
  133. fdc.push(ele.id);
  134. } else {
  135. gf.push(ele.id);
  136. }
  137. });
  138. that.typeArray = [{
  139. id: [].concat(fdc, gf).toString(),
  140. name: "全部",
  141. },
  142. {
  143. id: fdc.toString(),
  144. name: "风场",
  145. },
  146. {
  147. id: gf.toString(),
  148. name: "光伏电站",
  149. },
  150. ];
  151. that.wpIps = [].concat(fdc, gf).toString();
  152. that.renderWprray();
  153. },
  154. });
  155. },
  156. renderWprray() {
  157. let wpArray = [];
  158. if (!this.wpIps) {
  159. this.wpIps = []
  160. .concat(
  161. this.typeArray[1].id.split(","),
  162. this.typeArray[2].id.split(",")
  163. )
  164. .toString();
  165. }
  166. this.allWpArray.forEach((ele) => {
  167. if (this.wpIps.indexOf("FDC") !== -1) {
  168. if (ele.id.indexOf("FDC") !== -1) {
  169. wpArray.push(ele);
  170. }
  171. } else if (this.wpIps.indexOf("GDC")) {
  172. if (ele.id.indexOf("GDC") !== -1) {
  173. wpArray.push(ele);
  174. }
  175. } else {
  176. wpArray.push(ele);
  177. }
  178. });
  179. this.wpId = this.wpIps ? this.wpIps.split(",") : [];
  180. this.wpArray = wpArray;
  181. this.getOutputSpeedList();
  182. },
  183. getOutputSpeedList() {
  184. let that = this;
  185. if (!that.beginDate || !that.endDate) {
  186. that.BASE.showMsg({
  187. msg: "日期不可为空",
  188. });
  189. } else {
  190. that.API.requestData({
  191. method: "GET",
  192. subUrl: "leaderboard/totalPowerCapacityTopList",
  193. showLoading: true,
  194. data: {
  195. wpIps: that.wpId.length ? that.wpId.toString() : that.wpIps,
  196. isAsc: that.isAsc,
  197. beginDate: that.beginDate,
  198. endDate: that.endDate,
  199. orderByColumn: "",
  200. },
  201. success(res) {
  202. res.data.forEach((ele) => {
  203. ele.beginDate = new Date(ele.beginDate).formatDate("yyyy-MM-dd");
  204. ele.endDate = new Date(ele.beginDate).formatDate("yyyy-MM-dd");
  205. ele.speed = ele.speed.toFixed(2);
  206. });
  207. res.data.sort((a, b) => {
  208. return b.power - a.power;
  209. });
  210. that.tableData.data = res.data;
  211. },
  212. });
  213. }
  214. },
  215. search() {
  216. this.getOutputSpeedList();
  217. },
  218. },
  219. created() {
  220. this.requestData();
  221. },
  222. mounted() {},
  223. unmounted() {},
  224. };
  225. </script>
  226. <style lang="less" scoped>
  227. .draught-fan-list {
  228. width: 100%;
  229. height: 100%;
  230. display: flex;
  231. flex-direction: column;
  232. .btn-group-tabs {
  233. display: flex;
  234. flex-direction: row;
  235. .photovoltaic {
  236. margin-left: 1.481vh;
  237. }
  238. }
  239. .df-table {
  240. border: 0.093vh solid fade(@darkgray, 50%);
  241. position: relative;
  242. overflow: hidden;
  243. flex-grow: 1;
  244. margin-top: 1.481vh;
  245. height: 80vh;
  246. &:before {
  247. content: "";
  248. width: 0.37vh;
  249. height: 0.37vh;
  250. background: @write;
  251. position: absolute;
  252. left: 0.278vh;
  253. top: 0.278vh;
  254. }
  255. tbody {
  256. height: calc(100vh - 166px);
  257. }
  258. }
  259. }
  260. </style>