调整加载方式及判断

This commit is contained in:
zyy 2020-07-23 17:09:29 +08:00
parent 11c021feb8
commit 9ec64f1eeb
10 changed files with 74 additions and 75 deletions

View File

@ -213,10 +213,6 @@ class Jlmap {
const scaleX = Math.floor((((opts.width - 200) * num) / rect.width) * 100) / 100; const scaleX = Math.floor((((opts.width - 200) * num) / rect.width) * 100) / 100;
const scaleY = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100; const scaleY = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100;
const scale = Math.min(scaleX, scaleY); const scale = Math.min(scaleX, scaleY);
// console.log('scaleX', scaleX, 'scaleY', scaleY, 'scale', scale, offsetY, rect.height * scale);
// const offsetHeight = (offsetY - (rect.height * scale)) / 2; // 高度差
// console.log(offsetHeight, opts.height, screenSplit, offsetY, rect, '缩放对比>', scaleX, scaleY);
for (let i = 0; i < splitList.length; i++) { for (let i = 0; i < splitList.length; i++) {
let offsetX = ''; let offsetX = '';
@ -333,6 +329,7 @@ class Jlmap {
this.hookHandle(oDevice, elem); this.hookHandle(oDevice, elem);
}); });
} }
// 模式选择 -> 更新
updateShowMode(list, showMode) { updateShowMode(list, showMode) {
this.showConfig.showMode = showMode; this.showConfig.showMode = showMode;
(list || []).forEach(elem => { (list || []).forEach(elem => {

View File

@ -137,8 +137,8 @@ export default class StationTurnBack extends Group {
this.eachChild(item => { this.eachChild(item => {
item.show(); item.show();
}); });
this.isShowShape = true; // this.isShowShape = true;
this.setState(this.model); // this.setState(this.model);
} else { } else {
this.eachChild(item => { this.eachChild(item => {
item.hide(); item.hide();

View File

@ -16,7 +16,7 @@
:offset="offset" :offset="offset"
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
:show-station="showStation" :show-station="showStation"
:station-list="stationList" :station-list="stationListMode"
:show-select-station="showSelectStation" :show-select-station="showSelectStation"
@switchMode="switchMode" @switchMode="switchMode"
@selectQuest="selectQuest" @selectQuest="selectQuest"
@ -33,6 +33,7 @@
</template> </template>
<script> <script>
// 稿
import RunPlanLoad from './demon/runPlanLoad'; import RunPlanLoad from './demon/runPlanLoad';
import RunPlanView from './demon/runPlanView'; import RunPlanView from './demon/runPlanView';
import ScriptPreviewChat from './scriptPreviewChat.vue'; import ScriptPreviewChat from './scriptPreviewChat.vue';
@ -86,7 +87,7 @@ export default {
drivingShow: false, drivingShow: false,
isscriptRun:false, // isscriptRun:false, //
showStation: '', showStation: '',
stationList: [], stationListMode: [],
showSelectStation: false, // select showSelectStation: false, // select
group: '', group: '',
prdTypeMap: { prdTypeMap: {
@ -106,7 +107,8 @@ export default {
'canvasHeight' 'canvasHeight'
]), ]),
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map',
'stationList'
]), ]),
...mapGetters('training', [ ...mapGetters('training', [
'offsetStationCode' 'offsetStationCode'
@ -157,6 +159,7 @@ export default {
}, },
'$store.state.training.prdType':function(val) { '$store.state.training.prdType':function(val) {
this.setPosition(); this.setPosition();
this.setMode();
}, },
// '$store.state.training.prdType': function(val) { // '$store.state.training.prdType': function(val) {
// debugger; // debugger;
@ -167,9 +170,8 @@ export default {
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.setWindowSize(); this.setWindowSize();
}, },
'$store.state.map.map': function (val) { 'stationList': function () {
this.showSelectStation = val.skinVO.code === '06' && this.$store.state.training.prdType === '01'; this.setStationList();
this.showSelectStation && this.setStationList(val);
}, },
$route() { $route() {
this.$nextTick(() => { this.$nextTick(() => {
@ -233,7 +235,7 @@ export default {
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
if (this.group) { if (this.group) {
await this.loadNewMapDataByGroup(this.group); await this.loadNewMapDataByGroup(this.group);
this.switchMode('01'); this.switchMode('02');
} else { } else {
this.endViewLoading(); this.endViewLoading();
} }
@ -448,6 +450,9 @@ export default {
switchMode(prdType) { switchMode(prdType) {
this.$store.dispatch('training/setPrdType', prdType); this.$store.dispatch('training/setPrdType', prdType);
}, },
setMode() {
this.showSelectStation = this.$store.state.map.map.skinVO.code === '06' && this.$store.state.training.prdType === '01';
},
// hidepanel() { // hidepanel() {
// if (this.isDrive) { // if (this.isDrive) {
// this.panelShow = false; // this.panelShow = false;
@ -474,23 +479,23 @@ export default {
this.$refs.runPlanLoad.doShow(); this.$refs.runPlanLoad.doShow();
}, },
switchStationMode(val) { switchStationMode(val) {
if (val == null && this.stationList.length > 0) { if (val == null && this.stationListMode.length > 0) {
this.showStation = this.stationList[0].value; this.showStation = this.stationListMode[0].value;
} else { } else {
this.showStation = val; this.showStation = val;
} }
this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation); this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation);
this.$store.dispatch('map/setShowCentralizedStationNum'); this.$store.dispatch('map/setShowCentralizedStationNum');
}, },
setStationList(val) { setStationList() {
this.stationList = []; this.stationListMode = [];
(val.stationList || []).forEach(item => { (this.stationList || []).forEach(item => {
if (item.centralized) { if (item.centralized) {
this.stationList.push({value: item.code, name: item.name}); this.stationListMode.push({value: item.code, name: item.name});
} }
}); });
if (this.stationList.length) { if (this.stationListMode.length) {
this.showStation = this.stationList[0].value; this.showStation = this.stationListMode[0].value;
} }
} }
} }

View File

@ -242,9 +242,7 @@ export default {
this.setWindowSize(); this.setWindowSize();
}, },
$route() { $route() {
this.$nextTick(() => {
this.initLoadData(); this.initLoadData();
});
}, },
'$store.state.training.centerStationCode': function(code) { '$store.state.training.centerStationCode': function(code) {
if (code) { if (code) {
@ -285,6 +283,28 @@ export default {
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
}, },
methods:{ methods:{
//
async initLoadData() {
this.$store.dispatch('training/reset');
try {
await this.loadSimulationInfo();
if (this.isDemon) {
await this.initLoadDemonData();
} else if (this.isScript) {
await this.initLoadScriptData();
} else if (this.isPractice) {
await this.initPracticeData();
} else {
await this.initLoadLessonOrExamData();
}
this.checkLoginLineTimer();
this.checkMouseStatusTimer();
this.initMemberUserInfo();
} catch (error) {
this.$messageBox(`初始化失败: ${error.message}`);
this.endViewLoading();
}
},
// 仿退 // 仿退
async back() { async back() {
if (this.isExam) { if (this.isExam) {
@ -323,28 +343,6 @@ export default {
this.$store.dispatch('config/resize', { width, height }); this.$store.dispatch('config/resize', { width, height });
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode }); this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
}, },
//
async initLoadData() {
this.$store.dispatch('training/reset');
try {
await this.loadSimulationInfo();
if (this.isDemon) {
await this.initLoadDemonData();
} else if (this.isScript) {
await this.initLoadScriptData();
} else if (this.isPractice) {
await this.initPracticeData();
} else {
await this.initLoadLessonOrExamData();
}
this.checkLoginLineTimer();
this.checkMouseStatusTimer();
this.initMemberUserInfo();
} catch (error) {
this.$messageBox(`初始化失败: ${error.message}`);
this.endViewLoading();
}
},
// //
async initLoadScriptData() { async initLoadScriptData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL); this.$store.dispatch('training/end', TrainingMode.NORMAL);
@ -409,9 +407,9 @@ export default {
}, },
// 仿 // 仿
async loadSimulationInfo() { async loadSimulationInfo() {
// this.dataError = false;
const resp = await getSimulationInfoNew(this.group); const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) { if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
this.dataError = false;
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.scriptId = Number(resp.data.scriptId) || 0; this.scriptId = Number(resp.data.scriptId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`)); this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));

View File

@ -87,7 +87,7 @@ export default {
OperateMode: OperateMode, OperateMode: OperateMode,
viewDisabled: true, viewDisabled: true,
runing: false, runing: false,
swch: '01', swch: '02',
showStationContent:'', showStationContent:'',
isScriptCommand:false, isScriptCommand:false,
swchList: [ swchList: [
@ -145,16 +145,16 @@ export default {
} }
}, },
'showStation':function(val) { 'showStation':function(val) {
this.showStationContent = this.showStation; this.showStationContent = val;
}, },
'$store.state.training.prdType':function(val) { '$store.state.training.prdType':function(val) {
if (val == '02' || val == '') { this.switchModeInner('02'); } else { this.switchModeInner('01'); } if (val == '01') { this.switchModeInner('01'); } else { this.switchModeInner('02'); }
} }
}, },
async mounted() { async mounted() {
await this.loadRunData(this.$route.query); await this.loadRunData(this.$route.query);
this.isScriptCommand = this.$store.state.scriptRecord.bgSet; // this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
this.showStationContent = this.showStation; // this.showStationContent = this.showStation;
}, },
methods: { methods: {
loadRunData(opt) { loadRunData(opt) {
@ -246,19 +246,16 @@ export default {
} }
} }
}); });
this.$jlmap.updateShowMode(list, showMode); if (swch == '01') {
if (swch == '02') { this.$emit('switchStationMode', this.showStationContent); //
this.switchStationMode('');
} else { } else {
this.switchStationMode(null); this.$jlmap.updateShowStation(list, ''); //
} }
this.$jlmap.updateShowMode(list, showMode); //
}, },
switchStationModeInfo(val) { switchStationModeInfo(val) {
this.showStationContent = val; this.showStationContent = val;
this.$emit('switchStationMode', val); this.$emit('switchStationMode', val);
},
switchStationMode(val) {
this.$emit('switchStationMode', val);
} }
} }
}; };

View File

@ -23,6 +23,7 @@
<component <component
:is="each.menus" :is="each.menus"
:ref="each.name" :ref="each.name"
:selected="selected"
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
@deviceSelect="deviceSelect" @deviceSelect="deviceSelect"

View File

@ -262,6 +262,7 @@ export default {
}); });
}).catch(() => { }); }).catch(() => { });
}, },
//
previewScript(index, row) { previewScript(index, row) {
const drawWay = this.$route.query.drawWay; const drawWay = this.$route.query.drawWay;
if (drawWay && JSON.parse(drawWay)) { if (drawWay && JSON.parse(drawWay)) {