From 6335846e25b0f0e2ce13212cdd181aff6fdad37b Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 22 五月 2024 14:30:10 +0800 Subject: [PATCH] 题目按课目导出 --- src/views/exam/question/list.vue | 46 +++++++++++++--------------------------------- 1 files changed, 13 insertions(+), 33 deletions(-) diff --git a/src/views/exam/question/list.vue b/src/views/exam/question/list.vue index 055d211..c333b0b 100644 --- a/src/views/exam/question/list.vue +++ b/src/views/exam/question/list.vue @@ -33,22 +33,13 @@ <el-form label-position="top" > - <el-form-item label="棰樺瀷锛�"> - <el-select v-model="exportForm.questionType" clearable> - <el-option v-for="item in questionType" :key="item.key" :value="item.key" :label="item.value"></el-option> + <el-form-item label="璇剧洰锛�"> + <el-select v-model="exportForm.subjectIds" clearable filterable multiple> + <el-option v-for="item in subjectIdList" :key="item.id" :value="item.id" :label="item.name"></el-option> </el-select> </el-form-item> - <el-form-item label="鍒涘缓鏃堕棿锛�"> - <el-date-picker - v-model="timeRange" - type="daterange" - range-separator="鑷�" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡"> - </el-date-picker> - <el-form-item style="text-align: center;margin-top: 5px"> + <el-form-item> <el-button type="primary" @click="exportQuestion">瀵煎嚭</el-button> - </el-form-item> </el-form-item> </el-form> <el-button slot="reference" class="op-item" type="success">瀵煎嚭</el-button> @@ -99,17 +90,16 @@ import Pagination from '@/components/Pagination' import QuestionShow from './components/Show' import questionApi from '@/api/question' +import SubjectApi from '@/api/subject' import { downloadExcel } from '@/utils/download' - export default { components: { Pagination, QuestionShow }, data () { return { + subjectIdList: [], timeRange: [], exportForm: { - questionType: null, - start: null, - end: null + subjectIds: [], }, upLoadUrl: '/api/admin/question/import', fileList: [], @@ -137,16 +127,13 @@ created () { this.initSubject() this.search() + this.getSubjectIds() this.queryParam.subjectId = null this.subjectFilter = this.subjects }, methods: { // 瀵煎嚭棰樼洰 exportQuestion () { - if (this.timeRange && this.timeRange.length > 1) { - this.exportForm.startStr = this.timeRange[0] - this.exportForm.endStr = this.timeRange[1] - } questionApi.exportQuestion(this.exportForm).then(res => { downloadExcel(res, '棰樼洰瀵煎嚭') }) @@ -176,17 +163,6 @@ this.$message.warning('鏂囦欢鏍煎紡涓嶅锛屼粎闄恱ls鍜寈lsx') return false } - // console.log(file) - // const isJPG = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; - // // const isLt2M = file.size / 1024 / 1024 < 2; - // - // if (!isJPG) { - // this.$message.error('涓婁紶鏂囦欢鍙兘鏄疎xcel!'); - // } - // // if (!isLt2M) { - // // this.$message.error('涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!'); - // // } - // return isJPG ; }, submitForm () { this.queryParam.pageIndex = 1 @@ -218,6 +194,11 @@ _this.questionShow.question = re.response _this.questionShow.loading = false }) + }, + getSubjectIds() { + SubjectApi.list().then(res => { + this.subjectIdList = res.response + }); }, editQuestion (row) { let url = this.enumFormat(this.editUrlEnum, row.questionType) @@ -251,7 +232,6 @@ ...mapActions('exam', { initSubject: 'initSubject' }) }, computed: { - headers: function () { // console.log(store.getters.Admin-Token) // const tenantId = store.getters.userInfo.tenantId -- Gitblit v1.8.0