hcqhome.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <div class="dashboard-editor-container">
  3. <panel-group @handleSetLineChartData="handleSetLineChartData" />
  4. <el-row :gutter="32">
  5. <el-col :xs="24" :sm="24" :lg="8">
  6. <div>
  7. <div class="card-head">
  8. <span class="card-name">{{ $t('程序数量') }}</span>
  9. </div>
  10. </div>
  11. <div class="chart-wrapper">
  12. <raddar-chart />
  13. </div>
  14. </el-col>
  15. <el-col :xs="24" :sm="24" :lg="8">
  16. <div>
  17. <div class="card-head">
  18. <span class="card-name">装置年度培训完成情况</span>
  19. <el-dropdown style="float: right ;cursor: pointer" placement="bottom" trigger="click" class="card-time">
  20. <span class="el-dropdown-link">
  21. 年份 {{trainingYear}}
  22. <i class="el-icon-date"></i>
  23. </span>
  24. <el-dropdown-menu slot="dropdown">
  25. <el-dropdown-item @click.native="chooseYear(-1)">{{this.searchFormField.year - 1}}</el-dropdown-item>
  26. <el-dropdown-item @click.native="chooseYear(0)">{{this.searchFormField.year}}</el-dropdown-item>
  27. <el-dropdown-item @click.native="chooseYear(1)">{{this.searchFormField.year + 1}}</el-dropdown-item>
  28. </el-dropdown-menu>
  29. </el-dropdown>
  30. </div>
  31. </div>
  32. <div class="chart-wrapper">
  33. <pie-chart ref="piechart" />
  34. </div>
  35. </el-col>
  36. <!-- <el-col :xs="24" :sm="24" :lg="8">-->
  37. <!-- <div class="chart-wrapper">-->
  38. <!-- <bar-chart />-->
  39. <!-- </div>-->
  40. <!-- </el-col>-->
  41. <el-col :xs="24" :sm="24" :lg="8">
  42. <div>
  43. <div class="card-head">
  44. <span class="card-name">{{ $t('新员工培训完成率') }}</span>
  45. <el-dropdown style="float: right ;cursor: pointer" placement="bottom" trigger="click" class="card-time">
  46. <span class="el-dropdown-link">
  47. 年份 {{trainingYearNew}}
  48. <i class="el-icon-date"></i>
  49. </span>
  50. <el-dropdown-menu slot="dropdown">
  51. <el-dropdown-item @click.native="chooseYearNew(-1)">{{this.searchFormField.year - 1}}</el-dropdown-item>
  52. <el-dropdown-item @click.native="chooseYearNew(0)">{{this.searchFormField.year}}</el-dropdown-item>
  53. <el-dropdown-item @click.native="chooseYearNew(1)">{{this.searchFormField.year + 1}}</el-dropdown-item> </el-dropdown-menu>
  54. </el-dropdown>
  55. </div>
  56. </div>
  57. <div class="chart-wrapper">
  58. <birth-chart ref="newchart"/>
  59. </div>
  60. </el-col>
  61. </el-row>
  62. <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
  63. <el-col :xs="24" :sm="24" :lg="10">
  64. <div>
  65. <div class="card-head">
  66. <span class="card-name">程序清单到期提醒</span>
  67. </div>
  68. </div>
  69. <div class="chart-wrapper">
  70. <line-chart :chart-data="lineChartData" />
  71. </div>
  72. </el-col>
  73. <el-col :xs="24" :sm="24" :lg="14">
  74. <div>
  75. <div class="card-head">
  76. <span class="card-name">员工证书统计</span>
  77. </div>
  78. </div>
  79. <div class="chart-wrapper">
  80. <workcertificate-chart :chart-data="lineChartData" />
  81. </div>
  82. </el-col>
  83. </el-row>
  84. </div>
  85. </template>
  86. <script>
  87. import PanelGroup from './dashboard/hcq/PanelGroup'
  88. import LineChart from './dashboard/hcq/LineChart'
  89. import RaddarChart from './dashboard/hcq/RaddarChart'
  90. import PieChart from './dashboard/hcq/PieChart'
  91. import WorkcertificateChart from "./dashboard/hcq/workcertificateChart";
  92. import BirthChart from './dashboard/hcq/BrithChart'
  93. const lineChartData = {
  94. newVisitis: {
  95. expectedData: [100, 120, 161, 134, 105, 160, 165],
  96. actualData: [120, 82, 91, 154, 162, 140, 145]
  97. },
  98. messages: {
  99. expectedData: [200, 192, 120, 144, 160, 130, 140],
  100. actualData: [180, 160, 151, 106, 145, 150, 130]
  101. },
  102. purchases: {
  103. expectedData: [80, 100, 121, 104, 105, 90, 100],
  104. actualData: [120, 90, 100, 138, 142, 130, 130]
  105. },
  106. shoppings: {
  107. expectedData: [130, 140, 141, 142, 145, 150, 160],
  108. actualData: [120, 82, 91, 154, 162, 140, 130]
  109. }
  110. }
  111. export default {
  112. name: 'Index',
  113. components: {
  114. WorkcertificateChart,
  115. PanelGroup,
  116. LineChart,
  117. RaddarChart,
  118. PieChart,
  119. BirthChart
  120. },
  121. data() {
  122. return {
  123. lineChartData: lineChartData.newVisitis,
  124. // 获取当前年份
  125. searchFormField: {
  126. year: parseInt(this.getNowTime()),
  127. },
  128. trainingYear: null,
  129. trainingYearNew: null,
  130. }
  131. },
  132. created() {
  133. this.trainingYear = new Date().getFullYear();
  134. this.trainingYearNew = new Date().getFullYear();
  135. },
  136. methods: {
  137. /** 获取当前年份 */
  138. getNowTime() {
  139. var now = new Date();
  140. var year = now.getFullYear(); //得到年份
  141. var defaultDate = `${year}`;
  142. defaultDate = `${year}`
  143. return defaultDate;
  144. this.$set(this.searchFormField, "year", defaultDate);
  145. },
  146. handleSetLineChartData(type) {
  147. this.lineChartData = lineChartData[type]
  148. },
  149. //变换年份
  150. chooseYear (index) {
  151. console.log(index + "nian")
  152. this.trainingYear = this.searchFormField.year + index
  153. this.$refs.piechart.changeYear(this.searchFormField.year + index)
  154. },
  155. chooseYearNew (index) {
  156. this.trainingYearNew = this.searchFormField.year + index
  157. this.$refs.newchart.changeYear(this.searchFormField.year + index)
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. .dashboard-editor-container {
  164. padding: 32px;
  165. background-color: rgb(240, 242, 245);
  166. position: relative;
  167. .chart-wrapper {
  168. background: #fff;
  169. padding: 16px 16px 0;
  170. margin-bottom: 32px;
  171. }
  172. }
  173. @media (max-width:1024px) {
  174. .chart-wrapper {
  175. padding: 8px;
  176. }
  177. }
  178. .card-name {
  179. font-size: 16px;
  180. }
  181. </style>