ncc显示配置

This commit is contained in:
fan 2023-04-24 15:43:04 +08:00
parent 68d0d9c83b
commit 5181b1e98a
8 changed files with 42 additions and 24 deletions

View File

@ -50,7 +50,7 @@ function handleRunPositionData(nccStation, runLineList) {
// 同步绘制数据到原始数据
export function updateForList(model, state, lstName) {
if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[]}; }
if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[], stationCircleList: [], displayConfig: {} }; }
const list = state.nccData[lstName];
if (list && list instanceof Array) {
const i = list.findIndex(elem => elem.code == model.code );
@ -69,6 +69,11 @@ export function updateForList(model, state, lstName) {
}
state.map.nccData = JSON.stringify(state.nccData);
}
export function updateDisplayConfig(state, config) {
if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[], stationCircleList: [], displayConfig: {} }; }
state.nccData.displayConfig = config;
state.map.nccData = JSON.stringify(state.nccData);
}
export function updateMapData(state, model) {
if (state.map && model) {

View File

@ -22,6 +22,7 @@ export default class NccStation extends Group {
create() {
const model = this.model;
if (!model.position) { return; }
this.stationMain = new Circle({
zlevel: this.zlevel,
z: this.z,

View File

@ -15,6 +15,7 @@ export default class StationCircle extends Group {
}
create() {
const model = this.model;
if (!model.position) { return; }
this.rectBody = new Rect({
zlevel: this.zlevel,
z: this.z,

View File

@ -902,6 +902,10 @@ const map = {
Vue.prototype.$jlmap && Vue.prototype.$jlmap.$painter.repaint(state.mapDevice);
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState();
},
updateNccDisplayConfig: (state, data) => {
const parser = parserFactory(ParserType.nccGraph.value);
parser.updateDisplayConfig(state, data);
},
updateMapDevice: (state, list) => {
list.forEach(elem => {
state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem);
@ -1484,6 +1488,9 @@ const map = {
},
setLinkSwitchMap: ({ commit }, linkSwitchMap) => {
commit('setLinkSwitchMap', linkSwitchMap);
},
updateNccDisplayConfig: ({ commit }, displayConfig) => {
commit('updateNccDisplayConfig', displayConfig);
}
}
};

View File

@ -32,7 +32,7 @@
import Vue from 'vue';
import Jlmap from '@/jmapNew/map';
import ProgressBar from '@/views/components/progressBar/index';
import { TrainingMode } from '@/scripts/ConstDic';
// import { TrainingMode } from '@/scripts/ConstDic';
import { mapGetters } from 'vuex';
import { EventBus } from '@/scripts/event-bus';
import Theme from '@/jmapNew/theme/factory';
@ -81,9 +81,9 @@ export default {
return this.$store.state.config.height;
},
zoomShow() {
if (this.mode == TrainingMode.EDIT || this.mode == TrainingMode.MAP_EDIT) {
return true;
}
// if (this.mode == TrainingMode.EDIT || this.mode == TrainingMode.MAP_EDIT) {
// return true;
// }
return false;
},
showZoom() {

View File

@ -87,6 +87,10 @@ export default {
const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData};
const repaint = this.$store.state.map.initJlmapLoadedCount === 1;
this.$jlmap.setMap(this.mapData, this.nccDevice, logicData, repaint);
if (this.$store.state.map.nccData && this.$store.state.map.nccData.displayConfig) {
const displayConfig = this.$store.state.map.nccData.displayConfig;
this.$jlmap.updateTransform(displayConfig.scaling || '1', displayConfig.origin || { x: 0, y: 0 });
}
}
}
};

View File

@ -185,24 +185,21 @@ export default {
type: 'warning'
}).then(() => {
const map = this.$store.state.map.map;
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
const param = {
mapId: this.$route.params.mapId,
skinVO: {
code: this.$store.state.map.map.skinVO.code,
name: this.$store.state.map.map.skinVO.name
},
origin: {
x: this.updtModel.origin.x || map.origin.x,
y: this.updtModel.origin.y || map.origin.y
},
scaling: this.updtModel.scaling
};
saveMap(Object.assign(map, param)).then(response => {
this.$message.success(this.$t('map.updateSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('map.updateFailed'));
});
const displayConfig = {
origin:{
x: this.updtModel.origin.x || 0,
y: this.updtModel.origin.y || 0
},
scaling: this.updtModel.scaling
};
this.$store.dispatch('map/updateNccDisplayConfig', displayConfig);
const param = {
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.$message.success(this.$t('map.updateSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('map.updateFailed'));
});
}).catch(() => { });
},
@ -325,7 +322,6 @@ export default {
this.$router.push({ path: `/design/usermap/home` });
},
updateMapModel(models) { //
console.log('updateMapModel', models);
this.$store.dispatch('map/updateNccMapDevices', models);
},
//

View File

@ -283,6 +283,10 @@ export default {
//
setMap(map) {
this.$jlmap.setMap(map, this.$store.state.map.nccDevice, {routeData: {}, autoReentryData: {}});
if (this.$store.state.map.nccData && this.$store.state.map.nccData.displayConfig) {
const displayConfig = this.$store.state.map.nccData.displayConfig;
this.$jlmap.updateTransform(displayConfig.scaling || '1', displayConfig.origin || { x: 0, y: 0 });
}
},
//
refresh(map) {