home.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div id="home">
  3. <el-card v-if="!loading">
  4. <iscome :istrain="data.trainstu" :nottrain="data.notrainstu"></iscome>
  5. <school :school="data.schs"></school>
  6. <leave :qj="data.levelqj" :exit="data.levelexit"></leave>
  7. </el-card>
  8. </div>
  9. </template>
  10. <script>
  11. import school from './home/school.vue';
  12. import iscome from './home/iscome.vue';
  13. import leave from './home/leave.vue';
  14. import { mapState, createNamespacedHelpers } from 'vuex';
  15. const { mapActions: count } = createNamespacedHelpers('count');
  16. export default {
  17. name: 'home',
  18. props: {},
  19. components: { leave, iscome, school },
  20. data: function() {
  21. return {
  22. loading: true,
  23. data: {},
  24. };
  25. },
  26. created() {
  27. this.search();
  28. },
  29. methods: {
  30. ...count(['query']),
  31. async search() {
  32. let res = await this.query();
  33. // 柱状图
  34. //levelexit:退出;
  35. //levelqj:请假;
  36. //饼形图
  37. //notrainstu:没参加培训的;
  38. //trainstu:已参加学生数;
  39. //planstu:计划总人数;
  40. //饼形图,哪个学校多少人
  41. //schstu:学校上报人数;
  42. if (this.$checkRes(res)) this.$set(this, `data`, res.data);
  43. this.loading = false;
  44. },
  45. },
  46. computed: {
  47. ...mapState(['user']),
  48. pageTitle() {
  49. return `${this.$route.meta.title}`;
  50. },
  51. },
  52. metaInfo() {
  53. return { title: this.$route.meta.title };
  54. },
  55. };
  56. </script>
  57. <style lang="less" scoped></style>