guhongwei 4 vuotta sitten
vanhempi
commit
d3e31a3096
3 muutettua tiedostoa jossa 128 lisäystä ja 2 poistoa
  1. 6 0
      src/router/index.js
  2. 15 2
      src/views/statistics/detail.vue
  3. 107 0
      src/views/statistics/nostu.vue

+ 6 - 0
src/router/index.js

@@ -472,6 +472,12 @@ const statistics = [
     meta: { title: '问卷-按班级统计' },
     component: () => import('@/views/statistics/class-index.vue'),
   },
+  {
+    path: '/statistics/nostu',
+    name: 'statistics_nostu',
+    meta: { title: '问卷-未答学生统计' },
+    component: () => import('@/views/statistics/nostu.vue'),
+  },
 ];
 
 const routes = [

+ 15 - 2
src/views/statistics/detail.vue

@@ -5,7 +5,7 @@
         <template #header>
           <span>{{ quest.name }}</span>
           [<span>完成度:</span><span>{{ questionAnswer.percentage }}%</span> <span>已答:</span><span>{{ questionAnswer.yesAnswer }}</span> <span>未答:</span
-          ><span>{{ questionAnswer.noAnswer }}</span
+          ><span @click="nostuBtn()">{{ questionAnswer.noAnswer }}</span
           >]
         </template>
         <el-tabs v-model="tabs" :stretch="true" type="card">
@@ -81,9 +81,12 @@ export default {
     ...setting({ getSetting: 'fetch' }),
     ...student({ findList: 'findList', studentQuery: 'query' }),
     async search() {
+      console.log(this.querys.questionnaireid);
       let res = await this.fetch(this.querys.questionnaireid);
       if (!this.$checkRes(res)) return;
+      console.log(this.querys);
       let ansres = await this.query(this.querys); //{ questionnaireid: this.id, termid: this.termid, batchid: this.batchid, classid: this.classid }
+      console.log(ansres);
       if (this.$checkRes(ansres)) {
         if (_.get(ansres.data, 'length', 0) <= 0) {
           this.$set(this, `nodata`, true);
@@ -104,16 +107,19 @@ export default {
         this.$set(this, `quest`, sta);
         //具体数据
         let concreteData = this.getConcreteData(quests, allAnswer);
+        console.log(concreteData);
         this.$set(this, `cdata`, concreteData);
         // 查学生,算已答未答
         const { questionnaireid, ...stuquery } = this.querys;
+        console.log(stuquery);
         let studentList = await this.studentQuery(stuquery);
+        console.log(studentList);
+        console.log(allAnswer);
         let answerDta = {
           yesAnswer: allAnswer.length,
           noAnswer: studentList.total - allAnswer.length,
           percentage: _.ceil(allAnswer.length / studentList.total, 4) * 100,
         };
-        console.log(answerDta);
         this.$set(this, `questionAnswer`, answerDta);
       }
     },
@@ -231,6 +237,13 @@ export default {
         this.$message.error('导出失败');
       }
     },
+    // 未答
+    nostuBtn() {
+      this.$router.push({
+        path: '/statistics/nostu',
+        query: { termid: this.querys.termid, questionnaireid: this.querys.questionnaireid, classid: this.querys.classid },
+      });
+    },
   },
   computed: {
     ...mapState(['user']),

+ 107 - 0
src/views/statistics/nostu.vue

@@ -0,0 +1,107 @@
+<template>
+  <div id="nostu">
+    <detail-frame :title="pageTitle" :returns="toReturns">
+      <el-table :data="list" stripe style="width: 100%" border>
+        <el-table-column prop="name" label="学生姓名" align="center"> </el-table-column>
+        <el-table-column prop="nation" label="民族" align="center"> </el-table-column>
+        <el-table-column prop="gender" label="性别" align="center"> </el-table-column>
+        <el-table-column prop="school_name" label="学校" align="center"> </el-table-column>
+        <el-table-column prop="major" label="专业" align="center"> </el-table-column>
+        <el-table-column prop="termname" label="期数" align="center"> </el-table-column>
+        <el-table-column prop="batchname" label="批次" align="center"> </el-table-column>
+        <el-table-column prop="classname" label="班级" align="center"> </el-table-column>
+        <el-table-column prop="job" label="职位" align="center"> </el-table-column>
+        <el-table-column prop="phone" label="联系电话" align="center"> </el-table-column>
+      </el-table>
+      <el-col :span="24" class="page">
+        <el-pagination
+          @current-change="handleCurrentChange"
+          :current-page="currentPage"
+          layout="total, prev, pager, next, jumper"
+          :total="total"
+          :page-size="pageSize"
+        >
+        </el-pagination>
+      </el-col>
+    </detail-frame>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+import detailFrame from '@frame/layout/admin/detail-frame';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: questionanswer } = createNamespacedHelpers('questionanswer');
+const { mapActions: student } = createNamespacedHelpers('student');
+export default {
+  name: 'nostu',
+  props: {},
+  components: {
+    detailFrame,
+  },
+  data: function() {
+    return {
+      stuList: [], //查询数据
+      currentPage: 1, //默认数据1
+      pageSize: 15, //每页显示数据数量
+      origin: [], //分割数据
+      list: [], //显示数据列表
+      total: 0,
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...questionanswer(['query']),
+    ...student({ findList: 'findList', studentQuery: 'query' }),
+    async search() {
+      let ansres = await this.query(this.querys); //{ questionnaireid: this.id, termid: this.termid, batchid: this.batchid, classid: this.classid }
+      const { questionnaireid, ...stuquery } = this.querys;
+      let studentList = await this.studentQuery(stuquery);
+      let newdata = studentList.data.filter(f => {
+        return !ansres.data.find(f2 => f2.studentid == f.id);
+      });
+      if (newdata) {
+        this.$set(this, `stuList`, newdata);
+        this.$set(this, `total`, newdata.length);
+      }
+    },
+    searchPage(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
+    },
+    handleCurrentChange(currentPage) {
+      this.searchPage(currentPage);
+    },
+    toReturns() {
+      window.history.go(-1);
+    },
+  },
+  watch: {
+    stuList: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.searchPage();
+      },
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    querys() {
+      return this.$route.query;
+    },
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.page {
+  padding: 15px 0;
+  text-align: center;
+}
+</style>