2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-11-13 11:17:46 +08:00
|
|
|
<div>
|
|
|
|
<div class="schema" :style="{top: offset+'px'}">
|
|
|
|
<el-select v-if="isScript" v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
|
|
|
|
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
|
|
|
|
</el-select>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-11-13 11:17:46 +08:00
|
|
|
<el-button-group>
|
|
|
|
<!-- viewRunQuest -->
|
|
|
|
<el-button v-if="isDemon && isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
|
|
|
|
<el-button v-if="isDemon && !isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
|
|
|
|
<el-button v-if="notScript && runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
|
|
|
|
<el-button v-if="!runing && !isPlan && notScript" size="small" :disabled="viewDisabled" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
|
|
|
|
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('display.schema.faultSetting') }}</el-button>
|
|
|
|
</el-button-group>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-11-13 11:17:46 +08:00
|
|
|
<el-radio-group v-if="!isPlan" v-model="mode" size="small" @change="changeOperateMode(mode)">
|
|
|
|
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('display.schema.normalOperation') }}</el-radio-button>
|
|
|
|
<el-radio-button class="mode" :label="OperateMode.FAULT">{{ $t('display.schema.faultOperation') }}</el-radio-button>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
<fault-choose v-if="isDemon || isPlan || isScript" ref="faultChoose" :group="group" />
|
|
|
|
<run-plan-Load ref="runPlanLoad" :group="group" />
|
|
|
|
<run-plan-view ref="runPlanView" :group="group" />
|
|
|
|
<add-quest ref="addQuest" @selectQuest="selectQuest" />
|
2019-08-01 15:19:24 +08:00
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-11-13 11:17:46 +08:00
|
|
|
import RunPlanLoad from './demon/runPlanLoad';
|
|
|
|
import RunPlanView from './demon/runPlanView';
|
|
|
|
import FaultChoose from './demon/faultChoose';
|
|
|
|
import AddQuest from './demon/addQuest';
|
2019-08-01 15:19:24 +08:00
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { OperateMode } from '@/scripts/ConstDic';
|
2019-10-30 16:50:35 +08:00
|
|
|
import { getStationList, queryRunPlan } from '@/api/runplan';
|
2019-08-01 15:19:24 +08:00
|
|
|
import { getEveryDayRunPlanData } from '@/api/simulation';
|
2019-10-08 18:35:02 +08:00
|
|
|
import {getRpDetailByUserMapId} from '@/api/designPlatform';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-01 15:19:24 +08:00
|
|
|
export default {
|
2019-10-30 16:50:35 +08:00
|
|
|
name: 'MenuSchema',
|
2019-11-13 11:17:46 +08:00
|
|
|
components: {
|
|
|
|
RunPlanLoad,
|
|
|
|
RunPlanView,
|
|
|
|
FaultChoose,
|
|
|
|
AddQuest
|
|
|
|
},
|
2019-10-30 16:50:35 +08:00
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
offset: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mode: OperateMode.NORMAL,
|
|
|
|
OperateMode: OperateMode,
|
|
|
|
viewDisabled: true,
|
|
|
|
runing: false,
|
2019-11-12 18:31:16 +08:00
|
|
|
swch: '01',
|
2019-10-30 16:50:35 +08:00
|
|
|
swchList: [
|
|
|
|
{ value: '01', name: '现地' },
|
|
|
|
{ value: '02', name: '行调' }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('runPlan', [
|
|
|
|
'stations'
|
|
|
|
]),
|
|
|
|
notScript() {
|
|
|
|
return this.$route.params.mode !== 'script';
|
|
|
|
},
|
|
|
|
isPlan() {
|
|
|
|
return this.$route.params.mode === 'plan';
|
|
|
|
},
|
|
|
|
isScript() {
|
2019-11-12 17:58:45 +08:00
|
|
|
return this.$route.params.mode === 'script';
|
2019-10-30 16:50:35 +08:00
|
|
|
},
|
|
|
|
isDemon() {
|
|
|
|
return this.$route.params.mode === 'demon';
|
|
|
|
},
|
|
|
|
isDesignPlatform() {
|
|
|
|
return this.$route.fullPath.includes('design/display/demon');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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() {
|
|
|
|
await this.loadRunData(this.$route.query);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadRunData(opt) {
|
|
|
|
this.$store.dispatch('runPlan/clear').then(() => {
|
|
|
|
if (opt && opt.mapId) {
|
|
|
|
this.viewDisabled = true;
|
|
|
|
getStationList(opt.mapId).then(response => {
|
|
|
|
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
|
|
|
|
if (this.$route.params.mode == 'plan') {
|
|
|
|
if (this.$route.query.from == 'user') {
|
|
|
|
// 测试运行图功能
|
|
|
|
getRpDetailByUserMapId(this.$route.query.planId).then(resp => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', resp.data);
|
|
|
|
this.viewDisabled = false;
|
|
|
|
}).catch(() => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', []);
|
|
|
|
this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// 测试运行图功能
|
|
|
|
queryRunPlan(this.$route.query.planId).then(resp => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', resp.data);
|
|
|
|
this.viewDisabled = false;
|
|
|
|
}).catch(() => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', []);
|
|
|
|
this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
|
|
|
|
});
|
|
|
|
}
|
2019-10-08 18:35:02 +08:00
|
|
|
|
2019-10-30 16:50:35 +08:00
|
|
|
} else {
|
|
|
|
getEveryDayRunPlanData(this.group).then(resp => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', resp.data);
|
|
|
|
this.viewDisabled = false;
|
|
|
|
}).catch(error => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', []);
|
|
|
|
if (error.code == 30001) {
|
|
|
|
this.$messageBox(this.$t('display.schema.todayRunDiagramNoLoad'));
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('display.schema.getStationListFail'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
changeOperateMode(handle) {
|
|
|
|
this.$store.dispatch('training/changeOperateMode', { mode: handle });
|
|
|
|
},
|
|
|
|
setRuning(run) {
|
|
|
|
this.runing = run;
|
|
|
|
},
|
|
|
|
setFault() {
|
2019-11-13 11:17:46 +08:00
|
|
|
this.$refs.faultChoose.doShow();
|
2019-10-30 16:50:35 +08:00
|
|
|
},
|
|
|
|
loadRunPlan() {
|
2019-11-13 11:17:46 +08:00
|
|
|
this.$refs.runPlanLoad.doShow();
|
2019-10-30 16:50:35 +08:00
|
|
|
},
|
|
|
|
viewRunPlan() {
|
2019-11-13 11:17:46 +08:00
|
|
|
this.$refs.runPlanView.doShow();
|
2019-10-30 16:50:35 +08:00
|
|
|
},
|
|
|
|
viewRunQuest() {
|
2019-11-13 11:17:46 +08:00
|
|
|
this.$refs.addQuest.doShow();
|
2019-10-30 16:50:35 +08:00
|
|
|
},
|
|
|
|
viewScriptRoles() {
|
2019-11-13 11:17:46 +08:00
|
|
|
const row = {id: this.$route.query.scriptId};
|
|
|
|
this.$refs.addQuest.handleLoad(1, row);
|
|
|
|
},
|
|
|
|
selectQuest(row, id, mapLocation, roleName) {
|
|
|
|
this.$emit('selectQuest', row, id, mapLocation, roleName);
|
2019-10-30 16:50:35 +08:00
|
|
|
},
|
|
|
|
switchMode(swch) {
|
|
|
|
this.$emit('switchMode', swch);
|
|
|
|
}
|
|
|
|
}
|
2019-08-01 15:19:24 +08:00
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
.schema {
|
|
|
|
z-index: 9;
|
|
|
|
display: inline;
|
|
|
|
position: absolute;
|
|
|
|
right: 15px;
|
|
|
|
}
|
|
|
|
|
|
|
|
/deep/ .el-button+.el-button {
|
|
|
|
margin-left: 0px;
|
|
|
|
}
|
2019-08-01 15:19:24 +08:00
|
|
|
</style>
|