Decision3Db.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <template>
  2. <div class="decision-page-3">
  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="value1"
  10. @change="ChangZhanChange(value1)"
  11. clearable
  12. placeholder="请选择"
  13. popper-class="select"
  14. >
  15. <el-option
  16. v-for="item in ChangZhan"
  17. :key="item.id"
  18. :value="item.id"
  19. :label="item.name"
  20. >
  21. </el-option>
  22. </el-select>
  23. </div>
  24. </div>
  25. <div class="query-item">
  26. <div class="lable">风机:</div>
  27. <div class="search-input">
  28. <el-select
  29. v-model="value2"
  30. @change="XiangMuChange(value2)"
  31. multiple
  32. multiple-limit="5"
  33. collapse-tags
  34. placeholder="请选择"
  35. popper-class="select"
  36. >
  37. <el-option
  38. v-for="item in XiangMu"
  39. :key="item.id"
  40. :value="item.id"
  41. :label="item.name"
  42. >
  43. </el-option>
  44. </el-select>
  45. </div>
  46. </div>
  47. <div class="query-item">
  48. <div class="lable">日期:</div>
  49. <div class="search-input">
  50. <el-date-picker
  51. v-model="value4"
  52. @change="BeginChange(value4)"
  53. type="date"
  54. value-format="YYYY-MM-DD"
  55. placeholder="选择日期"
  56. popper-class="date-select"
  57. >
  58. </el-date-picker>
  59. </div>
  60. </div>
  61. <div class="query-actions">
  62. <button class="btn" @click="reset">重置</button>
  63. </div>
  64. </div>
  65. <div class="actions mg-b-8">
  66. <button
  67. class="btn"
  68. :class="TypeClass == 0 ? 'green' : ''"
  69. @click="TypeClick(0)"
  70. >
  71. 日风电机对比
  72. </button>
  73. <button
  74. class="btn"
  75. :class="TypeClass == 1 ? 'green' : ''"
  76. @click="TypeClick(1)"
  77. >
  78. 月风电机对比
  79. </button>
  80. <button
  81. class="btn"
  82. :class="TypeClass == 2 ? 'green' : ''"
  83. @click="TypeClick(2)"
  84. >
  85. 年风电机对比
  86. </button>
  87. </div>
  88. </div>
  89. <!-- 列表 -->
  90. <toolbar-panel title="单机横向对比" :showLine="false"></toolbar-panel>
  91. <div class="info">
  92. <div class="mg-b-16">
  93. <div class="project-table">
  94. <Table :data="tableData"></Table>
  95. </div>
  96. </div>
  97. <!-- 风资源列表 -->
  98. <div class="direction-info mg-b-16">
  99. <table class="com-table">
  100. <tbody>
  101. <tr>
  102. <td v-for="(col, i) of tableData.column" :key="i">
  103. <div v-if="i == 0">22</div>
  104. <div v-if="i == 1">风资源</div>
  105. <div v-if="i != 0 && i != 1">
  106. <div class="direction-title">{{ listName[i - 2] }}</div>
  107. <div
  108. class="direction-chart"
  109. :class="i - 2 < fzyData.length ? '' : 'hide'"
  110. >
  111. <normal-radar-chart
  112. :width="'70%'"
  113. :height="'232px'"
  114. :value="fzyData[i - 2]"
  115. />
  116. </div>
  117. </div>
  118. </td>
  119. </tr>
  120. </tbody>
  121. </table>
  122. </div>
  123. <!-- 日功率曲线 -->
  124. <div>
  125. <toolbar-panel :title="'日功率曲线'">
  126. <template v-slot:tools>
  127. <div class="tools">
  128. <div
  129. class="tool-block"
  130. v-for="(item, index) in listName"
  131. :key="index"
  132. >
  133. <div class="legend" :class="'bg-' + (index + 1)"></div>
  134. <div class="legend-text">{{ item }}</div>
  135. </div>
  136. </div>
  137. </template>
  138. <double-line-chart :height="'200px'" :list="list" />
  139. </toolbar-panel>
  140. </div>
  141. </div>
  142. </div>
  143. </template>
  144. <script>
  145. import DoubleLineChart from "../../components/chart/line/DayPowerChart.vue";
  146. import NormalRadarChart from "../../components/chart/radar/normal-radar-chart.vue";
  147. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  148. import ToolbarPanel from "../../components/coms/panel/toolbar-panel.vue";
  149. import Table from "../../components/coms/table/table.vue";
  150. import api from "@api/economic/index.js";
  151. export default {
  152. components: {
  153. Table,
  154. SvgIcon,
  155. ToolbarPanel,
  156. DoubleLineChart,
  157. NormalRadarChart,
  158. },
  159. data() {
  160. return {
  161. tableData: {
  162. column: [
  163. {
  164. name: "",
  165. field: "index",
  166. is_num: false,
  167. is_light: false,
  168. },
  169. {
  170. name: "项目",
  171. field: "name",
  172. is_num: false,
  173. is_light: false,
  174. },
  175. {
  176. name: "",
  177. field: "data1",
  178. is_num: false,
  179. is_light: false,
  180. },
  181. {
  182. name: "",
  183. field: "data2",
  184. is_num: false,
  185. is_light: false,
  186. },
  187. {
  188. name: "",
  189. field: "data3",
  190. is_num: false,
  191. is_light: false,
  192. },
  193. {
  194. name: "",
  195. field: "data4",
  196. is_num: false,
  197. is_light: false,
  198. },
  199. {
  200. name: "",
  201. field: "data5",
  202. is_num: false,
  203. is_light: false,
  204. },
  205. ],
  206. data: [],
  207. },
  208. ChangZhan: [], //场站
  209. XiangMu: [], //项目
  210. value1: [],
  211. value2: [],
  212. value4: "",
  213. fzyData: [],
  214. list: [{ value: [{ text: "", value: 0 }] }],
  215. listName: [],
  216. TypeClass: 0,
  217. ajaxArr: ["daydjhxdbtop", "monthdjhxdbtop", "yeardjhxdbtop"],
  218. ajaxName: "daydjhxdbtop",
  219. };
  220. },
  221. created() {
  222. this.ChangZhanVal();
  223. this.value4 = this.getTime(1);
  224. },
  225. methods: {
  226. ChangZhanVal() {
  227. api.benchmarkingWplist({}).then((res) => {
  228. this.ChangZhan = res.data;
  229. this.value1 = res.data[0].code;
  230. this.XiangMuVal(res.data[0].code);
  231. });
  232. },
  233. ChangZhanChange(val) {
  234. this.value1 = val;
  235. this.value2 = [];
  236. this.AjaxCommon();
  237. this.XiangMuVal(val);
  238. },
  239. XiangMuVal(val) {
  240. api
  241. .benchmarkingWtList({
  242. wpid: val ? val : "",
  243. })
  244. .then((res) => {
  245. this.XiangMu = res.data;
  246. this.value2.push(res.data[0].id);
  247. this.AjaxCommon();
  248. });
  249. },
  250. XiangMuChange(val) {
  251. var that = this;
  252. that.value2 = val;
  253. that.AjaxCommon();
  254. },
  255. getTime(val) {
  256. //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  257. var date = new Date();
  258. var year = date.getFullYear(),
  259. month = date.getMonth() + 1,
  260. day = date.getDate();
  261. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  262. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  263. var begin = year + "-" + month + "-01";
  264. var end = year + "-" + month + "-" + day;
  265. if (val == 1) {
  266. return begin;
  267. } else if (val == 2) {
  268. return end;
  269. }
  270. },
  271. AjaxCommon() {
  272. this.list = []
  273. api
  274. .ajaxName({
  275. ajaxName: this.ajaxName,
  276. wpid: this.value1,
  277. wtids: this.value2,
  278. date: this.value4,
  279. target: "",
  280. sort: "",
  281. })
  282. .then((res) => {
  283. var data = res.data,
  284. data2 = [],
  285. chart = [],
  286. fzy = [],
  287. fzyArr = [],
  288. jfpl = [],
  289. jfplArr = [];
  290. let thisItem = [];
  291. jfpl = data.pop(); //静风频率
  292. fzy = data.pop(); //风资源
  293. if (fzy["1"] == null) {
  294. this.BASE.showMsg({
  295. msg: "此风机无数据",
  296. type: "success",
  297. });
  298. return false;
  299. }
  300. data.forEach((ele, index) => {
  301. for (let key in ele) {
  302. if (key !== "name") {
  303. thisItem.push(ele[key]);
  304. }
  305. }
  306. });
  307. var count = thisItem.length / data.length;
  308. data.forEach((item, index) => {
  309. data2.push({
  310. index: index + 1,
  311. name: item.name,
  312. data1: thisItem[index * count],
  313. data2: count >= 2 ? thisItem[index * count + 1] : [],
  314. data3: count >= 3 ? thisItem[index * count + 2] : [],
  315. data4: count >= 4 ? thisItem[index * count + 3] : [],
  316. data5: count >= 5 ? thisItem[index * count + 4] : [],
  317. is_light: false,
  318. });
  319. });
  320. Object.keys(fzy).map((key) => {
  321. fzyArr.push(fzy[key]);
  322. });
  323. Object.keys(jfpl).map((key) => {
  324. jfplArr.push(jfpl[key]);
  325. });
  326. fzyArr.pop();
  327. var jfplName = jfplArr.pop();
  328. var indicator = [
  329. "北",
  330. "北北西",
  331. "北西",
  332. "西北西",
  333. "西",
  334. "西南西",
  335. "南西",
  336. "南南西",
  337. "南",
  338. "南南东",
  339. "东南",
  340. "东南东",
  341. "东",
  342. "东北东",
  343. "北东",
  344. "北北东",
  345. ];
  346. var fzyDataArr = [];
  347. fzyArr.forEach((item, index) => {
  348. var arr = [];
  349. item.forEach((e, i) => {
  350. arr.push(e.value);
  351. });
  352. fzyDataArr.push([
  353. {
  354. indicator: indicator,
  355. data: [
  356. {
  357. value: arr,
  358. },
  359. ],
  360. name: jfplArr[index],
  361. },
  362. ]);
  363. });
  364. this.fzyData = fzyDataArr;
  365. this.tableData.data = data2;
  366. });
  367. api
  368. .benchmarkingDjhxdbbottom({
  369. wpid: this.value1,
  370. wtids: this.value2,
  371. date: this.value4,
  372. })
  373. .then((res) => {
  374. console.log(res.data);
  375. // var data = res.data;
  376. // var arrName = [],
  377. // arrKey = [],
  378. // arrData = [],
  379. // tempArray = [];
  380. // data?.forEach((ele) => {
  381. // for (let key in ele) {
  382. // if (key !== "name") {
  383. // arrKey.push(key);
  384. // arrData.push(ele[key]);
  385. // } else {
  386. // arrName.push(ele[key]);
  387. // }
  388. // }
  389. // });
  390. // this.listName = arrName;
  391. // for (var i = 0; i < arrKey.length - 1; i++) {
  392. // //冒泡排序
  393. // for (var j = 0; j < arrKey.length - 1 - i; j++) {
  394. // if (parseInt(arrKey[j]) > parseInt(arrKey[j + 1])) {
  395. // var temp = arrKey[j];
  396. // arrKey[j] = arrKey[j + 1];
  397. // arrKey[j + 1] = temp;
  398. // var temp2 = arrData[j];
  399. // arrData[j] = arrData[j + 1];
  400. // arrData[j + 1] = temp2;
  401. // }
  402. // }
  403. // }
  404. // for (var i = 0; i < data.length; i++) {
  405. // var arr = [];
  406. // arrData.forEach((e, index) => {
  407. // if (index * data.length + i < arrData.length) {
  408. // arr.push({
  409. // text: arrKey[index * data.length + i],
  410. // value: arrData[index * data.length + i],
  411. // });
  412. // }
  413. // });
  414. // tempArray.push({
  415. // title: arrName[i],
  416. // value: arr,
  417. // });
  418. // }
  419. // this.list = res.data;
  420. for (const key in res.data) {
  421. let obj = {}
  422. obj.name = key
  423. obj.value = res.data[key]
  424. this.list.push(obj)
  425. }
  426. console.log(" this.list", this.list);
  427. });
  428. },
  429. reset() {
  430. //重置
  431. this.value1 = "";
  432. this.value2 = "";
  433. this.value4 = this.getTime(1);
  434. this.AjaxCommon();
  435. },
  436. TypeClick(val) {
  437. this.TypeClass = val;
  438. // 重置状态start
  439. // this.value1 = "";
  440. // this.value2 = "";
  441. this.value4 = this.getTime(1);
  442. this.ajaxName = this.ajaxArr[val];
  443. this.AjaxCommon();
  444. // 重置状态end
  445. },
  446. },
  447. watch: {
  448. value4() {
  449. this.AjaxCommon();
  450. },
  451. },
  452. };
  453. </script>
  454. <style lang="less">
  455. .decision-page-3 {
  456. .com-panel {
  457. .panel-title {
  458. color: @gray-l;
  459. }
  460. .tools {
  461. display: flex;
  462. .tool-block {
  463. display: flex;
  464. align-items: center;
  465. margin-left: 0.741vh;
  466. .legend {
  467. flex: auto;
  468. width: 0.741vh;
  469. height: 0.741vh;
  470. margin-right: 0.741vh;
  471. &.long {
  472. width: 2.963vh;
  473. height: 0.37vh;
  474. }
  475. }
  476. .legend-text {
  477. color: @gray-l;
  478. font-size: @fontsize-s;
  479. }
  480. }
  481. }
  482. }
  483. .info {
  484. overflow: auto;
  485. height: calc(100vh - 150px);
  486. }
  487. .project-table {
  488. overflow: auto;
  489. .com-table {
  490. tbody {
  491. padding-right: 0px;
  492. }
  493. th,
  494. td {
  495. color: #b2bdc0;
  496. &:nth-child(1) {
  497. width: 32px;
  498. }
  499. &:nth-child(2) {
  500. width: 183px;
  501. }
  502. }
  503. }
  504. }
  505. .direction-info {
  506. .com-table {
  507. tbody {
  508. padding-right: 0px;
  509. }
  510. th,
  511. td {
  512. color: #b2bdc0;
  513. padding: 0;
  514. &:nth-child(1) {
  515. width: 32px;
  516. background-color: fade(#536268, 20);
  517. }
  518. &:nth-child(2) {
  519. width: 183px;
  520. background-color: fade(#536268, 40);
  521. }
  522. .direction-title {
  523. background-color: fade(#536268, 20);
  524. font-size: @fontsize-s;
  525. line-height: 2.963vh;
  526. }
  527. .direction-chart {
  528. padding-top: 48px;
  529. .legend {
  530. display: flex;
  531. align-items: center;
  532. justify-content: center;
  533. margin-top: 32px;
  534. margin-bottom: 16px;
  535. .dot {
  536. width: 7px;
  537. height: 7px;
  538. background: @green;
  539. display: inline-block;
  540. margin-right: 8px;
  541. }
  542. }
  543. }
  544. }
  545. }
  546. }
  547. }
  548. .hide {
  549. opacity: 0;
  550. }
  551. .bg-1 {
  552. background: #05bb4c;
  553. }
  554. .bg-2 {
  555. background: #f8de5b;
  556. }
  557. .bg-3 {
  558. background: #4b55ae;
  559. }
  560. .bg-4 {
  561. background: #fa8c16;
  562. }
  563. .bg-5 {
  564. background: #1da0d7;
  565. }
  566. </style>