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 {
|
2019-11-05 19:03:20 +08:00
|
|
|
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
|
|
|
|
2019-11-05 19:03:20 +08:00
|
|
|
},
|
|
|
|
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'
|
2019-11-05 19:03:20 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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',
|
2019-11-05 19:03:20 +08:00
|
|
|
type: 'tag',
|
2020-03-24 09:23:24 +08:00
|
|
|
columnValue: (row) => { return this.$ConstSelect.translate(row.planRunning, 'Whether'); },
|
2019-11-05 19:03:20 +08:00
|
|
|
tagType: (row) => {
|
|
|
|
switch (row.runAsPlan) {
|
|
|
|
case true: return 'success';
|
|
|
|
case false: return 'danger';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2020-03-24 09:23:24 +08:00
|
|
|
title: this.$t('system.prdType'),
|
|
|
|
prop: 'prodType',
|
2019-11-05 19:03:20 +08:00
|
|
|
type: 'tag',
|
2020-03-24 09:23:24 +08:00
|
|
|
columnValue: (row) => { return this.$convertField(row.prodType, this.prdTypeList, ['value', 'label']); },
|
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
|
2019-11-05 19:03:20 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('system.simulationGroupId'),
|
2020-03-24 09:23:24 +08:00
|
|
|
prop: 'onlineUserIdList',
|
2019-11-05 19:03:20 +08:00
|
|
|
type: 'basicText',
|
2020-03-24 09:23:24 +08:00
|
|
|
columnValue: (row) => { return this.listJoiningTogether(row.onlineUserIdList); }
|
2019-11-05 19:03:20 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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 }; });
|
|
|
|
}
|
|
|
|
},
|
2019-11-05 19:03:20 +08:00
|
|
|
created() {
|
2019-12-27 19:36:29 +08:00
|
|
|
this.queryForm.queryObject.prdType.config.data = this.prdTypeList;
|
2019-11-05 19:03:20 +08:00
|
|
|
},
|
|
|
|
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>
|
|
|
|
|