This commit is contained in:
joylink_cuiweidong 2020-12-28 16:25:49 +08:00
commit 0b606fbc56

View File

@ -66,7 +66,7 @@
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { mapGetters } from 'vuex';
import ConfirmControl from './childDialog/confirmControl';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { getStationList } from '@/api/runplan';
export default {
name: 'StandRunLevel',
@ -84,7 +84,8 @@ export default {
selection: [],
isSelect: true,
isConfirm: false,
time: ''
time: '',
sortStationList: []
};
},
computed: {
@ -132,6 +133,7 @@ export default {
}
},
mounted() {
this.sortStationList = [];
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
@ -139,21 +141,40 @@ export default {
methods: {
loadInitData(selected) {
this.tempData = [];
const index = this.stationList.findIndex(n => n.code == selected.stationCode);
if (selected.direction == '01') { //
//
if (index != 0) {
const stationStand = this.$store.getters['map/getDeviceByCode'](this.stationStandList[index + 1].code);
const station = this.$store.getters['map/getDeviceByCode'](stationStand.stationCode);
this.tempData.push({ name: `${stationStand.name}(${station.name})`, time: selected.runLevelTime ? selected.runLevelTime : 0, check: !!selected.runLevelTimeForever });
}
if (!this.sortStationList.length) {
getStationList(this.$route.query.mapId).then(resp => {
this.sortStationList = resp.data;
this.handleTempData(selected);
});
} else {
//
if (index != this.stationList.length) {
const stationStand = this.$store.getters['map/getDeviceByCode'](this.stationStandList[index + 1].code);
const station = this.$store.getters['map/getDeviceByCode'](stationStand.stationCode);
this.tempData.push({ name: `${stationStand.name}(${station.name})`, time: selected.runLevelTime ? selected.runLevelTime : 0, check: !!selected.runLevelTimeForever });
}
this.handleTempData(selected);
}
},
handleTempData(selected) {
const stationIndex = this.sortStationList.findIndex((item) => item.code == selected.stationCode);
if (selected.right) {
const nextStation = this.sortStationList[stationIndex + 1];
let nextStationStand = '';
this.stationStandList.forEach(stand => {
if (stand.stationCode === nextStation.code && stand.right) { nextStationStand = stand; }
});
nextStation && nextStationStand && this.tempData.push({
name: `${nextStationStand.name}(${nextStation.name})`,
time: selected.runLevelTime ? selected.runLevelTime : 0,
check: !!selected.runLevelTimeForever
});
} else {
const nextStation = this.sortStationList[stationIndex - 1];
let nextStationStand = '';
this.stationStandList.forEach(stand => {
if (stand.stationCode === nextStation.code && stand.right) { nextStationStand = stand; }
});
console.log(nextStation, nextStationStand, '========');
nextStation && nextStationStand && this.tempData.push({
name: `${nextStationStand.name}(${nextStation.name})`,
time: selected.runLevelTime ? selected.runLevelTime : 0,
check: !!selected.runLevelTimeForever
});
}
},
doShow(operate, selected) {