index.vue 12 KB

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