车辆段显示调整

This commit is contained in:
fan 2021-09-14 17:10:00 +08:00
parent 43b8751d55
commit 05854c4239
6 changed files with 1353 additions and 1260 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.152:9000'; // 袁琪
// BASE_API = 'http://192.168.8.177:9000'; // 旭强
BASE_API = 'http://192.168.8.177:9000'; // 旭强
// BASE_API = 'http://192.168.2.183:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -219,7 +219,7 @@ export default {
});
},
async start() {
const jumpFunc = ['jump', 'jump', 'enterIntegratedSimulation', 'jump', 'jumpScheduling', 'enterISCS', 'enterScreen'];
const jumpFunc = ['jump', 'jump', 'enterIntegratedSimulation', 'jump', 'jumpScheduling', 'enterISCS', 'enterScreen', '', 'jump'];
this[jumpFunc[parseInt(this.courseModel.prdType) - 1]]();
},
jumpSimulation() {

View File

@ -1,7 +1,7 @@
<template>
<div>
<div class="schema" :style="{top: offset+'px'}">
<select-station v-if="isLocalStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
<select-station v-if="isShowSelectStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
<el-select v-model="speed" style="width: 100px;" size="small" @change="speedChange">
<el-option
v-for="item in speedList"
@ -110,6 +110,9 @@ export default {
isLocalStation() {
return this.$store.state.training.prdType === '01';
},
isShowSelectStation() {
return this.$store.state.training.prdType === '01' || this.$store.state.training.prdType === '09';
},
running() {
return this.$store.state.training.started;
},

View File

@ -1,7 +1,12 @@
<template>
<el-select v-model="oldShowMemberId" :style="styleCss" size="small" @change="switchStationMode">
<span>
<el-select v-if="$store.state.training.prdType === '01'" v-model="oldShowMemberId" :style="styleCss" size="small" @change="switchStationMode">
<el-option v-for="item in stationListMode" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-select v-else-if="$store.state.training.prdType === '09'" v-model="oldShowMemberId" :style="styleCss" size="small" @change="switchStationMode">
<el-option v-for="item in depotListMode" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</span>
</template>
<script>
import { mapGetters } from 'vuex';
@ -19,6 +24,7 @@ export default {
data() {
return {
stationListMode: [], //
depotListMode: [],
showMemberId: '', // memberId
oldShowMemberId: '',
stationCentralizedMap: {},
@ -57,12 +63,6 @@ export default {
this.showMemberId = val;
const member = this.$store.state.training.memberData[val];
const station = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
// const lineCode = this.$store.getters['map/lineCode'];
// if ((lineCode === '02' || lineCode === '05') && station) {
// this.showStation = station.code;
// const showStationCode = this.stationCentralizedMap[station.code];
// this.setCenter(showStationCode);
// } else
if (station) {
this.showStation = station.code;
const showStationCode = this.stationCentralizedMap[station.code];
@ -72,7 +72,7 @@ export default {
list.push(mapDevice[key]);
}
this.$store.dispatch('training/setRoleDeviceCode', station.code);
this.$jlmap.updateShowStation(list, showStationCode);
this.$jlmap.updateShowStation(list, showStationCode || station.code);
this.setCenter(showStationCode);
}
}).catch((err) => {
@ -92,6 +92,11 @@ export default {
if (station) {
this.stationListMode.push({value:item.id, name: station.name});
}
} else if (item.type === 'DEPOT_DISPATCHER') {
const station = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
if (station) {
this.depotListMode.push({value:item.id, name: station.name});
}
}
});
},
@ -100,6 +105,9 @@ export default {
if (item.type === 'STATION_SUPERVISOR' && item.userId == this.$store.state.user.id) {
this.showMemberId = item.memberId;
this.oldShowMemberId = item.memberId;
} else if (item.type === 'DEPOT_DISPATCHER' && item.userId == this.$store.state.user.id) {
this.showMemberId = item.memberId;
this.oldShowMemberId = item.memberId;
}
});
this.stationList.forEach(item => {

View File

@ -1,11 +1,47 @@
<template>
<div v-loading="loading" class="view-control-content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
<el-table-column label="车站">
<template slot-scope="scope">
<template v-for="stationCode in scope.row.stationCodeList">
<span :key="stationCode" style="margin-left: 10px">{{ getDeviceName(stationCode) }}</span>
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native.prevent="editModel(tableData, scope.$index)">
编辑
</el-button>
<el-button type="text" size="small" @click.native.prevent="deleteModel(tableData, scope.$index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-card class="box-card" shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header">
<span>请选择车辆段显示设备</span>
<div slot="header" class="clearfix">
<span style="font-size: 12px;">{{ cardTitle }}</span>
<el-button style="float: right; padding: 3px 3px" type="text" @click="clear">清空</el-button>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div style="padding: 10px;font-size: 14px;">
<div>
<span>车站</span>
<el-select v-model="addModel.stationCodeList" size="mini" style="width: 300px;" multiple placeholder="请选择">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div class="content-box-list" style="margin-top: 10px;">
<div class="title-box">设备列表</div>
<div class="list-box" style="height:400px;overflow:auto">
@ -17,10 +53,9 @@
</div>
</div>
</el-card>
<div style="display: table; margin-left: 120px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" :loading="dataLoading" @click="generateData">自动生成</el-button>
<div style="display: table; margin-left: 150px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" @click="generateData">生成</el-button>
<el-button type="primary" size="small" :loading="dataLoading" @click="save">保存</el-button>
<el-button type="primary" size="small" :loading="dataLoading" @click="clear">清除</el-button>
<el-button type="primary" size="small" @click="back">返回</el-button>
</div>
</el-scrollbar>
@ -44,13 +79,21 @@ export default {
},
data() {
return {
tableData: [],
otherData: [],
addModel: {
type: 'DEPOT_IL',
type: 'LOCAL',
stationCodeList: [],
elementList: []
},
list: [],
field: '',
cardMode: 'generate',
index: '',
isPreview: true,
loading: false,
dataLoading:false
dataLoading:false,
depotStationList: []
};
},
computed: {
@ -74,7 +117,16 @@ export default {
'textList',
'totalGuideLockButtonVOList',
'seclectDeviceList'
])
]),
cardTitle() {
if (this.cardMode === 'generate') {
return '生成数据';
} else if (this.cardMode === 'edit') {
return '编辑数据';
} else {
return '';
}
}
},
watch: {
selected: function (val, oldVal) {
@ -86,9 +138,10 @@ export default {
},
methods: {
initData() {
this.$store.state.map.map.displayList.forEach(item => {
this.depotStationList = this.stationList.filter(elem => elem.depot);
this.$store.state.map.map.displayList.forEach( item => {
if (item.type === 'DEPOT_IL') {
this.addModel = item;
this.tableData.push(item);
} else {
this.otherData.push(item);
}
@ -111,6 +164,31 @@ export default {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name || device.code;
},
deleteModel(list, index) {
list.splice(index, 1);
this.list.pop();
this.clearData();
this.cardMode = 'generate';
},
editModel(list, index) {
this.addModel = list[index];
this.index = index;
this.cardMode = 'edit';
},
cancelOverlab() {
this.cardMode = 'generate';
this.clear();
},
updateOverlab() {
if (this.index || this.index == 0) {
this.clearData();
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
}
this.tableData.splice(this.index, 1, this.addModel);
}
},
//
delList(model, list) {
list.forEach((nor, index) => {
@ -124,32 +202,17 @@ export default {
}
});
},
clear() {
this.addModel = { type: 'DEPOT_IL', elementList: [] };
const map = this.$store.state.map.map;
const param = {
displayList: [...this.otherData],
mapId: this.$route.params.mapId
};
this.dataLoading = true;
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存车辆段配置成功');
this.dataLoading = false;
}).catch(() => {
this.dataLoading = false;
this.$messageBox('保存车辆段配置失败');
});
},
save() {
const map = this.$store.state.map.map;
const param = {
displayList: [...this.otherData, this.addModel],
displayList: [...this.tableData, ...this.otherData],
mapId: this.$route.params.mapId
};
this.dataLoading = true;
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存车辆段配置成功');
this.dataLoading = false;
this.cancelOverlab();
}).catch(() => {
this.dataLoading = false;
this.$messageBox('保存车辆段配置失败');
@ -158,36 +221,55 @@ export default {
back() {
this.$emit('goDraw');
},
generateOverlab() { //
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
}
this.tableData.push(this.addModel);
this.clearData();
},
clear() {
this.addModel = { type: 'DEPOT_IL', stationCodeList: [], elementList: [] };
},
clearData() {
this.addModel = { type: 'DEPOT_IL', stationCodeList: [], elementList: [] };
this.index = '';
this.cardMode = 'generate';
},
generateData() {
this.loading = true;
this.addModel = { type: 'DEPOT_IL', elementList: [] };
const station = this.stationList.find(item => item.depot);
this.tableData = [];
this.stationList.forEach(item => {
if (item.depot) {
this.tableData.push({type: 'DEPOT_IL', stationCodeList: [item.code], elementList: [item.code]});
}
});
[...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList,
...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList,
...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList].forEach(item => {
if (item.stationCode === station.code) {
this.addModel.elementList.push(item.code);
}
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.stationCode));
target && target.elementList.push(item.code);
});
[...this.directionRodList].forEach(item => {
if (item.deviceStationCode === station.code) {
this.addModel.elementList.push(item.code);
}
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.deviceStationCode));
target && target.elementList.push(item.code);
});
this.psdList.forEach(item => {
const stand = this.$store.getters['map/getDeviceByCode'](item.standCode);
if (stand.stationCode === station.code) {
this.addModel.elementList.push(item.code);
}
const target = this.tableData.find(elem => elem.stationCodeList.includes(stand.stationCode));
target && target.elementList.push(item.code);
});
const map = this.$store.state.map.map;
const param = {
displayList: [...this.otherData, this.addModel],
displayList: [...this.tableData, ...this.otherData],
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.loading = false;
this.$message.success('保存车辆段配置成功');
this.cancelOverlab();
}).catch(() => {
this.loading = false;
this.$messageBox('保存车辆段配置失败');