调整加载方式及判断

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

@ -130,7 +130,7 @@ class Jlmap {
const type = elem._type;
// 列车不需要设置默认状态
type != deviceType.Train && list.push(Object.assign({ code, _type: type }, this.defaultStateDict[type]));
});
});
this.update(list);
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
@ -213,10 +213,6 @@ class Jlmap {
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 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++) {
let offsetX = '';
@ -332,14 +328,15 @@ class Jlmap {
const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
this.hookHandle(oDevice, elem);
});
}
}
// 模式选择 -> 更新
updateShowMode(list, showMode) {
this.showConfig.showMode = showMode;
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
oDevice.showMode = showMode;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
oDevice.showMode = showMode;
this.$painter.updateShowMode(oDevice);
});
this.$painter.$transformHandle.revisibleAll();
@ -468,7 +465,7 @@ class Jlmap {
this.$painter.update(oDevice);
// }
}
}
}
});
if (this.isUpdateShowTrainList) {
store.dispatch('map/setActiveTrainList');

View File

@ -53,7 +53,7 @@ export default class OutFrame extends Group {
if (showMode == '04') {
this.box && this.box.hide();
return;
}
}
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.box && this.box.show();
this.setState(this.model);

View File

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

View File

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

View File

@ -242,9 +242,7 @@ export default {
this.setWindowSize();
},
$route() {
this.$nextTick(() => {
this.initLoadData();
});
this.initLoadData();
},
'$store.state.training.centerStationCode': function(code) {
if (code) {
@ -285,6 +283,28 @@ export default {
this.$store.dispatch('map/mapClear');
},
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() {
if (this.isExam) {
@ -323,28 +343,6 @@ export default {
this.$store.dispatch('config/resize', { width, height });
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() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
@ -409,9 +407,9 @@ export default {
},
// 仿
async loadSimulationInfo() {
// this.dataError = false;
const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
this.dataError = false;
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.scriptId = Number(resp.data.scriptId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));

View File

@ -5,7 +5,7 @@
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<!-- ||(isScriptCommand && isLocalStation) -->
<el-select v-if="showSelectStation&&((!isScriptCommand&&swch=='01')||(isScriptCommand && isLocalStation)) " v-model="showStationContent" style="width: 100px;" size="small" @change="switchStationModeInfo">
<el-select v-if="showSelectStation&&((!isScriptCommand&&swch=='01')||(isScriptCommand && isLocalStation))" v-model="showStationContent" style="width: 100px;" size="small" @change="switchStationModeInfo">
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-button-group>
@ -87,7 +87,7 @@ export default {
OperateMode: OperateMode,
viewDisabled: true,
runing: false,
swch: '01',
swch: '02',
showStationContent:'',
isScriptCommand:false,
swchList: [
@ -145,16 +145,16 @@ export default {
}
},
'showStation':function(val) {
this.showStationContent = this.showStation;
this.showStationContent = 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() {
await this.loadRunData(this.$route.query);
this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
this.showStationContent = this.showStation;
// this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
// this.showStationContent = this.showStation;
},
methods: {
loadRunData(opt) {
@ -245,20 +245,17 @@ export default {
list = [...list, ...data];
}
}
});
this.$jlmap.updateShowMode(list, showMode);
if (swch == '02') {
this.switchStationMode('');
});
if (swch == '01') {
this.$emit('switchStationMode', this.showStationContent); //
} else {
this.switchStationMode(null);
}
this.$jlmap.updateShowStation(list, ''); //
}
this.$jlmap.updateShowMode(list, showMode); //
},
switchStationModeInfo(val) {
this.showStationContent = val;
this.$emit('switchStationMode', val);
},
switchStationMode(val) {
this.$emit('switchStationMode', val);
}
}
};

View File

@ -327,7 +327,7 @@ export default {
return device;
},
onSelect(device) {
this.selected = device || null;
this.selected = device || null;
this.selected && this.handleSelectControlPage(device);
},
onContextmenu(em) {

View File

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

View File

@ -250,7 +250,7 @@ export default {
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
deviceSelect(selected) {
@ -267,7 +267,7 @@ export default {
data.chargeStationCodeList.forEach(charge=>{
beCentralizedStation[charge] = data.code;
});
}
}
if (data.ciStation && data.code != this.selected.code) {
const arr = data.relStationCodeList || [];
arr.forEach(stationCode => {

View File

@ -261,7 +261,8 @@ export default {
this.$messageBox(`${this.$t('approval.revokeScriptFailed')}: ${error.message}`);
});
}).catch(() => { });
},
},
//
previewScript(index, row) {
const drawWay = this.$route.query.drawWay;
if (drawWay && JSON.parse(drawWay)) {