pingfenindex.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div id="leave">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <!-- <topInfo></topInfo> -->
  7. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  8. </el-col>
  9. <el-col :span="24" class="main">
  10. <el-col :span="24" class="leaveBtn" v-if="this.user.job == '班长'">
  11. <van-button round type="info" icon="smile" @click="onClickRight()">添加分数</van-button>
  12. </el-col>
  13. <el-col :span="24" class="leaveList">
  14. <pingfenList :groupList="groupList" :leaveList="leaveList" :stuList="groupList" @clickShow="clickShow"></pingfenList>
  15. </el-col>
  16. </el-col>
  17. </el-col>
  18. </el-row>
  19. </div>
  20. </template>
  21. <script>
  22. import NavBar from '@/layout/common/topTitle.vue';
  23. import pingfenList from '@/layout/user/pingfenList.vue';
  24. import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
  25. const { mapActions: mapStudent } = createNamespacedHelpers('student');
  26. const { mapActions: group } = createNamespacedHelpers('group');
  27. const { mapActions: mapclass } = createNamespacedHelpers('classes');
  28. export default {
  29. metaInfo: { title: '评分列表' },
  30. name: 'leave',
  31. props: {},
  32. components: {
  33. NavBar, //头部导航
  34. pingfenList, //请假列表
  35. },
  36. data: () => ({
  37. groupList: [],
  38. leaveList: [],
  39. stuList: [],
  40. title: '',
  41. isleftarrow: '',
  42. transitionName: 'fade',
  43. navShow: true,
  44. }),
  45. created() {
  46. this.searchInfo();
  47. },
  48. computed: {
  49. ...mapState(['user']),
  50. id() {
  51. return this.$route.query.id;
  52. },
  53. },
  54. mounted() {
  55. this.title = this.$route.meta.title;
  56. this.isleftarrow = this.$route.meta.isleftarrow;
  57. },
  58. watch: {
  59. $route(to, from) {
  60. this.title = to.meta.title;
  61. this.isleftarrow = to.meta.isleftarrow;
  62. },
  63. },
  64. methods: {
  65. ...mapStudent(['fetch', 'query']),
  66. ...group({ groupinfo: 'query', groupfetch: 'fetch' }),
  67. ...mapclass({ mapclass: 'query', classfetch: 'fetch' }),
  68. async searchInfo() {
  69. let classid = this.id;
  70. const acc = await this.query({ classid });
  71. console.log(res);
  72. var res = acc.data.filter(item => item.classid === classid);
  73. let selfscore = res.map(i => i.selfscore);
  74. let nes = selfscore.filter(d => d);
  75. console.log(nes);
  76. let num = eval(nes.join('+'));
  77. console.log(num);
  78. this.leaveList.num = num;
  79. this.$set(this, `leaveList`, this.leaveList);
  80. const resq = await this.groupinfo({ classid });
  81. for (const val of resq.data) {
  82. for (const acc of val.students) {
  83. var ref = res.filter(item => item.id === acc.stuid);
  84. for (const aaa of ref) {
  85. acc.stores = aaa.selfscore;
  86. }
  87. let asd = val.students.map(i => i.stores);
  88. let nes = asd.filter(d => d);
  89. let snewcore = eval(nes.join('+'));
  90. val.score = snewcore;
  91. }
  92. }
  93. this.$set(this, `groupList`, resq.data);
  94. },
  95. async clickShow(acc) {},
  96. // 跳转到请假
  97. onClickRight() {
  98. this.$router.push({ path: '/user/socre', query: { classid: this.id } });
  99. },
  100. },
  101. };
  102. </script>
  103. <style lang="less" scoped>
  104. .style {
  105. width: 100%;
  106. min-height: 667px;
  107. position: relative;
  108. background-color: #f9fafc;
  109. }
  110. .top {
  111. height: 46px;
  112. overflow: hidden;
  113. }
  114. .main {
  115. min-height: 570px;
  116. }
  117. .main .leaveBtn {
  118. text-align: center;
  119. padding: 15px 0;
  120. }
  121. </style>