Merge branch 'test'

This commit is contained in:
sunzhenyu 2019-08-29 17:17:49 +08:00
commit 64b3d18ab4
81 changed files with 2123 additions and 416 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -54,6 +54,7 @@ export default {
trainWindow: 'train window', trainWindow: 'train window',
line: 'line', line: 'line',
text: 'text', text: 'text',
button: 'button',
mapName: 'Name of the map:', mapName: 'Name of the map:',
skinName: 'Skin style:', skinName: 'Skin style:',
@ -189,6 +190,8 @@ export default {
linkLp: 'Link Start point coordinates:', linkLp: 'Link Start point coordinates:',
linkRp: 'Link End point coordinates:', linkRp: 'Link End point coordinates:',
linePoint: 'point:',
rulesChange: 'The rules change', rulesChange: 'The rules change',
splitMerge: 'Split/merge', splitMerge: 'Split/merge',
linkSet: 'The Link set', linkSet: 'The Link set',

View File

@ -48,6 +48,7 @@ export default {
zcZoneControl: 'zc区域控制', zcZoneControl: 'zc区域控制',
temporaryLimit: '全线临时限速', temporaryLimit: '全线临时限速',
lcControl: 'Lc控制', lcControl: 'Lc控制',
buttonControl: '按钮',
image: '图片', image: '图片',
station: '车站', station: '车站',
controlMode: '控制模式', controlMode: '控制模式',
@ -58,6 +59,7 @@ export default {
trainWindow: '车次窗', trainWindow: '车次窗',
line: '线条', line: '线条',
text: '文字', text: '文字',
button: '按钮',
mapName: '地图名称:', mapName: '地图名称:',
skinName: '皮肤:', skinName: '皮肤:',
@ -76,6 +78,7 @@ export default {
lineCoding: '线条编码:', lineCoding: '线条编码:',
lineType: '线条类型:', lineType: '线条类型:',
lineWidth: '线条宽度:', lineWidth: '线条宽度:',
linePoint: '坐标:',
segmentCoordinates: '区段显示坐标:', segmentCoordinates: '区段显示坐标:',
publishMapCreation: '从发布地图创建', publishMapCreation: '从发布地图创建',
@ -133,6 +136,8 @@ export default {
failedCreateSignal: '创建自动信号失败', failedCreateSignal: '创建自动信号失败',
automaticSignalUpdateSucceeded: '更新自动信号成功!', automaticSignalUpdateSucceeded: '更新自动信号成功!',
automaticSignalUpdateFailed: '更新自动信号失败', automaticSignalUpdateFailed: '更新自动信号失败',
interconnected: '联锁控名称',
buttonType: '所属类型',
stationName: '车站名称:', stationName: '车站名称:',
@ -254,7 +259,7 @@ export default {
isCurve: '是否曲线:', isCurve: '是否曲线:',
physicalSegmentName: '物理区段名称:', physicalSegmentName: '物理区段名称:',
directionType: '形式方向:', directionType: '行驶方向:',
leftOrRight: '左右位置:', leftOrRight: '左右位置:',
positionType: '上下位置:', positionType: '上下位置:',
@ -312,7 +317,7 @@ export default {
zzkContent: '站中控内容:', zzkContent: '站中控内容:',
stationControlZok: '中控', stationControlZok: '中控',
stationstandName: '选择车站名称:', stationstandName: '所属车站:',
stationstandDirection: '站台方向:', stationstandDirection: '站台方向:',
stationstandHasDoor: '是否显示屏蔽门:', stationstandHasDoor: '是否显示屏蔽门:',
stationstandNameColon: '站台名称:', stationstandNameColon: '站台名称:',
@ -341,6 +346,7 @@ export default {
delayUnlockPosition: '延迟解锁坐标:', delayUnlockPosition: '延迟解锁坐标:',
trainWindowPoints: '车次窗坐标:', trainWindowPoints: '车次窗坐标:',
textPoints: '坐标:', textPoints: '坐标:',
buttonText: '内容',
textCode: '文字编码:', textCode: '文字编码:',
textContent: '文本内容:', textContent: '文本内容:',

View File

@ -54,5 +54,7 @@ export default {
userTrainingManage: '用户实训管理', userTrainingManage: '用户实训管理',
userExamManage: '用户考试管理', userExamManage: '用户考试管理',
userSimulationManage: '用户仿真管理', userSimulationManage: '用户仿真管理',
existingSimulation: '存在仿真管理' existingSimulation: '存在仿真管理',
ibpDraw: 'Ibp盘绘制'
}; };

View File

@ -252,6 +252,9 @@ export default {
enterScale: '请输入缩放比例', enterScale: '请输入缩放比例',
enterXOffset: '请输入X偏移', enterXOffset: '请输入X偏移',
enterYOffset: '请输入Y偏移' enterYOffset: '请输入Y偏移',
pleaseSelectButtonType: '请选择按钮类型',
pleaseSelectButtonContent: '请输入内容'
}; };

View File

@ -2,8 +2,8 @@ import deviceType from './deviceType';
const deviceRender = {}; const deviceRender = {};
/** Text渲染配置*/ /** IbpText渲染配置*/
deviceRender[deviceType.Text] = { deviceRender[deviceType.IbpText] = {
zlevel: 1 zlevel: 1
}; };

View File

@ -1,5 +1,5 @@
const deviceType = { const deviceType = {
Text: 'Text', IbpText: 'IbpText',
SquareButton: 'SquareButton', SquareButton: 'SquareButton',
WarnButton: 'WarnButton', WarnButton: 'WarnButton',
Arrow: 'Arrow', Arrow: 'Arrow',

View File

@ -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, deviceFactory} from './utils/parser'; import {calculateDCenter, createBoundingRect, modelFactory} from './utils/parser';
const renderer = 'canvas'; const renderer = 'canvas';
const devicePixelRatio = 1; const devicePixelRatio = 1;
@ -34,6 +34,8 @@ class IbpPan {
const height = opts.config.height; const height = opts.config.height;
this.$ibpZr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config)); this.$ibpZr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config));
this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放 this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放
this.$mouseController = new MouseController(this);
this.$mouseController.enable();
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()});
@ -41,9 +43,6 @@ class IbpPan {
this.optionsHandler = this.setOptions.bind(this); this.optionsHandler = this.setOptions.bind(this);
this.$mouseController = new MouseController(this);
this.$mouseController.enable();
this.$mouseController.on(this.events.__Pan, this.optionsHandler); this.$mouseController.on(this.events.__Pan, this.optionsHandler);
this.$mouseController.on(this.events.__Zoom, this.optionsHandler); this.$mouseController.on(this.events.__Zoom, this.optionsHandler);
@ -123,12 +122,12 @@ class IbpPan {
} }
render(list) { render(list) {
console.log('-*-*-*-*-', list);
(list || []).forEach(elem => { (list || []).forEach(elem => {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem); const oDevice = this.ibpDevice[code] || {instance: null, event: null, model: modelFactory(type, elem)};
const nDevice = Object.assign(oDevice || {}, elem); const nDevice = Object.assign(oDevice.model || {}, elem);
this.dataSync(nDevice);
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
if (!elem._dispose) { if (!elem._dispose) {
this.ibpDevice[code] = nDevice; this.ibpDevice[code] = nDevice;
@ -140,7 +139,7 @@ class IbpPan {
} }
// 中间处理 // 中间处理
hookHandle(oDevice, elem) { hookHandle(model, elem) {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
// 如果是延时计时,需要保存计数值到全局 // 如果是延时计时,需要保存计数值到全局
@ -153,8 +152,8 @@ class IbpPan {
localStore(code, val); localStore(code, val);
} }
for (var prop in elem) { for (var prop in elem) {
if (elem[prop] != oDevice[prop]) { if (elem[prop] != model[prop]) {
Object.assign(oDevice, elem); Object.assign(model, elem);
return true; return true;
} }
} }
@ -169,7 +168,7 @@ class IbpPan {
if (elem.dispose) { if (elem.dispose) {
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
} else { } else {
if (this.hookHandle(oDevice, elem)) { if (this.hookHandle(oDevice.model, elem)) {
this.$painter.update(oDevice); this.$painter.update(oDevice);
} }
} }
@ -178,6 +177,12 @@ class IbpPan {
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); } if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
} }
drawIbpInit() {
(Object.keys(this.ibpDevice) || []).forEach(elem => {
this.$painter.drawIbp(this.ibpDevice[elem]);
});
}
pullBack(payload) { pullBack(payload) {
if (payload.type === 'zoom') { if (payload.type === 'zoom') {
const zrWidth = this.$ibpZr.getWidth(); const zrWidth = this.$ibpZr.getWidth();
@ -196,33 +201,6 @@ class IbpPan {
return payload || {}; return payload || {};
} }
dataSync(model) {
var prop = null;
var type = model._type;
var code = model.code;
switch (type) {
case deviceType.Link: prop = 'linkList'; break;
}
const list = this.data[prop] || [];
const idex = list.findIndex(elem => { return elem.code == code; });
if (list) {
if (model._dispose) {
idex >= 0 && list.splice(idex, 1);
} else {
const elem = list[idex];
if (elem) {
Object.keys(elem).forEach(key => {
elem[key] = model[key];
});
} else {
list.push(Object.assign({}, model));
}
}
}
}
getZr() { getZr() {
return this.$ibpZr; return this.$ibpZr;
} }
@ -250,7 +228,6 @@ class IbpPan {
refresh() { refresh() {
this.$painter.refresh(); this.$painter.refresh();
} }
clear() { clear() {
this.skinCode = ''; this.skinCode = '';
this.style = {}; this.style = {};

View File

@ -59,11 +59,12 @@ class Painter {
* @param {*} device * @param {*} device
*/ */
add(device) { add(device) {
device = Object.assign(device, { event: this.$ibp.$mouseController });
const instance = shapefactory(device, this.$ibp); const instance = shapefactory(device, this.$ibp);
if (instance) { if (instance) {
device.instance = instance; device.instance = instance;
this.$transformHandle.transformView(instance); this.$transformHandle.transformView(instance);
this.ibpInstanceLevel[device._type].add(instance); this.ibpInstanceLevel[device.model._type].add(instance);
} }
} }
@ -74,7 +75,7 @@ class Painter {
delete(device) { delete(device) {
const instance = device.instance; const instance = device.instance;
if (instance) { if (instance) {
this.ibpInstanceLevel[device._type].remove(instance); this.ibpInstanceLevel[device.model._type].remove(instance);
} }
} }
@ -84,7 +85,7 @@ class Painter {
*/ */
update(device) { update(device) {
if (device) { if (device) {
if (device._dispose) { if (device.model._dispose) {
this.delete(device); this.delete(device);
} else { } else {
const instance = device.instance; const instance = device.instance;
@ -95,6 +96,18 @@ class Painter {
} }
} }
/**
* 绘制ipb时更改draggable 和注册事件
*/
drawIbp(device) {
if (device) {
const instance = device.instance;
if (instance) {
instance.setDraggable();
}
}
}
/** /**
* 更新transform变化 * 更新transform变化
* @param {*} opt * @param {*} opt

52
src/ibp/shape/alarm.js Normal file
View File

@ -0,0 +1,52 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import alarmpic from '@/assets/ibp_images/alarm.png';
export default class alarm extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: model.draggable || false,
style: {
image: alarmpic,
x: model.point.x,
y: model.point.y,
width: 70,
height: 74
}
});
this.add(this.imageBg);
}
setDraggable() {
this.arrow.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
}
mousemove(e) {
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
}
}

View File

@ -1,22 +1,24 @@
import Polygon from 'zrender/src/graphic/shape/Polygon'; import Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import {arrow} from '../../jmap/shape/utils/ShapePoints'; import {arrow} from '@/jmap/shape/utils/ShapePoints';
// import { updateIbpData } from '@/ibp/utils/parser';
class Arrow extends Group { class Arrow extends Group {
constructor(model) { constructor(device) {
super(); super();
this.model = model; this.event = device.event;
this.model = device.model;
this.create(); this.create();
} }
create() { create() {
const model = this.model; const model = this.model;
const point = arrow(this.model.point.x, this.model.point.y, this.model.length, 10);
this.arrow = new Polygon({ this.arrow = new Polygon({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
draggable: model.draggable || false,
shape: { shape: {
points: point points: arrow(this.model.point.x, this.model.point.y, this.model.length, 10)
}, },
style: { style: {
stroke: model.stroke, stroke: model.stroke,
@ -25,13 +27,55 @@ class Arrow extends Group {
} }
}); });
this.add(this.arrow); this.add(this.arrow);
this.getOrientate();
}
getOrientate() {
switch (this.model.orientation) {
case 'left': {
this.transformRotation(0);
break;
}
case 'right': {
this.transformRotation(180);
break;
}
}
}
// 整体旋转箭头
transformRotation(rotate) {
this.arrow.origin = [this.model.point.x, this.model.point.y];
this.arrow.rotation = Math.PI / 180 * Number(rotate);
this.arrow.dirty();
} }
// 箭头颜色 // 箭头颜色
setColor(color) { setColor(color) {
this.arrow.setStyle('fill', color); this.arrow.setStyle('fill', color);
} }
setDraggable() {
this.arrow.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown() {
this.event.disable();
console.log('鼠标按下');
}
mousemove() {
console.log('鼠标移动');
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
console.log('鼠标抬起', this.model);
}
} }
export default Arrow; export default Arrow;

View File

@ -4,10 +4,10 @@ import Rect from 'zrender/src/graphic/shape/Rect';
import ibpBg from '@/assets/ibp_images/ibp_bg.png'; import ibpBg from '@/assets/ibp_images/ibp_bg.png';
export default class background extends Group { export default class background extends Group {
constructor(model) { constructor(device) {
super(); super();
this.model = model; this.model = device.model;
this.zlevel = model.zlevel; this.zlevel = device.model.zlevel;
this.z = 1; this.z = 1;
this.create(); this.create();
} }
@ -47,4 +47,6 @@ export default class background extends Group {
this.tailorRect.setShape('x', x-opt.offsetX); this.tailorRect.setShape('x', x-opt.offsetX);
this.tailorRect.setShape('y', y-opt.offsetY); this.tailorRect.setShape('y', y-opt.offsetY);
} }
setDraggable() {
}
} }

View File

@ -1,163 +1,120 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image'; import Image from 'zrender/src/graphic/Image';
// import Eventful from 'zrender/src/mixin/Eventful'; import redButtonPic from '@/assets/ibp_images/red_button.png';
import redButtonPicOn from '@/assets/ibp_images/red_button_on.png';
import * as eventTool from 'zrender/src/core/event'; import greenButtonPicOn from '@/assets/ibp_images/green_button_on.png';
import greenButtonPic from '@/assets/ibp_images/green_button.png';
import buttonPic from '@/assets/ibp_images/red_button.png'; import blueButtonPic from '@/assets/ibp_images/blue_button.png';
import buttonPicOn from '@/assets/ibp_images/red_button_on.png'; import blueButtonPicOn from '@/assets/ibp_images/blue_button_on.png';
import yellowButtonPic from '@/assets/ibp_images/yellow_button.png';
import yellowButtonPicOn from '@/assets/ibp_images/yellow_button_on.png';
import grayButtonPic from '@/assets/ibp_images/gray_button.png';
import grayButtonPicOn from '@/assets/ibp_images/gray_button_on.png';
export default class button extends Group { export default class button extends Group {
constructor(model) { static colors = new Map([
['red_on', [redButtonPicOn]],
['red_off', [redButtonPic]],
['green_on', [greenButtonPicOn]],
['green_off', [greenButtonPic]],
['blue_on', [blueButtonPicOn]],
['blue_off', [blueButtonPic]],
['yellow_on', [yellowButtonPicOn]],
['yellow_off', [yellowButtonPic]],
['gray_on', [grayButtonPicOn]],
['gray_off', [grayButtonPic]]
]);
constructor(device) {
super(); super();
this.model = model; this.model = device.model;
this.zlevel = model.zlevel; this.zlevel = device.model.zlevel;
this.z = model.z;
this.create(); this.create();
this.createMouseEvent();
} }
create() { create() {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, draggable: model.draggable || false,
style: { style: {
image: model.status === '01' ? buttonPic : buttonPicOn, image: this.getImagePic(),
x: this.model.point.x, x: model.point.x,
y: this.model.point.y, y: model.point.y,
width: this.model.width, width: 70,
height: this.model.height height: 80
} }
}); });
this.add(this.imageBg); this.add(this.imageBg);
} }
getImagePic() {
const color = button.colors.get(`${this.model.color}_${this.model.status}`);
return color[0];
}
setDraggable() {
this.arrow.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
// 设置按钮状态 // 设置按钮状态
setState(model) { setState(model) {
switch (model.status) { switch (model.status) {
case '01': this.close(); break; // 关闭 case 'on': {
case '02': this.open(); break; // 开放 // 关闭
this.close();
this.model.status='on';
break;
}
case 'off': {
// 开放
this.open();
this.model.status='off';
break;
}
} }
} }
// 绑定按钮事件 onclick() {
createMouseEvent() { if (!this.model.draggable) {
this.model.isDraging=true; switch (this.model.status) {
if (this.model.isDraging) { case 'off': {
// 按钮拖拽事件监听 this.open();
this.imageBg.on('mousedown', (e) => { this.model.status='on';
if (eventTool.notLeftMouse(e)) { break;
return; }
} case 'on': {
eventTool.stop(e.event); this.close();
var x = e.offsetX; this.model.status='off';
var y = e.offsetY; break;
this._x = x; }
this._y = y; }
this._dragginger = true;
});
this.imageBg.on('mousemove', (e) => {
// !this._moveOnMouseMove ||
if (eventTool.notLeftMouse(e) || !this._dragginger) {
return;
}
// eventTool.stop(e.event);
const oldX = this._x;
const oldY = this._y;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
this._x = e.offsetX;
this._y = e.offsetY;
debugger;
// this.imageBg.preventDefaultMouseMove &&
eventTool.stop(e.event);
// debugger;
this.imageBg.setStyle({x: oldX+dx, y: oldY+dy });
});
this.imageBg.on('mouseup', (e) => {
if (!eventTool.notLeftMouse(e)) {
this._dragginger = false;
}
});
} else {
// 按钮的点击监听
this.imageBg.on('click', (e) => {
switch (this.model.status) {
case '01': {
this.open();
this.model.status='02';
break;
}
case '02': {
this.close();
this.model.status='01';
break;
}
}
});
} }
} }
// if (this.model.isDraging) { mousedown(e) {
// // this.mouseEvent = new EMouse(this); this.event.disable();
// // this.add(this.mouseEvent); }
// this.imageBg.on('mousedown', (e) => { mousemove(e) {
// // debugger; }
// if (eventTool.notLeftMouse(e)) { mouseup(e) {
// return; this.event.enable();
// } this.model.point.x = this.model.point.x + e.offsetX;
// var x = e.offsetX; this.model.point.y = this.model.point.y + e.offsetY;
// var y = e.offsetY; }
// this._x = x;
// this._y = y;
// this._dragging = true;
// });
// this.imageBg.on('mousemove', (e) => {
// if (eventTool.notLeftMouse(e) || !this._moveOnMouseMove ||!this._dragging) {
// return;
// }
// const oldX = this._x;
// const oldY = this._y;
// const dx = e.offsetX - oldX;
// const dy = e.offsetY - oldY;
// this._x = e.offsetX;
// this._y = e.offsetY;
// debugger;
// this.imageBg.preventDefaultMouseMove && eventTool.stop(e.event);
// debugger;
// this.imageBg.setStyle({x: dx, y: dy});
// // this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
// });
// this.on('mouseup', (e) => { });
// }
// else {
// this.on('mousedown', (e) => { this.mouseEvent.mouseout(e); });
// // this.on('mousemove', (e) => { this.mouseEvent.mouseover(e); });
// this.on('mouseup', (e) => { this.mouseEvent.mouseover(e); });
// }
// 关闭 // 关闭
close() { close() {
this.imageBg.setStyle({image: buttonPic}); const color = button.colors.get(`${this.model.color}_off`);
this.imageBg.setStyle({image: color[0]});
} }
// 开放 // 开放
open() { open() {
this.imageBg.setStyle({image: buttonPicOn}); const color = button.colors.get(`${this.model.color}_on`);
} this.imageBg.setStyle({image: color[0]});
getShapeTipPoint() {
if (this.imageBg) {
var distance = 2;
var rect = this.imageBg.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y - distance
};
}
return null;
} }
} }

View File

@ -1,13 +1,13 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Circle from 'zrender/src/graphic/shape/Circle'; import Circle from 'zrender/src/graphic/shape/Circle';
import MouseController from '../mouseController';
export default class CircularLamp extends Group { export default class CircularLamp extends Group {
constructor(model) { constructor(device) {
super(); super();
this.model = model; this.model = device.model;
this.zlevel = model.zlevel; this.event = device.event;
this.z = model.z; this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create(); this.create();
} }
@ -15,6 +15,7 @@ export default class CircularLamp extends Group {
this.lamp = new Circle({ this.lamp = new Circle({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
draggable: this.model.draggable||false,
shape: { shape: {
cx: this.model.point.x, cx: this.model.point.x,
cy: this.model.point.y, cy: this.model.point.y,
@ -30,4 +31,24 @@ export default class CircularLamp extends Group {
setCircularLampColor(color) { setCircularLampColor(color) {
this.lamp.setStyle('fill', color); this.lamp.setStyle('fill', color);
} }
setDraggable() {
this.lamp.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown() {
this.event.disable();
console.log('鼠标按下');
}
mousemove() {
console.log('鼠标移动');
}
mouseup() {
this.event.enable();
console.log('鼠标抬起');
}
} }

View File

@ -1,25 +0,0 @@
// import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 名称元素*/
export default function ETextName(model) {
const TextName = new Text({
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
style: {
x: model.x,
y: model.y,
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: model.fontFamily,
text: model.text,
textStrokeWidth: model.textStrokeWidth,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null
}
});
return TextName;
}

View File

@ -1,15 +1,17 @@
import Arrow from './arrow'; import Arrow from './arrow';
import deviceType from '../constant/deviceType'; import deviceType from '../constant/deviceType';
import Background from './background'; import Background from './background';
import CircularLamp from './circularLamp' import CircularLamp from './circularLamp';
import IbpText from './ibpText';
const ibpShape = {}; const ibpShape = {};
ibpShape[deviceType.Arrow] = Arrow; ibpShape[deviceType.Arrow] = Arrow;
ibpShape[deviceType.Background] = Background; ibpShape[deviceType.Background] = Background;
ibpShape[deviceType.CircularLamp] = CircularLamp; ibpShape[deviceType.CircularLamp] = CircularLamp;
ibpShape[deviceType.IbpText] = IbpText;
function shapefactory(device, ibp) { function shapefactory(device, ibp) {
const type = device._type; const type = device.model._type;
const shape = ibpShape[type]; const shape = ibpShape[type];
if (shape instanceof Function) { if (shape instanceof Function) {
// eslint-disable-next-line // eslint-disable-next-line

60
src/ibp/shape/ibpText.js Normal file
View File

@ -0,0 +1,60 @@
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import { updateIbpData } from '@/ibp/utils/parser';
export default class button extends Group {
constructor(device) {
super();
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.textName = new Text({
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
draggable: model.draggable || false,
style: {
x: model.x,
y: model.y,
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: model.fontFamily,
text: model.context,
textStrokeWidth: model.textStrokeWidth,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null
}
});
this.add(this.textName);
}
setDraggable() {
this.textName.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown() {
this.event.disable();
console.log('鼠标按下');
}
mousemove() {
console.log('鼠标移动');
}
mouseup(e) {
this.event.enable();
this.model.x = this.model.x + e.offsetX;
this.model.y = this.model.y + e.offsetY;
console.log('鼠标抬起', this.model);
updateIbpData(this.model, 'update');
}
}

View File

@ -0,0 +1,68 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import rotateBlack from '@/assets/ibp_images/rotate_black.png';
import rotateRed from '@/assets/ibp_images/rotate_red.png';
export default class rotateTip extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: model.draggable || false,
style: {
image: this.getRotateColor(),
x: model.point.x,
y: model.point.y,
width: 70,
height: 74
}
});
this.add(this.imageBg);
}
getRotateColor() {
if (this.model.color) {
switch (this.model.color) {
case 'black': {
return rotateBlack;
}
case 'red': {
return rotateRed;
}
}
} else {
return rotateBlack;
}
}
setDraggable() {
this.arrow.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
}
mousemove(e) {
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
}
}

View File

@ -28,13 +28,13 @@ export function calculateDCenter(viewRect, zrbound) {
return { dx: dx, dy: dy }; return { dx: dx, dy: dy };
} }
export function deviceFactory(type, elem) { export function modelFactory(type, elem) {
return Object.assign({ _type: type }, deviceRender[type], elem); return Object.assign(elem, { _type: type }, deviceRender[type]);
} }
export function createDevice(type, model, propConvert) { export function createModel(type, model, propConvert) {
const device = deviceFactory(type, model); const tempModel = modelFactory(type, model);
return propConvert ? propConvert.initPrivateProps(device) : device; return { instance: null, event: null, model: propConvert ? propConvert.initPrivateProps(tempModel) : tempModel };
} }
export function parser(data, config) { export function parser(data, config) {
@ -44,33 +44,33 @@ export function parser(data, config) {
if (data) { if (data) {
Object.assign(data.background, config); Object.assign(data.background, config);
ibpDevice[data.background.code] = createDevice(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] = createDevice(deviceType.Text, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.IbpText, elem, propConvert);
}, this); }, this);
zrUtil.each(data.squareButtonList || [], elem => { zrUtil.each(data.squareButtonList || [], elem => {
ibpDevice[elem.code] = createDevice(deviceType.SquareButton, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.SquareButton, elem, propConvert);
}, this); }, this);
zrUtil.each(data.circularLampList || [], elem => { zrUtil.each(data.circularLampList || [], elem => {
ibpDevice[elem.code] = createDevice(deviceType.CircularLamp, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.CircularLamp, elem, propConvert);
}, this); }, this);
zrUtil.each(data.warnButtonList || [], elem => { zrUtil.each(data.warnButtonList || [], elem => {
ibpDevice[elem.code] = createDevice(deviceType.WarnButton, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.WarnButton, elem, propConvert);
}, this); }, this);
zrUtil.each(data.arrowList || [], elem => { zrUtil.each(data.arrowList || [], elem => {
ibpDevice[elem.code] = createDevice(deviceType.Arrow, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.Arrow, elem, propConvert);
}, this); }, this);
zrUtil.each(data.rotatingButtonList || [], elem => { zrUtil.each(data.rotatingButtonList || [], elem => {
ibpDevice[elem.code] = createDevice(deviceType.RotatingButton, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.RotatingButton, elem, propConvert);
}, this); }, this);
zrUtil.each(data.tipList || [], elem => { zrUtil.each(data.tipList || [], elem => {
ibpDevice[elem.code] = createDevice(deviceType.Tip, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.Tip, elem, propConvert);
}, this); }, this);
} }

View File

@ -57,7 +57,7 @@ export function JLmapDriving(dom, data, skinCode) {
document.getElementById('jlsimulation').appendChild(renderer.domElement); document.getElementById('jlsimulation').appendChild(renderer.domElement);
document.getElementById('jlcctv').appendChild(renderercctv.domElement); document.getElementById('jlcctv').appendChild(renderercctv.domElement);
// 定义相机 // 定义相机
let camera = SetCamera(dom); //let camera = SetCamera(dom);
// 定义场景(渲染容器) // 定义场景(渲染容器)
const scene = SetScene(); const scene = SetScene();
@ -95,24 +95,22 @@ export function JLmapDriving(dom, data, skinCode) {
// 地图模型数据 // 地图模型数据
let mapdata = new Jl3ddata(); let mapdata = new Jl3ddata();
const camera2 = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 2000 ); let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 1100);
camera2.name = 'camera2'; camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
const controls3 = new MouseControls(camera2, 1.6); const controls3 = new MouseControls(camera, 1.6);
controls3.enabled = true; controls3.enabled = true;
scene.add(controls3.getObject()); scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 20); let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150);
cameracctv.position.set( 5, 1,27 ); cameracctv.position.set( 5, -3,27 );
cameracctv.rotation.y = Math.PI/5*3; cameracctv.rotation.y = Math.PI/5*3;
camera2.add(cameracctv); camera.add(cameracctv);
// 订阅仿真socket // 订阅仿真socket
this.Subscribe = new Jl3dDriving(scope); this.Subscribe = new Jl3dDriving(scope);
// 连接到通信
// console.log(this.Subscribe.config);
// this.webwork.postMessage(this.Subscribe.teststomp);
this.Subscribe.socketon(scope.Subscribe.topic); this.Subscribe.socketon(scope.Subscribe.topic);
@ -137,8 +135,9 @@ export function JLmapDriving(dom, data, skinCode) {
// 判断渲染是否开启 // 判断渲染是否开启
if (scope.animateswitch == true) { if (scope.animateswitch == true) {
// 根据相机渲染场景 // 根据相机渲染场景
renderer.render(scene, camera2);
renderercctv.render(scene,cameracctv); renderercctv.render(scene,cameracctv);
renderer.render(scene, camera);
// updatcontrols(); // updatcontrols();
// renderercctv // renderercctv
controls3.update(); controls3.update();

View File

@ -213,47 +213,48 @@ export function Jl3dDriving(jlmap3d) {
} }
trainlisttest.list[code].runMode = data.body[i].runMode; trainlisttest.list[code].runMode = data.body[i].runMode;
// 车门开关验证 // 车门开关验证
if (data.body[i].directionType == '02') { if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') { // console.log("close");
// console.log("close"); trainlisttest.list[code].doorStatus = '01';
trainlisttest.list[code].doorStatus = '01'; for (let an=actions[code].top.length-1; an>=0; an--) {
for (let an=actions[code].top.length-1; an>=0; an--) { actions[code].top[an].reset();
actions[code].top[an].reset(); actions[code].top[an].time = actions[code].top[an]._clip.duration;
actions[code].top[an].time = actions[code].top[an]._clip.duration; actions[code].top[an].timeScale = -1;
actions[code].top[an].timeScale = -1; actions[code].top[an].play();
actions[code].top[an].play();
}
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// console.log("open");
trainlisttest.list[code].doorStatus = '02';
for (let an=actions[code].top.length-1; an>=0; an--) {
actions[code].top[an].reset();
actions[code].top[an].time = 0;
actions[code].top[an].timeScale = 1;
actions[code].top[an].play();
}
} }
} else { } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') { // console.log("open");
// console.log("close"); trainlisttest.list[code].doorStatus = '02';
trainlisttest.list[code].doorStatus = '01'; for (let an=actions[code].top.length-1; an>=0; an--) {
for (let an=actions[code].down.length-1; an>=0; an--) { actions[code].top[an].reset();
actions[code].down[an].reset(); actions[code].top[an].time = 0;
actions[code].down[an].time = actions[code].top[an]._clip.duration; actions[code].top[an].timeScale = 1;
actions[code].down[an].timeScale = -1; actions[code].top[an].play();
actions[code].down[an].play();
}
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// console.log("open");
trainlisttest.list[code].doorStatus = '02';
for (let an=actions[code].down.length-1; an>=0; an--) {
actions[code].down[an].reset();
actions[code].down[an].time = 0;
actions[code].down[an].timeScale = 1;
actions[code].down[an].play();
}
} }
} }
// if (data.body[i].directionType == '02') {
//
// } else {
// if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
// // console.log("close");
// trainlisttest.list[code].doorStatus = '01';
// for (let an=actions[code].down.length-1; an>=0; an--) {
// actions[code].down[an].reset();
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
// actions[code].down[an].timeScale = -1;
// actions[code].down[an].play();
// }
// } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// // console.log("open");
// trainlisttest.list[code].doorStatus = '02';
// for (let an=actions[code].down.length-1; an>=0; an--) {
// actions[code].down[an].reset();
// actions[code].down[an].time = 0;
// actions[code].down[an].timeScale = 1;
// actions[code].down[an].play();
// }
// }
// }
// 遍历获取所在轨道 // 遍历获取所在轨道
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) { if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
@ -282,12 +283,14 @@ export function Jl3dDriving(jlmap3d) {
} }
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z; const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = rotaposz;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz)); vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) { for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
@ -323,15 +326,14 @@ export function Jl3dDriving(jlmap3d) {
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent; rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
} }
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z; const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
}
if (data.body[i].groupNumber == '001') {
}
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz)); vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) { for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
@ -347,7 +349,6 @@ export function Jl3dDriving(jlmap3d) {
} }
} }
} }
trainlisttest.list[code].status = '03'; trainlisttest.list[code].status = '03';
} }
@ -355,8 +356,17 @@ export function Jl3dDriving(jlmap3d) {
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack; trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].progress = 0; trainlisttest.list[code].progress = 0;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance; trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
trainlisttest.list[code].speed = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
if(data.body[i].speed == 0){
trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = 0;
// trainlisttest.list[code].startmark = 1;
}else{
trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
}
} }
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) { } else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {

View File

@ -4,11 +4,12 @@ export function UpdateTrain(camera,traindata,control){
for(let j=traindata.group.children.length-1;j>=0;j--){ for(let j=traindata.group.children.length-1;j>=0;j--){
//判断是否有移动事件 //判断是否有移动事件
if(traindata.group.children[j].dispose == false){ //if(traindata.group.children[j].dispose == false){
if(traindata.group.children[j].progress != null){ if(traindata.group.children[j].progress != null){
let trainmodel = traindata.group.children[j]; let trainmodel = traindata.group.children[j];
if(trainmodel.speeds > 0 && trainmodel.speeds){ if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null; let speed = null;
if(traindata.group.children[j].progress<1){ if(traindata.group.children[j].progress<1){
@ -265,8 +266,10 @@ export function UpdateTrain(camera,traindata,control){
} }
} }
} }
} //}
} }

View File

@ -551,7 +551,15 @@ THREE.FBXLoader = ( function () {
if ( materialNode.EmissiveFactor ) { if ( materialNode.EmissiveFactor ) {
parameters.emissiveIntensity = parseFloat( materialNode.EmissiveFactor.value ); if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.side = THREE.DoubleSide;
parameters.transparent = true;
parameters.alphaTest = 0.7;
parameters.opacity = 1;
}else{
parameters.opacity = parseFloat( materialNode.Opacity.value );
}
} }

View File

@ -272,7 +272,7 @@ class SkinCode extends defaultStyle {
emergencyControlShow: true, // 紧急站控显示 emergencyControlShow: true, // 紧急站控显示
centerControlShow: true, // 中控显示 centerControlShow: true, // 中控显示
substationControlShow: true, // 站控按钮显示 substationControlShow: true, // 站控按钮显示
turnedAroundControlShow: false // 按图折返显示 interconnectedControlShow: false // 联锁控显示
}, },
arrow: { arrow: {
show: false // 控制模式箭头显隐 show: false // 控制模式箭头显隐

View File

@ -276,7 +276,7 @@ class SkinCode extends defaultStyle {
emergencyControlShow: true, // 紧急站控显示 emergencyControlShow: true, // 紧急站控显示
centerControlShow: true, // 中控显示 centerControlShow: true, // 中控显示
substationControlShow: true, // 站控按钮显示 substationControlShow: true, // 站控按钮显示
turnedAroundControlShow: true // 按图折返显示 interconnectedControlShow: true // 联锁控显示
}, },
arrow: { arrow: {
show: false // 控制模式箭头显隐 show: false // 控制模式箭头显隐
@ -374,6 +374,18 @@ class SkinCode extends defaultStyle {
} }
}; };
this[deviceType.ButtonControl] = {
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};
this[deviceType.Line] = { this[deviceType.Line] = {
lineColor: '#FFFFFF' // 线条颜色 lineColor: '#FFFFFF' // 线条颜色
}; };

View File

@ -273,7 +273,7 @@ class SkinCode extends defaultStyle {
emergencyControlShow: true, // 紧急站控显示 emergencyControlShow: true, // 紧急站控显示
centerControlShow: true, // 中控显示 centerControlShow: true, // 中控显示
substationControlShow: true, // 站控按钮显示 substationControlShow: true, // 站控按钮显示
turnedAroundControlShow: false // 按图折返显示 interconnectedControlShow: false // 联锁控显示
}, },
arrow: { arrow: {
show: false // 控制模式箭头显隐 show: false // 控制模式箭头显隐

View File

@ -255,7 +255,7 @@ class SkinCode extends defaultStyle {
emergencyControlShow: false, // 紧急站控显示 emergencyControlShow: false, // 紧急站控显示
centerControlShow: true, // 中控显示 centerControlShow: true, // 中控显示
substationControlShow: true, // 站控按钮显示 substationControlShow: true, // 站控按钮显示
turnedAroundControlShow: false // 按图折返显示 interconnectedControlShow: false // 联锁控显示
}, },
arrow: { arrow: {
show: true // 控制模式箭头显隐 show: true // 控制模式箭头显隐

View File

@ -11,6 +11,7 @@ const deviceType = {
StationStand: 'StationStand', StationStand: 'StationStand',
StationControl: 'StationControl', StationControl: 'StationControl',
StationCounter: 'StationCounter', StationCounter: 'StationCounter',
ButtonControl: 'ButtonControl',
StationDelayUnlock: 'StationDelayUnlock', StationDelayUnlock: 'StationDelayUnlock',
Train: 'Train', Train: 'Train',
TrainWindow: 'TrainWindow', TrainWindow: 'TrainWindow',

View File

@ -292,6 +292,7 @@ class Jlmap {
case deviceType.ZcControl: prop = 'zcControlList'; break; case deviceType.ZcControl: prop = 'zcControlList'; break;
case deviceType.StationDelayUnlock: prop = 'stationDelayUnlockList'; break; case deviceType.StationDelayUnlock: prop = 'stationDelayUnlockList'; break;
case deviceType.LcControl: prop = 'lcControlList'; break; case deviceType.LcControl: prop = 'lcControlList'; break;
case deviceType.ButtonControl: prop = 'buttonList'; break;
case deviceType.LimitControl: prop = 'tempSpeedLimitList'; break; case deviceType.LimitControl: prop = 'tempSpeedLimitList'; break;
case deviceType.ImageControl: prop = 'imageControl'; break; case deviceType.ImageControl: prop = 'imageControl'; break;
case deviceType.Train: prop = 'trainList'; break; case deviceType.Train: prop = 'trainList'; break;

View File

@ -0,0 +1,67 @@
/*
* lC区域控制模式
*/
import Group from 'zrender/src/container/Group';
import EControl from '../element/EControl';
export default class ButtonControl extends Group {
constructor(model, style) {
super();
this.z = 20;
this._code = model.code;
this._type = model._type;
this.zlevel = 10;
this.model = model;
this.style = style;
this.create();
this.setState(model);
}
create() {
const model = this.model;
this.control = new EControl({
zlevel: this.zlevel,
z: this.z,
arc: {
shape: {
cx: model.position.x,
cy: model.position.y,
r: this.style.ButtonControl.lamp.radiusR
},
lineWidth: 0,
fill: this.style.ButtonControl.lamp.controlColor
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.ButtonControl.lamp.radiusR + this.style.ButtonControl.text.distance,
fontWeight: this.style.ButtonControl.text.fontWeight,
fontSize: this.style.ButtonControl.text.fontSize,
fontFamily: this.style.fontFamily,
text: model.text || '按图折返',
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top'
},
style: this.style
});
this.add(this.control);
}
// 设置状态
setState(model) {
}
getShapeTipPoint() {
if (this.control) {
var distance = 2;
var rect = this.control.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y - distance
};
}
return null;
}
}

View File

@ -73,10 +73,10 @@ export default class StationControl extends Group {
}); });
this.add(this.substationControl); this.add(this.substationControl);
} }
// 按图折返 // 联锁控
if (this.style.StationControl.lamp.turnedAroundControlShow) { if (this.style.StationControl.lamp.interconnectedControlShow) {
this.turnedAroundControl = new ESingleControl({ this.interconnectedControl = new ESingleControl({
_subType: 'turnedAround', _subType: 'interconnected',
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -84,10 +84,10 @@ export default class StationControl extends Group {
x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x, x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y y: model.position.y + this.style.StationControl.lamp.offset.y
}, },
context: '按图折返', context: model.lskContent || '联锁控',
pop: false pop: false
}); });
this.add(this.turnedAroundControl); this.add(this.interconnectedControl);
} }
// 箭头 // 箭头
if (this.style.StationControl.arrow.show) { if (this.style.StationControl.arrow.show) {

View File

@ -9,6 +9,7 @@ import LcControl from './LcControl/index.js';
import LimitControl from './LimitControl/index.js'; import LimitControl from './LimitControl/index.js';
import Switch from './Switch/index.js'; import Switch from './Switch/index.js';
import ZcControl from './ZcControl/index.js'; import ZcControl from './ZcControl/index.js';
import ButtonControl from './ButtonControl/index.js';
import StationCounter from './StationCounter/index.js'; import StationCounter from './StationCounter/index.js';
import StationDelayUnlock from './StationDelayUnlock/index.js'; import StationDelayUnlock from './StationDelayUnlock/index.js';
import StationStand from './StationStand/index.js'; import StationStand from './StationStand/index.js';
@ -29,6 +30,7 @@ mapShape[deviceType.LcControl] = LcControl;
mapShape[deviceType.LimitControl] = LimitControl; mapShape[deviceType.LimitControl] = LimitControl;
mapShape[deviceType.Switch] = Switch; mapShape[deviceType.Switch] = Switch;
mapShape[deviceType.ZcControl] = ZcControl; mapShape[deviceType.ZcControl] = ZcControl;
mapShape[deviceType.ButtonControl] = ButtonControl;
mapShape[deviceType.StationCounter] = StationCounter; mapShape[deviceType.StationCounter] = StationCounter;
mapShape[deviceType.StationDelayUnlock] = StationDelayUnlock; mapShape[deviceType.StationDelayUnlock] = StationDelayUnlock;
mapShape[deviceType.StationStand] = StationStand; mapShape[deviceType.StationStand] = StationStand;

View File

@ -86,6 +86,10 @@ export function parser(data, skinCode) {
mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert);
}, this); }, this);
zrUtil.each(data.buttonList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert);
}, this);
zrUtil.each(data.lcList || [], elem => { zrUtil.each(data.lcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert);
}, this); }, this);

View File

@ -84,6 +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 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';
@ -216,6 +218,11 @@ export const UrlConfig = {
prefix: '/script', prefix: '/script',
detail: '/script/detail', detail: '/script/detail',
display: '/script/display' display: '/script/display'
},
ibp: {
prefix: 'ibp',
draft: '/ibp/draft',
edit: 'ibp/edit'
} }
}; };
@ -375,6 +382,13 @@ export const asyncRouter = [
} }
] ]
}, },
// {
// path: 'ibp/edit',
// component: IbpEdit,
// meta: {
// i18n: 'router.ibpDraw'
// }
// },
{ {
path: 'runPlan', path: 'runPlan',
redirect: '/map/runPlan/view/draft', redirect: '/map/runPlan/view/draft',

View File

@ -13,6 +13,7 @@ import exam from './modules/exam';
import runPlan from './modules/runplan'; import runPlan from './modules/runplan';
import socket from './modules/socket'; import socket from './modules/socket';
import scriptRecord from './modules/scriptRecord'; import scriptRecord from './modules/scriptRecord';
import ibp from './modules/ibp';
import getters from './getters'; import getters from './getters';
@ -32,7 +33,8 @@ const store = new Vuex.Store({
exam, exam,
runPlan, runPlan,
socket, socket,
scriptRecord scriptRecord,
ibp
}, },
getters getters
}); });

59
src/store/modules/ibp.js Normal file
View File

@ -0,0 +1,59 @@
import Vue from 'vue';
import { parser } from '@/ibp/utils/parser';
/**
* ibp状态数据
*/
const ibp = {
namespaced: true,
state: {
ibp: null, // 数据
ibpDevice: {}, // 解析后的地图数据
ibpList: {}, // 数据列表
ibpIdList: {} // 数据列表(以id为标识)
},
getters: {
ibpList: (state) => {
return state.ibpList;
},
ibp: (state) => {
return state.ibp;
},
version: (state) => {
if (state.ibp) {
return state.ibp.version;
} else {
return null;
}
}
},
mutations: {
ibpRender: (state, devices) => {
Vue.prototype.$ibp && Vue.prototype.$ibp.render(devices);
},
setIbpData: (state, ibp) => {
state.ibp = ibp;
}
},
actions: {
setIbpData: ({ commit }, map) => {
commit('setIbpData', map);
},
updateIbpDevices: ({ commit }, models) => {
return new Promise((resolve) => {
if (!(models instanceof Array)) {
models = [models];
}
commit('ibpRender', models);
resolve(models);
});
}
}
};
export default ibp;

View File

@ -248,6 +248,13 @@ const map = {
return []; return [];
} }
}, },
buttonList: (state) => {
if (state.map) {
return state.map.buttonList;
} else {
return [];
}
},
signalList: (state) => { signalList: (state) => {
if (state.map) { if (state.map) {
return state.map.signalList; return state.map.signalList;

View File

@ -0,0 +1,65 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="报警器宽度">
<el-input-number v-model="form.alarmWidth" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="报警器长度">
<el-input-number v-model="form.alarmHeight" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'ButtonDraft',
components: {
},
data() {
return {
form: {
alarmWidth: '',
alarmHeight: ''
},
rules: {
alarmWidth: [
{ required: true, message: '请输入报警器宽度', trigger: 'blur' },
],
alarmHeight: [
{ required: true, message: '请输入报警器高度', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const alarmModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
_type: 'SquareButton',
width: this.form .alarmWidth,
height: this.form.alarmHeight
};
this.$emit('createButton', alarmModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -0,0 +1,65 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="扶梯框宽度">
<el-input-number v-model="form.appendageBoxWidth" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="扶梯框高度">
<el-input-number v-model="form.appendageBoxHeight" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'AppendageBoxDraft',
components: {
},
data() {
return {
form: {
appendageBoxWidth: '',
appendageBoxHeight: ''
},
rules: {
appendageBoxWidth: [
{ required: true, message: '请输入扶梯框宽度', trigger: 'blur' },
],
appendageBoxHeight: [
{ required: true, message: '请输入扶梯框高度', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const appendageBoxModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
_type: 'AppendageBox',
width: this.form .appendageBoxWidth,
height: this.form.appendageBoxHeight
};
this.$emit('createAppendageBox', appendageBoxModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -0,0 +1,78 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="箭头方向">
<el-select v-model="form.arrowDirection" placeholder="请选择箭头方向">
<el-option label="向上" value="redButton"></el-option>
<el-option label="向下" value="yellowButton"></el-option>
<el-option label="向左" value="greenButton"></el-option>
<el-option label="向右" value="greenButton"></el-option>
</el-select>
</el-form-item>
<el-form-item label="箭头长度">
<el-input-number v-model="form.arrowWidth" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="箭头宽度">
<el-input-number v-model="form.arrowHeight" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'ButtonDraft',
components: {
},
data() {
return {
form: {
arrowDirection: '',
arrowWidth: '',
arrowHeight: ''
},
rules: {
arrowDirection: [
{ required: true, message: '请选择箭头方向', trigger: 'change'}
],
arrowWidth: [
{ required: true, message: '请输入箭头长度', trigger: 'blur' },
],
arrowHeight: [
{ required: true, message: '请输入箭头线宽', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const arrowModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
_type: 'Arrow',
colorType: this.form.buttonColor,
width: this.form .arrowWidth,
height: this.form.arrowHeight
};
this.$emit('createButton', arrowModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -0,0 +1,71 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="背景板宽度">
<el-input-number v-model="form.bgWidth" controls-position="right" :min="1" ></el-input-number>
</el-form-item>
<el-form-item label="背景板高度">
<el-input-number v-model="form.bgHeight" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'BgDraft',
components: {
},
data() {
return {
form: {
bgWidth: '',
bgHeight: ''
},
rules: {
bgWidth: [
{ required: true, message: '请输入背景板宽度', trigger: 'blur' },
],
bgHeight: [
{ required: true, message: '请输入背景板高度', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const bgModel = {
zlevel: 1,
z: 1,
x: 0,
y: 0,
_type: 'Background',
width: this.form .bgWidth,
height: this.form.bgHeight
};
this.$emit('createBg', bgModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,82 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="按钮颜色">
<el-select v-model="form.buttonColor" placeholder="请选择按钮颜色">
<el-option label="红色按钮" value="redButton"></el-option>
<el-option label="黄色按钮" value="yellowButton"></el-option>
<el-option label="绿色按钮" value="greenButton"></el-option>
</el-select>
</el-form-item>
<el-form-item label="按钮宽度">
<el-input-number v-model="form.buttonWidth" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="按钮高度">
<el-input-number v-model="form.buttonHeight" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'ButtonDraft',
components: {
},
data() {
return {
form: {
buttonColor: '',
buttonWidth: '',
buttonHeight: ''
},
rules: {
buttonColor: [
{ required: true, message: '请选择按钮颜色', trigger: 'change'}
],
buttonWidth: [
{ required: true, message: '请输入按钮宽度', trigger: 'blur' },
],
buttonHeight: [
{ required: true, message: '请输入按钮高度', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const buttonModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
_type: 'SquareButton',
colorType: this.form.buttonColor,
width: this.form .bgWidth,
height: this.form.bgHeight
};
this.$emit('createButton', buttonModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,78 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="圆形指示灯半径">
<el-input-number v-model="form.r" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="圆形指示灯关闭颜色">
<el-input-number v-model="form.offColor" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="圆形指示灯打开颜色">
<el-input-number v-model="form.onColor" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'ButtonDraft',
components: {
},
data() {
return {
form: {
r: '',
offColor: '',
onColor: ''
},
rules: {
r: [
{ required: true, message: '请输入圆形指示灯半径', trigger: 'change'}
],
offColor: [
{ required: true, message: '请输入圆形指示灯关闭颜色', trigger: 'blur' },
],
onColor: [
{ required: true, message: '请输入圆形指示灯打开颜色', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const lampModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
_type: 'CircularLamp',
r: this.form.r,
offColor: this.form.offColor,
onColor: this.form.onColor
};
this.$emit('createLamp', lampModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,65 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="旋转按钮宽度">
<el-input-number v-model="form.rotatingButtonWidth" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="旋转按钮高度">
<el-input-number v-model="form.rotatingButtonHeight" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'RotatingButtonDraft',
components: {
},
data() {
return {
form: {
rotatingButtonWidth: '',
rotatingButtonHeight: ''
},
rules: {
rotatingButtonWidth: [
{ required: true, message: '请输入旋转按钮宽度', trigger: 'blur' },
],
rotatingButtonHeight: [
{ required: true, message: '请输入旋转按钮高度', trigger: 'blur' },
]
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const rotatingButtonModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
_type: 'RotatingButton',
width: this.form .rotatingButtonWidth,
height: this.form.rotatingButtonHeight
};
this.$emit('createAppendageBox', rotatingButtonModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -0,0 +1,92 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="文字编号">
<el-input v-model="form.code"></el-input>
</el-form-item>
<el-form-item label="文字内容">
<el-input type="textarea" v-model="form.context"></el-input>
</el-form-item>
<el-form-item label="文字颜色">
<el-input v-model="form.textFill"></el-input>
</el-form-item>
<el-form-item label="文字大小">
<el-input-number v-model="form.fontSize" controls-position="right" :min="1" :max="50"></el-input-number>
</el-form-item>
<el-form-item label="是否加粗">
<el-switch v-model="form.fontWeight"></el-switch>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'TextDraft',
components: {
},
data() {
return {
form: {
code: '',
context: '',
textFill: '',
fontSize: '',
fontWeight: false
},
rules: {
code: [
{ required: true, message: '请输入文字编号', trigger: 'blur' },
],
context: [
{ required: true, message: '请输入文字内容', trigger: 'blur' },
],
textFill: [
{ required: true, message: '请输入文字颜色', trigger: 'blur' },
],
fontSize: [
{ required: true, message: '请输入文字大小', trigger: 'blur' },
],
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const textModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
code: this.form.code,
_type: 'IbpText',
context: this.form .context,
textFill: this.form.textFill,
fontSize: this.form.fontSize ,
fontWeight: this.form.fontWeight,
fontFamily: 'consolas'
};
this.$emit('createText', textModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,93 @@
<template>
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="文字编号">
<el-input v-model="form.code"></el-input>
</el-form-item>
<el-form-item label="文字内容">
<el-input v-model="form.context"></el-input>
</el-form-item>
<el-form-item label="文字颜色">
<el-input v-model="form.textFill"></el-input>
</el-form-item>
<el-form-item label="文字大小">
<el-input-number v-model="form.fontSize" controls-position="right" :min="1" :max="50"></el-input-number>
</el-form-item>
<el-form-item label="是否加粗">
<el-switch v-model="form.fontWeight"></el-switch>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'TextDraft',
components: {
},
data() {
return {
form: {
code: '',
context: '',
textFill: '',
fontSize: '',
fontWeight: false
},
rules: {
code: [
{ required: true, message: '请输入文字编号', trigger: 'blur' },
],
context: [
{ required: true, message: '请输入文字内容', trigger: 'blur' },
],
textFill: [
{ required: true, message: '请输入文字颜色', trigger: 'blur' },
],
fontSize: [
{ required: true, message: '请输入文字大小', trigger: 'blur' },
],
}
};
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
onSubmit() {
const textModel = {
zlevel: 1,
z: 1,
x: 10,
y: 10,
code: this.form.code,
_type: 'IbpText',
context: this.form .context,
textFill: this.form.textFill,
fontSize: this.form.fontSize ,
fontWeight: this.form.fontWeight,
fontFamily: 'consolas'
};
this.$emit('createText', textModel)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,104 @@
<template>
<transition name="el-zoom-in-center">
<div class="map-control">
<el-card type="border-card">
<div slot="header" class="clearfix">
<span>
车站名称
<b>请选择车站</b>
</span>
<el-button
type="text"
style="float: right; padding: 3px 0; margin-right: 5px;"
@click="handleSave"
>保存</el-button>
</div>
<el-tabs v-model="enabledTab" class="mapEdit" type="card">
<el-tab-pane label="背景板" name="BgImage">
<ibp-bg
@createBg="createDataModel"
></ibp-bg>
</el-tab-pane>
<el-tab-pane label="文字" name="Text">
<ibp-text
@createText="createDataModel"
>
</ibp-text>
</el-tab-pane>
<el-tab-pane label="功能提示" name="Tip">
<ibp-tip
@createTip="createDataModel"
></ibp-tip>
</el-tab-pane>
<el-tab-pane label="按键" name="Button">
<ibp-button
@createButton="createDataModel"
>
</ibp-button>
</el-tab-pane>
<el-tab-pane label="圆形指示灯" name="CircularLamp">
</el-tab-pane>
<el-tab-pane label="箭头" name="Arrow">
</el-tab-pane>
<el-tab-pane label="扶梯框" name="AppendageBox">
</el-tab-pane>
<el-tab-pane label="报警器" name="Alarm">
</el-tab-pane>
<el-tab-pane label="旋转按钮" name="SpinButton">
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</transition>
</template>
<script>
import { checkLoginLine } from '@/api/login';
import { updateIbpData } from '@/ibp/utils/parser';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import { EventBus } from '@/scripts/event-bus';
import IbpText from './ibpText';
import IbpTip from './ibpTip';
import IbpButton from './ibpButton';
import IbpBg from './ibpBg';
export default {
name: 'IbpOperate',
components: {
IbpText,
IbpBg,
IbpButton,
IbpTip
},
mixins: [
],
data() {
return {
enabledTab: 'BgImage',
};
},
watch: {
},
mounted() {
},
beforeDestroy() {
},
methods: {
createDataModel(textModel) {
this.$store.dispatch('ibp/updateIbpDevices', textModel);
updateIbpData(textModel,'update')
},
handleSave() {
console.log(this.$store.state.ibp.ibp);
}
}
};
</script>

View File

@ -0,0 +1,103 @@
<template>
<transition name="el-zoom-in-center">
<div class="mapPaint">
<div class="map-view">
<ibp-plate ref="ibpPlate"/>
</div>
<div class="map-draft">
<ibp-operate ref="ibpOperate"></ibp-operate>
</div>
</div>
</transition>
</template>
<script>
import { checkLoginLine } from '@/api/login';
import IbpPlate from '@/views/ibp/index';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import { EventBus } from '@/scripts/event-bus';
import IbpOperate from './ibpOperate/index';
export default {
name: 'MapView',
components: {
IbpPlate,
IbpOperate
},
mixins: [
WindowResizeHandler
],
data() {
return {
mapSaveing: false,
viewDraft: 'draft',
autoSaveTask: null,
selected: null,
mapInfo: { name: "" },
timeDemon: null
};
},
watch: {
},
mounted() {
this.$refs.ibpPlate.show();
this.$refs.ibpPlate.drawIbpInit();
},
beforeDestroy() {
},
methods: {
resizeHandler() {
this._clientWidth = this._clientWidth || document.documentElement.clientWidth;
this._clientHeight = this._clientHeight || document.documentElement.clientHeight;
const width = this._clientWidth - 521;
const height = this._clientHeight;
this.$store.dispatch('config/resize', { width: width, height: height });
},
endViewLoading(isSuccess) {
},
selectViewDraft(data) {
this.viewDraft = data;
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.map-draft{
/deep/{
.v-modal{
opacity: 0;
}
}
}
.map-view {
float: left;
width: 60%;
}
.map-draft {
float: right;
width: 520px;
// /deep/ .el-scrollbar__view {
// width: 510px !important;
// height: calc(100% - 40px);
// }
}
.physical-view {
line-height: 25px;
height: 60px;
padding-left: 12px;
.el-checkbox {
width: 70px;
margin: 0;
margin-right: 12px;
}
}
</style>

View File

@ -0,0 +1,72 @@
<template>
<div id="mapMain" class="ibpDraft">
<div class="map-list" :style="{width: widthLeft+'px'}">
<span>车站列表</span>
</div>
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<transition>
<router-view />
</transition>
</div>
</template>
<script>
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import localStore from 'storejs';
import IbpPlate from '@/views/ibp/index';
import DrapLeft from '@/views/components/drapLeft/index';
export default {
name: 'IbpDraft',
components: {
IbpPlate,
DrapLeft
},
mixins: [
WindowResizeHandler
],
data() {
return {
widthLeft: 320
};
},
watch: {
widthLeft(val) {
this.setMapResize(val);
}
},
mounted() {
// this.$refs.ibpPlate.show();
this.resizeHandler();
},
methods: {
drapWidth(width) {
this.widthLeft = Number(width);
},
resizeHandler() {
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
this._clientWidth = this._clientWidth || document.documentElement.clientWidth;
this._clientHeight = this._clientHeight || document.documentElement.clientHeight;
const width = this._clientWidth - 521 - this.widthLeft;
const height = this._clientHeight - 90;
this.$store.dispatch('config/resize', { width: width, height: height });
},
setMapResize(LeftWidth) {
const widths = this._clientWidth - 521 - LeftWidth;
const heights = this._clientHeight - 90;
this.$store.dispatch('config/resize', { width: widths, height: heights });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.ibpDraft {
overflow: hidden;
.map-list {
float: left;
height: 100%;
}
}
</style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div :id="ibpId" :style="{ width: '100%', height: '100%' }" class="ibp-canvas"></div> <div :id="ibpId" :style="{ width: '100%', height: '100%' }" class="ibp-canvas"></div>
<el-button class="ibp-button" type="primary" @click="back">返回</el-button> <el-button v-if="showBackButton" class="ibp-button" type="primary" @click="back">返回</el-button>
</div> </div>
</template> </template>
@ -20,6 +20,8 @@ export default {
}, },
data() { data() {
return { return {
width: this.$store.state.config.width,
height: this.$store.state.config.height,
dataZoom: { dataZoom: {
offsetX: '0', offsetX: '0',
offsetY: '0', offsetY: '0',
@ -31,7 +33,8 @@ export default {
x: 0, x: 0,
y: 0 y: 0
} }
} },
showBackButton: true
}; };
}, },
computed: { computed: {
@ -58,12 +61,19 @@ export default {
} }
}, },
methods: { methods: {
resizeHandler() {
this._clientWidth = this._clientWidth || document.documentElement.clientWidth;
this._clientHeight = this._clientHeight || document.documentElement.clientHeight;
const width = this._clientWidth - 521;
const height = this._clientHeight - 60;
this.$store.dispatch('config/resize', { width: width, height: height });
},
show: function () { show: function () {
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});
console.log('=================', data);
this.$ibp = new IbpPan({ this.$ibp = new IbpPan({
dom: document.getElementById(this.ibpId), dom: document.getElementById(this.ibpId),
config: { config: {
@ -82,8 +92,9 @@ export default {
stateLoaded: this.handleStateLoaded stateLoaded: this.handleStateLoaded
} }
}); });
Vue.prototype.$ibp = this.$ibp;
this.setMap(data); this.setMap(data);
console.log('+++++++++',this.$ibp); this.$store.dispatch('ibp/setIbpData', ibpData);
window.document.oncontextmenu = function () { window.document.oncontextmenu = function () {
return false; return false;
}; };
@ -102,23 +113,7 @@ export default {
back() { back() {
this.$emit('hideIbp'); this.$emit('hideIbp');
}, },
//
onDataZoom(dataZoom) {
this.dataZoom.offsetX = dataZoom.offsetX.toFixed(1) + '';
this.dataZoom.offsetY = dataZoom.offsetY.toFixed(1) + '';
this.dataZoom.scaleRate = dataZoom.scaleRate + '';
const skinCode = this.$store.getters['map/skinCode'];
if (skinCode) {
const param = {
scaleRate: this.dataZoom.scaleRate,
offsetY: this.dataZoom.offsetY,
skinCode: skinCode
};
localStore.set(`scaleRate_${skinCode}`, JSON.stringify(param)); //
}
},
// //
onSelected(em) { onSelected(em) {
this.$emit('onSelect', em); this.$emit('onSelect', em);
@ -127,13 +122,10 @@ export default {
onContextMenu(em) { onContextMenu(em) {
this.$emit('onMenu', em); this.$emit('onMenu', em);
}, },
// //
setShrink() { drawIbpInit() {
this.$ibp.setOptions({type: 'zoom', scale: -1}); this.$ibp.drawIbpInit();
}, this.showBackButton = false;
//
setMagnify() {
this.$ibp.setOptions({type: 'zoom', scale: 1});
} }
} }
}; };
@ -149,6 +141,5 @@ export default {
/*background-image: url('../../assets/ibp_images/ibp_bg.png');*/ /*background-image: url('../../assets/ibp_images/ibp_bg.png');*/
/*background-repeat:repeat;*/ /*background-repeat:repeat;*/
/*background-size: 4096px 2048px;*/ /*background-size: 4096px 2048px;*/
background-color: #0e151f;
} }
</style> </style>

View File

@ -38,6 +38,15 @@
@setCenter="setCenter" @setCenter="setCenter"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="路径单元" name="path">
<path-operate
ref="pathOperate"
:card-height="cardHeight+25"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane label="交路" name="routing"> <el-tab-pane label="交路" name="routing">
<routing-operate <routing-operate
ref="routingOperate" ref="routingOperate"
@ -65,15 +74,6 @@
@setCenter="setCenter" @setCenter="setCenter"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="路径单元" name="path">
<path-operate
ref="pathOperate"
:card-height="cardHeight+25"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
</div> </div>

View File

@ -58,7 +58,7 @@
style="width: 95%; margin: 0 auto" style="width: 95%; margin: 0 auto"
> >
<el-table-column type="index" /> <el-table-column type="index" />
<el-table-column prop="routeCode" label="进路ID" /> <el-table-column prop="routeCode" label="进路code" />
<el-table-column prop="routeName" label="进路名称" /> <el-table-column prop="routeName" label="进路名称" />
<el-table-column fixed="right" :label="$t('map.operation')" width="50"> <el-table-column fixed="right" :label="$t('map.operation')" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
@ -235,10 +235,8 @@ export default {
data.forEach((element, index) => { data.forEach((element, index) => {
this.addModel.mapRouteUnitRelList.push({ this.addModel.mapRouteUnitRelList.push({
routeCode: element.code, routeCode: element.code,
routeName: element.name, routeName: element.name
mapId: this.mapInfo.id, // routeUnitCode: this.addModel.code
id: element.id,
routeUnitCode: this.addModel.code
}); });
}); });
}, },
@ -274,15 +272,13 @@ export default {
this.loading = false; this.loading = false;
}); });
} else { } else {
[ addRouteUnit(this.buildModel()).then(response => {
addRouteUnit(this.buildModel()).then(response => { this.$message.success(this.$t('tip.createSuccess'));
this.$message.success(this.$t('tip.createSuccess')); this.clear();
this.clear(); }).catch(() => {
}).catch(() => { this.$messageBox(this.$t('tip.operationAbnormal'));
this.$messageBox(this.$t('tip.operationAbnormal')); this.loading = false;
this.loading = false; });
})
];
} }
}, },
clear() { clear() {

View File

@ -515,8 +515,10 @@ export default {
const model = Object.assign({}, this.addModel); const model = Object.assign({}, this.addModel);
model['mapId'] = this.mapInfo.id; model['mapId'] = this.mapInfo.id;
model['routeSectionList'] = this.addModel.routeSectionList.map(elem => { return { sectionCode: elem }; }); model['routeSectionList'] = this.addModel.routeSectionList.map(elem => { return { sectionCode: elem }; });
model['routeTriggerSectionList'] = this.addModel.routeTriggerSectionList.map(elem => { return { mapId: this.mapInfo.id, routeCode: model.code, sectionCode: elem }; }); // mapId: this.mapInfo.id, routeCode: model.code,
model['routeOverlapSectionList'] = this.addModel.routeOverlapSectionList.map(elem => { return { mapId: this.mapInfo.id, routeCode: model.code, sectionCode: elem }; }); model['routeTriggerSectionList'] = this.addModel.routeTriggerSectionList.map(elem => { return { sectionCode: elem }; });
// mapId: this.mapInfo.id, routeCode: model.code,
model['routeOverlapSectionList'] = this.addModel.routeOverlapSectionList.map(elem => { return { sectionCode: elem }; });
model['routeStandList'] = this.addModel.routeStandList.map(elem => { return { stationStandCode: elem }; }); model['routeStandList'] = this.addModel.routeStandList.map(elem => { return { stationStandCode: elem }; });
if (code) { model['code'] = code; } if (code) { model['code'] = code; }

View File

@ -120,8 +120,8 @@ export default {
draw: { draw: {
name: this.$t('map.drawData'), name: this.$t('map.drawData'),
item: [ item: [
{ prop: 'code', label: `${this.$t('map.image')}${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.resourceList, change: true, deviceChange: this.deviceChange }, { prop: 'code', label: `${this.$t('map.image')}${this.$t('map.code')}`, type: 'select', optionLabel: 'code', optionValue: 'code', options: this.resourceList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.imageName'), type: 'input' }, // { prop: 'name', label: this.$t('map.imageName'), type: 'input' },
{ prop: 'width', label: this.$t('map.imageWidth'), type: 'number', min: 0 }, { prop: 'width', label: this.$t('map.imageWidth'), type: 'number', min: 0 },
{ prop: 'height', label: this.$t('map.imageHeight'), type: 'number', min: 0 }, { prop: 'height', label: this.$t('map.imageHeight'), type: 'number', min: 0 },
{ prop: 'zIndex', label: this.$t('map.imageZindex'), type: 'number', min: 0 }, { prop: 'zIndex', label: this.$t('map.imageZindex'), type: 'number', min: 0 },

View File

@ -0,0 +1,308 @@
<template>
<div>
<el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }">
<config-list ref="form" :form="form" :form-model="editModel" :rules="rules" />
</el-scrollbar>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }">
<el-form ref="make" label-width="120px" :rules="createRules" :model="addModel" size="mini">
<!-- <el-form-item :label="$t('map.buttonText')+':'" prop="text">
<el-input v-model="addModel.text" />
</el-form-item> -->
<el-form-item :label="$t('map.buttonType')+ ':'" prop="type">
<el-select v-model="addModel.type" filterable>
<el-option
v-for="item in buttonTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('map.belongsStation')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable>
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
</el-form-item>
<div class="coordinate">
<span class="title" style="width: 120px">{{ $t('map.textPoints') }}</span>
<el-form-item
label="x:"
prop="position.x"
style="display: table; float: left; margin-right: 20px;"
label-width="25px"
>
<el-input-number v-model="addModel.position.x" label="x:" />
</el-form-item>
<el-form-item
label="y:"
prop="position.y"
style="display: table; float: left;"
label-width="25px"
>
<el-input-number v-model="addModel.position.y" label="y:" />
</el-form-item>
</div>
</el-form>
</el-scrollbar>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import ConfigList from './config/list';
export default {
name: 'LcControlDraft',
components: {
ConfigList
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
},
cardHeight: {
type: [String, Number],
required: true
}
},
data() {
return {
activeName: 'first',
buttonTypeList: [
{ code: '01', name: '按图折返' }
],
mapData: null,
editModel: {
code: '',
text: '',
type: '',
stationCode: '',
position: {
x: 0,
y: 0
}
},
addModel: {
type: '',
stationCode: '',
text: '',
position: {
x: 0,
y: 0
}
},
rules: {
code: [
{ required: true, message: this.$t('rules.pleaseSelectEncoding'), trigger: 'change' }
],
tsxt: [
{ required: true, message: this.$t('rules.pleaseEnterStatusSignal'), trigger: 'blur' }
],
'position.x': [
{ required: true, message: this.$t('map.pleaseEnterXCoordinate'), trigger: 'blur' }
],
'position.y': [
{ required: true, message: this.$t('map.pleaseEnterYCoordinate'), trigger: 'blur' }
]
}
};
},
computed: {
...mapGetters('map', [
'stationList',
'buttonList'
]),
createRules: function () {
return {
text: [
{ required: true, message: this.$t('rules.pleaseSelectButtonContent'), trigger: 'blur' }
],
type: [
{ required: true, message: this.$t('rules.pleaseSelectButtonType'), trigger: 'blur' }
],
stationCode: [
{ required: true, message: this.$t('rules.stationControlStationCode'), trigger: 'change' }
],
'position.x': [
{ required: true, message: this.$t('map.pleaseEnterXCoordinate'), trigger: 'blur' }
],
'position.y': [
{ required: true, message: this.$t('map.pleaseEnterYCoordinate'), trigger: 'blur' }
]
};
},
form() {
const form = {
labelWidth: '140px',
items: {
code: {
name: '',
item: []
},
draw: {
name: this.$t('map.drawData'),
item: [
{ prop: 'code', label: `${this.$t('map.buttonControl')}${this.$t('map.code')}`, type: 'select', optionLabel: 'code', optionValue: 'code', options: this.buttonList, change: true, deviceChange: this.deviceChange },
// { prop: 'text', label: `${this.$t('map.buttonText')}:`, type: 'input' },
{ prop: 'type', label: `${this.$t('map.buttonType')}:`, type: 'select', optionLabel: 'name', optionValue: 'code', options: this.buttonTypeList },
{ prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px'},
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }
]
},
map: {
name: this.$t('map.mapData'),
item: [
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList }
]
}
}
};
return form;
}
},
watch: {
selected: function (val, oldVal) {
this.deviceSelect(val);
}
},
mounted() {
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
deviceSelect(selected) {
this.$refs.form.resetFields();
this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() == 'ButtonControl'.toUpperCase()) {
this.editModel.code = selected.code;
this.editModel.text = selected.text;
this.editModel.type = selected.type;
this.editModel.stationCode = selected.stationCode;
this.editModel.position = {
x: selected.position.x,
y: selected.position.y
};
this.activeName = 'first';
}
},
create() {
this.$refs.make.validate((valid) => {
if (valid) {
const uid = getUID('ButtonControl');
const model = {
_type: 'ButtonControl',
code: uid,
type: this.addModel.type,
stationCode: this.addModel.stationCode,
text: this.addModel.text,
position: {
x: this.addModel.position.x,
y: this.addModel.position.y
}
};
this.$emit('addOrUpdateMapModel', model);
}
});
},
//
edit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.$emit('addOrUpdateMapModel', this.buildEditModel());
}
});
},
buildEditModel() {
const model = {
_type: 'ButtonControl',
code: this.editModel.code,
text: this.editModel.text,
type: this.editModel.type,
stationCode: this.editModel.stationCode,
position: {
x: this.editModel.position.x,
y: this.editModel.position.y
}
};
return model;
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'LcControl'.toUpperCase()) {
const _that = this;
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
_that.$emit('delMapModel', selected);
_that.deviceSelect();
}).catch(() => {
_that.$message.info(this.$t('tip.cancelledDelete'));
});
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
.coordinate {
overflow: hidden;
.title {
text-align: right;
font-size: 14px;
color: #606266;
line-height: 40px;
padding: 0 12px 0 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
line-height: 28px;
width: 160px;
font-weight: bold;
display: block;
float: left;
}
}
.map-draft-group {
color: #3E44BE;
}
</style>

View File

@ -204,6 +204,16 @@
@setCenter="setCenter" @setCenter="setCenter"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('map.button')" name="ButtonControl">
<button-draft
ref="ImageControl"
:card-height="cardHeights"
:selected="selected"
@addOrUpdateMapModel="addOrUpdateMapModel"
@delMapModel="delMapModel"
@setCenter="setCenter"
/>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
</div> </div>
@ -228,6 +238,7 @@ import ZcControlDraft from './zcControl';
import LimitControlDraft from './limitControl'; import LimitControlDraft from './limitControl';
import LcControlDraft from './lcControl'; import LcControlDraft from './lcControl';
import ImageControlDraft from './ImageControl'; import ImageControlDraft from './ImageControl';
import ButtonDraft from './buttonDraft';
import { ViewMode } from '@/scripts/ConstDic'; import { ViewMode } from '@/scripts/ConstDic';
@ -250,7 +261,8 @@ export default {
ZcControlDraft, ZcControlDraft,
LimitControlDraft, LimitControlDraft,
LcControlDraft, LcControlDraft,
ImageControlDraft ImageControlDraft,
ButtonDraft
}, },
props: { props: {
selected: { selected: {

View File

@ -27,7 +27,7 @@
<el-input-number v-model="addModel.width" :min="1" />px <el-input-number v-model="addModel.width" :min="1" />px
</el-form-item> </el-form-item>
<div class="coordinate"> <div class="coordinate">
<span class="title">{{ $t('map.segmentCoordinates') }}</span> <span class="title">{{ $t('map.linePoint') }}</span>
<div class="point-section"> <div class="point-section">
<template v-for="(point, index) in addModel.points"> <template v-for="(point, index) in addModel.points">
<div :key="index" style="overflow: hidden;"> <div :key="index" style="overflow: hidden;">

View File

@ -171,14 +171,13 @@ export default {
{ prop: 'code', label: this.$t('map.linkCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList, change: true, deviceChange: this.deviceChange }, { prop: 'code', label: this.$t('map.linkCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.linkName'), type: 'input' }, { prop: 'name', label: this.$t('map.linkName'), type: 'input' },
{ prop: 'lp', label: this.$t('map.linkLp'), type: 'coordinate', width: '119px', children: [ { prop: 'lp', label: this.$t('map.linkLp'), type: 'coordinate', width: '119px', children: [
{ prop: 'lp.x', firstLevel: 'lp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: false }, { prop: 'lp.x', firstLevel: 'lp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px', disabled: false },
{ prop: 'lp.y', firstLevel: 'lp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: false } { prop: 'lp.y', firstLevel: 'lp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
] }, ] },
{ prop: 'rp', label: this.$t('map.linkRp'), type: 'coordinate', width: '119px', children: [ { prop: 'rp', label: this.$t('map.linkRp'), type: 'coordinate', width: '119px', children: [
{ prop: 'rp.x', firstLevel: 'rp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: false }, { prop: 'rp.x', firstLevel: 'rp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px', disabled: false },
{ prop: 'rp.y', firstLevel: 'rp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: false } { prop: 'rp.y', firstLevel: 'rp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
] }, ] },
{ prop: 'color', label: this.$t('map.linkColor'), type: 'color' },
{ prop: 'leftFdCode', label: this.$t('map.linkLeftFdCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkLists }, { prop: 'leftFdCode', label: this.$t('map.linkLeftFdCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkLists },
{ prop: 'leftSdCode', label: this.$t('map.linkLeftSdCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkLists }, { prop: 'leftSdCode', label: this.$t('map.linkLeftSdCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkLists },
{ prop: 'rightFdCode', label: this.$t('map.linkRightFdCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkLists }, { prop: 'rightFdCode', label: this.$t('map.linkRightFdCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkLists },
@ -202,6 +201,21 @@ export default {
], ],
name: [ name: [
{ required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' } { required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' }
],
'lp.x': [
{ required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' }
],
'lp.y': [
{ required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' }
],
'rp.x': [
{ required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' }
],
'rp.y': [
{ required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' }
],
lengthFact: [
{ required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' }
] ]
}; };
// //

View File

@ -24,16 +24,6 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('map.directionType')" prop="directionType">
<el-select v-model="addModel.directionType" filterable>
<el-option
v-for="item in SignalDirectionTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('map.leftOrRight')" prop="leftOrRight"> <el-form-item :label="$t('map.leftOrRight')" prop="leftOrRight">
<el-select v-model="addModel.leftOrRight" filterable> <el-select v-model="addModel.leftOrRight" filterable>
<el-option <el-option
@ -44,6 +34,16 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('map.directionType')" prop="directionType">
<el-select v-model="addModel.directionType" filterable>
<el-option
v-for="item in SignalDirectionTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('map.positionType')" prop="positionType"> <el-form-item :label="$t('map.positionType')" prop="positionType">
<el-select v-model="addModel.positionType" filterable> <el-select v-model="addModel.positionType" filterable>
<el-option <el-option
@ -202,7 +202,7 @@ export default {
PhysicalSectionList() { PhysicalSectionList() {
let list = []; let list = [];
if (this.sectionList && this.sectionList.length) { if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => { return elem.type === '01'; }); list = this.sectionList.filter(elem => { return elem.type === '01' && !elem.isSwitchSection; });
} }
return list; return list;
}, },

View File

@ -171,7 +171,7 @@ export default {
PhysicalSectionList() { PhysicalSectionList() {
let list = []; let list = [];
if (this.sectionList && this.sectionList.length) { if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => { return elem.type === '01'; }); list = this.sectionList.filter(elem => { return elem.type === '01' && !elem.isSwitchSection; });
} }
return list; return list;
}, },

View File

@ -15,7 +15,7 @@
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second"> <el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }"> <el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }">
<el-form ref="make" :model="addModel" label-width="120px" size="mini" :rules="makeRules"> <el-form ref="make" :model="addModel" label-width="120px" size="mini" :rules="makeRules">
<el-form-item :label="$t('map.stationName')" prop="stationCode"> <el-form-item :label="$t('map.stationstandName')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable> <el-select v-model="addModel.stationCode" filterable>
<el-option <el-option
v-for="item in stationList" v-for="item in stationList"
@ -74,7 +74,8 @@ export default {
zakContent: '', zakContent: '',
jjzkContent: '', jjzkContent: '',
zbjkContent: '', zbjkContent: '',
zzkContent: '' zzkContent: '',
lskContent: ''
}, },
addModel: { addModel: {
stationCode: '' stationCode: ''
@ -104,11 +105,12 @@ export default {
name: this.$t('map.drawData'), name: this.$t('map.drawData'),
item: [ item: [
{ prop: 'code', label: this.$t('map.stationControlCode'), type: 'select', optionLabel: 'code', optionValue: 'code', options: this.stationControlList, change: true, deviceChange: this.deviceChange }, { prop: 'code', label: this.$t('map.stationControlCode'), type: 'select', optionLabel: 'code', optionValue: 'code', options: this.stationControlList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.stationControlName'), type: 'input' }, // { prop: 'name', label: this.$t('map.stationControlName'), type: 'input' },
{ prop: 'zokContent', label: this.$t('map.zokContent'), type: 'input' }, { prop: 'zokContent', label: this.$t('map.zokContent'), type: 'input' },
{ prop: 'zakContent', label: this.$t('map.zakContent'), type: 'input' }, { prop: 'zakContent', label: this.$t('map.zakContent'), type: 'input' },
{ prop: 'jjzkContent', label: this.$t('map.jjzkContent'), type: 'input' }, { prop: 'jjzkContent', label: this.$t('map.jjzkContent'), type: 'input' },
{ prop: 'zzkContent', label: this.$t('map.zzkContent'), type: 'input' }, { prop: 'zzkContent', label: this.$t('map.zzkContent'), type: 'input' },
{ prop: 'lskContent', label: `${this.$t('map.interconnected')}:`, type: 'input' },
{ prop: 'position', label: this.$t('map.stationControlPosition'), type: 'coordinate', width: '150px', children: [ { prop: 'position', label: this.$t('map.stationControlPosition'), type: 'coordinate', width: '150px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' }, { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
@ -184,6 +186,7 @@ export default {
this.editModel.zakContent = selected.zakContent; this.editModel.zakContent = selected.zakContent;
this.editModel.jjzkContent = selected.jjzkContent; this.editModel.jjzkContent = selected.jjzkContent;
this.editModel.zzkContent = selected.zzkContent; this.editModel.zzkContent = selected.zzkContent;
this.editModel.lskContent = selected.lskContent;
this.editModel.stationCode = selected.stationCode; this.editModel.stationCode = selected.stationCode;
this.editModel.zbjkContent = selected.zbjkContent; this.editModel.zbjkContent = selected.zbjkContent;
if (selected.hasOwnProperty('position')) { if (selected.hasOwnProperty('position')) {
@ -208,7 +211,8 @@ export default {
zbjkContent: '总报警', zbjkContent: '总报警',
zakContent: '站控', zakContent: '站控',
jjzkContent: '紧急站控', jjzkContent: '紧急站控',
zzkContent: '站中控按钮' zzkContent: '站中控按钮',
lskContent: '连锁控'
}; };
this.stationList.forEach(elem => { this.stationList.forEach(elem => {
if (elem.code === this.addModel.stationCode) { if (elem.code === this.addModel.stationCode) {
@ -241,6 +245,7 @@ export default {
zbjkContent: this.editModel.zbjkContent, zbjkContent: this.editModel.zbjkContent,
zakContent: this.editModel.zakContent, zakContent: this.editModel.zakContent,
jjzkContent: this.editModel.jjzkContent, jjzkContent: this.editModel.jjzkContent,
lskContent: this.editModel.lskContent,
zzkContent: this.editModel.zzkContent, zzkContent: this.editModel.zzkContent,
stationCode: this.editModel.stationCode, stationCode: this.editModel.stationCode,
position: { position: {

View File

@ -86,12 +86,16 @@ export default {
const list = []; const list = [];
if (this.sectionList && this.sectionList.length) { if (this.sectionList && this.sectionList.length) {
this.sectionList.forEach(elem => { this.sectionList.forEach(elem => {
if (elem.type === '01') { if (elem.type === '01' && elem.isSwitchSection) {
list.push({ const link = this.findLinkData(elem.linkCode);
label: elem.name, if ((link.leftFdCode && link.leftSdCode) || (link.rightFdCode && link.rightSdCode)) {
key: elem.code, list.push({
pinyin: elem.name label: elem.name,
}); key: elem.code,
pinyin: elem.name
});
}
} }
}); });
} }
@ -125,10 +129,10 @@ export default {
name: this.$t('map.mapData'), name: this.$t('map.mapData'),
item: [ item: [
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList }, { prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList },
{ prop: 'turnTime', label: this.$t('map.turnTime'), type: 'number', min: 0, max: 1000, placeholder: 's' }, { prop: 'turnTime', label: this.$t('map.turnTime'), type: 'number', min: 0, max: 1000, placeholder: 's' }
{ prop: 'sectionACode', label: this.$t('map.sectionACode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList }, // { prop: 'sectionACode', label: this.$t('map.sectionACode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList },
{ prop: 'sectionBCode', label: this.$t('map.sectionBCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList }, // { prop: 'sectionBCode', label: this.$t('map.sectionBCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList },
{ prop: 'sectionCCode', label: this.$t('map.sectionCCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList } // { prop: 'sectionCCode', label: this.$t('map.sectionCCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList }
] ]
} }
} }
@ -229,6 +233,8 @@ export default {
if (node) { if (node) {
const lFdSection = this.findSectionDataByLinkCodeAndPoint(link.leftFdCode, section.points[0]); const lFdSection = this.findSectionDataByLinkCodeAndPoint(link.leftFdCode, section.points[0]);
const lSdSection = this.findSectionDataByLinkCodeAndPoint(link.leftSdCode, section.points[0]); const lSdSection = this.findSectionDataByLinkCodeAndPoint(link.leftSdCode, section.points[0]);
// const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode];
if (lFdSection && lSdSection) { if (lFdSection && lSdSection) {
const model = { const model = {
_type: 'Switch', _type: 'Switch',
@ -249,6 +255,14 @@ export default {
rp: { rp: {
x: lSdSection.points[lSdSection.points.length - 2].x, x: lSdSection.points[lSdSection.points.length - 2].x,
y: lSdSection.points[lSdSection.points.length - 2].y y: lSdSection.points[lSdSection.points.length - 2].y
},
intersection: {
x: section.points[0].x,
y: section.points[0].y
},
skew: {
x: lSdSection.points[lSdSection.points.length - 2].x,
y: lSdSection.points[lSdSection.points.length - 2].y
} }
}; };
@ -287,6 +301,14 @@ export default {
rp: { rp: {
x: rSdSection.points[1].x, x: rSdSection.points[1].x,
y: rSdSection.points[1].y y: rSdSection.points[1].y
},
intersection: {
x: section.points[section.points.length - 1].x,
y: section.points[section.points.length - 1].y
},
skew: {
x: rSdSection.points[1].x,
y: rSdSection.points[1].y
} }
}; };
@ -351,7 +373,7 @@ export default {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code); const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
const _that = this; const _that = this;
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'

View File

@ -24,11 +24,6 @@
<el-form-item :label="$t('map.mapName')" prop="name"> <el-form-item :label="$t('map.mapName')" prop="name">
<el-input v-model="editModel.name" /> <el-input v-model="editModel.name" />
</el-form-item> </el-form-item>
<!-- <el-form-item :label="$t('map.selectCity')" prop="cityCode">
<el-select v-model="editModel.cityCode" :placeholder="$t('map.pleaseSelect')" size="mini">
<el-option v-for="item in cityList" :key="item.code" :label="item.name" :value="item.code" />
</el-select>
</el-form-item> -->
</el-form> </el-form>
</template> </template>
<template v-else> <template v-else>
@ -116,9 +111,6 @@ export default {
], ],
skinCode: [ skinCode: [
{ required: true, message: this.$t('rules.pleaseSelectAssociatedSkin'), trigger: 'change' } { required: true, message: this.$t('rules.pleaseSelectAssociatedSkin'), trigger: 'change' }
],
cityCode: [
{ required: true, message: this.$t('rules.pleaseSelectAssociatedCity'), trigger: 'change' }
] ]
}; };
}, },
@ -152,13 +144,19 @@ export default {
this.initLoadData(); this.initLoadData();
}, },
methods: { methods: {
show() { show(type) {
const dataZoom = this.$store.state.map.dataZoom; const dataZoom = this.$store.state.map.dataZoom;
if (dataZoom && dataZoom.offsetX) { if (type == 'editCode') {
this.updtModel.origin.x = Number.parseInt(dataZoom.offsetX); this.editModel.skinCode = this.editModel.skinCode ? this.editModel.skinCode : '';
this.updtModel.origin.y = Number.parseInt(dataZoom.offsetY); this.editModel.name = this.editModel.name ? this.editModel.name : '';
this.updtModel.scaling = dataZoom.scaleRate; } else if (type == 'editPoint') {
if (dataZoom && dataZoom.offsetX) {
this.updtModel.origin.x = Number.parseInt(dataZoom.offsetX);
this.updtModel.origin.y = Number.parseInt(dataZoom.offsetY);
this.updtModel.scaling = dataZoom.scaleRate;
}
} }
this.dialogShow = true; this.dialogShow = true;
}, },
close() { close() {
@ -176,7 +174,7 @@ export default {
save() { save() {
this.loading = true; this.loading = true;
if (this.basicInfo) { if (this.basicInfo) {
this.editModel.id = this.$route.params.mapId; // this.editModel.id = this.$route.params.mapId;
this.$refs['edit'].validate((valid) => { this.$refs['edit'].validate((valid) => {
if (valid) { if (valid) {
updateMap(this.editModel).then(response => { updateMap(this.editModel).then(response => {

View File

@ -117,6 +117,7 @@ export default {
y: e.clientY y: e.clientY
}; };
this.editModel = obj; this.editModel = obj;
this.editModel.skinCode = node.parent.data.id;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu }); this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
} }
}, },
@ -299,7 +300,6 @@ export default {
import('@/utils/Export2Excel').then(excel => { import('@/utils/Export2Excel').then(excel => {
self.queryExportData(resultData).then(data => { self.queryExportData(resultData).then(data => {
excel.export_json_excel(data, resultData.name); excel.export_json_excel(data, resultData.name);
}).catch(error => { }).catch(error => {
self.$message.error('导出执行异常:' + error.message); self.$message.error('导出执行异常:' + error.message);
}); });

View File

@ -114,13 +114,13 @@ export default {
updateObj() { updateObj() {
this.doClose(); this.doClose();
if (this.$refs && this.$refs.edit) { if (this.$refs && this.$refs.edit) {
this.$refs.edit.show(); this.$refs.edit.show('editCode');
} }
}, },
updateObjAxis() { updateObjAxis() {
this.doClose(); this.doClose();
if (this.$refs && this.$refs.axisEdit) { if (this.$refs && this.$refs.axisEdit) {
this.$refs.axisEdit.show(); this.$refs.axisEdit.show('editPoint');
} }
}, },
saveAs() { saveAs() {
@ -144,12 +144,14 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
deleteMap(this.editModel.id).then(response => { deleteMap(this.editModel.id).then(response => {
this.$store.dispatch('map/mapClear').then(() => { if (this.editModel.id == this.$route.params.mapId) {
_that.refresh(); this.$store.dispatch('map/mapClear').then(() => {
_that.$emit('editMap', null); _that.$emit('editMap', null);
_that.$message.success(this.$t('map.successfullyDelete')); _that.$router.push({ path: `${UrlConfig.map.draft}/0/draft` });
_that.$router.push({ path: `${UrlConfig.map.draft}/0/draft` }); });
}); }
_that.refresh();
_that.$message.success(this.$t('map.successfullyDelete'));
}).catch(error => { }).catch(error => {
_that.$message.error(this.$t('map.failDelete') + error.message); _that.$message.error(this.$t('map.failDelete') + error.message);
}); });

View File

@ -6,6 +6,7 @@
label-position="right" label-position="right"
:model="editModel" :model="editModel"
label-width="120px" label-width="120px"
:rules="editRules"
size="mini" size="mini"
@submit.native.prevent @submit.native.prevent
> >
@ -45,6 +46,14 @@ export default {
id: '', id: '',
name: '', name: '',
cityCode: '000000' cityCode: '000000'
},
editRules: {
cityCode: [
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'blur' }
]
} }
}; };
}, },

View File

@ -6,6 +6,7 @@
label-position="right" label-position="right"
:model="editModel" :model="editModel"
label-width="100px" label-width="100px"
:rules="editRules"
size="mini" size="mini"
@submit.native.prevent @submit.native.prevent
> >
@ -39,6 +40,11 @@ export default {
editModel: { editModel: {
id: '', id: '',
name: '' name: ''
},
editRules: {
name: [
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'blur' }
]
} }
}; };
}, },

Binary file not shown.

Binary file not shown.