index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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="companyChanged"
  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. <el-select
  20. size="mini"
  21. v-model="station"
  22. placeholder="请选择"
  23. style="margin-left: 15px"
  24. @change="stationChanged"
  25. >
  26. <el-option
  27. v-for="item in stationOptions"
  28. :key="item.id"
  29. :label="item.aname"
  30. :value="item.id"
  31. >
  32. </el-option>
  33. </el-select>
  34. <el-button round size="mini" class="searchColor" @click="getDatas"
  35. >搜索</el-button
  36. >
  37. </div>
  38. </div>
  39. <div
  40. class="parcel-content"
  41. v-loading="loading"
  42. element-loading-background="rgba(4, 12, 11, 0.8)"
  43. >
  44. <!-- <img src="@/assets/imgs/glycfx-bg1.png" alt="" /> -->
  45. <div class="line clearfix">
  46. <div class="leftContent">
  47. <span>{{ selectValue }}</span>
  48. </div>
  49. </div>
  50. <div class="table-wrapper">
  51. <el-table
  52. :data="tableData"
  53. size="mini"
  54. stripe
  55. width="100%"
  56. height="100%"
  57. >
  58. <el-table-column
  59. v-for="(item, index) in tableHead"
  60. :label="item"
  61. :key="index"
  62. align="center"
  63. :width="item == '指标名称' ? '200px' : ''"
  64. show-overflow-tooltip
  65. >
  66. <template #default="scope">
  67. <span>
  68. {{
  69. scope.row[index] || scope.row[index] == 0
  70. ? scope.row[index]
  71. : "--"
  72. }}
  73. </span>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. </div>
  78. <div class="echarts">
  79. <div class="chart-wrapper">
  80. <LineCharts :list="list" width="100%" height="100%" />
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import LineCharts from "./components/lineCharts.vue";
  88. import { companys } from "@/api/curveAnalyse";
  89. import { GetStationByCompany } from "@/api/factoryMonitor/index.js";
  90. import { getMonthElectricAnalyseGf } from "@/api/monthlyPerformanceAnalysis.js";
  91. export default {
  92. name: "monthElectricAnalyseGf",
  93. components: {
  94. // ChartColumnar,
  95. // Panel,
  96. LineCharts,
  97. },
  98. data() {
  99. return {
  100. loading: false,
  101. list: [],
  102. barList: [],
  103. tableData: [],
  104. tableHead: [
  105. "指标名称",
  106. "一月",
  107. "二月",
  108. "三月",
  109. "四月",
  110. "五月",
  111. "六月",
  112. "七月",
  113. "八月",
  114. "九月",
  115. "十月",
  116. "十一月",
  117. "十二月",
  118. "合计",
  119. ],
  120. company: "",
  121. companyOptions: [],
  122. station: "",
  123. stationOptions: [],
  124. selectValue: "光伏电量分析",
  125. headers: [
  126. "日照强度(W/m²)",
  127. "实发电量",
  128. "计划电量",
  129. "计划完成情况(%)",
  130. "可研电量",
  131. "可研完成情况(%)",
  132. "等效发电小时(h)",
  133. ],
  134. };
  135. },
  136. watch: {},
  137. created() {
  138. this.initialization();
  139. },
  140. methods: {
  141. initialization() {
  142. companys().then(({ data: res }) => {
  143. if (res.data) {
  144. this.companyOptions = [res.data[1]];
  145. this.company = res.data[1].id;
  146. this.getStation();
  147. }
  148. });
  149. },
  150. companyChanged() {
  151. this.station = "";
  152. this.getStation();
  153. },
  154. getStation() {
  155. GetStationByCompany({ companyids: this.company, type: -2 }).then(
  156. ({ data: res, code }) => {
  157. if (res.code == 200) {
  158. this.stationOptions = res.data;
  159. this.station = this.stationOptions[0].id;
  160. this.getDatas();
  161. }
  162. }
  163. );
  164. },
  165. getDatas() {
  166. this.loading = true;
  167. getMonthElectricAnalyseGf({ wpId: this.station }).then(
  168. ({ data, code }) => {
  169. if (code == 200) {
  170. //合计列
  171. let hj = [
  172. data.rzqdhj,
  173. data.sjdlhj,
  174. data.jhdlhj,
  175. data.wcqkhj + "%",
  176. data.kydlhj,
  177. data.kywcqkhj + "%",
  178. data.dxxsshj,
  179. ];
  180. //处理纵向表格数据
  181. let resData = JSON.parse(JSON.stringify(data.value));
  182. // 数组按矩阵思路, 变成转置矩阵
  183. let matrixData = resData.map((row) => {
  184. let arr = [];
  185. for (let key in row) {
  186. if (key != "hours") {
  187. if (key == "wcqk" || key == "kywcqk") {
  188. arr.push(row[key] ? row[key] + "%" : row[key]);
  189. } else {
  190. arr.push(row[key]);
  191. }
  192. }
  193. }
  194. return arr;
  195. });
  196. // 加入标题拼接最终的数据
  197. this.tableData = matrixData[0].map((col, i) => {
  198. let newArr = new Array(
  199. this.tableHead.length - matrixData.length - 2
  200. ).fill(null);
  201. let array = [
  202. this.headers[i],
  203. ...matrixData.map((row) => {
  204. return row[i];
  205. }),
  206. ...newArr,
  207. hj[i],
  208. ];
  209. return array;
  210. });
  211. //处理图表数据
  212. let list = [
  213. {
  214. name: "计划电量",
  215. data: resData.map((ele) => ele.jhdl),
  216. color: "#4B55AE",
  217. },
  218. {
  219. name: "实发电量",
  220. data: resData.map((ele) => ele.sjdl),
  221. color: "#05BB4C",
  222. },
  223. {
  224. name: "可研电量",
  225. data: resData.map((ele) => ele.sjdl),
  226. color: "#21a4f7",
  227. },
  228. {
  229. name: "日照强度",
  230. data: resData.map((ele) => ele.rzqd),
  231. color: "#FF8300",
  232. },
  233. ];
  234. this.list = list;
  235. this.loading = false;
  236. }
  237. }
  238. );
  239. },
  240. },
  241. };
  242. </script>
  243. <style lang="less" scoped>
  244. .parcel-box {
  245. padding: 0 20px;
  246. box-sizing: border-box;
  247. width: 100%;
  248. height: 100%;
  249. .search {
  250. display: flex;
  251. flex-direction: row;
  252. padding: 15px 0;
  253. align-items: center;
  254. justify-content: space-between;
  255. .search-left {
  256. display: flex;
  257. flex-direction: row;
  258. align-items: center;
  259. }
  260. .search-right {
  261. position: relative;
  262. .select-back {
  263. position: absolute;
  264. right: 5px;
  265. top: 0px;
  266. z-index: 0;
  267. }
  268. .title-select {
  269. z-index: 2;
  270. }
  271. }
  272. button {
  273. margin-left: 10px;
  274. background: rgba(67, 81, 107, 0.3);
  275. border: 1px solid #274934;
  276. color: #b3b3b3;
  277. }
  278. .searchColor {
  279. background-color: rgba(5, 187, 76, 0.2);
  280. border: 1px solid #3b6c53;
  281. color: #b3b3b3;
  282. font-size: 14px;
  283. &:hover {
  284. background-color: rgba(5, 187, 76, 0.5);
  285. color: #ffffff;
  286. }
  287. }
  288. }
  289. .parcel-content {
  290. width: 100%;
  291. height: calc(100% - 88px);
  292. // position: relative;
  293. background: url("~@/assets/imgs/glycfx-bg1.png") no-repeat;
  294. background-size: 100% 100%;
  295. background-position: center;
  296. img {
  297. position: absolute;
  298. top: 0;
  299. left: 0;
  300. width: 100%;
  301. height: 100%;
  302. }
  303. .line {
  304. .leftContent {
  305. width: 242px;
  306. height: 45px;
  307. line-height: 45px;
  308. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  309. span {
  310. font-size: 16px;
  311. font-family: Microsoft YaHei;
  312. font-weight: 400;
  313. color: #05bb4c;
  314. margin-left: 25px;
  315. }
  316. }
  317. }
  318. .echarts {
  319. height: calc(100% - 310px - 45px);
  320. padding: 0 20px;
  321. .chart-wrapper {
  322. height: 100%;
  323. width: 100%;
  324. }
  325. }
  326. .table-wrapper {
  327. height: 310px;
  328. width: 100%;
  329. padding: 0 20px;
  330. padding-top: 10px;
  331. }
  332. }
  333. }
  334. </style>