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

181 lines
6.8 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" />
</div>
</template>
<script>
2019-12-27 19:36:29 +08:00
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
2019-10-31 15:34:38 +08:00
import { getExistingSimulation, deleteExistingSimulation } from '@/api/simulation';
export default {
name: 'SimulationManage',
components: {
},
data() {
return {
examResultList: [],
LessonList: [],
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '130px',
reset: true,
queryObject: {
group: {
type: 'text',
label: this.$t('system.simulationGroup')
},
userName: {
type: 'text',
label: this.$t('system.userName')
},
prdType: {
type: 'select',
label: this.$t('system.prdType'),
config: {
data: []
}
}
}
2019-10-31 15:34:38 +08:00
},
simulationTypeList: [{label: '仿真', value: 'SIMULATION'}, {label: '课程', value: 'LESSON'}, {label: '考试', value: 'EXAM'}, {label: '剧本编制', value: 'SCRIPT_MAKING'}],
queryList: {
query: getExistingSimulation,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('system.userName'),
prop: 'creator.name'
},
{
2020-03-24 09:23:24 +08:00
title: this.$t('system.mapName'),
prop: 'map.name'
},
{
title: 'Group',
prop: 'group'
},
{
title: this.$t('system.isError'),
prop: 'error',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.error, 'Whether'); },
tagType: (row) => {
switch (row.error) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('system.isSuspend'),
prop: 'pause',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.pause, 'Whether'); },
tagType: (row) => {
switch (row.pause) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('system.isDrivingAsplanned'),
2020-03-24 09:23:24 +08:00
prop: 'planRunning',
type: 'tag',
2020-03-24 09:23:24 +08:00
columnValue: (row) => { return this.$ConstSelect.translate(row.planRunning, 'Whether'); },
tagType: (row) => {
switch (row.runAsPlan) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: '类型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.simulationTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
2020-03-24 09:23:24 +08:00
title: this.$t('system.prdType'),
prop: 'prodType',
type: 'tag',
2020-03-24 09:23:24 +08:00
columnValue: (row) => { return this.$convertField(row.prodType, this.prdTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('system.simulationGroupId'),
2020-03-24 09:23:24 +08:00
prop: 'onlineUserIdList',
type: 'basicText',
2020-03-24 09:23:24 +08:00
columnValue: (row) => { return this.listJoiningTogether(row.onlineUserIdList); }
},
{
type: 'button',
title: this.$t('global.operate'),
buttons: [
{
name: this.$t('system.destory'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
]
},
currentModel: {}
};
},
2019-12-27 19:36:29 +08:00
computed:{
prdTypeList() {
const productTypeList = ConstConfig.ConstSelect.prdType;
return Cookies.get('user_lang') == 'en'
? productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
: productTypeList.map(elem => { return { value: elem.value, label: elem.label }; });
}
},
created() {
2019-12-27 19:36:29 +08:00
this.queryForm.queryObject.prdType.config.data = this.prdTypeList;
},
methods: {
listJoiningTogether(sessionList) {
let sessionId = '';
if (sessionList.length > 0) {
sessionList.forEach((item) => {
sessionId = sessionId + item + ',';
});
sessionId = sessionId.substring(0, sessionId.length - 1);
}
return sessionId;
},
handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelUserSimulation'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteExistingSimulation(row.group).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>