2019-07-26 13:32:43 +08:00
|
|
|
|
<template>
|
2019-08-08 14:32:32 +08:00
|
|
|
|
<el-card>
|
|
|
|
|
<div v-if="lessonName" slot="header" style="text-align: center;">
|
2019-08-29 17:16:33 +08:00
|
|
|
|
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
2019-08-08 14:32:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div :style="{ height: height +'px' }">
|
|
|
|
|
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
|
|
|
|
|
<QueryListPage
|
|
|
|
|
ref="queryListPage"
|
|
|
|
|
:pager-config="pagerConfig"
|
|
|
|
|
:query-form="queryForm"
|
|
|
|
|
:query-list="queryList"
|
|
|
|
|
style="height: 100%;"
|
|
|
|
|
/>
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-08-08 14:32:32 +08:00
|
|
|
|
import { getExamList, deleteExam, setExamEfficacy, setExamEffectivey } from '@/api/management/exam';
|
|
|
|
|
import { getPublishLessonTree } from '@/api/jmap/lesson';
|
|
|
|
|
import { UrlConfig } from '@/router/index';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
|
export default {
|
|
|
|
|
name: 'List',
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
BizTypeList: [],
|
|
|
|
|
OrderTypeList: [],
|
|
|
|
|
PayTypeList: [],
|
|
|
|
|
PayStatusList: [],
|
|
|
|
|
OrganizationList: [],
|
|
|
|
|
EffectiveTypeList: [],
|
|
|
|
|
userId: this.$store.state.user.id,
|
|
|
|
|
pagerConfig: {
|
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
|
},
|
|
|
|
|
lessonName: '',
|
|
|
|
|
queryForm: {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
labelWidth: '160px',
|
2019-08-08 14:32:32 +08:00
|
|
|
|
queryObject: {
|
|
|
|
|
'lessonId': {
|
|
|
|
|
type: this.$route.query.lessonId ? '' : 'select',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
label: this.$t('publish.lessonName'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
config: {
|
|
|
|
|
data: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'name': {
|
|
|
|
|
type: 'text',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
label: this.$t('publish.paperName')
|
2019-08-08 14:32:32 +08:00
|
|
|
|
},
|
|
|
|
|
'creatorName': {
|
|
|
|
|
type: 'text',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
label: this.$t('publish.creator')
|
2019-08-08 14:32:32 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
reset: !this.$route.query.lessonId
|
|
|
|
|
},
|
|
|
|
|
queryList: {
|
|
|
|
|
query: this.queryFunction,
|
|
|
|
|
selectCheckShow: false,
|
|
|
|
|
indexShow: true,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('publish.lessonName'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'lessonId',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
show: !this.$route.query.lessonId,
|
2019-08-08 15:57:36 +08:00
|
|
|
|
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
|
2019-08-08 14:32:32 +08:00
|
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('publish.paperName'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'name'
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('publish.creator'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'creatorName'
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('global.isTry'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'trial',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
columnValue: (row) => { return this.$ConstSelect.translate(row.trial, 'Whether'); },
|
|
|
|
|
tagType: (row) => {
|
|
|
|
|
switch (row.trial) {
|
|
|
|
|
case true: return 'success';
|
|
|
|
|
case false: return 'danger';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('global.duration'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'duration',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
columnValue: (row) => { return this.durationField(row.duration); },
|
|
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('publish.examTime'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'startTime',
|
|
|
|
|
type: 'formatter',
|
|
|
|
|
format: 'yyyy-MM-dd hh:ss'
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('publish.fullMark'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'fullPoint'
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('publish.passScore'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'passingPoint'
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('global.status'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
prop: 'status',
|
|
|
|
|
type: 'tag',
|
2019-08-08 15:57:36 +08:00
|
|
|
|
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
2019-08-08 14:32:32 +08:00
|
|
|
|
tagType: (row) => {
|
|
|
|
|
switch (row.status) {
|
|
|
|
|
case '1': return 'success';
|
|
|
|
|
default: return 'danger';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'button',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
title: this.$t('global.operate'),
|
|
|
|
|
width: '380',
|
2019-08-08 14:32:32 +08:00
|
|
|
|
buttons: [
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
name: this.$t('global.fastCreate'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'primary',
|
|
|
|
|
handleClick: this.handleDistribute,
|
|
|
|
|
showControl: (row) => { return row.bizType !== '02'; }
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
name: this.$t('global.edit'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'primary',
|
|
|
|
|
showControl: (row) => { return row.creatorId == this.userId; },
|
|
|
|
|
handleClick: this.handleUpdate
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
name: this.$t('global.soldOut'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'warning',
|
|
|
|
|
handleClick: this.handleEfficacy,
|
|
|
|
|
showControl: (row) => {
|
2019-09-03 18:59:46 +08:00
|
|
|
|
return !this.$route.query.lessonId && row.status == 1;
|
2019-08-08 14:32:32 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2019-09-03 16:13:23 +08:00
|
|
|
|
{
|
2019-09-18 16:04:34 +08:00
|
|
|
|
name: this.$t('publish.lessonDeleteBtn'),
|
2019-09-03 16:13:23 +08:00
|
|
|
|
type: 'warning',
|
|
|
|
|
handleClick: this.handleDelete,
|
|
|
|
|
showControl: (row) => {
|
2019-09-03 18:59:46 +08:00
|
|
|
|
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
|
2019-09-03 16:13:23 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2019-08-08 14:32:32 +08:00
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
name: this.$t('global.putaway'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'primary',
|
|
|
|
|
handleClick: this.handleEffective,
|
|
|
|
|
showControl: (row) => {
|
|
|
|
|
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
|
name: this.$t('global.delete'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'danger',
|
|
|
|
|
handleClick: this.deleteList,
|
|
|
|
|
showControl: (row) => { return row.creatorId == this.userId; }
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
actions: [
|
2019-08-29 17:16:33 +08:00
|
|
|
|
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd }
|
2019-08-08 14:32:32 +08:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
2019-09-02 15:37:57 +08:00
|
|
|
|
computed: {
|
|
|
|
|
height() {
|
|
|
|
|
return /\/exam\//.test(`${this.$route.path}`)? this.$store.state.app.height - 92: this.$store.state.app.height - 65;
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-08-08 14:32:32 +08:00
|
|
|
|
created() {
|
|
|
|
|
this.loadInitData();
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
2019-09-02 10:38:10 +08:00
|
|
|
|
this.$store.dispatch('exam/setCourseDetail', {});
|
|
|
|
|
this.$store.dispatch('exam/setRuleList', []);
|
2019-08-08 14:32:32 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
loadInitData() {
|
|
|
|
|
this.queryForm.queryObject.lessonId.config.data.length = 0;
|
|
|
|
|
getPublishLessonTree({ mapId: '' }).then(response => {
|
|
|
|
|
this.OrganizationList = response.data;
|
|
|
|
|
this.OrganizationList.forEach(elem => {
|
|
|
|
|
if (elem.id == this.$route.query.lessonId) {
|
|
|
|
|
this.lessonName = elem.name;
|
|
|
|
|
}
|
|
|
|
|
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
|
|
|
|
|
});
|
|
|
|
|
});
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
|
this.$Dictionary.effectiveType().then(list => {
|
2019-08-08 15:57:36 +08:00
|
|
|
|
this.$convertList(list, this.EffectiveTypeList, elem => {
|
2019-08-08 14:32:32 +08:00
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
durationField(fieldValue) {
|
|
|
|
|
if (fieldValue) {
|
|
|
|
|
const time = Number(fieldValue) / 60;
|
2019-09-18 16:04:34 +08:00
|
|
|
|
return `${time} ${this.$t('publish.durationMinutes')}`;
|
2019-08-08 14:32:32 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
queryFunction(params) {
|
|
|
|
|
if (this.$route.query.lessonId) {
|
|
|
|
|
params.lessonId = this.$route.query.lessonId;
|
2019-09-03 18:59:46 +08:00
|
|
|
|
params.status = '1';
|
2019-08-08 14:32:32 +08:00
|
|
|
|
}
|
|
|
|
|
return getExamList(params);
|
|
|
|
|
},
|
|
|
|
|
handleNormalAdd() {
|
|
|
|
|
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
|
|
|
|
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
|
|
|
|
this.$router.push({ path: `${path}/add/0/${lessonId}` });
|
|
|
|
|
},
|
|
|
|
|
handleUpdate(index, data) {
|
|
|
|
|
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
|
|
|
|
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
|
|
|
|
this.$router.push({ path: `${path}/edit/${data.id}/${lessonId}` });
|
|
|
|
|
},
|
|
|
|
|
handleDistribute(index, data) {
|
|
|
|
|
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
|
|
|
|
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
|
|
|
|
this.$router.push({ path: `${path}/add/${data.id}/${lessonId}` });
|
|
|
|
|
},
|
|
|
|
|
// 删除
|
|
|
|
|
deleteList(index, data) {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
deleteExam(data).then(res => {
|
|
|
|
|
this.queryList.reload();
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
message: this.$t('publish.setSuccess')
|
2019-08-08 14:32:32 +08:00
|
|
|
|
});
|
|
|
|
|
}).catch(res => {
|
|
|
|
|
if (res.code == '500009') {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
|
2019-08-08 14:32:32 +08:00
|
|
|
|
} else {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
this.$message({ type: 'error', message: this.$t('error.deleteException') });
|
2019-08-08 14:32:32 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => { });
|
|
|
|
|
},
|
2019-09-03 16:13:23 +08:00
|
|
|
|
// 下架
|
|
|
|
|
handleDelete(index, data) {
|
|
|
|
|
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
setExamEfficacy(data).then(res => {
|
|
|
|
|
this.queryList.reload();
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: this.$t('publish.setSuccess')
|
|
|
|
|
});
|
|
|
|
|
}).catch(res => {
|
|
|
|
|
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => { });
|
|
|
|
|
},
|
|
|
|
|
// 下架
|
2019-08-08 14:32:32 +08:00
|
|
|
|
handleEfficacy(index, data) {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
setExamEfficacy(data).then(res => {
|
|
|
|
|
this.queryList.reload();
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
message: this.$t('publish.setSuccess')
|
2019-08-08 14:32:32 +08:00
|
|
|
|
});
|
|
|
|
|
}).catch(res => {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
2019-08-08 14:32:32 +08:00
|
|
|
|
});
|
|
|
|
|
}).catch(() => { });
|
|
|
|
|
},
|
2019-09-03 16:13:23 +08:00
|
|
|
|
// 上架
|
2019-08-08 14:32:32 +08:00
|
|
|
|
handleEffective(index, data) {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
2019-08-08 14:32:32 +08:00
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
setExamEffectivey(data).then(res => {
|
|
|
|
|
this.queryList.reload();
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
2019-08-29 17:16:33 +08:00
|
|
|
|
message: this.$t('publish.setSuccess')
|
2019-08-08 14:32:32 +08:00
|
|
|
|
});
|
|
|
|
|
}).catch(res => {
|
2019-08-29 17:16:33 +08:00
|
|
|
|
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
2019-08-08 14:32:32 +08:00
|
|
|
|
});
|
|
|
|
|
}).catch(() => { });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
/deep/ {
|
|
|
|
|
.is-always-shadow {
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-08 14:32:32 +08:00
|
|
|
|
</style>
|