2019-12-30 09:00:16 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div class="schema" :style="{top: offset+'px'}">
|
2020-05-19 09:45:15 +08:00
|
|
|
<el-select v-if="(isScript&&!isScriptCommand) || isDesignPlatform" v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
|
2019-12-30 09:00:16 +08:00
|
|
|
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
|
|
|
|
</el-select>
|
2020-05-20 14:50:34 +08:00
|
|
|
<!-- ||(isScriptCommand && isLocalStation) -->
|
2020-07-23 17:09:29 +08:00
|
|
|
<el-select v-if="showSelectStation&&((!isScriptCommand&&swch=='01')||(isScriptCommand && isLocalStation))" v-model="showStationContent" style="width: 100px;" size="small" @change="switchStationModeInfo">
|
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>
|
2019-12-30 09:00:16 +08:00
|
|
|
<el-button-group>
|
2020-05-09 20:24:59 +08:00
|
|
|
<el-button v-if="isDemon && isDesignPlatform && !dataError" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
|
2019-12-30 09:00:16 +08:00
|
|
|
<!-- 加载剧本 -->
|
2020-05-09 20:24:59 +08:00
|
|
|
<el-button v-if="isDemon && !isDesignPlatform && !isScheduling && !dataError" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
|
|
|
|
<el-button v-if="notScript && runing && !dataError" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
|
|
|
|
<el-button v-if="!runing && notScript && !dataError" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
|
2020-07-03 16:29:40 +08:00
|
|
|
<el-button v-if="mode==OperateMode.FAULT && !dataError" size="small" type="danger" @click="setFault">自动故障设置</el-button>
|
2019-12-30 09:00:16 +08:00
|
|
|
</el-button-group>
|
|
|
|
|
2020-05-09 20:24:59 +08:00
|
|
|
<el-radio-group v-if="!isScheduling && !dataError" v-model="mode" size="small" @change="changeOperateMode(mode)">
|
2019-12-30 09:00:16 +08:00
|
|
|
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('display.schema.normalOperation') }}</el-radio-button>
|
2020-07-03 16:29:40 +08:00
|
|
|
<el-radio-button class="mode" :label="OperateMode.FAULT">故障模式</el-radio-button>
|
2019-12-30 09:00:16 +08:00
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
2020-06-30 14:41:22 +08:00
|
|
|
<fault-choose v-if="isDemon || isScript" ref="faultChoose" :group="group" :offset="offset" />
|
2019-12-30 09:00:16 +08:00
|
|
|
<run-plan-Load ref="runPlanLoad" :group="group" />
|
|
|
|
<run-plan-view ref="runPlanView" :group="group" />
|
|
|
|
<!-- 加载剧本列表弹窗 -->
|
|
|
|
<add-quest ref="addQuest" @selectQuest="selectQuest" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import RunPlanLoad from './demon/runPlanLoad';
|
|
|
|
import RunPlanView from './demon/runPlanView';
|
|
|
|
import FaultChoose from './demon/faultChoose';
|
|
|
|
import AddQuest from './demon/addQuest';
|
|
|
|
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-06-29 15:55:31 +08:00
|
|
|
import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
|
2020-07-03 16:29:40 +08:00
|
|
|
import { getEveryDayRunPlanNew, loadScriptNew } from '@/api/simulation';
|
2020-06-29 15:55:31 +08:00
|
|
|
import Vue from 'vue';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
|
|
|
// 右上角操作
|
|
|
|
export default {
|
|
|
|
name: 'MenuSchema',
|
|
|
|
components: {
|
|
|
|
RunPlanLoad,
|
|
|
|
RunPlanView,
|
|
|
|
FaultChoose,
|
|
|
|
AddQuest
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
offset: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
|
|
|
showSelectStation: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stationList: {
|
2020-03-31 16:54:04 +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;
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mode: OperateMode.NORMAL,
|
|
|
|
OperateMode: OperateMode,
|
|
|
|
viewDisabled: true,
|
|
|
|
runing: false,
|
2020-07-23 17:09:29 +08:00
|
|
|
swch: '02',
|
2020-05-20 14:50:34 +08:00
|
|
|
showStationContent:'',
|
2020-05-19 09:45:15 +08:00
|
|
|
isScriptCommand:false,
|
2019-12-30 09:00:16 +08:00
|
|
|
swchList: [
|
|
|
|
{ value: '01', name: '现地' },
|
|
|
|
{ value: '02', name: '行调' }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('runPlan', [
|
|
|
|
'stations'
|
|
|
|
]),
|
2020-06-29 15:55:31 +08:00
|
|
|
group() {
|
|
|
|
return this.$route.query.group;
|
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
notScript() {
|
|
|
|
return this.$route.params.mode !== 'script';
|
|
|
|
},
|
|
|
|
isScript() {
|
|
|
|
return this.$route.params.mode === 'script';
|
|
|
|
},
|
|
|
|
isDemon() {
|
|
|
|
return this.$route.params.mode === 'demon';
|
|
|
|
},
|
|
|
|
isDesignPlatform() {
|
2020-05-11 15:43:36 +08:00
|
|
|
return this.$route.fullPath.includes('design/displayNew/demon');
|
2020-04-20 15:38:30 +08:00
|
|
|
},
|
|
|
|
isScheduling() {
|
|
|
|
return this.$route.query.prdType === '05';
|
2020-05-20 14:50:34 +08:00
|
|
|
},
|
|
|
|
isLocalStation() {
|
|
|
|
return this.$store.state.training.prdType === '01';
|
2020-07-03 16:29:40 +08:00
|
|
|
},
|
|
|
|
drawWay() {
|
|
|
|
const drawWay = this.$route.query.drawWay;
|
|
|
|
return drawWay && JSON.parse(drawWay);
|
2019-12-30 09:00:16 +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);
|
|
|
|
}
|
|
|
|
}
|
2020-05-19 09:45:15 +08:00
|
|
|
},
|
|
|
|
'$store.state.scriptRecord.bgSet':function (val) {
|
|
|
|
this.isScriptCommand = val;
|
2020-07-09 15:44:12 +08:00
|
|
|
if (!val) {
|
|
|
|
this.swch = '01';
|
|
|
|
}
|
2020-05-20 14:50:34 +08:00
|
|
|
},
|
|
|
|
'showStation':function(val) {
|
2020-07-23 17:09:29 +08:00
|
|
|
this.showStationContent = val;
|
2020-05-20 14:50:34 +08:00
|
|
|
},
|
|
|
|
'$store.state.training.prdType':function(val) {
|
2020-07-23 17:09:29 +08:00
|
|
|
if (val == '01') { this.switchModeInner('01'); } else { this.switchModeInner('02'); }
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
await this.loadRunData(this.$route.query);
|
2020-07-23 17:09:29 +08:00
|
|
|
// this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
|
|
|
|
// this.showStationContent = this.showStation;
|
2019-12-30 09:00:16 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadRunData(opt) {
|
|
|
|
this.$store.dispatch('runPlan/clear').then(() => {
|
|
|
|
if (opt && opt.mapId) {
|
|
|
|
this.viewDisabled = true;
|
2020-03-13 18:19:04 +08:00
|
|
|
getByGroupStationList(this.$route.query.group).then(response => {
|
|
|
|
// getStationList(opt.mapId).then(response => {
|
2019-12-30 09:00:16 +08:00
|
|
|
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
|
2020-02-24 17:04:39 +08:00
|
|
|
getEveryDayRunPlanNew(this.group).then(resp => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', resp.data);
|
2020-02-27 22:09:51 +08:00
|
|
|
this.$store.dispatch('runPlan/setInitialPlanData', resp.data);
|
2020-02-24 17:04:39 +08:00
|
|
|
this.viewDisabled = false;
|
|
|
|
}).catch(error => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', []);
|
|
|
|
if (error.code == 30001) {
|
|
|
|
this.$messageBox(this.$t('display.schema.todayRunDiagramNoLoad'));
|
|
|
|
} else {
|
2020-05-09 20:24:59 +08:00
|
|
|
!this.dataError && this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
|
2020-02-24 17:04:39 +08:00
|
|
|
}
|
|
|
|
});
|
2019-12-30 09:00:16 +08:00
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('display.schema.getStationListFail'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
changeOperateMode(handle) {
|
|
|
|
this.$store.dispatch('training/changeOperateMode', { mode: handle });
|
|
|
|
},
|
|
|
|
setRuning(run) {
|
|
|
|
this.runing = run;
|
|
|
|
},
|
|
|
|
setFault() {
|
|
|
|
this.$refs.faultChoose.doShow();
|
|
|
|
},
|
|
|
|
loadRunPlan() {
|
|
|
|
this.$refs.runPlanLoad.doShow();
|
|
|
|
},
|
|
|
|
viewRunPlan() {
|
|
|
|
this.$refs.runPlanView.doShow();
|
|
|
|
},
|
|
|
|
viewRunQuest() {
|
|
|
|
this.$refs.addQuest.doShow();
|
|
|
|
},
|
|
|
|
viewScriptRoles() {
|
2020-05-11 15:43:36 +08:00
|
|
|
const row = {id: this.$route.query.scriptId, group:this.$route.query.group, drawWay:this.$route.query.drawWay};
|
2019-12-30 09:00:16 +08:00
|
|
|
this.$refs.addQuest.handleLoad(1, row);
|
|
|
|
},
|
2020-06-29 15:55:31 +08:00
|
|
|
async selectQuest(row, id, mapLocation, roleName) {
|
|
|
|
try {
|
|
|
|
let res;
|
|
|
|
if (this.isDesignPlatform) {
|
|
|
|
res = this.drawWay ? await loadDraftScriptNew(id, this.group) : await loadDraftScript(row.id, id, this.group);
|
|
|
|
} else {
|
|
|
|
res = await loadScriptNew(row.id, id, this.group);
|
|
|
|
}
|
|
|
|
if (res && res.code == 200) {
|
|
|
|
this.questId = parseInt(row.id);
|
|
|
|
if (mapLocation) {
|
|
|
|
const newMapLocation = {'offsetX': mapLocation.x, 'offsetY': mapLocation.y, 'scaleRate': mapLocation.scale};
|
|
|
|
Vue.prototype.$jlmap.setOptions(newMapLocation);
|
|
|
|
}
|
|
|
|
}
|
2020-07-21 19:27:32 +08:00
|
|
|
this.$emit('selectQuest', {row, roleName, id});
|
2020-06-29 15:55:31 +08:00
|
|
|
} catch (error) {
|
|
|
|
this.$messageBox(error.message);
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
},
|
|
|
|
switchMode(swch) {
|
|
|
|
this.$emit('switchMode', swch);
|
2020-05-20 14:50:34 +08:00
|
|
|
this.switchModeInner(swch);
|
|
|
|
},
|
|
|
|
switchModeInner(swch) {
|
2020-05-19 09:45:15 +08:00
|
|
|
let showMode = '03';
|
2020-03-30 16:16:11 +08:00
|
|
|
if (swch == '01') {
|
|
|
|
showMode = '03';
|
|
|
|
} else if (swch == '02') {
|
|
|
|
showMode = '02';
|
|
|
|
}
|
|
|
|
const nameList = Object.keys(this.$store.state.map.map || {});
|
|
|
|
let list = [];
|
|
|
|
nameList.forEach(item => {
|
|
|
|
if (item !== 'skinVO') {
|
2020-05-15 13:16:55 +08:00
|
|
|
const data = this.$store.state.map.map[item];
|
|
|
|
if (data && data.constructor === Array) {
|
|
|
|
list = [...list, ...data];
|
|
|
|
}
|
2020-03-30 16:16:11 +08:00
|
|
|
}
|
2020-07-23 17:09:29 +08:00
|
|
|
});
|
|
|
|
if (swch == '01') {
|
|
|
|
this.$emit('switchStationMode', this.showStationContent); // 设置显示集中站元素
|
2020-05-19 09:45:15 +08:00
|
|
|
} else {
|
2020-07-23 17:09:29 +08:00
|
|
|
this.$jlmap.updateShowStation(list, ''); // 显示全部元素
|
|
|
|
}
|
|
|
|
this.$jlmap.updateShowMode(list, showMode); // 二次过滤
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
2020-05-20 14:50:34 +08:00
|
|
|
switchStationModeInfo(val) {
|
|
|
|
this.showStationContent = val;
|
|
|
|
this.$emit('switchStationMode', val);
|
2019-12-30 09:00:16 +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;
|
|
|
|
}
|
|
|
|
</style>
|