index.vue 12 KB

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