2020-01-06 18:39:44 +08:00
|
|
|
<template>
|
|
|
|
<div class="schema" :style="{top: offset+'px'}">
|
|
|
|
<el-select
|
2020-06-30 14:27:32 +08:00
|
|
|
v-if="isAdmin && adminMode"
|
2020-01-06 18:39:44 +08:00
|
|
|
v-model="swch"
|
|
|
|
size="small"
|
2020-03-25 15:22:52 +08:00
|
|
|
style="width: 100px;"
|
2020-01-06 18:39:44 +08:00
|
|
|
:placeholder="this.$t('rules.productTypeInput')"
|
|
|
|
@change="switchMode"
|
|
|
|
>
|
|
|
|
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
|
|
|
|
</el-select>
|
2020-05-19 13:41:48 +08:00
|
|
|
<el-select v-if="showSelectStation" v-model="chiShowStation" style="width: 100px;" size="small" @change="switchStationMode">
|
2020-03-25 15:22:52 +08:00
|
|
|
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
|
|
|
|
</el-select>
|
2020-01-06 18:39:44 +08:00
|
|
|
<el-button-group>
|
|
|
|
<template>
|
2020-05-09 20:24:59 +08:00
|
|
|
<el-button v-if="runing && !dataError" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
|
2020-01-06 18:39:44 +08:00
|
|
|
</template>
|
2020-06-30 14:27:32 +08:00
|
|
|
<template v-if="isAdmin && adminMode">
|
2020-05-09 20:24:59 +08:00
|
|
|
<el-button v-if="!runing && !dataError" size="small" type="warning" @click="loadRunPlan">
|
2020-01-06 18:39:44 +08:00
|
|
|
{{ $t('joinTraining.runGraphLoading') }}</el-button>
|
|
|
|
</template>
|
2020-06-30 14:27:32 +08:00
|
|
|
<template v-if="isAdmin && adminMode">
|
2020-05-09 20:24:59 +08:00
|
|
|
<el-button v-if="mode==OperateMode.FAULT && !dataError" size="small" type="danger" @click="setFault">{{ $t('joinTraining.faultSetting') }}</el-button>
|
2020-01-06 18:39:44 +08:00
|
|
|
</template>
|
|
|
|
</el-button-group>
|
|
|
|
<el-radio-group
|
2020-06-30 14:27:32 +08:00
|
|
|
v-if="isAdmin && adminMode && !dataError && !isScreen"
|
2020-01-06 18:39:44 +08:00
|
|
|
v-model="mode"
|
|
|
|
size="small"
|
|
|
|
@change="changeOperateMode(mode)"
|
|
|
|
>
|
|
|
|
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('joinTraining.normalOperation') }}</el-radio-button>
|
|
|
|
<el-radio-button class="mode" :label="OperateMode.FAULT">{{ $t('joinTraining.faultOperation') }}</el-radio-button>
|
|
|
|
</el-radio-group>
|
2020-06-30 14:27:32 +08:00
|
|
|
<el-radio-group v-if="isAdmin" v-model="adminMode" size="small" @change="changeAdminMode">
|
|
|
|
<el-radio-button class="mode" :label="true">管理模式</el-radio-button>
|
|
|
|
<el-radio-button class="mode" :label="false">演练模式</el-radio-button>
|
|
|
|
</el-radio-group>
|
2020-01-06 18:39:44 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { OperateMode } from '@/scripts/ConstDic';
|
2020-03-13 18:19:04 +08:00
|
|
|
// import { getStationList } from '@/api/runplan';
|
|
|
|
import { getByGroupStationList } from '@/api/jmap/map';
|
2020-03-17 14:54:03 +08:00
|
|
|
import { getEveryDayRunPlanNew } from '@/api/simulation';
|
2020-01-06 18:39:44 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'MenuDemonSchema',
|
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
offset: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
userRole: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
|
|
|
showSelectStation: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stationList: {
|
2020-04-21 11:26:07 +08:00
|
|
|
type: Array,
|
2020-03-25 15:22:52 +08:00
|
|
|
default() {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showStation: {
|
|
|
|
type: String,
|
|
|
|
default() {
|
|
|
|
return '';
|
|
|
|
}
|
2020-05-09 20:24:59 +08:00
|
|
|
},
|
|
|
|
dataError: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2020-06-30 14:27:32 +08:00
|
|
|
},
|
|
|
|
isAdmin: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mode: OperateMode.NORMAL,
|
|
|
|
OperateMode: OperateMode,
|
|
|
|
viewDisabled: true,
|
|
|
|
realData: {},
|
|
|
|
series: [],
|
2020-05-19 13:41:48 +08:00
|
|
|
chiShowStation: '',
|
2020-01-06 18:39:44 +08:00
|
|
|
kmRangeCoordMap: {},
|
|
|
|
runPlanData: {},
|
|
|
|
swch: '02',
|
|
|
|
swchList: [
|
|
|
|
{ value: '01', name: this.$t('joinTraining.local') },
|
2020-06-10 16:56:52 +08:00
|
|
|
{ value: '02', name: this.$t('joinTraining.lineAdjustment') },
|
|
|
|
{ value: '07', name: '大屏'}
|
2020-01-06 18:39:44 +08:00
|
|
|
],
|
|
|
|
runing: false,
|
2020-06-30 14:27:32 +08:00
|
|
|
userId: '',
|
|
|
|
adminMode: true
|
2020-01-06 18:39:44 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('runPlan', [
|
|
|
|
'stations'
|
|
|
|
]),
|
2020-06-10 16:56:52 +08:00
|
|
|
isScreen() {
|
|
|
|
return this.$store.state.training.prdType === '07';
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$store.state.training.started': function (val) {
|
|
|
|
this.setRuning(val);
|
|
|
|
},
|
|
|
|
'$store.state.training.switchcount': async function () {
|
|
|
|
if (this.group) {
|
|
|
|
const started = this.$store.state.training.started;
|
|
|
|
if (started) {
|
|
|
|
await this.loadRunData(this.$route.query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
this.userId = this.$store.state.user.id;
|
|
|
|
await this.loadRunData(this.$route.query);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadRunData(opt) {
|
|
|
|
this.$store.dispatch('runPlan/clear').then(resp => {
|
|
|
|
if (opt && opt.mapId) {
|
|
|
|
this.viewDisabled = true;
|
2020-03-13 18:19:04 +08:00
|
|
|
getByGroupStationList(this.$route.query.group).then(response => {
|
2020-01-06 18:39:44 +08:00
|
|
|
const stations = response.data;
|
|
|
|
this.$store.dispatch('runPlan/setStations', stations).then(() => {
|
2020-03-17 14:54:03 +08:00
|
|
|
getEveryDayRunPlanNew(this.group).then(resp => {
|
2020-01-06 18:39:44 +08:00
|
|
|
this.$store.dispatch('runPlan/setPlanData', resp.data);
|
2020-03-17 14:54:03 +08:00
|
|
|
this.$store.dispatch('runPlan/setInitialPlanData', resp.data);
|
2020-01-06 18:39:44 +08:00
|
|
|
this.viewDisabled = false;
|
|
|
|
}).catch(error => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', []);
|
|
|
|
if (error.code == 30001) {
|
|
|
|
this.$messageBox(this.$t('error.runGraphIsNotLoaded'));
|
|
|
|
} else {
|
2020-05-09 20:27:41 +08:00
|
|
|
!this.dataError && this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('error.obtainStationListFailed'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
switchMode(swch) {
|
2020-05-19 13:41:48 +08:00
|
|
|
this.chiShowStation = this.showStation;
|
2020-01-06 18:39:44 +08:00
|
|
|
this.$store.dispatch('training/setPrdType', swch);
|
|
|
|
},
|
2020-03-17 14:54:03 +08:00
|
|
|
initPlannedDriving(isDisable) {
|
|
|
|
this.isDisable = isDisable;
|
|
|
|
},
|
2020-01-06 18:39:44 +08:00
|
|
|
changeOperateMode(handle) {
|
|
|
|
this.$store.dispatch('training/changeOperateMode', { mode: handle });
|
|
|
|
},
|
|
|
|
setFault() {
|
|
|
|
this.$emit('faultChooseShow');
|
|
|
|
},
|
|
|
|
loadRunPlan() {
|
|
|
|
this.$emit('runPlanLoadShow');
|
|
|
|
},
|
|
|
|
viewRunPlan() {
|
|
|
|
this.$emit('runPlanViewShow');
|
|
|
|
},
|
|
|
|
setRuning(run) {
|
|
|
|
this.runing = run;
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
|
|
|
switchStationMode(val) {
|
|
|
|
this.$emit('switchStationMode', val);
|
2020-06-30 14:27:32 +08:00
|
|
|
},
|
|
|
|
changeAdminMode(adminMode) {
|
|
|
|
this.$emit('changeAdminMode', adminMode, this.swch);
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
.schema {
|
|
|
|
z-index: 9;
|
|
|
|
display: inline;
|
|
|
|
position: absolute;
|
|
|
|
right: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.schema .el-radio-group .el-radio-button__inner {
|
|
|
|
padding: 0px 15px 0px 15px;
|
|
|
|
height: 32px;
|
|
|
|
line-height: 32px;
|
|
|
|
font-size: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* /deep/ .el-button+ .el-button {
|
|
|
|
margin-left: 0px;
|
|
|
|
} */
|
|
|
|
</style>
|