生成客户端逻辑调整

This commit is contained in:
fan 2023-05-04 16:54:45 +08:00
parent be9d27d7a2
commit 1c51094308
7 changed files with 197 additions and 61 deletions

View File

@ -307,3 +307,10 @@ export function queryMapListByUser() {
method: 'get'
});
}
/** 根据mapId获取客户端信息数据 */
export function getClientDataById(mapId) {
return request({
url: `/api/map/${mapId}/mapClientMap`,
method: 'get'
});
}

View File

@ -846,8 +846,12 @@ const map = {
map.conversationGroupMap.EMERGENCY = [];
}
}
if (!map.mapClientVOList) {
map.mapClientVOList = [];
if (!map.mapClientVOMap) {
map.mapClientVOMap = { METRO: [], RAILWAY: [], EMERGENCY: [] };
} else {
if (!map.mapClientVOMap.METRO) { map.mapClientVOMap.METRO = []; }
if (!map.mapClientVOMap.RAILWAY) { map.mapClientVOMap.RAILWAY = []; }
if (!map.mapClientVOMap.EMERGENCY) { map.mapClientVOMap.EMERGENCY = []; }
}
state.map = map;
let showConfig = {};

View File

@ -31,7 +31,7 @@ export function handlerUrl() {
// BASE_API = 'http://192.168.3.94: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://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -70,7 +70,7 @@ import FloodGate from './floodGate';
import DirectionRod from './directionRod';
import SignalButton from './signalButton';
import SimulationMember from './simulationMember/index';
import terminals from './terminals';
import terminals from './terminals/terminals';
export default {
name: 'MapOperate',

View File

@ -0,0 +1,69 @@
<template>
<div style="height: calc(100% - 47px);overflow-y: auto;">
<el-row style="margin-bottom: 5px;">
<el-col :span="6" :offset="1"><div style="text-align: center;font-size: 14px;">名称</div></el-col>
<el-col :span="5" :offset="1"><div style="text-align: center;font-size: 14px;">客户端类型</div></el-col>
<el-col :span="6" :offset="1"><div style="text-align: center;font-size: 14px;">设备</div></el-col>
<el-col :span="4"><div style="text-align: center;font-size: 14px;">操作</div></el-col>
</el-row>
<el-row v-for="(item, index) in clientList" :key="index" style="margin-bottom: 5px;">
<el-col :span="6" :offset="1">
<el-input v-model="item.name" size="mini" :title="item.name" />
</el-col>
<el-col :span="5" :offset="1">
<el-select v-model="item.type" placeholder="请选择" size="mini">
<el-option v-for="elem in terminals" :key="elem.code" :label="elem.name" :value="elem.code" />
</el-select>
</el-col>
<el-col :span="6" :offset="1">
<el-select v-if="stationShow.includes(item.type)" v-model="item.deviceCode" placeholder="请选择" size="mini">
<el-option v-for="elem in stationList" :key="elem.code" :label="elem.name" :value="elem.code" />
</el-select>
<span v-else>--</span>
</el-col>
<el-col :span="4" style="text-align: center;">
<el-button type="primary" size="mini" @click="deleteClient(index)">删除</el-button>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
name: 'List',
props: {
clientList: {
type: Array,
default: function () {
return [];
}
},
terminals: {
type: Array,
default: function () {
return [];
}
},
stationList: {
type: Array,
default: function () {
return [];
}
}
},
data() {
return {
stationShow: ['localWork', 'ibp', 'psl']
};
},
methods: {
deleteClient(index) {
this.clientList.splice(index, 1);
}
}
};
</script>
<style scoped>
</style>

View File

@ -1,33 +1,17 @@
<template>
<el-tabs v-model="activeName" class="card" style="height: 100%">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
<div style="height: calc(100% - 47px);overflow-y: auto;">
<el-row style="margin-bottom: 5px;">
<el-col :span="6" :offset="1"><div style="text-align: center;font-size: 14px;">名称</div></el-col>
<el-col :span="5" :offset="1"><div style="text-align: center;font-size: 14px;">客户端类型</div></el-col>
<el-col :span="6" :offset="1"><div style="text-align: center;font-size: 14px;">设备</div></el-col>
<el-col :span="4"><div style="text-align: center;font-size: 14px;">操作</div></el-col>
</el-row>
<el-row v-for="(item, index) in mapClientVOList" :key="index" style="margin-bottom: 5px;">
<el-col :span="6" :offset="1">
<el-input v-model="item.name" size="mini" :title="item.name" />
</el-col>
<el-col :span="5" :offset="1">
<el-select v-model="item.type" placeholder="请选择" size="mini">
<el-option v-for="elem in getTerminals()" :key="elem.code" :label="elem.name" :value="elem.code" />
</el-select>
</el-col>
<el-col :span="6" :offset="1">
<el-select v-if="stationShow.includes(item.type)" v-model="item.deviceCode" placeholder="请选择" size="mini">
<el-option v-for="elem in stationList" :key="elem.code" :label="elem.name" :value="elem.code" />
</el-select>
<span v-else>--</span>
</el-col>
<el-col :span="4" style="text-align: center;">
<el-button type="primary" size="mini" @click="deleteClient(index)">删除</el-button>
</el-col>
</el-row>
</div>
<el-tabs v-model="clientActive" class="card" style="height: 100%">
<el-tab-pane class="view-control" label="地铁CBTC" name="METRO">
<client-show-list :client-list="clientMetroList" :station-list="stationList" :terminals="getTerminals('METRO')" />
</el-tab-pane>
<el-tab-pane class="view-control" label="大铁CTC" name="RAILWAY">
<client-show-list :client-list="clientRailwayList" :station-list="stationList" :terminals="getTerminals('RAILWAY')" />
</el-tab-pane>
<el-tab-pane class="view-control" label="应急调度" name="EMERGENCY">
<client-show-list :client-list="clientRailwayList" :station-list="stationList" :terminals="getTerminals('EMERGENCY')" />
</el-tab-pane>
</el-tabs>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="createClient">新建</el-button>
@ -46,6 +30,13 @@
/>
</el-select>
</el-form-item>
<el-form-item label="分站:" prop="isStationGen">
<el-checkbox-group v-model="generationForm.isStationGen">
<el-checkbox label="localWork">现地工作站</el-checkbox>
<el-checkbox label="ibp">IBP</el-checkbox>
<el-checkbox label="psl">PSL</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
<div style="text-align: center;">
<el-button size="small" type="primary" @click="keyGeneration">一键生成</el-button>
@ -56,10 +47,11 @@
<script>
import {mapGetters} from 'vuex';
import ClientShowList from './list';
export default {
name: 'Terminals',
components: {
ClientShowList
},
props: {
@ -67,24 +59,31 @@ export default {
data() {
return {
activeName: 'first',
clientActive: 'METRO',
lazy: true,
memberActive: 'METRO',
generationForm: {
systemType: 'METRO'
systemType: 'METRO',
isStationGen: []
},
systemList: [
{ label: '地铁CBTC', value: 'METRO' },
{ label: '大铁CTC', value: 'RAILWAY' },
{ label: '应急调度', value: 'EMERGENCY' }
],
// mapClientVOList: [],
stationShow: ['localWork']
stationShow: ['localWork', 'ibp', 'psl']
};
},
computed: {
...mapGetters('map', ['stationList']),
mapClientVOList() {
return this.$store.state.map.map.mapClientVOList;
clientMetroList() {
return this.$store.state.map.map.mapClientVOMap.METRO;
},
clientRailwayList() {
return this.$store.state.map.map.mapClientVOMap.RAILWAY;
},
clientEmergencyList() {
return this.$store.state.map.map.mapClientVOMap.EMERGENCY;
}
},
watch: {
@ -99,48 +98,71 @@ export default {
methods: {
createClient() {
const obj = {
id: this.getId(),
id: this.getId(this.clientActive),
name: '',
type: '',
deviceCode: ''
};
this.mapClientVOList.push(obj);
switch (this.clientActive) {
case 'METRO':
this.clientMetroList.push(obj);
break;
case 'RAILWAY':
this.clientRailwayList.push(obj);
break;
case 'EMERGENCY':
this.clientEmergencyList.push(obj);
break;
}
},
getId() {
const list = [];
this.mapClientVOList.forEach(item => {
getId(type) {
let id = 0;
if (type === 'METRO') {
this.clientMetroList.forEach(item => {
if (item.id) {
list.push(item.id.slice(9));
id = Math.max(parseInt(item.id.slice(8)), id);
}
});
const maxNum = list.length ? Math.max(...list) : 0;
return `terminals${maxNum + 1}`;
},
deleteClient(index) {
this.mapClientVOList.splice(index, 1);
return 'ter_met_' + (id + 1);
} else if (type === 'RAILWAY') {
this.clientRailwayList.forEach(item => {
if (item.id) {
id = Math.max(parseInt(item.id.slice(8)), id);
}
});
return 'ter_rai_' + id;
} else if (type === 'EMERGENCY') {
this.clientEmergencyList.forEach(item => {
if (item.id) {
id = Math.max(parseInt(item.id.slice(8)), id);
}
});
return 'ter_eme_' + id;
}
},
keyGeneration() {
this.mapClientVOList.splice(0, this.mapClientVOList.length);
const clientList = this.$store.state.map.map.mapClientVOMap[this.generationForm.systemType];
clientList.splice(0, clientList.length);
const terminalsList = this.getTerminals(this.generationForm.systemType);
terminalsList.forEach(item => {
if (this.stationShow.includes(item.code)) {
if (this.generationForm.isStationGen.includes(item.code)) {
this.stationList.forEach(ii => {
const obj = {
id: this.getId(),
id: this.getId(this.generationForm.systemType),
name: `${item.name}-${ii.name}`,
type: item.code,
deviceCode: ii.code
};
this.mapClientVOList.push(obj);
clientList.push(obj);
});
} else {
const obj = {
id: this.getId(),
id: this.getId(this.generationForm.systemType),
name: item.name,
type: item.code,
deviceCode: ''
};
this.mapClientVOList.push(obj);
clientList.push(obj);
}
});
},

View File

@ -110,6 +110,14 @@
:value="item.value"
/>
</el-select>
<el-select v-else-if="scope.row.type === 'multiple'" v-model="scope.row.value" multiple size="mini">
<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>
@ -131,8 +139,10 @@ import { getPassengerFlowData } from '@/api/simulation';
import { queryPaperList } from '@/api/management/exam';
import { getTrainingDetailNew } from '@/api/jmap/training';
import ChooseTraining from './chooseTraining';
import { ClientList, TrainingTypeList } from '@/scripts/ConstDic';
import { TrainingTypeList } from '@/scripts/ConstDic';
import { getUploadUrl } from '@/api/projectConfig';
import { getClientDataById } from '@/api/jmap/map';
export default {
name: 'EditSubsystem',
components: {
@ -147,11 +157,13 @@ export default {
loginProLogoImg: '',
memberList: [],
examList: [],
clientMap: {},
lpfDataList: [],
frontTableData: [
{ key: 'singleMember', label: '是否单角色', value: false, type: 'checkbox' },
{ key: 'singleClient', label: '是否单客户端', value: false, type: 'checkbox' },
{ key: 'client', label: '初始客户端', value: '', type: 'select', optionList: ClientList},
{ key: 'clientList', label: '客户端列表', value: [], type: 'multiple', optionList: [] },
{ key: 'client', label: '初始客户端', value: '', type: 'select', optionList: []},
{ key: 'hasTraining', label: '是否有实训', value: false, type: 'checkbox'},
{ key: 'trainingType', label: '实训类型', value: '', type: 'select', optionList: TrainingTypeList },
{ key: 'hasExam', label: '是否有考试', value: false, type: 'checkbox' },
@ -214,6 +226,13 @@ export default {
}).catch(e => {
this.$message.error('获取大客流数据失败!');
});
getClientDataById(this.$route.query.mapId).then(resp => {
this.clientMap = resp.data;
this.initClientList();
}).catch(e => {
console.error(e, 'w');
this.$message.error('获取客户端数据失败!');
});
try {
const stationResp = await querySimulationStationsByMapId(this.$route.query.mapId);
const memberResp = await querySimulationMemberByMapId(this.$route.query.mapId);
@ -243,6 +262,19 @@ export default {
}
},
methods: {
initClientList() {
const clientListItem = this.frontTableData.find(item => item.key === 'clientList');
const clientItem = this.frontTableData.find(item => item.key === 'client');
const clientList = [];
console.log(this.clientMap, this.ruleForm.type);
if (this.clientMap[this.ruleForm.type]) {
this.clientMap[this.ruleForm.type].forEach(item => {
clientList.push({ label: item.name, value: item.id });
});
}
clientListItem.optionList = clientList;
clientItem.optionList = clientList;
},
doShow(row) {
if (row && row.id) {
this.mapSystemId = row.id;
@ -293,6 +325,7 @@ export default {
}
const defaultMember = this.endTableData.find(item => item.key === 'DEFAULT_MEMBER');
defaultMember.optionList = this.memberList;
this.initClientList();
},
handleMember(member, stationList) {
const data = { value: member.id, label: '', memberType: member.type };
@ -379,7 +412,8 @@ export default {
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: 'clientList', label: '客户端列表', value: [], type: 'multiple', optionList: [] },
{ key: 'client', label: '初始客户端', value: '', type: 'select', optionList: []},
{ key: 'hasTraining', label: '是否有实训', value: false, type: 'checkbox'},
{ key: 'trainingType', label: '实训类型', value: '', type: 'select', optionList: TrainingTypeList },
{ key: 'hasExam', label: '是否有考试', value: false, type: 'checkbox' },