控制权判断调整

This commit is contained in:
fan 2022-12-07 14:37:46 +08:00
parent 57b4eedfe6
commit 16ee7692b2
2 changed files with 19 additions and 5 deletions

View File

@ -17,10 +17,19 @@ export function parser(data, skinCode, showConfig) {
var mapDevice = {};
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
if (data) {
const centralStationList = [];
zrUtil.each(data.stationList || [], elem => {
if (elem.centralized) {
centralStationList.push(elem);
}
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert, showConfig);
}, this);
zrUtil.each(centralStationList, elem => {
mapDevice[elem.code].stationCode = elem.code;
zrUtil.each(elem.chargeStationCodeList || [], item => {
mapDevice[item].stationCode = elem.code;
});
});
zrUtil.each(data.sectionList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert, showConfig);
elem = propConvert.initPrivateProps(elem);

View File

@ -4,10 +4,15 @@ import store from '@/store/index';
* @param {String} stationCode 所属车站code
* @param {String} centralStationCode 所属集中站code
* */
export function judgeStationControl(stationCode, centralStationCode) {
export function judgeStationControl(stationCode, centralStationCode, work) {
const centralStation = this.$store.getters['map/getDeviceByCode'](centralStationCode);
// 角色车站是 设备所属车站或所属集中站
if (work === 'localWork') {
const flag1 = store.state.training.roleDeviceCode === stationCode || store.state.training.roleDeviceCode === centralStationCode;
const flag2 = centralStation.controlMode === 'Local' || centralStation.controlMode === 'Emergency';
return flag1 && flag2;
} else {
return centralStation.controlMode === 'Center';
}
}