337 lines
14 KiB
Vue
337 lines
14 KiB
Vue
<template>
|
||
<div class="joylink-card">
|
||
<div v-if="lessonName" class="card-title">
|
||
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
||
</div>
|
||
<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" />
|
||
</el-scrollbar>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { getExamList, deleteExam, setExamEfficacy, setExamEffectivey } from '@/api/management/exam';
|
||
import { getPublishLessonList } from '@/api/jmap/lesson';
|
||
import { UrlConfig } from '@/scripts/ConstDic';
|
||
|
||
export default {
|
||
name: 'List',
|
||
data() {
|
||
return {
|
||
BizTypeList: [],
|
||
OrderTypeList: [],
|
||
PayTypeList: [],
|
||
PayStatusList: [],
|
||
OrganizationList: [],
|
||
EffectiveTypeList: [],
|
||
userId: this.$store.state.user.id,
|
||
pagerConfig: {
|
||
pageSize: 'pageSize',
|
||
pageIndex: 'pageNum'
|
||
},
|
||
lessonName: '',
|
||
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'),
|
||
prop: 'creatorNickname'
|
||
},
|
||
{
|
||
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 row.status == '1' ? '有效' : row.overdue ? '过期' : '下架'; },
|
||
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'), show: !this.$route.path.includes('device'), btnCode: 'employee_back', handler: this.handlerBack },
|
||
{ text: '退出', show: this.$route.path.includes('device'), btnCode: 'employee_back', handler: this.handelQuit}
|
||
]
|
||
}
|
||
};
|
||
},
|
||
computed: {
|
||
queryForm() {
|
||
return this.$route.path.includes('device') ? {
|
||
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')
|
||
}
|
||
},
|
||
reset: !this.$route.query.lessonId
|
||
} : {
|
||
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
|
||
};
|
||
}
|
||
},
|
||
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;
|
||
}
|
||
if (this.$route.path.includes('device')) {
|
||
if (elem.mapId === this.$route.query.mapId) {
|
||
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
|
||
}
|
||
} else {
|
||
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
|
||
}
|
||
});
|
||
});
|
||
|
||
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;
|
||
} else if (this.$route.path.includes('device')) {
|
||
params.mapId = this.$route.query.mapId;
|
||
}
|
||
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.replace({ path: `${path}/add/0/${lessonId}`, query: { mapId: this.$route.query.mapId, noPreLogout: this.$route.query.noPreLogout} });
|
||
},
|
||
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.replace({ path: `${path}/edit/${data.id}/${lessonId}`, query: { mapId: this.$route.query.mapId, noPreLogout: this.$route.query.noPreLogout} });
|
||
},
|
||
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.replace({ path: `${path}/add/${data.id}/${lessonId}`, query: { mapId: this.$route.query.mapId, noPreLogout: this.$route.query.noPreLogout} });
|
||
},
|
||
// 删除
|
||
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();
|
||
},
|
||
handelQuit() {
|
||
window.close();
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||
.joylink-card {
|
||
height: 100%;
|
||
}
|
||
.card-title{
|
||
text-align: center;
|
||
height: 47px;
|
||
line-height: 47px;
|
||
border-bottom: 1px solid #e6e6e6;
|
||
}
|
||
/deep/ {
|
||
.is-always-shadow {
|
||
box-shadow: none;
|
||
border-bottom: none;
|
||
}
|
||
}
|
||
</style>
|