Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly

This commit is contained in:
fan 2022-10-14 15:32:15 +08:00
commit 88024ce606
3 changed files with 32 additions and 14 deletions

View File

@ -7,10 +7,10 @@
<script> <script>
// import { UrlConfig } from '@/scripts/ConstDic'; // import { UrlConfig } from '@/scripts/ConstDic';
import { listQuestionPage, deleteQuestion } from '@/api/questionBank.js'; import { listQuestionPage, deleteQuestion, getLableList } from '@/api/questionBank.js';
import DialogDetail from './dialog-detail'; import DialogDetail from './dialog-detail';
import { convertSheetToList } from '@/jmapNew/theme/parser/util.js'; import { convertSheetToList } from '@/jmapNew/theme/parser/util.js';
import { getCompanyList } from '@/api/company'; // import { getCompanyList } from '@/api/company';
import XLSX from 'xlsx'; import XLSX from 'xlsx';
export default { export default {
@ -19,7 +19,7 @@ export default {
}, },
data() { data() {
return { return {
companyList: [], // companyList: [],
companyMap: {}, companyMap: {},
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
@ -29,6 +29,7 @@ export default {
reset: true, reset: true,
labelWidth: '80px', labelWidth: '80px',
leftSpan: 17, leftSpan: 17,
beforeQuery: this.beforeQuery,
queryObject: { queryObject: {
type: { type: {
type: 'select', type: 'select',
@ -40,14 +41,15 @@ export default {
topic: { topic: {
type: 'text', type: 'text',
label: '题 目' label: '题 目'
},
labels: {
type: 'select',
label: '标 签',
config: {
multiple: true,
data: []
}
} }
// companyId: {
// type: 'select',
// label: '',
// config: {
// data: []
// }
// }
} }
}, },
queryList: { queryList: {
@ -134,15 +136,26 @@ export default {
} }
}, },
mounted() { mounted() {
this.companyList = []; // this.companyList = [];
// getCompanyList().then(resp => { // getCompanyList().then(resp => {
// resp.data.forEach(item => { // resp.data.forEach(item => {
// // this.queryForm.queryObject.companyId.config.data.push({ value: item.id, label: item.name }); // // this.queryForm.queryObject.companyId.config.data.push({ value: item.id, label: item.name });
// this.companyMap[item.id] = item.name; // this.companyMap[item.id] = item.name;
// }); // });
// }); // });
getLableList().then(res => {
res.data.forEach(item => {
this.queryForm.queryObject.labels.config.data.push({ value: item, label: item });
});
}).catch(err => {
console.log(err);
});
}, },
methods: { methods: {
beforeQuery(obj) {
obj.labels = obj.labels ? obj.labels.join(',') : '';
return obj;
},
doCreate() { doCreate() {
// this.$router.push({path: `${UrlConfig.bank.questionCreate}`}); // this.$router.push({path: `${UrlConfig.bank.questionCreate}`});
this.$router.push({path: '/teaching/questionCreate'}); this.$router.push({path: '/teaching/questionCreate'});

View File

@ -73,7 +73,8 @@ export default {
}, },
computed: { computed: {
isSelect() { isSelect() {
return this.remove && this.option.type == 'select'; const selectArr = ['select', 'multi'];
return this.remove && selectArr.includes(this.option.type);
}, },
isProject() { isProject() {
const project = getSessionStorage('project'); const project = getSessionStorage('project');

View File

@ -57,13 +57,17 @@ export default {
setTimeout(() => { setTimeout(() => {
this.formModel = deepAssign({}, this.$store.state.race.preTheoryData[this.questionId]); this.formModel = deepAssign({}, this.$store.state.race.preTheoryData[this.questionId]);
this.formModel.answer = this.formModel.optionList.findIndex(ele => ele.correct); this.formModel.answer = this.formModel.optionList.findIndex(ele => ele.correct);
this.$refs.info.tagsArr = this.formModel.tags.split(','); const tagVal = this.formModel.tags ? this.formModel.tags.split(',') : '';
this.$refs.info.tagsArr = tagVal;
this.tagsArr = tagVal;
}, 500); }, 500);
} else { } else {
getQuestionInfo(this.questionId).then(resp => { getQuestionInfo(this.questionId).then(resp => {
this.formModel = resp.data; this.formModel = resp.data;
this.formModel.answer = this.formModel.optionList.findIndex(ele => ele.correct); this.formModel.answer = this.formModel.optionList.findIndex(ele => ele.correct);
this.$refs.info.tagsArr = this.formModel.tags.split(','); const tagVal = this.formModel.tags ? this.formModel.tags.split(',') : '';
this.$refs.info.tagsArr = tagVal;
this.tagsArr = tagVal;
}); });
} }
}, },