模板线路功能调整

This commit is contained in:
fan 2023-02-20 16:12:18 +08:00
parent d4ce77e8bc
commit 7590552db2
10 changed files with 763 additions and 69 deletions

View File

@ -146,3 +146,50 @@ export function updateMapFunctionSubset(data) {
data
});
}
/** 根据模板生成地图功能 */
export function generateMapFunctionByTemplate(data) {
return request({
url: `/api/mapFunction/generate/from/template`,
method: 'post',
data
});
}
/** 创建模板线路功能 */
export function createTemplateMapFunction(data) {
return request({
url: `/api/mapFunction/template`,
method: 'post',
data
});
}
/** 修改模板线路功能 */
export function updateTemplateMapFunction(data) {
return request({
url: `/api/mapFunction/template/${data.id}`,
method: 'put',
data
});
}
/** 删除模板线路功能 */
export function deleteTemplateMapFunction(id) {
return request({
url: `/api/mapFunction/template/${id}`,
method: 'delete'
});
}
/** 查询模板线路功能列表 */
export function queryTemplateMapFunctionList(params) {
return request({
url: `/api/mapFunction/template/list`,
method: 'get',
params
});
}
/** 分页查询模板线路功能列表 */
export function queryTemplateMapFunPaged(params) {
return request({
url: `/api/mapFunction/template/paged`,
method: 'get',
params
});
}

View File

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

View File

@ -37,16 +37,10 @@
</el-col>
<el-col :span="12">
<el-form-item label="背景:" prop="bgUrl">
<div style="display: flex;align-items: flex-start;">
<el-select v-model="ruleForm.bgUrl" size="mini" clearable>
<el-option
v-for="item in bgUrlList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<img :src="ossUrl+ruleForm.bgUrl" style="width: 200px;margin-left: 15px;">
<div class="eachButton uploadLogo">
<img v-if="ruleForm.bgUrl" :src="computedLoginLogo" :alt="computedLoginLogo" class="loginLogo">
<i class="el-icon-plus avatar-uploader-icon el-icon-other" />
<input id="upload_file" ref="files" type="file" class="file_box" accept="image/jpeg,image/png" @change="uploadLogo">
</div>
</el-form-item>
</el-col>
@ -131,7 +125,7 @@ import { queryPaperList } from '@/api/management/exam';
import { getTrainingDetailNew } from '@/api/jmap/training';
import ChooseTraining from './chooseTraining';
import { ClientList, TrainingTypeList } from '@/scripts/ConstDic';
import { getUploadUrl } from '@/api/projectConfig';
export default {
name: 'EditSubsystem',
components: {
@ -143,6 +137,7 @@ export default {
title: '',
trainingName: '',
mapSystemId: '',
loginProLogoImg: '',
memberList: [],
examList: [],
lpfDataList: [],
@ -183,25 +178,12 @@ export default {
},
memberMetroList: [],
memberRailwayList: [],
memberEmergencyList: [],
bgUrlList: [
{ label: '运行图编制', value: '/logo/chartPreparation.png' },
{ label: '调度仿真', value: '/logo/dispatchingPlan.png' },
{ label: '考试', value: '/logo/exam.png' },
{ label: '综合演练', value: '/logo/joinRoom.png' },
{ label: '场景实训', value: '/logo/sceneTraining.png' },
{ label: '派班', value: '/logo/schedulingSimulation.png' },
{ label: '单操仿真', value: '/logo/singleTraining.png' },
{ label: '车站仿真', value: '/logo/stationSimulation.png' },
{ label: '车辆段', value: '/logo/trainDepot.png' },
{ label: '实训设计', value: '/logo/trainingDesign.png' },
{ label: '模拟驾驶', value: '/logo/simulatedDriving.png' }
]
memberEmergencyList: []
};
},
computed: {
ossUrl() {
return this.$store.state.user.ossUrl;
computedLoginLogo() {
return this.loginProLogoImg ? this.$store.state.user.ossUrl + this.loginProLogoImg : '';
}
},
async mounted() {
@ -259,6 +241,7 @@ export default {
this.ruleForm.name = row.name;
this.ruleForm.desc = row.desc || '';
this.ruleForm.bgUrl = row.bgUrl || '';
this.loginProLogoImg = row.bgUrl || '';
this.ruleForm.type = row.paramVO.type;
this.typeChange(this.ruleForm.type);
this.frontTableData.forEach(item => {
@ -461,13 +444,99 @@ export default {
this.trainingName = data.name;
const training = this.endTableData.find(item => item.type === 'trainingChoose');
training.value = data.id;
},
uploadLogo() {
const pic = document.getElementById('upload_file');
if (!pic.files || !pic.files[0]) {
return;
}
const file = pic.files[0];
const mineType = file.type;
const fileSize = file.size;
if (mineType != 'image/png' && mineType != 'image/jpeg') {
this.$message.error('仅支持png和jpeg格式的图片');
return;
}
if (fileSize / (1024 * 1024) > 1) {
this.$message.error('图片应该小于1M');
return;
}
const fileArray = file.name.split('.');
const fileType = fileArray[fileArray.length - 1] || '';
if (!fileType) {
return;
}
const params = {
directory:'funBg',
fileName:'favicon_' + this.ruleForm.templateName + '.' + fileType,
method:'PUT'
};
const that = this;
getUploadUrl(params).then((response) => {
const url = response.data;
if (url) {
// var formData = new FormData();
// formData.append('body', file);
const xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.setRequestHeader('Content-Type', 'multipart/form-data');
xhr.send(file);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status == 200) {
that.ruleForm.bgUrl = '/funBg/' + params.fileName;
that.loginProLogoImg = '/funBg/' + params.fileName + '?' + Math.random() * 1000;
} else if (xhr.status != 200) {
that.$message.error('上传失败,请稍后再试');
}
};
}
});
}
}
};
</script>
<style scoped>
<style scoped lang="scss">
.dialog-footer {
text-align: center;
}
.loginLogo{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.el-icon-other{
width: 100%;
text-align: center;
height: 100%;
line-height: 98px;
font-size: 16px;
position: absolute;
color: #000;
}
.eachButton{
margin-left:10px;
width:200px;
height:100px;
border:1px #ccc dashed;
margin-bottom: 10px;
}
.uploadLogo {
position: relative;
overflow: hidden;
// float: right;
margin-right: 3px;
cursor: pointer;
input {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
}
</style>

View File

@ -66,7 +66,7 @@ export default {
queryForm: {
labelWidth: '80px',
reset: true,
leftSpan: 17,
leftSpan: 15,
queryObject: {
name: {
type: 'text',
@ -223,7 +223,8 @@ export default {
{ text: '地图排序', handler: this.mapSort },
{ text: '导出', handler: this.localExport, show: () => { return this.$store.state.user.roles.includes(superAdmin); }},
{ text: '导入', handler: this.localImport, fileType: 'file', show: () => { return this.$store.state.user.roles.includes(superAdmin); }},
{ text: '一键校验', handler: this.allCheck }
{ text: '一键校验', handler: this.allCheck },
{ text: '线路功能模板', handler: this.templateLineFunctionShow }
]
},
@ -416,6 +417,9 @@ export default {
this.$message.error('一键校验地图数据失败:' + e.message);
});
},
templateLineFunctionShow() {
this.$router.push({path:'/systemManagement/lineDataManage/mapFunTem'});
},
localExport() {
this.$refs['localMap'].doShow();
},

View File

@ -0,0 +1,427 @@
<template>
<el-dialog
:title="title"
:before-close="close"
:visible.sync="visible"
center
fullscreen
>
<div style="padding: 0 150px">
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px" size="small">
<el-row>
<el-col :span="12">
<el-form-item label="模板名称:" prop="templateName">
<el-input v-model="ruleForm.templateName" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="线路功能名称:" prop="name">
<el-input v-model="ruleForm.name" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<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-col>
<el-col :span="12">
<el-form-item label="默认成员类型:" prop="defaultMemberType">
<el-select v-model="ruleForm.defaultMemberType" size="mini" clearable>
<el-option
v-for="item in memberTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="描述:" prop="desc">
<el-input
v-model="ruleForm.desc"
type="textarea"
:rows="4"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="背景:" prop="bgUrl">
<div class="eachButton uploadLogo">
<img v-if="ruleForm.bgUrl" :src="computedLoginLogo" :alt="computedLoginLogo" class="loginLogo">
<i class="el-icon-plus avatar-uploader-icon el-icon-other" />
<input id="upload_file" ref="files" type="file" class="file_box" accept="image/jpeg,image/png" @change="uploadLogo">
</div>
</el-form-item>
</el-col>
</el-row>
<el-card style="padding: 10px;">
<el-table
:data="endTableData"
border
size="mini"
style="width: 100%;margin-top: 10px;max-height: 300px;overflow: scroll;"
>
<el-table-column
prop="label"
label="后端配置项"
/>
<el-table-column
prop="value"
label="value"
>
<template slot-scope="scope">
<el-checkbox v-if="scope.row.type === 'checkbox'" v-model="scope.row.value" />
<el-select
v-else-if="scope.row.type === 'select'"
v-model="scope.row.value"
size="mini"
clearable
>
<el-option
v-for="item in scope.row.optionList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card style="padding: 10px;margin-top: 20px;">
<el-table
:data="frontTableData"
border
size="mini"
style="width: 100%;margin-top: 10px;max-height: 300px;overflow: scroll;"
>
<el-table-column
prop="label"
label="前端配置项"
/>
<el-table-column
prop="value"
label="value"
>
<template slot-scope="scope">
<el-checkbox v-if="scope.row.type === 'checkbox'" v-model="scope.row.value" />
<el-select
v-else-if="scope.row.type === 'select'"
v-model="scope.row.value"
size="mini"
clearable
>
<el-option
v-for="item in scope.row.optionList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
</el-table>
</el-card>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="commit"> </el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import { createTemplateMapFunction, updateTemplateMapFunction } from '@/api/trainingPlatform';
import { ClientList, TrainingTypeList } from '@/scripts/ConstDic';
import ConstConfig from '@/scripts/ConstConfig';
import { getUploadUrl } from '@/api/projectConfig';
export default {
name: 'EditSubsystem',
data() {
return {
visible: false,
title: '',
loginProLogoImg: '',
memberTypeList: ConstConfig.ConstSelect.roleTypeList,
frontTableData: [
{ key: 'singleMember', label: '是否单角色', value: false, type: 'checkbox' },
{ key: 'singleClient', label: '是否单客户端', value: false, type: 'checkbox' },
{ key: 'client', label: '初始客户端', value: '', type: 'select', optionList: ClientList},
{ key: 'hasTraining', label: '是否有实训', value: false, type: 'checkbox'},
{ key: 'trainingType', label: '实训类型', value: '', type: 'select', optionList: TrainingTypeList },
{ key: 'hasExam', label: '是否有考试', value: false, type: 'checkbox' },
{ key: 'trainingDesign', label: '是否实训设计', value: false, type: 'checkbox' },
{ key: 'hasLpf', label: '是否有大客流', value: false, type: 'checkbox' },
{ key: 'hasVoice', label: '是否有语音指令', value: false, type: 'checkbox' },
{ key: 'joint', label: '是否综合演练', value: false, type: 'checkbox' },
{ key: 'hasDeviceManage', label: '是否有设备管理', value: false, type: 'checkbox' },
{ key: 'hasMemberManage', label: '是否有成员管理', value: false, type: 'checkbox' }
],
endTableData: [
// { key: 'DEFAULT_MEMBER', label: '仿', value: '', type: 'select', optionList: [] },
// { key: 'LPF', label: '', value: '', type: 'select', optionList: [] },
{ key: 'REAL_DEVICE', label: '真实设备', value: '', type: 'checkbox' }
// { key: 'TRAINING', label: '', value: '', type: 'trainingChoose' },
// { key: 'EXAM', label: '', value: '', type: 'select', optionList: [] }
],
rules: {
templateName: [
{ required: true, message: '请输入模板线路功能名称', trigger: 'blur' }
],
name: [
{ required: true, message: '请输入线路功能名称', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择线路功能类型', trigger: 'change' }
]
},
ruleForm: {
templateName: '',
templateId: '',
defaultMemberType: '',
name: '',
type: '',
desc: '',
bgUrl: ''
}
};
},
computed: {
computedLoginLogo() {
return this.loginProLogoImg ? this.$store.state.user.ossUrl + this.loginProLogoImg : '';
}
},
methods: {
doShow(row) {
if (row && row.id) {
this.ruleForm.templateId = row.id;
this.ruleForm.templateName = row.name;
this.ruleForm.defaultMemberType = row.assistantParam.defaultMemberType;
this.loginProLogoImg = row.mapFunctionParam.bgUrl;
this.ruleForm.name = row.mapFunctionParam.name;
this.ruleForm.desc = row.mapFunctionParam.desc || '';
this.ruleForm.bgUrl = row.mapFunctionParam.bgUrl || '';
this.ruleForm.type = row.mapFunctionParam.paramVO.type;
this.frontTableData.forEach(item => {
item.value = row.mapFunctionParam.paramVO.domConfig[item.key];
});
this.endTableData.forEach(item => {
if (row.mapFunctionParam.paramVO.itemMap && row.mapFunctionParam.paramVO.itemMap[item.key]) {
if (row.mapFunctionParam.paramVO.itemMap[item.key] === 'true') {
item.value = true;
} else if (row.mapFunctionParam.paramVO.itemMap[item.key] === 'false') {
item.value = false;
} else {
item.value = row.mapFunctionParam.paramVO.itemMap[item.key] === null ? '' : row.mapFunctionParam.paramVO.itemMap[item.key];
}
}
});
this.title = '修改模板线路功能';
} else {
this.title = '创建模板线路功能';
}
this.visible = true;
},
close() {
this.ruleForm = {
templateId: '',
templateName: '',
defaultMemberType: '',
name: '',
type: '',
desc: '',
bgUrl: ''
};
this.loginProLogoImg = '';
this.frontTableData = [
{ key: 'singleMember', label: '是否单角色', value: false, type: 'checkbox' },
{ key: 'singleClient', label: '是否单客户端', value: false, type: 'checkbox' },
{ key: 'client', label: '初始客户端', value: '', type: 'select', optionList: ClientList},
{ key: 'hasTraining', label: '是否有实训', value: false, type: 'checkbox'},
{ key: 'trainingType', label: '实训类型', value: '', type: 'select', optionList: TrainingTypeList },
{ key: 'hasExam', label: '是否有考试', value: false, type: 'checkbox' },
{ key: 'trainingDesign', label: '是否实训设计', value: false, type: 'checkbox' },
{ key: 'hasLpf', label: '是否有大客流', value: false, type: 'checkbox' },
{ key: 'hasVoice', label: '是否有语音指令', value: false, type: 'checkbox' },
{ key: 'joint', label: '是否综合演练', value: false, type: 'checkbox' },
{ key: 'hasDeviceManage', label: '是否有设备管理', value: false, type: 'checkbox' },
{ key: 'hasMemberManage', label: '是否有成员管理', value: false, type: 'checkbox' }
];
this.endTableData = [
// { key: 'DEFAULT_MEMBER', label: '仿', value: '', type: 'select', optionList: [] },
// { key: 'LPF', label: '', value: '', type: 'select', optionList: this.lpfDataList },
{ key: 'REAL_DEVICE', label: '真实设备', value: '', type: 'checkbox' }
// { key: 'TRAINING', label: '', value: '', type: 'trainingChoose' },
// { key: 'EXAM', label: '', value: '', type: 'select', optionList: this.examList }
];
this.visible = false;
this.$refs.ruleForm.resetFields();
},
commit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
const itemMap = {
DEFAULT_MEMBER: '',
LPF: '',
TRAINING: '',
EXAM: ''
};
this.endTableData.forEach(item => {
itemMap[item.key] = item.value === '' ? null : item.value;
});
const domConfig = {};
this.frontTableData.forEach(item => {
domConfig[item.key] = item.value;
});
if (!domConfig.trainingType) {
delete domConfig.trainingType;
}
const data = {
name: this.ruleForm.templateName,
assistantParam: {
defaultMemberType: this.ruleForm.defaultMemberType
},
mapFunctionParam: {
name: this.ruleForm.name,
desc: this.ruleForm.desc,
bgUrl: this.ruleForm.bgUrl,
paramVO: {
type: this.ruleForm.type,
itemMap:itemMap,
domConfig: domConfig
}
}
};
if (this.title === '创建模板线路功能') {
createTemplateMapFunction(data).then(resp => {
this.visible = false;
this.$emit('tableReload');
this.$message.success('创建模板线路功能成功!');
this.close();
}).catch(() => {
this.$message.error('创建模板线路功能失败!');
});
} else {
data.id = this.ruleForm.templateId;
updateTemplateMapFunction(data).then(resp => {
this.visible = false;
this.$emit('tableReload');
this.close();
this.$message.success('修改模板线路功能成功!');
}).catch(() => {
this.$message.error('修改模板线路功能失败!');
});
}
}
});
},
uploadLogo() {
const pic = document.getElementById('upload_file');
if (!pic.files || !pic.files[0]) {
return;
}
const file = pic.files[0];
const mineType = file.type;
const fileSize = file.size;
if (mineType != 'image/png' && mineType != 'image/jpeg') {
this.$message.error('仅支持png和jpeg格式的图片');
return;
}
if (fileSize / (1024 * 1024) > 1) {
this.$message.error('图片应该小于1M');
return;
}
const fileArray = file.name.split('.');
const fileType = fileArray[fileArray.length - 1] || '';
if (!fileType) {
return;
}
const params = {
directory:'funBg',
fileName:'favicon_' + this.ruleForm.templateName + '.' + fileType,
method:'PUT'
};
const that = this;
getUploadUrl(params).then((response) => {
const url = response.data;
if (url) {
// var formData = new FormData();
// formData.append('body', file);
const xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.setRequestHeader('Content-Type', 'multipart/form-data');
xhr.send(file);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status == 200) {
that.ruleForm.bgUrl = '/funBg/' + params.fileName;
that.loginProLogoImg = '/funBg/' + params.fileName + '?' + Math.random() * 1000;
} else if (xhr.status != 200) {
that.$message.error('上传失败,请稍后再试');
}
};
}
});
// directoryMINIO
// fileName
// method
}
}
};
</script>
<style scoped lang="scss">
.dialog-footer {
text-align: center;
}
.loginLogo{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.el-icon-other{
width: 100%;
text-align: center;
height: 100%;
line-height: 98px;
font-size: 16px;
position: absolute;
color: #000;
}
.eachButton{
margin-left:10px;
width:200px;
height:100px;
border:1px #ccc dashed;
margin-bottom: 10px;
}
.uploadLogo {
position: relative;
overflow: hidden;
// float: right;
margin-right: 3px;
cursor: pointer;
input {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
}
</style>

View File

@ -0,0 +1,146 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-subsystem ref="editSubsystem" @tableReload="reloadTable" />
</div>
</template>
<script>
import { queryTemplateMapFunPaged, deleteTemplateMapFunction } from '@/api/trainingPlatform';
import EditSubsystem from './edit';
import ConstConfig from '@/scripts/ConstConfig';
const simTypeMap = {
METRO: '地铁CBTC',
RAILWAY: '大铁CTC',
EMERGENCY: '应急调度'
};
export default {
name: 'PublishMap',
components: {
EditSubsystem
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
leftSpan: 16,
queryObject: {
name: {
type: 'text',
label: '名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '模板名称',
prop: 'name'
},
{
title: '线路功能名称',
prop: 'name',
type: 'tag',
columnValue: (row) => { return row.mapFunctionParam.name; },
tagType: () => { return 'success'; }
},
{
title: '系统',
prop: 'simType',
type: 'tag',
columnValue: (row) => { return simTypeMap[row.mapFunctionParam.paramVO.type]; },
tagType: () => { return 'success'; }
},
{
title: '默认扮演成员类型',
prop: 'DEFAULT_MEMBER',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.assistantParam ? row.assistantParam.defaultMemberType : '', ConstConfig.ConstSelect.roleTypeList, ['value', 'label']); },
tagType: () => { return 'success'; }
},
{
title: '真实设备',
prop: 'REAL_DEVICE',
type: 'tag',
columnValue: (row) => { return row.mapFunctionParam.paramVO && row.mapFunctionParam.paramVO.itemMap && row.mapFunctionParam.paramVO.itemMap.REAL_DEVICE ? '是' : '否'; },
tagType: () => { return 'success'; }
},
{
title: '描述',
prop: 'desc',
type: 'tag',
columnValue: (row) => { return row.mapFunctionParam.desc; },
tagType: () => { return 'success'; }
},
{
type: 'button',
title: '操作',
width: '300',
buttons: [
{
name: '更新',
handleClick: this.updateRow
},
{
name: '删除',
handleClick: this.deleteRow
}
]
}
],
actions: [
{ text: '新建', handler: this.handleAddSubsystem },
{ text: '返回', handler: this.goBack }
]
}
};
},
methods: {
queryFunction(params) {
params['detail'] = true;
return queryTemplateMapFunPaged(params);
},
deleteRow(index, row) {
this.$confirm('删除线路功能,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteTemplateMapFunction(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除模板线路功能失败:${error.message}`);
});
}).catch( () => { });
},
updateRow(index, row) {
this.$refs.editSubsystem.doShow(row);
},
handleAddSubsystem() {
this.$refs.editSubsystem.doShow();
},
reloadTable() {
this.queryList.reload();
},
goBack() {
this.$router.go(-1);
}
}
};
</script>
<style lang="scss" scoped>
/deep/
.el-button+.el-button{
margin-top: 5px;
margin-left: 5px;
}
</style>

View File

@ -10,13 +10,19 @@
center
>
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="120px">
<el-form-item label="系统:" prop="simTypes">
<el-select v-model="form.simTypes" multiple placeholder="请选择生成仿真类型">
<el-option label="地铁CBTC" value="METRO" />
<el-option label="大铁CTC" value="RAILWAY" />
<el-option label="应急调度" value="EMERGENCY" />
<el-form-item label="系统:" prop="templateIds">
<el-select v-model="form.templateIds" multiple clearable placeholder="请选择生成仿真类型">
<el-option
v-for="item in templateList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="同名覆写:" prop="overwrite">
<el-checkbox v-model="form.overwrite" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="doCloseGenerate"> </el-button>
@ -27,7 +33,7 @@
</template>
<script>
import { queryMapFunctionPaged, deleteMapFunction, generateMapFunctionNew, deleteAllMapFunction } from '@/api/trainingPlatform';
import { queryMapFunctionPaged, deleteMapFunction, deleteAllMapFunction, queryTemplateMapFunctionList, generateMapFunctionByTemplate } from '@/api/trainingPlatform';
import { getPublishMapListOnline } from '@/api/jmap/map';
import EditSubsystem from './editSubsystem';
const simTypeMap = {
@ -35,25 +41,6 @@ const simTypeMap = {
RAILWAY: '大铁CTC',
EMERGENCY: '应急调度'
};
// const clientMap = {
// C_ATS: 'ATS',
// C_ATS_BS: 'ATS',
// C_PA: 'PA',
// C_CCTV: '',
// L_ATS: 'ATS',
// LCW: '',
// L_CCTV: '',
// L_PA: 'PA',
// GPC: '',
// IPC: '',
// STPC: '',
// DMP: '',
// ISCS: 'ISCS',
// IBP: 'IBP',
// PSL: 'PSL',
// RUN_PLAN_DESIGN: '',
// DRIVE: ''
// };
export default {
name: 'PublishMap',
components: {
@ -61,20 +48,21 @@ export default {
},
data() {
return {
dialogVisible: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
title: '一键生成线路功能',
visible: false,
templateList: [],
rules: {
type: [
{ required: true, message: '请选择生成仿真系统类型', trigger: 'change' }
templateIds: [
{ required: true, message: '请选择模板线路功能', trigger: 'change' }
]
},
form: {
simTypes: []
templateIds: [],
overwrite: false
},
queryForm: {
labelWidth: '80px',
@ -185,11 +173,6 @@ export default {
}
};
},
computed: {
isShow() {
return this.$store.getters['roles'].indexOf('05');
}
},
created() {
this.mapList = [];
getPublishMapListOnline().then(resp => {
@ -213,6 +196,7 @@ export default {
},
queryFunction(params) {
params['mapId'] = this.$route.query.mapId;
params['detail'] = true;
return queryMapFunctionPaged(params);
},
deleteRow(index, row) {
@ -229,19 +213,30 @@ export default {
}).catch( () => { });
},
generateMapSystem() {
if (!this.templateList.length) {
queryTemplateMapFunctionList({detail: false}).then(resp => {
this.templateList = resp.data || [];
}).catch(() => {
this.$message.error('获取模板线路功能列表失败!');
});
}
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.form = {
templateIds: [],
overwrite: false
};
this.visible = false;
},
generateCommit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
generateMapFunctionNew(this.$route.query.mapId, this.form).then(resp => {
const data = { templateIds: this.form.templateIds, mapIds: [this.$route.query.mapId], overwrite: this.form.overwrite };
generateMapFunctionByTemplate(data).then(resp => {
if (resp.data && resp.data.length) {
let message = '';
resp.data.forEach(item => {

View File

@ -66,7 +66,7 @@ export default {
};
},
mounted() {
queryMapFunctionList({mapId: this.$route.query.mapId}).then(resp => {
queryMapFunctionList({mapId: this.$route.query.mapId, detail: false}).then(resp => {
this.functionList = resp.data;
this.functionList.forEach(item => {
if (item.subset && this.subsetList.includes(item.subset)) {

View File

@ -112,7 +112,7 @@ export default {
}
},
getRelatedFunctionList(mapId) {
queryMapFunctionList({mapId: mapId}).then(resp => {
queryMapFunctionList({mapId: mapId, detail: true}).then(resp => {
this.functionList = resp.data;
console.log(resp);
}).catch(() => {

View File

@ -248,7 +248,7 @@ export default {
this.$refs.selectRole.doShow(row.id);
},
initMapSystem() {
queryMapFunctionList({mapId: this.$route.params.mapId}).then(resp => {
queryMapFunctionList({mapId: this.$route.params.mapId, detail: true}).then(resp => {
this.systemList = resp.data;
this.systemList.forEach(item => {
if (item.subset && this.subsetList.includes(item.subset)) {