优化IBP盘代码
This commit is contained in:
parent
6eb0ac89b8
commit
dfcdb5628f
@ -4,78 +4,99 @@ const deviceRender = {};
|
|||||||
|
|
||||||
/** IbpText渲染配置*/
|
/** IbpText渲染配置*/
|
||||||
deviceRender[deviceType.IbpText] = {
|
deviceRender[deviceType.IbpText] = {
|
||||||
|
_type: deviceType.IbpText,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** SquareButton渲染配置*/
|
/** SquareButton渲染配置*/
|
||||||
deviceRender[deviceType.SquareButton] = {
|
deviceRender[deviceType.SquareButton] = {
|
||||||
|
_type: deviceType.SquareButton,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** WarnButton渲染配置*/
|
/** WarnButton渲染配置*/
|
||||||
deviceRender[deviceType.WarnButton] = {
|
deviceRender[deviceType.WarnButton] = {
|
||||||
|
_type: deviceType.WarnButton,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Arrow渲染配置*/
|
/** Arrow渲染配置*/
|
||||||
deviceRender[deviceType.Arrow] = {
|
deviceRender[deviceType.Arrow] = {
|
||||||
|
_type: deviceType.Arrow,
|
||||||
zlevel: 2
|
zlevel: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/** RotatingButton渲染配置*/
|
/** RotatingButton渲染配置*/
|
||||||
deviceRender[deviceType.RotatingButton] = {
|
deviceRender[deviceType.RotatingButton] = {
|
||||||
|
_type: deviceType.RotatingButton,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** TipBox渲染配置*/
|
/** TipBox渲染配置*/
|
||||||
deviceRender[deviceType.TipBox] = {
|
deviceRender[deviceType.TipBox] = {
|
||||||
|
_type: deviceType.TipBox,
|
||||||
zlevel: 2,
|
zlevel: 2,
|
||||||
z: 2
|
z: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/** BackGround渲染配置*/
|
/** BackGround渲染配置*/
|
||||||
deviceRender[deviceType.Background] = {
|
deviceRender[deviceType.Background] = {
|
||||||
|
_type: deviceType.Background,
|
||||||
zlevel: 0
|
zlevel: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/** CircularLamp渲染配置 */
|
/** CircularLamp渲染配置 */
|
||||||
deviceRender[deviceType.CircularLamp] = {
|
deviceRender[deviceType.CircularLamp] = {
|
||||||
|
_type: deviceType.CircularLamp,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** AppendageBox渲染配置 */
|
/** AppendageBox渲染配置 */
|
||||||
deviceRender[deviceType.AppendageBox] = {
|
deviceRender[deviceType.AppendageBox] = {
|
||||||
|
_type: deviceType.AppendageBox,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/** IbpLine渲染配置 */
|
/** IbpLine渲染配置 */
|
||||||
deviceRender[deviceType.IbpLine] = {
|
deviceRender[deviceType.IbpLine] = {
|
||||||
|
_type: deviceType.IbpLine,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Elevator 渲染配置 */
|
/** Elevator 渲染配置 */
|
||||||
deviceRender[deviceType.Elevator] = {
|
deviceRender[deviceType.Elevator] = {
|
||||||
|
_type: deviceType.Elevator,
|
||||||
zlevel: 2,
|
zlevel: 2,
|
||||||
z: 1
|
z: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Key 渲染配置 */
|
/** Key 渲染配置 */
|
||||||
deviceRender[deviceType.Key] = {
|
deviceRender[deviceType.Key] = {
|
||||||
|
_type: deviceType.Key,
|
||||||
zlevel: 4
|
zlevel: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
/** TeleTerminal 渲染配置 */
|
/** TeleTerminal 渲染配置 */
|
||||||
deviceRender[deviceType.TeleTerminal] = {
|
deviceRender[deviceType.TeleTerminal] = {
|
||||||
|
_type: deviceType.TeleTerminal,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Clock 渲染配置*/
|
/** Clock 渲染配置*/
|
||||||
deviceRender[deviceType.Clock] = {
|
deviceRender[deviceType.Clock] = {
|
||||||
|
_type: deviceType.Clock,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** RotateTip 渲染配置 */
|
/** RotateTip 渲染配置 */
|
||||||
deviceRender[deviceType.RotateTip] = {
|
deviceRender[deviceType.RotateTip] = {
|
||||||
|
_type: deviceType.RotateTip,
|
||||||
|
zlevel: 3
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Alarm */
|
||||||
|
deviceRender[deviceType.Alarm] = {
|
||||||
|
_type: deviceType.Alarm,
|
||||||
zlevel: 3
|
zlevel: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import MouseController from './mouseController';
|
|||||||
import Painter from './painter';
|
import Painter from './painter';
|
||||||
import deviceState from '../jmap/constant/deviceState';
|
import deviceState from '../jmap/constant/deviceState';
|
||||||
import deviceType from './constant/deviceType';
|
import deviceType from './constant/deviceType';
|
||||||
import {calculateDCenter, createBoundingRect, modelFactory} from './utils/parser';
|
import {calculateDCenter, createBoundingRect, deviceFactory} from './utils/parser';
|
||||||
import { updateIbpData } from './utils/parser';
|
import { updateIbpData } from './utils/parser';
|
||||||
|
|
||||||
const renderer = 'canvas';
|
const renderer = 'canvas';
|
||||||
@ -135,7 +135,7 @@ class IbpPan {
|
|||||||
const code = elem.code;
|
const code = elem.code;
|
||||||
const type = elem._type;
|
const type = elem._type;
|
||||||
updateIbpData(elem);
|
updateIbpData(elem);
|
||||||
const oDevice = this.ibpDevice[code] || {instance: null, event: null, model: modelFactory(type, elem)};
|
const oDevice = this.ibpDevice[code] || {instance: null, event: null, model: deviceFactory(type, elem)};
|
||||||
const nDevice = {instance: null, event: null, model: Object.assign(oDevice.model || {}, elem)};
|
const nDevice = {instance: null, event: null, model: Object.assign(oDevice.model || {}, elem)};
|
||||||
this.$painter.delete(oDevice);
|
this.$painter.delete(oDevice);
|
||||||
if (!elem._dispose) {
|
if (!elem._dispose) {
|
||||||
|
@ -59,13 +59,17 @@ class Painter {
|
|||||||
* @param {*} device
|
* @param {*} device
|
||||||
*/
|
*/
|
||||||
add(device, draggable) {
|
add(device, draggable) {
|
||||||
device = Object.assign(device, { event: this.$ibp.$mouseController });
|
try {
|
||||||
const instance = shapefactory(device, this.$ibp);
|
device = Object.assign(device, { event: this.$ibp.$mouseController });
|
||||||
if (instance) {
|
const instance = shapefactory(device, this.$ibp);
|
||||||
device.instance = instance;
|
if (instance) {
|
||||||
draggable?instance.setDraggable():'';
|
device.instance = instance;
|
||||||
this.$transformHandle.transformView(instance);
|
draggable?instance.setDraggable():'';
|
||||||
this.ibpInstanceLevel[device.model._type].add(instance);
|
this.$transformHandle.transformView(instance);
|
||||||
|
this.ibpInstanceLevel[device.model._type].add(instance);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,324 +29,139 @@ export function calculateDCenter(viewRect, zrbound) {
|
|||||||
return { dx: dx, dy: dy };
|
return { dx: dx, dy: dy };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modelFactory(type, elem) {
|
export function deviceFactory(type, elem) {
|
||||||
return Object.assign(elem, { _type: type }, deviceRender[type]);
|
return Object.assign({instance: null, event: null, model: Object(elem, deviceRender[type])});
|
||||||
}
|
|
||||||
|
|
||||||
export function createModel(type, model, propConvert) {
|
|
||||||
const tempModel = modelFactory(type, model);
|
|
||||||
return { instance: null, event: null, model: propConvert ? propConvert.initPrivateProps(tempModel) : tempModel };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parser(data) {
|
export function parser(data) {
|
||||||
var ibpDevice = {};
|
var ibpDevice = {};
|
||||||
const propConvert = null;
|
|
||||||
// var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null;
|
|
||||||
if (data) {
|
if (data) {
|
||||||
Object.assign(data.background);
|
Object.assign(data.background);
|
||||||
ibpDevice[data.background.code] = createModel(deviceType.Background, data.background, propConvert);
|
ibpDevice[data.background.code] = deviceFactory(deviceType.Background, data.background);
|
||||||
zrUtil.each(data.textList || [], elem => {
|
zrUtil.each(data.textList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.IbpText, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.IbpText, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.squareButtonList || [], elem => {
|
zrUtil.each(data.squareButtonList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.SquareButton, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.SquareButton, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.circularLampList || [], elem => {
|
zrUtil.each(data.circularLampList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.CircularLamp, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.CircularLamp, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.alarmList || [], elem => {
|
zrUtil.each(data.alarmList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.Alarm, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.Alarm, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.arrowList || [], elem => {
|
zrUtil.each(data.arrowList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.Arrow, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.Arrow, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.rotatingButtonList || [], elem => {
|
zrUtil.each(data.rotatingButtonList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.RotatingButton, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.RotatingButton, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.tipBoxList || [], elem => {
|
zrUtil.each(data.tipBoxList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.TipBox, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.TipBox, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.ibpLineList || [], elem => {
|
zrUtil.each(data.ibpLineList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.IbpLine, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.IbpLine, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.appendageBoxList || [], elem => {
|
zrUtil.each(data.appendageBoxList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.AppendageBox, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.AppendageBox, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.elevatorList || [], elem => {
|
zrUtil.each(data.elevatorList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.Elevator, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.Elevator, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.keyList || [], elem => {
|
zrUtil.each(data.keyList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.Key, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.Key, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.teleTerminalList || [], elem => {
|
zrUtil.each(data.teleTerminalList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.TeleTerminal, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.TeleTerminal, elem);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.clockList || [], elem => {
|
zrUtil.each(data.clockList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.Clock, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.Clock, elem);
|
||||||
});
|
});
|
||||||
|
|
||||||
zrUtil.each(data.rotateTipList || [], elem => {
|
zrUtil.each(data.rotateTipList || [], elem => {
|
||||||
ibpDevice[elem.code] = createModel(deviceType.RotateTip, elem, propConvert);
|
ibpDevice[elem.code] = deviceFactory(deviceType.RotateTip, elem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return ibpDevice;
|
return ibpDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateIbpListByDevice(ibp, name, device) {
|
||||||
|
var list = ibp[name];
|
||||||
|
if (list) {
|
||||||
|
const index = list.findIndex(elem => { return elem.code == device.code; });
|
||||||
|
if (index >= 0) {
|
||||||
|
list[index].dispose ? list.splice(index, 1) : list[index] = device;
|
||||||
|
} else {
|
||||||
|
list.push(device);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ibp[name] = [device];
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
export function updateIbpData(device) {
|
export function updateIbpData(device) {
|
||||||
const ibpData = store.getters['ibp/ibp'];
|
const ibpData = store.getters['ibp/ibp'];
|
||||||
switch (device._type) {
|
switch (device._type) {
|
||||||
case deviceType.Background : {
|
case deviceType.Background :
|
||||||
ibpData.background = device;
|
ibpData.background = device;
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.IbpText :
|
||||||
case deviceType.IbpText : {
|
updateIbpListByDevice(ibpData, 'textList', device);
|
||||||
if (ibpData.textList && ibpData.textList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.textList.length; i++) {
|
|
||||||
if (device.code === ibpData.textList[i].code) {
|
|
||||||
device.dispose ? ibpData.textList.splice(i, 1) :ibpData.textList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.textList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.textList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.SquareButton :
|
||||||
case deviceType.SquareButton : {
|
updateIbpListByDevice(ibpData, 'squareButtonList', device);
|
||||||
if (ibpData.squareButtonList && ibpData.squareButtonList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.squareButtonList.length; i++) {
|
|
||||||
if (device.code === ibpData.squareButtonList[i].code) {
|
|
||||||
device.dispose ? ibpData.squareButtonList.splice(i, 1):ibpData.squareButtonList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.squareButtonList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.squareButtonList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.Arrow :
|
||||||
case deviceType.Arrow : {
|
updateIbpListByDevice(ibpData, 'arrowList', device);
|
||||||
if (ibpData.arrowList && ibpData.arrowList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.arrowList.length; i++) {
|
|
||||||
if (device.code === ibpData.arrowList[i].code) {
|
|
||||||
device.dispose ? ibpData.arrowList.splice(i, 1):ibpData.arrowList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.arrowList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.arrowList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.RotatingButton :
|
||||||
case deviceType.RotatingButton : {
|
updateIbpListByDevice(ibpData, 'rotatingButtonList', device);
|
||||||
if (ibpData.rotatingButtonList && ibpData.rotatingButtonList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.rotatingButtonList.length; i++) {
|
|
||||||
if (device.code === ibpData.rotatingButtonList[i].code) {
|
|
||||||
device.dispose ? ibpData.rotatingButtonList.splice(i, 1):ibpData.rotatingButtonList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.rotatingButtonList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.rotatingButtonList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.TipBox :
|
||||||
case deviceType.TipBox : {
|
updateIbpListByDevice(ibpData, 'tipBoxList', device);
|
||||||
if (ibpData.tipBoxList && ibpData.tipBoxList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.tipBoxList.length; i++) {
|
|
||||||
if (device.code === ibpData.tipBoxList[i].code) {
|
|
||||||
device.dispose ? ibpData.tipBoxList.splice(i, 1):ibpData.tipBoxList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.tipBoxList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.tipBoxList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.CircularLamp :
|
||||||
case deviceType.CircularLamp : {
|
updateIbpListByDevice(ibpData, 'circularLampList', device);
|
||||||
if (ibpData.circularLampList && ibpData.circularLampList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.circularLampList.length; i++) {
|
|
||||||
if (device.code === ibpData.circularLampList[i].code) {
|
|
||||||
device.dispose ? ibpData.circularLampList.splice(i, 1):ibpData.circularLampList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.circularLampList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.circularLampList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.IbpLine :
|
||||||
case deviceType.IbpLine : {
|
updateIbpListByDevice(ibpData, 'ibpLineList', device);
|
||||||
if (ibpData.ibpLineList && ibpData.ibpLineList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.ibpLineList.length; i++) {
|
|
||||||
if (device.code === ibpData.ibpLineList[i].code) {
|
|
||||||
device.dispose ? ibpData.ibpLineList.splice(i, 1):ibpData.ibpLineList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.ibpLineList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.ibpLineList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.AppendageBox :
|
||||||
case deviceType.AppendageBox : {
|
updateIbpListByDevice(ibpData, 'appendageBoxList', device);
|
||||||
if (ibpData.appendageBoxList && ibpData.appendageBoxList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.appendageBoxList.length; i++) {
|
|
||||||
if (device.code === ibpData.appendageBoxList[i].code) {
|
|
||||||
device.dispose ? ibpData.appendageBoxList.splice(i, 1):ibpData.appendageBoxList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.appendageBoxList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.appendageBoxList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.Alarm :
|
||||||
case deviceType.Alarm : {
|
updateIbpListByDevice(ibpData, 'alarmList', device);
|
||||||
if (ibpData.alarmList && ibpData.alarmList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.alarmList.length; i++) {
|
|
||||||
if (device.code === ibpData.alarmList[i].code) {
|
|
||||||
device.dispose ? ibpData.alarmList.splice(i, 1):ibpData.alarmList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.alarmList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.alarmList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.Elevator :
|
||||||
case deviceType.Elevator : {
|
updateIbpListByDevice(ibpData, 'elevatorList', device);
|
||||||
if (ibpData.elevatorList && ibpData.elevatorList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.elevatorList.length; i++) {
|
|
||||||
if (device.code === ibpData.elevatorList[i].code) {
|
|
||||||
device.dispose ? ibpData.elevatorList.splice(i, 1):ibpData.elevatorList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.elevatorList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.elevatorList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.Key :
|
||||||
case deviceType.Key : {
|
updateIbpListByDevice(ibpData, 'keyList', device);
|
||||||
if (ibpData.keyList && ibpData.keyList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.keyList.length; i++) {
|
|
||||||
if (device.code === ibpData.keyList[i].code) {
|
|
||||||
device.dispose ? ibpData.keyList.splice(i, 1):ibpData.keyList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.keyList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.keyList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case deviceType.TeleTerminal :
|
||||||
case deviceType.TeleTerminal : {
|
updateIbpListByDevice(ibpData, 'teleTerminalList', device);
|
||||||
if (ibpData.teleTerminalList && ibpData.teleTerminalList.length > 0) {
|
break;
|
||||||
let newDevice = true;
|
case deviceType.Clock :
|
||||||
for (let i=0; i<ibpData.teleTerminalList.length; i++) {
|
updateIbpListByDevice(ibpData, 'clockList', device);
|
||||||
if (device.code === ibpData.teleTerminalList[i].code) {
|
break;
|
||||||
device.dispose ? ibpData.teleTerminalList.splice(i, 1):ibpData.teleTerminalList[i] = device;
|
case deviceType.RotateTip:
|
||||||
newDevice = false;
|
updateIbpListByDevice(ibpData, 'rotateTipList', device);
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.teleTerminalList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.teleTerminalList = [device];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case deviceType.Clock : {
|
|
||||||
if (ibpData.clockList && ibpData.clockList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.clockList.length; i++) {
|
|
||||||
if (device.code === ibpData.clockList[i].code) {
|
|
||||||
device.dispose ? ibpData.clockList.splice(i, 1):ibpData.clockList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.clockList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.clockList = [device];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case deviceType.RotateTip: {
|
|
||||||
if (ibpData.rotateTipList && ibpData.rotateTipList.length > 0) {
|
|
||||||
let newDevice = true;
|
|
||||||
for (let i=0; i<ibpData.rotateTipList.length; i++) {
|
|
||||||
if (device.code === ibpData.rotateTipList[i].code) {
|
|
||||||
device.dispose ? ibpData.rotateTipList.splice(i, 1): ibpData.rotateTipList[i] = device;
|
|
||||||
newDevice = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newDevice) {
|
|
||||||
ibpData.rotateTipList.push(device);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ibpData.rotateTipList = [device];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
store.dispatch('ibp/setIbpData', ibpData);
|
store.dispatch('ibp/setIbpData', ibpData);
|
||||||
}
|
}
|
||||||
|
@ -4,107 +4,125 @@ const deviceRender = {};
|
|||||||
|
|
||||||
/** link渲染配置*/
|
/** link渲染配置*/
|
||||||
deviceRender[deviceType.Link] = {
|
deviceRender[deviceType.Link] = {
|
||||||
|
_type: deviceType.Link,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 1
|
// progressive: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Section渲染配置*/
|
/** Section渲染配置*/
|
||||||
deviceRender[deviceType.Section] = {
|
deviceRender[deviceType.Section] = {
|
||||||
|
_type: deviceType.Section,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 2
|
// progressive: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Signal渲染配置*/
|
/** Signal渲染配置*/
|
||||||
deviceRender[deviceType.Signal] = {
|
deviceRender[deviceType.Signal] = {
|
||||||
|
_type: deviceType.Signal,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 3
|
// progressive: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Switch渲染配置*/
|
/** Switch渲染配置*/
|
||||||
deviceRender[deviceType.Switch] = {
|
deviceRender[deviceType.Switch] = {
|
||||||
|
_type: deviceType.Switch,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 5
|
// progressive: 5
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Station渲染配置*/
|
/** Station渲染配置*/
|
||||||
deviceRender[deviceType.Station] = {
|
deviceRender[deviceType.Station] = {
|
||||||
|
_type: deviceType.Station,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 4
|
// progressive: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
/** StationStand渲染配置*/
|
/** StationStand渲染配置*/
|
||||||
deviceRender[deviceType.StationStand] = {
|
deviceRender[deviceType.StationStand] = {
|
||||||
|
_type: deviceType.StationStand,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 5
|
// progressive: 5
|
||||||
};
|
};
|
||||||
|
|
||||||
/** StationControl渲染配置*/
|
/** StationControl渲染配置*/
|
||||||
deviceRender[deviceType.StationControl] = {
|
deviceRender[deviceType.StationControl] = {
|
||||||
|
_type: deviceType.StationControl,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 4
|
// progressive: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ImageControl渲染配置*/
|
/** ImageControl渲染配置*/
|
||||||
deviceRender[deviceType.ImageControl] = {
|
deviceRender[deviceType.ImageControl] = {
|
||||||
|
_type: deviceType.ImageControl,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 5
|
// progressive: 5
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ZcControl渲染配置*/
|
/** ZcControl渲染配置*/
|
||||||
deviceRender[deviceType.ZcControl] = {
|
deviceRender[deviceType.ZcControl] = {
|
||||||
|
_type: deviceType.ZcControl,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 6
|
// progressive: 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/** LcControl渲染配置*/
|
/** LcControl渲染配置*/
|
||||||
deviceRender[deviceType.LcControl] = {
|
deviceRender[deviceType.LcControl] = {
|
||||||
|
_type: deviceType.LcControl,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 6
|
// progressive: 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/** LimitControl渲染配置*/
|
/** LimitControl渲染配置*/
|
||||||
deviceRender[deviceType.LimitControl] = {
|
deviceRender[deviceType.LimitControl] = {
|
||||||
|
_type: deviceType.LimitControl,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 5
|
// progressive: 5
|
||||||
};
|
};
|
||||||
|
|
||||||
/** StationDelayUnlock渲染配置*/
|
/** StationDelayUnlock渲染配置*/
|
||||||
deviceRender[deviceType.StationDelayUnlock] = {
|
deviceRender[deviceType.StationDelayUnlock] = {
|
||||||
|
_type: deviceType.StationDelayUnlock,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 6
|
// progressive: 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Train渲染配置*/
|
/** Train渲染配置*/
|
||||||
deviceRender[deviceType.Train] = {
|
deviceRender[deviceType.Train] = {
|
||||||
|
_type: deviceType.Train,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 9
|
// progressive: 9
|
||||||
};
|
};
|
||||||
|
|
||||||
/** TrainWindow渲染配置*/
|
/** TrainWindow渲染配置*/
|
||||||
deviceRender[deviceType.TrainWindow] = {
|
deviceRender[deviceType.TrainWindow] = {
|
||||||
|
_type: deviceType.TrainWindow,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 8
|
// progressive: 8
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Line渲染配置*/
|
/** Line渲染配置*/
|
||||||
deviceRender[deviceType.Line] = {
|
deviceRender[deviceType.Line] = {
|
||||||
|
_type: deviceType.Line,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 7
|
// progressive: 7
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Text渲染配置*/
|
/** Text渲染配置*/
|
||||||
deviceRender[deviceType.Text] = {
|
deviceRender[deviceType.Text] = {
|
||||||
|
_type: deviceType.Text,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 7
|
// progressive: 7
|
||||||
};
|
};
|
||||||
|
|
||||||
/** TrainWindow渲染配置*/
|
/** TrainWindow渲染配置*/
|
||||||
deviceRender[deviceType.TrainWindow] = {
|
deviceRender[deviceType.TrainWindow] = {
|
||||||
|
_type: deviceType.TrainWindow,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 4
|
// progressive: 4
|
||||||
};
|
};
|
||||||
/** Train渲染配置*/
|
/** Train渲染配置*/
|
||||||
deviceRender[deviceType.TRain] = {
|
deviceRender[deviceType.TRain] = {
|
||||||
|
_type: deviceType.TRain,
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
// progressive: 4
|
// progressive: 4
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,7 @@ export function calculateDCenter(viewRect, zrbound) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function deviceFactory(type, elem) {
|
export function deviceFactory(type, elem) {
|
||||||
return Object.assign({ _type: type }, deviceRender[type], elem);
|
return {...deviceRender[type], ...elem};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createDevice(type, model, propConvert) {
|
export function createDevice(type, model, propConvert) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="display-draft">
|
<div class="display-draft">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button v-if="isIBP" type="warning" @click="jumpIbp">IBP盘</el-button>
|
<el-button v-if="isAdmin || isIBP" type="warning" @click="jumpIbp">IBP盘</el-button>
|
||||||
<el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button>
|
<el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button>
|
||||||
<template v-if="isAdmin">
|
<template v-if="isAdmin">
|
||||||
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">按计划行车</el-button>
|
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">按计划行车</el-button>
|
||||||
|
Loading…
Reference in New Issue
Block a user