index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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="tabIndex"
  8. placeholder="请选择"
  9. @change="tabClick"
  10. >
  11. <el-option
  12. v-for="item in tabOptions"
  13. :key="item.id"
  14. :label="item.name"
  15. :value="item.id"
  16. >
  17. </el-option>
  18. </el-select>
  19. <el-select
  20. size="mini"
  21. v-model="company"
  22. placeholder="请选择"
  23. @change="getHomePageData()"
  24. >
  25. <el-option
  26. v-for="item in companyOptions"
  27. :key="item.id"
  28. :label="item.aname"
  29. :value="item.id"
  30. >
  31. </el-option>
  32. </el-select>
  33. <div class="search-input">
  34. <el-date-picker
  35. size="mini"
  36. v-model="searchYear"
  37. type="year"
  38. value-format="YYYY"
  39. placeholder="选择年"
  40. popper-class="date-select"
  41. >
  42. </el-date-picker>
  43. </div>
  44. </div>
  45. <div class="search-btns">
  46. <el-button round size="mini" class="searchColor" @click="search"
  47. >搜索</el-button
  48. >
  49. </div>
  50. <!-- <el-button round size="mini">导出</el-button> -->
  51. </div>
  52. <div class="data-bodys">
  53. <div class="line clearfix">
  54. <div class="leftContent left">
  55. <span>风能利用率</span>
  56. </div>
  57. <div class="rightContent right"></div>
  58. </div>
  59. <div class="economicTable">
  60. <el-table
  61. :data="tableData"
  62. style="width: 100%"
  63. size="mini"
  64. stripe
  65. height="50vh"
  66. @row-click="rowClick"
  67. >
  68. <el-table-column
  69. align="center"
  70. prop=""
  71. label="场站"
  72. show-overflow-tooltip
  73. sortable
  74. >
  75. <template v-slot="scope">
  76. <span style="cursor: pointer">{{ scope.row.wpname }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column
  80. align="center"
  81. :label="val"
  82. v-for="(val, index) in tableHead"
  83. :key="index"
  84. width="144"
  85. sortable
  86. >
  87. <template v-slot="scope">
  88. <div v-if="scope.row.wpname == ''">
  89. <el-row>
  90. <el-col :span="12"
  91. ><span>{{ scope.row.data?.current }}</span></el-col
  92. >
  93. <el-col :span="12"
  94. ><span>{{ scope.row.data.sameperiod }}</span></el-col
  95. >
  96. </el-row>
  97. </div>
  98. <div v-else>
  99. <el-row>
  100. <el-col :span="12" style="position: relative">
  101. <div
  102. style="
  103. padding: 0 10px;
  104. width: 100%;
  105. height: 100%;
  106. display: flex;
  107. flex-direction: row;
  108. align-items: center;
  109. justify-content: center;
  110. "
  111. >
  112. <span style="width: 40px">{{
  113. scope.row.targetList &&
  114. (scope.row.targetList[index]?.current ||
  115. scope.row.targetList[index]?.current === 0
  116. ? scope.row.targetList[index]?.current
  117. : "--")
  118. }}</span>
  119. <i
  120. style="position: absolute; right: 0; top: 4px"
  121. v-if="
  122. scope.row.targetList &&
  123. (scope.row.targetList[index]?.compare > 0 ||
  124. scope.row.targetList[index]?.compare === 0)
  125. "
  126. class="active_icon icon-arrow-up compare-lift-up"
  127. ></i>
  128. <i
  129. style="position: absolute; right: 0; top: 4px"
  130. v-if="
  131. scope.row.targetList &&
  132. scope.row.targetList[index]?.compare < 0
  133. "
  134. class="active_icon icon-arrow-dpwn compare-lift-down"
  135. ></i>
  136. </div>
  137. </el-col>
  138. <el-col :span="12"
  139. ><span>{{
  140. scope.row.targetList &&
  141. (scope.row.targetList[index]?.sameperiod ||
  142. scope.row.targetList[index]?.sameperiod === 0
  143. ? scope.row.targetList[index]?.sameperiod
  144. : "--")
  145. }}</span></el-col
  146. >
  147. </el-row>
  148. </div>
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. </div>
  153. </div>
  154. <div class="echarts" style="height: 30vh">
  155. <div class="chart-name">
  156. <div class="point left bottom"></div>
  157. <div class="point right bottom"></div>
  158. 风能利用率
  159. </div>
  160. <div style="margin-top: 10px">
  161. <BarCharts
  162. :list="barList"
  163. width="97%"
  164. height="32vh"
  165. :top="60"
  166. :pillarName="pillarName"
  167. :xdate="false"
  168. :showLegend="true"
  169. :units="['', '']"
  170. ></BarCharts>
  171. </div>
  172. </div>
  173. </div>
  174. </template>
  175. <script>
  176. import { GetOrganization } from "@/api/headerNav.js";
  177. import BarCharts from "../../../economicsOperation/homePage/components/barCharts.vue";
  178. import { companys, fnlylList } from "@/api/curveAnalyse";
  179. export default {
  180. name: "curveAnalyse",
  181. components: {
  182. BarCharts,
  183. },
  184. data() {
  185. return {
  186. pillarName: "",
  187. list: [],
  188. tabIndex: -1,
  189. tabOptions: [
  190. { id: -1, name: "风电" },
  191. { id: -2, name: "光伏" },
  192. ],
  193. barList: [],
  194. tableData: [],
  195. tableHead: [
  196. "一月",
  197. "二月",
  198. "三月",
  199. "四月",
  200. "五月",
  201. "六月",
  202. "七月",
  203. "八月",
  204. "九月",
  205. "十月",
  206. "十一月",
  207. "十二月",
  208. ],
  209. company: "",
  210. companyOptions: [],
  211. searchYear: this.getmonthValue(),
  212. };
  213. },
  214. watch: {},
  215. filters: {},
  216. computed: {},
  217. created() {
  218. this.initialization();
  219. },
  220. methods: {
  221. compare(property) {
  222. return (a, b) => {
  223. let val1 = a[property];
  224. let val2 = b[property];
  225. return val1 - val2;
  226. };
  227. },
  228. rowClick(list) {
  229. if (list?.wpname) {
  230. let barList = [
  231. {
  232. name: "本期",
  233. children: [],
  234. date: [],
  235. },
  236. {
  237. name: "同期",
  238. children: [],
  239. },
  240. ];
  241. this.pillarName = list.wpname;
  242. list.targetList.forEach((item) => {
  243. barList[0].date.push(item.month + "月");
  244. barList[0].children.push(item.current || 0);
  245. barList[1].children.push(item.compare || 0);
  246. });
  247. this.barList = barList;
  248. }
  249. },
  250. // isNumber(val) {
  251. // return typeof val === "number" && !isNaN(val);
  252. // },
  253. search() {
  254. fnlylList({
  255. companys: this.company,
  256. type: this.tabIndex,
  257. year: this.monthChange(this.searchYear),
  258. }).then((res) => {
  259. if (res.data) {
  260. let arr = [
  261. {
  262. wpname: "",
  263. data: {
  264. wpname: "期次",
  265. current: "本期",
  266. sameperiod: "同期",
  267. },
  268. },
  269. ];
  270. this.tableData = [...arr, ...res.data];
  271. this.rowClick(res.data[res.data.length - 1]);
  272. }
  273. });
  274. },
  275. getHomePageData() {
  276. this.search();
  277. },
  278. monthChange(data) {
  279. let year = new Date(data).getFullYear().toString();
  280. return year;
  281. },
  282. getmonthValue() {
  283. let year = new Date().getFullYear().toString();
  284. return year;
  285. },
  286. tabClick() {
  287. this.$router.push({
  288. path: "/economicsOperation/thematicAnalysis/lightEnergy",
  289. });
  290. },
  291. initialization() {
  292. GetOrganization({ type: this.tabIndex }).then((res) => {
  293. if (res.data) {
  294. this.companyOptions = res.data;
  295. this.company = res.data[0].id;
  296. this.search();
  297. }
  298. });
  299. },
  300. },
  301. mounted() {},
  302. beforeUnmount() {},
  303. };
  304. </script>
  305. <style lang="less" scoped>
  306. .data-bodys {
  307. display: flex;
  308. flex-direction: column;
  309. background-color: rgba(0, 0, 0, 0.45);
  310. border-radius: 5px;
  311. padding: 5px;
  312. }
  313. .parcel-box {
  314. padding: 0 20px;
  315. box-sizing: border-box;
  316. ::v-deep .search-left {
  317. display: flex;
  318. align-items: center;
  319. .el-select {
  320. margin-right: 10px;
  321. width: 155px;
  322. .el-input .el-input__inner {
  323. width: 150px;
  324. }
  325. }
  326. .search-btns {
  327. display: flex;
  328. }
  329. }
  330. .line {
  331. padding-bottom: 5px;
  332. .leftContent {
  333. width: 242px;
  334. height: 41px;
  335. line-height: 41px;
  336. background: url("../../../../../assets/imgs/title_left_bg.png");
  337. span {
  338. font-size: 16px;
  339. font-family: Microsoft YaHei;
  340. font-weight: 400;
  341. color: #ffffff;
  342. margin-left: 25px;
  343. }
  344. }
  345. .rightContent {
  346. width: 212px;
  347. height: 28px;
  348. margin-top: 13px;
  349. background: url("../../../../../assets/imgs/title_right_bg.png");
  350. }
  351. }
  352. .search {
  353. display: flex;
  354. flex-direction: row;
  355. padding-top: 10px;
  356. padding-bottom: 10px;
  357. align-items: center;
  358. // justify-content: space-between;
  359. button {
  360. margin-left: 10px;
  361. background: rgba(67, 81, 107, 0.3);
  362. border: 1px solid #354460;
  363. color: #b3b3b3;
  364. }
  365. .searchColor {
  366. background-color: rgba(0, 70, 199, 0.2);
  367. border: 1px solid #3b4c6c;
  368. color: #b3b3b3;
  369. font-size: 14px;
  370. &:hover {
  371. background-color: rgba(0, 70, 199, 0.5);
  372. color: #ffffff;
  373. }
  374. }
  375. }
  376. .echarts {
  377. margin-top: 20px;
  378. background-color: rgba(0, 0, 0, 0.45);
  379. border-radius: 5px;
  380. width: 100%;
  381. }
  382. }
  383. .clearfix::after {
  384. content: "";
  385. clear: both;
  386. height: 0;
  387. line-height: 0;
  388. visibility: hidden;
  389. display: block;
  390. }
  391. .clearfix {
  392. zoom: 1;
  393. }
  394. .left {
  395. float: left;
  396. }
  397. .right {
  398. float: right;
  399. }
  400. /deep/ .el-input__prefix {
  401. right: -15px;
  402. left: unset;
  403. }
  404. /deep/ .el-input--prefix .el-input__inner {
  405. padding-left: 20px;
  406. }
  407. .el-table::before {
  408. height: 0;
  409. }
  410. .compare-lift-down {
  411. margin-left: 7px;
  412. font-size: 14px;
  413. font-family: Arial;
  414. font-weight: 400;
  415. color: #ff8300;
  416. }
  417. .compare-lift-up {
  418. margin-left: 7px;
  419. font-size: 14px;
  420. font-family: Arial;
  421. font-weight: 400;
  422. color: #1c99ff;
  423. }
  424. .chart-name {
  425. display: flex;
  426. align-items: center;
  427. justify-content: center;
  428. position: relative;
  429. width: 100%;
  430. height: 40px;
  431. border-bottom: 1px solid rgba(106, 106, 106, 0.5);
  432. font-size: 16px;
  433. font-family: Microsoft YaHei;
  434. font-weight: 400;
  435. color: #ffffff;
  436. }
  437. .point {
  438. width: 6px;
  439. height: 1px;
  440. background-color: #ffffff;
  441. position: absolute;
  442. &.left {
  443. left: 0;
  444. }
  445. &.right {
  446. right: 0;
  447. }
  448. &.top {
  449. top: -1px;
  450. }
  451. &.bottom {
  452. bottom: -1px;
  453. }
  454. }
  455. </style>