rt-sim-training-client/src/views/system/userExam/index.vue

130 lines
4.3 KiB
Vue
Raw Normal View History

2019-10-31 15:34:38 +08:00
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<publish-exam-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { getPublishExam, delPublishExam } from '@/api/management/userexam';
import PublishExamEdit from './edit';
export default {
name: 'PublishExam',
components: {
PublishExamEdit
},
data() {
return {
examResultList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '150px',
reset: true,
queryObject: {
examName: {
type: 'text',
label: this.$t('system.examName')
},
userName: {
type: 'text',
label: this.$t('system.examUser')
},
result: {
type: 'select',
label: this.$t('system.examResult'),
config: {
data: this.$ConstSelect.examResultList
}
}
}
2019-10-31 15:34:38 +08:00
},
queryList: {
query: getPublishExam,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('system.examName'),
prop: 'examName'
},
{
title: this.$t('system.examResult'),
prop: 'result',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.result, this.$ConstSelect.examResultList, ['value', 'label']); },
tagType: (row) => {
switch (row.result) {
case '01': return 'warning';
case '02': return 'success';
case '03': return 'danger';
case '04': return 'danger';
}
}
},
{
title: this.$t('system.examScore'),
prop: 'score'
},
{
title: this.$t('system.examUser'),
prop: 'userNickname'
},
{
title: this.$t('global.mobile'),
prop: 'userMobile'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.edit
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
]
},
2019-10-31 15:34:38 +08:00
currentModel: {}
};
},
methods: {
// 编辑
edit(index, row) {
this.$refs.edit.show(row);
},
// 删除
handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelExamResult'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
delPublishExam(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
reloadTable() {
this.queryList.reload();
}
}
2019-10-31 15:34:38 +08:00
};
</script>