调整加载方式及判断
This commit is contained in:
parent
11c021feb8
commit
9ec64f1eeb
@ -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');
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)}`));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -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) {
|
||||
|
@ -23,6 +23,7 @@
|
||||
<component
|
||||
:is="each.menus"
|
||||
:ref="each.name"
|
||||
:selected="selected"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
@deviceSelect="deviceSelect"
|
||||
|
@ -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 => {
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user