index.vue 15 KB

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