index.vue 15 KB

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