rt-sim-training-client/src/views/publish/publishMap/subsystem.vue

154 lines
4.7 KiB
Vue
Raw Normal View History

2022-10-11 09:55:07 +08:00
<template>
2022-10-12 15:31:15 +08:00
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-subsystem ref="editSubsystem" />
</div>
2022-10-11 09:55:07 +08:00
</template>
<script>
2022-10-12 15:31:15 +08:00
import { queryMapSystemPaged, deleteMapSystem } from '@/api/trainingPlatform';
import { getPublishMapListOnline } from '@/api/jmap/map';
import EditSubsystem from './editSubsystem';
const simTypeMap = {
METRO: '地铁CBTC',
RAILWAY: '大铁CTC',
EMERGENCY: '应急调度'
};
const simUsageMap = {
SINGLE_MEMBER: '单角色仿真',
SINGLE_CLIENT: '单客户端仿真',
JOINT: '综合演练'
};
2022-10-11 09:55:07 +08:00
export default {
2022-10-12 15:31:15 +08:00
name: 'PublishMap',
components: {
EditSubsystem
},
2022-10-11 09:55:07 +08:00
data() {
return {
dialogVisible: false,
2022-10-12 15:31:15 +08:00
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
2022-10-11 09:55:07 +08:00
},
2022-10-12 15:31:15 +08:00
queryForm: {
labelWidth: '80px',
reset: true,
leftSpan: 18,
queryObject: {
name: {
type: 'text',
label: '名称'
}
}
2022-10-11 09:55:07 +08:00
},
2022-10-12 15:31:15 +08:00
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '名称',
prop: 'name'
},
{
title: '地图',
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['id', 'name']); },
tagType: () => { return 'success'; }
},
{
title: '系统',
prop: 'simType',
type: 'tag',
columnValue: (row) => { return simTypeMap[row.simType]; },
tagType: () => { return 'success'; }
},
{
title: '使用方式',
prop: 'simUsage',
type: 'tag',
columnValue: (row) => { return simUsageMap[row.simUsage]; },
tagType: () => { return ''; }
},
{
title: '描述',
prop: 'desc'
},
{
type: 'button',
title: '操作',
width: '300',
buttons: [
{
name: '更新',
handleClick: this.updateRow
},
{
name: '删除',
handleClick: this.deleteRow
}
]
}
2022-10-11 09:55:07 +08:00
],
2022-10-12 15:31:15 +08:00
actions: [
{ text: '新建', handler: this.handleAddSubsystem },
{ text: '返回', handler: this.goBack }
2022-10-11 09:55:07 +08:00
]
2022-10-12 15:31:15 +08:00
}
2022-10-11 09:55:07 +08:00
};
},
2022-10-12 15:31:15 +08:00
computed: {
isShow() {
return this.$store.getters['roles'].indexOf('05');
}
},
created() {
this.mapList = [];
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
});
},
2022-10-11 09:55:07 +08:00
methods: {
2022-10-12 15:31:15 +08:00
queryFunction(params) {
params['mapId'] = this.$route.query.mapId;
return queryMapSystemPaged(params);
2022-10-11 09:55:07 +08:00
},
deleteRow(row) {
this.$confirm('删除子系统,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteMapSystem(row.id).then(resp => {
this.reload();
}).catch(error => {
this.$message.error(`删除子系统: ${error.message}`);
});
}).catch( () => { });
},
2022-10-12 15:31:15 +08:00
updateRow(index, row) {
this.$refs.editSubsystem.doShow(row);
2022-10-11 09:55:07 +08:00
},
2022-10-12 15:31:15 +08:00
handleAddSubsystem() {
this.$refs.editSubsystem.doShow();
},
reloadTable() {
this.queryList.reload();
2022-10-11 09:55:07 +08:00
},
2022-10-12 15:31:15 +08:00
goBack() {
this.$router.go(-1);
2022-10-11 09:55:07 +08:00
}
}
};
</script>
2022-10-12 15:31:15 +08:00
<style lang="scss" scoped>
/deep/
.el-button+.el-button{
margin-top: 5px;
margin-left: 5px;
}
2022-10-11 09:55:07 +08:00
</style>