代码调整

This commit is contained in:
fan 2022-10-14 18:02:22 +08:00
parent 908da1f4a9
commit cb19a6b423
4 changed files with 162 additions and 36 deletions

View File

@ -292,3 +292,11 @@ export function querySimulationMemberByMapId(id) {
method: 'get'
});
}
/** 根据地图查询车站(含车辆段停车场) */
export function querySimulationStationsByMapId(id) {
return request({
url: `/api/map/${id}/stations`,
method: 'get'
});
}

View File

@ -23,13 +23,13 @@ export function handlerUrl() {
let OSS_URL;
if (process.env.NODE_ENV === 'development') {
// 开发分支
BASE_API = 'http://192.168.3.233/rtss-server';
// BASE_API = 'http://192.168.3.233/rtss-server';
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.3.90:9100'; // 周寅
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -274,6 +274,23 @@
<el-button size="small" type="primary" @click="keyGeneration">一键生成</el-button>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" label="一键清空" name="fifth" :lazy="lazy">
<el-form ref="generationForm" :model="clearForm" label-width="120px" class="demo-ruleForm" size="small">
<el-form-item label="系统:" prop="systemType">
<el-select v-model="clearForm.systemType" placeholder="请选择">
<el-option
v-for="item in systemList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div style="text-align: center;">
<el-button size="small" type="primary" @click="keyClear">一键清空</el-button>
</div>
</el-tab-pane>
</el-tabs>
</template>
@ -341,6 +358,9 @@ export default {
},
generationForm: {
systemType: 'METRO'
},
clearForm: {
systemType: 'METRO'
}
};
},
@ -756,6 +776,10 @@ export default {
}
this.$message.success('一键生成成功!');
this.resetForm();
},
keyClear() {
const memberMap = { METRO: this.memberMetroList, RAILWAY: this.memberRailwayList, EMERGENCY: this.memberEmergencyList };
memberMap[this.clearForm.systemType].splice(0, memberMap[this.clearForm.systemType].length);
}
}
};

View File

@ -2,6 +2,7 @@
<el-dialog
width="30%"
:title="title"
:before-close="close"
:visible.sync="visible"
center
>
@ -10,39 +11,32 @@
<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-select v-model="ruleForm.type" placeholder="请选择类型" @change="typeChange">
<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-select v-model="ruleForm.usage" placeholder="请选择使用方式" @change="usageChange">
<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') && ruleForm.type === 'METRO'" label="仿真成员:" prop="memberType">
<el-select v-model="ruleForm.memberId" placeholder="请选择仿真成员">
<el-option v-for="option in memberMetroList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item v-if="(ruleForm.usage === 'SINGLE_MEMBER' || ruleForm.usage === 'JOINT') && ruleForm.type === 'RAILWAY'" label="仿真成员:" prop="memberType">
<el-select v-model="ruleForm.memberId" placeholder="请选择仿真成员">
<el-option v-for="option in memberRailwayList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item v-if="(ruleForm.usage === 'SINGLE_MEMBER' || ruleForm.usage === 'JOINT') && ruleForm.type === 'EMERGENCY'" label="仿真成员:" prop="memberType">
<el-select v-model="ruleForm.memberId" placeholder="请选择仿真成员">
<el-option v-for="option in memberEmergencyList" :key="option.value" :label="option.label" :value="option.value" />
</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 v-model="ruleForm.client" placeholder="请选择使用客户端" @change="clientChange">
<el-option v-for="option in clientList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.usage === 'SINGLE_MEMBER'" label="成员类型:" prop="memberType">
<el-select v-model="ruleForm.memberType" placeholder="请选择成员类型" @change="memberTypeChange">
<el-option v-for="option in roleList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item label="仿真成员:" prop="memberId">
<el-select v-model="ruleForm.memberId" placeholder="请选择仿真成员">
<el-option v-for="option in memberList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item label="功能:" prop="function">
@ -79,7 +73,7 @@
<script>
import { updateMapSystem, createMapSystem } from '@/api/trainingPlatform';
import { querySimulationMemberByMapId, getStationListNeedAttendant } from '@/api/jmap/map';
import { querySimulationMemberByMapId, querySimulationStationsByMapId } from '@/api/jmap/map';
import { getTrainingDetailNew } from '@/api/jmap/training';
import ChooseTraining from './chooseTraining';
export default {
@ -92,7 +86,7 @@ export default {
visible: false,
title: '',
mapSystemId: '',
memberMap: {},
memberList: [],
rules: {
name: [
{ required: true, message: '请输入子系统名称', trigger: 'blur' }
@ -102,6 +96,12 @@ export default {
],
usage: [
{ required: true, message: '请选择使用方式', trigger: 'change' }
],
memberType: [
{ required: true, message: '请选择成员类型', trigger: 'change' }
],
memberId: [
{ required: true, message: '请选择仿真成员', trigger: 'change' }
]
},
ruleForm: {
@ -113,8 +113,29 @@ export default {
client: '',
function: '',
trainingId: '',
trainingName: ''
trainingName: '',
memberType: ''
},
roleList: [
{label: '行调', value: 'DISPATCHER'},
{label: '行值', value: 'STATION_SUPERVISOR'},
{label: '司机', value: 'DRIVER'},
{label: '通号', value: 'MAINTAINER'},
{label: '车辆段/停车场调度', value: 'DEPOT_DISPATCHER'},
{label: '车辆段/停车场信号楼', value: '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'},
{label: '工电调度', value: 'ELECTRIC_DISPATCHER'},
{label: '上级部分', value: 'PARENT_DEPARTMENT'},
{label: '派班员', value: 'SCHEDULING'},
{label: '设备管理员', value: 'DEVICE_MANAGER'}
],
clientList: [
{ label: '中心ATS工作站', value: 'C_ATS' },
{ label: '中心ATS大屏', value: 'C_ATS_BS' },
@ -135,9 +156,8 @@ export default {
};
},
async mounted() {
this.memberMap = [];
try {
const stationResp = await getStationListNeedAttendant(this.$route.query.mapId);
const stationResp = await querySimulationStationsByMapId(this.$route.query.mapId);
const memberResp = await querySimulationMemberByMapId(this.$route.query.mapId);
this.memberMetroList = [];
this.memberRailwayList = [];
@ -168,8 +188,9 @@ export default {
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.memberId = row.paramVO.usageInfo.param.memberId;
this.ruleForm.client = row.paramVO.usageInfo.param.client || '';
this.ruleForm.memberId = row.paramVO.usageInfo.param.memberId || '';
this.ruleForm.memberType = row.paramVO.usageInfo.param.memberType || '';
const functionList = Object.keys(row.paramVO.functionMap);
if (functionList && functionList.length) {
this.ruleForm.function = functionList[0];
@ -184,8 +205,80 @@ export default {
}
this.visible = true;
},
typeChange(val) {
if (val === 'METRO') {
this.memberList = [...this.memberMetroList];
} else if (val === 'RAILWAY') {
this.memberList = [...this.memberRailwayList];
} else if (val === 'EMERGENCY') {
this.memberList = [...this.memberEmergencyList];
}
if (this.ruleForm.usage === 'SINGLE_MEMBER' && this.ruleForm.memberType) {
const temMemberList = this.memberList.filter(member => member.memberType === this.ruleForm.memberType);
this.memberList = [...temMemberList];
}
if (this.ruleForm.usage === 'SINGLE_CLIENT' && this.ruleForm.client) {
if (['C_ATS', 'C_ATS_BS', 'C_PA', 'C_CCTV', 'GPC'].includes(this.ruleForm.client)) {
const temMemberList = this.memberList.filter(member => member.memberType === 'DISPATCHER');
this.memberList = [...temMemberList];
} else if (['L_ATS', 'LCW', 'L_CCTV', 'L_PA'].includes(this.ruleForm.client)) {
const temMemberList = this.memberList.filter(member => member.memberType === 'STATION_SUPERVISOR');
this.memberList = [...temMemberList];
}
}
},
usageChange(val) {
if (this.ruleForm.type === 'METRO') {
this.memberList = [...this.memberMetroList];
} else if (this.ruleForm.type === 'RAILWAY') {
this.memberList = [...this.memberRailwayList];
} else if (this.ruleForm.type === 'EMERGENCY') {
this.memberList = [...this.memberEmergencyList];
}
if (val === 'SINGLE_MEMBER' && this.ruleForm.memberType) {
const temMemberList = this.memberList.filter(member => member.memberType === this.ruleForm.memberType);
this.memberList = [...temMemberList];
}
if (val === 'SINGLE_CLIENT' && this.ruleForm.client) {
if (['C_ATS', 'C_ATS_BS', 'C_PA', 'C_CCTV', 'GPC'].includes(this.ruleForm.client)) {
const temMemberList = this.memberList.filter(member => member.memberType === 'DISPATCHER');
this.memberList = [...temMemberList];
} else if (['L_ATS', 'LCW', 'L_CCTV', 'L_PA'].includes(this.ruleForm.client)) {
const temMemberList = this.memberList.filter(member => member.memberType === 'STATION_SUPERVISOR');
this.memberList = [...temMemberList];
}
}
},
clientChange(val) {
if (this.ruleForm.type === 'METRO') {
this.memberList = [...this.memberMetroList];
} else if (this.ruleForm.type === 'RAILWAY') {
this.memberList = [...this.memberRailwayList];
} else if (this.ruleForm.type === 'EMERGENCY') {
this.memberList = [...this.memberEmergencyList];
}
if (['C_ATS', 'C_ATS_BS', 'C_PA', 'C_CCTV', 'GPC'].includes(val)) {
const temMemberList = this.memberList.filter(member => member.memberType === 'DISPATCHER');
this.memberList = [...temMemberList];
} else if (['L_ATS', 'LCW', 'L_CCTV', 'L_PA'].includes(val)) {
const temMemberList = this.memberList.filter(member => member.memberType === 'STATION_SUPERVISOR');
this.memberList = [...temMemberList];
}
},
memberTypeChange(val) {
if (this.ruleForm.type === 'METRO') {
this.memberList = [...this.memberMetroList];
} else if (this.ruleForm.type === 'RAILWAY') {
this.memberList = [...this.memberRailwayList];
} else if (this.ruleForm.type === 'EMERGENCY') {
this.memberList = [...this.memberEmergencyList];
}
const temMemberList = this.memberList.filter(member => member.memberType === val);
console.log(this.memberList, val, temMemberList);
this.memberList = [...temMemberList];
},
handleMember(member, stationList) {
const data = { value: member.id, label: '' };
const data = { value: member.id, label: '', memberType: member.type };
const device = stationList.find(station => station.code === member.deviceCode) || {};
switch (member.type) {
case 'DISPATCHER':
@ -256,7 +349,8 @@ export default {
client: '',
function: '',
trainingId: '',
trainingName: ''
trainingName: '',
memberType: ''
};
this.visible = false;
this.$refs.ruleForm.resetFields();
@ -268,12 +362,13 @@ export default {
} else if (this.ruleForm.function) {
functionMap[this.ruleForm.function] = null;
}
const param = {};
const param = {memberId: this.ruleForm.memberId};
if (this.ruleForm.usage === 'SINGLE_CLIENT') {
param.client = this.ruleForm.client;
} else {
param.memberId = this.ruleForm.memberId;
} else if (this.ruleForm.usage === 'SINGLE_MEMBER') {
param.memberType = this.ruleForm.memberType;
}
console.log(this.ruleForm.memberType, param, '------');
const data = {
mapId: this.$route.query.mapId,
name: this.ruleForm.name,
@ -287,7 +382,6 @@ export default {
functionMap: functionMap
}
};
console.log(data, '----');
if (this.title === '创建子系统') {
createMapSystem(data).then(resp => {
this.visible = false;