增加一键生成仿真系统

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

View File

@ -2,11 +2,32 @@
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-subsystem ref="editSubsystem" @tableReload="reloadTable" /> <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> </div>
</template> </template>
<script> <script>
import { queryMapSystemPaged, deleteMapSystem } from '@/api/trainingPlatform'; import { queryMapSystemPaged, deleteMapSystem, generateMapSystemNew } from '@/api/trainingPlatform';
import { getPublishMapListOnline } from '@/api/jmap/map'; import { getPublishMapListOnline } from '@/api/jmap/map';
import EditSubsystem from './editSubsystem'; import EditSubsystem from './editSubsystem';
const simTypeMap = { const simTypeMap = {
@ -26,7 +47,12 @@ const clientMap = {
GPC: '调度台终端', GPC: '调度台终端',
IPC: '联锁工作站', IPC: '联锁工作站',
STPC: '车务终端', STPC: '车务终端',
DMP: '车务管理终端' DMP: '车务管理终端',
ISCS: 'ISCS',
IBP: 'IBP',
PSL: 'PSL',
RUN_PLAN_DESIGN: '运行图编制',
DRIVE: '列车驾驶'
}; };
export default { export default {
name: 'PublishMap', name: 'PublishMap',
@ -40,6 +66,16 @@ export default {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
title: '一键生成子系统',
visible: false,
rules: {
type: [
{ required: true, message: '请选择生成仿真系统类型', trigger: 'change' }
]
},
form: {
simTypes: []
},
queryForm: { queryForm: {
labelWidth: '80px', labelWidth: '80px',
reset: true, reset: true,
@ -103,6 +139,7 @@ export default {
} }
], ],
actions: [ actions: [
{ text: '一键生成', handler: this.generateMapSystem },
{ text: '新建', handler: this.handleAddSubsystem }, { text: '新建', handler: this.handleAddSubsystem },
{ text: '返回', handler: this.goBack } { text: '返回', handler: this.goBack }
] ]
@ -138,6 +175,35 @@ export default {
}); });
}).catch( () => { }); }).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) { updateRow(index, row) {
this.$refs.editSubsystem.doShow(row); this.$refs.editSubsystem.doShow(row);
}, },