dataDispose.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. <template>
  2. <div class="dataDisposeBox">
  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
  9. v-model="changzhan"
  10. placeholder="请选择"
  11. popper-class="select"
  12. @change="
  13. () => {
  14. getFengji();
  15. }
  16. "
  17. >
  18. <el-option
  19. v-for="item in changzhanArray"
  20. :key="item.id"
  21. :value="item.id"
  22. :label="item.name"
  23. >
  24. </el-option>
  25. </el-select>
  26. </div>
  27. </div>
  28. <div class="query-item">
  29. <div class="lable">风机:</div>
  30. <div class="search-input">
  31. <el-select
  32. v-model="fengji"
  33. clearable
  34. placeholder="请选择"
  35. popper-class="select"
  36. multiple
  37. collapse-tags
  38. >
  39. <el-option
  40. v-for="item in fengjiArray"
  41. :key="item.id"
  42. :value="item.id"
  43. :label="item.name"
  44. >
  45. </el-option>
  46. </el-select>
  47. </div>
  48. </div>
  49. <div class="query-item">
  50. <div class="lable">时间:</div>
  51. <div class="search-input">
  52. <el-date-picker
  53. v-model="date"
  54. type="month"
  55. value-format="YYYY-MM"
  56. placeholder="请选择"
  57. popper-class="date-select"
  58. >
  59. </el-date-picker>
  60. </div>
  61. </div>
  62. <div class="query-actions" style="margin-left: 0px">
  63. <button class="btn green" @click="apply">数据预处理</button>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="query mg-b-8">
  68. <div class="query-items">
  69. <div class="query-item">
  70. <div class="lable">筛选条件:</div>
  71. </div>
  72. <div class="query-item">
  73. <el-checkbox-group v-model="checkList">
  74. <el-checkbox label="connected" size="small">并网</el-checkbox>
  75. <el-checkbox label="correct" size="small">合理值</el-checkbox>
  76. <el-checkbox label="connected10" size="small"
  77. >并网十分钟</el-checkbox
  78. >
  79. <el-checkbox label="prestop10" size="small"
  80. >停机前十分钟</el-checkbox
  81. >
  82. <el-checkbox label="levels" size="small">欠符合等级</el-checkbox>
  83. <el-select
  84. v-model="qfhdj"
  85. placeholder=" "
  86. size="small"
  87. style="width: 100px; margin-left: 12px"
  88. clearable
  89. @change="selectChange"
  90. >
  91. <el-option
  92. v-for="item in qfhdjArray"
  93. :key="item.id"
  94. :label="item.label"
  95. :value="item.id"
  96. />
  97. </el-select>
  98. </el-checkbox-group>
  99. </div>
  100. <div class="query-item">
  101. <div class="lable">间隔:</div>
  102. <el-select
  103. v-model="jg"
  104. placeholder="请选择"
  105. size="small"
  106. style="width: 100px; margin-left: 12px"
  107. >
  108. <el-option
  109. v-for="item in jgArray"
  110. :key="item.id"
  111. :label="item.label"
  112. :value="item.id"
  113. />
  114. </el-select>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="dataBox">
  119. <div class="l">
  120. <el-tree
  121. accordion
  122. :data="treeData"
  123. :props="{
  124. children: 'children',
  125. label: 'windturbineid',
  126. }"
  127. @node-click="nodeClick"
  128. />
  129. </div>
  130. <div class="r">
  131. <el-table
  132. :data="tableData"
  133. style="width: 100%; height: 85%; overflow-y: scroll"
  134. height="250"
  135. border
  136. >
  137. <el-table-column
  138. prop="time"
  139. label="时间"
  140. width="200px"
  141. align="center"
  142. ></el-table-column>
  143. <el-table-column
  144. prop="windturbineid"
  145. label="风机"
  146. sortable
  147. align="center"
  148. ></el-table-column>
  149. <el-table-column
  150. prop="power"
  151. label="风机功率"
  152. width="200px"
  153. sortable
  154. align="center"
  155. ></el-table-column>
  156. <el-table-column
  157. prop="speed"
  158. label="风机风速"
  159. width="200px"
  160. sortable
  161. align="center"
  162. ></el-table-column>
  163. <el-table-column
  164. prop="rotate"
  165. label="风机发电机转速"
  166. width="200px"
  167. sortable
  168. align="center"
  169. ></el-table-column>
  170. <el-table-column
  171. prop="status"
  172. label="风机状态"
  173. sortable
  174. align="center"
  175. ></el-table-column>
  176. <el-table-column
  177. prop="quantity"
  178. label="风机电量"
  179. sortable
  180. align="center"
  181. ></el-table-column>
  182. <el-table-column
  183. prop="curveoffset"
  184. label="欠发状态"
  185. sortable
  186. align="center"
  187. ></el-table-column>
  188. <el-table-column
  189. prop="direction"
  190. label="风向"
  191. width="200px"
  192. sortable
  193. align="center"
  194. ></el-table-column>
  195. <el-table-column
  196. prop="angle"
  197. label="对风角度"
  198. width="200px"
  199. sortable
  200. align="center"
  201. ></el-table-column>
  202. </el-table>
  203. <el-pagination
  204. v-model:currentPage="currentPage"
  205. v-model:page-size="pageSize"
  206. :page-sizes="[500, 1000, 2000]"
  207. :small="small"
  208. :background="false"
  209. layout="total, sizes, prev, pager, next, jumper"
  210. :total="tableTotal"
  211. @size-change="changeTableSize"
  212. @current-change="changeCurrentPage"
  213. />
  214. </div>
  215. </div>
  216. </div>
  217. </template>
  218. <script>
  219. import axios from "axios";
  220. export default {
  221. components: {},
  222. data() {
  223. return {
  224. treeData: [],
  225. changzhan: "",
  226. changzhanArray: [],
  227. fengji: [],
  228. fengjiArray: [],
  229. date: new Date().formatDate("yyyy-MM"),
  230. checkList: [],
  231. qfhdj: "2",
  232. qfhdjArray: [
  233. {
  234. id: "1",
  235. label: "1",
  236. },
  237. {
  238. id: "2",
  239. label: "2",
  240. },
  241. {
  242. id: "3",
  243. label: "3",
  244. },
  245. {
  246. id: "4",
  247. label: "4",
  248. },
  249. {
  250. id: "5",
  251. label: "5",
  252. },
  253. ],
  254. jg: "300",
  255. jgArray: [
  256. {
  257. id: "1",
  258. label: "1秒钟",
  259. },
  260. {
  261. id: "60",
  262. label: "1分钟",
  263. },
  264. {
  265. id: "300",
  266. label: "5分钟",
  267. },
  268. {
  269. id: "900",
  270. label: "15分钟",
  271. },
  272. ],
  273. tableData: [],
  274. currentPage: 1,
  275. pageSize: 500,
  276. tableTotal: 0,
  277. };
  278. },
  279. created() {
  280. this.getChangeZhan();
  281. this.getTree();
  282. },
  283. methods: {
  284. // 数据预处理
  285. apply() {
  286. let stationen = this.changzhan;
  287. let windturbineid = this.fengji;
  288. let time = this.date;
  289. let connected = false;
  290. let correct = false;
  291. let connected10 = false;
  292. let prestop10 = false;
  293. let levels = null;
  294. let intervals = ~~this.jg;
  295. let params = {
  296. stationen,
  297. windturbineid,
  298. time,
  299. connected,
  300. correct,
  301. connected10,
  302. prestop10,
  303. levels,
  304. intervals,
  305. };
  306. this.checkList.forEach((ele) => {
  307. for (let key in params) {
  308. if (key === ele && ele !== "levels") {
  309. params[key] = true;
  310. }
  311. if (ele === "levels") {
  312. params.levels = ~~this.qfhdj || null;
  313. }
  314. }
  315. });
  316. if (!params.windturbineid) {
  317. this.BASE.showMsg({
  318. msg: "风机不可为空",
  319. });
  320. } else if (!params.time) {
  321. this.BASE.showMsg({
  322. msg: "时间不可为空",
  323. });
  324. } else {
  325. this.sendData(params);
  326. }
  327. },
  328. // 发送数据预处理数据
  329. sendData(data) {
  330. const that = this;
  331. axios({
  332. method: "post",
  333. url: "http://192.168.1.18:9002/scatter/preprocess",
  334. data,
  335. header: {
  336. "Content-Type": "application/json",
  337. },
  338. }).then((res) => {
  339. if (res.data.code === 200) {
  340. that.BASE.showMsg({
  341. type: "success",
  342. msg: "数据已提交,请稍后刷新页面查看",
  343. });
  344. }
  345. });
  346. },
  347. // 获取树形数据
  348. getTree() {
  349. const that = this;
  350. that.API.requestData({
  351. method: "GET",
  352. baseURL: "http://192.168.1.18:9002/",
  353. subUrl: "powercurve/tree",
  354. success(res) {
  355. that.treeData = res.data;
  356. },
  357. });
  358. },
  359. // 获取场站列表
  360. getChangeZhan() {
  361. const that = this;
  362. that.API.requestData({
  363. method: "GET",
  364. baseURL: "http://10.155.32.4:9001/",
  365. subUrl: "benchmarking/wplist",
  366. success(res) {
  367. that.changzhanArray = res.data;
  368. that.changzhan = res.data[0].id;
  369. that.getFengji();
  370. },
  371. });
  372. },
  373. // 获取风机列表
  374. getFengji(fjId) {
  375. const that = this;
  376. that.API.requestData({
  377. method: "GET",
  378. baseURL: "http://10.155.32.4:9001/",
  379. subUrl: "benchmarking/wtList",
  380. data: {
  381. wpid: that.changzhan,
  382. },
  383. success(res) {
  384. that.fengjiArray = res.data;
  385. that.fengji = fjId?.split(",") || [res.data[0].id];
  386. if (fjId) that.getTableData();
  387. },
  388. });
  389. },
  390. // 欠符合等级 checkbox 勾选逻辑修改
  391. selectChange(res) {
  392. let resultIndex = 0;
  393. const result = this.checkList.some((ele, index) => {
  394. if (ele === "levels") {
  395. resultIndex = index;
  396. }
  397. return ele === "levels";
  398. });
  399. if (res) {
  400. if (!result) {
  401. this.checkList.push("levels");
  402. }
  403. } else {
  404. if (result) {
  405. this.checkList.splice(resultIndex, 1);
  406. }
  407. }
  408. },
  409. // 获取表格数据
  410. getTableData() {
  411. const that = this;
  412. that.API.requestData({
  413. method: "GET",
  414. baseURL: "http://192.168.1.18:9002/",
  415. subUrl: "powercurve/list",
  416. data: {
  417. station: that.changzhan,
  418. wtid: that.fengji,
  419. time: that.date,
  420. pagenum: that.currentPage,
  421. pagesize: that.pageSize,
  422. },
  423. success(res) {
  424. that.tableData = res.data.list;
  425. that.tableTotal = res.data.total;
  426. },
  427. });
  428. },
  429. // 修改分页每页显示数量
  430. changeTableSize(res) {
  431. this.pageSize = res;
  432. this.currentPage = 1;
  433. this.getTableData();
  434. },
  435. // 修改分页当前页数
  436. changeCurrentPage(res) {
  437. this.currentPage = res;
  438. this.getTableData();
  439. },
  440. // 树形结构点击处理
  441. nodeClick(res) {
  442. if (!res.children) {
  443. this.changzhan = res.stationen;
  444. let checkList = [];
  445. if (res.connected) checkList.push("connected");
  446. if (res.correct) checkList.push("correct");
  447. if (res.connected10) checkList.push("connected10");
  448. if (res.prestop10) checkList.push("prestop10");
  449. if (res.levels) {
  450. checkList.push("levels");
  451. this.qfhdj = String(res.levels);
  452. } else {
  453. this.qfhdj = "";
  454. }
  455. this.date = res.time;
  456. this.jg = String(res.intervals);
  457. this.checkList = checkList;
  458. this.getFengji(res.windturbineid);
  459. }
  460. },
  461. },
  462. };
  463. </script>
  464. <style lang="less" scoped>
  465. .dataDisposeBox {
  466. height: 100%;
  467. .dataBox {
  468. display: flex;
  469. justify-content: space-between;
  470. align-items: flex-start;
  471. width: 100%;
  472. height: 100%;
  473. .l {
  474. width: 20%;
  475. height: 100%;
  476. .el-tree {
  477. height: 100%;
  478. }
  479. }
  480. .r {
  481. width: 80%;
  482. height: 100%;
  483. }
  484. }
  485. }
  486. </style>
  487. <style lang="less">
  488. .dataDisposeBox {
  489. .el-checkbox__input {
  490. display: inline-block;
  491. }
  492. .el-checkbox__inner {
  493. position: absolute;
  494. top: calc(50% - 7px);
  495. }
  496. .el-checkbox__label {
  497. height: 100%;
  498. display: flex;
  499. justify-content: start;
  500. align-items: center;
  501. }
  502. }
  503. </style>