index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="page-wrapper">
  3. <!-- 头部按钮选项 -->
  4. <HeaderNav @typeFlag="typeFlag" :isAll="true" />
  5. <div class="chart-wrapper">
  6. <div
  7. class="chart-item"
  8. v-for="(item, index) in list"
  9. :key="index"
  10. @click="handleClick(item.name)"
  11. >
  12. <div class="chart-item-name">
  13. <p class="text">{{ item.name }}</p>
  14. </div>
  15. <div class="chart-item-chart">
  16. <multipleLineChartVue
  17. ref="multipLineChart"
  18. height="100%"
  19. width="100%"
  20. :chartData="item"
  21. />
  22. </div>
  23. </div>
  24. </div>
  25. <el-dialog
  26. class="dialogs"
  27. width="90%"
  28. top="120px"
  29. v-model="displayDialog"
  30. :show-close="true"
  31. destroy-on-close
  32. >
  33. <template #title>
  34. <div class="dialog-title">
  35. <img class="dialog-title-img" src="@assets/imgs/dialog-title.png" />
  36. <div class="title">{{ showName }}未来十天功率预测</div>
  37. </div>
  38. </template>
  39. <div class="dialog-body" style="height: 600px">
  40. <img class="dialog-img" src="@assets/imgs/dialog.png" />
  41. <div class="dialog-form">
  42. <div class="date-wrapper">
  43. 开始时间
  44. <div style="margin-left: 10px">
  45. <el-date-picker
  46. v-model="beginDate"
  47. type="date"
  48. size="mini"
  49. placeholder="选择日期"
  50. popper-class="date-select"
  51. format="YYYY-MM-DD"
  52. >
  53. </el-date-picker>
  54. </div>
  55. </div>
  56. <div class="date-wrapper">
  57. 结束时间
  58. <div style="margin-left: 10px">
  59. <el-date-picker
  60. v-model="endDate"
  61. size="mini"
  62. type="date"
  63. popper-class="date-select"
  64. placeholder="选择日期"
  65. format="YYYY-MM-DD"
  66. >
  67. </el-date-picker>
  68. </div>
  69. </div>
  70. <div class="btns">
  71. <el-button round size="mini" class="searchColor">查 询</el-button>
  72. </div>
  73. </div>
  74. <div class="dialog-chart">
  75. <multipleLineChartVue ref="multipLineChart" :chartData="chartData" />
  76. </div>
  77. </div>
  78. </el-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. import HeaderNav from "@/components/headerNavSta/index.vue";
  83. import multipleLineChartVue from "./components/multiple-line-chart.vue";
  84. import { GetAllPowerData, GetPowerData } from "@/api/factoryMonitor/index.js";
  85. import dayjs from "dayjs";
  86. export default {
  87. name: "PowerCurveMatrix", //安全监视
  88. data() {
  89. return {
  90. activeTab: -1,
  91. list: {},
  92. displayDialog: false,
  93. showName: "",
  94. beginDate: "",
  95. endDate: "",
  96. format: "YYYY-MM-DD",
  97. };
  98. },
  99. components: {
  100. HeaderNav,
  101. multipleLineChartVue,
  102. },
  103. created() {
  104. this.beginDate = dayjs().startOf("day").format(this.format);
  105. this.endDate = dayjs().add(10, "day").format(this.format);
  106. this.init();
  107. },
  108. methods: {
  109. init() {
  110. GetAllPowerData({
  111. type: this.activeTab == -1 ? "F" : "G",
  112. beginDate: this.beginDate,
  113. endDate: this.endDate,
  114. }).then(({ code, data }) => {
  115. if (code == 200) {
  116. let resData = JSON.parse(JSON.stringify(data));
  117. for (let key in resData) {
  118. resData[key] = {
  119. name: "",
  120. pjfs: [],
  121. ycfs: [],
  122. sjgl: [],
  123. ycgl: [],
  124. llgl: [],
  125. lengend: [],
  126. xAxis: [],
  127. };
  128. }
  129. for (let index in data) {
  130. resData[index].name = data[index][0].name;
  131. data[index].forEach((ele) => {
  132. resData[index].pjfs.push(ele.pjfs);
  133. resData[index].ycfs.push(ele.ycfs);
  134. resData[index].sjgl.push(ele.sjgl);
  135. resData[index].ycgl.push(ele.ycgl);
  136. resData[index].llgl.push(ele.llgl);
  137. resData[index].xAxis.push(
  138. dayjs(ele.hours).format("YYYY-MM-DD HH:mm:ss")
  139. );
  140. });
  141. }
  142. // console.log(resData);
  143. this.list = resData;
  144. }
  145. });
  146. },
  147. typeFlag(activeTab) {
  148. this.activeTab = activeTab;
  149. },
  150. handleClick(name) {
  151. this.displayDialog = true;
  152. this.showName = name;
  153. this.beginDate = dayjs().startOf("day").format(this.format);
  154. this.endDate = dayjs().add(10, "day").format(this.format);
  155. },
  156. },
  157. };
  158. </script>
  159. <style scoped lang="less">
  160. .page-wrapper {
  161. height: 100%;
  162. }
  163. .chart-wrapper {
  164. height: calc(100% - 57px);
  165. padding: 0 20px 10px 20px;
  166. display: grid;
  167. grid-template-columns: auto auto;
  168. grid-auto-rows: 232px;
  169. // grid-auto-columns: 935px;
  170. grid-gap: 20px;
  171. .chart-item {
  172. width: 935px;
  173. height: 232px;
  174. // border: 1px solid #fff;
  175. display: flex;
  176. align-items: center;
  177. background: url("~@/assets/imgs/power-bg.png") no-repeat;
  178. .chart-item-name {
  179. display: flex;
  180. width: 50px;
  181. height: 232px;
  182. border-right: 1px solid #3a3f43;
  183. justify-content: center;
  184. align-items: center;
  185. .text {
  186. writing-mode: vertical-lr;
  187. margin: 0;
  188. }
  189. }
  190. .chart-item-chart {
  191. // width: calc(100% - 50px);
  192. flex: 1 0 auto;
  193. height: 100%;
  194. }
  195. }
  196. }
  197. .dialog-body {
  198. .dialog-form {
  199. display: flex;
  200. align-items: center;
  201. height: 38px;
  202. .date-wrapper {
  203. display: flex;
  204. align-items: center;
  205. font-size: 13px;
  206. color: #b3b3b3;
  207. margin-right: 10px;
  208. }
  209. .searchColor {
  210. background: rgba(0, 70, 199, 0.4);
  211. color: #b3b3b3;
  212. font-size: 14px;
  213. border: none;
  214. width: 80px;
  215. min-height: 25px !important;
  216. &:hover {
  217. background-color: rgba(0, 70, 199, 0.5);
  218. color: #ffffff;
  219. }
  220. }
  221. }
  222. .dialog-chart {
  223. height: calc(100% - 38px);
  224. }
  225. }
  226. </style>