This commit is contained in:
joylink_cuiweidong 2020-12-16 11:15:29 +08:00
commit 4eb8d4e5be
5 changed files with 82 additions and 58 deletions

View File

@ -2,10 +2,10 @@ 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.107:9000'; // 袁琪
// BASE_API = 'http://192.168.8.129:9000'; // 旭强
BASE_API = 'http://192.168.8.119:9000'; // 张赛
// BASE_API = 'http://192.168.8.119:9000'; // 张赛
// BASE_API = 'http://192.168.8.110:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -4,6 +4,7 @@
<select-station v-if="isLocalStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
<template v-if="!dataError&& project !== 'bjd'">
<el-button-group>
<el-button v-if="isLocalStation" size="small" @click="goIbp">IBP盘</el-button>
<el-button v-if="isScheduling && isDepot" size="small" type="primary" @click="runPlanEditShow">运行图编辑</el-button>
<!-- 加载剧本 -->
<el-button v-if="isDemon && !isScheduling && !isContest" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
@ -37,6 +38,7 @@ import { getByGroupStationList } from '@/api/jmap/map';
import { getEveryDayRunPlanNew } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth';
import { getToken } from '@/utils/auth';
import { getIbpInfoByStation } from '@/api/ibp';
//
export default {
@ -238,6 +240,34 @@ export default {
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
goIbp() {
const deviceCode = this.$refs.selectStation.showStation;
getIbpInfoByStation(this.$route.query.mapId, deviceCode).then(resp => {
if (resp.data) {
const routeData = this.$router.resolve({
path:`/ibpShow`,
query:{
lineCode: this.$route.query.lineCode,
mapId: this.$route.query.mapId,
group: this.$route.query.group,
stationCode: deviceCode,
loadAll: true,
noPreLogout: true
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
} else {
this.$messageBox('本车站暂无IBP盘数据');
}
}).catch((error) => {
if (error.code == '10007') {
this.$messageBox('本车站暂无IBP盘数据');
} else {
this.$message.error('获取IBP盘数据异常');
}
});
}
}
};

View File

@ -1,10 +1,11 @@
<template>
<el-select v-if="showSelectStation" v-model="showStation" :style="styleCss" size="small" @change="switchStationMode">
<el-select 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>
</template>
<script>
import { mapGetters } from 'vuex';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
export default {
name:'SelectStation',
props:{
@ -16,8 +17,10 @@ export default {
data() {
return {
stationListMode: [], //
showStation: '', //
showSelectStation: false // select
showMemberId: '', // memberId
oldShowMemberId: '',
stationCentralizedMap: {},
showStation: ''
};
},
computed:{
@ -27,45 +30,44 @@ export default {
])
},
watch:{
'stationList': function () {
this.setStationList();
},
'$store.state.map.mapViewLoadedCount': function (val) { //
this.setMode();
this.setStationList();
this.switchStationMode(this.showStation);
},
'$store.state.training.centerStationCode': function(code) {
if (code) {
this.showStation = code;
'$store.state.training.memberData': function (val) {
this.$store.state.training.memberList.forEach(item => {
if (item.type === 'STATION_SUPERVISOR') {
const station = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
this.stationListMode.push({value:item.id, name: station.name});
}
});
},
'$store.state.training.prdType': function (val) { //
this.setMode();
},
'$store.state.socket.simulationStart':function(val) {
if (val) {
if (this.$route.query.lineCode == '06') {
this.switchStationMode(this.showStation);// 线
'$store.state.training.simulationUserList': function(val) {
this.$store.state.training.simulationUserList.forEach(item => {
if (item.userId == this.$store.state.user.id) {
this.showMemberId = item.memberId;
this.oldShowMemberId = item.memberId;
}
});
this.stationList.forEach(item => {
if (item.centralized) {
this.stationCentralizedMap[item.code] = item.code;
item.chargeStationCodeList.forEach(ele => {
this.stationCentralizedMap[ele] = item.code;
});
}
});
console.log(this.showMemberId, 'ddddd');
this.switchStationMode( this.showMemberId);
}
},
methods:{
setMode() {
if (this.map) {
this.showSelectStation = this.map.skinVO.code === '06' && this.$store.state.training.prdType === '01';
}
},
switchStationMode(val) {
if (this.stationListMode.length > 0) {
if (val == null) {
this.showStation = this.stationListMode[0].value;
} else {
this.showStation = val;
}
assignUsersPlayRoles([{ userId: this.$store.state.user.id, memberId: val}], this.$route.query.group).then(resp => {
this.showMemberId = val;
const nameList = Object.keys(this.$store.state.map.map);
let list = [];
const member = this.$store.state.training.memberData[val];
const station = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
this.showStation = station.code;
const showStationCode = this.stationCentralizedMap[station.code];
console.log(station, member);
nameList.forEach(item => {
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
if (item === 'trainList') {
@ -77,25 +79,15 @@ export default {
}
}
});
this.$jlmap.updateShowStation(list, this.showStation);
this.setCenter(this.showStation);
// this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation);
// this.$store.dispatch('map/setShowCentralizedStationNum');
}
this.$jlmap.updateShowStation(list, showStationCode);
this.setCenter(showStationCode);
}).catch(() => {
this.showMemberId = this.oldShowMemberId;
this.$message.error('调整角色成员失败!');
});
},
setCenter(code) {
this.$jlmap.setCenter(code);
},
setStationList() {
this.stationListMode = [];
(this.stationList || []).forEach(item => {
if (item.centralized) {
this.stationListMode.push({value: item.code, name: item.name});
}
});
if (this.stationListMode.length && this.showSelectStation) {
this.showStation = this.stationListMode[0].value;
}
}
}
};

View File

@ -240,7 +240,7 @@ export default {
this.$messageBox('本车站暂无IBP盘数据');
}
}).catch((error) => {
if (error.code == '30001') {
if (error.code == '10007') {
this.$messageBox('本车站暂无IBP盘数据');
} else {
this.$message.error('获取IBP盘数据异常');

View File

@ -68,11 +68,13 @@ export default {
},
watch: {
'$store.state.runPlan.planLoadedCount': function() {
if (this.$store.state.runPlan.runPlanInfo && this.$store.state.runPlan.runPlanInfo.id) {
this.currentPlanId = this.$store.state.runPlan.runPlanInfo.id;
this.tableData.forEach(item => {
item.$loading = item.id === this.currentPlanId;
});
}
}
},
methods: {
doShow() {