Merge branch 'dev' of git.cloud.tencent.com:joylink/jl-nclient into dev

This commit is contained in:
sunzhenyu 2019-09-04 17:36:15 +08:00
commit ebd1b211d1
99 changed files with 1845 additions and 1064 deletions

View File

@ -61,6 +61,14 @@ export function setLessonPermisson(data) {
});
}
/** 设置权限失效或有效*/
export function getPermissionList(id) {
return request({
url: `/api/permission/${id}`,
method: 'get'
});
}
/**
* 查询仿真权限列表
*/

View File

@ -93,3 +93,20 @@ export function putRoles(data) {
data: data
});
}
// 获取缓存列表数据
export function getCacheList(params) {
return request({
url: `/api/cache/keys`,
method: 'get',
params: params
});
}
// 删除缓存列表
export function delCacheList(key) {
return request({
url: `/api/cache/${key}`,
method: 'delete'
});
}

View File

@ -72,9 +72,24 @@ export function queryRunPlan(planId) {
});
}
/**
* 删除运行图
*/
// 根据skinCode查询发布运行图列表
export function queryRunPlanList(skinCode) {
return request({
url: `/api/runPlan/template/skin/${skinCode}`,
method: 'get'
});
}
// 从发布运行图创建新运行图
export function postCreatePlan(data) {
return request({
url: `/api/runPlan/draft/createFrom/${data.templateId}`,
method: 'post',
data: data
});
}
// 删除运行图
export function deleteRunPlan(planId) {
return request({
url: `/api/runPlan/draft/${planId}`,
@ -82,6 +97,15 @@ export function deleteRunPlan(planId) {
});
}
// 修改运行图内容
export function putRunPlanDetail(data) {
return request({
url: `/api/runPlan/draft/${data.planId}`,
method: 'put',
data: data
});
}
/**
* 发布运行图
*/
@ -204,15 +228,6 @@ export function duplicateService(data) {
});
}
/** 修改计划*/
// export function updatePlanService(data) {
// return request({
// url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`,
// method: 'put',
// data: data
// })
// }
/** 增加任务*/
export function addPlanTrip(data) {
return request({

View File

@ -23,10 +23,11 @@ export function getSchedulingAllTrains(group) {
});
}
export function checkScheduling(group) {
export function checkScheduling(group, data) {
return request({
url: `/api/scheduling/${group}/check`,
method: 'post'
method: 'post',
data
});
}

View File

@ -400,7 +400,7 @@ export function generateDayRunPlan(planId, group) {
});
}
/** 创建班计划仿真*/
/** 创建班计划仿真*/
export function schedulingNotify(params) {
return request({
url: `/api/scheduling/simulation`,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 MiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -56,5 +56,6 @@ export default {
userTrainingManage: 'User training management',
userExamManage: 'User examination management',
userSimulationManage: 'User simulation management',
existingSimulation: 'Existence simulation management'
existingSimulation: 'Existence simulation management',
ibpDraw: 'ibp Draw'
};

View File

@ -53,6 +53,7 @@ export default {
dataDictionary: '数据字典',
dataDictionaryDetails: '数据字典明细',
userManage: '用户管理',
cacheManage: '缓存管理',
userTrainingManage: '用户实训统计',
userExamManage: '用户考试统计',
userSimulationManage: '用户仿真统计',

View File

@ -1,22 +1,26 @@
export default {
scriptTitle: '任务录制',
saveMaplocation: '更新定位',
scriptTitle: '剧本录制',
// saveMaplocation: '更新定位',
saveBackground: '保存背景',
saveData: '保存数据',
roleManage: '角色管理',
targetCondition: '任务目标',
taskScript: '任务剧本',
roleName: '角色名称',
roleType: '角色类型',
deviceCode: '设备编码',
roleList: '角色列表',
operation: '操作',
roleAdd: '添加',
delete: '删除',
behaviorOperate: '行为操作',
conditionTitle: '目标条件',
deviceType: '设备类型',
deviceCondition: '设备条件',
paramDeviceType: '参数设备类型',
paramDeviceCode: '参数设备编号'
mapList: '地图列表',
createScript: '创建剧本',
scriptName: '剧本名称',
// roleManage: '角色管理',
// targetCondition: '任务目标',
// taskScript: '任务剧本',
// roleName: '角色名称',
// roleType: '角色类型',
// deviceCode: '设备编码',
// roleList: '角色列表',
// operation: '操作',
// roleAdd: '添加',
// delete: '删除',
// behaviorOperate: '行为操作',
// conditionTitle: '目标条件',
// deviceType: '设备类型',
// deviceCondition: '设备条件',
// paramDeviceType: '参数设备类型',
// paramDeviceCode: '参数设备编号'
};

View File

@ -4,79 +4,114 @@ const deviceRender = {};
/** IbpText渲染配置*/
deviceRender[deviceType.IbpText] = {
zlevel: 3
_type: deviceType.IbpText,
zlevel: 1,
z: 4
};
/** SquareButton渲染配置*/
deviceRender[deviceType.SquareButton] = {
zlevel: 3
_type: deviceType.SquareButton,
zlevel: 1,
z: 4
};
/** WarnButton渲染配置*/
deviceRender[deviceType.WarnButton] = {
zlevel: 3
_type: deviceType.WarnButton,
zlevel: 1,
z: 4
};
/** Arrow渲染配置*/
deviceRender[deviceType.Arrow] = {
zlevel: 2
_type: deviceType.Arrow,
zlevel: 1,
z: 2
};
/** RotatingButton渲染配置*/
deviceRender[deviceType.RotatingButton] = {
zlevel: 3
_type: deviceType.RotatingButton,
zlevel: 1,
z: 3
};
/** TipBox渲染配置*/
deviceRender[deviceType.TipBox] = {
zlevel: 2,
z: 2
_type: deviceType.TipBox,
zlevel: 1,
z: 3
};
/** BackGround渲染配置*/
deviceRender[deviceType.Background] = {
zlevel: 0
_type: deviceType.Background,
zlevel: 1,
z: 0
};
/** CircularLamp渲染配置 */
deviceRender[deviceType.CircularLamp] = {
zlevel: 3
_type: deviceType.CircularLamp,
zlevel: 1,
z: 4
};
/** AppendageBox渲染配置 */
deviceRender[deviceType.AppendageBox] = {
zlevel: 1
_type: deviceType.AppendageBox,
zlevel: 1,
z: 1
};
/** IbpLine渲染配置 */
deviceRender[deviceType.IbpLine] = {
zlevel: 1
_type: deviceType.IbpLine,
zlevel: 1,
z: 3
};
/** Elevator 渲染配置 */
deviceRender[deviceType.Elevator] = {
zlevel: 2,
z: 1
_type: deviceType.Elevator,
zlevel: 1,
z: 2
};
/** Key 渲染配置 */
deviceRender[deviceType.Key] = {
zlevel: 4
_type: deviceType.Key,
zlevel: 1,
z: 4
};
/** TeleTerminal 渲染配置 */
deviceRender[deviceType.TeleTerminal] = {
zlevel: 3
_type: deviceType.TeleTerminal,
zlevel: 1,
z: 4
};
/** Clock 渲染配置*/
deviceRender[deviceType.Clock] = {
zlevel: 3
_type: deviceType.Clock,
zlevel: 1,
z: 4
};
/** RotateTip 渲染配置 */
deviceRender[deviceType.RotateTip] = {
zlevel: 3
_type: deviceType.RotateTip,
zlevel: 1,
z: 4
};
/** Alarm */
deviceRender[deviceType.Alarm] = {
_type: deviceType.Alarm,
zlevel: 1,
z: 4
};
export default deviceRender;

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ import MouseController from './mouseController';
import Painter from './painter';
import deviceState from '../jmap/constant/deviceState';
import deviceType from './constant/deviceType';
import {calculateDCenter, createBoundingRect, modelFactory} from './utils/parser';
import {calculateDCenter, createBoundingRect, deviceFactory} from './utils/parser';
import { updateIbpData } from './utils/parser';
const renderer = 'canvas';
@ -36,9 +36,11 @@ class IbpPan {
initIbpPage(opts) {
const width = opts.config.width;
const height = opts.config.height;
this.isAllowDragging=false;
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.$mouseController = new MouseController(this);
this.$mouseController.enable();
this.$painter = new Painter(this);
@ -99,6 +101,11 @@ class IbpPan {
setDefaultState() {
const list = [];
Object.values(this.mapDevice).forEach(elem => {
const type = elem.model._type;
list.push(deviceFactory(type, Object.assign(elem.model, this.defaultStateDict[type]) ));
});
this.update(list);
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
}
@ -135,8 +142,8 @@ class IbpPan {
const code = elem.code;
const type = elem._type;
updateIbpData(elem);
const oDevice = this.ibpDevice[code] || {instance: null, event: null, model: modelFactory(type, elem)};
const nDevice = {instance: null, event: null, model: Object.assign(oDevice.model || {}, elem)};
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
this.$painter.delete(oDevice);
if (!elem._dispose) {
this.ibpDevice[code] = nDevice;
@ -190,6 +197,7 @@ class IbpPan {
(Object.keys(this.ibpDevice) || []).forEach(elem => {
this.$painter.drawIbp(this.ibpDevice[elem]);
});
this.$mouseController.setAllowDragging(true);
}
pullBack(payload) {

View File

@ -2,6 +2,7 @@ import deviceType from './constant/deviceType';
import Eventful from 'zrender/src/mixin/Eventful';
import * as eventTool from 'zrender/src/core/event';
import store from '@/store';
import Group from 'zrender/src/container/Group';
class EventModel {
constructor(e) {
@ -33,7 +34,10 @@ class MouseController extends Eventful {
super();
this.$ibp = ibp;
this.$zr = ibp.getZr();
this.isAllowDragging=ibp.isAllowDragging||false;
this.events = ibp.getEvents();
this._draggingTarget=null;
this._dragging = false;
this.initHandler(this.$zr);
}
@ -54,6 +58,9 @@ class MouseController extends Eventful {
zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this);
zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this);
zr.on('mousewheel', this.mousewheel, this);
};
@ -61,6 +68,11 @@ class MouseController extends Eventful {
zr.off('mousedown', this.mousedown);
zr.off('mousemove', this.mousemove);
zr.off('mouseup', this.mouseup);
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
zr.off('mousewheel', this.mousewheel);
};
@ -68,6 +80,11 @@ class MouseController extends Eventful {
zr.off('click', this.click);
zr.off('contextmenu', this.contextmenu);
zr.off('mousemove', this.moveEvent);
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
this.disable();
};
@ -75,17 +92,48 @@ class MouseController extends Eventful {
}
}
setAllowDragging(data) {
this.isAllowDragging=data;
}
mousedown(e) {
if (eventTool.notLeftMouse(e)) {
return;
}
//
const draggingTarget = e.target;
// draggingTarget.draggable
if (draggingTarget) {
if (e.target.parent.getName()=='background') {
this._draggingName='background';
} else if (this.isAllowDragging&&e.target.parent.getName()=='simple') {
this._draggingName='simple';
} else if (this.isAllowDragging&&e.target.parent.getName()=='group') {
this._draggingName='group';
this._offsetX=e.offsetX;
this._offsetY=e.offsetY;
// debugger;
// this._draggingTarget.parent.model.point
var x = e.offsetX;
var y = e.offsetY;
} else if (this.isAllowDragging&&e.target.parent.getName()=='group_child') {
this._draggingName='group_child';
this._offsetX=e.offsetX;
this._offsetY=e.offsetY;
}
this._draggingTarget = draggingTarget;
// draggingTarget.dragging = true;
this._x = e.offsetX;
this._y = e.offsetY;
this._dragging = true;
// this.dispatchToElement(param(draggingTarget, e), 'dragstart', e.event);
}
this._x = x;
this._y = y;
this._dragging = true;
// var x = e.offsetX;
// var y = e.offsetY;
// this._x = x;
// this._y = y;
// this._dragging = true;
}
mousemove(e) {
@ -105,14 +153,52 @@ class MouseController extends Eventful {
this._x = e.offsetX;
this._y = e.offsetY;
this._preventDefaultMouseMove && eventTool.stop(e.event);
if (this._dragging) {
if (this._draggingTarget&&this._draggingName=='background') {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
return true;
} else if (this.isAllowDragging&&this._draggingTarget&&this._draggingName=='simple') {
this._draggingTarget.drift(dx, dy, e);
return true;
} else if (this.isAllowDragging&&this._draggingTarget&&(this._draggingName=='group'||this._draggingName=='group_child')) {
// debugger;
if (this._draggingName=='group') {
// this._draggingTarget.parent.model.point.x+=dx;
// this._draggingTarget.parent.model.point.y+=dy;
// this._draggingTarget.parent.dirty();
this._draggingTarget.parent.drift(dx, dy, e);
return true;
} else {
this._draggingTarget.parent.parent.drift(dx, dy, e);
return true;
}
}
} else {
// debugger;
return true;
}
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
}
mouseup(e) {
if (!eventTool.notLeftMouse(e)) {
// debugger;
const draggingTarget = this._draggingTarget;
if (!eventTool.notLeftMouse(e)&&draggingTarget) {
if (this._draggingName=='simple') {
console.log();
} else if (this._draggingName=='group'||this._draggingName=='group_child') {
if (this._draggingName=='group') {
this._draggingTarget.parent.setModal(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this._draggingTarget.parent.dirty();
} else {
this._draggingTarget.parent.parent.parent.setModal(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this._draggingTarget.parent.parent.dirty();
}
}
this._dragging = false;
this._draggingTarget = null;
this._draggingName=='';
}
}

View File

@ -59,13 +59,17 @@ class Painter {
* @param {*} device
*/
add(device, draggable) {
device = Object.assign(device, { event: this.$ibp.$mouseController });
const instance = shapefactory(device, this.$ibp);
if (instance) {
device.instance = instance;
draggable?instance.setDraggable():'';
this.$transformHandle.transformView(instance);
this.ibpInstanceLevel[device.model._type].add(instance);
try {
device = Object.assign(device, { event: this.$ibp.$mouseController });
const instance = shapefactory(device, this.$ibp);
if (instance) {
device.instance = instance;
draggable?instance.setDraggable():'';
this.$transformHandle.transformView(instance);
this.ibpInstanceLevel[device.model._type].add(instance);
}
} catch (error) {
console.error(error);
}
}

View File

@ -10,9 +10,11 @@ export default class alarm extends Group {
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.zlevel;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
@ -20,6 +22,7 @@ export default class alarm extends Group {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
z: this.z,
draggable: false,
style: {
image: alarmpic,
@ -72,4 +75,7 @@ export default class alarm extends Group {
}
}
getName() {
return this.name;
}
}

View File

@ -13,6 +13,7 @@ export default class AppendageBox extends Group {
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
@ -62,4 +63,7 @@ export default class AppendageBox extends Group {
}
}
getName() {
return this.name;
}
}

View File

@ -12,6 +12,7 @@ class Arrow extends Group {
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
@ -78,7 +79,7 @@ class Arrow extends Group {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
@ -91,9 +92,12 @@ class Arrow extends Group {
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
this.dragging = false;
}
}
getName() {
return this.name;
}
}
export default Arrow;

View File

@ -1,7 +1,7 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import Rect from 'zrender/src/graphic/shape/Rect';
import ibpBg from '@/assets/ibp_images/ibp_bg.png';
import Pattern from 'zrender/src/graphic/Pattern';
export default class background extends Group {
constructor(device) {
@ -9,49 +9,49 @@ export default class background extends Group {
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = 1;
this.imageBgArray = [];
// this.model.width = 4100;
// this.model.height = 900;
this.name='background';
this.create();
this.createMouseEvent();
}
create() {
const widthNum = Math.ceil(parseInt(this.model.width)/2048);
const heightNum = Math.ceil(parseInt(this.model.height)/1024);
for (let i = 0; i<widthNum; i++) {
for (let j = 0; j<heightNum; j++) {
const imageBg = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
x: i*2048,
y: j*1024,
image: ibpBg,
width: 2048,
height: 1024
}
});
this.imageBgArray.push(imageBg);
}
}
this.tailorRect = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.height
}
});
this.tailorBgImage();
const image = new Image(25, 25);
image.src = ibpBg;
image.onload = (e) => {
const pattern = new Pattern(image, 'repeat');
this.imageBg = new Rect({
zlevel: this.zlevel,
z: this.z,
cursor: 'default',
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.height
},
style: {
fill: pattern
}
});
this.add(this.imageBg);
};
}
tailorBgImage() {
const _this = this;
this.imageBgArray.forEach( function(elem) {
elem.setClipPath(_this.tailorRect);
_this.add(elem);
});
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
if (e.which == 3) {
return;
}
this.imageBg.attr('cursor', 'pointer');
}
mouseup() {
this.imageBg.attr('cursor', 'default');
}
setDraggable() {
}
getName() {
return this.name;
}
}

View File

@ -30,16 +30,19 @@ export default class button extends Group {
this.event = device.event;
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
z: this.z,
draggable: false,
style: {
image: this.getImagePic(),
@ -141,5 +144,7 @@ export default class button extends Group {
const color = button.colors.get(`${this.model.color}_on`);
this.imageBg.setStyle({image: color[0]});
}
getName() {
return this.name;
}
}

View File

@ -12,7 +12,9 @@ export default class CircularLamp extends Group {
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
this.setStatus(this.model);
}
create() {
@ -48,7 +50,7 @@ export default class CircularLamp extends Group {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
@ -64,4 +66,14 @@ export default class CircularLamp extends Group {
this.dragging = false;
}
}
setStatus(model) {
if (model.switch === 'on') {
this.lamp.setStyle('fill', '#D8FCF2');
} else {
this.lamp.setStyle('fill', '#332C22');
}
}
getName() {
return this.name;
}
}

View File

@ -12,6 +12,7 @@ import clock8 from '@/assets/ibp_images/clock/clock_8.png';
import clock9 from '@/assets/ibp_images/clock/clock_9.png';
import clockBg from '@/assets/ibp_images/clock/clock_bg.png';
import clockColon from '@/assets/ibp_images/clock/clock_colon.png';
import store from '@/store';
export default class clock extends Group {
constructor(device) {
@ -25,7 +26,9 @@ export default class clock extends Group {
this.offsetY = 0;
this.dragging = false;
this.initTime = 0;
this.name='group';
this.create();
}
create() {
this.clockBg = new Image({
@ -247,5 +250,32 @@ export default class clock extends Group {
this.setNumPic(1, hours.charAt(0));
}
setDraggable() {
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
}
mousedown(e) {
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
}
getName() {
return this.name;
}
setModal(dx, dy) {
// debugger;
// this.parent.dirty();
//
// this.model.point.x+=dx;
// this.model.point.y+=dy;
// this.eachChild(function(child) {
// // // debugger;
// child.style.x+=dx;
// child.style.y+=dy;
// // child.dirty();
// }, this.parent);
}
}

View File

@ -9,6 +9,7 @@ export default class elevator extends Group {
super();
this.event = device.event;
this.model = device.model;
this.name='group';
this.create();
}
@ -16,11 +17,11 @@ export default class elevator extends Group {
const model = this.model;
this.grouper=new Group({
id: '111',
id: model.code,
// width: model.width,
// height: model.height,
position: [model.point.x, model.point.y],
draggable: false
position: [model.point.x, model.point.y]
// draggable: model.draggable || false
});
this.elevatorBack = new ElevatorBack({model: {
@ -80,6 +81,10 @@ export default class elevator extends Group {
}
}
getName() {
return this.name;
}
setStatus(model) {
if (model.direction=='none') {
this.elevatorArrowBottom.setStatus('off');
@ -94,36 +99,11 @@ export default class elevator extends Group {
}
setDraggable() {
this.grouper.attr('draggable', true);
this.createMouseEvent();
// this.grouper.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();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.draggroup =this.grouper;
this.deltPostion =[e.event.zrX-this.draggroup.position[0], e.event.zrY-this.draggroup.position[1]];
}
mousemove(e) {
if (this.draggroup !=null) {
var new_pos =[e.event.zrX, e.event.zrY];
this.draggroup.position=[new_pos[0]-this.deltPostion[0], new_pos[1]-this.deltPostion[1]];
this.draggroup.dirty();
}
}
mouseup(e) {
this.event.enable();
this.draggroup=null;
setModal(dx, dy) {
this.model.point.x+=dx;
this.model.point.y+=dy;
}
}

View File

@ -9,6 +9,7 @@ export default class elevatorArrow extends Group {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.name='group_child';
this.create();
}
@ -26,7 +27,6 @@ export default class elevatorArrow extends Group {
height: 60
}
});
// debugger;
this.add(this.imageBg);
this.getOrientate();
this.transformScale();
@ -89,26 +89,7 @@ export default class elevatorArrow extends Group {
this.imageBg.setStyle({image: imageBack});
}
// 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;
// }
getName() {
return this.name;
}
}

View File

@ -7,11 +7,11 @@ export default class elevatorBack extends Group {
super();
this.event = device.event;
this.model = device.model;
this.name='group_child';
this.create();
}
create() {
// debugger;
const model = this.model;
const tempString='M'+model.width/6+' '+model.height/8*6+' L'+model.width/6*4+
' 0 L'+model.width/6*5+' 0 A '+model.width/6+' '+model.width/6+' 0 0 1 '+
@ -31,4 +31,8 @@ export default class elevatorBack extends Group {
});
this.add(this.elevatorBack);
}
getName() {
return this.name;
}
}

View File

@ -12,6 +12,7 @@ export default class ibpLine extends Group {
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
create() {
@ -46,7 +47,7 @@ export default class ibpLine extends Group {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
@ -64,4 +65,7 @@ export default class ibpLine extends Group {
this.dragging = false;
}
}
getName() {
return this.name;
}
}

View File

@ -12,6 +12,7 @@ export default class ibpText extends Group {
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
create() {
@ -67,4 +68,7 @@ export default class ibpText extends Group {
this.dragging = false;
}
}
getName() {
return this.name;
}
}

View File

@ -12,6 +12,7 @@ export default class ibpTipBox extends Group {
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
create() {
@ -61,4 +62,7 @@ export default class ibpTipBox extends Group {
this.dragging = false;
}
}
getName() {
return this.name;
}
}

View File

@ -13,12 +13,14 @@ export default class key extends Group {
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
this.keyImage = new Image({
zlevel: this.zlevel,
z: model.z,
draggable: false,
@ -30,15 +32,15 @@ export default class key extends Group {
height: 932
}
});
this.add(this.imageBg);
this.add(this.keyImage);
this.transformScale();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/314, this.model.width/314];
this.imageBg.dirty();
this.keyImage.origin = [this.model.point.x, this.model.point.y];
this.keyImage.scale =[this.model.width/314, this.model.width/314];
this.keyImage.dirty();
}
getRotateColor() {
@ -55,18 +57,33 @@ export default class key extends Group {
return keyPic;
}
}
onclick() {
if (!this.keyImage.draggable) {
switch (this.model.status) {
case 'off': {
this.keyImage.setStyle({image: keyPicOn});
this.model.status='on';
break;
}
case 'on': {
this.keyImage.setStyle({image: keyPic});
this.model.status='off';
break;
}
}
}
}
setStatus(model) {
switch (model.status) {
case 'on': {
// 开放
this.imageBg.setStyle({image: keyPicOn});
this.keyImage.setStyle({image: keyPicOn});
this.model.status='on';
break;
}
case 'off': {
// 关闭
this.imageBg.setStyle({image: keyPic});
this.keyImage.setStyle({image: keyPic});
this.model.status='off';
break;
}
@ -74,7 +91,7 @@ export default class key extends Group {
}
setDraggable() {
this.imageBg.attr('draggable', true);
this.keyImage.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
@ -87,10 +104,11 @@ export default class key extends Group {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove(e) {
@ -98,7 +116,13 @@ export default class key extends Group {
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
getName() {
return this.name;
}
}

View File

@ -10,10 +10,12 @@ export default class rotateTip extends Group {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
@ -21,6 +23,7 @@ export default class rotateTip extends Group {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
z: this.z,
draggable: false,
style: {
image: this.getRotateColor(),
@ -88,4 +91,7 @@ export default class rotateTip extends Group {
this.dragging = false;
}
}
getName() {
return this.name;
}
}

View File

@ -13,6 +13,7 @@ export default class RotatingButton extends Group {
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
@ -61,4 +62,7 @@ export default class RotatingButton extends Group {
this.dragging = false;
}
}
getName() {
return this.name;
}
}

View File

@ -10,9 +10,11 @@ export default class alarm extends Group {
this.event = device.event;
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.name='simple';
this.create();
}
@ -20,6 +22,7 @@ export default class alarm extends Group {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
z: this.z,
draggable: false,
style: {
image: teleTerminalPic,
@ -72,4 +75,7 @@ export default class alarm extends Group {
this.dragging = false;
}
}
getName() {
return this.name;
}
}

View File

@ -32,6 +32,7 @@ class TransformHandle {
view.transform = this.transform;
view.decomposeTransform();
this.revisibleView(view);
view.transform = '';
}
}

View File

@ -29,324 +29,140 @@ export function calculateDCenter(viewRect, zrbound) {
return { dx: dx, dy: dy };
}
export function modelFactory(type, elem) {
return Object.assign(elem, { _type: type }, deviceRender[type]);
}
export function createModel(type, model, propConvert) {
const tempModel = modelFactory(type, model);
return { instance: null, event: null, model: propConvert ? propConvert.initPrivateProps(tempModel) : tempModel };
export function deviceFactory(type, elem) {
return Object.assign({instance: null, event: null, model: Object.assign(elem, deviceRender[type])});
}
export function parser(data) {
var ibpDevice = {};
const propConvert = null;
// var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null;
if (data) {
Object.assign(data.background);
ibpDevice[data.background.code] = createModel(deviceType.Background, data.background, propConvert);
ibpDevice[data.background.code] = deviceFactory(deviceType.Background, data.background);
store.dispatch('ibp/setIbpBgDevice', ibpDevice[data.background.code]);
zrUtil.each(data.textList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.IbpText, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.IbpText, elem);
}, this);
zrUtil.each(data.squareButtonList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.SquareButton, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.SquareButton, elem);
}, this);
zrUtil.each(data.circularLampList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.CircularLamp, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.CircularLamp, elem);
}, this);
zrUtil.each(data.alarmList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Alarm, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.Alarm, elem);
}, this);
zrUtil.each(data.arrowList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Arrow, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.Arrow, elem);
}, this);
zrUtil.each(data.rotatingButtonList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.RotatingButton, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.RotatingButton, elem);
}, this);
zrUtil.each(data.tipBoxList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.TipBox, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.TipBox, elem);
}, this);
zrUtil.each(data.ibpLineList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.IbpLine, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.IbpLine, elem);
}, this);
zrUtil.each(data.appendageBoxList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.AppendageBox, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.AppendageBox, elem);
}, this);
zrUtil.each(data.elevatorList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Elevator, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.Elevator, elem);
}, this);
zrUtil.each(data.keyList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Key, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.Key, elem);
}, this);
zrUtil.each(data.teleTerminalList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.TeleTerminal, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.TeleTerminal, elem);
}, this);
zrUtil.each(data.clockList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Clock, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.Clock, elem);
});
zrUtil.each(data.rotateTipList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.RotateTip, elem, propConvert);
ibpDevice[elem.code] = deviceFactory(deviceType.RotateTip, elem);
});
}
return ibpDevice;
}
function updateIbpListByDevice(ibp, name, device) {
var list = ibp[name];
if (list) {
const index = list.findIndex(elem => { return elem.code == device.code; });
if (index >= 0) {
list[index].dispose ? list.splice(index, 1) : list[index] = device;
} else {
list.push(device);
}
} else {
ibp[name] = [device];
}
return list;
}
export function updateIbpData(device) {
const ibpData = store.getters['ibp/ibp'];
switch (device._type) {
case deviceType.Background : {
case deviceType.Background :
ibpData.background = device;
break;
}
case deviceType.IbpText : {
if (ibpData.textList && ibpData.textList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.textList.length; i++) {
if (device.code === ibpData.textList[i].code) {
device.dispose ? ibpData.textList.splice(i, 1) :ibpData.textList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.textList.push(device);
}
} else {
ibpData.textList = [device];
}
case deviceType.IbpText :
updateIbpListByDevice(ibpData, 'textList', device);
break;
}
case deviceType.SquareButton : {
if (ibpData.squareButtonList && ibpData.squareButtonList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.squareButtonList.length; i++) {
if (device.code === ibpData.squareButtonList[i].code) {
device.dispose ? ibpData.squareButtonList.splice(i, 1):ibpData.squareButtonList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.squareButtonList.push(device);
}
} else {
ibpData.squareButtonList = [device];
}
case deviceType.SquareButton :
updateIbpListByDevice(ibpData, 'squareButtonList', device);
break;
}
case deviceType.Arrow : {
if (ibpData.arrowList && ibpData.arrowList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.arrowList.length; i++) {
if (device.code === ibpData.arrowList[i].code) {
device.dispose ? ibpData.arrowList.splice(i, 1):ibpData.arrowList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.arrowList.push(device);
}
} else {
ibpData.arrowList = [device];
}
case deviceType.Arrow :
updateIbpListByDevice(ibpData, 'arrowList', device);
break;
}
case deviceType.RotatingButton : {
if (ibpData.rotatingButtonList && ibpData.rotatingButtonList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.rotatingButtonList.length; i++) {
if (device.code === ibpData.rotatingButtonList[i].code) {
device.dispose ? ibpData.rotatingButtonList.splice(i, 1):ibpData.rotatingButtonList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.rotatingButtonList.push(device);
}
} else {
ibpData.rotatingButtonList = [device];
}
case deviceType.RotatingButton :
updateIbpListByDevice(ibpData, 'rotatingButtonList', device);
break;
}
case deviceType.TipBox : {
if (ibpData.tipBoxList && ibpData.tipBoxList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.tipBoxList.length; i++) {
if (device.code === ibpData.tipBoxList[i].code) {
device.dispose ? ibpData.tipBoxList.splice(i, 1):ibpData.tipBoxList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.tipBoxList.push(device);
}
} else {
ibpData.tipBoxList = [device];
}
case deviceType.TipBox :
updateIbpListByDevice(ibpData, 'tipBoxList', device);
break;
}
case deviceType.CircularLamp : {
if (ibpData.circularLampList && ibpData.circularLampList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.circularLampList.length; i++) {
if (device.code === ibpData.circularLampList[i].code) {
device.dispose ? ibpData.circularLampList.splice(i, 1):ibpData.circularLampList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.circularLampList.push(device);
}
} else {
ibpData.circularLampList = [device];
}
case deviceType.CircularLamp :
updateIbpListByDevice(ibpData, 'circularLampList', device);
break;
}
case deviceType.IbpLine : {
if (ibpData.ibpLineList && ibpData.ibpLineList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.ibpLineList.length; i++) {
if (device.code === ibpData.ibpLineList[i].code) {
device.dispose ? ibpData.ibpLineList.splice(i, 1):ibpData.ibpLineList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.ibpLineList.push(device);
}
} else {
ibpData.ibpLineList = [device];
}
case deviceType.IbpLine :
updateIbpListByDevice(ibpData, 'ibpLineList', device);
break;
}
case deviceType.AppendageBox : {
if (ibpData.appendageBoxList && ibpData.appendageBoxList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.appendageBoxList.length; i++) {
if (device.code === ibpData.appendageBoxList[i].code) {
device.dispose ? ibpData.appendageBoxList.splice(i, 1):ibpData.appendageBoxList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.appendageBoxList.push(device);
}
} else {
ibpData.appendageBoxList = [device];
}
case deviceType.AppendageBox :
updateIbpListByDevice(ibpData, 'appendageBoxList', device);
break;
}
case deviceType.Alarm : {
if (ibpData.alarmList && ibpData.alarmList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.alarmList.length; i++) {
if (device.code === ibpData.alarmList[i].code) {
device.dispose ? ibpData.alarmList.splice(i, 1):ibpData.alarmList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.alarmList.push(device);
}
} else {
ibpData.alarmList = [device];
}
case deviceType.Alarm :
updateIbpListByDevice(ibpData, 'alarmList', device);
break;
}
case deviceType.Elevator : {
if (ibpData.elevatorList && ibpData.elevatorList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.elevatorList.length; i++) {
if (device.code === ibpData.elevatorList[i].code) {
device.dispose ? ibpData.elevatorList.splice(i, 1):ibpData.elevatorList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.elevatorList.push(device);
}
} else {
ibpData.elevatorList = [device];
}
case deviceType.Elevator :
updateIbpListByDevice(ibpData, 'elevatorList', device);
break;
}
case deviceType.Key : {
if (ibpData.keyList && ibpData.keyList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.keyList.length; i++) {
if (device.code === ibpData.keyList[i].code) {
device.dispose ? ibpData.keyList.splice(i, 1):ibpData.keyList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.keyList.push(device);
}
} else {
ibpData.keyList = [device];
}
case deviceType.Key :
updateIbpListByDevice(ibpData, 'keyList', device);
break;
}
case deviceType.TeleTerminal : {
if (ibpData.teleTerminalList && ibpData.teleTerminalList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.teleTerminalList.length; i++) {
if (device.code === ibpData.teleTerminalList[i].code) {
device.dispose ? ibpData.teleTerminalList.splice(i, 1):ibpData.teleTerminalList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.teleTerminalList.push(device);
}
} else {
ibpData.teleTerminalList = [device];
}
case deviceType.TeleTerminal :
updateIbpListByDevice(ibpData, 'teleTerminalList', device);
break;
case deviceType.Clock :
updateIbpListByDevice(ibpData, 'clockList', device);
break;
case deviceType.RotateTip:
updateIbpListByDevice(ibpData, 'rotateTipList', device);
break;
}
case deviceType.Clock : {
if (ibpData.clockList && ibpData.clockList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.clockList.length; i++) {
if (device.code === ibpData.clockList[i].code) {
device.dispose ? ibpData.clockList.splice(i, 1):ibpData.clockList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.clockList.push(device);
}
} else {
ibpData.clockList = [device];
}
}
case deviceType.RotateTip: {
if (ibpData.rotateTipList && ibpData.rotateTipList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.rotateTipList.length; i++) {
if (device.code === ibpData.rotateTipList[i].code) {
device.dispose ? ibpData.rotateTipList.splice(i, 1): ibpData.rotateTipList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.rotateTipList.push(device);
}
} else {
ibpData.rotateTipList = [device];
}
}
}
store.dispatch('ibp/setIbpData', ibpData);
}

View File

@ -4,107 +4,125 @@ const deviceRender = {};
/** link渲染配置*/
deviceRender[deviceType.Link] = {
_type: deviceType.Link,
zlevel: 1
// progressive: 1
};
/** Section渲染配置*/
deviceRender[deviceType.Section] = {
_type: deviceType.Section,
zlevel: 1
// progressive: 2
};
/** Signal渲染配置*/
deviceRender[deviceType.Signal] = {
_type: deviceType.Signal,
zlevel: 1
// progressive: 3
};
/** Switch渲染配置*/
deviceRender[deviceType.Switch] = {
_type: deviceType.Switch,
zlevel: 1
// progressive: 5
};
/** Station渲染配置*/
deviceRender[deviceType.Station] = {
_type: deviceType.Station,
zlevel: 1
// progressive: 4
};
/** StationStand渲染配置*/
deviceRender[deviceType.StationStand] = {
_type: deviceType.StationStand,
zlevel: 1
// progressive: 5
};
/** StationControl渲染配置*/
deviceRender[deviceType.StationControl] = {
_type: deviceType.StationControl,
zlevel: 1
// progressive: 4
};
/** ImageControl渲染配置*/
deviceRender[deviceType.ImageControl] = {
_type: deviceType.ImageControl,
zlevel: 1
// progressive: 5
};
/** ZcControl渲染配置*/
deviceRender[deviceType.ZcControl] = {
_type: deviceType.ZcControl,
zlevel: 1
// progressive: 6
};
/** LcControl渲染配置*/
deviceRender[deviceType.LcControl] = {
_type: deviceType.LcControl,
zlevel: 1
// progressive: 6
};
/** LimitControl渲染配置*/
deviceRender[deviceType.LimitControl] = {
_type: deviceType.LimitControl,
zlevel: 1
// progressive: 5
};
/** StationDelayUnlock渲染配置*/
deviceRender[deviceType.StationDelayUnlock] = {
_type: deviceType.StationDelayUnlock,
zlevel: 1
// progressive: 6
};
/** Train渲染配置*/
deviceRender[deviceType.Train] = {
_type: deviceType.Train,
zlevel: 1
// progressive: 9
};
/** TrainWindow渲染配置*/
deviceRender[deviceType.TrainWindow] = {
_type: deviceType.TrainWindow,
zlevel: 1
// progressive: 8
};
/** Line渲染配置*/
deviceRender[deviceType.Line] = {
_type: deviceType.Line,
zlevel: 1
// progressive: 7
};
/** Text渲染配置*/
deviceRender[deviceType.Text] = {
_type: deviceType.Text,
zlevel: 1
// progressive: 7
};
/** TrainWindow渲染配置*/
deviceRender[deviceType.TrainWindow] = {
_type: deviceType.TrainWindow,
zlevel: 1
// progressive: 4
};
/** Train渲染配置*/
deviceRender[deviceType.TRain] = {
_type: deviceType.TRain,
zlevel: 1
// progressive: 4
};

View File

@ -24,7 +24,7 @@ class Jlmap {
this.skinCode = '';
// 皮肤风格
this.style = this.loadStyle();
this.style = {};
// 设备数据
this.mapDevice = {};
@ -80,11 +80,12 @@ class Jlmap {
this.$options.scaleRate = map.skinVO.scaling || 1;
this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0;
this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0;
// 更新视图大小
this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });
}
// 解析地图数据
// 更新视图大小
this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });
// 解析后的数据
this.mapDevice = mapDevice;
// 加载对应皮肤

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusBar {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusDownTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusUpTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusDownTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusUpTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusBar {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusDownTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusUpTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusBar {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusDownTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusUpTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusDownTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -20,7 +20,7 @@
</script>
<style>
#statusUpTrainDetail {
z-index: 2000;
z-index: 1000;
position: absolute;
height: $height;
line-height: $height;

View File

@ -33,7 +33,6 @@ class TransformHandle {
view.decomposeTransform();
this.revisibleView(view);
}
// return view;
}
// 处理所有视图缩放/平移

View File

@ -30,7 +30,7 @@ export function calculateDCenter(viewRect, zrbound) {
}
export function deviceFactory(type, elem) {
return Object.assign({ _type: type }, deviceRender[type], elem);
return {...deviceRender[type], ...elem};
}
export function createDevice(type, model, propConvert) {

View File

@ -84,7 +84,7 @@ import RunPlanEveryDay from '@/views/publish/runPlanEveryDay/index';
import ProductStatus from '@/views/publish/productStatus/index';
import PublishLesson from '@/views/publish/publishLesson/index';
// import SimulationScript from '@/views/publish/simulationScript/index';
import IbpDraft from '@/views/ibp/ibpDraft/index';
// import IbpDraft from '@/views/ibp/ibpDraft/index';
import IbpEdit from '@/views/ibp/ibpDraft/ibpEdit/index';
import Commodity from '@/views/orderauthor/commodity/index';
@ -109,6 +109,8 @@ import UserExam from '@/views/management/userExam/index';
import UserSimulation from '@/views/management/userSimulation/index';
import ExistingSimulation from '@/views/management/existingSimulation/index';
import CacheControl from '@/views/management/cacheControl/index';
/**
* Note: sub-menu only appear when route children.length >= 1
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
@ -960,6 +962,13 @@ export const asyncRouter = [
i18n: 'router.userManage'
}
},
{
path: 'cache',
component: CacheControl,
meta: {
i18n: 'router.cacheManage'
}
},
{
path: 'userTrainingManage',
component: UserTraining,

View File

@ -12,7 +12,8 @@ const ibp = {
ibpList: {}, // 数据列表
ibpIdList: {}, // 数据列表(以id为标识)
updateDeviceData: {}, // 修改的数据
rightClickCount: 0 // 右键点击设备
rightClickCount: 0, // 右键点击设备
ibpBgDevice: {} // ibp背景设备
},
getters: {
@ -31,6 +32,9 @@ const ibp = {
},
updateDeviceData: (state) => {
return state.updateDeviceData;
},
ibpBgDevice: (state) => {
return state.ibpBgDevice;
}
},
@ -47,6 +51,9 @@ const ibp = {
},
deleteIbpDevices: (state, devices) => {
Vue.prototype.$ibp && Vue.prototype.$ibp.render(devices);
},
setIbpBgDevice: (state, ibpBgDevice) => {
state.ibpBgDevice = ibpBgDevice;
}
},
@ -72,6 +79,9 @@ const ibp = {
models = [models];
}
commit('deleteIbpDevices', models);
},
setIbpBgDevice: ( { commit }, device) => {
commit('setIbpBgDevice', device);
}
}
};

View File

@ -158,7 +158,7 @@ export const hexColor = {
/** 保证本次的颜色和上次的不一致*/
for (let i = 0; i < this.newColor.length && i < this.oldColor.length; i++) {
if (i === 0 && Math.abs(this.newColor[i].toFixed(2) - this.oldColor[i].toFixed(2)) < this.difValue) {
this.toCreate();
this.colorRandom();
break;
}
}

View File

@ -80,8 +80,8 @@ StompClient.prototype = {
this.status = false;
this.count++;
this.reconnect(this.count);
}).catch(() => {
this.logOut();
}).catch((err) => {
this.logOut(err);
});
};
}
@ -103,30 +103,27 @@ StompClient.prototype = {
this.reconnect(this.count);
}
}).catch((err) => {
if (err.code == 40003 || err.code == 40004 || err.code == 40005 || err.code == 50012) {
this.logOut();
}
if (err.code == 50008 || err.code == 50014) {
this.url = websocketUrl + handleToken();
this.status = false;
this.count++;
this.reconnect(this.count);
}
this.logOut(err);
});
}
}, 30000);
}
resolve(this);
}, () => {
// console.log('向服务器发起websocket连接', 222222);
if (this.checkTimer) {
clearInterval(this.checkTimer);
this.checkTimer = null;
}
checkLoginLine().then(() => {
this.connect();
}).catch(() => {
this.logOut();
}).catch((err) => {
if (err.code == 40003 || err.code == 40004 || err.code == 40005 || err.code == 50012) {
this.logOut();
}
if (err.code == 50008 || err.code == 50014) {
this.url = websocketUrl + handleToken();
this.connect();
}
});
});
} catch (err) {
@ -135,16 +132,24 @@ StompClient.prototype = {
});
},
logOut() {
MessageBox.confirm('你已被登出,请重新登录', '确定登出', {
confirmButtonText: '重新登录',
showCancelButton: false,
type: 'warning'
}).then(() => {
store.dispatch('FedLogOut', gainClientId()).then(() => {
location.reload();// 为了重新实例化vue-router对象 避免bug
logOut(err) {
if (err.code == 40003 || err.code == 40004 || err.code == 40005 || err.code == 50012) {
MessageBox.confirm('你已被登出,请重新登录', '确定登出', {
confirmButtonText: '重新登录',
showCancelButton: false,
type: 'warning'
}).then(() => {
store.dispatch('FedLogOut', gainClientId()).then(() => {
location.reload();// 为了重新实例化vue-router对象 避免bug
});
});
});
}
if (err.code == 50008 || err.code == 50014) {
this.url = websocketUrl + handleToken();
this.status = false;
this.count++;
this.reconnect(this.count);
}
},
// 恢复链接
reconnect(count) {

View File

@ -2,11 +2,12 @@
<div>
<el-table
:size="size"
:stripe="stripe"
:stripe="rowStyle? null: stripe"
:border="border"
:data="tableData"
:max-height="maxHeight"
:height="height"
:row-style="rowStyle"
>
<el-table-column v-if="tableForm.index" fixed type="index" />
<template v-for="(column, index) in tableForm.columns">
@ -126,6 +127,12 @@ export default {
tableForm: {
type: Object,
required: true
},
rowStyle: {
type: Function,
default() {
return null;
}
}
},
data() {
@ -171,3 +178,12 @@ export default {
}
}
</style>
<style>
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: #f0f9eb;
}
</style>

View File

@ -122,6 +122,10 @@ export default {
min: 0,
max: 0
},
// graphic: {
// type: 'line',
// progressive: true
// },
series: [],
dataZoom: [
{

View File

@ -55,7 +55,7 @@
</el-card>
<div class="scheduling_body">
<div class="scheduling_body-table">
<edit-table ref="table" border stripe :table-data="tableData" :table-form="tableForm" />
<edit-table ref="table" v-loading="loading" border stripe :table-data="tableData" :table-form="tableForm" :row-style="handleRowStyle" />
</div>
</div>
</div>
@ -65,6 +65,7 @@
<script>
import { querySecheduling, generateScheduling, getSchedulingAllTrains, checkScheduling, saveScheduling, generateSchedulingAgain } from '@/api/scheduling';
import { hexColor } from '@/utils/runPlan';
import EditTable from '@/views/components/editTable/index';
export default {
@ -81,6 +82,7 @@ export default {
data() {
return {
show: false,
loading: false,
runPlanList: [],
groupNumberList: [],
formModel: {
@ -221,6 +223,7 @@ export default {
},
handleQuery(day) {
if (day) {
this.loading = true;
querySecheduling(this.group, {day}).then(resp => {
if (!resp.data) {
this.$confirm('无派班计划,是否创建?', this.$t('global.tips'), {
@ -231,13 +234,15 @@ export default {
this.handleGenerate(day);
}).catch(() => {
this.clearData();
this.loading = false;
});
} else {
this.tableData = resp.data.planList || [];
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(`加载数据 ${day} 派班计划成功!`);
this.loading = false;
}
}).catch(error => {
this.clearData();
@ -245,40 +250,51 @@ export default {
this.handleReGenerate(day);
} else {
this.$messageBox(`${error.message}`);
this.loading = false;
}
});
}
},
handleGenerate(day) {
generateScheduling(this.group, {day}).then(resp => {
this.tableData = resp.data.planList || [];
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success('创建派班计划成功');
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleReGenerate(day) {
generateSchedulingAgain(this.group).then(resp => {
this.tableData = resp.data.planList || [];
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success('重新生成派班计划成功');
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleCheck() {
if (this.formModel.planDate) {
checkScheduling(this.group).then(resp => {
this.$message.success('检查成功');
}).catch(() => {
this.$messageBox('检查派班计划失败');
checkScheduling(this.group, this.tableData).then(resp => {
const data = resp.data;
this.setConflictList(data.conflictList);
if (data.pass) {
this.$message.success('检查通过');
} else {
this.$message.warning('检查不通过');
}
}).catch(error => {
this.$messageBox(`检查派班计划失败: ${error.message}`);
});
} else {
this.$messageBox('清先选择派班计划');
@ -296,6 +312,31 @@ export default {
}
},
handleRowStyle({rowIndex}) {
const row = this.tableData[rowIndex];
return row['$conflict']? `background: ${row['$conflict']}`: `background: #fff`;
},
setConflictList(list) {
this.tableData.forEach(elem => { elem['$conflict'] = null; });
if (list && list.length) {
list.forEach(idList => {
const color = hexColor.colorRandom();
this.tableData.forEach(elem => {
if (idList.includes(parseInt(elem.id))) {
elem['$conflict'] = color;
}
});
});
}
this.tableData = [...this.tableData];
},
initTableData(tableData) {
tableData.forEach(elem => {
elem['$conflict'] = null;
});
return tableData;
},
clearData() {
this.formModel.planDate = '';
this.tableData = [];

View File

@ -470,21 +470,25 @@ export default {
},
//
async selectQuest(row, id) {
const res = await loadScript(row.id, id, this.group);
if (res && res.code == 200) {
this.questId = parseInt(row.id);
if (res.data && res.data.mapLocation) {
const mapLocation={'offsetX': res.data.mapLocation.x, 'offsetY': res.data.mapLocation.y, 'scaleRate': res.data.mapLocation.scale};
Vue.prototype.$jlmap.setOptions(mapLocation);
try {
const res = await loadScript(row.id, id, this.group);
if (res && res.code == 200) {
this.questId = parseInt(row.id);
if (res.data && res.data.mapLocation) {
const mapLocation={'offsetX': res.data.mapLocation.x, 'offsetY': res.data.mapLocation.y, 'scaleRate': res.data.mapLocation.scale};
Vue.prototype.$jlmap.setOptions(mapLocation);
}
}
}
if (this.$refs.menuDemon) {
this.$refs.menuDemon.initLoadPage();
}
if (this.$refs.menuDemon) {
this.$refs.menuDemon.initLoadPage();
}
if (this.$refs.menuScript) {
this.$refs.menuScript.initLoadPage();
if (this.$refs.menuScript) {
this.$refs.menuScript.initLoadPage();
}
} catch (error) {
this.$messageBox(error.message);
}
},
// 退

View File

@ -7,7 +7,7 @@
</div>
<div class="display-draft">
<el-button-group>
<el-button v-if="isShowScheduling" type="primary" @click="jumpScheduling">班计划</el-button>
<el-button v-if="isShowScheduling" type="primary" @click="jumpScheduling">班计划</el-button>
<el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
<template v-if="isShowQuest">
<el-button type="danger" @click="handleQuitQuest">退出剧本</el-button>

View File

@ -13,16 +13,16 @@
<el-input v-model="form.fillColor"></el-input>
</el-form-item>
<el-form-item label="起始X轴坐标">
<el-input-number v-model="form.x1" controls-position="right" :min="1"></el-input-number>
<el-input-number v-model="form.x1" controls-position="right" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="起始Y轴坐标">
<el-input-number v-model="form.y1" controls-position="right" :min="1"></el-input-number>
<el-input-number v-model="form.y1" controls-position="right" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="终止X轴坐标">
<el-input-number v-model="form.x2" controls-position="right" :min="1"></el-input-number>
<el-input-number v-model="form.x2" controls-position="right" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="终止Y轴坐标">
<el-input-number v-model="form.y2" controls-position="right" :min="1"></el-input-number>
<el-input-number v-model="form.y2" controls-position="right" :min="0"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>

View File

@ -13,7 +13,7 @@
<el-input v-model="form.textFill"></el-input>
</el-form-item>
<el-form-item label="文字大小" prop="fontSize">
<el-input-number v-model="form.fontSize" controls-position="right" :min="1" :max="50"></el-input-number>
<el-input-number v-model="form.fontSize" controls-position="right" :min="1" :max="100"></el-input-number>
</el-form-item>
<el-form-item label="文字粗细" prop="fontWeight">
<el-input-number v-model="form.fontWeight" controls-position="right" :min="1" ></el-input-number>

View File

@ -110,7 +110,8 @@
<script>
import { checkLoginLine } from '@/api/login';
import { EventBus } from '@/scripts/event-bus';
import {modelFactory} from '@/ibp/utils/parser'
import {deviceFactory} from '@/ibp/utils/parser';
import deviceType from '@/ibp/constant/deviceType';
import IbpText from './ibpText';
import IbpTipBox from './ibpTipBox';
import IbpButton from './ibpButton';
@ -169,8 +170,13 @@
},
methods: {
createDataModel(model) {
const newModel = modelFactory(model.type, model);
this.$store.dispatch('ibp/updateIbpDevices', newModel);
if(model._type === deviceType.Background) {
const bgDevice = this.$store.getters['ibp/ibpBgDevice'];
model.code = bgDevice.model.code;
}
const newModel = deviceFactory(model._type, model);
this.$store.dispatch('ibp/updateIbpDevices', newModel.model);
},
deleteDataModel(model) {
this.$store.dispatch('ibp/deleteIbpDevices', model);

View File

@ -14,6 +14,14 @@ import { mapGetters } from 'vuex';
export default {
name: 'Ibp',
props: {
size: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
width: this.$store.state.config.width,
@ -31,19 +39,10 @@ export default {
}
},
showBackButton: true,
initZrender: false,
initTime: '',
started: false
started: false
};
},
props: {
size: {
type: Object,
default() {
return null;
}
}
},
computed: {
...mapGetters([
'canvasWidth',
@ -55,14 +54,10 @@ export default {
},
watch: {
'$store.state.config.canvasSizeCount': function (val) {
if (this.initZrender) {
this.resetSize();
}
this.reSize();
},
'$store.state.app.windowSizeCount': function() {
const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height});
this.setWindowSize();
},
'$store.state.training.initTime': function (initTime) {
this.initTime = initTime;
@ -70,12 +65,12 @@ export default {
this.initClockTime(initTime);
}
},
'$store.state.training.started': function (started) {
this.started = started;
if (this.$ibp){
this.setClockStart(started);
}
}
'$store.state.training.started': function (started) {
this.started = started;
if (this.$ibp) {
this.setClockStart(started);
}
}
},
mounted() {
this.setWindowSize();
@ -86,7 +81,7 @@ export default {
}
},
methods: {
show: function () {
show () {
document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false;
};
@ -116,30 +111,10 @@ export default {
window.document.oncontextmenu = function () {
return false;
};
this.initZrender = true;
},
setMap(data) {
this.$ibp.setMap(ibpData, data);
},
resetSize() {
this.$nextTick(() => {
this.width = this.$store.state.config.width;
this.height = this.$store.state.config.height;
this.$ibp && this.$ibp.resize({ width: this.width, height: this.height });
});
},
setWindowSize() {
this.$nextTick(() => {
const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height });
});
},
back() {
this.$emit('hideIbp');
},
//
onSelected(em) {
this.$emit('onSelect', em);
@ -157,10 +132,28 @@ export default {
initClockTime(initTime) {
this.$ibp.initClockTime(initTime);
},
//
setClockStart(started) {
this.$ibp.setClockStart(started);
}
//
setClockStart(started) {
this.$ibp.setClockStart(started);
},
reSize() {
this.$nextTick(() => {
this.width = this.$store.state.config.width;
this.height = this.$store.state.config.height;
this.$ibp && this.$ibp.resize({ width: this.width, height: this.height });
});
},
setWindowSize() {
this.$nextTick(() => {
const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height });
});
},
back() {
this.$emit('hideIbp');
}
}
};
</script>
@ -172,8 +165,5 @@ export default {
bottom: 15px;
}
.ibp-canvas{
/*background-image: url('../../assets/ibp_images/ibp_bg.png');*/
/*background-repeat:repeat;*/
/*background-size: 4096px 2048px;*/
}
</style>

View File

@ -285,8 +285,6 @@ export default {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
console.log(this.skinCode);
if (this.skinCode) {
// 01 02 ''
const resp = await this.getUserRole();

View File

@ -2,7 +2,7 @@
<div>
<div class="display-draft">
<el-button-group>
<el-button v-if="isIBP" @click="jumpIbp">IBP盘</el-button>
<el-button v-if="isIBP" type="warning" @click="jumpIbp">IBP盘</el-button>
<el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button>
<template v-if="isAdmin">
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">按计划行车</el-button>

View File

@ -0,0 +1,83 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import { getCacheList, delCacheList } from '@/api/management/user';
export default {
name: 'CacheControl',
components: {
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
key: {
type: 'text',
label: 'key'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: 'key',
prop: 'key'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: '删除',
handleClick: this.handledelete,
type: 'danger'
}
]
}
]
},
currentModel: {}
};
},
created() {
},
methods: {
//
handledelete(index, row) {
this.$confirm('此操作将删除该列表, 是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
delCacheList(row.key).then(response => {
this.$message.success('删除成功');
this.reloadTable();
}).catch(() => {
this.$messageBox('删除失败');
});
});
},
queryFunction(params) {
return getCacheList(params);
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="'订阅地图'" :visible.sync="dialogVisible" width="30%" :before-close="doClose" center>
<el-dialog :title="'订阅地图'" :visible.sync="dialogVisible" width="30%" :before-close="doClose" center :close-on-click-modal="false">
<el-form ref="form" v-model="formModel" label-width="120px">
<el-form-item label="订阅地图列表:" prop="mapIdList">
<el-select v-model="formModel.mapIdList" clearable multiple placeholder="请输入关键词" style="width: 80%">

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="$t('system.editUserPermission')" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="$t('system.editUserPermission')" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave"> </el-button>

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisibles" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisibles" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: '280px', width:'100%' }">
<el-tree
ref="tree"

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>

View File

@ -15,9 +15,6 @@
<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
@ -169,7 +166,6 @@ export default {
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'},

View File

@ -93,44 +93,11 @@ export default {
activeName: 'first',
SignalLeftOrRightList: [],
SignalPotLampTypeList: [],
/*
{ code: '01', name: '物理点灯' },
{ code: '02', name: '逻辑电灯' }
*/
SignalLampPostTypeList: [],
/*
{ code: '01', name: '矮柱' },
{ code: '02', name: '高柱' }
*/
SignalLampPositionTypeList: [],
/*
{ code: '01', name: '单灯' },
{ code: '02', name: '双灯' },
{ code: '03', name: '三灯' },
{ code: '04', name: '四灯' },
{ code: '05', name: '五灯' }
*/
SignalDirectionTypeList: [],
/*
{ code: '01', name: '向左行使' },
{ code: '02', name: '向右行驶' }
*/
SignalPositionTypeList: [],
/*
{ code: '01', name: '区段上边' },
{ code: '02', name: '区段下边' }
*/
SignalUseTypeList: [],
/*
{ code: '01', name: '进站信号机' },
{ code: '02', name: '出站信号机' },
{ code: '03', name: '通过信号机' },
{ code: '04', name: '防护信号机' },
{ code: '05', name: '调车信号机' },
{ code: '06', name: '阻挡信号机' },
{ code: '07', name: '预告信号机' },
{ code: '08', name: '复位信号机' }
*/
failTypes: [
{ code: '00', name: this.$t('map.normal') },
{ code: '01', name: this.$t('map.signalFilamentAlarm') }
@ -145,10 +112,7 @@ export default {
potLampType: '01',
directionType: '',
positionType: '',
namePosition: {
x: 0,
y: 0
},
namePosition: { x: 0, y: 0 },
useType: '',
stationCode: '',
linkCode: '',
@ -156,18 +120,9 @@ export default {
rotate: 0,
guideShow: false,
buttonShow: false,
position: {
x: 0,
y: 0
},
buttonPosition: {
x: 0,
y: 0
},
guidePosition: {
x: 0,
y: 0
}
position: { x: 0, y: 0 },
buttonPosition: { x: 0, y: 0 },
guidePosition: { x: 0, y: 0 }
},
addModel: {
sectionCode: '',
@ -207,7 +162,7 @@ export default {
return list;
},
form() {
const form = {
return {
labelWidth: '150px',
items: {
code: {
@ -258,10 +213,9 @@ export default {
}
}
};
return form;
},
rules() {
const rules = {
return {
code: [
{ required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
],
@ -293,7 +247,6 @@ export default {
{ required: true, message: this.$t('rules.signalGuidePositionY'), trigger: 'blur' }
]
};
return rules;
}
},
watch: {

View File

@ -158,16 +158,8 @@ export default {
this.$messageBox(this.$t('map.failedLoadListPublishedMaps'));
});
},
isNormal() {
return this.activeTab === 'first';
},
isThird() {
return this.activeTab === 'third';
},
create() {
if (this.isThird()) {
this.close();
} else if (this.isNormal()) {
if (this.activeTab === 'first') {
this.$refs['newForm'].validate((valid) => {
if (valid) {
this.loading = true;

View File

@ -1,9 +1,9 @@
<template>
<el-dialog :title="this.$t('map.operationGraphPublished')" :visible.sync="dialogShow" width="30%" :before-close="handleClose">
<div>
<el-form ref="form" label-position="right" :model="editModel" label-width="120px" size="mini">
<el-form ref="form" label-position="right" :model="editModel" label-width="120px" size="mini" :rules="rules">
<el-form-item :label="this.$t('map.operationGraphName')" prop="name">
<el-input v-model="editModel.name" :disabled="true" />
<el-input v-model="editModel.name" />
</el-form-item>
</el-form>
</div>
@ -34,6 +34,11 @@ export default {
editModel: {
planId: '',
name: ''
},
rules: {
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
}
};
},

View File

@ -1,5 +1,5 @@
<template>
<el-dialog title="打包详情" :visible.sync="dialogShow" width="50%" :before-close="close">
<el-dialog title="打包详情" :visible.sync="dialogShow" width="700px" :before-close="close">
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
@ -47,15 +47,15 @@ export default {
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: '创建时间',
prop: 'createTime'
},
{
title: '创建者',
prop: 'creatorUserName'
}
// {
// title: '',
// prop: 'createTime'
// },
// {
// title: '',
// prop: 'creatorUserName'
// }
],
actions: [
]

View File

@ -6,6 +6,7 @@
width="90%"
:before-close="doClose"
:close-on-click-modal="false"
:z-index="3000"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
@ -158,8 +159,6 @@ export default {
resp.data.list.forEach(item => {
if (item.id == elem.id) {
item.isPut = true;
} else {
item.isPut = false;
}
});
});

View File

@ -1,53 +1,103 @@
<template>
<el-dialog title="修改权限内容" :visible.sync="dialogShow" width="30%" :before-close="handleClose">
<div>
<el-form
ref="form"
label-position="right"
:model="editModel"
label-width="100px"
:rules="editRules"
size="mini"
@submit.native.prevent
>
<el-form-item :label="$t('map.mapName')" prop="name">
<el-input v-model="editModel.name" />
</el-form-item>
<el-form-item label="描述" prop="remarks">
<el-input
v-model="editModel.remarks"
type="textarea"
:rows="2"
placeholder="请输入内容"
maxlength="60"
show-word-limit
/>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
</span>
</el-dialog>
<div>
<el-dialog title="修改权限内容" :visible.sync="dialogShow" width="30%" :before-close="handleClose" :z-index="2000">
<div>
<el-form
ref="form"
label-position="right"
:model="editModel"
label-width="100px"
:rules="editRules"
size="mini"
@submit.native.prevent
>
<el-form-item :label="$t('map.mapName')" prop="name">
<el-input v-model="editModel.name" />
</el-form-item>
<el-form-item label="描述" prop="remarks">
<el-input
v-model="editModel.remarks"
type="textarea"
:rows="2"
placeholder="请输入内容"
maxlength="60"
show-word-limit
/>
</el-form-item>
</el-form>
<div v-show="isPackage">
<div class="form_title">地图名称:</div>
<el-select v-model="editModel.mapId" size="mini" :disabled="ruleList.length ? true : false">
<el-option
v-for="item in mapList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button class="addList" size="small" @click="dialogSelect">添加权限</el-button>
<el-table
:data="ruleList"
border
style="width: 100%"
:height="200"
>
<el-table-column prop="name" label="权限名称" />
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
<template slot-scope="scope">
{{ computedName(PermissionTypeList, scope.row.type) }}
</template>
</el-table-column>
<el-table-column :label="this.$t('global.operate')" width="80">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
</span>
</el-dialog>
<choose-permission
ref="choosePermission"
:rule-list="ruleList"
:effective-type-list="EffectiveTypeList"
:permission-type-list="PermissionTypeList"
@addRuleForm="addRuleForm"
@deleteForm="deleteForm"
/>
</div>
</template>
<script>
import { putPermissonDetail } from '@/api/management/author';
import { putPermissonDetail, getPermissionList } from '@/api/management/author';
import { listPublishMap } from '@/api/jmap/map';
import { EventBus } from '@/scripts/event-bus';
import ChoosePermission from './choosePermission';
export default {
name: 'MapSaveAs',
props: {
components: {
ChoosePermission
},
data() {
return {
dialogShow: false,
loading: false,
isPackage: false,
mapList: [],
ruleList: [],
PermissionTypeList: [],
EffectiveTypeList: [],
editModel: {
id: '',
name: '',
remarks: ''
remarks: '',
mapId: ''
},
editRules: {
name: [
@ -56,23 +106,75 @@ export default {
}
};
},
watch: {
computed: {
// height() {
// return this.$store.state.app.height - 65;
// }
},
mounted() {
this.loadInitData();
},
methods: {
doShow(data) {
async loadInitData() {
this.EffectiveTypeList = [];
this.$Dictionary.effectiveType().then(list => {
this.EffectiveTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
});
this.PermissionTypeList = [];
this.$Dictionary.permissionType().then(list => {
this.PermissionTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
});
this.mapList = [];
const res = await listPublishMap();
if (res.code == 200 && res.data.length) {
res.data.forEach(elem => {
this.mapList.push({ value: elem.id, label: elem.name });
});
} else {
console.error(res);
}
},
computedName(list, code) {
let name = '';
list.forEach(elem => {
if (elem.value == code) {
name = elem.label;
}
});
return name;
},
dialogSelect(row) {
if (this.editModel.mapId) {
this.$refs.choosePermission.doShow(this.editModel.mapId);
} else {
this.$messageBox('请选择地图');
}
},
async doShow(data) {
this.dialogShow = true;
this.editModel = {
id: data.id,
name: data.name,
remarks: data.remarks
remarks: data.remarks,
mapId: ''
};
this.isPackage = data.isPackage;
if (this.isPackage) {
const res = await getPermissionList(data.id);
if (res.code == 200) {
this.ruleList = res.data.relPermissions;
this.editModel.mapId = res.data.relPermissions[0].mapId;
}
}
},
close() {
this.editModel = {
id: '',
name: '',
remarks: ''
remarks: '',
mapId: ''
};
this.dialogShow = false;
},
@ -81,18 +183,63 @@ export default {
},
saveAs() {
this.$refs['form'].validate((valid) => {
this.loading = true;
putPermissonDetail(this.editModel).then(response => {
this.loading = false;
this.$message.success('修改成功!');
this.$emit('refresh');
this.close();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('map.saveFailed'));
});
if (!this.isPackage) {
this.loading = true;
putPermissonDetail(this.editModel).then(response => {
this.loading = false;
this.$message.success('修改成功!');
this.$emit('refresh');
this.close();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('map.saveFailed'));
});
} else {
if (this.ruleList.length) {
const arr = this.ruleList.map(nor => {
return nor.id;
});
this.editModel['relPermissions'] = arr;
this.loading = true;
putPermissonDetail(this.editModel).then(response => {
this.loading = false;
this.$message.success('修改成功!');
this.$emit('refresh');
this.close();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('map.saveFailed'));
});
} else {
this.$messageBox('请选择多个权限');
}
}
});
},
deleteForm(index, row) {
const idx = this.ruleList.findIndex(elem => { return elem.id == row.id; });
if (idx >= 0) {
row['isPut'] = false;
this.ruleList.splice(idx, 1);
}
EventBus.$emit('reloadTable', { index: index, list: row });
},
addRuleForm(index, row) {
row['isPut'] = true;
this.ruleList.push(row);
EventBus.$emit('reloadTable', { index: index, list: row });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.form_title{
float: left;
width: 90px;
margin-right: 10px;
line-height: 31px;
text-align: right;
font-weight: bold;
margin-bottom: 8px;
}
</style>

View File

@ -3,7 +3,7 @@
<div class="pack-box" :style="{ height: height +'px' }">
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
<el-steps class="steps" :active="display">
<el-step title="新建权限" icon="el-icon-edit" />
<el-step :title="title" icon="el-icon-edit" />
<el-step icon="el-icon-setting" />
</el-steps>
<el-card class="forms pack-rule">
@ -11,7 +11,17 @@
<el-form-item label="权限名称:" prop="name">
<el-input v-model="addModel.name" size="small" />
</el-form-item>
<el-form-item label="地图名称:">
<el-form-item label="描述" prop="remarks">
<el-input
v-model="addModel.remarks"
type="textarea"
:rows="2"
placeholder="请输入内容"
maxlength="60"
show-word-limit
/>
</el-form-item>
<el-form-item v-show="isPackage" label="地图名称:">
<el-select v-model="addModel.mapId" :disabled="ruleList.length ? true : false">
<el-option
v-for="item in mapList"
@ -22,32 +32,33 @@
</el-select>
</el-form-item>
</el-form>
<el-button class="addList" size="small" @click="dialogSelect">添加权限</el-button>
<el-table
:data="ruleList"
border
style="width: 100%"
:height="height-450"
>
<!-- <el-table-column prop="createTime" label="创建时间" />
<el-table-column prop="creatorUserName" label="创建者" /> -->
<el-table-column prop="name" label="权限名称" />
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
<template slot-scope="scope">
{{ computedName(PermissionTypeList, scope.row.type) }}
</template>
</el-table-column>
<el-table-column :label="this.$t('global.operate')" width="80">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
<div v-show="isPackage">
<el-button class="addList" size="small" @click="dialogSelect">添加权限</el-button>
<el-table
:data="ruleList"
border
style="width: 100%"
:height="height-450"
>
<el-table-column prop="name" label="权限名称" />
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
<template slot-scope="scope">
{{ computedName(PermissionTypeList, scope.row.type) }}
</template>
</el-table-column>
<el-table-column :label="this.$t('global.operate')" width="80">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<div class="draft">
<el-button-group>
<el-button type="primary" @click="packForm">{{ $t('orderAuthor.packaging') }}</el-button>
<el-button v-if="!$route.query.id" type="primary" @click="packForm">{{ $t('orderAuthor.packaging') }}</el-button>
<el-button v-if="$route.query.id" type="primary" @click="update">更新</el-button>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
@ -66,7 +77,7 @@
<script>
import { UrlConfig } from '@/router/index';
import { createLessonPermisson } from '@/api/management/author';
import { createLessonPermisson, getPermissionList, putPermissonDetail } from '@/api/management/author';
import { listPublishMap } from '@/api/jmap/map';
import ChoosePermission from './choosePermission';
import { EventBus } from '@/scripts/event-bus';
@ -82,6 +93,7 @@ export default {
display: 1,
addModel: {
name: '',
remarks: '',
mapId: ''
},
rules: {
@ -93,12 +105,16 @@ export default {
ruleList: [],
EffectiveTypeList: [],
PermissionTypeList: [],
mapList: []
mapList: [],
isPackage: true
};
},
computed: {
height() {
return this.$store.state.app.height - 65;
},
title() {
return this.$route.query.id ? '修改权限' : '新建权限';
}
},
mounted() {
@ -133,12 +149,21 @@ export default {
this.mapList = [];
const res = await listPublishMap();
res.data.forEach(elem => {
// this.queryForm.queryObject.mapId.config.data.push({ value: elem.id, label: elem.name });
this.mapList.push({ value: elem.id, label: elem.name });
});
} catch (error) {
console.error(error, '获取发布地图');
}
if (this.$route.query.id) {
const res = await getPermissionList(this.$route.query.id);
if (res.code == 200) {
this.ruleList = res.data.relPermissions;
this.addModel.mapId = res.data.relPermissions[0].mapId;
this.isPackage = res.data.isPackage;
this.addModel.name = res.data.name;
this.addModel.remarks = res.data.remarks;
}
}
},
dialogSelect(row) {
if (this.addModel.mapId) {
@ -174,13 +199,38 @@ export default {
this.$message.success('打包成功');
setTimeout(() => {
this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}` });
}, 2000);
}, 500);
}).catch(() => {
this.$messageBox(this.$t('tip.packagingFailed'));
});
} else {
this.$messageBox('请选择多个权限');
}
},
update() {
this.$refs['formData'].validate((valid) => {
if (this.ruleList.length) {
const arr = this.ruleList.map(nor => {
return nor.id;
});
const data = {
id: this.$route.query.id,
name: this.addModel.name,
remarks: this.addModel.remarks,
relPermissions: arr
};
putPermissonDetail(data).then(response => {
this.$message.success('修改成功!');
setTimeout(() => {
this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}` });
}, 500);
}).catch(() => {
this.$messageBox(this.$t('map.saveFailed'));
});
} else {
this.$messageBox('请选择多个权限');
}
});
}
}
};

View File

@ -179,7 +179,11 @@ export default {
this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}/rules` });
},
handleEdit(index, row) {
this.$refs.edit.doShow(row);
if (row.isPackage) {
this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}/rules`, query: { id: row.id } });
} else {
this.$refs.edit.doShow(row);
}
},
create() {
this.$refs.create.doShow();

View File

@ -64,7 +64,7 @@ export default {
prop: 'permissionName'
},
{
title: this.$t('orderAuthor.price'),
title: `${this.$t('orderAuthor.price')}(元)`,
prop: 'price'
},
{

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
:title="this.$t('orderAuthor.trainingList')"
title="订单选择商品"
:visible.sync="show"
top="20px"
width="90%"

View File

@ -48,7 +48,7 @@ export default {
// },
'status': {
type: 'select',
label: this.$t('orderAuthor.authorityStatus'),
label: '状态',
value: '1',
config: {
data: []
@ -142,7 +142,7 @@ export default {
formatter: this.formatterDate
},
{
title: this.$t('orderAuthor.authorityStatus'),
title: '状态',
prop: 'status',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },

View File

@ -72,7 +72,7 @@ export default {
{ prop: 'lessonId', label: this.$t('permission.lessonName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList },
{ prop: 'roleName', label: this.$t('permission.belonger'), type: 'complete', required: false, disabled: !this.isAdd && this.isAdministrator, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' },
{ prop: 'date', label: this.$t('permission.selectDate'), type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss' },
{ prop: 'amount', label: this.$t('permission.permissionTotal'), type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage }
{ prop: 'amount', label: '权限个数', type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage }
]
};
return form;

View File

@ -26,9 +26,9 @@
{{ computedName(PublishMapList, scope.row.mapId) }}
</template>
</el-table-column>
<el-table-column prop="mapProductCode" :label="$t('permission.mapProductName')" width="80">
<el-table-column prop="mapProductCode" :label="$t('permission.mapProductName')" width="100">
<template slot-scope="scope">
{{ scope.row.mapProductCode }}
{{ computedName(mapProductList, scope.row.mapProductCode) }}
</template>
</el-table-column>
<el-table-column prop="lessonId" :label="$t('permission.lessonName')">
@ -38,8 +38,8 @@
</el-table-column>
<el-table-column prop="startTime" :label="$t('permission.startTime')" width="80" />
<el-table-column prop="endTime" :label="$t('permission.endTime')" width="80" />
<el-table-column prop="amount" :label="$t('permission.permissionTotal')" width="110" />
<el-table-column l:abel="$t('global.operate')" width="90">
<el-table-column prop="amount" label="权限个数" width="90" />
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<el-button type="text" size="small" @click="dialogEdit(scope.row)">{{ $t('global.edit') }}</el-button>
<el-button type="text" size="small" @click="deleteForm(scope.row)">{{ $t('global.delete') }}</el-button>
@ -92,6 +92,7 @@ export default {
PermissionTypeList: [],
PublisLessonList: [],
PublishMapList: [],
mapProductList: [],
ruleList: []
};
},
@ -205,7 +206,14 @@ export default {
item.mapProductCode == elem.mapProductCode &&
item.permissionType == elem.permissionType;
});
getPublishMapInfo(item.mapId).then(resp => {
getCommodityMapProduct(resp.data.skinCode).then(rest => {
const list = rest.data || [];
this.mapProductList = list.map(elem => {
return { value: elem.code, label: elem.name };
});
});
});
if (index < 0) {
this.ruleList.push(item);
} else {
@ -271,7 +279,7 @@ export default {
}
.forms {
width: 800px;
width: 900px;
margin: 0 auto;
margin-top: 20px;
padding: 40px;

View File

@ -119,7 +119,7 @@ export default {
{
title: this.$t('permission.belonger'),
prop: 'ownerName',
isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) != -1 || this.$store.state.user.roles.indexOf(admin) < 0; }
isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0 || this.$store.state.user.roles.indexOf(admin) > 0; }
},
{
type: 'button',

View File

@ -1,6 +1,6 @@
<template>
<div class="plan-tool" style="width: 100%; height: 100%;">
<menu-bar ref="menuBar" :skin-style="skinCode" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" />
<menu-bar ref="menuBar" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" />
<schedule
ref="schedule"
:skin-code="skinCode"

View File

@ -123,10 +123,10 @@ import { EventBus } from '@/scripts/event-bus';
export default {
name: 'PlanMenuBar',
props: {
skinCode: {
type: String,
default: ''
},
// skinCode: {
// type: String,
// default: ''
// },
planConvert: {
type: Object,
default: function() {
@ -141,6 +141,7 @@ export default {
tempClassA: -1,
tempClassB: -1,
menus: [],
loading: null,
menuBase: [
{
title: '文件',
@ -149,19 +150,27 @@ export default {
title: '打开运行图',
click: this.handleOpenRunPlan
},
{
type: 'file',
title: '导入运行图',
click: this.handleImportRunPlan
},
// {
// type: 'file',
// title: '',
// click: this.handleImportRunPlan
// },
{
title: '新建运行图',
click: this.handleCreateEmptyPlan
},
{
title: '修改运行图名称',
click: this.handleEditPlan
},
{
title: '修改站间运行时间',
click: this.handleModifyingStationIntervalTime
// disabledCallback: () => { return !this.$route.query.planId },
},
{
title: '删除运行图',
click: this.handledeleteRunPlan
}
]
},
@ -388,65 +397,74 @@ export default {
},
//
handleOpenRunPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {} });
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
},
handledeleteRunPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'delete'} });
},
//
handleEditPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'edit'} });
},
loadingScreen() {
this.loading = this.$loading({
lock: true,
text: '正在导入中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
},
//
handleImportRunPlan(file) {
if (file) {
const loading = this.$loading({
lock: true,
text: '正在导入中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const that = this;
const reader = new FileReader();
if (reader) {
reader.onload = function (e) {
let wb;
const data = e.target.result;
if (that.rABS) {
wb = XLSX.read(btoa(that.fixdata(data)), { //
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
if (wb) {
try {
let jsonData = [];
for (const index in wb.Sheets) {
jsonData = that.PlanConvert.importData(wb.Sheets[index], jsonData);
}
importRunPlan({ skinCode: that.skinCode, runPlanList: jsonData }).then(response => {
loading.close();
that.refresh();
that.$message.success('导入运行图成功!');
}).catch(() => {
loading.close();
that.refresh();
that.$message.warning('导入运行图失败!');
this.loadingScreen();
setTimeout(() => {
const that = this;
const reader = new FileReader();
if (reader) {
reader.onload = function (e) {
let wb;
const data = e.target.result;
if (that.rABS) {
wb = XLSX.read(btoa(that.fixdata(data)), { //
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
} catch (error) {
loading.close();
that.refresh();
that.$message.warning('解析运行图失败!');
}
}
};
if (wb) {
try {
let jsonData = [];
for (const index in wb.Sheets) {
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
}
if (that.rABS) {
reader.readAsArrayBuffer(file);
} else {
reader.readAsBinaryString(file);
importRunPlan({ skinCode: that.$route.query.skinCode || '02', runPlanList: jsonData }).then(response => {
that.loading.close();
that.refresh();
that.handleOpenRunPlan();
}).catch(error => {
that.loading.close();
that.refresh();
that.$message.warning(`导入运行图失败: ${error.message}`);
});
} catch (error) {
that.loading.close();
that.refresh();
that.$message.warning(`解析运行图失败: ${error.message}`);
}
}
};
if (that.rABS) {
reader.readAsArrayBuffer(file);
} else {
reader.readAsBinaryString(file);
}
}
}
}, 50);
}
this.closeMenu();
},

View File

@ -4,28 +4,54 @@
class="planEdit__tool create-empty-plan"
:title="title"
:visible.sync="dialogShow"
width="420px"
width="30%"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-form ref="form" :model="addModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="addModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
<div>
<el-tabs v-model="activeTab" type="card">
<el-tab-pane label="正常新建" name="first">
<el-row>
<el-form ref="form" :model="newModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="newModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
</el-tab-pane>
<el-tab-pane label="从发布运行图创建" name="second">
<el-row>
<el-form ref="pullForm" :model="pullModel" label-width="140px" size="mini" :rules="pullRules" @submit.native.prevent>
<el-form-item label="发布运行图" prop="templateId">
<el-select v-model="pullModel.templateId" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in publishMapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="pullModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
</el-tab-pane>
</el-tabs>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="loading" @click="handleCommit">{{ $t('map.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('map.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { createEmptyPlan } from '@/api/runplan';
import { createEmptyPlan, queryRunPlanList, postCreatePlan } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
export default {
name: 'CreateEmptyPlan',
@ -33,9 +59,16 @@ export default {
},
data() {
return {
activeTab: 'first',
dialogShow: false,
loading: false,
addModel: {
publishMapList: [],
newModel: {
name: '',
skinCode: this.$route.query.skinCode
},
pullModel: {
templateId: '',
name: '',
skinCode: this.$route.query.skinCode
}
@ -43,7 +76,7 @@ export default {
},
computed: {
title() {
return '创建空运行图数据';
return '新建运行图';
},
rules() {
return {
@ -51,36 +84,88 @@ export default {
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
};
},
pullRules() {
return {
templateId: [
{ required: true, message: '请选择发布运行图', trigger: 'change' }
],
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
};
}
},
mounted() {
},
methods: {
async initLoad() {
const res = await queryRunPlanList(this.$route.query.skinCode);
if (res.code == 200 && res.data.length) {
this.publishMapList = res.data;
}
},
doShow() {
this.dialogShow = true;
this.initLoad();
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.newModel.name = '';
this.pullModel.templateId = '';
this.pullModel.name = '';
if (this.$refs.form) {
this.$refs.form.resetFields();
}
if (this.$refs.pullForm) {
this.$refs.pullForm.resetFields();
}
},
handleCommit() {
this.$refs['form'].validate((valid) => {
if (valid) {
createEmptyPlan(this.addModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.addModel.name, refresh: true }
};
if (this.activeTab === 'first') {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true;
createEmptyPlan(this.newModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.newModel.name, refresh: true }
};
this.$emit('dispatchOperate', params);
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {} });
this.$message.success('创建空运行图成功!');
this.doClose();
}).catch(() => {
this.$messageBox('创建空运行图失败');
this.doClose();
});
}
});
this.$emit('dispatchOperate', params);
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建空运行图成功!');
this.jump(resp.data, this.newModel.name);
this.doClose();
}).catch(() => {
this.$messageBox('创建空运行图失败');
this.doClose();
});
}
});
} else {
this.$refs['pullForm'].validate((valid) => {
if (valid) {
this.loading = true;
postCreatePlan(this.pullModel).then(resp => {
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建运行图成功!');
this.jump(resp.data, this.pullModel.name);
this.doClose();
}).catch(() => {
this.$messageBox('创建运行图失败');
this.doClose();
});
}
});
}
},
jump(planId, planName) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
}
};

View File

@ -0,0 +1,116 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool create-empty-plan"
:title="title"
:visible.sync="dialogShow"
width="30%"
:before-close="doClose"
:z-index="3000"
:modal="false"
:close-on-click-modal="false"
>
<div>
<el-row>
<el-form ref="form" :model="editModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="editModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="loading" @click="handleEdit">修改</el-button>
<el-button @click="doClose">{{ $t('map.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { putRunPlanDetail } from '@/api/runplan';
export default {
name: 'CreateEmptyPlan',
components: {
},
data() {
return {
activeTab: 'first',
dialogShow: false,
loading: false,
publishMapList: [],
editModel: {
planId: '',
name: ''
}
};
},
computed: {
title() {
return '新建运行图';
},
rules() {
return {
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
};
}
},
mounted() {
},
methods: {
doShow(data) {
this.dialogShow = true;
if (data && data.name) {
this.editModel.name = data.name;
this.editModel.planId = data.id;
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.editModel.name = '';
if (this.$refs.form) {
this.$refs.form.resetFields();
}
},
handleEdit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true;
putRunPlanDetail(this.editModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.editModel.name, refresh: true }
};
this.$emit('dispatchOperate', params);
this.$message.success('修改运行图名称成功!');
this.$emit('renewal');
this.doClose();
}).catch(() => {
this.$messageBox('修改运行图名称失败');
this.doClose();
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-input {
width: 160px;
}
.el-input-number {
width: 120px;
}
}
</style>

View File

@ -1,42 +1,49 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool open-runplan"
:title="title"
:visible.sync="show"
width="640px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"
class="filter-tree"
:data="runPlanList"
:props="defaultProps"
default-expand-all
:style="{height: height-20+'px'}"
>
<span slot-scope="{ node, data }">
<el-radio v-model="planId" :label="data.id"><span>{{ data.name }}</span></el-radio>
</span>
</el-tree>
</el-scrollbar>
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" @click="handleConfirm">选择运行图</el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
<div>
<el-dialog
v-dialogDrag
class="planEdit__tool open-runplan"
:title="title"
:visible.sync="show"
width="640px"
:before-close="doClose"
:z-index="2000"
:modal="true"
:close-on-click-modal="false"
>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"
class="filter-tree"
:data="runPlanList"
:props="defaultProps"
highlight-current
default-expand-all
:style="{height: height-20+'px'}"
@node-click="handleNodeClick"
/>
</el-scrollbar>
<el-row type="flex" justify="center" class="button-group">
<el-button v-if="type == 'add'" type="primary" @click="handleConfirm">选择运行图</el-button>
<el-button v-if="type == 'delete'" type="primary" @click="handleDelete">删除</el-button>
<el-button v-if="type == 'edit'" type="primary" @click="handleEdit">修改</el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
</div>
</template>
<script>
import { getRpListByMapId } from '@/api/runplan';
import { getRpListByMapId, deleteRunPlan } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
import EditPlanName from './editPlanName';
export default {
name: 'OpenRunPlan',
components: {
EditPlanName
},
props: {
skinCode: {
type: String,
@ -49,6 +56,9 @@ export default {
loading: false,
height: 260,
planId: '',
planName: '',
type: 'add',
// defaultShowKeys: [],
runPlanList: [],
runPlanDict: {},
defaultProps: {
@ -72,35 +82,68 @@ export default {
});
},
methods: {
handleNodeClick(data) {
this.planId = data.id;
this.planName = data.name;
},
loadRunPlanData({ refresh, planId, skinCode, planName }) {
if (refresh) {
this.$store.dispatch('runPlan/refresh');
} else {
const query = { skinCode: skinCode, mapId: this.$route.query.mapId, planId: planId, planName, try: this.$route.query.try, goodsId: this.$route.query.goodsId };
const query = { skinCode: skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
},
doShow() {
getRunPlanList() {
getRpListByMapId(this.$route.query.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
// this.defaultShowKeys = [this.planId];
this.dialogShow = true;
}).catch(() => {
this.$messageBox('获取运行图列表失败');
});
},
doShow(data) {
this.type = data.type || 'add';
this.getRunPlanList();
},
doClose() {
this.dialogShow = false;
this.planId = '';
this.planName = '';
},
//
handleConfirm() {
this.loadRunPlanData({
planId: this.planId,
skinCode: this.$route.query.skinCode,
planName: this.runPlanDict[this.planId]
planName: this.planName
});
this.doClose();
},
//
handleDelete() {
deleteRunPlan(this.planId).then(Response => {
this.$message.success(`删除成功!`);
if (this.planId === this.$route.query.planId) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});
},
//
handleEdit() {
if (this.planId && this.planName) {
this.$refs.editPlan.doShow({id: this.planId, name: this.planName});
} else {
this.$message.info('请选择运行图');
}
}
}
};

View File

@ -40,10 +40,10 @@ export default {
type: String,
required: true
},
planConvert: {
type: Object,
required: true
},
// planConvert: {
// type: Object,
// required: true
// },
maxWidth: {
type: Number,
required: true
@ -55,6 +55,7 @@ export default {
},
data() {
return {
planConvert: null,
top: 0,
height: 0,
mapName: '',
@ -350,29 +351,33 @@ export default {
getPublishMapInfo(this.$route.query.mapId).then(resp => {
this.mapName = `${resp.data.name} (${this.$route.query.planName || ''})`;
});
this.PlanConvert = this.$theme.loadPlanConvert(this.skinCode);
this.$store.dispatch('runPlan/clear').then(resp => {
this.planConvert = this.$theme.loadPlanConvert(this.skinCode);
this.$store.dispatch('runPlan/clear').then(() => {
this.loadInitChart().then(() => {
if (this.skinCode && this.planId) {
this.myChart && this.myChart.showLoading();
if (this.skinCode) {
loadMapData(this.skinCode);
getStationListBySkinCode(this.skinCode).then(resp => {
getStationListBySkinCode(this.$route.query.skinCode).then(resp => {
this.$store.dispatch('runPlan/setStations', resp.data).then(() => {
queryRunPlan(this.planId).then(rest => {
this.$store.dispatch('runPlan/setPlanData', rest.data).then(() => {
this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.loadChartData();
this.loadInitData();
if (this.planId) {
this.myChart && this.myChart.showLoading();
queryRunPlan(this.planId).then(rest => {
this.$store.dispatch('runPlan/setPlanData', rest.data).then(() => {
this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.loadChartData();
this.myChart && this.myChart.hideLoading();
});
}).catch(() => {
this.myChart && this.myChart.hideLoading();
this.$messageBox('获取运行图数据失败');
});
}).catch(() => {
this.myChart && this.myChart.hideLoading();
this.$messageBox('获取运行图数据失败');
});
} else {
this.clearCanvas();
}
});
}).catch(() => {
this.$messageBox('请求车站数据失败');
this.$store.dispatch('runPlan/setStations', []);
this.myChart && this.myChart.hideLoading();
});
}
});
@ -389,10 +394,10 @@ export default {
this.viewDisabled = true;
this.option.series = [];
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
this.pushModels(this.option.series, [this.PlanConvert.initializeYaxis(stations)]);
this.pushModels(this.option.series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 0.5 }));
await this.loadInitData();
this.kmRangeCoordMap = this.planConvert.convertStationsToMap(stations);
this.pushModels(this.option.series, [this.planConvert.initializeYaxis(this.stations)]);
this.pushModels(this.option.series, this.planConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 0.5, color: '#000' }));
await this.loadInitChart();
this.viewDisabled = false;
} catch (error) {
@ -465,11 +470,19 @@ export default {
}
});
},
clearCanvas() {
this.option.series = [];
this.option.title.text = '';
if (this.myChart) {
this.myChart.clear();
}
this.myChart.setOption(this.option);
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
return this.planConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
@ -481,7 +494,7 @@ export default {
},
xAxisInit() {
const list = [];
for (var time = 0 + this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
for (var time = 0 + this.planConvert.TranslationTime; time < 3600 * 24 + this.planConvert.TranslationTime; time++) {
list.push(time);
}
@ -498,18 +511,19 @@ export default {
}
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
if (Object.keys(this.planConvert).length) {
this.pushModels(this.option.series, [this.planConvert.initializeYaxis(this.stations)]);
this.option.yAxis.min = this.planConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.planConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
const station = this.stations[Math.floor((param.data[1] - this.planConvert.EdgeHeight) / this.planConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style="margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
`到站时间: ${timeFormat(param.data[0] + this.planConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
mouseClick(params) {
@ -559,7 +573,7 @@ export default {
@import "src/styles/mixin.scss";
#PlanSchedule {
z-index: 5;
z-index: 0;
position: absolute;
width: 100%;

View File

@ -147,7 +147,15 @@ export default {
type: 'warning',
handleClick: this.handleEfficacy,
showControl: (row) => {
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status == 1;
return !this.$route.query.lessonId && row.status == 1;
}
},
{
name: '删除',
type: 'warning',
handleClick: this.handleDelete,
showControl: (row) => {
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
}
},
{
@ -213,6 +221,7 @@ export default {
queryFunction(params) {
if (this.$route.query.lessonId) {
params.lessonId = this.$route.query.lessonId;
params.status = '1';
}
return getExamList(params);
},
@ -253,6 +262,25 @@ export default {
});
}).catch(() => { });
},
//
handleDelete(index, data) {
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setExamEfficacy(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
});
}).catch(() => { });
},
//
handleEfficacy(index, data) {
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
@ -270,6 +298,7 @@ export default {
});
}).catch(() => { });
},
//
handleEffective(index, data) {
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),

View File

@ -6,8 +6,7 @@
<p style="margin-top: 2px;font-size: 15px;">综合实训管理者: {{ roomInfo.creator }}</p>
<p class="roomName">综合演练室</p>
<div style="padding-right: 30px;">
<p class="num">可分配角色数量: {{ roomInfo.permissionNum - 1 }}</p>
<!-- <p class="num">剩余可分配角色数量: {{roomInfo.permissionNum - num}}</p> -->
<p class="num">可分配角色数量: {{ permissionRest }} / {{ roomInfo.permissionNum - 1 }}</p>
</div>
</div>
<!-- 聊天窗口 -->
@ -16,7 +15,7 @@
</div>
<!-- 参与人员 -->
<div class="personnel">
<div style="height: calc(100% - 20px); overflow-y: scroll;">
<div style="height: calc(100% - 20px); overflow-y: scroll; padding: 0px 30px;">
<div style="display: flex; justify-content: space-between;">
<div class="Scheduling">
<p class="title">调度员</p>
@ -34,7 +33,7 @@
<el-button icon="el-icon-plus" circle plain @click="addingRoles('dispatch', '增加调度人员')" />
</div>
</div>
<div class="Scheduling bottomNone">
<div class="Scheduling">
<p class="title">车站值班员</p>
<ul>
<li v-for="(nor, index) in equipmentList" :key="index" class="selectPerson">
@ -42,7 +41,7 @@
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="handleDelEquipment(nor, index)"
@click="handleDelUserForStation(nor, index, stationListForEquipment, equipmentList)"
/>
<div style="float: right; margin-right: 15px;">
<el-select
@ -50,10 +49,10 @@
placeholder="请选择"
size="mini"
:disabled="userId != roomInfo.creatorId"
@change="changeEquipment(nor)"
@change="handleChangeUser(nor, 'Attendant', stationListForEquipment, equipmentList)"
>
<el-option
v-for="item in stationList"
v-for="item in stationListForEquipment"
:key="item.code"
:label="item.name"
:value="item.code"
@ -108,7 +107,7 @@
</div>
</div>
<div style="display: flex; justify-content: space-between;">
<div class="Scheduling bottomNone">
<div class="Scheduling">
<p class="title">司机</p>
<ul>
<li v-for="(nor, index) in driverList" :key="index" class="selectPerson">
@ -124,7 +123,7 @@
<el-button icon="el-icon-plus" circle plain @click="addingRoles('driver', '增加司机')" />
</div>
</div>
<div class="Scheduling bottomNone">
<div class="Scheduling">
<p class="title">IBP</p>
<ul>
<li v-for="(nor, index) in ibpList" :key="index" class="selectPerson">
@ -132,62 +131,102 @@
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="handleDelUser(ibpList, nor, index)"
@click="handleDelUserForStation(nor, index, stationListForIBP, ibpList)"
/>
<div style="float: right; margin-right: 15px;">
<el-select
v-model="nor.deviceCode"
placeholder="请选择"
size="mini"
:disabled="userId != roomInfo.creatorId"
@change="handleChangeUser(nor, 'IBP', stationListForIBP, ibpList)"
>
<el-option
v-for="item in stationListForIBP"
:key="item.code"
:label="item.name"
:value="item.code"
:disabled="item.disabled"
/>
</el-select>
</div>
</li>
</ul>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button
icon="el-icon-plus"
circle
plain
@click="addingRoles('ibp', '增加IBP')"
/>
</div>
</div>
</div>
<div style="display: flex; justify-content: space-between;">
<div class="Scheduling">
<p class="title">大屏</p>
<ul>
<li v-for="(nor, index) in bigScreenList" :key="index" class="selectPerson">
<span>{{ nor.nickName }}</span>
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="handleDelUser(bigScreenList, nor, index)"
/>
</li>
</ul>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('ibp', '增加IBP')" />
<el-button icon="el-icon-plus" circle plain @click="addingRoles('bigScreen', '增加大屏')" />
</div>
</div>
</div>
<div class="start-box">
<div v-if="!starting" style="float: right; margin-left: 10px;">
<el-button
v-if="userId == roomInfo.creatorId"
type="primary"
style="float: right;"
:loading="loading"
@click="start"
>
开始仿真</el-button>
</div>
<div v-else>
<el-button
type="primary"
style="float: right; margin-right: 10px;"
:loading="loading"
@click="joinJointTrain"
>
进入仿真</el-button>
<el-button
v-if="userId == roomInfo.creatorId"
type=""
style="float: right; margin-right: 10px;"
:loading="loading"
@click="stop"
>
结束仿真</el-button>
</div>
</div>
<div class="start-box">
<el-button
v-if="userId == roomInfo.creatorId"
style="margin-left: 10px"
type="danger"
:loading="loading"
@click="exit"
>销毁房间
</el-button>
<el-button
v-if="userId == roomInfo.creatorId"
style="margin-left: 10px"
type="success"
:loading="loading"
@click="postCode"
>生成二维码
</el-button>
<template v-if="!starting">
<el-button
v-if="userId == roomInfo.creatorId"
type=""
style="float: right; margin-right: 0px;"
style="margin-left: 10px"
type="primary"
:loading="loading"
@click="postCode"
>生成二维码
</el-button>
<el-button type="" style="float: right; margin-right: 10px;" @click="backRoom">返回
</el-button>
@click="start"
>
开始仿真</el-button>
</template>
<template v-else>
<el-button
type="primary"
style="margin-left: 10px"
:loading="loading"
@click="joinJointTrain"
>
进入仿真</el-button>
<el-button
v-if="userId == roomInfo.creatorId"
type="danger"
style="float: right; margin-right: 0px;"
style="margin-left: 10px"
type="warning"
:loading="loading"
@click="exit"
>销毁房间
</el-button>
</div>
@click="stop"
>
结束仿真</el-button>
</template>
<el-button type="" @click="backRoom">返回
</el-button>
</div>
</div>
</div>
@ -223,14 +262,15 @@
<script>
import { getJoinTrainCode, deljointTrainRoom, putUserRoles, postRoomDetail, getJointTrainRoomUserList, putJointTrainingExit, startJointTraining, putJointTrainingSimulation, putJointTrainingSimulationEntrance } from '@/api/chat';
import trainChat from './trainChat';
import AddPerson from './addPerson';
import QrCode from '@/components/QrCode';
import { getStationList } from '@/api/runplan';
import TreeOperateMenu from './operateMenu';
import { launchFullscreen } from '@/utils/screen';
import { DeviceMenu } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login';
import { getPublishMapInfo } from '@/api/jmap/map';
import trainChat from './trainChat';
import AddPerson from './addPerson';
import QrCode from '@/components/QrCode';
import TreeOperateMenu from './operateMenu';
export default {
name: 'TrainRoom',
@ -243,13 +283,14 @@ export default {
data() {
return {
userId: '',
permissionRest: 0,
roomInfo: {
creator: '',
totalNum: '',
creatorId: '',
group: '',
audienceNum: '',
permissionNum: ''
audienceNum: 0,
permissionNum: 0
},
filterText: '',
isShow: false,
@ -263,7 +304,8 @@ export default {
adminList: [],
driverList: [],
signalList: [],
stationList: [], //
bigScreenList: [],
stationList: [],
ibpList: [],
point: {
x: 0,
@ -273,51 +315,72 @@ export default {
timeDemon: null,
starting: false,
mapId: '',
num: 0,
loading: false
};
},
computed: {
height() {
return this.$store.state.app.height - 95;
},
stationListForEquipment() {
return this.stationList.filter(elem => { return elem.centralized; }).map(item => {
const elem = { code: item.code, name: item.name, disabled: false };
this.equipmentList.forEach(nor => {
if (elem.code == nor.deviceCode) {
elem.disabled = true;
}
});
return elem;
});
},
stationListForIBP() {
return this.stationList.map(item => {
const elem = { code: item.code, name: item.name, disabled: false };
this.ibpList.forEach(nor => {
if (elem.code == nor.deviceCode) {
elem.disabled = true;
}
});
return elem;
});
}
},
watch: {
filterText(val) {
this.$refs.trainingTree.filter(val);
},
'$store.state.socket.roleInfo': function (val) {
if (val.length) { //
this.addrolesList(val);
'$store.state.socket.roleInfo': async function (val) {
if (val.length) { //
await this.addrolesList(val);
}
},
'$store.state.socket.jointRoomInfo': function (val) {
if (val.creatorId) { //
this.handleRoomInfo(val);
'$store.state.socket.jointRoomInfo': async function (val) {
if (val.creatorId) { //
await this.handleRoomInfo(val);
}
},
'$store.state.socket.userRoomKickOut': function (val) {
if (val.id) { //
val.state = '03';
this.addPeopleList(val);
}
},
'$store.state.socket.userPermit': function (val) {
if (val.id) { //
'$store.state.socket.userPermit': async function (val) {
if (val.id) { //
val.state = '01';
this.addPeopleList(val);
await this.addPeopleList(val);
}
},
'$store.state.socket.userInRoom': function (val) {
if (val.id) { //
val.state = '02';
this.addPeopleList(val);
'$store.state.socket.userRoomKickOut': async function (val) {
if (val.id) { //
val.state = '03';
await this.addPeopleList(val);
}
},
'$store.state.socket.userOutRoom': function (val) {
if (val.id) { // 退
'$store.state.socket.userInRoom': async function (val) {
if (val.id) { //
val.state = '02';
this.addPeopleList(val);
await this.addPeopleList(val);
}
},
'$store.state.socket.userOutRoom': async function (val) {
if (val.id) { // 退
val.state = '02';
await this.addPeopleList(val);
}
}
},
@ -327,7 +390,6 @@ export default {
}
},
async mounted() {
this.getRoomState();
this.userId = this.$store.state.user.id;
this.getRoomInfo(); // info
this.getUserList(); //
@ -336,6 +398,18 @@ export default {
}, 5000 * 60);
},
methods: {
computePermissionRest() {
this.permissionRest = this.roomInfo.permissionNum > 0
?this.roomInfo.permissionNum - [
...this.adminList,
...this.dispatchList,
...this.equipmentList,
...this.driverList,
...this.signalList,
...this.ibpList,
...this.bigScreenList
].length - 1: 0;
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
@ -349,6 +423,7 @@ export default {
roomName: data.roomName,
state: data.state
};
if (data.state == '03') { //
this.$router.push({ path: `/demonstration/detail/${param.mapId}` });
} else if (data.state == '01') { //
@ -359,18 +434,10 @@ export default {
const rest = await getPublishMapInfo(param.mapId);
const query = { skinCode: rest.data.skinCode, mapId: param.mapId, group: param.group };
this.$router.push({ path: `/jointTraining`, query: query });
launchFullscreen();
}
this.$store.dispatch('socket/setJointRoomInfo'); //
},
//
async getRoomState() {
const res = await postRoomDetail(this.$route.query.group);
this.mapId = res.data.mapId;
this.starting = false;
if (res.data.state == '02') {
this.starting = true;
}
},
//
showContextMenu(e, obj, node, vueElem) {
e.preventDefault();
@ -389,6 +456,7 @@ export default {
const rest = await getPublishMapInfo(this.mapId);
const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.$route.query.group };
this.$router.push({ path: `/jointTraining`, query: query });
launchFullscreen();
},
// 线/线
addPeopleList(obj) {
@ -421,6 +489,7 @@ export default {
this.addrolesList(arr); //
}
}
this.computePermissionRest();
},
//
addrolesList(list) {
@ -428,78 +497,82 @@ export default {
switch (item.userRole) {
case 'Instructor':
this.adminList.push(item);
this.num++;
break;
case 'Dispatcher':
this.dispatchList.push(item);
this.num++;
break;
case 'Attendant':
this.equipmentList.forEach((nor, index) => {
if (nor.id == item.id) { //
if (nor.id == item.id) {
this.equipmentList.splice(index, 1);
this.num--;
}
});
this.equipmentList.push(item); //
this.num++;
this.equipmentList.push(item);
break;
case 'Driver':
this.driverList.push(item);
this.num++;
break;
case 'Repair':
this.signalList.push(item);
this.num++;
break;
case 'IBP':
this.ibpList.forEach((nor, index) => {
if (nor.id == item.id) {
this.ibpList.splice(index, 1);
}
});
this.ibpList.push(item);
this.num++;
break;
case 'BigScreen':
this.bigScreenList.push(item);
break;
default:
this.dispatchList.forEach((nor, index) => {
if (item.id == nor.id) {
this.dispatchList.splice(index, 1);
this.num--;
}
});
this.equipmentList.forEach((nor, index) => {
if (item.id == nor.id) {
this.equipmentList.splice(index, 1);
this.num--;
}
});
this.adminList.forEach((nor, index) => {
if (item.id == nor.id) {
this.adminList.splice(index, 1);
this.num--;
}
});
this.driverList.forEach((nor, index) => {
if (item.id == nor.id) {
this.driverList.splice(index, 1);
this.num--;
}
});
this.signalList.forEach((nor, index) => {
if (item.id == nor.id) {
this.signalList.splice(index, 1);
this.num--;
}
});
this.ibpList.forEach((nor, index) => {
if (item.id == nor.id) {
this.ibpList.splice(index, 1);
this.num--;
}
});
this.bigScreenList.forEach((nor, index) => {
if (item.id == nor.id) {
this.bigScreenList.splice(index, 1);
}
});
break;
}
});
this.computePermissionRest();
},
async getRoomInfo() {
//
const res = await postRoomDetail(this.$route.query.group);
this.starting = res.data.state == '02';
this.mapId = res.data.mapId;
this.roomInfo = {
creatorId: res.data.creatorId,
totalNum: Number(res.data.permissionNum) + Number(res.data.audiencePermissionNum),
@ -511,23 +584,11 @@ export default {
//
const resp = await getStationList(res.data.mapId);
resp.data.forEach(item => {
if (item.centralized) {
this.stationList.push(item);
}
});
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
});
this.stationList = resp.data;
this.computePermissionRest();
},
// list Admin Instructor Dispatcher Attendant Audience Driver Repair IBP IBP
async getUserList() {
this.num = 0;
this.dispatchList = [];
this.equipmentList = [];
this.adminList = [];
@ -539,7 +600,6 @@ export default {
if (item.id == this.userId) {
item.disabled = true;
}
if (item.userRole != 'Audience' && item.userRole != '') this.num++;
switch (item.userRole) {
case 'Instructor':
item.select = true;
@ -565,9 +625,14 @@ export default {
item.select = true;
this.ibpList.push(item);
break;
case 'BigScreen':
item.select = true;
this.bigScreenList.push(item);
break;
}
this.treeData.push(item);
});
this.computePermissionRest();
},
async postCode() {
this.loading = true;
@ -640,24 +705,6 @@ export default {
}
});
},
//
changeEquipment(val) {
const params = [{
id: val.id,
nickName: val.nickName,
userRole: 'Attendant',
deviceCode: val.deviceCode
}];
putUserRoles(params, this.$route.query.group);
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
});
},
//
addingRoles(name, title) {
this.listName = name;
@ -680,24 +727,27 @@ export default {
userRole: ''
};
switch (this.listName) {
case 'admin': //
case 'admin': //
params.userRole = 'Instructor';
break;
case 'dispatch': //
case 'dispatch': //
params.userRole = 'Dispatcher';
break;
case 'equipment': //
case 'equipment': //
params.userRole = 'Attendant';
break;
case 'driver': //
case 'driver': //
params.userRole = 'Driver';
break;
case 'signal': //
case 'signal': //
params.userRole = 'Repair';
break;
case 'ibp': // IBP
case 'ibp': // IBP
params.userRole = 'IBP';
break;
case 'bigScreen': //
params.userRole = 'BigScreen';
break;
}
arr.push(params);
});
@ -716,7 +766,7 @@ export default {
this.messageInfo('分配角色数量已超过可分配角色总数!', 'error');
}
this.treeData.forEach(item => {
if (item.userRole == '' || item.userRole == 'Audience') {
if (item.userRole == '' || item.userRole == 'Audience' || item.userRole == 'IBP') {
item.select = false;
}
});
@ -732,15 +782,32 @@ export default {
});
});
},
handleChangeUser(val, role, stationList, list) {
const params = [{
id: val.id,
nickName: val.nickName,
userRole: role,
deviceCode: val.deviceCode
}];
putUserRoles(params, this.$route.query.group);
stationList.forEach(item => {
item.disabled = false;
list.forEach(nor => {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
});
},
handleDelUser(list, item, index) {
list.splice(index, 1);
this.handleProperty(item);
},
handleDelEquipment(item, index) {
this.equipmentList.splice(index, 1);
this.stationList.forEach(item => {
handleDelUserForStation(item, index, stationList, list) {
list.splice(index, 1);
stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
list.forEach(nor => {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
@ -748,10 +815,9 @@ export default {
});
this.handleProperty(item);
},
handleProperty(item) {
handleProperty(item, role) {
const treeIndex = this.treeData.findIndex(nor => nor.id == item.id);
if (treeIndex > -1) {
this.num--;
this.treeData[treeIndex]['select'] = false;
this.treeData[treeIndex].userRole = 'Audience';
}
@ -855,15 +921,14 @@ export default {
}
.personnel {
padding: 0px 20px;
width: calc(100% - 500px);
height: calc(100% - 60px);
height: calc(100% - 120px);
float: left;
.Scheduling {
width: calc(50% - 10px);
float: left;
height: 250px;
height: 240px;
border: 1px solid #ccc;
margin-bottom: 20px;
overflow-y: scroll;
@ -884,10 +949,6 @@ export default {
}
}
.bottomNone {
margin-bottom: 0;
}
.selectPerson {
height: 30px;
line-height: 30px;
@ -909,9 +970,11 @@ export default {
}
.start-box {
width: 100%;
height: 40px;
margin-top: 20px;
width: 100%;
display: flex;
justify-content: center;
background: #f1f1f1;
padding: 20px 0px;
}
@media screen and (max-width: 1325px) {