index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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="search()"
  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" v-if="$store.state.showGf">
  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 class="search-input">
  30. <el-date-picker
  31. size="mini"
  32. v-model="searchYear"
  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="search()"
  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="leftContent">
  67. <span>{{ selectValue + "分析" }}</span>
  68. </div>
  69. <div class="economicTable">
  70. <el-table
  71. :data="tableData"
  72. style="width: 100%"
  73. size="mini"
  74. stripe
  75. height="100%"
  76. @row-click="rowClick"
  77. >
  78. <el-table-column
  79. align="center"
  80. prop=""
  81. label="场站"
  82. width="100"
  83. show-overflow-tooltip
  84. sortable
  85. >
  86. <template v-slot="scope">
  87. <span style="cursor: pointer">{{ scope.row.wpname }}</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column
  91. align="center"
  92. :label="val"
  93. v-for="(val, index) in selectValue !== '利用小时'
  94. ? tableHead
  95. : tableHead1"
  96. :key="index"
  97. width="150"
  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. <div
  156. v-if="
  157. scope.row.targetList[index]?.sameperiod ||
  158. scope.row.targetList[index]?.sameperiod === 0
  159. "
  160. >
  161. <el-tooltip
  162. effect="dark"
  163. :content="scope.row.targetList[index]?.sameperiod"
  164. placement="top-start"
  165. >
  166. <div>
  167. <span style="width: 80%">{{
  168. scope.row.targetList &&
  169. scope.row.targetList[index]?.sameperiod
  170. }}</span>
  171. </div>
  172. </el-tooltip>
  173. </div>
  174. <div v-else>--</div>
  175. </el-col>
  176. </el-row>
  177. </div>
  178. </template>
  179. </el-table-column>
  180. </el-table>
  181. </div>
  182. </div>
  183. <div class="echarts">
  184. <div style="height: 100%; margin-top: 10px">
  185. <BarCharts
  186. :list="barList"
  187. width="97%"
  188. height="100%"
  189. :top="60"
  190. :pillarName="pillarName"
  191. :xdate="false"
  192. :showLegend="true"
  193. :units="['', '']"
  194. :units2="selectValue !== '利用小时' ? '(万kWh)' : '(h)'"
  195. ></BarCharts>
  196. </div>
  197. </div>
  198. </div>
  199. </template>
  200. <script>
  201. // import Panel from "@/components/curveAnalyse/panel.vue";
  202. // import ChartColumnar from '@/components/curveAnalyse/multiple-bar-chart.vue'
  203. import BarCharts from "@/views/economicsOperation/thematicAnalysis/components/barCharts.vue";
  204. import {
  205. companys,
  206. fdlList,
  207. zhcydlList,
  208. gwdlList,
  209. swdlList,
  210. lyxsList,
  211. } from "@/api/curveAnalyse";
  212. import dataJson from "./dataJson.json";
  213. import dayjs from "dayjs";
  214. export default {
  215. name: "curveAnalyse",
  216. components: {
  217. // ChartColumnar,
  218. // Panel,
  219. BarCharts,
  220. },
  221. data() {
  222. return {
  223. pillarName: "",
  224. // echartsData: [],
  225. // tableName: "",
  226. list: [],
  227. // DayPower: {
  228. // // 图表所用单位
  229. // units: [""],
  230. // value: [
  231. // {
  232. // title: "",
  233. // yAxisIndex: 0, // 使用单位
  234. // value: [],
  235. // },
  236. // ],
  237. // },
  238. // BarChartsList: [],
  239. tabIndex: -1,
  240. tabOptions: [
  241. { id: -1, name: "风电" },
  242. { id: -2, name: "光伏" },
  243. ],
  244. // barHeight: '260px',
  245. barList: [],
  246. tableData: [],
  247. tableHead: [
  248. "一月(万kWh)",
  249. "二月(万kWh)",
  250. "三月(万kWh)",
  251. "四月(万kWh)",
  252. "五月(万kWh)",
  253. "六月(万kWh)",
  254. "七月(万kWh)",
  255. "八月(万kWh)",
  256. "九月(万kWh)",
  257. "十月(万kWh)",
  258. "十一月(万kWh)",
  259. "十二月(万kWh)",
  260. ],
  261. tableHead1: [
  262. "一月(h)",
  263. "二月(h)",
  264. "三月(h)",
  265. "四月(h)",
  266. "五月(h)",
  267. "六月(h)",
  268. "七月(h)",
  269. "八月(h)",
  270. "九月(h)",
  271. "十月(h)",
  272. "十一月(h)",
  273. "十二月(h)",
  274. ],
  275. company: "",
  276. companyOptions: [],
  277. searchYear: dayjs().format("YYYY"),
  278. selectList: [
  279. {
  280. name: "发电量",
  281. },
  282. {
  283. name: "上网电量",
  284. },
  285. {
  286. name: "购网电量",
  287. },
  288. {
  289. name: "综合场用电量",
  290. },
  291. {
  292. name: "利用小时",
  293. },
  294. ],
  295. selectValue: "发电量",
  296. };
  297. },
  298. watch: {},
  299. filters: {},
  300. computed: {},
  301. created() {
  302. this.initialization();
  303. },
  304. methods: {
  305. compare(property) {
  306. return (a, b) => {
  307. let val1 = a[property];
  308. let val2 = b[property];
  309. return val1 - val2;
  310. };
  311. },
  312. rowClick(list) {
  313. if (list?.wpname) {
  314. let barList = [
  315. {
  316. name: "本期",
  317. children: [],
  318. date: [],
  319. },
  320. {
  321. name: "同期",
  322. children: [],
  323. },
  324. ];
  325. this.pillarName = list.wpname;
  326. list.targetList.forEach((item) => {
  327. barList[0].date.push(item.month + "月");
  328. barList[0].children.push(item.current || 0);
  329. barList[1].children.push(item.sameperiod || 0);
  330. });
  331. this.barList = barList;
  332. this.BASE.closeLoading();
  333. }
  334. },
  335. isNumber(val) {
  336. return typeof val === "number" && !isNaN(val);
  337. },
  338. search() {
  339. this.BASE.showLoading();
  340. switch (this.selectValue) {
  341. case "发电量":
  342. // this.dataChange(dataJson.data.fdldata)
  343. fdlList({
  344. companys: this.company,
  345. type: this.tabIndex,
  346. year: this.monthChange(this.searchYear),
  347. }).then(({ data: res }) => {
  348. this.dataChange(res.data);
  349. });
  350. break;
  351. case "综合场用电量":
  352. // this.dataChange(dataJson.data.zhcydldata)
  353. zhcydlList({
  354. companys: this.company,
  355. type: this.tabIndex,
  356. year: this.monthChange(this.searchYear),
  357. }).then(({ data: res }) => {
  358. this.dataChange(res.data);
  359. });
  360. break;
  361. case "上网电量":
  362. // this.dataChange(dataJson.data.swdldata)
  363. swdlList({
  364. companys: this.company,
  365. type: this.tabIndex,
  366. year: this.monthChange(this.searchYear),
  367. }).then(({ data: res }) => {
  368. this.dataChange(res.data);
  369. });
  370. break;
  371. case "购网电量":
  372. // this.dataChange(dataJson.data.gwdldata)
  373. gwdlList({
  374. companys: this.company,
  375. type: this.tabIndex,
  376. year: this.monthChange(this.searchYear),
  377. }).then(({ data: res }) => {
  378. this.dataChange(res.data);
  379. });
  380. break;
  381. case "利用小时":
  382. // this.dataChange(dataJson.data.lyxsdata)
  383. lyxsList({
  384. companys: this.company,
  385. type: this.tabIndex,
  386. year: this.monthChange(this.searchYear),
  387. }).then(({ data: res }) => {
  388. this.dataChange(res.data);
  389. });
  390. break;
  391. }
  392. },
  393. dataChange(res) {
  394. if (res.length) {
  395. let arr = [
  396. {
  397. wpname: "",
  398. data: {
  399. wpname: "期次",
  400. current: "本期",
  401. sameperiod: "同期",
  402. },
  403. },
  404. ];
  405. this.tableData = [...arr, ...res];
  406. this.rowClick(res[res.length - 1]);
  407. } else {
  408. this.BASE.closeLoading();
  409. this.barList = [];
  410. this.tableData = [];
  411. }
  412. },
  413. monthChange(data) {
  414. let year = dayjs(data).format("YYYY");
  415. return year;
  416. },
  417. getmonthValue() {
  418. let year = dayjs().format("YYYY");
  419. return year;
  420. },
  421. tabClick(data) {
  422. this.tabIndex = data;
  423. if (data == -2) {
  424. this.company = "SXJ_KGDL_GFFD_ZGS";
  425. this.search();
  426. } else {
  427. this.company = this.companyOptions[0].id;
  428. this.search();
  429. }
  430. },
  431. initialization() {
  432. // this.dataChange(dataJson.data.fdldata)
  433. companys().then(({ data: res }) => {
  434. if (res.data) {
  435. this.companyOptions = res.data;
  436. this.company = res.data[0].id;
  437. this.search();
  438. }
  439. });
  440. },
  441. },
  442. mounted() {},
  443. beforeUnmount() {},
  444. };
  445. </script>
  446. <style lang="less" scoped>
  447. .parcel-box {
  448. padding: 0 20px;
  449. box-sizing: border-box;
  450. height: 100%;
  451. .data-bodys {
  452. display: flex;
  453. flex-direction: column;
  454. background-color: rgba(0, 0, 0, 0.45);
  455. border-radius: 5px;
  456. height: calc(100% - 58px - 350px - 20px);
  457. }
  458. .economicTable {
  459. height: calc(100% - 32px);
  460. .el-table__body-wrapper {
  461. .columnFlex {
  462. display: flex;
  463. align-items: center;
  464. }
  465. .box-item {
  466. flex: 1;
  467. white-space: nowrap;
  468. overflow: hidden;
  469. text-overflow: ellipsis;
  470. }
  471. }
  472. .topSvg {
  473. width: 1em;
  474. height: 1em;
  475. color: #1c99ff;
  476. }
  477. .botSvg {
  478. width: 1em;
  479. height: 1em;
  480. color: #ff8300;
  481. }
  482. }
  483. .el-col + .el-col {
  484. padding-left: 0 !important;
  485. }
  486. .el-table::v-deep {
  487. // .el-table__header-wrapper {
  488. // th {
  489. // height: 35px !important;
  490. // line-height: 35px !important;
  491. // }
  492. // }
  493. td {
  494. height: 34px !important;
  495. line-height: 34px !important;
  496. }
  497. }
  498. .leftContent {
  499. width: 242px;
  500. height: 45px;
  501. line-height: 45px;
  502. background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  503. span {
  504. font-size: 16px;
  505. font-family: Microsoft YaHei;
  506. font-weight: 400;
  507. color: #05bb4c;
  508. margin-left: 25px;
  509. }
  510. }
  511. .search {
  512. display: flex;
  513. flex-direction: row;
  514. padding-top: 10px;
  515. padding-bottom: 10px;
  516. align-items: center;
  517. justify-content: space-between;
  518. .search-left {
  519. display: flex;
  520. flex-direction: row;
  521. align-items: center;
  522. }
  523. .search-right {
  524. position: relative;
  525. .select-back {
  526. position: absolute;
  527. right: 5px;
  528. top: 0px;
  529. z-index: 0;
  530. }
  531. .title-select {
  532. z-index: 2;
  533. }
  534. }
  535. .tabCut {
  536. display: inline-block;
  537. margin: 0 20px;
  538. div {
  539. display: inline-block;
  540. width: 60px;
  541. height: 27px;
  542. border: 1px solid #274934;
  543. text-align: center;
  544. line-height: 25px;
  545. cursor: pointer;
  546. }
  547. div:nth-child(1) {
  548. border-radius: 13px 0px 0px 13px;
  549. border-right-width: 0;
  550. }
  551. div:nth-child(2) {
  552. border-radius: 0px 13px 13px 0px;
  553. }
  554. .active {
  555. background-color: rgba(5, 187, 76, 0.9);
  556. color: #fff;
  557. }
  558. }
  559. button {
  560. margin-left: 10px;
  561. background: rgba(67, 81, 107, 0.3);
  562. border: 1px solid #274934;
  563. color: #b3b3b3;
  564. }
  565. .searchColor {
  566. background-color: rgba(5, 187, 76, 0.2);
  567. border: 1px solid #3b6c53;
  568. color: #b3b3b3;
  569. font-size: 14px;
  570. &:hover {
  571. background-color: rgba(5, 187, 76, 0.5);
  572. color: #ffffff;
  573. }
  574. }
  575. }
  576. .echarts {
  577. margin-top: 20px;
  578. background-color: rgba(0, 0, 0, 0.45);
  579. border-radius: 5px;
  580. width: 100%;
  581. height: 350px;
  582. }
  583. }
  584. .el-table::before {
  585. height: 0;
  586. }
  587. .compare-lift-down {
  588. margin-left: 7px;
  589. font-size: 14px;
  590. font-family: Arial;
  591. font-weight: 400;
  592. color: #ff8300;
  593. }
  594. .compare-lift-up {
  595. margin-left: 7px;
  596. font-size: 14px;
  597. font-family: Arial;
  598. font-weight: 400;
  599. color: #1c99ff;
  600. }
  601. .chart-name {
  602. display: flex;
  603. align-items: center;
  604. justify-content: center;
  605. position: relative;
  606. width: 100%;
  607. height: 40px;
  608. border-bottom: 1px solid rgba(106, 106, 106, 0.5);
  609. font-size: 16px;
  610. font-family: Microsoft YaHei;
  611. font-weight: 400;
  612. color: #ffffff;
  613. }
  614. </style>