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; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // 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.107:9000'; // 袁琪
// BASE_API = 'http://192.168.8.129: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://192.168.8.110:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.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;'" /> <select-station v-if="isLocalStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
<template v-if="!dataError&& project !== 'bjd'"> <template v-if="!dataError&& project !== 'bjd'">
<el-button-group> <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="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> <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 { getEveryDayRunPlanNew } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getIbpInfoByStation } from '@/api/ibp';
// //
export default { export default {
@ -238,6 +240,34 @@ export default {
} }
}); });
window.open(routeData.href, '_blank', 'noopener noreferrer'); 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> <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-option v-for="item in stationListMode" :key="item.value" :label="item.name" :value="item.value" />
</el-select> </el-select>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
export default { export default {
name:'SelectStation', name:'SelectStation',
props:{ props:{
@ -16,8 +17,10 @@ export default {
data() { data() {
return { return {
stationListMode: [], // stationListMode: [], //
showStation: '', // showMemberId: '', // memberId
showSelectStation: false // select oldShowMemberId: '',
stationCentralizedMap: {},
showStation: ''
}; };
}, },
computed:{ computed:{
@ -27,45 +30,44 @@ export default {
]) ])
}, },
watch:{ watch:{
'stationList': function () { '$store.state.training.memberData': function (val) {
this.setStationList(); this.$store.state.training.memberList.forEach(item => {
}, if (item.type === 'STATION_SUPERVISOR') {
'$store.state.map.mapViewLoadedCount': function (val) { // const station = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
this.setMode(); this.stationListMode.push({value:item.id, name: station.name});
this.setStationList();
this.switchStationMode(this.showStation);
},
'$store.state.training.centerStationCode': function(code) {
if (code) {
this.showStation = code;
}
},
'$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:{ methods:{
setMode() {
if (this.map) {
this.showSelectStation = this.map.skinVO.code === '06' && this.$store.state.training.prdType === '01';
}
},
switchStationMode(val) { switchStationMode(val) {
if (this.stationListMode.length > 0) { assignUsersPlayRoles([{ userId: this.$store.state.user.id, memberId: val}], this.$route.query.group).then(resp => {
if (val == null) { this.showMemberId = val;
this.showStation = this.stationListMode[0].value;
} else {
this.showStation = val;
}
const nameList = Object.keys(this.$store.state.map.map); const nameList = Object.keys(this.$store.state.map.map);
let list = []; 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 => { nameList.forEach(item => {
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) { if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
if (item === 'trainList') { if (item === 'trainList') {
@ -77,25 +79,15 @@ export default {
} }
} }
}); });
this.$jlmap.updateShowStation(list, this.showStation); this.$jlmap.updateShowStation(list, showStationCode);
this.setCenter(this.showStation); this.setCenter(showStationCode);
// this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation); }).catch(() => {
// this.$store.dispatch('map/setShowCentralizedStationNum'); this.showMemberId = this.oldShowMemberId;
} this.$message.error('调整角色成员失败!');
});
}, },
setCenter(code) { setCenter(code) {
this.$jlmap.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盘数据'); this.$messageBox('本车站暂无IBP盘数据');
} }
}).catch((error) => { }).catch((error) => {
if (error.code == '30001') { if (error.code == '10007') {
this.$messageBox('本车站暂无IBP盘数据'); this.$messageBox('本车站暂无IBP盘数据');
} else { } else {
this.$message.error('获取IBP盘数据异常'); this.$message.error('获取IBP盘数据异常');

View File

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