| | |
| | | <el-button slot="reference" type="primary">添加</el-button> |
| | | |
| | | </el-popover> |
| | | <el-popover |
| | | placement="right" |
| | | width="400" |
| | | trigger="click"> |
| | | <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-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-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> |
| | | </el-popover> |
| | | <el-button class="op-item" type="danger" @click="downloadImportTemplate">下载导入模板</el-button> |
| | | <el-upload |
| | | class="op-item" |
| | |
| | | </el-form> |
| | | <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%"> |
| | | <el-table-column prop="subjectId" label="课目" :formatter="subjectIdFormatte" width="120px"/> |
| | | <!-- <el-table-column prop="subjectId" label="课目">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!--<!– <span>{{this.subjectIdFormatte}}</span>–>--> |
| | | <!-- <span>{{scope.row.questionSubjects.forEach(item=>{ return item.subName})}}</span>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column prop="questionType" label="题型" :formatter="questionTypeFormatter" width="70px"/> |
| | | <el-table-column prop="shortTitle" label="题干" show-overflow-tooltip/> |
| | | <el-table-column prop="score" label="分数" width="60px"/> |
| | |
| | | import Pagination from '@/components/Pagination' |
| | | import QuestionShow from './components/Show' |
| | | import questionApi from '@/api/question' |
| | | import {downloadExcel} from '@/utils/download' |
| | | import { downloadExcel } from '@/utils/download' |
| | | |
| | | import Cookies from 'js-cookie' |
| | | export default { |
| | | components: { Pagination, QuestionShow }, |
| | | data () { |
| | | return { |
| | | upLoadUrl:'/api/admin/question/import', |
| | | fileList:[], |
| | | timeRange: [], |
| | | exportForm: { |
| | | questionType: null, |
| | | start: null, |
| | | end: null |
| | | }, |
| | | upLoadUrl: '/api/admin/question/import', |
| | | fileList: [], |
| | | queryParam: { |
| | | id: null, |
| | | questionType: 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, '题目导出') |
| | | }) |
| | | }, |
| | | // 下载导入模板 |
| | | downloadImportTemplate () { |
| | | questionApi.downloadImportTemplate().then(res => { |
| | | downloadExcel(res, '题目导出') |
| | | downloadExcel(res, '题目导入模板') |
| | | }) |
| | | }, |
| | | handlePreview (e) { |
| | |
| | | questionTypeFormatter (row, column, cellValue, index) { |
| | | return this.enumFormat(this.questionType, cellValue) |
| | | }, |
| | | subjectIdFormatte(row, column, cellValue, index){ |
| | | subjectIdFormatte (row, column, cellValue, index) { |
| | | console.log(row, column, cellValue, index) |
| | | let str = '' |
| | | row.questionSubjects.forEach(item=>{ |
| | | str+=item.subName+',' |
| | | row.questionSubjects.forEach(item => { |
| | | str += item.subName + ',' |
| | | }) |
| | | return str = str.slice(0,str.length-1) |
| | | return str = str.slice(0, str.length - 1) |
| | | }, |
| | | subjectFormatter (row, column, cellValue, index) { |
| | | return this.subjectEnumFormat(cellValue) |
| | |
| | | computed: { |
| | | |
| | | headers: function () { |
| | | console.log( Cookies.get('adminUserName'),) |
| | | // console.log(store.getters.Admin-Token) |
| | | // const tenantId = store.getters.userInfo.tenantId |
| | | return { |
| | | // 'Authorization': "Bearer " + store.getters.Admin-Token, |
| | | "Cookie":"JSESSIONID=shpHmjIK1ysHPDyAQB4-M-N3WytgJ3UIwYrfcA2t; adminUserName=admin" |
| | | 'Cookie': 'JSESSIONID=shpHmjIK1ysHPDyAQB4-M-N3WytgJ3UIwYrfcA2t; adminUserName=admin' |
| | | } |
| | | }, |
| | | ...mapGetters('enumItem', ['enumFormat']), |