线路功能分组

This commit is contained in:
fan 2023-01-10 15:40:53 +08:00
parent a2e4f3df9c
commit 0fd4c16d7a
5 changed files with 207 additions and 31 deletions

View File

@ -138,3 +138,11 @@ export function deleteAllMapFunction(mapId) {
method: 'delete'
});
}
/** 新增分组 */
export function updateMapFunctionSubset(data) {
return request({
url: `/api/mapFunction/group`,
method: 'put',
data
});
}

View File

@ -133,6 +133,7 @@ const SimulationPlatform = () => import('@/views/trainingPlatform/simulation');
const PublishMap = () => import('@/views/publish/publishMap/index');
const SubsystemManage = () => import('@/views/publish/publishMap/subsystem');
const SystemSubsetManage = () => import('@/views/publish/publishMap/systemSubset');
const IscsDataManage = () => import('@/views/publish/publishMap/iscsDataManage/index');
const PublishMapDetail = () => import('@/views/publish/publishMap/list'); // 发布历史
const PublishLesson = () => import('@/views/publish/publishLesson/index');
@ -1965,6 +1966,11 @@ export const asyncRouter = [
component: SubsystemManage,
hidden: true
},
{
path: 'systemSubset',
component: SystemSubsetManage,
hidden: true
},
{
path: 'PublishMapDetail',
component: PublishMapDetail,

View File

@ -79,7 +79,7 @@ export default {
queryForm: {
labelWidth: '80px',
reset: true,
leftSpan: 16,
leftSpan: 15,
queryObject: {
name: {
type: 'text',
@ -111,6 +111,10 @@ export default {
columnValue: (row) => { return simTypeMap[row.simType]; },
tagType: () => { return 'success'; }
},
{
title: '分组',
prop: 'subset'
},
// DEFAULT_MEMBER: false,
// LPF: false,
// REAL_DEVICE: false,
@ -174,6 +178,7 @@ export default {
actions: [
{ text: '一键生成', handler: this.generateMapSystem },
{ text: '一键删除', handler: this.deleteAll },
{ text: '功能分组', handler: this.systemSubset },
{ text: '新建', handler: this.handleAddSubsystem },
{ text: '返回', handler: this.goBack }
]
@ -226,6 +231,9 @@ export default {
generateMapSystem() {
this.visible = true;
},
systemSubset() {
this.$router.push({ path:'/systemManagement/lineDataManage/systemSubset', query:{ mapId: this.$route.query.mapId, lineCode: this.$route.query.lineCode }});
},
doCloseGenerate() {
this.form.simTypes = [];
this.visible = false;

View File

@ -0,0 +1,148 @@
<template>
<div style="width: 100%;height: 100%;padding: 50px 30px;">
<el-card style="width: 100%;height: 100%;padding: 20px;">
<el-row>
<el-col :span="4">
<el-card style="width: 100%;height: 100%;padding: 15px;">
<el-checkbox-group v-model="checkList">
<template v-for="item in functionList">
<el-checkbox :key="item.id" :label="item" :disabled="!!item.subset" style="display: block;margin: 5px;">{{ item.name }}</el-checkbox>
</template>
</el-checkbox-group>
</el-card>
</el-col>
<el-col :span="4">
<div style="width: 100%;height: 100%;text-align: center;padding: 15px;">
<div>分组按钮</div>
<div style="display: flex; flex-direction: column-reverse;align-items: center;">
<template v-for="item in subsetList">
<el-button :key="item" type="primary" style="width: 120px;margin: 5px;" @click="handleSubset(item)">{{ `分组至${item}` }}</el-button>
</template>
</div>
</div>
</el-col>
<el-col :span="16">
<div style="text-align: left;margin-bottom: 10px;">
<el-input v-model="subset" placeholder="请输入内容" style="width: 400px">
<el-button slot="append" @click="addSubset">添加分组</el-button>
</el-input>
</div>
<div style="display: flex;">
<template v-for="item in subsetList">
<el-card :key="item" class="box-card">
<div slot="header" class="clearfix">
<span>{{ item }}</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="removeSubset(item)">删除分组</el-button>
</div>
<div>
<el-tag v-for="elem in subsetMap[item]" :key="elem.id" style="margin: 5px;" closable @close="deleteFunction(elem, item)">
{{ elem.name }}
</el-tag>
</div>
</el-card>
</template>
</div>
</el-col>
</el-row>
<el-row style="text-align: center;margin-top: 10px;">
<el-button type="primary" @click="update">更新</el-button>
<el-button @click="goBack">返回</el-button>
</el-row>
</el-card>
</div>
</template>
<script>
import { queryMapFunctionList, updateMapFunctionSubset } from '@/api/trainingPlatform';
export default {
name: 'SystemSubset',
data() {
return {
functionList: [],
checkList: [],
subsetList: [],
subsetMap: {},
subset: ''
};
},
mounted() {
queryMapFunctionList({mapId: this.$route.query.mapId}).then(resp => {
this.functionList = resp.data;
this.functionList.forEach(item => {
if (item.subset && this.subsetList.includes(item.subset)) {
this.subsetMap[item.subset].push(item);
} else if (item.subset) {
this.subsetList.push(item.subset);
this.subsetMap[item.subset] = [item];
}
});
}).catch(() => {
this.$message.error('获取地图功能列表失败!');
});
},
methods: {
handleSubset(subset) {
this.checkList.forEach(item => {
this.$set(item, 'subset', subset);
this.subsetMap[subset].push(item);
});
this.checkList = [];
console.log(this.subsetMap, this.functionList);
},
removeSubset(subset) {
this.subsetMap[subset].forEach(item => {
this.$set(item, 'subset', '');
});
delete this.subsetMap[subset];
const index = this.subsetList.findIndex(elem => elem === subset);
this.subsetList.splice(index, 1);
},
deleteFunction(functionItem, subset) {
this.$set(functionItem, 'subset', '');
const index = this.subsetMap[subset].findIndex(elem => elem.id === functionItem.id);
this.subsetMap[subset].splice(index, 1);
},
addSubset() {
if (this.subset) {
this.subsetList.push(this.subset);
this.subsetMap[this.subset] = [];
this.subset = '';
}
},
update() {
const data = {};
this.subsetList.forEach(item => {
data[item] = [];
this.subsetMap[item].forEach(elem => {
data[item].push(elem.id);
});
});
updateMapFunctionSubset(data).then(resp => {
this.$message.success('更新线路功能成功!');
}).catch(() => {
this.$message.error('更新线路功能失败!');
});
},
goBack() {
this.$router.go(-1);
}
}
};
</script>
<style scoped>
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 350px;
height: 200px;
margin: 5px;
}
</style>

View File

@ -1,17 +1,23 @@
<template>
<div style="height: 100%;width: 100%;">
<div style="height: 100%;width: 100%;padding-bottom: 20px;">
<div style="height: 50px;text-align: center;line-height: 50px;font-size: 26px;font-weight: bolder;">{{ mapName }}</div>
<el-tabs v-model="activeName" style="height: calc(100% - 30px);margin: 0 10px;" type="border-card">
<el-tab-pane label="功能" name="first" style="height: 100%;">
<div style="display: flex;flex-wrap:wrap; justify-content:center;height: 100%;overflow-y: auto;padding-bottom:30px">
<template>
<el-card v-for="system in systemList" :key="system.id" class="box-card">
<div style="text-align: center;font-size: 26px;font-weight: bolder;color: #0C161A;">{{ system.name }}</div>
<div style="font-size: 14px;color: #0C161A;text-indent: 28px;margin-top: 20px;">{{ system.desc }}</div>
<el-button style="position: absolute;bottom: 15px;left: 0;right: 0;margin: 0 auto;width: 60px;" size="small" type="primary" @click="enterSimulation(system)">进入</el-button>
</el-card>
<el-collapse v-model="collapse" accordion>
<template v-for="item in subsetList">
<el-collapse-item :key="item" :title="item" :name="item" class="function-box">
<div style="display: flex;flex-wrap:wrap; justify-content:center;max-height: 520px;overflow-y: auto;padding-bottom:30px">
<template>
<el-card v-for="system in subsetMap[item]" :key="system.id" class="box-card">
<div style="text-align: center;font-size: 26px;font-weight: bolder;color: #0C161A;">{{ system.name }}</div>
<div style="font-size: 14px;color: #0C161A;text-indent: 28px;margin-top: 20px;">{{ system.desc }}</div>
<el-button style="position: absolute;bottom: 15px;left: 0;right: 0;margin: 0 auto;width: 60px;" size="small" type="primary" @click="enterSimulation(system)">进入</el-button>
</el-card>
</template>
</div>
</el-collapse-item>
</template>
</div>
</el-collapse>
</el-tab-pane>
<el-tab-pane label="联机" name="second">
<el-form ref="ruleForm" v-loading="loading" :model="ruleForm" :rules="rules" label-width="100px">
@ -42,7 +48,6 @@ import { launchFullscreen } from '@/utils/screen';
import { createSimulation } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth';
import { jointSimulationByPermission } from '@/api/jointSimulation';
// import { EventBus } from '@/scripts/event-bus';
export default {
name: 'Simulation',
components: {
@ -52,13 +57,14 @@ export default {
return {
loading: false,
param: '',
// mapName: '',
collapse: '1',
subsetList: [],
subsetMap: {},
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts', 'hlsdrts', 'designhlsdrts', 'teaching', 'designteaching'],
activeName: 'first',
WhetherTypeList: [],
activeNames: ['1', '2'],
systemList: [],
// mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -208,17 +214,12 @@ export default {
watch: {
'$route.params.mapId': function (val) {
this.$refs.queryListPage.refresh(true);
this.subsetList = [];
this.subsetMap = {};
this.initMapSystem(true);
}
},
mounted() {
// EventBus.$on('setMapList', (mapList) => {
// this.mapList = mapList;
// const map = this.mapList.find(map => map.id === this.$route.params.mapId);
// if (map) {
// this.mapName = map.name;
// }
// });
this.loadInitData();
this.initMapSystem();
},
@ -234,13 +235,24 @@ export default {
this.$refs.selectRole.doShow(row.id);
},
initMapSystem() {
// const map = this.mapList.find(map => map.id === this.$route.params.mapId);
// if (map) {
// this.mapName = map.name;
// }
queryMapFunctionList({mapId: this.$route.params.mapId}).then(resp => {
this.systemList = resp.data;
console.log(resp);
this.systemList.forEach(item => {
if (item.subset && this.subsetList.includes(item.subset)) {
this.subsetMap[item.subset].push(item);
} else if (item.subset) {
this.subsetList.push(item.subset);
this.subsetMap[item.subset] = [item];
} else {
if (!this.subsetList.includes('默认')) {
this.subsetList.push('默认');
this.subsetMap['默认'] = [];
console.log('***/');
}
this.subsetMap['默认'].push(item);
}
});
this.collapse = this.subsetList[0];
}).catch(() => {
this.$message.error('获取地图子系统列表失败!');
});
@ -325,10 +337,4 @@ export default {
margin: 20px;
position: relative;
}
/deep/ {
.el-tabs__content {
height: 100%;
}
}
</style>