teaProgress.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div id="teaProgress">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <quesProgress :quesProgress="quesProgress"></quesProgress>
  10. </el-col>
  11. </el-col>
  12. </el-row>
  13. </div>
  14. </template>
  15. <script>
  16. import NavBar from '@/layout/common/topInfo.vue';
  17. import quesProgress from '@/layout/question/quesProgress.vue';
  18. import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
  19. const { mapActions: classes } = createNamespacedHelpers('classes');
  20. const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
  21. const { mapActions: termquest } = createNamespacedHelpers('termquest');
  22. import _ from 'lodash';
  23. export default {
  24. name: 'teaProgress',
  25. props: {},
  26. components: {
  27. NavBar, //头部导航
  28. quesProgress, //班级问卷进度
  29. },
  30. data: () => ({
  31. classInfo: {},
  32. quest: [],
  33. quesProgress: [],
  34. title: '',
  35. isleftarrow: '',
  36. navShow: true,
  37. }),
  38. created() {
  39. this.searchInfo();
  40. },
  41. computed: {
  42. id() {
  43. return this.$route.query.classid;
  44. },
  45. ...mapState(['user']),
  46. },
  47. mounted() {
  48. this.title = this.$route.meta.title;
  49. this.isleftarrow = this.$route.meta.isleftarrow;
  50. },
  51. watch: {
  52. $route(to, from) {
  53. this.title = to.meta.title;
  54. this.isleftarrow = to.meta.isleftarrow;
  55. },
  56. },
  57. methods: {
  58. ...classes({ classFectch: 'fetch' }),
  59. ...questionnaire({ getQuestionnaireList: 'query' }),
  60. ...termquest({ getTermQuestList: 'query' }),
  61. // 查询班级信息,全部问卷,当前期问卷
  62. async searchInfo() {
  63. // 班级信息
  64. let classInfo = await this.classFectch(this.id);
  65. if (this.$checkRes(classInfo)) {
  66. this.$set(this, `classInfo`, classInfo.data);
  67. }
  68. //查询所有问卷
  69. const quest = await this.getQuestionnaireList();
  70. if (this.$checkRes(quest)) {
  71. this.$set(this, `quest`, quest.data);
  72. }
  73. //查询这期的所有问卷,id=>数据
  74. const res = await this.getTermQuestList({ termid: this.classInfo.termid });
  75. let { questionnaireid, termid, ...othrers } = res.data[0];
  76. let newArr = this.quest.filter(q => (_.find(questionnaireid, sq => sq === q.id) ? q : ''));
  77. this.$set(this, `quesProgress`, newArr);
  78. },
  79. },
  80. };
  81. </script>
  82. <style lang="less" scoped>
  83. .style {
  84. width: 100%;
  85. min-height: 667px;
  86. position: relative;
  87. background-color: #f9fafc;
  88. }
  89. .top {
  90. height: 46px;
  91. overflow: hidden;
  92. }
  93. .main {
  94. min-height: 570px;
  95. }
  96. </style>