index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. <template>
  2. <div class="parcel-box">
  3. <div class="search">
  4. <div class="search-left">
  5. <el-select
  6. size="mini"
  7. v-model="company"
  8. placeholder="请选择"
  9. @change="getHomePageData()"
  10. >
  11. <el-option
  12. v-for="item in companyOptions"
  13. :key="item.id"
  14. :label="item.aname"
  15. :value="item.id"
  16. >
  17. </el-option>
  18. </el-select>
  19. <div class="tabCut">
  20. <div
  21. @click="tabClick(val.id)"
  22. :class="tabIndex === val.id ? 'active' : ''"
  23. v-for="val in tabOptions"
  24. :key="val.id"
  25. >
  26. <span>{{ val.name }}</span>
  27. </div>
  28. </div>
  29. <div>
  30. <el-date-picker
  31. v-model="searchYear"
  32. size="mini"
  33. type="year"
  34. value-format="YYYY"
  35. placeholder="选择年"
  36. popper-class="date-select"
  37. >
  38. </el-date-picker>
  39. </div>
  40. <el-button round size="mini" class="searchColor" @click="search"
  41. >搜索</el-button
  42. >
  43. </div>
  44. <div class="search-right">
  45. <img class="select-back" src="@assets/imgs/select-back.png" />
  46. <div class="title-select">
  47. <el-select
  48. v-model="selectValue"
  49. placeholder="请选择"
  50. @change="getHomePageData()"
  51. clearable
  52. >
  53. <el-option
  54. v-for="item in selectList"
  55. :key="item.name"
  56. :label="item.name"
  57. :value="item.name"
  58. >
  59. </el-option>
  60. </el-select>
  61. </div>
  62. </div>
  63. <!-- <el-button round size="mini">导出</el-button> -->
  64. </div>
  65. <div class="data-bodys">
  66. <div class="line clearfix">
  67. <div class="leftContent left">
  68. <span>{{ selectValue }}</span>
  69. </div>
  70. <div class="rightContent floatRight"></div>
  71. </div>
  72. <div class="economicTable">
  73. <el-table
  74. :data="tableData"
  75. style="width: 100%"
  76. size="mini"
  77. stripe
  78. height="50vh"
  79. @row-click="rowClick"
  80. >
  81. <el-table-column
  82. align="center"
  83. prop=""
  84. label="场站"
  85. show-overflow-tooltip
  86. sortable
  87. >
  88. <template v-slot="scope">
  89. <span style="cursor: pointer">{{ scope.row.wpname }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column
  93. align="center"
  94. :label="val"
  95. v-for="(val, index) in tableHead"
  96. :key="index"
  97. width="144"
  98. sortable
  99. >
  100. <template v-slot="scope">
  101. <div v-if="scope.row.wpname == ''">
  102. <el-row>
  103. <el-col :span="12"
  104. ><span>{{ scope.row.data?.current }}</span></el-col
  105. >
  106. <el-col :span="12"
  107. ><span>{{ scope.row.data.sameperiod }}</span></el-col
  108. >
  109. </el-row>
  110. </div>
  111. <div v-else>
  112. <el-row>
  113. <el-col :span="12" class="columnFlex">
  114. <div
  115. v-if="
  116. scope.row.targetList[index]?.current ||
  117. scope.row.targetList[index]?.current === 0
  118. "
  119. class="box-item"
  120. >
  121. <el-tooltip
  122. effect="dark"
  123. :content="scope.row.targetList[index]?.current"
  124. placement="top-start"
  125. >
  126. <div>
  127. <span style="width: 80%">{{
  128. scope.row.targetList &&
  129. scope.row.targetList[index]?.current
  130. }}</span>
  131. </div>
  132. </el-tooltip>
  133. </div>
  134. <div v-else class="box-item">--</div>
  135. <div style="flex: 0 0 auto; line-height: 1">
  136. <Bottom
  137. class="botSvg"
  138. v-if="
  139. scope.row.targetList &&
  140. scope.row.targetList[index]?.current <
  141. scope.row.targetList[index]?.sameperiod
  142. "
  143. />
  144. <Top
  145. class="topSvg"
  146. v-if="
  147. scope.row.targetList &&
  148. scope.row.targetList[index]?.current >
  149. scope.row.targetList[index]?.sameperiod
  150. "
  151. />
  152. </div>
  153. </el-col>
  154. <el-col :span="12"
  155. ><span>{{
  156. scope.row.targetList &&
  157. (scope.row.targetList[index]?.sameperiod ||
  158. scope.row.targetList[index]?.sameperiod === 0
  159. ? scope.row.targetList[index]?.sameperiod
  160. : "--")
  161. }}</span></el-col
  162. >
  163. </el-row>
  164. </div>
  165. </template>
  166. </el-table-column>
  167. </el-table>
  168. </div>
  169. </div>
  170. <div class="echarts" style="height: 30vh">
  171. <div class="chart-name">
  172. <div class="point point-left bottom"></div>
  173. <div class="point point-right bottom"></div>
  174. {{ selectValue }}
  175. </div>
  176. <div>
  177. <BarCharts
  178. :list="barList"
  179. width="97%"
  180. height="32vh"
  181. :top="60"
  182. :pillarName="pillarName"
  183. :xdate="false"
  184. :showLegend="true"
  185. :units="['', '']"
  186. ></BarCharts>
  187. </div>
  188. </div>
  189. </div>
  190. </template>
  191. <script>
  192. // import Panel from "@/components/curveAnalyse/panel.vue";
  193. // import ChartColumnar from '@/components/curveAnalyse/multiple-bar-chart.vue'
  194. import BarCharts from "../../homePage/components/barCharts.vue";
  195. // import { companys, fnlylList, gzsslList, whsslList, xdsslList, xnsslList, slsslList } from '@/api/curveAnalyse'
  196. import {
  197. companys,
  198. gzsslList,
  199. whsslList,
  200. xdsslList,
  201. xnsslList,
  202. slsslList,
  203. } from "@/api/curveAnalyse";
  204. export default {
  205. name: "curveAnalyse",
  206. components: {
  207. // ChartColumnar,
  208. // Panel,
  209. BarCharts,
  210. },
  211. data() {
  212. return {
  213. pillarName: "",
  214. // echartsData: [],
  215. // tableName: "",
  216. list: [],
  217. // DayPower: {
  218. // // 图表所用单位
  219. // units: [""],
  220. // value: [
  221. // {
  222. // title: "",
  223. // yAxisIndex: 0, // 使用单位
  224. // value: [],
  225. // },
  226. // ],
  227. // },
  228. // BarChartsList: [],
  229. tabIndex: -1,
  230. tabOptions: [
  231. { id: -1, name: "风电" },
  232. { id: -2, name: "光伏" },
  233. ],
  234. // barHeight: '260px',
  235. barList: [],
  236. tableData: [],
  237. tableHead: [
  238. "一月",
  239. "二月",
  240. "三月",
  241. "四月",
  242. "五月",
  243. "六月",
  244. "七月",
  245. "八月",
  246. "九月",
  247. "十月",
  248. "十一月",
  249. "十二月",
  250. ],
  251. company: "",
  252. companyOptions: [],
  253. searchYear: this.getmonthValue(),
  254. selectValue: "故障损失率",
  255. selectList: [
  256. {
  257. name: "故障损失率",
  258. },
  259. {
  260. name: "维护损失率",
  261. },
  262. {
  263. name: "限电损失率",
  264. },
  265. {
  266. name: "受累损失率",
  267. },
  268. {
  269. name: "性能损失率",
  270. },
  271. ],
  272. };
  273. },
  274. watch: {},
  275. filters: {},
  276. computed: {},
  277. created() {
  278. this.initialization();
  279. },
  280. methods: {
  281. compare(property) {
  282. return (a, b) => {
  283. let val1 = a[property];
  284. let val2 = b[property];
  285. return val1 - val2;
  286. };
  287. },
  288. rowClick(list) {
  289. if (list?.wpname) {
  290. let barList = [
  291. {
  292. name: "本期",
  293. children: [],
  294. date: [],
  295. },
  296. {
  297. name: "同期",
  298. children: [],
  299. },
  300. ];
  301. this.pillarName = list.wpname;
  302. list.targetList.forEach((item) => {
  303. barList[0].date.push(item.month + "月");
  304. barList[0].children.push(item.current || 0);
  305. barList[1].children.push(item.compare || 0);
  306. });
  307. this.barList = barList;
  308. }
  309. },
  310. isNumber(val) {
  311. return typeof val === "number" && !isNaN(val);
  312. },
  313. search() {
  314. switch (this.selectValue) {
  315. case "故障损失率":
  316. gzsslList({
  317. companys: this.company,
  318. type: this.tabIndex,
  319. year: this.monthChange(this.searchYear),
  320. }).then(({ data: res }) => {
  321. if (res.data) {
  322. let arr = [
  323. {
  324. wpname: "",
  325. data: {
  326. wpname: "期次",
  327. current: "本期",
  328. sameperiod: "同期",
  329. },
  330. },
  331. ];
  332. this.tableData = [...arr, ...res.data];
  333. this.rowClick(res.data[res.data.length - 1]);
  334. }
  335. });
  336. break;
  337. case "维护损失率":
  338. whsslList({
  339. companys: this.company,
  340. type: this.tabIndex,
  341. year: this.monthChange(this.searchYear),
  342. }).then(({ data: res }) => {
  343. if (res.data) {
  344. let arr = [
  345. {
  346. wpname: "",
  347. data: {
  348. wpname: "期次",
  349. current: "本期",
  350. sameperiod: "同期",
  351. },
  352. },
  353. ];
  354. this.tableData = [...arr, ...res.data];
  355. this.rowClick(res.data[res.data.length - 1]);
  356. }
  357. });
  358. break;
  359. case "限电损失率":
  360. xdsslList({
  361. companys: this.company,
  362. type: this.tabIndex,
  363. year: this.monthChange(this.searchYear),
  364. }).then(({ data: res }) => {
  365. if (res.data) {
  366. let arr = [
  367. {
  368. wpname: "",
  369. data: {
  370. wpname: "期次",
  371. current: "本期",
  372. sameperiod: "同期",
  373. },
  374. },
  375. ];
  376. this.tableData = [...arr, ...res.data];
  377. this.rowClick(res.data[res.data.length - 1]);
  378. }
  379. });
  380. break;
  381. case "受累损失率":
  382. slsslList({
  383. companys: this.company,
  384. type: this.tabIndex,
  385. year: this.monthChange(this.searchYear),
  386. }).then(({ data: res }) => {
  387. if (res.data) {
  388. let arr = [
  389. {
  390. wpname: "",
  391. data: {
  392. wpname: "期次",
  393. current: "本期",
  394. sameperiod: "同期",
  395. },
  396. },
  397. ];
  398. this.tableData = [...arr, ...res.data];
  399. this.rowClick(res.data[res.data.length - 1]);
  400. }
  401. });
  402. break;
  403. case "性能损失率":
  404. xnsslList({
  405. companys: this.company,
  406. type: this.tabIndex,
  407. year: this.monthChange(this.searchYear),
  408. }).then(({ data: res }) => {
  409. if (res.data) {
  410. let arr = [
  411. {
  412. wpname: "",
  413. data: {
  414. wpname: "期次",
  415. current: "本期",
  416. sameperiod: "同期",
  417. },
  418. },
  419. ];
  420. this.tableData = [...arr, ...res.data];
  421. this.rowClick(res.data[res.data.length - 1]);
  422. }
  423. });
  424. break;
  425. }
  426. },
  427. getHomePageData() {
  428. this.search();
  429. },
  430. monthChange(data) {
  431. let year = new Date(data).getFullYear().toString();
  432. return year;
  433. },
  434. getmonthValue() {
  435. let year = new Date().getFullYear().toString();
  436. return year;
  437. },
  438. tabClick(data) {
  439. this.tabIndex = data;
  440. this.search();
  441. },
  442. initialization() {
  443. companys().then(({ data: res }) => {
  444. if (res.data) {
  445. this.companyOptions = res.data;
  446. this.company = res.data[0].id;
  447. this.search();
  448. }
  449. });
  450. },
  451. },
  452. mounted() {},
  453. beforeUnmount() {},
  454. };
  455. </script>
  456. <style lang="less" scoped>
  457. .data-bodys {
  458. display: flex;
  459. flex-direction: column;
  460. background-color: rgba(0, 0, 0, 0.45);
  461. border-radius: 5px;
  462. padding: 5px;
  463. }
  464. .parcel-box {
  465. padding: 0 20px;
  466. box-sizing: border-box;
  467. .economicTable {
  468. .el-table__body-wrapper {
  469. .columnFlex {
  470. display: flex;
  471. align-items: center;
  472. }
  473. .box-item {
  474. flex: 1;
  475. white-space: nowrap;
  476. overflow: hidden;
  477. text-overflow: ellipsis;
  478. }
  479. }
  480. .topSvg {
  481. width: 1em;
  482. height: 1em;
  483. color: #1c99ff;
  484. }
  485. .botSvg {
  486. width: 1em;
  487. height: 1em;
  488. color: #ff8300;
  489. }
  490. }
  491. .line {
  492. padding-bottom: 5px;
  493. .leftContent {
  494. width: 242px;
  495. height: 41px;
  496. line-height: 41px;
  497. background: url("../../../../assets/imgs/title_left_bg.png");
  498. span {
  499. font-size: 16px;
  500. font-family: Microsoft YaHei;
  501. font-weight: 400;
  502. color: #ffffff;
  503. margin-left: 25px;
  504. }
  505. }
  506. .rightContent {
  507. width: 212px;
  508. height: 28px;
  509. margin-top: 13px;
  510. background: url("../../../../assets/imgs/title_right_bg.png");
  511. }
  512. .floatRight {
  513. float: right;
  514. }
  515. }
  516. .search {
  517. display: flex;
  518. flex-direction: row;
  519. padding-top: 10px;
  520. align-items: center;
  521. justify-content: space-between;
  522. .search-left {
  523. display: flex;
  524. flex-direction: row;
  525. align-items: center;
  526. }
  527. .search-right {
  528. position: relative;
  529. .select-back {
  530. position: absolute;
  531. right: 5px;
  532. top: 0px;
  533. z-index: 0;
  534. }
  535. .title-select {
  536. z-index: 2;
  537. }
  538. }
  539. .tabCut {
  540. display: inline-block;
  541. margin: 0 20px;
  542. div {
  543. display: inline-block;
  544. width: 60px;
  545. height: 27px;
  546. border: 1px solid #274934;
  547. text-align: center;
  548. line-height: 25px;
  549. cursor: pointer;
  550. }
  551. div:nth-child(1) {
  552. border-radius: 13px 0px 0px 13px;
  553. border-right-width: 0;
  554. }
  555. div:nth-child(2) {
  556. border-radius: 0px 13px 13px 0px;
  557. }
  558. .active {
  559. background-color: rgba(5, 187, 76, 0.9);
  560. color: #fff;
  561. }
  562. }
  563. button {
  564. margin-left: 10px;
  565. background: rgba(67, 81, 107, 0.3);
  566. border: 1px solid #274934;
  567. color: #b3b3b3;
  568. }
  569. .searchColor {
  570. background-color: rgba(5, 187, 76, 0.2);
  571. border: 1px solid #3b6c53;
  572. color: #b3b3b3;
  573. font-size: 14px;
  574. &:hover {
  575. background-color: rgba(5, 187, 76, 0.5);
  576. color: #ffffff;
  577. }
  578. }
  579. }
  580. .echarts {
  581. margin-top: 20px;
  582. background-color: rgba(0, 0, 0, 0.45);
  583. border-radius: 5px;
  584. width: 100%;
  585. }
  586. }
  587. .clearfix::after {
  588. content: "";
  589. clear: both;
  590. height: 0;
  591. line-height: 0;
  592. visibility: hidden;
  593. display: block;
  594. }
  595. .clearfix {
  596. zoom: 1;
  597. }
  598. .left {
  599. float: left;
  600. }
  601. .right {
  602. float: right;
  603. }
  604. .el-table::before {
  605. height: 0;
  606. }
  607. .compare-lift-down {
  608. margin-left: 7px;
  609. font-size: 14px;
  610. font-family: Arial;
  611. font-weight: 400;
  612. color: #ff8300;
  613. }
  614. .compare-lift-up {
  615. margin-left: 7px;
  616. font-size: 14px;
  617. font-family: Arial;
  618. font-weight: 400;
  619. color: #1c99ff;
  620. }
  621. .chart-name {
  622. display: flex;
  623. align-items: center;
  624. justify-content: center;
  625. position: relative;
  626. width: 100%;
  627. height: 40px;
  628. border-bottom: 1px solid rgba(106, 106, 106, 0.5);
  629. font-size: 16px;
  630. font-family: Microsoft YaHei;
  631. font-weight: 400;
  632. color: #ffffff;
  633. }
  634. .point {
  635. width: 6px;
  636. height: 1px;
  637. background-color: #ffffff;
  638. position: absolute;
  639. &.point-left {
  640. left: 0;
  641. }
  642. &.point-right {
  643. right: 0;
  644. }
  645. &.top {
  646. top: -1px;
  647. }
  648. &.bottom {
  649. bottom: -1px;
  650. }
  651. }
  652. </style>