|
@@ -1,16 +1,26 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
- <list-frame title="问卷状态页" :total="total" :filter="filFields" @add="$router.push({ path: '/questionnaire/detail' })">
|
|
|
- <template #options="{item}">
|
|
|
- <template v-if="item.model == 'class'">
|
|
|
- <el-option v-for="(item, index) in list" :key="index" :value="item.label"></el-option>
|
|
|
- </template>
|
|
|
- <template v-if="item.model == 'batch'">
|
|
|
- <el-option v-for="(item, index) in lists" :key="index" :value="item.label"></el-option>
|
|
|
- </template>
|
|
|
- </template>
|
|
|
-
|
|
|
- <data-table :fields="fields" :data="index" :opera="opera"></data-table>
|
|
|
+ <list-frame title="问卷完成度查询" :total="total" :needFilter="false" :needAdd="false" :needPag="views === 'plan'">
|
|
|
+ <transition name="el-fade-in-linear">
|
|
|
+ <self-cards :title="planTitle" v-if="views === `plan`">
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @view="data => toView(data, 'term')"></data-table>
|
|
|
+ </self-cards>
|
|
|
+ <self-cards :title="termTitle" v-if="views === `term`" :returns="toReturns">
|
|
|
+ <data-table :fields="termFields" :data="termList" :opera="opera" @view="data => toView(data, 'batch')"></data-table>
|
|
|
+ </self-cards>
|
|
|
+ <self-cards :title="batchTitle" v-if="views === `batch`" :returns="toReturns">
|
|
|
+ <el-alert :title="`进度:${batch.answertotal || 0}/${batch.alltotal || 0}`" :closable="false"></el-alert>
|
|
|
+ <data-table :fields="batchFields" :data="batch.list" :opera="opera" @view="data => toView(data, 'class')"></data-table>
|
|
|
+ </self-cards>
|
|
|
+ <self-cards :title="classTitle" v-if="views === `class`" :returns="toReturns">
|
|
|
+ <el-alert :title="`进度:${classes.answertotal || 0}/${classes.alltotal || 0}`" :closable="false"></el-alert>
|
|
|
+ <data-table :fields="classFields" :data="classes.list" :opera="opera" @view="data => toView(data, 'student')"></data-table>
|
|
|
+ </self-cards>
|
|
|
+ <self-cards :title="studentTitle" v-if="views === `student`" :returns="toReturns">
|
|
|
+ <el-alert :title="`进度:${student.answertotal || 0}/${student.alltotal || 0}`" :closable="false"></el-alert>
|
|
|
+ <data-table :fields="studFields" :data="student.list" :opera="[]"></data-table>
|
|
|
+ </self-cards>
|
|
|
+ </transition>
|
|
|
</list-frame>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -18,113 +28,156 @@
|
|
|
<script>
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
-// import { createNamespacedHelpers } from 'vuex';
|
|
|
-// const { mapActions } = createNamespacedHelpers('questionnaire');
|
|
|
-
|
|
|
+import selfCards from './parts/cards';
|
|
|
+import { createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: trainPlan } = createNamespacedHelpers('trainplan');
|
|
|
+const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
+const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
+const { mapActions: completion } = createNamespacedHelpers('completion');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
+ metaInfo: { title: '问卷完成度查询' },
|
|
|
props: {},
|
|
|
components: {
|
|
|
listFrame,
|
|
|
dataTable,
|
|
|
+ selfCards,
|
|
|
},
|
|
|
data: () => ({
|
|
|
- lists: [
|
|
|
- { label: '第一批次', value: 0 },
|
|
|
- { label: '第二批次', value: 1 },
|
|
|
- { label: '第三批次', value: 2 },
|
|
|
- { label: '特殊批次', value: 2 },
|
|
|
- ],
|
|
|
- list: [
|
|
|
- { label: '一班', value: 0 },
|
|
|
- { label: '二班', value: 1 },
|
|
|
- { label: '三班', value: 2 },
|
|
|
- { label: '四班', value: 3 },
|
|
|
- { label: '五班', value: 4 },
|
|
|
- { label: '六班', value: 5 },
|
|
|
- { label: '七班', value: 6 },
|
|
|
- ],
|
|
|
+ views: 'plan', // term, batch, class
|
|
|
+ planTitle: '全年计划',
|
|
|
+ termTitle: '',
|
|
|
+ batchTitle: '',
|
|
|
+ classTitle: '',
|
|
|
+ studentTitle: '',
|
|
|
+ planid: undefined,
|
|
|
opera: [
|
|
|
- // {
|
|
|
- // label: '编辑',
|
|
|
- // icon: 'el-icon-edit',
|
|
|
- // method: 'edit',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // label: '删除',
|
|
|
- // icon: 'el-icon-delete',
|
|
|
- // method: 'delete',
|
|
|
- // },
|
|
|
- ],
|
|
|
- fields: [
|
|
|
- { label: '期数', prop: 'term' },
|
|
|
{
|
|
|
- label: '批次',
|
|
|
- prop: 'batch',
|
|
|
- format: item => {
|
|
|
- return item === '0' ? '第一批次' : item === '1' ? '第二批次' : item === '2' ? '第三批次' : item === '3' ? '特殊批次' : '其他';
|
|
|
- },
|
|
|
+ label: '查看',
|
|
|
+ icon: 'el-icon-view',
|
|
|
+ method: 'view',
|
|
|
},
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '计划标题', prop: 'title' },
|
|
|
+ { label: '年度', prop: 'year' },
|
|
|
{
|
|
|
- label: '班级',
|
|
|
- prop: 'class',
|
|
|
- format: item => {
|
|
|
- return item === '0'
|
|
|
- ? '一班'
|
|
|
- : item === '1'
|
|
|
- ? '二班'
|
|
|
- : item === '2'
|
|
|
- ? '三班'
|
|
|
- : item === '3'
|
|
|
- ? '四班'
|
|
|
- : item === '4'
|
|
|
- ? '五班'
|
|
|
- : item === '5'
|
|
|
- ? '六班'
|
|
|
- : item === '6'
|
|
|
- ? '七班'
|
|
|
- : '其他';
|
|
|
+ label: '状态',
|
|
|
+ prop: 'status',
|
|
|
+ format: i => {
|
|
|
+ return i === '0' ? '筹备中' : i === '1' ? '发布中' : '已结束';
|
|
|
},
|
|
|
},
|
|
|
- { label: '问卷进度', prop: 'id' },
|
|
|
],
|
|
|
- filFields: [
|
|
|
- { label: '期数', model: 'term' },
|
|
|
-
|
|
|
- {
|
|
|
- label: '批次',
|
|
|
- model: 'batch',
|
|
|
- type: 'select',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '班级',
|
|
|
- model: 'class',
|
|
|
- type: 'select',
|
|
|
- },
|
|
|
+ list: [],
|
|
|
+ termFields: [{ label: '期数', prop: 'term' }],
|
|
|
+ termList: [],
|
|
|
+ batchFields: [
|
|
|
+ { label: '批次', prop: 'name' },
|
|
|
+ { label: '进度', prop: 'completion' },
|
|
|
+ ],
|
|
|
+ batch: {
|
|
|
+ list: [],
|
|
|
+ },
|
|
|
+ classFields: [
|
|
|
+ { label: '班级', prop: 'name' },
|
|
|
+ { label: '进度', prop: 'completion' },
|
|
|
],
|
|
|
- index: [],
|
|
|
+ classes: {
|
|
|
+ list: [],
|
|
|
+ },
|
|
|
total: 0,
|
|
|
+ studFields: [
|
|
|
+ { label: '姓名', prop: 'name' },
|
|
|
+ { label: '进度', prop: 'completion' },
|
|
|
+ ],
|
|
|
+ student: {
|
|
|
+ list: [],
|
|
|
+ },
|
|
|
+ studFilter: [
|
|
|
+ { label: '姓名', model: 'name' },
|
|
|
+ { label: '进度', prop: 'completion' },
|
|
|
+ ],
|
|
|
+ classid: '',
|
|
|
+ studTotal: 0,
|
|
|
}),
|
|
|
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
- // ...mapActions(['query', 'delete']),
|
|
|
- // async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- // const res = await this.query({ skip, limit, ...info });
|
|
|
- // if (this.$checkRes(res)) {
|
|
|
- // this.$set(this, `list`, res.data);
|
|
|
- // this.$set(this, `total`, res.total);
|
|
|
- // }
|
|
|
- // },
|
|
|
- // toEdit({ data }) {
|
|
|
- // this.$router.push({ path: '/questionnaire/detail', query: { id: data.id } });
|
|
|
- // },
|
|
|
- // async toDelete({ data }) {
|
|
|
- // const res = await this.delete(data.id);
|
|
|
- // this.$checkRes(res, '删除成功', '删除失败');
|
|
|
- // this.search();
|
|
|
- //},
|
|
|
+ ...trainPlan(['query', 'delete', 'update']),
|
|
|
+ ...completion({ getCompletion: 'query' }),
|
|
|
+ ...classes({ getClassesList: 'query' }),
|
|
|
+ ...student({ getStudentList: 'query' }),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.query({ skip, limit, status: '1', ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async toView({ data }, type) {
|
|
|
+ this.views = type;
|
|
|
+ if (type === 'term') {
|
|
|
+ let planid = data._id;
|
|
|
+ this.planid = planid;
|
|
|
+ this.$set(this, `termTitle`, data.title);
|
|
|
+ this.$set(this, `termList`, data.termnum);
|
|
|
+ }
|
|
|
+ if (type === 'batch') {
|
|
|
+ let termid = data._id;
|
|
|
+ let res = await this.getCompletion({ type: '0', typeid: termid, trainplanid: this.planid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let { data: completion, answertotal, alltotal, completiontotal } = res;
|
|
|
+ completion = completion.map(i => {
|
|
|
+ i.completion.includes('NaN') ? (i.completion = '-') : '';
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.$set(this, `batch`, { list: completion, answertotal, alltotal, completiontotal });
|
|
|
+ }
|
|
|
+ this.$set(this, `batchTitle`, `第${data.term}期`);
|
|
|
+ }
|
|
|
+ if (type === 'class') {
|
|
|
+ let batch = data.id;
|
|
|
+ let res = await this.getCompletion({ type: '1', typeid: batch });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let { data: completion, answertotal, alltotal, completiontotal } = res;
|
|
|
+ completion = completion.map(i => {
|
|
|
+ i.completion.includes('NaN') ? (i.completion = '-') : '';
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.$set(this, `classes`, { list: completion, answertotal, alltotal, completiontotal });
|
|
|
+ }
|
|
|
+ this.$set(this, `classTitle`, `${data.name}`);
|
|
|
+ }
|
|
|
+ if (type === 'student') {
|
|
|
+ let res = await this.getCompletion({ type: '2', typeid: data.id });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let { data: completion, answertotal, alltotal, completiontotal } = res;
|
|
|
+ completion = completion.map(i => {
|
|
|
+ i.completion.includes('NaN') ? (i.completion = '-') : '';
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.$set(this, `student`, { list: completion, answertotal, alltotal, completiontotal });
|
|
|
+ }
|
|
|
+ this.$set(this, `studentTitle`, `${data.name}`);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toReturns() {
|
|
|
+ if (this.views === 'term') this.views = 'plan';
|
|
|
+ else if (this.views === 'batch') this.views = 'term';
|
|
|
+ else if (this.views === 'class') this.views = 'batch';
|
|
|
+ else if (this.views === 'student') this.views = 'class';
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ views: {
|
|
|
+ handler(val) {
|
|
|
+ if (val === 'plan') this.planid = undefined;
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|