|
@@ -6,7 +6,10 @@
|
|
|
<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>
|
|
|
+ <data-table :fields="termFields" :data="termList" :opera="opera" @view="data => toView(data, 'pool')"></data-table>
|
|
|
+ </self-cards>
|
|
|
+ <self-cards title="问卷列表" v-if="views === `pool`" :returns="toReturns">
|
|
|
+ <data-table :fields="quesFields" :data="quesList" :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>
|
|
@@ -29,11 +32,14 @@
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
import selfCards from './parts/cards';
|
|
|
+import _ from 'lodash';
|
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: trainPlan } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
const { mapActions: completion } = createNamespacedHelpers('completion');
|
|
|
+const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
|
|
|
+const { mapActions: termquest } = createNamespacedHelpers('termquest');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
metaInfo: { title: '问卷完成度查询' },
|
|
@@ -72,6 +78,9 @@ export default {
|
|
|
list: [],
|
|
|
termFields: [{ label: '期数', prop: 'term' }],
|
|
|
termList: [],
|
|
|
+ quesFields: [{ label: '标题', prop: 'name' }],
|
|
|
+ quesList: [],
|
|
|
+ quest: [],
|
|
|
batchFields: [
|
|
|
{ label: '批次', prop: 'name' },
|
|
|
{ label: '进度', prop: 'completion' },
|
|
@@ -94,10 +103,6 @@ export default {
|
|
|
student: {
|
|
|
list: [],
|
|
|
},
|
|
|
- studFilter: [
|
|
|
- { label: '姓名', model: 'name' },
|
|
|
- { label: '进度', prop: 'completion' },
|
|
|
- ],
|
|
|
classid: '',
|
|
|
studTotal: 0,
|
|
|
}),
|
|
@@ -111,12 +116,18 @@ export default {
|
|
|
...completion({ getCompletion: 'query' }),
|
|
|
...classes({ getClassesList: 'query' }),
|
|
|
...student({ getStudentList: 'query' }),
|
|
|
+ ...termquest({ getTermQuestList: 'query' }),
|
|
|
+ ...questionnaire({ getQuestionnaireList: '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);
|
|
|
}
|
|
|
+ const quest = await this.getQuestionnaireList();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `quest`, quest.data);
|
|
|
+ }
|
|
|
},
|
|
|
async toView({ data }, type) {
|
|
|
this.views = type;
|
|
@@ -126,34 +137,56 @@ export default {
|
|
|
this.$set(this, `termTitle`, data.title);
|
|
|
this.$set(this, `termList`, data.termnum);
|
|
|
}
|
|
|
- if (type === 'batch') {
|
|
|
+ if (type === 'pool') {
|
|
|
let termid = data._id;
|
|
|
- let res = await this.getCompletion({ type: '0', typeid: termid, trainplanid: this.planid });
|
|
|
+ let res = await this.getTermQuestList({ termid: termid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let { term } = data;
|
|
|
+ let { questionnaireid, termid, ...othrers } = res.data[0];
|
|
|
+ let newArr = this.quest.filter(q => (_.find(questionnaireid, sq => sq === q.id) ? q : ''));
|
|
|
+ newArr = newArr.map(q => {
|
|
|
+ q.term = term;
|
|
|
+ q.termid = termid;
|
|
|
+ return q;
|
|
|
+ });
|
|
|
+ this.$set(this, `quesList`, newArr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (type === 'batch') {
|
|
|
+ let termid = data.termid;
|
|
|
+ let questionnaireid = data.id;
|
|
|
+ let res = await this.getCompletion({ type: '0', typeid: termid, trainplanid: this.planid, questionnaireid });
|
|
|
if (this.$checkRes(res)) {
|
|
|
let { data: completion, answertotal, alltotal, completiontotal } = res;
|
|
|
completion = completion.map(i => {
|
|
|
i.completion.includes('NaN') ? (i.completion = '-') : '';
|
|
|
+ i.questname = data.name;
|
|
|
+ i.term = data.term;
|
|
|
+ i.questionnaireid = questionnaireid;
|
|
|
return i;
|
|
|
});
|
|
|
this.$set(this, `batch`, { list: completion, answertotal, alltotal, completiontotal });
|
|
|
}
|
|
|
- this.$set(this, `batchTitle`, `第${data.term}期`);
|
|
|
+ this.$set(this, `batchTitle`, `第${data.term}期 问卷${data.name}进度`);
|
|
|
}
|
|
|
if (type === 'class') {
|
|
|
- let batch = data.id;
|
|
|
- let res = await this.getCompletion({ type: '1', typeid: batch });
|
|
|
+ let { id: batch, questname, term, questionnaireid } = data;
|
|
|
+ let res = await this.getCompletion({ type: '1', typeid: batch, questionnaireid });
|
|
|
if (this.$checkRes(res)) {
|
|
|
let { data: completion, answertotal, alltotal, completiontotal } = res;
|
|
|
completion = completion.map(i => {
|
|
|
i.completion.includes('NaN') ? (i.completion = '-') : '';
|
|
|
+ i.questname = data.questname;
|
|
|
+ i.questionnaireid = questionnaireid;
|
|
|
return i;
|
|
|
});
|
|
|
this.$set(this, `classes`, { list: completion, answertotal, alltotal, completiontotal });
|
|
|
}
|
|
|
- this.$set(this, `classTitle`, `${data.name}`);
|
|
|
+ this.$set(this, `classTitle`, `${data.name} 问卷${questname}进度`);
|
|
|
}
|
|
|
if (type === 'student') {
|
|
|
- let res = await this.getCompletion({ type: '2', typeid: data.id });
|
|
|
+ let { id, questname, questionnaireid } = data;
|
|
|
+ let res = await this.getCompletion({ type: '2', typeid: data.id, questionnaireid });
|
|
|
if (this.$checkRes(res)) {
|
|
|
let { data: completion, answertotal, alltotal, completiontotal } = res;
|
|
|
completion = completion.map(i => {
|
|
@@ -162,12 +195,13 @@ export default {
|
|
|
});
|
|
|
this.$set(this, `student`, { list: completion, answertotal, alltotal, completiontotal });
|
|
|
}
|
|
|
- this.$set(this, `studentTitle`, `${data.name}`);
|
|
|
+ this.$set(this, `studentTitle`, `${data.name} 问卷${questname}进度`);
|
|
|
}
|
|
|
},
|
|
|
toReturns() {
|
|
|
if (this.views === 'term') this.views = 'plan';
|
|
|
- else if (this.views === 'batch') this.views = 'term';
|
|
|
+ else if (this.views === 'pool') this.views = 'term';
|
|
|
+ else if (this.views === 'batch') this.views = 'pool';
|
|
|
else if (this.views === 'class') this.views = 'batch';
|
|
|
else if (this.views === 'student') this.views = 'class';
|
|
|
},
|