增加一键生成仿真系统

This commit is contained in:
fan 2022-10-19 09:30:23 +08:00
parent c7f1984f92
commit a7e21bbfae
3 changed files with 127 additions and 47 deletions

View File

@ -114,3 +114,11 @@ export function queryMapSystemPaged(params) {
params
});
}
/** 生成地图子系统 */
export function generateMapSystemNew(mapId, data) {
return request({
url: `/api/mapSystem/new/${mapId}/generate`,
method: 'post',
data
});
}

View File

@ -6,7 +6,7 @@
:visible.sync="visible"
center
>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px">
<el-form-item label="子系统名称:" prop="name">
<el-input v-model="ruleForm.name" style="width: 200px;" />
</el-form-item>
@ -131,7 +131,9 @@ export default {
{ label: '车务管理终端', value: 'DMP' },
{ label: 'ISCS', value: 'ISCS' },
{ label: 'IBP', value: 'IBP' },
{ label: 'PSL', value: 'PSL' }
{ label: 'PSL', value: 'PSL' },
{ label: '运行图编制', value: 'RUN_PLAN_DESIGN' },
{ label: '列车驾驶', value: 'DRIVE' }
],
memberMetroList: [],
memberRailwayList: [],
@ -299,51 +301,55 @@ export default {
this.$refs.ruleForm.resetFields();
},
commit() {
const functionMap = {};
if (this.ruleForm.function === 'TRAINING') {
functionMap[this.ruleForm.function] = { trainingId: this.ruleForm.trainingId};
} else if (this.ruleForm.function) {
functionMap[this.ruleForm.function] = null;
}
const initParam = { memberId: this.ruleForm.memberId };
if (this.ruleForm.client) {
initParam.client = this.ruleForm.client;
}
const data = {
mapId: this.$route.query.mapId,
name: this.ruleForm.name,
desc: this.ruleForm.desc,
paramVO: {
type: this.ruleForm.type,
initParam: initParam,
functionMap: functionMap,
domConfig: {
singleClient: this.ruleForm.singleClient,
singleMember: this.ruleForm.singleMember,
hasTraining: this.ruleForm.hasTraining
this.$refs.ruleForm.validate((valid) => {
if (valid) {
const functionMap = {};
if (this.ruleForm.function === 'TRAINING') {
functionMap[this.ruleForm.function] = { trainingId: this.ruleForm.trainingId};
} else if (this.ruleForm.function) {
functionMap[this.ruleForm.function] = null;
}
const initParam = { memberId: this.ruleForm.memberId };
if (this.ruleForm.client) {
initParam.client = this.ruleForm.client;
}
const data = {
mapId: this.$route.query.mapId,
name: this.ruleForm.name,
desc: this.ruleForm.desc,
paramVO: {
type: this.ruleForm.type,
initParam: initParam,
functionMap: functionMap,
domConfig: {
singleClient: this.ruleForm.singleClient,
singleMember: this.ruleForm.singleMember,
hasTraining: this.ruleForm.hasTraining
}
}
};
if (this.title === '创建子系统') {
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('修改子系统失败!');
});
}
}
};
if (this.title === '创建子系统') {
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();

View File

@ -2,11 +2,32 @@
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-subsystem ref="editSubsystem" @tableReload="reloadTable" />
<el-dialog
width="30%"
:title="title"
:before-close="doCloseGenerate"
:visible.sync="visible"
center
>
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="120px">
<el-form-item label="系统:" prop="type">
<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-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="doCloseGenerate"> </el-button>
<el-button type="primary" @click="generateCommit"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { queryMapSystemPaged, deleteMapSystem } from '@/api/trainingPlatform';
import { queryMapSystemPaged, deleteMapSystem, generateMapSystemNew } from '@/api/trainingPlatform';
import { getPublishMapListOnline } from '@/api/jmap/map';
import EditSubsystem from './editSubsystem';
const simTypeMap = {
@ -26,7 +47,12 @@ const clientMap = {
GPC: '调度台终端',
IPC: '联锁工作站',
STPC: '车务终端',
DMP: '车务管理终端'
DMP: '车务管理终端',
ISCS: 'ISCS',
IBP: 'IBP',
PSL: 'PSL',
RUN_PLAN_DESIGN: '运行图编制',
DRIVE: '列车驾驶'
};
export default {
name: 'PublishMap',
@ -40,6 +66,16 @@ export default {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
title: '一键生成子系统',
visible: false,
rules: {
type: [
{ required: true, message: '请选择生成仿真系统类型', trigger: 'change' }
]
},
form: {
simTypes: []
},
queryForm: {
labelWidth: '80px',
reset: true,
@ -103,6 +139,7 @@ export default {
}
],
actions: [
{ text: '一键生成', handler: this.generateMapSystem },
{ text: '新建', handler: this.handleAddSubsystem },
{ text: '返回', handler: this.goBack }
]
@ -138,6 +175,35 @@ export default {
});
}).catch( () => { });
},
generateMapSystem() {
// this.$confirm('', ' ', {
// confirmButtonText: ' ',
// cancelButtonText: ' ',
// type: 'warning'
// }).then(() => {
// generateMapSystemNew(this.$route.query.mapId).then(resp => {
// this.reloadTable();
// }).catch(error => {
// this.$message.error(`: ${error.message}`);
// });
// }).catch( () => { });
this.visible = true;
},
doCloseGenerate() {
this.form.simTypes = [];
this.visible = false;
},
generateCommit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
generateMapSystemNew(this.$route.query.mapId, this.form).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`一键生成仿真系统失败: ${error.message}`);
});
}
});
},
updateRow(index, row) {
this.$refs.editSubsystem.doShow(row);
},