|
@@ -70,7 +70,11 @@
|
|
|
<!-- 问卷提交数据 -->
|
|
|
<div class="qn-col qn-data-box">
|
|
|
<div class="qn-box-header">
|
|
|
- <span>{{ $t('survey.surveyResult') }}</span>
|
|
|
+ <div>
|
|
|
+ <span :class="['qn-box-header-tab',curTab === 'progress' ? 'qn-box-header-tab-active' : '']" @click="onChangeResultTab('progress')" v-if="currentQn.progress !== 'pending'">问卷进度</span>
|
|
|
+ <span :class="['qn-box-header-tab',curTab === 'result' ? 'qn-box-header-tab-active' : '']" @click="onChangeResultTab('result')">{{ $t('survey.surveyResult') }}</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="qn-box-header-tools" v-show="!isEmptyData">
|
|
|
<div class="qn-box-header-tools-tool" style="margin-right: 10px" v-show="currentQn.progress !== 'finish' && editable">
|
|
|
<Icon type="md-list-box" color="#dcdcdc" />
|
|
@@ -107,9 +111,24 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<vuescroll>
|
|
|
- <div class="qn-data-wrap">
|
|
|
- <BaseQuestionnaire :editItem="currentQn" :isEdit="editable" ref="qnPaper" v-if="!isEmptyData"></BaseQuestionnaire>
|
|
|
+ <div v-show="qnList.length === 0">
|
|
|
+ <EmptyData :top="50"></EmptyData>
|
|
|
+ </div>
|
|
|
+ <div v-show="qnList.length">
|
|
|
+ <div class="qn-data-wrap" v-if="curTab === 'result'">
|
|
|
+ <BaseQuestionnaire :editItem="currentQn" :isEdit="editable" ref="qnPaper" v-if="!isEmptyData"></BaseQuestionnaire>
|
|
|
+ </div>
|
|
|
+ <div class="qn-data-wrap qn-progress-wrap" v-else>
|
|
|
+ <div class="progress-wrap">
|
|
|
+ <BaseProgress barId="pro1" :total="allSsList.length" :noAnswerdCount="noFinishStudents.length"></BaseProgress>
|
|
|
+ <BasePie barId="pie1" :total="allSsList.length" :noAnswerdCount="noFinishStudents.length"></BasePie>
|
|
|
+ </div>
|
|
|
+ <div class="no-table-wrap">
|
|
|
+ <BaseSsTable :tableDatas="noFinishStudents"></BaseSsTable>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
</vuescroll>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -123,10 +142,16 @@
|
|
|
import blobTool from "@/utils/blobTool.js";
|
|
|
import BaseQuestionnaire from "@/components/questionnaire/BaseQuestionnaire.vue";
|
|
|
import BaseQnForm from "@/components/questionnaire/BaseQnForm.vue";
|
|
|
+ import BaseProgress from "@/components/questionnaire/BaseProgress.vue";
|
|
|
+ import BasePie from "@/components/questionnaire/BasePie.vue";
|
|
|
+ import BaseSsTable from "@/components/questionnaire/BaseSsTable.vue";
|
|
|
export default {
|
|
|
components: {
|
|
|
BaseQuestionnaire,
|
|
|
BaseQnForm,
|
|
|
+ BaseProgress,
|
|
|
+ BasePie,
|
|
|
+ BaseSsTable
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -148,6 +173,9 @@
|
|
|
editItem: {},
|
|
|
activeQnIndex: null,
|
|
|
addQnModal: false,
|
|
|
+ curTab:'progress',
|
|
|
+ noFinishStudents:[],
|
|
|
+ allSsList:[]
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
@@ -159,6 +187,10 @@
|
|
|
this.getQnList(index === 0 ? "school" : "private");
|
|
|
}, 500)
|
|
|
},
|
|
|
+
|
|
|
+ onChangeResultTab(tab){
|
|
|
+ this.curTab = tab
|
|
|
+ },
|
|
|
|
|
|
/** 新增问卷 */
|
|
|
goToCreate() {
|
|
@@ -185,6 +217,7 @@
|
|
|
this.editable = true;
|
|
|
this.isEmptyData = false;
|
|
|
this.$refs.qnForm.qnFormEdit = true;
|
|
|
+ this.onChangeResultTab('result')
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -254,6 +287,12 @@
|
|
|
}
|
|
|
this.currentQn = item.id ? await this.getQnDetails(item) : this.currentQn;
|
|
|
this.currentQn.progress = item.progress;
|
|
|
+ if (item.id) this.getSurveyStudents(this.currentQn)
|
|
|
+ if(item.progress === 'pending'){
|
|
|
+ this.onChangeResultTab('result')
|
|
|
+ }else{
|
|
|
+ this.onChangeResultTab('progress')
|
|
|
+ }
|
|
|
console.log("获取问卷数据");
|
|
|
console.log(this.currentQn);
|
|
|
this.activeQnIndex = hasNewQn ? this.qnList.indexOf(item) : index;
|
|
@@ -294,7 +333,8 @@
|
|
|
this.isBtnLoading = false;
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
+ /* 保存问卷题目到Blob */
|
|
|
async doUploadBlob(qnBaseInfo, items) {
|
|
|
console.log('上传参数', qnBaseInfo)
|
|
|
return new Promise(async (resolve, reject) => {
|
|
@@ -353,6 +393,74 @@
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ /* 获取当前问卷活动学生作答数据 */
|
|
|
+ async getSurveyStudents(surveyItem) {
|
|
|
+ this.isLoading = true
|
|
|
+ let answerdList = await this.getAnswerdRecord(surveyItem)
|
|
|
+ // 先查找 投票发布对象关联的学生清单 然后再去判断学生的作答情况
|
|
|
+ this.$api.schoolSetting.getClassroomStudent({
|
|
|
+ school_code: this.$store.state.userInfo.schoolCode,
|
|
|
+ ids: surveyItem.classes,
|
|
|
+ scope:surveyItem.owner === this.$store.state.userInfo.schoolCode ? 'school' : 'private'
|
|
|
+ }).then(res => {
|
|
|
+ if (!res.error && res.classrooms.length) {
|
|
|
+ let list = []
|
|
|
+ res.classrooms.forEach(classroom => {
|
|
|
+ classroom.students.forEach(i => {
|
|
|
+ list.push({
|
|
|
+ id: i.id,
|
|
|
+ name: i.name,
|
|
|
+ no: i.no,
|
|
|
+ classroomName: classroom.name
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.allSsList = list
|
|
|
+ // 要根据作答情况 结合两张表 处理表格显示的数据
|
|
|
+ if (answerdList.length) {
|
|
|
+ this.noFinishStudents = this.getNoFinishList(answerdList,list)
|
|
|
+ } else {
|
|
|
+ this.noFinishStudents = list
|
|
|
+ }
|
|
|
+ this.isLoading = false
|
|
|
+ } else {
|
|
|
+ this.$Message.error(this.$t('vote.getDataFailTip'))
|
|
|
+ this.isLoading = false
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error(this.$t('vote.getClassDataFailTip'))
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 获取未作答学生清单 */
|
|
|
+ getNoFinishList(answerdList,allList){
|
|
|
+ let result = []
|
|
|
+ console.log(allList.map(i => i.id))
|
|
|
+ allList.forEach(i => {
|
|
|
+ if(!answerdList.includes(i.id)){
|
|
|
+ result.push(i)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return result
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 获取正在进行中的投票活动的投票数据 */
|
|
|
+ getAnswerdRecord(surveyItem){
|
|
|
+ return new Promise((r,j) => {
|
|
|
+ this.$api.questionnaire.GetAnswerdRecord({
|
|
|
+ id: surveyItem.id,
|
|
|
+ code: surveyItem.code,
|
|
|
+ }).then(res => {
|
|
|
+ if(!res.error){
|
|
|
+ r(res.userids)
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ j(err)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
onShowAllAnalysis() {
|
|
|
this.$refs.qnPaper.onShowAllAnalysis();
|