index2.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <div class="app-main" style="background: #11285a">
  3. <div class="dashboard-editor-container" style="width:100%;height:100%">
  4. <!--
  5. <panel-group @handleSetLineChartData="handleSetLineChartData" />
  6. <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
  7. <line-chart :chart-data="lineChartData" />
  8. </el-row> -->
  9. <el-row :gutter="10">
  10. </el-row>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import PanelGroup from './dashboard/PanelGroup'
  16. import LineChart from './dashboard/LineChart'
  17. import YxChart from './dashboard/YxChart'
  18. import QzftChart from './dashboard/QzftChart'
  19. import BarChart from './dashboard/BarChart'
  20. import CnlylChart from './dashboard/CnlylChart'
  21. import NyxhChart from './dashboard/NyxhChart'
  22. import NhtjChart from './dashboard/NhtjChart'
  23. import KpiChart from './dashboard/KpiChart'
  24. import YhpcChart from "./dashboard/YhpcChart"
  25. import WarnChart from "./dashboard/WarnChart"
  26. import BrithChart from "./dashboard/BrithChart";
  27. const lineChartData = {
  28. newVisitis: {
  29. expectedData: [100, 120, 161, 134, 105, 160, 165],
  30. actualData: [120, 82, 91, 154, 162, 140, 145]
  31. },
  32. messages: {
  33. expectedData: [200, 192, 120, 144, 160, 130, 140],
  34. actualData: [180, 160, 151, 106, 145, 150, 130]
  35. },
  36. purchases: {
  37. expectedData: [80, 100, 121, 104, 105, 90, 100],
  38. actualData: [120, 90, 100, 138, 142, 130, 130]
  39. },
  40. shoppings: {
  41. expectedData: [130, 140, 141, 142, 145, 150, 160],
  42. actualData: [120, 82, 91, 154, 162, 140, 130]
  43. }
  44. }
  45. export default {
  46. name: 'Index',
  47. components: {
  48. PanelGroup,
  49. LineChart,
  50. YxChart,
  51. QzftChart,
  52. BarChart,
  53. CnlylChart,
  54. NyxhChart,
  55. NhtjChart,
  56. KpiChart,
  57. YhpcChart,
  58. WarnChart,
  59. BrithChart
  60. },
  61. data() {
  62. return {
  63. lineChartData: lineChartData.newVisitis,
  64. heightObj: {
  65. height: document.body.clientHeight -50 + "px"
  66. },
  67. // 获取当前年份
  68. searchFormField: {
  69. year: this.getNowTime(),
  70. },
  71. yxChooseYear: 0,
  72. qzftChooseYear: 0,
  73. nyxhChooseYear: 0,
  74. cnlylChooseYear: 0,
  75. }
  76. },
  77. created() {
  78. this.$i18n.locale = 'zh'
  79. this.$store.dispatch('app/setLanguage', 'zh')
  80. },
  81. methods: {
  82. /** 获取当前年份 */
  83. getNowTime() {
  84. var now = new Date();
  85. var year = now.getFullYear(); //得到年份
  86. var defaultDate = `${year}`;
  87. defaultDate = `${year}`
  88. return defaultDate;
  89. this.$set(this.searchFormField, "year", defaultDate);
  90. },
  91. handleSetLineChartData(type) {
  92. this.lineChartData = lineChartData[type]
  93. },
  94. handleRouter(type){
  95. this.$router.push({ path: '/production/monthplan', query: { type: type }});
  96. },
  97. handleRouter2(type){
  98. this.$router.push({ path: '/production/lbnhjstj', query: { type: type }});
  99. },
  100. handleRouter3(type){
  101. this.$router.push({ path: '/ehs/ehskpinew', query: { type: type }});
  102. },
  103. //变换年份
  104. chooseOne (index) {
  105. if (index === 1) {
  106. this.yxChooseYear = this.searchFormField.year - 2;
  107. }else if (index === 2) {
  108. this.qzftChooseYear = this.searchFormField.year - 2;
  109. }else if (index === 3) {
  110. this.nyxhChooseYear = this.searchFormField.year - 2;
  111. }else if (index === 4) {
  112. this.cnlylChooseYear = this.searchFormField.year - 2;
  113. }
  114. },
  115. chooseTwo (index) {
  116. if (index === 1) {
  117. this.yxChooseYear = this.searchFormField.year - 1;
  118. }else if (index === 2) {
  119. this.qzftChooseYear = this.searchFormField.year - 1;
  120. }else if (index === 3) {
  121. this.nyxhChooseYear = this.searchFormField.year - 1;
  122. }else if (index === 4) {
  123. this.cnlylChooseYear = this.searchFormField.year - 1;
  124. }
  125. },
  126. chooseThree (index) {
  127. if (index === 1) {
  128. this.yxChooseYear = this.searchFormField.year - 0;
  129. }else if (index === 2) {
  130. this.qzftChooseYear = this.searchFormField.year - 0;
  131. }else if (index === 3) {
  132. this.nyxhChooseYear = this.searchFormField.year - 0;
  133. }else if (index === 4) {
  134. this.cnlylChooseYear = this.searchFormField.year - 0;
  135. }
  136. },
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .dashboard-editor-container {
  142. padding: 10px;
  143. background-color: #182e62;
  144. position: relative;
  145. .chart-wrapper {
  146. background: rgba(253, 245, 245, 0) linear-gradient(to right, #11285a, #1d2d4a) repeat scroll 0% 0%;
  147. padding: 10px 0 0;
  148. margin-bottom: 10px;
  149. }
  150. }
  151. /deep/.el-dropdown {
  152. color: #ffffff;
  153. margin-right: 10px;
  154. margin-top: 2px;
  155. }
  156. .card-time {
  157. float: right;
  158. }
  159. .card-name {
  160. cursor: pointer;
  161. font-size: 12px;
  162. font-weight:bold;
  163. color: #ffffff;
  164. padding: 2px 0 2px 5px;
  165. }
  166. .card-head {
  167. background: rgba(253, 245, 245, 0) linear-gradient(to right, #4a7cf9, #628fff) repeat scroll 0% 0%;
  168. }
  169. @media (max-width:1024px) {
  170. .chart-wrapper {
  171. padding: 8px;
  172. }
  173. }
  174. </style>