index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <div class="page-wrapper">
  3. <!-- 头部按钮选项 -->
  4. <HeaderNav @firstRender="firstRender" :isAll="true" />
  5. <div
  6. class="wrapper"
  7. v-loading="loading"
  8. element-loading-background="rgba(4, 12, 11, 0.8)"
  9. >
  10. <div
  11. class="chart-wrapper"
  12. :style="{ overflowX: isFixed ? 'auto' : 'unset' }"
  13. >
  14. <div
  15. class="chart-item"
  16. v-for="(item, index) in list"
  17. :key="index"
  18. @dblclick="handleClick(list[index]?.name, index)"
  19. >
  20. <div class="chart-item-name">
  21. <p class="text">{{ list[index]?.name }}</p>
  22. </div>
  23. <div class="chart-item-chart">
  24. <multipleLineChartVue
  25. ref="multipLineChart"
  26. height="100%"
  27. width="100%"
  28. :type="activeTab"
  29. :chartData="list[index]"
  30. />
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <el-dialog
  36. class="dialogs"
  37. width="75%"
  38. top="120px"
  39. v-model="displayDialog"
  40. :show-close="true"
  41. @close="handleClose"
  42. destroy-on-close
  43. >
  44. <template #title>
  45. <div class="dialog-title">
  46. <img class="dialog-title-img" src="@assets/imgs/dialog-title.png" />
  47. <div class="title">{{ showName }}功率预测详情</div>
  48. </div>
  49. </template>
  50. <div class="dialog-body" style="height: 600px">
  51. <img class="dialog-img" src="@assets/imgs/dialog.png" />
  52. <div class="dialog-form">
  53. <div class="date-wrapper">
  54. 开始时间
  55. <div style="margin-left: 10px">
  56. <el-date-picker
  57. v-model="beginDate"
  58. type="date"
  59. size="mini"
  60. placeholder="选择日期"
  61. popper-class="date-select"
  62. value-format="YYYY-MM-DD"
  63. >
  64. </el-date-picker>
  65. </div>
  66. </div>
  67. <div class="date-wrapper">
  68. 结束时间
  69. <div style="margin-left: 10px">
  70. <el-date-picker
  71. v-model="endDate"
  72. size="mini"
  73. type="date"
  74. popper-class="date-select"
  75. placeholder="选择日期"
  76. value-format="YYYY-MM-DD"
  77. >
  78. </el-date-picker>
  79. </div>
  80. </div>
  81. <div class="btns">
  82. <el-button
  83. round
  84. size="mini"
  85. class="searchColor"
  86. @click="handleSearch"
  87. >查 询</el-button
  88. >
  89. </div>
  90. </div>
  91. <div class="dialog-chart" v-if="!isDouble">
  92. <multipleLineChartVue
  93. ref="multipLineChart"
  94. :type="activeTab"
  95. :chartData="singleChartData"
  96. />
  97. </div>
  98. <div class="dialog-chart" v-if="isDouble">
  99. <div class="carousel-wrapper">
  100. <el-carousel trigger="click" height="100%" :autoplay="false">
  101. <el-carousel-item
  102. v-for="(chart, key) in doubleChartData"
  103. :key="key"
  104. :name="doubleChartData[key]?.name"
  105. >
  106. <multipleLineChartVue
  107. ref="multipLineChart"
  108. :chartData="doubleChartData[key]"
  109. width="1392px"
  110. :type="activeTab"
  111. height="580px"
  112. :isDouble="isDouble"
  113. />
  114. </el-carousel-item>
  115. </el-carousel>
  116. </div>
  117. </div>
  118. </div>
  119. </el-dialog>
  120. </div>
  121. </template>
  122. <script>
  123. import HeaderNav from "@/components/headerNavSta/index.vue";
  124. import multipleLineChartVue from "./components/multiple-line-chart.vue";
  125. import { GetAllPowerData, GetPowerData } from "@/api/factoryMonitor/index.js";
  126. import dayjs from "dayjs";
  127. export default {
  128. name: "PowerCurveMatrix", //全景监视
  129. data() {
  130. return {
  131. activeTab: -1,
  132. list: {},
  133. displayDialog: false,
  134. showName: "",
  135. beginDate: "",
  136. endDate: "",
  137. format: "YYYY-MM-DD",
  138. doubleChartData: [],
  139. singleChartData: {},
  140. isDouble: false,
  141. showWpid: "",
  142. isSearch: false,
  143. timer: null,
  144. loading: false,
  145. flag: false,
  146. };
  147. },
  148. components: {
  149. HeaderNav,
  150. multipleLineChartVue,
  151. },
  152. created() {
  153. this.beginDate = dayjs().startOf("day").format(this.format);
  154. this.endDate = dayjs().add(3, "day").format(this.format);
  155. this.init();
  156. },
  157. mounted() {
  158. this.timer = setInterval(() => {
  159. this.flag = true;
  160. this.init();
  161. }, 15 * 60 * 1000);
  162. },
  163. unmounted() {
  164. clearInterval(this.timer);
  165. this.timer = null;
  166. },
  167. methods: {
  168. firstRender(tab) {
  169. this.activeTab = tab;
  170. clearInterval(this.timer);
  171. this.timer = null;
  172. this.flag = false;
  173. this.init();
  174. this.timer = setInterval(() => {
  175. this.flag = true;
  176. this.init();
  177. }, 15 * 60 * 1000);
  178. },
  179. init() {
  180. if (this.flag) {
  181. this.loading = false;
  182. } else {
  183. this.loading = true;
  184. }
  185. GetAllPowerData({
  186. type: this.activeTab == -1 ? "F" : "G",
  187. beginDate: this.beginDate,
  188. endDate: this.endDate,
  189. }).then(({ code, data }) => {
  190. this.loading = false;
  191. if (code == 200) {
  192. this.list = this.dealRes(data);
  193. }
  194. });
  195. },
  196. dealRes(res) {
  197. let resData = JSON.parse(JSON.stringify(res));
  198. for (let key in resData) {
  199. resData[key] = {
  200. name: "",
  201. ycgl: [],
  202. llgl: [],
  203. sjgl: [],
  204. pjfs: [],
  205. ycfs: [],
  206. xAxis: [],
  207. };
  208. }
  209. for (let index in res) {
  210. resData[index].name = res[index][0].name;
  211. res[index].forEach((ele) => {
  212. resData[index].pjfs.push(ele.pjfs);
  213. resData[index].ycfs.push(ele.ycfs);
  214. resData[index].sjgl.push(ele.sjgl);
  215. resData[index].ycgl.push(ele.ycgl);
  216. resData[index].llgl.push(ele.llgl);
  217. resData[index].xAxis.push(dayjs(ele.hours).format("MM-DD HH:mm:ss"));
  218. });
  219. }
  220. return resData;
  221. },
  222. handleClick(name, id) {
  223. this.showName = name;
  224. this.showWpid = id;
  225. this.beginDate = dayjs().startOf("day").format(this.format);
  226. this.endDate = dayjs().add(10, "day").format(this.format);
  227. this.getPowerData();
  228. },
  229. getPowerData() {
  230. GetPowerData({
  231. wpId: this.showWpid,
  232. beginDate: this.beginDate,
  233. endDate: this.endDate,
  234. }).then((res) => {
  235. if (res && res.code == 200) {
  236. if (!this.isSearch) {
  237. this.displayDialog = true;
  238. }
  239. if (Object.keys(res.data).length < 2) {
  240. this.isDouble = false;
  241. this.singleChartData = this.dealRes(res.data)[this.showWpid];
  242. } else if (Object.keys(res.data).length >= 2) {
  243. this.isDouble = true;
  244. this.doubleChartData = this.dealRes(res.data);
  245. }
  246. }
  247. });
  248. },
  249. handleClose() {
  250. this.showName = "";
  251. this.showWpid = "";
  252. this.singleChartData = [];
  253. this.doubleChartData = [];
  254. },
  255. handleSearch() {
  256. this.isSearch = true;
  257. this.getPowerData();
  258. },
  259. },
  260. computed: {
  261. isFixed() {
  262. return this.$store.state.isFixed;
  263. },
  264. },
  265. };
  266. </script>
  267. <style scoped lang="less">
  268. .carousel-wrapper {
  269. height: 100%;
  270. width: 100%;
  271. .el-carousel {
  272. height: 100%;
  273. width: 100%;
  274. .el-carousel__container {
  275. height: 100%;
  276. width: 100%;
  277. .el-carousel__item {
  278. height: 100%;
  279. width: 100%;
  280. }
  281. }
  282. }
  283. }
  284. .el-carousel__item h3 {
  285. color: #475669;
  286. opacity: 0.75;
  287. line-height: 150px;
  288. margin: 0;
  289. text-align: center;
  290. }
  291. .page-wrapper {
  292. height: 100%;
  293. width: 100%;
  294. .wrapper {
  295. height: calc(100% - 57px);
  296. width: 100%;
  297. padding: 0 20px 10px 20px;
  298. overflow-y: auto;
  299. }
  300. }
  301. .chart-wrapper {
  302. display: grid;
  303. grid-template-columns: auto auto;
  304. grid-auto-rows: 256px;
  305. grid-gap: 20px;
  306. padding-bottom: 10px;
  307. overflow-x: auto;
  308. .chart-item {
  309. width: 935px;
  310. height: 256px;
  311. // border: 1px solid #fff;
  312. display: flex;
  313. align-items: center;
  314. background: url("~@/assets/imgs/power-bg1.png") no-repeat;
  315. .chart-item-name {
  316. display: flex;
  317. width: 50px;
  318. height: 256px;
  319. border-right: 1px solid #3a3f43;
  320. justify-content: center;
  321. align-items: center;
  322. .text {
  323. writing-mode: vertical-lr;
  324. margin: 0;
  325. }
  326. }
  327. .chart-item-chart {
  328. // width: calc(100% - 50px);
  329. flex: 1 0 auto;
  330. height: 100%;
  331. }
  332. }
  333. }
  334. .dialog-body {
  335. .dialog-form {
  336. display: flex;
  337. align-items: center;
  338. height: 38px;
  339. .date-wrapper {
  340. display: flex;
  341. align-items: center;
  342. font-size: 13px;
  343. color: #b3b3b3;
  344. margin-right: 10px;
  345. }
  346. .searchColor {
  347. background: rgba(0, 70, 199, 0.4);
  348. color: #b3b3b3;
  349. font-size: 14px;
  350. border: none;
  351. width: 80px;
  352. min-height: 25px !important;
  353. &:hover {
  354. background-color: rgba(0, 70, 199, 0.5);
  355. color: #ffffff;
  356. }
  357. }
  358. }
  359. .dialog-chart {
  360. height: calc(100% - 38px);
  361. }
  362. }
  363. </style>