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

180 lines
6.6 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>
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')
},
mobile: {
type: 'text',
label: this.$t('global.mobile')
},
prdType: {
type: 'select',
label: this.$t('system.prdType'),
config: {
data: []
}
},
type: {
type: 'select',
label: this.$t('system.simulationType'),
config: {
data: this.$ConstSelect.SimulationType
}
}
}
2019-10-31 15:34:38 +08:00
},
queryList: {
query: getExistingSimulation,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('system.userName'),
prop: 'creator.name'
},
{
title: this.$t('global.mobile'),
prop: 'creator.mobile'
},
{
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.productName'),
prop: 'mapPrdVO.name'
},
{
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'),
prop: 'runAsPlan',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.runAsPlan, 'Whether'); },
tagType: (row) => {
switch (row.runAsPlan) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('system.simulationType'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.$ConstSelect.SimulationType, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.simulationGroupId'),
prop: 'sessionList',
type: 'basicText',
columnValue: (row) => { return this.listJoiningTogether(row.sessionList); }
},
{
type: 'button',
title: this.$t('global.operate'),
buttons: [
{
name: this.$t('system.destory'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
]
},
currentModel: {}
};
},
created() {
this.$Dictionary.productType().then(list => {
list.forEach(elem => {
this.queryForm.queryObject.prdType.config.data.push({ value: elem.code, label: elem.name });
});
});
},
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>