代码调整

This commit is contained in:
fan 2022-10-12 15:31:15 +08:00
parent b8ab34b766
commit 8461e49e59
15 changed files with 718 additions and 326 deletions

View File

@ -106,3 +106,11 @@ export function deleteMapSystem(id) {
method: 'delete'
});
}
/** 分页查询地图系统 */
export function queryMapSystemPaged(params) {
return request({
url: `/api/mapSystem/new/paged`,
method: 'get',
params
});
}

View File

@ -40,5 +40,6 @@ export default {
userRulesManage: 'User Rights Statistics',
fileManage: 'File Manage',
frontResourceManage: 'Front-end Resource Management',
iscsPrerecordManage: 'ISCS Advance record management'
iscsPrerecordManage: 'ISCS Advance record management',
subsystemManage: 'Subsystem Manage'
};

View File

@ -40,5 +40,6 @@ export default {
userRulesManage: '用户权限管理',
fileManage: '文件管理',
frontResourceManage: '前端资源管理',
iscsPrerecordManage: 'ISCS预录管理'
iscsPrerecordManage: 'ISCS预录管理',
subsystemManage: '子系统管理'
};

View File

@ -63,7 +63,7 @@ function handleRoute(to, next, loginPath) {
// 除没有动态改变权限的需求可直接next() 删下方权限判断
if (to.path === '/404' && to.redirectedFrom === '/') {
const project = getSessionStorage('project');
console.log(localStore.get('trainingPlatformRoute' + store.getters.id + project, '-------------'));
console.log(localStore.get('trainingPlatformRoute' + store.getters.id + project, '-------------'));
next(localStore.get('trainingPlatformRoute' + store.getters.id + project) || '/trainingPlatform');
} else {
next();

View File

@ -132,9 +132,10 @@ const MapPreviewNew = () => import('@/views/designPlatform/mapPreviewNew');
const BigScreen = () => import('@/views/designPlatform/bigScreen');
const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen');
const Package = () => import('@/views/package/index');
const SimulationPlatform = () => import('@/views/trainingPlatform/simulation');
const PublishMap = () => import('@/views/publish/publishMap/index');
const SubsystemManage = () => import('@/views/publish/publishMap/subsystem');
const PublishMapDetail = () => import('@/views/publish/publishMap/list'); // 发布历史
const PublishLesson = () => import('@/views/publish/publishLesson/index');
const RunPlanTemplate = () => import('@/views/publish/runPlanTemplate/index');
@ -919,9 +920,9 @@ export const asyncRouter = [
component: ExamResult,
hidden: true
},
{ // 线路权限列表
path: 'permission/:mapId',
component: Package,
{
path: 'simulation/:mapId',
component: SimulationPlatform,
hidden: true
},
{ // 二级home页面
@ -1775,6 +1776,14 @@ export const asyncRouter = [
meta: {
i18n: 'newRouter.linePacketManage'
}
},
{
path: 'subsystem',
component: SubsystemManage,
hidden: true,
meta: {
i18n: 'newRouter.subsystemManage'
}
}
]
},

View File

@ -129,7 +129,7 @@ class MenuContextHandler {
}
covertList(list) {
const menu = [...list];
let menu = [...list];
const selected = this.getCurrentStateObject();
const control = this.getStationControl(selected);
if (control && !store.state.scriptRecord.audioPlay) {

View File

@ -101,7 +101,6 @@ export default {
try {
let res;
try {
debugger;
res = await getPublishMapInfo(this.mapId);
} catch (error) {
if (error.code == 30001 || error.code == 10007) {

View File

@ -0,0 +1,258 @@
<template>
<el-dialog width="80%" :title="innerTitle" :visible.sync="innerVisible" center append-to-body>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 98%;margin-left:1%;margin-top:20px;" />
</el-dialog>
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import { pageQueryTrainingNew } from '@/api/jmap/training';
import { getPublishMapListOnline } from '@/api/jmap/map';
import { getCmdList } from '@/api/management/dictionary';
import { getTrainingOperateTypeMap } from '@/scripts/ConstDic';
export default {
name: 'TrainingGeneration',
components: {
},
data() {
return {
innerVisible: false,
innerTitle: '实训选择',
mapIdList: [],
trainingTypeList: [],
trainingOperateTypeMap: {
Switch: [],
Section: [],
Signal: [],
Stand: [],
Station: [],
ControlConvertMenu: [],
LimitControl: [],
TrainWindow: []
},
trainingTypeMap: {},
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
initLoadCallback: this.initForm,
queryObject: {
prdType: {
type: 'select',
label: this.$t('lesson.prdType'),
change: this.prdChoose,
config: {
data: []
}
},
type: {
type: 'select',
label: this.$t('lesson.trainingType'),
change: this.typeChoose,
config: {
data: []
}
},
operateType: {
type: 'select',
label: this.$t('lesson.operationType'),
config: {
data: []
}
},
name: {
type: 'text',
label: this.$t('lesson.trainingName')
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.trainingName'),
prop: 'name'
},
{
title: this.$t('lesson.prdType'),
prop: 'prdType',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.prdType, this.prdTypeList, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.trainingType'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.trainingTypeList, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.operationType'),
prop: 'operateType',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.minDuration'),
prop: 'minDuration'
},
{
title: this.$t('lesson.maxDuration'),
prop: 'maxDuration'
},
{
title: this.$t('lesson.remarks'),
prop: 'remarks'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: '选中',
handleClick: this.chooseTraining,
type: ''
}
]
}
],
actions: []
},
currentModel: {}
};
},
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 }; });
}
},
async created() {
await this.loadInitData();
this.typeChoose();
},
mounted() {
},
beforeDestroy() {
},
methods: {
doShow() {
this.innerVisible = true;
},
async loadInitData() {
this.mapIdList = [];
this.queryForm.queryObject.prdType.config.data = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
this.queryForm.queryObject.prdType.config.data = this.prdTypeList;
this.trainingOperateTypeMap = getTrainingOperateTypeMap();
},
chooseTraining(index, row) {
this.$emit('choose', row);
this.innerVisible = false;
},
async initForm(form) {
if (form) {
await this.prdChoose(form, false);
await this.typeChoose(form, false);
}
},
async prdChoose(form, isClean = true) {
console.log('-------------');
this.trainingTypeMap = {};
const lineCode = this.$route.query.lineCode;
const res = await getCmdList(lineCode, {prdType:form.prdType});
const trainingOperateList = [];
const trainingOperateConfigList = [];
const operateTypeMap = {
Switch: [],
Section: [],
Signal: [],
Stand: [],
Station: [],
ControlConvertMenu: [],
LimitControl: [],
TrainWindow: [],
Driver: []
};
if (isClean) {
form.type = '';
form.operateType = '';
}
this.queryForm.queryObject.type.config.data = [];
this.queryForm.queryObject.operateType.config.data = [];
if (res && res.code === 200) {
res.data.forEach(item => {
if (this.trainingOperateTypeMap[item.operateObject]) {
this.trainingOperateTypeMap[item.operateObject].forEach(ele => {
if (ele.value == item.operate && !this.checkIncludes(operateTypeMap[item.operateObject], ele)) {
operateTypeMap[item.operateObject].push(ele);
}
});
}
if (!trainingOperateList.includes(item.operateObject)) {
trainingOperateList.push(item.operateObject);
const objectLabel = ConstConfig.ConstSelect.trainingDeviceType[item.operateObject] || {};
trainingOperateConfigList.push({value: item.operateObject, label: Cookies.get('user_lang') == 'en' ? objectLabel.enlabel : objectLabel.label});
}
});
this.queryForm.queryObject.type.config.data = trainingOperateConfigList;
this.trainingTypeList = trainingOperateConfigList;
this.trainingTypeMap = operateTypeMap;
} else {
this.$message.error(this.$t('error.failedToObtainTrainingType'));
}
},
async typeChoose(form, isClean = true) {
this.queryForm.queryObject.operateType.config.data = [];
if (isClean && form) {
form.operateType = '';
}
if (form && form.type && this.trainingTypeMap[form.type]) {
this.trainingTypeMap[form.type].forEach(elem => {
this.queryForm.queryObject.operateType.config.data.push({ value: elem.value, label: elem.label });
});
}
},
checkIncludes(list, obj) {
let flag = false;
list.forEach(item => {
if (item.value === obj.value) {
flag = true;
}
});
return flag;
},
reloadTable() {
this.queryList.reload();
},
queryFunction(params) {
params['mapId'] = this.$route.query.mapId;
return pageQueryTrainingNew(params);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -0,0 +1,257 @@
<template>
<el-dialog
width="30%"
:title="title"
:visible.sync="visible"
center
>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
<el-form-item label="子系统名称:" prop="name">
<el-input v-model="ruleForm.name" style="width: 200px;" />
</el-form-item>
<el-form-item label="系统:" prop="type">
<el-select v-model="ruleForm.type" placeholder="请选择类型">
<el-option label="地铁CBTC" value="METRO" />
<el-option label="大铁CTC" value="RAILWAY" />
<el-option label="应急调度" value="EMERGENCY" />
</el-select>
</el-form-item>
<el-form-item label="使用方式:" prop="usage">
<el-select v-model="ruleForm.usage" placeholder="请选择使用方式">
<el-option label="单角色仿真" value="SINGLE_MEMBER" />
<el-option label="单客户端仿真" value="SINGLE_CLIENT" />
<el-option label="综合演练" value="JOINT" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.usage === 'SINGLE_MEMBER' || ruleForm.usage === 'JOINT'" label="角色:" prop="memberType">
<el-select v-model="ruleForm.memberType" placeholder="请选择角色">
<el-option v-for="option in roleList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item v-if="stationRoles.includes(ruleForm.memberType)" label="车站:" prop="deviceCode">
<el-select v-model="ruleForm.deviceCode" placeholder="请选择设备">
<el-option v-for="option in stationList" :key="option.code" :label="option.name" :value="option.code" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.memberType === 'DRIVER'" label="列车:" prop="deviceCode">
<el-select v-model="ruleForm.deviceCode" placeholder="请选择设备">
<el-option v-for="option in trainList" :key="option.code" :label="option.code" :value="option.code" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.usage === 'SINGLE_CLIENT'" label="客户端:" prop="client">
<el-select v-model="ruleForm.client" placeholder="请选择使用客户端">
<el-option label="联锁" value="INTERLOCK" />
<el-option label="大屏" value="BIG_SCREEN" />
<el-option label="综合监控" value="ISCS" />
</el-select>
</el-form-item>
<el-form-item label="功能:" prop="function">
<el-select v-model="ruleForm.function" placeholder="请选择功能">
<el-option label="大客流" value="LPF" />
<el-option label="实训室" value="TRAINING_ROOM" />
<el-option label="实训设计" value="TRAINING_DESIGN" />
<el-option label="实训" value="TRAINING" />
<el-option label="考试" value="EXAM" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.function === 'TRAINING'" label="实训:" prop="trainingName">
<div style="display: flex;">
<div style="width: 200px;">{{ ruleForm.trainingName? ruleForm.trainingName: '-' }}</div>
<el-button style="margin-left: 10px;" type="primary" size="mini" @click="handleChoose">选择</el-button>
</div>
</el-form-item>
<el-form-item label="描述:" prop="desc">
<el-input
v-model="ruleForm.desc"
type="textarea"
:rows="2"
placeholder="请输入内容"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="commit"> </el-button>
</span>
<choose-training ref="chooseTraining" @choose="choose" />
</el-dialog>
</template>
<script>
import { updateMapSystem, createMapSystem } from '@/api/trainingPlatform';
import { getStationListNeedAttendant } from '@/api/jmap/map';
import ChooseTraining from './chooseTraining';
export default {
name: 'EditSubsystem',
components: {
ChooseTraining
},
data() {
return {
visible: false,
title: '',
mapSystemId: '',
mapId: '',
stationList: [],
trainList: [],
stationRoles: ['STATION_SUPERVISOR', 'STATION_ASSISTANT', 'STATION_MASTER', 'STATION_SIGNALER', 'STATION_PASSENGER', 'STATION_SWITCH_MAN',
'STATION_FACILITATOR', 'STATION_WORKER', 'TRAIN_MASTER'],
rules: {
name: [
{ required: true, message: '请输入子系统名称', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择子系统类型', trigger: 'change' }
],
usage: [
{ required: true, message: '请选择使用方式', trigger: 'change' }
]
},
roleList: [
{label: '行调', value: 'DISPATCHER'},
{label: '行值', value: 'STATION_SUPERVISOR'},
{label: '司机', value: 'DRIVER'},
{label: '通号', value: 'MAINTAINER'},
{label: '车辆段信号楼', value: 'DEPOT_DISPATCHER'},
{label: '停车场信号楼', value: 'PARKING_LOT_SIGNAL_BUILDING'},
{label: '车站助理', value: 'STATION_ASSISTANT'},
{label: '车站站长', value: 'STATION_MASTER'},
{label: '车站信号员', value: 'STATION_SIGNALER'},
{label: '车站客运员', value: 'STATION_PASSENGER'},
{label: '车站扳道员', value: 'STATION_SWITCH_MAN'},
{label: '车站引导员', value: 'STATION_FACILITATOR'},
{label: '车站工务工', value: 'STATION_WORKER'},
{label: '车务段段长', value: 'TRAIN_MASTER'}
],
ruleForm: {
name: '',
type: '',
usage: '',
memberType: '',
deviceCode: '',
client: '',
function: '',
trainingId: '',
trainingName: ''
},
clientList: [
{ label: '中心ATS工作站', value: 'C_ATS' },
{ label: '中心ATS大屏', value: 'C_ATS_BS' },
{ label: '中心PA系统', value: 'C_PA' },
{ label: '中心视频监控系统', value: 'C_CCTV' },
{ label: '现地ATS工作站', value: 'L_ATS' },
{ label: '本地控制工作站', value: 'LCW' },
{ label: '现地视频监控系统', value: 'L_CCTV' },
{ label: '现地PA系统', value: 'L_PA' },
{ label: '调度台终端', value: 'GPC' },
{ label: '联锁工作站', value: 'IPC' },
{ label: '车务终端', value: 'STPC' },
{ label: '车务管理终端', value: 'DMP' }
]
};
},
mounted() {
this.stationList = [];
getStationListNeedAttendant(this.$route.query.mapId).then(resp => {
if (resp.data && resp.data.length) {
this.stationList = resp.data;
}
}).catch(() => {
this.$message.error('获取车站列表失败');
});
},
methods: {
doShow(row) {
if (row && row.id) {
this.mapSystemId = row.id;
this.ruleForm.name = row.name;
this.ruleForm.desc = row.desc;
this.ruleForm.type = row.paramVO.type;
this.ruleForm.usage = row.paramVO.usageInfo.usage;
this.ruleForm.client = row.paramVO.usageInfo.param.client;
this.ruleForm.memberType = row.paramVO.usageInfo.param.memberType;
this.ruleForm.deviceCode = row.paramVO.usageInfo.param.deviceCode;
const functionList = Object.keys(row.paramVO.functionMap);
if (functionList && functionList.length) {
this.ruleForm.function = functionList[0];
}
this.title = '子系统修改';
} else {
this.title = '子系统创建';
}
this.visible = true;
},
close() {
this.mapSystemId = '';
this.ruleForm = {
name: '',
type: '',
usage: '',
memberType: '',
deviceCode: '',
client: '',
function: '',
trainingId: '',
trainingName: ''
};
this.visible = false;
this.$refs.ruleForm.resetFields();
},
commit() {
const functionMap = {};
if (this.ruleForm.function) {
functionMap[this.ruleForm.function] = this.ruleForm.function;
}
const data = {
mapId: this.mapId,
name: this.ruleForm.name,
desc: this.ruleForm.desc,
paramVO: {
type: this.ruleForm.type,
usageInfo: {
usage: this.ruleForm.usage,
param: {
client: this.ruleForm.client,
memberType: this.ruleForm.memberType,
deviceCode: this.ruleForm.deviceCode
}
},
functionMap: functionMap
}
};
if (this.innerTitle === '创建子系统') {
createMapSystem(data).then(resp => {
this.visible = false;
this.$emit('tableReload');
this.$message.success('创建子系统成功!');
this.close();
}).catch(() => {
this.$message.error('创建子系统失败!');
});
} else {
data.id = this.mapSystemId;
updateMapSystem(data).then(resp => {
this.visible = false;
this.$emit('tableReload');
this.close();
this.$message.success('修改子系统成功!');
}).catch(() => {
this.$message.error('修改子系统失败!');
});
}
},
handleChoose() {
this.$refs.chooseTraining.doShow();
},
choose(data) {
this.ruleForm.trainingId = data.id;
this.ruleForm.trainingName = data.name;
}
}
};
</script>
<style scoped>
</style>

View File

@ -7,7 +7,6 @@
<local-map ref="localMap" />
<export-map ref="exportMap" />
<map-sort ref="mapSort" />
<subsystem-manage ref="subsystemManage" />
<!--<input ref="files" type="file" class="file_box" accept=".json, application/json" style="display: none" @change="importf">-->
<el-dialog
title="一键领取权限"
@ -40,7 +39,6 @@ import MapSort from './mapSort';
import { superAdmin } from '@/router/index';
import { ProjectList } from '@/scripts/ProjectConfig';
import { getPermissionQuickly } from '@/api/management/author';
import SubsystemManage from './subsystem';
export default {
name: 'PublishMap',
@ -50,8 +48,7 @@ export default {
CopyMap,
LocalMap,
ExportMap,
MapSort,
SubsystemManage
MapSort
},
data() {
return {
@ -474,7 +471,7 @@ export default {
this.dialogVisible = true;
},
subsystemManage(index, row) {
this.$refs.subsystemManage.doShow(row);
this.$router.push({path:'/system/lineDataManage/subsystem', query: {mapId: row.id, lineCode: row.lineCode}});
},
permissionCommit() {
getPermissionQuickly(this.mapId, this.permissionNum).then(resp => {

View File

@ -1,201 +1,120 @@
<template>
<el-dialog
title="子系统管理"
:visible.sync="dialogVisible"
width="60%"
center
>
<el-button type="primary" size="small" style="position: relative;left: 90%;margin-bottom: 10px;" @click="handleAddSubsystem">新增</el-button>
<el-table v-loading="loading" :data="tableData" border style="width: 100%">
<el-table-column prop="name" label="名称" />
<el-table-column prop="simType" label="类型">
<template slot-scope="scope">
<span>{{ simTypeMap[scope.row.simType] }}</span>
</template>
</el-table-column>
<el-table-column prop="simUsage" label="使用方式">
<template slot-scope="scope">
<span>{{ simUsageMap[scope.row.simUsage] }}</span>
</template>
</el-table-column>
<el-table-column prop="desc" label="描述" width="400px" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="updateRow(scope.row)">更新</el-button>
<el-button type="text" size="small" @click="deleteRow(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
width="30%"
:title="innerTitle"
:visible.sync="innerVisible"
center
append-to-body
>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
<el-form-item label="子系统名称:" prop="name">
<el-input v-model="ruleForm.name" style="width: 200px;" />
</el-form-item>
<el-form-item label="类型:" prop="type">
<el-select v-model="ruleForm.type" placeholder="请选择类型">
<el-option label="地铁" value="METRO" />
<el-option label="铁路/大铁" value="RAILWAY" />
<el-option label="应急调度" value="EMERGENCY" />
</el-select>
</el-form-item>
<el-form-item label="使用方式:" prop="usage">
<el-select v-model="ruleForm.usage" placeholder="请选择使用方式">
<el-option label="单角色仿真" value="SINGLE_MEMBER" />
<el-option label="单客户端仿真" value="SINGLE_CLIENT" />
<el-option label="综合演练" value="JOINT" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.usage === 'SINGLE_MEMBER' || ruleForm.usage === 'JOINT'" label="角色:" prop="memberType">
<el-select v-model="ruleForm.memberType" placeholder="请选择角色">
<el-option v-for="option in roleList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item v-if="stationRoles.includes(ruleForm.memberType)" label="车站:" prop="deviceCode">
<el-select v-model="ruleForm.deviceCode" placeholder="请选择设备">
<el-option v-for="option in stationList" :key="option.code" :label="option.name" :value="option.code" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.memberType === 'DRIVER'" label="列车:" prop="deviceCode">
<el-select v-model="ruleForm.deviceCode" placeholder="请选择设备">
<el-option v-for="option in trainList" :key="option.code" :label="option.code" :value="option.code" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.usage === 'SINGLE_CLIENT'" label="客户端:" prop="client">
<el-select v-model="ruleForm.client" placeholder="请选择使用客户端">
<el-option label="联锁" value="INTERLOCK" />
<el-option label="大屏" value="BIG_SCREEN" />
<el-option label="综合监控" value="ISCS" />
</el-select>
</el-form-item>
<el-form-item label="功能:" prop="function">
<el-select v-model="ruleForm.function" placeholder="请选择功能">
<el-option label="大客流" value="LPF" />
</el-select>
</el-form-item>
<el-form-item label="描述:" prop="desc">
<el-input
v-model="ruleForm.desc"
type="textarea"
:rows="2"
placeholder="请输入内容"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeInner"> </el-button>
<el-button type="primary" @click="commit"> </el-button>
</span>
</el-dialog>
</el-dialog>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-subsystem ref="editSubsystem" />
</div>
</template>
<script>
import { getStationListNeedAttendant } from '@/api/jmap/map';
import { queryMapSystemList, updateMapSystem, createMapSystem, deleteMapSystem } from '@/api/trainingPlatform';
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: '综合演练'
};
export default {
name: 'Subsystem',
name: 'PublishMap',
components: {
EditSubsystem
},
data() {
return {
dialogVisible: false,
tableData: [],
mapId: '',
loading: false,
innerVisible: false,
mapSystemId: '',
stationList: [],
trainList: [],
innerTitle: '',
ruleForm: {
name: '',
type: '',
usage: '',
memberType: '',
deviceCode: '',
client: '',
function: ''
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
simTypeMap: {
METRO: '地铁',
RAILWAY: '铁路/大铁',
EMERGENCY: '应急调度'
queryForm: {
labelWidth: '80px',
reset: true,
leftSpan: 18,
queryObject: {
name: {
type: 'text',
label: '名称'
}
}
},
simUsageMap: {
SINGLE_MEMBER: '单角色仿真',
SINGLE_CLIENT: '单客户端仿真',
JOINT: '综合演练'
},
stationRoles: ['STATION_SUPERVISOR', 'STATION_ASSISTANT', 'STATION_MASTER', 'STATION_SIGNALER', 'STATION_PASSENGER', 'STATION_SWITCH_MAN',
'STATION_FACILITATOR', 'STATION_WORKER', 'TRAIN_MASTER'],
rules: {
name: [
{ required: true, message: '请输入子系统名称', trigger: 'blur' }
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
}
]
}
],
type: [
{ required: true, message: '请选择子系统类型', trigger: 'change' }
],
usage: [
{ required: true, message: '请选择使用方式', trigger: 'change' }
actions: [
{ text: '新建', handler: this.handleAddSubsystem },
{ text: '返回', handler: this.goBack }
]
},
roleList: [
{label: '行调', value: 'DISPATCHER'},
{label: '行值', value: 'STATION_SUPERVISOR'},
{label: '司机', value: 'DRIVER'},
{label: '通号', value: 'MAINTAINER'},
{label: '车辆段信号楼', value: 'DEPOT_DISPATCHER'},
{label: '停车场信号楼', value: 'PARKING_LOT_SIGNAL_BUILDING'},
{label: '车站助理', value: 'STATION_ASSISTANT'},
{label: '车站站长', value: 'STATION_MASTER'},
{label: '车站信号员', value: 'STATION_SIGNALER'},
{label: '车站客运员', value: 'STATION_PASSENGER'},
{label: '车站扳道员', value: 'STATION_SWITCH_MAN'},
{label: '车站引导员', value: 'STATION_FACILITATOR'},
{label: '车站工务工', value: 'STATION_WORKER'},
{label: '车务段段长', value: 'TRAIN_MASTER'}
]
}
};
},
computed: {
isShow() {
return this.$store.getters['roles'].indexOf('05');
}
},
created() {
this.mapList = [];
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
});
},
methods: {
handleAddSubsystem() {
this.innerTitle = '创建子系统';
this.innerVisible = true;
},
doShow(data) {
if (data && data.id) {
this.mapId = data.id;
this.stationList = [];
getStationListNeedAttendant(data.id).then(resp => {
if (resp.data && resp.data.length) {
this.stationList = resp.data;
}
}).catch(() => {
this.$message.error('获取车站列表失败');
});
this.reload();
this.dialogVisible = true;
}
},
reload() {
this.loading = true;
this.tableData = [];
queryMapSystemList({mapId: this.mapId}).then(resp => {
if (resp.data && resp.data.length) {
this.tableData = resp.data;
}
this.loading = false;
}).catch(() => {
this.loading = false;
this.$message.error('获取地图系统列表!');
});
},
doClose() {
this.dialogVisible = false;
queryFunction(params) {
params['mapId'] = this.$route.query.mapId;
return queryMapSystemPaged(params);
},
deleteRow(row) {
this.$confirm('删除子系统,是否继续?', '提 示', {
@ -210,83 +129,25 @@ export default {
});
}).catch( () => { });
},
updateRow(row) {
this.mapSystemId = row.id;
this.ruleForm.name = row.name;
this.ruleForm.desc = row.desc;
this.ruleForm.type = row.paramVO.type;
this.ruleForm.usage = row.paramVO.usageInfo.usage;
this.ruleForm.client = row.paramVO.usageInfo.param.client;
this.ruleForm.memberType = row.paramVO.usageInfo.param.memberType;
this.ruleForm.deviceCode = row.paramVO.usageInfo.param.deviceCode;
const functionList = Object.keys(row.paramVO.functionMap);
if (functionList && functionList.length) {
this.ruleForm.function = functionList[0];
}
this.innerTitle = '修改子系统';
this.innerVisible = true;
updateRow(index, row) {
this.$refs.editSubsystem.doShow(row);
},
commit() {
const functionMap = {};
if (this.ruleForm.function) {
functionMap[this.ruleForm.function] = null;
}
const data = {
mapId: this.mapId,
name: this.ruleForm.name,
desc: this.ruleForm.desc,
paramVO: {
type: this.ruleForm.type,
usageInfo: {
usage: this.ruleForm.usage,
param: {
client: this.ruleForm.client,
memberType: this.ruleForm.memberType,
deviceCode: this.ruleForm.deviceCode
}
},
functionMap: functionMap
}
};
if (this.innerTitle === '创建子系统') {
createMapSystem(data).then(resp => {
this.innerVisible = false;
this.reload();
this.$message.success('创建子系统成功!');
this.closeInner();
}).catch(() => {
this.$message.error('创建子系统失败!');
});
} else {
data.id = this.mapSystemId;
updateMapSystem(data).then(resp => {
this.innerVisible = false;
this.reload();
this.closeInner();
this.$message.success('修改子系统成功!');
}).catch(() => {
this.$message.error('修改子系统失败!');
});
}
handleAddSubsystem() {
this.$refs.editSubsystem.doShow();
},
closeInner() {
this.mapSystemId = '';
this.ruleForm = {
name: '',
type: '',
usage: '',
memberType: '',
deviceCode: '',
client: '',
function: ''
};
this.innerVisible = false;
this.$refs.ruleForm.resetFields();
reloadTable() {
this.queryList.reload();
},
goBack() {
this.$router.go(-1);
}
}
};
</script>
<style scoped>
<style lang="scss" scoped>
/deep/
.el-button+.el-button{
margin-top: 5px;
margin-left: 5px;
}
</style>

View File

@ -1,52 +1,49 @@
<template>
<div v-loading="loading" class="map-list-main">
<div class="mapListName">
<span>{{ $t('global.mapList') }}</span>
</div>
<template v-if="!IsProject">
<filter-city ref="filerCity" filter-empty local-param-name="training_cityCode" @filterSelectChange="refresh" />
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
</template>
<div id="trainingMapTree" class="left-map-list">
<el-tree
ref="tree"
:data="treeList"
node-key="id"
:props="{children:'children',label:'name'}"
highlight-current
:span="22"
:filter-node-method="filterNode"
@node-click="clickEvent"
<el-menu
default-active="2"
class="el-menu-vertical-demo"
background-color="#545c64"
text-color="#fff"
router
active-text-color="#ffd04b"
>
<span slot-scope="{ node }">
<span
class="el-icon-tickets"
/>
<span :id="node.data.id">&nbsp;{{ node.data.name }}</span>
</span>
</el-tree>
<div class="mapListName">
<span>{{ $t('global.mapList') }}</span>
</div>
<template v-for="(cityCode, index) in Object.keys(menuData)">
<el-submenu :key="index" :index="index+''">
<template slot="title">
<i class="el-icon-location" />
<span>{{ cityMap.get(cityCode) }}</span>
</template>
<template v-for="(map, mapIndex) in menuData[cityCode]">
<el-menu-item :key="index + '-' + mapIndex" :index="'/trainingPlatform/simulation/' + map.id + '?lineCode=' + map.lineCode">{{ map.name }}</el-menu-item>
</template>
</el-submenu>
</template>
</el-menu>
</div>
</div>
</template>
<script>
import { listPublishMap } from '@/api/jmap/map';
import { UrlConfig } from '@/scripts/ConstDic';
import FilterCity from '@/views/components/filterCity';
import { getSessionStorage } from '@/utils/auth';
import { GetMapListByProjectList } from '@/scripts/ProjectConfig';
import { publisMapCityList} from '@/api/jmap/map';
export default {
name: 'DemonList',
components: {
FilterCity
},
data() {
return {
loading: true,
filterText: '',
treeList: [],
menuData: {},
mapId: '',
filterSelect: ''
filterSelect: '',
cityMap: null
};
},
computed: {
@ -66,10 +63,29 @@ export default {
this.$refs.tree.filter(val);
}
},
mounted() {
async mounted() {
let res = {};
this.menuData = {};
this.cityMap = new Map();
const resp = await publisMapCityList('city_type');
(resp.data || []).forEach(item => {
this.cityMap.set(item.code, item.name);
});
if (this.IsProject) {
this.refresh();
res = await listPublishMap({project: this.project});
} else {
res = await listPublishMap();
}
if (res && res.data) {
res.data.forEach(item => {
if (this.menuData[item.cityCode]) {
this.menuData[item.cityCode].push(item);
} else {
this.menuData[item.cityCode] = [item];
}
});
}
this.loading = false;
},
methods: {
filterNode(value, data) {
@ -78,30 +94,9 @@ export default {
},
clickEvent(obj, data, ele) {
this.mapId = obj.id;
const router = { path: `${UrlConfig.trainingPlatform.permission}/${this.mapId}`, query: { lineCode: obj.lineCode }};
const router = { path: `/trainingPlatform/simulation/${this.mapId}`, query: { lineCode: obj.lineCode }};
console.log(router, 'router');
this.$router.push(router);
},
async refresh(filterSelect) {
this.loading = true;
this.treeList = [];
this.filterSelect = filterSelect;
try {
let res = {};
if (this.IsProject) {
res = await listPublishMap({project: this.project});
} else {
res = await listPublishMap({ cityCode:filterSelect});
}
this.treeList = res.data;
this.$nextTick(() => {
this.$refs.tree && this.$refs.tree.setCurrentKey(this.$route.params.mapId + '');
});
this.$emit('goRoutePath', res.data);
this.loading = false;
} catch (error) {
this.loading = false;
this.$message.error(this.$t('error.refreshFailed'));
}
}
}
};
@ -109,19 +104,25 @@ export default {
<style rel="stylesheet/scss" lang="scss" scoped>
.mapListName{
padding: 15px 0px 15px 17px;
color: #fff;
}
.left-map-list{
width: 100%;
height: 100%;
flex: 1;
overflow: auto;
padding-bottom: 10px;
padding-top: 5px;
background: #545c64;
}
.map-list-main{
height: 100%;
display:flex;
flex-direction:column;
}
/deep/.el-menu{
border-right-width: 0;
}
</style>
<style>
.el-tree {

View File

@ -42,7 +42,7 @@ export default {
goRoutePath(data) {
const againEnter = getSessionStorage('againEnter') || null;
if (!againEnter && !this.$route.query.thirdJump) {
this.$router.push(`/trainingPlatform/permission/${data[0].id}?lineCode=${data[0].lineCode}`);
this.$router.push(`/trainingPlatform/simulation/${data[0].id}?lineCode=${data[0].lineCode}`);
setSessionStorage('againEnter', true);
}
}

View File

@ -46,7 +46,7 @@ import { createSimulation } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth';
export default {
name: 'Author',
name: 'Simulation',
components: {
selectRole
},