index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <div class="pr-wrapper">
  3. <div class="pr-search">
  4. <el-select
  5. size="mini"
  6. v-model="station"
  7. placeholder="请选择"
  8. style="margin-left: 15px"
  9. >
  10. <el-option
  11. v-for="item in stationOptions"
  12. :key="item.id"
  13. :label="item.aname"
  14. :value="item.id"
  15. >
  16. </el-option>
  17. </el-select>
  18. <el-date-picker
  19. size="mini"
  20. type="month"
  21. v-model="month"
  22. value-format="YYYY-MM"
  23. placeholder="请选择"
  24. style="margin-left: 15px"
  25. popper-class="date-select"
  26. >
  27. </el-date-picker>
  28. <el-button round size="mini" class="buttons" @click="getDatas"
  29. >搜 索</el-button
  30. >
  31. </div>
  32. <div class="pr-content">
  33. <div class="leftContent" :data-type="$store.state.moreSty">
  34. <span>{{ selectValue }}</span>
  35. </div>
  36. <div class="pr-body">
  37. <div class="table-wrapper">
  38. <el-table
  39. :data="tableData"
  40. width="100%"
  41. stripe
  42. @sort-change="handleSort"
  43. >
  44. <el-table-column
  45. v-for="(item, index) in tableHeaders"
  46. :key="index"
  47. header-align="center"
  48. :align="item.align"
  49. show-overflow-tooltip
  50. :prop="item.prop"
  51. :label="item.label"
  52. :width="item.width"
  53. :sortable="
  54. item.prop != 'prpm' &&
  55. item.prop != 'wtid' &&
  56. item.prop != 'rl' &&
  57. item.prop != 'level'
  58. ? 'custom'
  59. : false
  60. "
  61. >
  62. <template #header>
  63. <div v-if="item.label.length > 2 || item.label == '容量'">
  64. {{ item.label }}
  65. </div>
  66. <span v-else>{{ item.label }}</span>
  67. <span>{{ item.unit }}</span>
  68. </template>
  69. <template #default="{ row }">
  70. <div class="pr-table-cell" v-if="item.label == '增长率'">
  71. <span>{{
  72. row[item.prop] || row[item.prop] == 0
  73. ? row[item.prop]
  74. : "--"
  75. }}</span>
  76. <span v-if="row[item.prop] && row[item.prop] != 0">
  77. <i
  78. class="svg-icon svg-icon-sm svg-icon-skyBlue"
  79. v-if="row[item.prop] < 0"
  80. >
  81. <svgIcon svgid="svg-arrow-down"></svgIcon>
  82. </i>
  83. <i
  84. class="svg-icon svg-icon-sm svg-icon-orange1"
  85. v-if="row[item.prop] > 0"
  86. >
  87. <svgIcon svgid="svg-arrow-up"></svgIcon>
  88. </i>
  89. </span>
  90. </div>
  91. <div v-else>
  92. {{
  93. row[item.prop] || row[item.prop] == 0
  94. ? row[item.prop]
  95. : "--"
  96. }}
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column width="600"></el-table-column>
  101. </el-table>
  102. </div>
  103. <div class="chart-wrapper">
  104. <div :style="{ height: height }">
  105. <barCharts
  106. v-if="showDisplay"
  107. height="100%"
  108. width="100%"
  109. :bardata="bardata"
  110. />
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. import dayjs from "dayjs";
  119. import barCharts from "@/views/economicsOperation/photovoltaicAnalyse/prAnalyse/components/barCharts.vue";
  120. import { getPrAnalysis } from "@/api/monthlyPerformanceAnalysis.js";
  121. import { GetStationByCompany } from "@/api/factoryMonitor/index.js";
  122. import svgIcon from "@/components/coms/icon/svg-icon.vue";
  123. export default {
  124. name: "PrAnalyse", //PR分析
  125. data() {
  126. return {
  127. selectValue: "系统效率分析",
  128. station: "",
  129. stationOptions: [],
  130. month: dayjs().format("YYYY-MM"),
  131. tableHeaders: [
  132. { prop: "prpm", label: "排名", width: 60 },
  133. { prop: "wtid", label: "设备", width: 100 },
  134. { prop: "level", label: "运行状态", width: 120 },
  135. { prop: "rl", label: "容量", width: 75, unit: "(kW)", align: "right" },
  136. {
  137. prop: "ljgzz",
  138. label: "累计光照",
  139. width: 120,
  140. unit: "(kW/m²)",
  141. align: "right",
  142. },
  143. {
  144. prop: "fdl",
  145. label: "发电量",
  146. width: 110,
  147. unit: "(kWh)",
  148. align: "right",
  149. },
  150. {
  151. prop: "llfdlmax",
  152. label: "最大理论发电量",
  153. unit: "(kWh)",
  154. align: "right",
  155. },
  156. { prop: "pr", label: "本期", width: 80, align: "right" },
  157. { prop: "prhb", label: "上月", width: 80, align: "right" },
  158. {
  159. prop: "prhbzzl",
  160. label: "环比",
  161. width: 120,
  162. unit: "(%)",
  163. align: "right",
  164. },
  165. { prop: "prtb", label: "同期", width: 80, align: "right" },
  166. {
  167. prop: "prtbzzl",
  168. label: "同比",
  169. width: 120,
  170. unit: "(%)",
  171. align: "right",
  172. },
  173. ],
  174. tableData: [],
  175. bardata: {},
  176. height: "880px",
  177. target: "",
  178. sort: "",
  179. showDisplay: true,
  180. };
  181. },
  182. components: { barCharts, svgIcon },
  183. created() {
  184. // this.getStation();
  185. this.tableData = new Array(25).fill({
  186. prpm: 10,
  187. wtid: '测试模拟设备1',
  188. level: '正常',
  189. rl: 125,
  190. ljgzz: 3265,
  191. scatter: 95,
  192. fdl: 128,
  193. llfdlmax: 1256,
  194. pr: 251,
  195. prhb: 214,
  196. prhbzzl: 85,
  197. prtb: 698,
  198. prtbzzl: 89
  199. })
  200. },
  201. methods: {
  202. getStation() {
  203. GetStationByCompany({
  204. companyids: 0,
  205. type: -2,
  206. }).then(({ data: res, code }) => {
  207. if (res.code == 200) {
  208. this.stationOptions = res.data;
  209. this.station = this.stationOptions[0].id;
  210. this.getDatas();
  211. }
  212. });
  213. },
  214. getDatas() {
  215. this.BASE.showLoading();
  216. getPrAnalysis({
  217. wpId: this.station,
  218. month: this.month,
  219. target: this.target,
  220. sort: this.sort,
  221. }).then((res) => {
  222. this.BASE.closeLoading();
  223. if (res.code == 200) {
  224. this.bardata = {
  225. name: res.data.map((i) => i.wtid),
  226. lengend: "PR",
  227. data: res.data.map((i) => i.pr),
  228. };
  229. if (res.data.length > 22) {
  230. this.height = res.data.length * 37 + 53 + "px";
  231. } else {
  232. this.height = 23 * 38 + 80 + "px";
  233. }
  234. this.showDisplay = false;
  235. setTimeout(() => {
  236. this.showDisplay = true;
  237. }, 5);
  238. this.tableData = res.data.map((i) => {
  239. return {
  240. ...i,
  241. prhbzzl: i.prhbzzl ? i.prhbzzl.toFixed(2) : i.prhbzzl,
  242. prtbzzl: i.prtbzzl ? i.prtbzzl.toFixed(2) : i.prtbzzl,
  243. };
  244. });
  245. }
  246. });
  247. },
  248. handleSort({ column, prop, order }) {
  249. switch (prop) {
  250. case "pr":
  251. this.target = "prpm";
  252. break;
  253. case "prhb":
  254. this.target = "prhbpm";
  255. break;
  256. case "prhbzzl":
  257. this.target = "prhbzzlpm";
  258. break;
  259. case "prtb":
  260. this.target = "prtbpm";
  261. break;
  262. case "prtbzzl":
  263. this.target = "prtbzzlpm";
  264. break;
  265. case "llfdlmax":
  266. this.target = "llfdlmaxpm";
  267. break;
  268. case "ljgzz":
  269. this.target = "ljgzzpm";
  270. break;
  271. case "fdl":
  272. this.target = "fdlpm";
  273. break;
  274. case null:
  275. this.target = "";
  276. }
  277. this.sort = order == "ascending" ? 1 : order == "descending" ? 2 : "";
  278. this.getDatas();
  279. },
  280. },
  281. };
  282. </script>
  283. <style lang="less" scoped>
  284. .pr-wrapper {
  285. height: 100%;
  286. padding: 0 20px;
  287. .pr-search {
  288. padding: 10px 0;
  289. .buttons {
  290. margin-left: 15px;
  291. background-color: rgba(5, 187, 76, 0.2);
  292. border: 1px solid #3b6c53;
  293. color: #b3b3b3;
  294. font-size: 14px;
  295. &:hover,
  296. &.active {
  297. background-color: rgba(5, 187, 76, 0.5);
  298. color: #ffffff;
  299. }
  300. }
  301. }
  302. .pr-content {
  303. height: calc(100% - 40px);
  304. width: 100%;
  305. padding-bottom: 10px;
  306. .leftContent[data-type~="greenSty"] {
  307. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  308. }
  309. .leftContent[data-type~="blueSty"] {
  310. background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  311. }
  312. .leftContent {
  313. width: 242px;
  314. height: 45px;
  315. line-height: 45px;
  316. span {
  317. font-size: 16px;
  318. font-family: Microsoft YaHei;
  319. font-weight: 400;
  320. color: #05bb4c;
  321. margin-left: 25px;
  322. }
  323. }
  324. .pr-body {
  325. height: calc(100% - 36px);
  326. width: 100%;
  327. position: relative;
  328. overflow: auto;
  329. .table-wrapper ::v-deep {
  330. height: 100%;
  331. width: 100%;
  332. .el-table {
  333. .el-table__header-wrapper {
  334. position: fixed;
  335. z-index: 1;
  336. }
  337. .el-table__body-wrapper {
  338. margin-top: 46.85px;
  339. }
  340. }
  341. }
  342. .chart-wrapper {
  343. z-index: 2;
  344. width: 600px;
  345. height: 100%;
  346. position: absolute;
  347. right: 0;
  348. top: 0;
  349. }
  350. }
  351. }
  352. }
  353. </style>