2019-07-26 13:32:43 +08:00
|
|
|
|
<template>
|
2019-10-31 14:47:05 +08:00
|
|
|
|
<div class="joylink-card">
|
|
|
|
|
<div v-if="lessonName" class="card-title">
|
2019-08-29 17:16:33 +08:00
|
|
|
|
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
2019-08-08 14:32:32 +08:00
|
|
|
|
</div>
|
2019-10-31 14:47:05 +08:00
|
|
|
|
<div :style="{ 'height': lessonName ? 'calc(100% - 47px)' : '100%' }">
|
|
|
|
|
<el-scrollbar wrap-class="scrollbar-wrapper">
|
|
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
2019-08-08 14:32:32 +08:00
|
|
|
|
</el-scrollbar>
|
|
|
|
|
</div>
|
2019-10-31 14:47:05 +08:00
|
|
|
|
</div>
|
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';
|
2019-10-22 13:40:42 +08:00
|
|
|
|
import { getPublishLessonList } from '@/api/jmap/lesson';
|
2019-08-08 14:32:32 +08:00
|
|
|
|
import { UrlConfig } from '@/router/index';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
|
export default {
|
2019-10-31 14:47:05 +08:00
|
|
|
|
name: 'List',
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
BizTypeList: [],
|
|
|
|
|
OrderTypeList: [],
|
|
|
|
|
PayTypeList: [],
|
|
|
|
|
PayStatusList: [],
|
|
|
|
|
OrganizationList: [],
|
|
|
|
|
EffectiveTypeList: [],
|
|
|
|
|
userId: this.$store.state.user.id,
|
|
|
|
|
pagerConfig: {
|
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
|
},
|
|
|
|
|
lessonName: '',
|
|
|
|
|
queryForm: {
|
|
|
|
|
labelWidth: '160px',
|
|
|
|
|
queryObject: {
|
|
|
|
|
'lessonId': {
|
|
|
|
|
type: this.$route.query.lessonId ? '' : 'select',
|
|
|
|
|
label: this.$t('publish.lessonName'),
|
|
|
|
|
config: {
|
|
|
|
|
data: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'name': {
|
|
|
|
|
type: 'text',
|
|
|
|
|
label: this.$t('publish.paperName')
|
|
|
|
|
},
|
|
|
|
|
'creatorName': {
|
|
|
|
|
type: 'text',
|
|
|
|
|
label: this.$t('publish.creator')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
reset: !this.$route.query.lessonId
|
|
|
|
|
},
|
|
|
|
|
queryList: {
|
|
|
|
|
query: this.queryFunction,
|
|
|
|
|
selectCheckShow: false,
|
|
|
|
|
indexShow: true,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('publish.lessonName'),
|
|
|
|
|
prop: 'lessonId',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
show: !this.$route.query.lessonId,
|
|
|
|
|
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
|
|
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('publish.paperName'),
|
|
|
|
|
prop: 'name'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('publish.creator'),
|
2020-01-02 18:40:30 +08:00
|
|
|
|
prop: 'creatorNickname'
|
2019-10-31 14:47:05 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('global.isTry'),
|
|
|
|
|
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';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('global.duration'),
|
|
|
|
|
prop: 'duration',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
columnValue: (row) => { return this.durationField(row.duration); },
|
|
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('publish.examTime'),
|
|
|
|
|
prop: 'startTime',
|
|
|
|
|
type: 'formatter',
|
|
|
|
|
format: 'yyyy-MM-dd hh:ss'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('publish.fullMark'),
|
|
|
|
|
prop: 'fullPoint'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('publish.passScore'),
|
|
|
|
|
prop: 'passingPoint'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.$t('global.status'),
|
|
|
|
|
prop: 'status',
|
|
|
|
|
type: 'tag',
|
|
|
|
|
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
|
|
|
|
tagType: (row) => {
|
|
|
|
|
switch (row.status) {
|
|
|
|
|
case '1': return 'success';
|
|
|
|
|
default: return 'danger';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'button',
|
|
|
|
|
title: this.$t('global.operate'),
|
|
|
|
|
width: '380',
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('global.fastCreate'),
|
|
|
|
|
type: 'primary',
|
|
|
|
|
handleClick: this.handleDistribute,
|
|
|
|
|
showControl: (row) => { return row.bizType !== '02'; }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('global.edit'),
|
|
|
|
|
type: 'primary',
|
|
|
|
|
showControl: (row) => { return row.creatorId == this.userId; },
|
|
|
|
|
handleClick: this.handleUpdate
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('global.soldOut'),
|
|
|
|
|
type: 'warning',
|
|
|
|
|
handleClick: this.handleEfficacy,
|
|
|
|
|
showControl: (row) => {
|
|
|
|
|
return !this.$route.query.lessonId && row.status == 1;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('global.putaway'),
|
|
|
|
|
type: 'primary',
|
|
|
|
|
handleClick: this.handleEffective,
|
|
|
|
|
showControl: (row) => {
|
|
|
|
|
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('global.delete'),
|
|
|
|
|
type: 'danger',
|
|
|
|
|
handleClick: this.deleteList,
|
|
|
|
|
showControl: (row) => { return row.creatorId == this.userId; }
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
actions: [
|
|
|
|
|
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd },
|
|
|
|
|
{ text: this.$t('global.back'), btnCode: 'employee_back', handler: this.handlerBack }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.loadInitData();
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.$store.dispatch('exam/setCourseDetail', {});
|
|
|
|
|
this.$store.dispatch('exam/setRuleList', []);
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
loadInitData() {
|
|
|
|
|
this.queryForm.queryObject.lessonId.config.data.length = 0;
|
|
|
|
|
getPublishLessonList().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-10-31 14:47:05 +08:00
|
|
|
|
this.$Dictionary.effectiveType().then(list => {
|
|
|
|
|
this.$convertList(list, this.EffectiveTypeList, elem => {
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
durationField(fieldValue) {
|
|
|
|
|
if (fieldValue) {
|
|
|
|
|
const time = Number(fieldValue) / 60;
|
|
|
|
|
return `${time} ${this.$t('publish.durationMinutes')}`;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
queryFunction(params) {
|
|
|
|
|
if (this.$route.query.lessonId) {
|
|
|
|
|
params.lessonId = this.$route.query.lessonId;
|
|
|
|
|
params.status = '1';
|
|
|
|
|
}
|
|
|
|
|
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) {
|
|
|
|
|
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
deleteExam(data).then(res => {
|
|
|
|
|
this.queryList.reload();
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: this.$t('publish.setSuccess')
|
|
|
|
|
});
|
|
|
|
|
}).catch(res => {
|
|
|
|
|
if (res.code == '500009') {
|
|
|
|
|
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
|
|
|
|
|
} else {
|
|
|
|
|
this.$message({ type: 'error', message: this.$t('error.deleteException') });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => { });
|
|
|
|
|
},
|
|
|
|
|
// 下架
|
|
|
|
|
handleEfficacy(index, data) {
|
|
|
|
|
this.$confirm(this.$t('publish.wellSoldOutPaper'), 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(() => { });
|
|
|
|
|
},
|
|
|
|
|
// 上架
|
|
|
|
|
handleEffective(index, data) {
|
|
|
|
|
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
setExamEffectivey(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(() => { });
|
|
|
|
|
},
|
|
|
|
|
handlerBack() {
|
|
|
|
|
this.$router.back();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-08 14:32:32 +08:00
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
2019-10-31 14:47:05 +08:00
|
|
|
|
.joylink-card {
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
.card-title{
|
|
|
|
|
text-align: center;
|
|
|
|
|
height: 47px;
|
|
|
|
|
line-height: 47px;
|
|
|
|
|
border-bottom: 1px solid #e6e6e6;
|
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
/deep/ {
|
|
|
|
|
.is-always-shadow {
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-08 14:32:32 +08:00
|
|
|
|
</style>
|