index.vue 13 KB

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