This commit is contained in:
zyy 2019-09-03 10:46:04 +08:00
commit 0938be08f5
60 changed files with 843 additions and 209 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -4,17 +4,17 @@ const deviceRender = {};
/** IbpText渲染配置*/ /** IbpText渲染配置*/
deviceRender[deviceType.IbpText] = { deviceRender[deviceType.IbpText] = {
zlevel: 2 zlevel: 3
}; };
/** SquareButton渲染配置*/ /** SquareButton渲染配置*/
deviceRender[deviceType.SquareButton] = { deviceRender[deviceType.SquareButton] = {
zlevel: 2 zlevel: 3
}; };
/** WarnButton渲染配置*/ /** WarnButton渲染配置*/
deviceRender[deviceType.WarnButton] = { deviceRender[deviceType.WarnButton] = {
zlevel: 2 zlevel: 3
}; };
/** Arrow渲染配置*/ /** Arrow渲染配置*/
@ -24,12 +24,13 @@ deviceRender[deviceType.Arrow] = {
/** RotatingButton渲染配置*/ /** RotatingButton渲染配置*/
deviceRender[deviceType.RotatingButton] = { deviceRender[deviceType.RotatingButton] = {
zlevel: 2 zlevel: 3
}; };
/** TipBox渲染配置*/ /** TipBox渲染配置*/
deviceRender[deviceType.TipBox] = { deviceRender[deviceType.TipBox] = {
zlevel: 1 zlevel: 2,
z: 2
}; };
/** BackGround渲染配置*/ /** BackGround渲染配置*/
@ -39,7 +40,7 @@ deviceRender[deviceType.Background] = {
/** CircularLamp渲染配置 */ /** CircularLamp渲染配置 */
deviceRender[deviceType.CircularLamp] = { deviceRender[deviceType.CircularLamp] = {
zlevel: 2 zlevel: 3
}; };
/** AppendageBox渲染配置 */ /** AppendageBox渲染配置 */
@ -49,22 +50,33 @@ deviceRender[deviceType.AppendageBox] = {
/** IbpLine渲染配置 */ /** IbpLine渲染配置 */
deviceRender[deviceType.IbpLine] = { deviceRender[deviceType.IbpLine] = {
zlevel: 2 zlevel: 1
}; };
/** Elevator 渲染配置 */ /** Elevator 渲染配置 */
deviceRender[deviceType.Elevator] = { deviceRender[deviceType.Elevator] = {
zlevel: 2 zlevel: 2,
z: 1
}; };
/** Key 渲染配置 */ /** Key 渲染配置 */
deviceRender[deviceType.Key] = { deviceRender[deviceType.Key] = {
zlevel: 3 zlevel: 4
}; };
/** TeleTerminal 渲染配置 */ /** TeleTerminal 渲染配置 */
deviceRender[deviceType.TeleTerminal] = { deviceRender[deviceType.TeleTerminal] = {
zlevel: 2 zlevel: 3
};
/** Clock 渲染配置*/
deviceRender[deviceType.Clock] = {
zlevel: 3
};
/** RotateTip 渲染配置 */
deviceRender[deviceType.RotateTip] = {
zlevel: 3
}; };
export default deviceRender; export default deviceRender;

View File

@ -11,7 +11,9 @@ const deviceType = {
Alarm: 'Alarm', Alarm: 'Alarm',
Elevator: 'Elevator', Elevator: 'Elevator',
Key: 'Key', Key: 'Key',
TeleTerminal: 'TeleTerminal' TeleTerminal: 'TeleTerminal',
Clock: 'Clock',
RotateTip: 'RotateTip'
}; };
export default deviceType; export default deviceType;

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,9 @@ class IbpPan {
// 设备数据 // 设备数据
this.ibpDevice = {}; this.ibpDevice = {};
// 展示的画布大小
this.canvasSize = {};
// 默认状态 // 默认状态
this.defaultStateDict = this.loadDefaultState(); this.defaultStateDict = this.loadDefaultState();
@ -40,7 +43,7 @@ class IbpPan {
this.$painter = new Painter(this); this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()}); this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
this.$painter.updateTransform(this.$options); this.$painter.updateTransform(this.$options, this.canvasSize);
this.optionsHandler = this.setOptions.bind(this); this.optionsHandler = this.setOptions.bind(this);
@ -71,12 +74,17 @@ class IbpPan {
// 保存原始数据 // 保存原始数据
this.data = config; this.data = config;
// 保存需展现的画布大小
this.canvasSize = {
x: 0,
y: 0,
width: config.background.width,
height: config.background.height
};
// 解析地图数据 // 解析地图数据
this.ibpDevice = ibpDevice; this.ibpDevice = ibpDevice;
// 加载对应皮肤
// this.style = this.loadStyle(this.skinCode);
// 数据加载完成 回调 // 数据加载完成 回调
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); } if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); }
@ -86,7 +94,7 @@ class IbpPan {
// 视图加载完成 回调 // 视图加载完成 回调
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); } if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); }
this.$painter.updateTransform(this.$options); this.$painter.updateTransform(this.$options, this.canvasSize);
} }
setDefaultState() { setDefaultState() {
@ -98,7 +106,7 @@ class IbpPan {
setOptions(opts) { setOptions(opts) {
const options = this.pullBack(opts); const options = this.pullBack(opts);
this.$options.update(options); this.$options.update(options);
this.$painter.updateTransform(this.$options); this.$painter.updateTransform(this.$options, this.canvasSize);
if (this.$options.disabled == true) { if (this.$options.disabled == true) {
this.$mouseController.disable(); this.$mouseController.disable();
@ -132,8 +140,7 @@ class IbpPan {
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
if (!elem._dispose) { if (!elem._dispose) {
this.ibpDevice[code] = nDevice; this.ibpDevice[code] = nDevice;
console.log('--3', nDevice); this.$painter.add(nDevice, true);
this.$painter.add(nDevice);
} }
}); });
@ -223,7 +230,6 @@ class IbpPan {
} }
resize(opt) { resize(opt) {
console.log('----------',this.$ibpZr);
this.$ibpZr.resize(opt); this.$ibpZr.resize(opt);
this.$painter.updateZrSize(opt); this.$painter.updateZrSize(opt);
} }
@ -237,7 +243,22 @@ class IbpPan {
this.ibpDevice = {}; this.ibpDevice = {};
this.$painter.clear(); this.$painter.clear();
} }
initClockTime(initTime) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.initClockTime(elem, initTime);
}
});
}
setClockStart(started) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.setClockStart(elem, started);
}
});
}
dispose() { dispose() {
this.off(this.events.Pan, this.optionsHandler); this.off(this.events.Pan, this.optionsHandler);
this.off(this.events.Zoom, this.optionsHandler); this.off(this.events.Zoom, this.optionsHandler);

View File

@ -58,13 +58,12 @@ class Painter {
* 添加视图 * 添加视图
* @param {*} device * @param {*} device
*/ */
add(device) { add(device, draggable) {
device = Object.assign(device, { event: this.$ibp.$mouseController }); device = Object.assign(device, { event: this.$ibp.$mouseController });
const instance = shapefactory(device, this.$ibp); const instance = shapefactory(device, this.$ibp);
console.log('--4', instance);
if (instance) { if (instance) {
device.instance = instance; device.instance = instance;
instance.setDraggable(); draggable?instance.setDraggable():'';
this.$transformHandle.transformView(instance); this.$transformHandle.transformView(instance);
this.ibpInstanceLevel[device.model._type].add(instance); this.ibpInstanceLevel[device.model._type].add(instance);
} }
@ -114,8 +113,8 @@ class Painter {
* 更新transform变化 * 更新transform变化
* @param {*} opt * @param {*} opt
*/ */
updateTransform(opt) { updateTransform(opt, canvasSize) {
this.$transformHandle.updateTransform(opt); this.$transformHandle.updateTransform(opt, canvasSize);
} }
/** /**
@ -145,7 +144,18 @@ class Painter {
} }
} }
/**
* 初始化电子时钟时间
*/
initClockTime(device, initTime) {
device.instance.setClockTime(initTime);
}
/**
* 电子时钟开始跑秒或暂停
*/
setClockStart(device, started) {
device.instance.setClockStart(started);
}
/** /**
* 设置图层可见 * 设置图层可见
* @param {*} code * @param {*} code

View File

@ -20,7 +20,7 @@ export default class alarm extends Group {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: alarmpic, image: alarmpic,
x: model.point.x, x: model.point.x,
@ -53,6 +53,7 @@ export default class alarm extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -67,7 +68,7 @@ export default class alarm extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.draggable = false; this.dragging = false;
} }
} }

View File

@ -45,6 +45,7 @@ export default class AppendageBox extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -57,6 +58,7 @@ export default class AppendageBox extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }

View File

@ -78,6 +78,7 @@ class Arrow extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -90,6 +91,7 @@ class Arrow extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }
} }

View File

@ -9,31 +9,30 @@ export default class background extends Group {
this.model = device.model; this.model = device.model;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = 1; this.z = 1;
this.imageBgArray = [];
// this.model.width = 4100;
// this.model.height = 900;
this.create(); this.create();
} }
create() { create() {
this.imageBg1 = new Image({ const widthNum = Math.ceil(parseInt(this.model.width)/2048);
zlevel: this.zlevel, const heightNum = Math.ceil(parseInt(this.model.height)/1024);
z: this.z, for (let i = 0; i<widthNum; i++) {
style: { for (let j = 0; j<heightNum; j++) {
x: 0, const imageBg = new Image({
y: 0, zlevel: this.zlevel,
image: ibpBg, z: this.z,
width: 2048, style: {
height: 1024 x: i*2048,
y: j*1024,
image: ibpBg,
width: 2048,
height: 1024
}
});
this.imageBgArray.push(imageBg);
} }
}); }
this.imageBg2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
x: 2048,
y: 0,
image: ibpBg,
width: 2048,
height: 1024
}
});
this.tailorRect = new Rect({ this.tailorRect = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -47,9 +46,11 @@ export default class background extends Group {
this.tailorBgImage(); this.tailorBgImage();
} }
tailorBgImage() { tailorBgImage() {
// this.imageBg.setClipPath(this.tailorRect); const _this = this;
this.add(this.imageBg1); this.imageBgArray.forEach( function(elem) {
this.add(this.imageBg2); elem.setClipPath(_this.tailorRect);
_this.add(elem);
});
} }
setDraggable() { setDraggable() {
} }

View File

@ -40,7 +40,7 @@ export default class button extends Group {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: this.getImagePic(), image: this.getImagePic(),
x: model.point.x, x: model.point.x,
@ -114,6 +114,7 @@ export default class button extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -126,6 +127,7 @@ export default class button extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }

View File

@ -48,6 +48,7 @@ export default class CircularLamp extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -60,6 +61,7 @@ export default class CircularLamp extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }
} }

251
src/ibp/shape/clock.js Normal file
View File

@ -0,0 +1,251 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import clock0 from '@/assets/ibp_images/clock/clock_0.png';
import clock1 from '@/assets/ibp_images/clock/clock_1.png';
import clock2 from '@/assets/ibp_images/clock/clock_2.png';
import clock3 from '@/assets/ibp_images/clock/clock_3.png';
import clock4 from '@/assets/ibp_images/clock/clock_4.png';
import clock5 from '@/assets/ibp_images/clock/clock_5.png';
import clock6 from '@/assets/ibp_images/clock/clock_6.png';
import clock7 from '@/assets/ibp_images/clock/clock_7.png';
import clock8 from '@/assets/ibp_images/clock/clock_8.png';
import clock9 from '@/assets/ibp_images/clock/clock_9.png';
import clockBg from '@/assets/ibp_images/clock/clock_bg.png';
import clockColon from '@/assets/ibp_images/clock/clock_colon.png';
export default class clock extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.initTime = 0;
this.create();
}
create() {
this.clockBg = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockBg,
x: this.model.point.x,
y: this.model.point.y,
width: this.model.width,
height: this.model.width/493*156
}
});
this.num1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.1,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.22,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num3 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.39,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num4 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.52,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num5 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.69,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num6 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.82,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.clockColon1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: this.model.point.x+this.model.width*0.16,
y: this.model.point.y-this.model.width*0.028,
width: this.model.width*0.37,
height: this.model.width/1*0.37
}
});
this.clockColon2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: this.model.point.x+this.model.width*0.46,
y: this.model.point.y-this.model.width*0.028,
width: this.model.width*0.37,
height: this.model.width/1*0.37
}
});
this.add(this.clockBg);
this.add(this.num1);
this.add(this.num2);
this.add(this.num3);
this.add(this.num4);
this.add(this.num5);
this.add(this.num6);
this.add(this.clockColon1);
this.add(this.clockColon2);
}
getImagePic(context) {
let pic = clock0;
switch (context) {
case '0':
pic = clock0;
break;
case '1':
pic = clock1;
break;
case '2':
pic = clock2;
break;
case '3':
pic = clock3;
break;
case '4':
pic = clock4;
break;
case '5':
pic = clock5;
break;
case '6':
pic = clock6;
break;
case '7':
pic = clock7;
break;
case '8':
pic = clock8;
break;
case '9':
pic = clock9;
break;
}
return pic;
}
setClockStart() {
const _this = this;
this.timer = setInterval(() => {
_this.handleClock(_this);
}, 1000);
}
handleClock(_this) {
_this.initTime += 1000;
const newDate = new Date();
newDate.setTime(_this.initTime);
let seconds = newDate.getSeconds() +'';
let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + '';
if (seconds.length<2) {
seconds = '0' + seconds;
}
if (minutes.length<2) {
minutes = '0' + minutes;
}
if (hours.length<2) {
hours = '0'+ hours;
}
_this.setNumPic(6, seconds.charAt(1));
_this.setNumPic(5, seconds.charAt(0));
_this.setNumPic(4, minutes.charAt(1));
_this.setNumPic(3, minutes.charAt(0));
_this.setNumPic(2, hours.charAt(1));
_this.setNumPic(1, hours.charAt(0));
}
setNumPic(num, context) {
switch (num) {
case 1:
this.num1.setStyle('image', this.getImagePic(context));
break;
case 2:
this.num2.setStyle('image', this.getImagePic(context));
break;
case 3:
this.num3.setStyle('image', this.getImagePic(context));
break;
case 4:
this.num4.setStyle('image', this.getImagePic(context));
break;
case 5:
this.num5.setStyle('image', this.getImagePic(context));
break;
case 6:
this.num6.setStyle('image', this.getImagePic(context));
}
}
setClockTime(initTime) {
this.initTime = initTime;
const newDate = new Date();
newDate.setTime(initTime);
let seconds = newDate.getSeconds() +'';
let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + '';
if (seconds.length<2) {
seconds = '0' + seconds;
}
if (minutes.length<2) {
minutes = '0' + minutes;
}
if (hours.length<2) {
hours = '0'+ hours;
}
this.setNumPic(6, seconds.charAt(1));
this.setNumPic(5, seconds.charAt(0));
this.setNumPic(4, minutes.charAt(1));
this.setNumPic(3, minutes.charAt(0));
this.setNumPic(2, hours.charAt(1));
this.setNumPic(1, hours.charAt(0));
}
setDraggable() {
}
}

View File

@ -20,7 +20,7 @@ export default class elevator extends Group {
// width: model.width, // width: model.width,
// height: model.height, // height: model.height,
position: [model.point.x, model.point.y], position: [model.point.x, model.point.y],
draggable: model.draggable || false draggable: false
}); });
this.elevatorBack = new ElevatorBack({model: { this.elevatorBack = new ElevatorBack({model: {
@ -108,6 +108,7 @@ export default class elevator extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.draggroup =this.grouper; this.draggroup =this.grouper;
this.deltPostion =[e.event.zrX-this.draggroup.position[0], e.event.zrY-this.draggroup.position[1]]; this.deltPostion =[e.event.zrX-this.draggroup.position[0], e.event.zrY-this.draggroup.position[1]];

View File

@ -12,6 +12,8 @@ import RotatingButton from './rotatingButton';
import Elevator from './elevator'; import Elevator from './elevator';
import Key from './key'; import Key from './key';
import TeleTerminal from './teleTerminal'; import TeleTerminal from './teleTerminal';
import Clock from './clock';
import RotateTip from './rotateTip';
const ibpShape = {}; const ibpShape = {};
ibpShape[deviceType.Arrow] = Arrow; ibpShape[deviceType.Arrow] = Arrow;
@ -27,6 +29,8 @@ ibpShape[deviceType.RotatingButton] = RotatingButton;
ibpShape[deviceType.Elevator] = Elevator; ibpShape[deviceType.Elevator] = Elevator;
ibpShape[deviceType.Key] = Key; ibpShape[deviceType.Key] = Key;
ibpShape[deviceType.TeleTerminal] = TeleTerminal; ibpShape[deviceType.TeleTerminal] = TeleTerminal;
ibpShape[deviceType.Clock] = Clock;
ibpShape[deviceType.RotateTip] = RotateTip;
function shapefactory(device, ibp) { function shapefactory(device, ibp) {
const type = device.model._type; const type = device.model._type;

View File

@ -46,6 +46,7 @@ export default class ibpLine extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -60,6 +61,7 @@ export default class ibpLine extends Group {
this.model.point1.y = this.model.point1.y - this.offsetY + e.offsetY; this.model.point1.y = this.model.point1.y - this.offsetY + e.offsetY;
this.model.point2.x = this.model.point2.x - this.offsetX + e.offsetX; this.model.point2.x = this.model.point2.x - this.offsetX + e.offsetX;
this.model.point2.y = this.model.point2.y - this.offsetY + e.offsetY; this.model.point2.y = this.model.point2.y - this.offsetY + e.offsetY;
this.dragging = false;
} }
} }
} }

View File

@ -20,7 +20,7 @@ export default class ibpText extends Group {
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
silent: model.silent || false, silent: model.silent || false,
draggable: model.draggable || false, draggable: false,
style: { style: {
x: model.point.x, x: model.point.x,
y: model.point.y, y: model.point.y,
@ -51,6 +51,7 @@ export default class ibpText extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -63,6 +64,7 @@ export default class ibpText extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }
} }

View File

@ -45,6 +45,7 @@ export default class ibpTipBox extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -57,6 +58,7 @@ export default class ibpTipBox extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }
} }

View File

@ -21,7 +21,7 @@ export default class key extends Group {
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: model.z, z: model.z,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: this.getRotateColor(), image: this.getRotateColor(),
x: model.point.x, x: model.point.x,
@ -87,6 +87,7 @@ export default class key extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;

View File

@ -21,7 +21,7 @@ export default class rotateTip extends Group {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: this.getRotateColor(), image: this.getRotateColor(),
x: model.point.x, x: model.point.x,
@ -57,7 +57,7 @@ export default class rotateTip extends Group {
} }
setDraggable() { setDraggable() {
this.arrow.attr('draggable', true); this.imageBg.attr('draggable', true);
this.createMouseEvent(); this.createMouseEvent();
} }
createMouseEvent() { createMouseEvent() {
@ -70,6 +70,7 @@ export default class rotateTip extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -84,6 +85,7 @@ export default class rotateTip extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }
} }

View File

@ -45,6 +45,7 @@ export default class RotatingButton extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -57,6 +58,7 @@ export default class RotatingButton extends Group {
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
} }
} }
} }

View File

@ -20,7 +20,7 @@ export default class alarm extends Group {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: teleTerminalPic, image: teleTerminalPic,
x: model.point.x, x: model.point.x,
@ -54,6 +54,7 @@ export default class alarm extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -65,9 +66,10 @@ export default class alarm extends Group {
mouseup(e) { mouseup(e) {
this.event.enable(); this.event.enable();
if (this.dragging) { if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
} this.dragging = false;
}
} }
} }

View File

@ -46,26 +46,26 @@ class TransformHandle {
} }
// 更新偏移量 // 更新偏移量
updateTransform(opts) { updateTransform(opts, canvasSize) {
const elRect = this.parentLevel.getBoundingRect(); if (canvasSize) {
const zrRect = this.rect; const elRect = this.parentLevel.getBoundingRect();
const zrRect = this.rect;
if (canvasSize.x - opts.offsetX > 0) {
opts.offsetX = -elRect.x;
}
if (elRect.x - opts.offsetX > 0) { if (canvasSize.y - opts.offsetY > 0) {
opts.offsetX = -elRect.x; opts.offsetY = -elRect.y;
}
if (elRect.x + canvasSize.width < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width);
}
if (elRect.y + canvasSize.height < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height);
}
} }
if (elRect.y - opts.offsetY > 0) {
opts.offsetY = -elRect.y;
}
if (elRect.x + elRect.width < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + elRect.width);
}
if (elRect.y + elRect.height < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + elRect.height);
}
this.transform = createTransform(opts); this.transform = createTransform(opts);
this.transformAll(); this.transformAll();
} }

View File

@ -38,13 +38,12 @@ export function createModel(type, model, propConvert) {
return { instance: null, event: null, model: propConvert ? propConvert.initPrivateProps(tempModel) : tempModel }; return { instance: null, event: null, model: propConvert ? propConvert.initPrivateProps(tempModel) : tempModel };
} }
export function parser(data, config) { export function parser(data) {
var ibpDevice = {}; var ibpDevice = {};
const propConvert = null; const propConvert = null;
// var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null; // var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null;
if (data) { if (data) {
Object.assign(data.background);
Object.assign(data.background, config);
ibpDevice[data.background.code] = createModel(deviceType.Background, data.background, propConvert); ibpDevice[data.background.code] = createModel(deviceType.Background, data.background, propConvert);
zrUtil.each(data.textList || [], elem => { zrUtil.each(data.textList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.IbpText, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.IbpText, elem, propConvert);
@ -94,6 +93,13 @@ export function parser(data, config) {
ibpDevice[elem.code] = createModel(deviceType.TeleTerminal, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.TeleTerminal, elem, propConvert);
}, this); }, this);
zrUtil.each(data.clockList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Clock, elem, propConvert);
});
zrUtil.each(data.rotateTipList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.RotateTip, elem, propConvert);
});
} }
return ibpDevice; return ibpDevice;
@ -309,7 +315,38 @@ export function updateIbpData(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);
} }

View File

@ -84,8 +84,8 @@ import RunPlanEveryDay from '@/views/publish/runPlanEveryDay/index';
import ProductStatus from '@/views/publish/productStatus/index'; import ProductStatus from '@/views/publish/productStatus/index';
import PublishLesson from '@/views/publish/publishLesson/index'; import PublishLesson from '@/views/publish/publishLesson/index';
// import SimulationScript from '@/views/publish/simulationScript/index'; // import SimulationScript from '@/views/publish/simulationScript/index';
// import IbpDraft from '@/views/ibp/ibpDraft/index'; import IbpDraft from '@/views/ibp/ibpDraft/index';
// import IbpEdit from '@/views/ibp/ibpDraft/ibpEdit/index'; import IbpEdit from '@/views/ibp/ibpDraft/ibpEdit/index';
import Commodity from '@/views/orderauthor/commodity/index'; import Commodity from '@/views/orderauthor/commodity/index';
import CommodityDraft from '@/views/orderauthor/commodity/draft'; import CommodityDraft from '@/views/orderauthor/commodity/draft';
@ -388,13 +388,13 @@ export const asyncRouter = [
} }
] ]
}, },
// { {
// path: 'ibp/edit', path: 'ibp/edit',
// component: IbpEdit, component: IbpEdit,
// meta: { meta: {
// i18n: 'router.ibpDraw' i18n: 'router.ibpDraw'
// } }
// }, },
{ {
path: 'runPlan', path: 'runPlan',
redirect: '/map/runPlan/view/draft', redirect: '/map/runPlan/view/draft',

View File

@ -36,7 +36,6 @@ const ibp = {
mutations: { mutations: {
ibpRender: (state, devices) => { ibpRender: (state, devices) => {
console.log('--2', devices);
Vue.prototype.$ibp && Vue.prototype.$ibp.render(devices); Vue.prototype.$ibp && Vue.prototype.$ibp.render(devices);
}, },
setIbpData: (state, ibp) => { setIbpData: (state, ibp) => {

View File

@ -3,8 +3,8 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培 // BASE_API = 'http://192.168.3.4:9000' // 琰培
} else { } else {

View File

@ -18,7 +18,6 @@
@tryTime="tryTime" @tryTime="tryTime"
@hidepanel="hidepanel" @hidepanel="hidepanel"
@quitQuest="quitQuest" @quitQuest="quitQuest"
@showIbp="showIbp"
@showScheduling="showScheduling" @showScheduling="showScheduling"
/> />
@ -47,7 +46,6 @@
<Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" />
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" /> <Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<ibp-plate v-show="ibpShow" ref="ibpPlate" @hideIbp="hideIbp" />
<fault-choose ref="faultChoose" :group="group" /> <fault-choose ref="faultChoose" :group="group" />
<run-plan-Load ref="runPlanLoad" :group="group" /> <run-plan-Load ref="runPlanLoad" :group="group" />
@ -87,7 +85,6 @@ import Vue from 'vue';
// //
import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation'; import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import IbpPlate from '@/views/ibp/index';
export default { export default {
name: 'DisplayDraft', name: 'DisplayDraft',
@ -108,7 +105,6 @@ export default {
MenuSystemTime, MenuSystemTime,
Jl3dSimulation, Jl3dSimulation,
Jl3dDrive, Jl3dDrive,
IbpPlate,
Scheduling Scheduling
}, },
props: { props: {
@ -563,11 +559,6 @@ export default {
this.$refs.Jl3dSimulation.show(this.skinCode); this.$refs.Jl3dSimulation.show(this.skinCode);
} }
}, },
showIbp() {
this.panelShow = false;
this.ibpShow = true;
this.$refs.ibpPlate.show();
},
showScheduling() { showScheduling() {
this.$refs.scheduling.doShow(); this.$refs.scheduling.doShow();
}, },
@ -579,10 +570,6 @@ export default {
this.panelShow = true; this.panelShow = true;
this.drivingShow = false; this.drivingShow = false;
}, },
hideIbp() {
this.panelShow = true;
this.ibpShow = false;
},
runPlanViewShow() { runPlanViewShow() {
this.$refs.runPlanView.doShow(); this.$refs.runPlanView.doShow();
}, },

View File

@ -7,7 +7,6 @@
</div> </div>
<div class="display-draft"> <div class="display-draft">
<el-button-group> <el-button-group>
<el-button v-if="isShowIbp" type="success" @click="jumpIbp">IBP盘</el-button>
<el-button v-if="isShowScheduling" type="primary" @click="jumpScheduling">排班计划</el-button> <el-button v-if="isShowScheduling" type="primary" @click="jumpScheduling">排班计划</el-button>
<el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button> <el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
<template v-if="isShowQuest"> <template v-if="isShowQuest">
@ -196,9 +195,6 @@ export default {
jumpjlmap3d() { jumpjlmap3d() {
this.$emit('hidepanel'); this.$emit('hidepanel');
}, },
jumpIbp() {
this.$emit('showIbp');
},
jumpScheduling() { jumpScheduling() {
this.$emit('showScheduling'); this.$emit('showScheduling');
}, },

View File

@ -74,8 +74,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid){ if (valid){
const alarmModel = { const alarmModel = {
zlevel: 2,
z: 1,
point:{ point:{
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -93,8 +91,6 @@
}, },
deleteDevice() { deleteDevice() {
const alarmModel = { const alarmModel = {
zlevel: 2,
z: 1,
point:{ point:{
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -82,8 +82,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid){ if (valid){
const appendageBoxModel = { const appendageBoxModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -102,8 +100,6 @@
}, },
deleteDevice() { deleteDevice() {
const appendageBoxModel = { const appendageBoxModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -98,8 +98,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid){ if (valid){
const arrowModel = { const arrowModel = {
zlevel: 2,
z: 1,
point: this.point, point: this.point,
_type: 'Arrow', _type: 'Arrow',
code: this.form.code, code: this.form.code,
@ -118,8 +116,6 @@
}, },
deleteDevice() { deleteDevice() {
const arrowModel = { const arrowModel = {
zlevel: 2,
z: 1,
point: this.point, point: this.point,
_type: 'Arrow', _type: 'Arrow',
code: this.form.code, code: this.form.code,

View File

@ -8,7 +8,7 @@
<el-input-number v-model="form.bgHeight" controls-position="right" :min="1"></el-input-number> <el-input-number v-model="form.bgHeight" controls-position="right" :min="1"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button> <el-button type="primary" @click="onSubmit">修改</el-button>
<el-button>取消</el-button> <el-button>取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -48,8 +48,6 @@
methods: { methods: {
onSubmit() { onSubmit() {
const bgModel = { const bgModel = {
zlevel: 1,
z: 1,
x: 0, x: 0,
y: 0, y: 0,
_type: 'Background', _type: 'Background',

View File

@ -88,8 +88,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
const buttonModel = { const buttonModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -109,8 +107,6 @@
}, },
deleteDevice() { deleteDevice() {
const buttonModel = { const buttonModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -0,0 +1,126 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form-item label="电子表编号" prop="code">
<el-input :disabled="true" v-model="form.code" >
<el-button slot="append" :disabled="isUpdate" type="primary" @click="generateCode">生成编号</el-button>
</el-input>
</el-form-item>
<el-form-item label="电子表宽度" prop="clockWidth">
<el-input-number v-model="form.clockWidth" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="X轴坐标">
<el-input-number v-model="form.x" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="Y轴坐标">
<el-input-number v-model="form.y" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" @click="deleteDevice" type="danger">删除</el-button>
<el-button v-show="showDeleteButton" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'ClockDraft',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
code: '',
clockWidth: '',
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message: '请输入电子表编号', trigger: 'blur' },
],
clockWidth: [
{ required: true, message: '请输入电子表宽度', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
'$store.state.ibp.rightClickCount': function (val) {
const model = this.$store.getters['ibp/updateDeviceData'];
if (model._type === 'Clock' ){
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.clockWidth = model.width;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {
},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const clockModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Clock',
code: this.form.code,
width: this.form.clockWidth,
};
this.$emit('createClock', clockModel);
this.initPage();
}else {
return false;
}
});
},
deleteDevice() {
const clockModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Clock',
code: this.form.code,
width: this.form.clockWidth,
};
this.$emit('deleteDataModel',clockModel );
this.initPage();
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
buttonColor: '',
buttonWidth: '',
x: 10,
y: 10
};
},
generateCode() {
const mydate = new Date();
this.form.code = "clock_"+mydate.getDay()+ mydate.getHours()+ mydate.getMinutes()+mydate.getSeconds()+mydate.getMilliseconds()+ Math.round(Math.random() * 10000);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -101,8 +101,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid){ if (valid){
const elevatorModel = { const elevatorModel = {
zlevel: 2,
z: 2,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -124,8 +122,6 @@
}, },
deleteDevice() { deleteDevice() {
const elevatorModel = { const elevatorModel = {
zlevel: 2,
z: 2,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -93,8 +93,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if(valid) { if(valid) {
const keyModel = { const keyModel = {
zlevel: 3,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -116,8 +114,6 @@
}, },
deleteDevice() { deleteDevice() {
const keyModel = { const keyModel = {
zlevel: 3,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -74,8 +74,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if(valid){ if(valid){
const lampModel = { const lampModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -95,8 +93,6 @@
}, },
deleteDevice() { deleteDevice() {
const lampModel = { const lampModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -92,8 +92,6 @@
this.$refs[form].validate((valid) =>{ this.$refs[form].validate((valid) =>{
if (valid){ if (valid){
const lineModel = { const lineModel = {
zlevel: 2,
z: 1,
point1: { point1: {
x: this.form.x1, x: this.form.x1,
y: this.form.y1 y: this.form.y1
@ -117,8 +115,6 @@
}, },
deleteDevice() { deleteDevice() {
const lineModel = { const lineModel = {
zlevel: 2,
z: 1,
point1: { point1: {
x: this.form.x1, x: this.form.x1,
y: this.form.y1 y: this.form.y1

View File

@ -0,0 +1,128 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="120px">
<el-form-item label="旋转提示编号" prop="code">
<el-input :disabled="true" v-model="form.code">
<el-button slot="append" :disabled="isUpdate" type="primary" @click="generateCode">生成编号</el-button>
</el-input>
</el-form-item>
<el-form-item label="旋转提示宽度" prop="rotateTipWidth">
<el-input-number v-model="form.rotateTipWidth" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="X轴坐标">
<el-input-number v-model="form.x" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="Y轴坐标">
<el-input-number v-model="form.y" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" @click="deleteDevice" type="danger">删除</el-button>
<el-button v-show="showDeleteButton" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'KeyDraft',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
code: '',
rotateTipWidth: '',
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message: '请输入旋转提示编号', trigger: 'blur' },
],
rotateTipWidth: [
{ required: true, message: '请输入旋转提示宽度', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
'$store.state.ibp.rightClickCount': function (val) {
const model = this.$store.getters['ibp/updateDeviceData'];
if (model._type === 'RotateTip' ){
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.rotateTipWidth = model.width;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {
},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if(valid) {
const rotateTipModel = {
point: {
x: this.form.x,
y: this.form.y
},
draggable: true,
_type: 'RotateTip',
code: this.form.code,
width: this.form.rotateTipWidth,
};
this.$emit('createRotateTip', rotateTipModel);
this.initPage();
}else {
return false;
}
});
},
deleteDevice() {
const rotateTipModel = {
point: {
x: this.form.x,
y: this.form.y
},
draggable: true,
_type: 'Key',
code: this.form.code,
width: this.form .rotateTipWidth,
};
this.$emit('deleteDataModel',rotateTipModel);
this.initPage();
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
rotateTipWidth: '',
x: 10,
y: 10
};
},
generateCode() {
const mydate = new Date();
this.form.code = "rTip_"+mydate.getDay()+ mydate.getHours()+ mydate.getMinutes()+mydate.getSeconds()+mydate.getMilliseconds()+ Math.round(Math.random() * 10000);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -74,8 +74,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
const rotatingButtonModel = { const rotatingButtonModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -95,8 +93,6 @@
}, },
deleteDevice() { deleteDevice() {
const rotatingButtonModel = { const rotatingButtonModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -75,8 +75,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid){ if (valid){
const TerminalModel = { const TerminalModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -96,8 +94,6 @@
}, },
deleteDevice() { deleteDevice() {
const TerminalModel = { const TerminalModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -98,8 +98,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
const textModel = { const textModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -119,8 +117,6 @@
} }
}); });
const textModel = { const textModel = {
zlevel: 2,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -91,8 +91,6 @@
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
const tipBoxModel = { const tipBoxModel = {
zlevel: 1,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
@ -113,8 +111,6 @@
}, },
deleteDevice() { deleteDevice() {
const tipBoxModel = { const tipBoxModel = {
zlevel: 1,
z: 1,
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y

View File

@ -78,18 +78,30 @@
> >
</ibp-telephone-terminal> </ibp-telephone-terminal>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="电梯" name="elevator"> <el-tab-pane label="电梯" name="Elevator">
<ibp-elevator ref="elevator" <ibp-elevator ref="elevator"
@createElevator="createDataModel" @deleteDataModel="deleteDataModel" @createElevator="createDataModel" @deleteDataModel="deleteDataModel"
> >
</ibp-elevator> </ibp-elevator>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="钥匙" name="key"> <el-tab-pane label="钥匙" name="Key">
<ibp-key ref="key" <ibp-key ref="key"
@createKey="createDataModel" @deleteDataModel="deleteDataModel" @createKey="createDataModel" @deleteDataModel="deleteDataModel"
> >
</ibp-key> </ibp-key>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="电子表" name="Clock">
<ibp-clock ref="clock"
@createClock="createDataModel" @deleteDataModel="deleteDataModel"
>
</ibp-clock>
</el-tab-pane>
<el-tab-pane label="旋转提示" name="RotateTip">
<ibp-rotate-tip ref="rotateTip"
@createRotateTip="createDataModel" @deleteDataModel="deleteDataModel"
>
</ibp-rotate-tip>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
</div> </div>
@ -98,6 +110,7 @@
<script> <script>
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import {modelFactory} from '@/ibp/utils/parser'
import IbpText from './ibpText'; import IbpText from './ibpText';
import IbpTipBox from './ibpTipBox'; import IbpTipBox from './ibpTipBox';
import IbpButton from './ibpButton'; import IbpButton from './ibpButton';
@ -111,8 +124,8 @@
import IbpTelephoneTerminal from './ibpTelephoneTerminal'; import IbpTelephoneTerminal from './ibpTelephoneTerminal';
import IbpElevator from './ibpElevator'; import IbpElevator from './ibpElevator';
import IbpKey from './ibpKey'; import IbpKey from './ibpKey';
import IbpClock from './ibpClock';
import IbpRotateTip from './ibpRotateTip';
export default { export default {
name: 'IbpOperate', name: 'IbpOperate',
@ -129,7 +142,9 @@
IbpLine, IbpLine,
IbpTelephoneTerminal, IbpTelephoneTerminal,
IbpElevator, IbpElevator,
IbpKey IbpKey,
IbpClock,
IbpRotateTip
}, },
mixins: [ mixins: [
@ -154,8 +169,8 @@
}, },
methods: { methods: {
createDataModel(model) { createDataModel(model) {
console.log('-1',model); const newModel = modelFactory(model.type, model);
this.$store.dispatch('ibp/updateIbpDevices', model); this.$store.dispatch('ibp/updateIbpDevices', newModel);
}, },
deleteDataModel(model) { deleteDataModel(model) {
this.$store.dispatch('ibp/deleteIbpDevices', model); this.$store.dispatch('ibp/deleteIbpDevices', model);
@ -176,7 +191,9 @@
this.$refs.rotatingbutton.initPage(); this.$refs.rotatingbutton.initPage();
this.$refs.elevator.initPage(); this.$refs.elevator.initPage();
this.$refs.key.initPage(); this.$refs.key.initPage();
this.$refs.teleTerminal.initPage() this.$refs.teleTerminal.initPage();
this.$refs.clock.initPage();
this.$refs.rotateTip.initPage();
} }
} }
}; };

View File

@ -2,7 +2,7 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="mapPaint"> <div class="mapPaint">
<div class="map-view"> <div class="map-view">
<ibp-plate ref="ibpPlate" /> <ibp-plate ref="ibpPlate" :size="size"/>
</div> </div>
<div class="map-draft"> <div class="map-draft">
<ibp-operate ref="ibpOperate" /> <ibp-operate ref="ibpOperate" />
@ -27,7 +27,11 @@ export default {
autoSaveTask: null, autoSaveTask: null,
selected: null, selected: null,
mapInfo: { name: '' }, mapInfo: { name: '' },
timeDemon: null timeDemon: null,
size: {
width: this.$store.state.app.width-521,
height: this.$store.state.app.height-60
},
}; };
}, },
watch: { watch: {

View File

@ -30,9 +30,20 @@ export default {
y: 0 y: 0
} }
}, },
showBackButton: true showBackButton: true,
initZrender: false,
initTime: '',
started: false
}; };
}, },
props: {
size: {
type: Object,
default() {
return null;
}
}
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'canvasWidth', 'canvasWidth',
@ -43,14 +54,31 @@ export default {
} }
}, },
watch: { watch: {
'$store.state.config.canvasSizeCount': function () { '$store.state.config.canvasSizeCount': function (val) {
this.resetSize(); if (this.initZrender) {
this.resetSize();
}
}, },
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
const width = this.$store.state.app.width; const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.$store.state.app.height; const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width- 521, height: height - 60 }); this.$store.dispatch('config/resize', { width: width, height: height});
} },
'$store.state.training.initTime': function (initTime) {
this.initTime = initTime;
if (this.$ibp) {
this.initClockTime(initTime);
}
},
'$store.state.training.started': function (started) {
this.started = started;
if (this.$ibp){
this.setClockStart(started);
}
}
},
mounted() {
this.setWindowSize();
}, },
beforeDestroy() { beforeDestroy() {
if (this.$ibp) { if (this.$ibp) {
@ -62,7 +90,6 @@ export default {
document.getElementById(this.ibpId).oncontextmenu = function (e) { document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false; return false;
}; };
const data = parser(ibpData, {width: this.canvasWidth, height: this.canvasHeight}); const data = parser(ibpData, {width: this.canvasWidth, height: this.canvasHeight});
this.$ibp = new IbpPan({ this.$ibp = new IbpPan({
dom: document.getElementById(this.ibpId), dom: document.getElementById(this.ibpId),
@ -85,12 +112,14 @@ export default {
Vue.prototype.$ibp = this.$ibp; Vue.prototype.$ibp = this.$ibp;
this.setMap(data); this.setMap(data);
this.$store.dispatch('ibp/setIbpData', ibpData); this.$store.dispatch('ibp/setIbpData', ibpData);
this.initClockTime(this.initTime);
window.document.oncontextmenu = function () { window.document.oncontextmenu = function () {
return false; return false;
}; };
this.initZrender = true;
}, },
setMap(data) { setMap(data) {
this.$ibp.setMap(data, data); this.$ibp.setMap(ibpData, data);
}, },
resetSize() { resetSize() {
this.$nextTick(() => { this.$nextTick(() => {
@ -100,6 +129,13 @@ export default {
this.$ibp && this.$ibp.resize({ width: this.width, height: this.height }); this.$ibp && this.$ibp.resize({ width: this.width, height: this.height });
}); });
}, },
setWindowSize() {
this.$nextTick(() => {
const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height });
});
},
back() { back() {
this.$emit('hideIbp'); this.$emit('hideIbp');
}, },
@ -116,7 +152,15 @@ export default {
drawIbpInit() { drawIbpInit() {
this.$ibp.drawIbpInit(); this.$ibp.drawIbpInit();
this.showBackButton = false; this.showBackButton = false;
} },
//
initClockTime(initTime) {
this.$ibp.initClockTime(initTime);
},
//
setClockStart(started) {
this.$ibp.setClockStart(started);
}
} }
}; };
</script> </script>

View File

@ -1,24 +1,27 @@
<template> <template>
<div class="main" :style="{width: canvasWidth+'px'}" @mousemove="mousemove"> <div class="main" :style="{width: canvasWidth+'px'}" @mousemove="mousemove">
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" /> <Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<transition name="el-zoom-in-bottom"> <ibp-plate v-show="ibpShow" ref="ibpPlate" @hideIbp="hideIbp" />
<map-system-draft ref="mapCanvas" @back="back" /> <div v-show="panelShow" :panelShow="panelShow">
</transition> <transition name="el-zoom-in-bottom">
<menu-demon-joint ref="demonMenu" :group="group" :user-role="userRole" @getUserRole="getUserRole" @hidepanel="hidepanel" /> <map-system-draft ref="mapCanvas" @back="back" />
<menu-demon-schema </transition>
ref="menuSchema" <menu-demon-joint ref="demonMenu" :group="group" :user-role="userRole" @getUserRole="getUserRole" @hidepanel="hidepanel" @showIbp="showIbp" />
:group="group" <menu-demon-schema
:offset="offset" ref="menuSchema"
:user-role="userRole" :group="group"
@runPlanLoadShow="runPlanLoadShow" :offset="offset"
@runPlanViewShow="runPlanViewShow" :user-role="userRole"
@faultChooseShow="faultChooseShow" @runPlanLoadShow="runPlanLoadShow"
/> @runPlanViewShow="runPlanViewShow"
@faultChooseShow="faultChooseShow"
/>
<join-fault-choose ref="faultChoose" :group="group" /> <join-fault-choose ref="faultChoose" :group="group" />
<join-run-plan-Load ref="runPlanLoad" :group="group" /> <join-run-plan-Load ref="runPlanLoad" :group="group" />
<join-run-plan-view ref="runPlanView" :group="group" /> <join-run-plan-view ref="runPlanView" :group="group" />
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" :right="right" /> <menu-system-time ref="menuSystemTime" :offset="offset" :group="group" :right="right" />
</div>
</div> </div>
</template> </template>
@ -32,6 +35,7 @@ import JoinFaultChoose from '@/views/display/demon/faultChoose';
import JoinRunPlanLoad from '@/views/display/demon/runPlanLoad'; import JoinRunPlanLoad from '@/views/display/demon/runPlanLoad';
import JoinRunPlanView from '@/views/display/demon/runPlanView'; import JoinRunPlanView from '@/views/display/demon/runPlanView';
import menuSystemTime from '@/views/display/menuSystemTime'; import menuSystemTime from '@/views/display/menuSystemTime';
import IbpPlate from '@/views/ibp/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
// import { getProductDetail } from '@/api/jmap/training'; // import { getProductDetail } from '@/api/jmap/training';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
@ -53,7 +57,8 @@ export default {
JoinRunPlanLoad, JoinRunPlanLoad,
JoinRunPlanView, JoinRunPlanView,
menuSystemTime, menuSystemTime,
Jl3dDrive Jl3dDrive,
IbpPlate
}, },
data() { data() {
return { return {
@ -71,7 +76,9 @@ export default {
mapId: '', mapId: '',
skinCode: '', skinCode: '',
simulationShow: false, simulationShow: false,
drivingShow: false drivingShow: false,
ibpShow: false,
panelShow: true
}; };
}, },
computed: { computed: {
@ -330,13 +337,25 @@ export default {
showdriving() { showdriving() {
this.panelShow = true; this.panelShow = true;
this.drivingShow = false; this.drivingShow = false;
this.ibpShow =false;
}, },
showIbp() {
this.drivingShow = false;
this.panelShow = false;
this.ibpShow = true;
this.$refs.ibpPlate.show();
},
hidepanel() { hidepanel() {
this.panelShow = false; this.panelShow = false;
this.drivingShow = true; this.drivingShow = true;
this.ibpShow = false;
this.$refs.Jl3dDrive.show(this.skinCode); this.$refs.Jl3dDrive.show(this.skinCode);
}, },
hideIbp() {
this.drivingShow = false;
this.panelShow = true;
this.ibpShow = false;
},
messageInfo(message, type) { messageInfo(message, type) {
this.$message({ this.$message({
showClose: true, showClose: true,

View File

@ -44,6 +44,7 @@
</div> --> </div> -->
<div class="display-draft"> <div class="display-draft">
<el-button-group> <el-button-group>
<!--<el-button @click="jumpIbp">IBP盘</el-button>-->
<el-button v-if="userRole == 'Driver'" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button> <el-button v-if="userRole == 'Driver'" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button>
<el-button <el-button
v-if="userRole == 'Admin'" v-if="userRole == 'Admin'"
@ -332,7 +333,10 @@ export default {
}, },
jumpjlmap3d() { jumpjlmap3d() {
this.$emit('hidepanel'); this.$emit('hidepanel');
} },
jumpIbp() {
this.$emit('showIbp');
}
} }
}; };
</script> </script>