This commit is contained in:
fan 2020-10-15 14:18:11 +08:00
commit 41f70aadd8
44 changed files with 2459 additions and 310 deletions

View File

@ -343,11 +343,12 @@ export function competitionPracticalSceneExit(group) {
});
}
/** 退出场景 */
export function competitionPracticalSceneFinish(group) {
/** 结束场景 */
export function competitionPracticalSceneFinish(group, data) {
return request({
url: `/api/v1/competitionPractical/finish/${group}`,
method: 'PUT'
method: 'PUT',
data
});
}
@ -359,12 +360,3 @@ export function getEmptyOperationalStatistics(group) {
});
}
/** 提交运营数据 */
export function submitOperationalStatistics(group, data) {
return request({
url: `/api/v1/competitionPractical/detail/os/${group}`,
method: 'PUT',
data
});
}

67
src/api/rpTools.js Normal file
View File

@ -0,0 +1,67 @@
import request from '@/utils/request';
/**
* 获取运行图数据
*/
export function getRpTools() {
return request({
url: '/api/rpTools',
method: 'get'
});
}
/**
* 添加车次
*/
export function addRpTrip(data) {
return request({
url: '/api/rpTools/trip',
method: 'post',
data
});
}
/**
* 修改到站时间
*/
export function justTripNoArrival(tripNo, data) {
return request({
url: `/api/rpTools/${tripNo}/arrival`,
method: 'put',
data
})
}
/**
* 修改发车时间
*/
export function justTripNoDeparture(tripNo, data) {
return request({
url: `/api/rpTools/${tripNo}/departure`,
method: 'put',
data
})
}
/**
* 平移车次
*/
export function translateTripNo(tripNo, data) {
return request({
url: `/api/rpTools/${tripNo}/trip`,
method: 'put',
data
})
}
/**
* 删除车次
*/
export function deleteTripNo(tripNo) {
return request({
url: `/api/rpTools/${tripNo}/trip`,
method: 'delete'
})
}

BIN
src/assets/yuyin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -18,7 +18,7 @@ class Iscs {
this.methods = opts.methods;
// 鼠标事件
this.events = { __Pan: 'pan', Selected: 'selected', Contextmenu: 'contextmenu', Keyboard: 'keyboard'};
this.events = { __Pan: 'pan', Selected: 'selected', Contextmenu: 'contextmenu', Keyboard: 'keyboard', dblclick: 'dblclick'};
// 设备数据
this.iscsDevice = {};
@ -275,6 +275,9 @@ class Iscs {
case this.events.Selected:
this.$mouseController.on(this.events.Selected, cb, context);
break;
case this.events.dblclick:
this.$mouseController.on(this.events.dblclick, cb, context);
break;
case this.events.Contextmenu:
this.$mouseController.on(this.events.Contextmenu, cb, context);
break;
@ -295,6 +298,9 @@ class Iscs {
case this.events.Selected:
this.$mouseController.off(this.events.Selected, cb);
break;
case this.events.dblclick:
this.$mouseController.off(this.events.dblclick, cb);
break;
case this.events.Contextmenu:
this.$mouseController.off(this.events.Contextmenu, cb);
break;

View File

@ -35,7 +35,7 @@ class KeyboardController extends Eventful {
keydown(e) {
if (this._keyOnDownUp && !e.repeat) {
const currentEvent = keyboardEvents[e.key.toUpperCase()]||{event:""};
const currentEvent = keyboardEvents[e.key.toUpperCase()] || {event:''};
this.trigger(this.events.Keyboard, currentEvent.event);
}
}

View File

@ -54,6 +54,7 @@ class MouseController extends Eventful {
zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this);
zr.on('dblclick', this.dblclick, this);
zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this);
@ -66,6 +67,7 @@ class MouseController extends Eventful {
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
zr.off('dblclick', this.dblclick);
};
this.dispose = function () {
@ -83,6 +85,11 @@ class MouseController extends Eventful {
this.isAllowDragging = data;
}
dblclick(e) {
var em = this.checkEvent(e);
this.trigger(this.events.dblclick, em);
}
mousedown(e) {
e.event.preventDefault();
e.event.stopPropagation();

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Vue from 'vue';
export default class rect extends Group {
constructor(device) {
@ -10,24 +11,36 @@ export default class rect extends Group {
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
this.createMouseEvent();
}
createMouseEvent() {
this.on('mouseout', (e) => {
this.hide();
});
}
create() {
let rect = null;
for (const key in this.model.elemMap) {
if (!rect) {
rect = Vue.prototype.$iscs.iscsDevice[key].instance.getBoundingRect();
} else {
rect.union(Vue.prototype.$iscs.iscsDevice[key].instance.getBoundingRect());
}
}
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
position: [rect.x, rect.y]
});
console.log(model);
// 处理内部元素的包围框
const rectWidth = 120;
const rectHeight = 60;
const rectWidth = rect.width + 10;
const rectHeight = rect.height + 10;
this.iscsRect = new Rect({
zlevel: model.zlevel,
z: model.z,
z2: model.z2 || 0,
z: 15, // 层级最高
shape: {
x: 0,
y: 0,
x: -5,
y: -5,
width: rectWidth,
height: rectHeight
},
@ -39,9 +52,16 @@ export default class rect extends Group {
});
this.grouper.add(this.iscsRect);
this.add(this.grouper);
this.grouper.hide();
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
show() {
this.grouper.show();
}
hide() {
this.grouper.hide();
}
}

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Circle from 'zrender/src/graphic/shape/Circle';
import Vue from 'vue';
export default class iscsCircle extends Group {
constructor(device) {
@ -10,6 +11,17 @@ export default class iscsCircle extends Group {
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
if (this.model.groupId) {
this.createMouseEvent();
}
}
createMouseEvent() {
// this.on('mouseout', (e) => {
// Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.hide();
// });
this.on('mouseover', (e) => {
Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.show();
});
}
create() {
const model = this.model;
@ -35,8 +47,18 @@ export default class iscsCircle extends Group {
this.grouper.add(this.iscsCircle);
this.add(this.grouper);
}
setState(model) {
this.iscsCircle.setStyle('fill', model.fillColor);
this.iscsCircle.setStyle('stroke', model.strokeColor);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
getBoundingRect() {
const rect = this.iscsCircle.getBoundingRect().clone();
rect.x = rect.x + this.model.point.x;
rect.y = rect.y + this.model.point.y;
return rect;
}
}

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Vue from 'vue';
export default class rect extends Group {
constructor(device) {
@ -10,6 +11,18 @@ export default class rect extends Group {
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
if (this.model.groupId) {
this.createMouseEvent();
}
}
createMouseEvent() {
// this.on('mouseout', (e) => {
// Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.hide();
// });
this.on('mouseover', (e) => {
Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.show();
});
}
create() {
const model = this.model;
@ -46,4 +59,10 @@ export default class rect extends Group {
this.model.point.x += dx;
this.model.point.y += dy;
}
getBoundingRect() {
const rect = this.iscsRect.getBoundingRect().clone();
rect.x = rect.x + this.model.point.x;
rect.y = rect.y + this.model.point.y;
return rect;
}
}

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import Vue from 'vue';
export default class text extends Group {
constructor(device) {
@ -10,6 +11,17 @@ export default class text extends Group {
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
if (this.model.groupId) {
this.createMouseEvent();
}
}
createMouseEvent() {
// this.on('mouseout', (e) => {
// Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.hide();
// });
this.on('mouseover', (e) => {
Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.show();
});
}
create() {
@ -61,4 +73,10 @@ export default class text extends Group {
this.model.width = width;
this.model.height = height;
}
getBoundingRect() {
const rect = this.textName.getBoundingRect().clone();
rect.x = rect.x + this.model.point.x;
rect.y = rect.y + this.model.point.y;
return rect;
}
}

View File

@ -1,6 +1,6 @@
export default {
Fixed: { lab: 'Fixed', describe: '状态值不做处理,请选择该类型'}, // 固定值
A: { lab: 'a', describe: '文字 远/近 状态转换类型'}, // 远
B: { lab: 'b', describe: '开关阀门矩形 状态转换类型'}, // 红框 阀门
C: { lab: 'c', describe: '电流电压文字转换类型'} // 数组
Fixed: { lab: 'Fixed', describe: '状态值不做处理'}, // 固定值
A: { lab: 'a', describe: '文字远/近类型'}, // 远
B: { lab: 'b', describe: '开关阀门类型'}, // 红框 阀门
C: { lab: 'c', describe: '电流电压类型'} // 数组
};

View File

@ -7,6 +7,10 @@ export default {
{type: elType.A},
{type: elType.B},
{type: elType.C}
],
statusList: [
{ key: 'valve', value: true, des: '某某开关分闸', childList: [{type: 'b', status: 'stateB'}] },
{ key: 'valve', value: false, des: '某某开关分闸', childList: [{type: 'b', status: 'stateA'}] }
]
}
};

View File

@ -17,12 +17,13 @@ class TransformHandle {
}
revisibleView(view) {
if (view._type != 'IscsGroup') {
if (this.checkVisible(view)) {
view.show();
} else {
view.hide();
}
}
view.dirty();
}

View File

@ -226,7 +226,7 @@ export function parser(data) {
zrUtil.each(data.fuzhouPsdList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.FuzhouPsd, elem);
});
zrUtil.each(data.IscsGroupList || [], elem=> {
zrUtil.each(data.iscsGroupList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.IscsGroup, elem);
});
}

View File

@ -333,8 +333,13 @@ export function JLmap3dEdit(dom, data, mapid) {
plane2.stopType = "right";
plane1.rotation.y = Math.PI/2;
plane2.rotation.y = Math.PI/2;
plane1.position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].leftStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
plane2.position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].rightStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
let leftpos = scope.mapdata.sectionlist.sections.datalist[k].leftStopPercent*(scope.mapdata.sectionlist.sections.datalist[k].railpoint[2].x -scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x)+scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x;
let rightpos = scope.mapdata.sectionlist.sections.datalist[k].rightStopPercent*(scope.mapdata.sectionlist.sections.datalist[k].railpoint[2].x -scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x)+scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x;
console.log("==========");
console.log(scope.mapdata.sectionlist.sections.datalist[k].leftStopPercent);
console.log(scope.mapdata.sectionlist.sections.datalist[k].rightStopPercent);
plane1.position.set(leftpos,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
plane2.position.set(rightpos,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
stationStopGroup.add(plane1);
stationStopGroup.add(plane2);
}

View File

@ -989,7 +989,7 @@ export function SectionList() {
}
console.log(scope.sections.datalist);
for(let i=0;i<section2d.length;i++){
if(section2d[i].type == "01" || section2d[i].type == "03"){
if(scope.sections.datalist[section2d[i].code]){
@ -1003,9 +1003,11 @@ export function SectionList() {
scope.sections.datalist[section2d[i].code].standLeftY = section2d[i].points[0].y;
scope.sections.datalist[section2d[i].code].standRightLeftX = section2d[i].points[1].x;
scope.sections.datalist[section2d[i].code].standRightRightY = section2d[i].points[1].y;
scope.sections.datalist[section2d[i].code].leftStopPointOffset = section2d[i].leftStopPointOffset;
scope.sections.datalist[section2d[i].code].rightStopPointOffset = section2d[i].leftStopPointOffset+120;
scope.sections.datalist[section2d[i].code].leftStopPercent = section2d[i].leftStopPointOffset/section2d[i].lengthFact;
scope.sections.datalist[section2d[i].code].rightStopPercent = section2d[i].rightStopPointOffset/section2d[i].lengthFact;
}
}

View File

@ -195,7 +195,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
renderer.sortObjects = true;
windowWidth = dom.offsetWidth ;
windowHeight = dom.offsetHeight;
@ -1307,6 +1307,13 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
fclip = new THREE.AnimationClip("four",2,ntracks2);
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 8;
}
} );
toptrain = object.clone(true);
@ -1452,6 +1459,13 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
}
}
station = object;
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
} );
// console.log(deviceaction);
scene.add(object);

View File

@ -84,7 +84,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
}
}
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList,3);
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList,1.3);
// assetloader.setmodellistnew(netdata.assets);

View File

@ -23,7 +23,7 @@ export default class ELimitLines extends Group {
let y = traingle.dricty * (style.Section.speedLimit.distance) * traingle.getCosRate();
if (x == Infinity) { x = 0; }
if (y == Infinity) { y = 0; }
if (model.switch) {
// if (model.switch) {
// 上侧临时限速线
const speedLimitLeft = this.createLimit({
position: [x, -y],
@ -50,7 +50,7 @@ export default class ELimitLines extends Group {
speedLimitRight.forEach(item => {
this.add(item);
});
}
// }
}
}

View File

@ -0,0 +1,129 @@
import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan';
export default {
/** 边缘高度*/
EdgeHeight: 600,
/** 间隔高度*/
CoordMultiple: 1,
/** 偏移时间*/
TranslationTime: 0,
/** 将后台数据解析成图表*/
convertDataToModels(tripList, stations, kmRangeCoordMap, lineStyle) {
var models = [];
/** 按车次遍历数据*/
if (tripList && tripList.length) {
tripList.forEach(trip => {
const opt = { name: `run-${trip.tripNo}`, type: 'line', markPoint: { data: [] }, data: []};
if (trip.tripNo &&
trip.stationTimeList.length) {
opt.markPoint.data.push(createMartPointReverse({
name: `${trip.tripNo}`,
color: '#000' || lineStyle.color,
coord: [
trip.stationTimeList[0].arrivalTime,
this.getCoordYByElem(stations, kmRangeCoordMap, trip.stationTimeList[0])
]
}));
}
/** 计算停站点坐标集合*/
trip.stationTimeList.forEach(elem => {
if (elem.arrivalTime) {
opt.data.push([elem.arrivalTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
}
if (elem.departureTime) {
opt.data.push([elem.departureTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
}
});
models.push(opt);
});
}
console.log(models);
return models;
},
/** 更新数据并解析成图表*/
updateDataToModels(tripList, stations, kmRangeCoordMap, runPlanData, series, lineStyle) {
if (tripList && tripList.length) {
}
return series;
},
/** 初始化Y轴*/
initializeYaxis(stations) {
return createMarkLineModels(stations, (elem) => {
return this.EdgeHeight + elem.kmRange * this.CoordMultiple;
});
},
/** 将后台数据转换为试图序列模型*/
convertStationsToMap(stations) {
var map = {};
if (stations && stations.length) {
stations.forEach((elem) => {
map[`${elem.kmRange}`] = this.EdgeHeight + elem.kmRange * this.CoordMultiple;
});
}
return map;
},
/** 计算y轴最小值*/
computedYaxisMinValue(stations) {
return stations[0].kmRange * this.CoordMultiple;
},
/** 计算y轴最大值*/
computedYaxisMaxValue(stations) {
return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight * 2;
},
/** 格式化y轴数据*/
computedFormatYAxis(stations, params) {
var yText = '0m';
stations.forEach(elem => {
if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) {
yText = Math.floor(elem.kmRange) + 'm';
}
});
return yText;
},
/** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/
computedReentryNumber(code) {
// return parseInt(code || 1) % 2 ? 1 : 2;
return 1;
},
/** 根据方向计算y折返偏移量*/
getYvalueByDirectionCode(defaultVlue, directionCode, num) {
if (directionCode === '1') {
defaultVlue += this.EdgeHeight / 2 * num;
} else if (directionCode === '2') {
defaultVlue -= this.EdgeHeight / 2 * num;
}
return defaultVlue;
},
/** 根据elem计算y值*/
getCoordYByElem(stations, kmRangeCoordMap, elem) {
var defaultVlue = 0;
var station = stations.find(it => { return it.code == elem.stationCode; });
if (station) {
defaultVlue = kmRangeCoordMap[`${station.kmRange}`];
}
return defaultVlue;
}
};

View File

@ -2,6 +2,7 @@ class Theme {
constructor(code) {
this._code = '02';
this._mapMenu = {
'00': 'aus_00',
'01': 'chengdu_01',
'02': 'fuzhou_01',
'03': 'beijing_01',

View File

@ -86,6 +86,7 @@ const DemonstrationDetail = () => import('@/views/demonstration/detail/index');
const PlanMonitorEditTool = () => import('@/views/planMonitor/editTool/index');
const PlanMonitorEditUserTool = () => import('@/views/planMonitor/editTool/userindex');
const PlanMonitorEditAUSTool = () => import('@/views/planMonitor/editToolAUS/index');
const PlanMonitorDetail = () => import('@/views/planMonitor/detail');
const DesignPlatformHome = () => import('@/views/designPlatform/home');
@ -370,6 +371,11 @@ export const publicAsyncRoute = [
component: PlanMonitorEditUserTool,
hidden: true
},
{ // 运行图编辑
path: '/plan/AUStool',
component: PlanMonitorEditAUSTool,
hidden: true
},
{ // 运行图编辑
path: '/plan/tool',
component: PlanMonitorEditTool,

View File

@ -128,7 +128,9 @@ export const DeviceMenu = {
SetDriver: '106',
Script: '107',
IscsSystem: '108',
IscsInterface: '109'
IscsInterface: '109',
planAusContextMenu: '200'
};
/**

View File

@ -16,6 +16,7 @@ import scriptRecord from './modules/scriptRecord';
import ibp from './modules/ibp';
import order from './modules/order';
import iscs from './modules/iscs';
import rpTools from './modules/rpTools';
import getters from './getters';
@ -38,7 +39,8 @@ const store = new Vuex.Store({
scriptRecord,
ibp,
order,
iscs
iscs,
rpTools
},
getters
});

View File

@ -33,6 +33,13 @@ const iscs = {
updateDeviceData: (state) => {
return state.updateDeviceData;
},
iscsGroupList: (state) => {
if (state.iscs) {
return state.iscs.iscsGroupList || [];
} else {
return [];
}
},
vidiconList: (state) => {
if (state.iscs) {
return state.iscs.vidiconList;
@ -129,6 +136,9 @@ const iscs = {
},
selectedCount: (state) => {
return state.selectedCount;
},
getDeviceByCode: (state) => (code) => {
return state.iscsDevice[code];
}
},

View File

@ -0,0 +1,93 @@
const runPlan = {
namespaced: true,
state: {
stations: [], // 车站列表
planData: {}, // 运行图原始数据
editData: {}, // 运行图编辑数据
planSizeCount: 0, // 运行图canvas 大小变更标识
planLoadedCount: 0, // 运行图数据更新
planUpdateCount: 0, // 运行图更新标识
selected: {}, // 选择的对象
refreshCount: 0, // 刷新页面重新加载
width: 800, // 运行图canvas 容器 宽度
height: 600, // 运行图canvas 容器 高度
},
getters: {
stations: (state) => {
return state.stations || [];
}
},
mutations: {
setWidth: (state, width) => {
state.width = width;
state.planSizeCount += 1;
},
setHeight: (state, height) => {
state.height = height;
state.planSizeCount += 1;
},
setStations: (state, stations) => {
state.stations = stations;
},
setPlanData: (state, data) => {
state.planData = data;
state.editData = {};
state.planLoadedCount++;
},
setSelected: (state, selected) => {
state.selected = selected;
},
clear: (state) => {
state.planData = {};
state.editData = {};
state.selected = {};
},
refresh: (state) => {
state.refreshCount++;
}
},
actions: {
/** 设置运行图大小*/
resize({ commit }, opt) {
if (opt.width) {
commit('setWidth', opt.width);
}
if (opt.height) {
commit('setHeight', opt.height);
}
},
/** 设置stations数据 */
setStations: ({ commit }, mapModel) => {
return new Promise((resolve) => {
commit('setStations', mapModel);
resolve(mapModel);
});
},
/** 设置运行图数据 */
setPlanData: ({ commit }, data) => {
commit('setPlanData', data);
},
/** 选择车次*/
setSelected: ({ commit }, selected) => {
commit('setSelected', selected);
},
/** 更新数据*/
updateRunPlanData: ({ commit }, data) => {
commit('updateRunPlanData', data);
},
/** 清空数据*/
clear: ({ commit }) => {
return new Promise((resolve) => {
commit('clear');
resolve();
});
},
/** 刷新页面*/
refresh: ({commit}) => {
commit('refresh');
}
}
};
export default runPlan;

View File

@ -3,11 +3,11 @@
<el-card type="border-card" class="heightClass">
<div slot="header" class="clearfix">
<el-button type="text" style="float: right; padding: 3px 0; margin-right: 5px;" @click="handleSave">{{ $t('ibp.save') }}</el-button></div>
<el-tabs class="mapEdit" type="border-card" v-model="active">
<el-tabs v-model="active" class="mapEdit" type="border-card">
<el-tab-pane name="first" label="自定用创建">
<tab-custom style="width: 100%; height: 100%;" @createDataModel="createDataModel" @deleteDataModel="deleteDataModel" />
</el-tab-pane>
<el-tab-pane name="second" label="模板创建">
<el-tab-pane name="second" label="模板选择">
<tab-template style="width: 100%; height: 100%;" @createDataModel="createDataModel" @deleteDataModel="deleteDataModel" />
</el-tab-pane>
</el-tabs>
@ -27,7 +27,7 @@ export default {
data() {
return {
active: 'first'
}
};
},
methods: {
createDataModel(models) {
@ -42,9 +42,9 @@ export default {
handleSave() {
const data = JSON.stringify(this.$store.state.iscs.iscs);
this.$emit('handleSave', data);
},
}
}
};
</script>
<style lang="scss" scoped>
.map-control {

View File

@ -1,7 +1,7 @@
<template>
<div class="flex-inline">
<el-select size="mini" v-model="type" clearable placeholder="请选择元素类型">
<el-option v-for="item in options" :key="item.lab" :label="item.describe" :value="item.lab"></el-option>
<el-select v-model="type" size="mini" clearable placeholder="请选择元素类型">
<el-option v-for="item in options" :key="item.lab" :label="item.describe" :value="item.lab" />
</el-select>
<el-button size="mini" type="primary" @click="doCreate">添加</el-button>
</div>
@ -18,14 +18,14 @@ export default {
data() {
return {
type: ''
}
};
},
methods: {
doCreate() {
this.$emit('create', this.type);
}
}
}
};
</script>
<style lang="scss" scoped>
.flex-inline {

View File

@ -5,18 +5,18 @@
<el-input v-model="formModel.name" placeholder="请输入组名称" />
</el-form-item>
<el-form-item label="组类型" prop="name">
<el-select v-model="formModel.type" clearable placeholder="请选择组类型">
<el-option v-for="item in grTypeList" :key="item.lab" :label="item.describe" :value="item.lab"></el-option>
<el-select v-model="formModel.type" clearable placeholder="请选择组类型" @change="changeType">
<el-option v-for="item in grTypeList" :key="item.lab" :label="item.describe" :value="item.lab" />
</el-select>
</el-form-item>
<el-form-item label="元素列表" prop="elemList" />
<el-table stripe border :data="formModel.elemList" style="width: 100%" height="500px">
<el-table stripe border :data="formModel.elemList" style="width: 100%; margin-bottom: 20px;" height="300px">
<el-table-column align="center">
<template slot="header">
<el-create :options="elTypeList" @create="handleCreate" />
</template>
<el-table-column type="index" width="50" />
<el-table-column label="元素类型" prop="type" />
<el-table-column label="元素类型" prop="des" />
<el-table-column label="元素编码" prop="code" />
<el-table-column width="180">
<template slot-scope="scope">
@ -26,22 +26,66 @@
</el-table-column>
</el-table-column>
</el-table>
<el-form-item label="状态列表" />
<el-table stripe border :data="formModel.statusList" style="width: 100%; margin-bottom: 50px;" height="300px">
<el-table-column align="center">
<template slot="header">
<el-button size="mini" type="primary" style="float: right;" @click="createStatus">添加</el-button>
</template>
<el-table-column label="描述" prop="des" width="60">
<template slot-scope="scope" style="padding: 0;">
<el-input v-model="scope.row.des" style="position: absolute;left: 0;top: 6px;" class="no_padding_input" />
</template>
</el-table-column>
<el-table-column label="字段" prop="key" width="62">
<template slot-scope="scope">
<el-input v-model="scope.row.key" style="position: absolute;left: 0;top: 6px;" class="no_padding_input" />
</template>
</el-table-column>
<el-table-column label="值" prop="value" width="52">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.value" />
</template>
</el-table-column>
<el-table-column label="关联">
<template slot-scope="scope">
<el-tag v-for="(tag, index) in scope.row.childList" :key="index" closable @close="handleClose(tag, scope.row.childList)">
{{ tag.type }}--{{ tag.status }}
</el-tag>
<!-- {{ elemCode }} -->
<el-select v-model="elemStatusType" size="small" clearable placeholder="" @change="changeStatus">
<el-option v-for="item in elTypeList" :key="item.lab" :label="item.describe" :value="item.lab" />
</el-select>
<el-select v-model="elemStatus" size="small" clearable>
<el-option v-for="item in optionsList" :key="item" :label="item" :value="item" />
</el-select>
<!-- <el-button size="mini" :type="activeChild == scope.$index? 'danger': ''" @click="handleActiveChild(scope.$index, scope.row)">激活</el-button> -->
<el-button size="small" @click="addChildElement(scope.row)">添加</el-button>
</template>
</el-table-column>
<el-table-column width="80">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="handleDeleteStatus(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table-column>
</el-table>
<div class="footer">
<el-button style="margin-left:10px" type="primary" @click="doCreateGroup">创建</el-button>
<!-- <el-button style="margin-left:10px" type="info" @click="doUpdeteGroup">修改</el-button>
<el-button style="margin-left:10px" type="danger" @click="doDeleteGroup">删除</el-button> -->
<el-button style="margin-left:10px" size="small" type="primary" @click="doCreateGroup">创建</el-button>
</div>
</el-form>
</div>
</template>
<script>
import elType from '@/iscs/status/elType.js';
import grType from '@/iscs/status/grType.js';
import mapGroup from '@/iscs/status/mapGroup.js';
import mapElement from '@/iscs/status/mapElement.js';
import elCreate from './create';
import deviceType from '@/iscs/constant/deviceType.js';
import {getUID} from '@/iscs/utils/Uid';
import { mapGetters } from 'vuex';
export default {
components: {
@ -50,30 +94,39 @@ export default {
data() {
return {
active: -1,
activeChild: -1,
elemCode: '',
elemStatus: '',
elemStatusType: '',
optionsList: [],
formModel: {
name: '',
type: '',
elemList: []
elemList: [],
statusList: []
},
grTypeList: [],
elTypeList: [],
elTypeMap: {}
}
};
},
computed: {
rules() {
return {
name: [
{ required: true, message: '请输入组名称', trigger: 'blur' },
{ required: true, message: '请输入组名称', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择组类型', trigger: 'change' },
{ required: true, message: '请选择组类型', trigger: 'change' }
],
elemList: [
{ type: 'array', required: true, message: '组元素不能为空', trigger: 'change' },
{ type: 'array', required: true, message: '组元素不能为空', trigger: 'change' }
]
}
}
};
},
...mapGetters('iscs', [
'iscs'
])
},
watch: {
'$store.state.iscs.rightClickCount': function (val) {
@ -82,27 +135,41 @@ export default {
}
},
created() {
this.elTypeMap = {}
this.elTypeMap = {};
this.grTypeList = Object.values(grType);
this.elTypeList = Object.values(elType);
Object.values(grType).forEach(el => {
this.elTypeMap[el.lab] = el;
})
});
// this.optionsListObj = mapElement;
},
methods: {
changeType(type) {
this.formModel.elemList = [];
type && mapGroup[type].elemList.forEach(item => {
this.formModel.elemList.push({ type: item.type.lab, des: item.type.describe, code: '' });
});
this.formModel.statusList = [];
type && mapGroup[type].statusList.forEach(item => {
this.formModel.statusList.push({ childList: [], ...item});
});
},
handleActive(index, row) {
this.active = this.active == index ? -1 : index;
},
handleActiveChild(index, row) {
this.activeChild = this.activeChild == index ? -1 : index;
},
handleDelete(index, row) {
this.formModel.elemList.splice(index, 1);
this.active = -1;
},
handleCreate(type) {
handleCreate(type, describe) {
if (type) {
console.log(type);
this.formModel.elemList.push({ type: type, code: '' })
const opt = this.elTypeList.filter(ele => ele.lab == type);
this.formModel.elemList.push({ type: type, des: opt[0].describe, code: '' });
} else {
this.$message.info('请选择元素类型')
this.$message.info('请选择元素类型');
}
},
handleSetSelect(model) {
@ -110,39 +177,65 @@ export default {
if (this.active >= 0) {
if (elem) { elem.code = model.code; }
this.active = -1;
} else {
this.formModel = {}
this.isUpdate = true;
}
if (this.activeChild >= 0) {
this.elemCode = model.code;
this.activeChild = -1;
}
},
doCreateGroup() {
const modelList = [];
const model = {
code: getUID('group'),
code: getUID('group', this.iscs.iscsGroupList),
_type: deviceType.IscsGroup,
name: this.formModel.name,
type: this.formModel.type,
elemMap: {}
}
elemMap: {},
statusList: this.formModel.statusList
};
this.formModel.elemList.forEach(el => {
model.elemMap[el.code] = el;
const device = this.$iscs.iscsDevice[el.code];
if (device &&
device.model) {
device.groupId = model.code;
modelList.push(device.model)
if (device && device.model) {
device.model['groupId'] = model.code;
modelList.push(device.model);
}
});
this.$emit('createDataModel', modelList.concat(model));
this.formModel = {
name: '',
type: '',
elemList: [],
statusList: []
};
},
doUpdateGroup() {
changeStatus(type) {
if (mapElement[type]) {
this.optionsList = Object.keys(mapElement[type].stateMap);
} else {
this.optionsList = [];
}
},
doDeleteGroup() {
}
createStatus() {
this.formModel.statusList.push({ childList: [], key: '', value: '', des: '' });
},
addChildElement(row) {
row.childList.push({ type: this.elemStatusType, status: this.elemStatus });
this.elemCode = '';
this.elemStatusType = '';
this.elemStatus = '';
},
handleDeleteStatus(index, row) {
this.formModel.statusList.splice(index, 1);
this.activeChild = -1;
},
handleClose(tag, row) {
row.splice(row.indexOf(tag), 1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -161,4 +254,10 @@ export default {
z-index: 9,
}
}
</style>>
</style>
<style>
.no_padding_input .el-input__inner{
padding: 0;
text-align: center;
}
</style>

View File

@ -1,17 +1,129 @@
<template>
<div class="template">
开发中
<el-form ref="form" label-width="160" size="mini" :model="formModel" class="form_data">
<el-form-item label="编组code" prop="code">
<el-select
v-model="formModel.code"
filterable
clearable
@change="deviceChange"
>
<el-option
v-for="option in iscsGroupList"
:key="option.code"
:label="option.name"
:value="option.code"
/>
</el-select>
</el-form-item>
<el-form-item label="编组名称:" prop="name">
<el-input v-model="formModel.name" placeholder="请输入内容" style="width: 220px;" />
</el-form-item>
<el-form-item label="编组code:" prop="code">
<div>{{ formModel.code }}</div>
</el-form-item>
<el-form-item label="编组元素:">
<el-tag v-for="(item, index) in formModel.elemList" :key="index" style="margin-right: 10px; margin-bottom: 8px;">{{ item.code }}</el-tag>
</el-form-item>
</el-form>
<div class="footer">
<el-button type="primary" size="small" style="margin-left:10px" @click="onSubmit">修改</el-button>
<el-button style="margin-left:10px" type="danger" size="small" @click="doDeleteGroup">删除</el-button>
<el-button style="margin-left:10px" type="primary" size="small" @click="groupAllShow">全部显示</el-button>
<el-button style="margin-left:10px" type="primary" size="small" @click="groupAllHide">全部隐藏</el-button>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
data() {
return {
formModel: {
code: '',
name: '',
elemMap: {},
elemList: []
},
selectedModel: {}
};
},
computed: {
...mapGetters('iscs', [
'iscsGroupList'
])
},
methods: {
deviceChange(code) {
this.groupAllHide();
if (code) {
this.deviceSelect(this.$iscs.iscsDevice[code]);
const device = this.$iscs.iscsDevice[code];
device.instance.show();
} else {
this.formModel = {
code: '',
name: '',
elemMap: {},
elemList: []
};
}
},
deviceSelect(selected) {
this.formModel.name = selected.model.name;
this.formModel.elemMap = selected.model.elemMap;
this.formModel.elemList = [];
for (const key in selected.model.elemMap) {
this.formModel.elemList.push(selected.model.elemMap[key]);
}
this.selectedModel = selected.model;
},
onSubmit() {
this.selectedModel.name = this.formModel.name;
this.$emit('createDataModel', this.selectedModel);
this.formModel = {
code: '',
name: '',
elemMap: {},
elemList: []
};
},
doDeleteGroup() {
const Model = {
code: this.formModel.code,
_type: 'IscsGroup'
};
this.$emit('deleteDataModel', Model);
const modelList = [];
for (const key in this.formModel.elemMap) {
const device = this.$iscs.iscsDevice[key];
if (device && device.model) {
device.model['groupId'] = '';
modelList.push(device.model);
}
}
this.$emit('createDataModel', modelList);
this.formModel = {
code: '',
name: '',
elemMap: {}
};
},
groupAllShow() {
this.iscsGroupList.forEach(group => {
const device = this.$iscs.iscsDevice[group.code];
device.instance.show();
});
},
groupAllHide() {
this.iscsGroupList.forEach(group => {
const device = this.$iscs.iscsDevice[group.code];
device.instance.hide();
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,14 +1,19 @@
<template>
<div class="iscsCanvas">
<div :id="iscsId" v-loading="loading" :style="{ width: widthCanvas +'px', height: canvasHeight +'px' }" class="iscs-canvas" />
<valve-dialog ref="valve" />
</div>
</template>
<script>
import Vue from 'vue';
import { parser } from '@/iscs/utils/parser';
import Iscs from '@/iscs/iscs';
import ValveDialog from '../dialog/valve';
export default {
name: 'IscsStation',
components: {
ValveDialog
},
props: {
size: {
type: Object,
@ -56,6 +61,16 @@ export default {
Vue.prototype.$iscs = this.$iscs;
this.setIscs(parserData, iscsData);
this.$store.dispatch('iscs/setIscsData', iscsData);
if (this.$route.query.group) {
this.$iscs.on('dblclick', this.onDblclick, this);
}
},
onDblclick(em) {
//
if (em.deviceType == 'IscsGroup') {
this.$iscs.iscsDevice[em.deviceModel.code].instance.hide();
this.$refs.valve.doShow(em.deviceModel);
}
},
handleViewLoaded() {
this.loading = false;
@ -83,4 +98,73 @@ export default {
overflow-x: hidden;
}
</style>
<style>
.iscs_fuzhou-01__systerm .el-dialog {
background: rgba(100, 100, 100, 0.3);
border: 2px solid rgb(144, 144, 144, 0.8);
border-radius: 6px;
color: #000;
font-size: 14px;
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__header {
padding: 5px;
height: 26px;
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__footer {
background: #F0F0F0;
opacity: 1;
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__body {
padding-top: 10px;
padding-bottom: 10px;
padding-left: 5px;
padding-right: 5px;
margin: 0px 5px 5px;
border: 2px solid rgba(120, 121, 123, 0.5);
box-shadow: 1px hsla(240, 0%, 100%, 0.5) inset;
background: #F0F0F0;
opacity: 1;
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__title {
position: absolute;
top: 4px;
color: #000;
border-radius: 4px;
padding: 0px 2px;
height: 20px;
line-height: 20px
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__title::before {
content: '';
position: absolute;
top: 0;
left: 0;
-webkit-filter: blur(10px);
filter: blur(10px);
height: 20px;
width: -webkit-fill-available;
background: rgba(128, 128, 128, 0.8);
z-index: -1;
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__headerbtn {
background: linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
border: 1px solid #fff;
border-radius: 4px;
top: 4px;
right: 5px;
line-height: 16px;
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__headerbtn .el-icon-close:before {
font-size: 16px;
}
.iscs_fuzhou-01__systerm .el-dialog .el-dialog__headerbtn .el-dialog__close {
color: #fff;
}
</style>

View File

@ -0,0 +1,173 @@
<template>
<div>
<el-dialog
v-dialogDrag
class="iscs_fuzhou-01__systerm route-detail"
:title="title"
:visible.sync="show"
width="500px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-table border :data="elemList" style="width: 100%;" height="300px">
<el-table-column label="描述" prop="name" />
<el-table-column label="类型" prop="types" />
<el-table-column label="状态" prop="status" />
<el-table-column label="操作" width="120">
<template slot-scope="scope" style="padding: 0;">
<el-button size="mini" type="" style="width: 100%; height: 100%" @click="handleOption(scope.$index, scope.row)">{{ scope.row[scope.row.key] ? list[scope.row.key][0] : list[scope.row.key][1] }}选择</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog
v-dialogDrag
class="iscs_fuzhou-01__systerm route-detail"
title="请执行或取消操作"
:visible.sync="showSublayer"
width="400px"
:before-close="doCloseSublayer"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form label-width="100px" size="small" label-position="left" :model="formModel">
<el-form-item label="控制点">
<div style="line-height: 15px; box-shadow: 0px 0px 2px inset #a2a2a2; padding: 5px;">{{ formModel.name }}</div>
</el-form-item>
<el-form-item label="控制动作">
<div style="line-height: 15px; box-shadow: 0px 0px 2px inset #a2a2a2; padding: 5px;">{{ formModel.action }}</div>
</el-form-item>
<el-form-item label="操作信息">
<div style="line-height: 15px; box-shadow: 0px 0px 2px inset #a2a2a2; padding: 5px;">{{ formModel.info }}</div>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button type="primary" @click="commit">执行</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button @click="doCloseSublayer">取消</el-button>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<script>
import mapElement from '@/iscs/status/mapElement.js';
import {deviceFactory} from '@/iscs/utils/parser';
export default {
name: '',
data() {
return {
dialogShow: false,
showSublayer: false,
activeIndex: -1,
title: '',
rowData: {},
elemList: [],
model: {},
formModel: {
name: '35KV高压开关室 35KV动力变馈线柜-CT5/1',
action: '短路器遥控开关分闸',
info: ''
},
list: {
valve: ['控合', '控分']
}
};
},
computed: {
show() {
return this.dialogShow;
}
},
methods: {
doShow(models) {
this.model = models;
console.log(models);
this.dialogShow = true;
this.title = models.name || '弹窗名称';
this.elemList = [];
models.statusList.forEach(item => {
if (!this.elemList.length) {
this.elemList = [
{
name: item.des,
types: 'DO',
key: item.key,
status: '',
[item.key]: models[item.key] || false
}
];
} else {
const arr = this.elemList.filter(ele => ele.key == item.key);
if (!arr.length) {
this.elemList.push({
name: item.des,
types: 'DO',
key: item.key,
status: '',
[item.key]: false
});
}
}
});
},
commit() {
this.showSublayer = false;
this.rowData[this.rowData.key] = !this.rowData[this.rowData.key];
this.elemList.splice(this.activeIndex, 1, this.rowData);
this.model[this.rowData.key] = this.rowData[this.rowData.key];
const arr = [];
this.model.statusList.forEach(item => {
if (item.key == this.rowData.key && item.value === this.rowData[this.rowData.key]) {
item.childList.forEach(ele => {
Object.values(this.model.elemMap).forEach(elem => {
if (elem.type == ele.type) {
arr.push({
code: elem.code,
...mapElement[ele.type].stateMap[ele.status]
});
}
});
// const data = this.model.elemMap
});
}
});
const models = [{...this.model, [this.rowData.key]: this.rowData[this.rowData.key]}];
this.$store.dispatch('iscs/updateIscsDevices', models.map(el => {
const device = deviceFactory(el._type, el);
return device.model;
}));
//
arr.forEach(el => {
const device = this.$iscs.iscsDevice[el.code];
if (device && device.instance) {
device.instance.setState(el);
}
});
},
doClose() {
this.dialogShow = false;
},
handleOption(index, row) {
this.activeIndex = index;
this.formModel.info = row[row.key] ? this.list[row.key][0] : this.list[row.key][1];
this.rowData = JSON.parse(JSON.stringify(row));
this.showSublayer = true;
},
doCloseSublayer() {
this.showSublayer = false;
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -147,6 +147,7 @@ export default {
this.$iscs.on('contextmenu', this.onContextMenu, this);
if (this.$route.query.group) {
this.$iscs.on('selected', this.onSelected, this);
this.$iscs.on('dblclick', this.onDblclick, this);
}
if (this.$route.path.startsWith('/iscs/design')) {
@ -236,6 +237,10 @@ export default {
},
//
onSelected(em) {
console.log(em);
},
onDblclick(em) {
console.log(em);
},
//
onContextMenu(em) {

View File

@ -300,17 +300,6 @@ export default {
this.filterNode();
if (activeTrainList.length <= 0) {
this.resetCoversition();
this.treeData.forEach(item => {
if (item.children) {
const memberList = Object.values(item.children);
memberList.forEach(data =>{
data.active = false;
data.isConnect = false;
data.loading = false;
data.disabled = false;
});
}
});
}
// if (this.$refs.tree) {
// this.$refs.tree.filter(this.queryMember);
@ -941,6 +930,18 @@ export default {
this.commonMessageList = [];
this.conversitionStateMap = {};
this.messageList = this.commonMessageList;
this.treeData.forEach(item => {
if (item.children) {
const memberList = Object.values(item.children);
memberList.forEach(data =>{
data.active = false;
data.isConnect = false;
data.loading = false;
data.disabled = false;
data.isInviting = false;
});
}
});
}
}
};

View File

@ -9,8 +9,9 @@
</div>
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage">
<span class="el-icon-video-play playicon" />
<span class="messageText">{{ chatContent.content }}</span>
<!-- <span class="el-icon-video-play playicon" /> -->
<img :src="yuyin" alt="playicon1">
<!-- <span class="messageText">{{ chatContent.content }}</span> -->
</div>
</div>
<audio id="audioPlay" style="display:none" />
@ -20,7 +21,7 @@
</div>
</template>
<script>
import yuyin from '@/assets/yuyin.png';
export default {
props:{
messageList:{
@ -68,6 +69,7 @@ export default {
return {
chatContentList:[],
currentAudioList:[],
yuyin:yuyin,
currentAudioIndex:0,
isPlay:false,
baseUrl:process.env.VUE_APP_VOICE_API
@ -176,9 +178,11 @@ export default {
.userName{font-size: 12px;display:inline-block;margin-right:10px;}
.userChatTime{font-size: 12px;display:inline-block;}
.userBubble{
max-width: 200px;
font-size: 12px;
padding: 10px;
// max-width: 200px;
// padding: 10px;
padding: 5px 10px 6px 10px;
width: 140px;
background: #ccc;
border-radius: 5px;
cursor: pointer;
@ -188,6 +192,9 @@ export default {
font-size: 20px;
vertical-align: top;
}
.playicon1{
width:17px;
}
.textRight{text-align: right;}
.userMessage{}
.messageText{line-height: 20px;}

View File

@ -73,7 +73,7 @@
<throry-result ref="theoryResult" @restart="goTheoryQuiz" /> -->
<select-role ref="selectRole" :member-list="currentPlayList" @selectRole="selectRole" />
<operational-statistic ref="operationalStatistic" />
<operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" />
</div>
@ -395,6 +395,7 @@ export default {
this.$store.dispatch('scriptRecord/updateOperationalItemVOs', {});
this.quitQuest();
// this.initLoadPage();
this.isScriptRun = false;
this.clearAllData();
this.$store.dispatch('scriptRecord/updateBgSet', false);
}).catch(()=>{
@ -462,8 +463,11 @@ export default {
(this.$store.state.training.memberData[role.id] || {}).disabled = true;
this.runScriptMode(memberId);
},
finishTraining() {
this.isScriptRun = false;
},
endTraining() {
competitionPracticalSceneFinish(this.group).then(res=>{
competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{
this.isScriptRun = false;
// if (this.scriptMode == ScriptMode.TEST) {
this.formatScore = res.data;

View File

@ -28,7 +28,7 @@
</el-dialog>
</template>
<script>
import { submitOperationalStatistics} from '@/api/competition';
import { competitionPracticalSceneFinish} from '@/api/competition';
export default {
name:'OperationalStatistics',
data() {
@ -76,8 +76,11 @@ export default {
if (!result) {
this.$messageBox('请填写表单');
} else {
submitOperationalStatistics(this.$route.query.group, this.resultData).then(res=>{
competitionPracticalSceneFinish(this.$route.query.group, this.resultData).then(res=>{
this.$message.success('运营统计数据提交成功');
this.formatScore = res.data;
this.$messageBox('得分:' + this.formatScore);
this.$emit('finishTraining');
this.$store.dispatch('scriptRecord/updateOperationalItemVOs', this.resultData.itemVOS);
this.dialogShow = false;
}).catch(error=>{

View File

@ -0,0 +1,90 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="popMenuClass" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import { Notification } from 'element-ui';
import { DeviceMenu } from '@/scripts/ConstDic';
import { deleteTripNo, justTripNoArrival, justTripNoDeparture} from '@/api/rpTools';
export default {
props: {
tripNo: {
type: [String, Number]
}
},
components: {
PopMenu
},
data() {
return {
menu: [
{
label: '调整起始时间',
handler: this.doJustBeginTime,
disabled: false
},
{
label: '调整停站时间',
handler: this.doJustStopTime,
disabled: false
},
{
label: '删除',
handler: this.doDeleteTrip,
disabled: false
}
]
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.planAusContextMenu)) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
doShow(point) {
this.clickEvent();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
doDeleteTrip() {
if (this.tripNo) {
deleteTripNo(this.tripNo).then(resp => {
this.$emit('reload')
}).catch(error => {
this.$message.error('delete error');
})
}
},
doJustBeginTime() {
},
doJustStopTime() {
}
}
};
</script>
<style lang="scss" scoped>
.popMenuClass{
background: #fff;
}
</style>

View File

@ -0,0 +1,392 @@
<template>
<div class="plan-tool">
<schedule
ref="schedule"
:line-code="lineCode"
:plan-convert="PlanConvert"
:max-height="height"
:max-width="width"
/>
</div>
</template>
<script>
import Schedule from './schedule';
export default {
components: {
Schedule
},
data() {
return {
PlanConvert: {}
};
},
computed: {
lineCode() {
return '00';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height - 60;
}
},
created() {
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
methods: {
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();
});
},
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
});
},
dispatchOperate(operateObj) {
this.$nextTick(() => {
if (this.$refs[operateObj.dialogName]) {
this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params);
}
});
}
}
};
</script>
<style>
.plan-tool {
position: absolute;
}
.plan-tool .pop-menu {
background: #F0F0F0;
}
.plan-tool .pop-menu span {
color: #000;
}
.plan-tool .system-close {
cursor: pointer;
height: 25px;
width: 25px;
background: -webkit-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: -o-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: -moz-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
border: 1px solid white;
border-radius: 4px;
}
.plan-tool .system-close::before {
position: absolute;
top: 0px;
left: 0px;
font-size: x-large;
}
.planEdit__tool {
overflow: hidden !important;
}
/* .planEdit__tool .el-dialog {
overflow: hidden !important;
background: rgba(202, 221, 253, 0.88);;
box-shadow: 1px hsla(240, 0%, 100%, 0.5) inset;
border: 2px solid #727375;
border-radius: 4px;
color: #000;
font-size: 14px;
}
.planEdit__tool .el-dialog .el-dialog__header {
height: 30px;
padding: 5px;
}
.planEdit__tool .el-dialog .el-dialog__footer {
background: #ECE9D8;
opacity: 1;
}
.planEdit__tool .el-dialog .el-dialog__body {
padding-top: 10px;
padding-bottom: 10px;
padding-left: 5px;
padding-right: 5px;
margin: 0px 3px 3px 3px;
border: 2px solid rgba(120, 121, 123, 0.5);
box-shadow: 1px hsla(240, 0%, 100%, 0.5) inset;
color: #000;
background: #ECE9D8;
opacity: 1;
}
.planEdit__tool .el-dialog .el-dialog__title {
font-size: 16px;
}
.planEdit__tool .el-dialog .el-dialog__headerbtn {
background: -webkit-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: -o-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: -moz-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
border: 1px solid white;
border-radius: 4px;
top: 0px;
right: 3px;
line-height: 26px;
width: 26px;
}
.planEdit__tool .el-dialog .el-dialog__headerbtn .el-icon-close:before {
font-size: 16px;
}
.planEdit__tool .el-dialog .el-dialog__headerbtn .el-dialog__close {
color: #fff;
}
.planEdit__tool .el-dialog .el-tabs--top {
border: 2px outset #FEFEFD;
border-radius: 4px;
}
.planEdit__tool .el-dialog .el-tabs__item {
height: 30px;
line-height: 30px;
text-align: center;
color: #000 !important;
border-right: 2px outset #fff;
padding-left: 10px !important;
padding-right: 10px !important;
}
.planEdit__tool .el-dialog .el-tab-pane {
margin: 10px !important;
}
.planEdit__tool .el-dialog .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
border-bottom: none
}
.planEdit__tool .el-dialog .el-tabs--card>.el-tabs__header .el-tabs__item:not(.is-active) {
border-bottom: 2px inset #fff
}
.planEdit__tool .el-dialog .el-form {
background: #ECE9D8 !important;
}
.planEdit__tool .el-dialog .el-card {
background: #ECE9D8 !important;
}
.planEdit__tool .el-dialog .el-button {
height: 32px;
line-height: 32px;
padding: 0px;
width: 80px;
border: 2px outset #E2E2E2;
border-radius: 0px !important;
color: #000;
background: #ECE9D8;
}
.planEdit__tool .el-dialog .expand {
width: 120px;
}
.planEdit__tool .el-dialog .el-button:focus span {
border: 1px dashed gray;
}
.planEdit__tool .el-dialog .el-button:active {
border: 2px inset #E2E2E2;
}
.planEdit__tool .el-dialog .el-button:disabled {
border: 2px inset #E2E2E2;
}
.planEdit__tool .el-dialog .el-button:disabled span {
border: 0px;
}
.planEdit__tool .el-dialog .button-group {
margin-top: 10px;
}
.planEdit__tool .el-dialog .el-input {
border: 2px inset #E9E9E9;
}
.planEdit__tool .el-dialog .el-input .el-input__inner {
color: #000;
background: #fff !important;
border: 0px;
border-radius: 0px !important;
box-sizing: border-box;
}
.planEdit__tool .el-dialog .el-input.is-disabled .el-input__inner {
background: #F0F0F0 !important;
}
.planEdit__tool .el-dialog .el-textarea {
border: 2px inset #E9E9E9;
border-radius: 0px;
}
.planEdit__tool .el-dialog .el-textarea .el-textarea__inner {
color: #000;
background: #fff !important;
border: 0px;
border-radius: 0px !important;
box-sizing: border-box;
}
.planEdit__tool .el-dialog .el-textarea.is-disabled .el-textarea__inner {
background: #F0F0F0 !important;
}
.planEdit__tool .el-dialog .el-table {
border: 2px inset #E9E9E9;
color: #000 !important;
}
.planEdit__tool .el-dialog .el-table .cell {
line-height: unset !important;
}
.planEdit__tool .el-dialog .el-table th.is-leaf {
background: #ECE9D8 !important;
border-right: 1px solid #BDBDBD !important;
border-bottom: 1px solid #BDBDBD !important;
color: #000 !important;
height: 20px !important;
padding: 0px;
}
.planEdit__tool .el-dialog .el-table tr td {
height: 20px !important;
padding: 0px;
}
.planEdit__tool .el-dialog .el-table .el-table__empty-text {
top: 15px !important;
}
.planEdit__tool .el-dialog .current-row>td {
background: #316AC5 !important;
color: #fff !important;
}
.planEdit__tool .el-dialog .el-checkbox__inner {
border: 1px inset #dcdfe6 !important;
}
.planEdit__tool .el-dialog .el-checkbox__label {
color: #000 !important;
}
.planEdit__tool .el-dialog .el-checkbox.is-disabled .el-checkbox__inner {
background: #E6E6E6 !important;
}
.planEdit__tool .el-dialog .el-checkbox.is-disabled .el-checkbox__label {
color: #C5C9CC !important;
}
.planEdit__tool .el-dialog .el-checkbox__input.is-checked .el-checkbox__inner {
background: #fff !important;
border: 1px inset #dcdfe6 !important;
}
.planEdit__tool .el-dialog .el-checkbox__input.is-checked .el-checkbox__inner::after {
position: absolute;
-webkit-box-sizing: content-box;
box-sizing: content-box;
content: "";
border: 1px solid #000;
border-left: 0;
border-top: 0;
height: 7px;
left: 4px;
top: 1px;
}
.planEdit__tool .el-dialog .el-radio__inner {
border: 1px inset #dcdfe6 !important;
}
.planEdit__tool .el-dialog .el-radio__label {
color: #000 !important;
}
.planEdit__tool .el-dialog .el-radio__input.is-checked .el-radio__inner {
background: #fff !important;
border: 1px inset #dcdfe6 !important;
}
.planEdit__tool .el-dialog .el-radio__input.is-checked .el-radio__inner::after {
width: 4px;
height: 4px;
border-radius: 100%;
background-color: #000 !important;
position: absolute;
left: 50%;
top: 50%;
}
.planEdit__tool .el-dialog .el-radio.is-disabled .el-radio__inner {
background: #E6E6E6 !important;
}
.planEdit__tool .el-dialog .el-radio.is-disabled .el-radio__label {
color: #C5C9CC !important;
}
.planEdit__tool .el-dialog .base-label {
background: rgba(0, 0, 0, x);
position: relative;
left: -15px;
top: -18px;
}
.planEdit__tool .el-dialog .el-form-item label {
font-weight: normal !important;
color: #000 !important;
}
.planEdit__tool .el-dialog .context {
height: 100px;
border: 2px inset #E2E2E2;
overflow-y: scroll;
}
.planEdit__tool .el-dialog .table {
margin-top: 10px;
}
.planEdit__tool .el-dialog .notice {
margin-left: 62px;
line-height: 30px;
}
.planEdit__tool .el-dialog .button-group {
margin-top: 10px;
}
.planEdit__tool .el-dialog .el-tree__empty-block {
background: #E9E9E9 !important;
color: #000 !important;
} */
</style>

View File

@ -0,0 +1,160 @@
import { DeviceMenu } from '@/scripts/ConstDic';
import { timeFormat } from '@/utils/date';
export default {
data() {
return {
isDragging: false,
createModel: {
endStationCode: '',
startStationCode: '',
startTime: {
hour: '',
minute: '',
second: ''
}
}
}
},
watch: {
myChart: function() {
this.listenersBind();
}
},
beforeDestroy() {
this.listenersOff();
},
methods: {
getStationByCoord(stations, y) {
for(var i = stations.length-1; i >= 0; i--) {
const station = stations[i];
if (station.kmRange <= y) {
return station;
}
}
return null;
},
pixelExecCb(e, cb) {
let myChart = this.myChart;
let pointInPixel= [e.offsetX, e.offsetY];
if (myChart.containPixel('grid', pointInPixel) && this.planConvert) {
let pointInGrid = myChart.convertFromPixel({seriesIndex:0},pointInPixel);
let xIndex = pointInGrid[0];
let yIndex = pointInGrid[1];
let op = myChart.getOption();
let minY = op.yAxis[0].min;
let xVal = op.xAxis[0].data[xIndex];
let edgeOffset = this.planConvert.EdgeHeight/6;
let yObj = this.getStationByCoord(this.stations, yIndex-minY-edgeOffset);
if (yObj && cb) {
cb(yObj, xVal, pointInPixel);
}
}
},
listenersBind() {
if (this.myChart) {
const zr = this.myChart.getZr();
zr.on('click', this.onClick, this)
zr.on('contextmenu', this.onContextMenu, this);
this.myChart.on('mousedown', this.onDragStart);
this.myChart.on('mouseup', this.onDragEnd);
this.myChart.on('click', 'series', this.onSelect);
this.myChart.on('datazoom', this.onClearMarks);
}
},
listenersOff() {
if (this.myChart) {
const zr = this.myChart.getZr();
zr.off('click', this.onClick);
zr.off('contextmenu', this.onContextMenu);
this.myChart.off('mousedown', this.onDragStart);
this.myChart.off('mouseup', this.onDragEnd);
this.myChart.off('click', 'series', this.onSelect);
this.myChart.off('datazoom', this.onClearMarks);
}
},
onClick(e) {
this.pixelExecCb(e, this.handleMarkPoint)
},
onContextMenu(e) {
console.log(e, 'onContextMenu');
this.onClearMarks();
if(e.target) {
const event = e.event;
const point = {
x: event.clientX,
y: event.clientY
}
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: DeviceMenu.planAusContextMenu });
} else {
this.$message.info('No train number selected')
}
},
onClearMarks() {
if (this.myChart) {
let op = this.myChart.getOption();
op.graphic[0].elements = [];
this.myChart.setOption(op, {notMerge: true})
}
},
onSelect(e) {
console.log(e, 'select')
},
onDragStart(e) {
console.log(e, 'dragStart');
},
onDragEnd(e) {
console.log(e, 'dragEnd');
},
createMarkPoint(point, text) {
return {
type: 'group',
z: 100,
children: [
{
type: 'circle',
z: 100,
shape: {
cx: point[0],
cy: point[1],
r: 5
},
style: {
fill: 'rgba(0,0,0,0.3)'
}
},
{
type: 'circle',
z: 100,
shape: {
cx: point[0],
cy: point[1],
r: 10
},
style: {
fill: 'rgba(0,0,0,0.3)'
}
}
]
}
},
handleMarkPoint(yObj, xVal, pointInPixel) {
let myChart = this.myChart;
if (myChart) {
let op = myChart.getOption();
let graphic = op.graphic[0];
if (graphic) {
graphic.elements.push(this.createMarkPoint(pointInPixel, 'hello world'))
myChart.setOption(op);
if (graphic.elements.length == 1) {
this.createModel.startStationCode = yObj.code;
this.createModel.startTime = timeFormat(xVal);
} else if (graphic.elements.length >= 2) {
this.createModel.endStationCode = yObj.code;
this.createRpTrip(this.createModel);
}
}
}
}
}
}

View File

@ -0,0 +1,599 @@
<template>
<div id="PlanSchedule">
<div class="left">
<div :id="runPlanId" />
<context-menu :tripNo="tripNo" />
</div>
</div>
</template>
<script>
import Monitor from './monitor.js';
import ContextMenu from './contextMenu.vue';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { getStationList } from '@/api/runplan';
import { getRpTools, addRpTrip } from '@/api/rpTools';
import { loadMapDataById } from '@/utils/loaddata';
import { getPublishMapInfo } from '@/api/jmap/map';
import echarts from 'echarts';
export default {
props: {
planConvert: {
type: Object,
required: true
},
maxWidth: {
type: Number,
required: true
},
maxHeight: {
type: Number,
required: true
},
loadRunPlanId: {
type: String,
default() {
return '';
}
},
loadRunPlanName: {
type: String,
default() {
return '';
}
}
},
mixins: [Monitor],
components: {
ContextMenu
},
data() {
return {
top: 0,
height: 0,
mapName: 'XXX',
runPlanId: 'plan-tool',
myChart: null,
showTrain: false,
tripNo: '',
serviceNumberConfig: {
data: [],
title: this.$t('planMonitor.serviceNumber'),
showHeader: false,
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
showClose: false,
columns: [
{
prop: 'serviceNumber',
label: this.$t('planMonitor.serviceNumber')
}
]
},
tripNumberConfig: {
data: [],
title: this.$t('planMonitor.tripNumber'),
showHeader: false,
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
showClose: false,
columns: [
{
prop: 'tripNumber',
label: this.$t('planMonitor.tripNumber')
}
]
},
realData: {},
kmRangeCoordMap: {},
option: {
title: {
text: '',
left: 'center',
top: '10px'
},
grid: {
top: '60px',
left: '160px',
right: '100px',
bottom: '80px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
snap: true,
axis: 'x'
},
formatter: this.axisTooltip,
borderWidth: 1,
position: function (pt) {
const data = pt[0] + 10;
return [data, '20%'];
}
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 1
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 1
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
graphic: [{
id: 'static',
elements: []
}],
markPoint: [{
id: 'mark',
data: []
}],
series: [],
dataZoom: [
{
type: 'inside',
zoomOnMouseWheel : 'ctrl',
moveOnMouseMove : 'ctrl',
moveOnMouseWheel: 'ctrl'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {},
stationsObj: {}
};
},
computed: {
...mapGetters('rpTools', [
'stations'
]),
planId() {
return this.$route.query.planId;
},
mapId() {
return 9;
}
},
watch: {
maxWidth() {
this.setPosition();
},
maxHeight() {
this.setPosition();
},
'$store.state.rpTools.planSizeCount': function () {
this.reSize({ width: this.$store.state.rpTools.width, height: this.$store.state.rpTools.height });
},
'$store.state.rpTools.refreshCount': function() {
this.loadChartPage();
},
$route() {
this.$nextTick(() => {
this.loadChartPage();
});
},
loadRunPlanId() {
this.loadChartPage();
}
},
mounted() {
this.setPosition();
this.loadChartPage();
},
beforeDestroy() {
this.destroy();
},
methods: {
displayTrain() {
this.showTrain = !this.showTrain;
},
serviceNumberChange(row) {
let serviceNumber = null;
let serviceObj = {};
if (row) {
serviceNumber = row.serviceNumber;
serviceObj = this.$store.state.rpTools.editData[row.serviceNumber] || {};
const op = this.myChart.getOption();
op.series.forEach((item, index) => {
item.lineStyle.color = '#000';
switch (item.name) {
case serviceNumber: {
item.lineStyle.color = 'red';
break;
}
case 'trainLabel': {
op.series.pop();
break;
}
}
});
this.myChart.setOption(op, true);
}
this.$store.dispatch('rpTools/setSelected', { serviceNumber: serviceNumber, tripNumber: null });
this.analyticalTripNumber(serviceObj.trainMap || {});
},
tripNumberChange(row) {
const serviceNumber = this.$store.state.rpTools.selected.serviceNumber;
let tripNumber = null;
if (row) {
const data = [];
tripNumber = row.tripNumber;
const op = this.myChart.getOption();
op.series.forEach((item, index) => {
switch (item.name) {
case serviceNumber: {
item.data.forEach(nor => {
if (nor[3] == tripNumber) {
data.push(nor);
}
});
break;
}
case 'trainLabel': {
op.series.pop();
this.myChart && this.myChart.setOption(op, true);
break;
}
}
});
op.series.push({
name: 'trainLabel',
lineStyle: {
color: 'green'
},
type: 'line',
data: data
});
setTimeout(() => {
this.myChart && this.myChart.setOption(op, true);
}, 50);
}
this.$store.dispatch('rpTools/setSelected', { serviceNumber: serviceNumber, tripNumber: tripNumber });
},
async analyticalServiceNumber(data) {
this.serviceNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(serviceNumber => { return { serviceNumber }; });
},
async analyticalTripNumber(data) {
this.tripNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(tripNumber => { return { tripNumber }; });
},
async setPosition() {
this.$nextTick(() => {
let top = 3;
const width = this.maxWidth;
let height = this.maxHeight;
const titleBar = document.getElementById('PlanTitleBar');
const menuBar = document.getElementById('PlanMenuBar');
const menuTool = document.getElementById('PlanMenuTool');
const statusBar = document.getElementById('PlanStatusBar');
if (titleBar) {
top += (titleBar.offsetHeight || 0);
}
if (menuBar) {
top += (menuBar.offsetHeight || 0);
}
if (menuTool) {
top += (menuTool.offsetHeight || 0);
}
if (statusBar) {
height -= (statusBar.offsetHeight || 0);
}
height = height - top;
this.$store.dispatch('rpTools/resize', { width, height });
if (this.top != top) {
this.top = top;
}
if (this.height != height) {
this.height = height - 20 * 2;
}
});
},
async loadChartPage() {
try {
this.$store.dispatch('rpTools/clear').then(() => {
this.loadInitChart().then(() => {
if (this.mapId) {
loadMapDataById(this.mapId);
getStationList(this.mapId).then(resp => {
const stations = resp.data.filter(el => {
return ['车辆段', '停车场'].findIndex(it => {
return el.name.includes(it)
}) < 0;
});
this.$store.dispatch('rpTools/setStations', stations).then(() => {
this.loadInitData();
this.myChart && this.myChart.showLoading();
getRpTools().then(rest => {
this.$store.dispatch('rpTools/setPlanData', rest.data).then(() => {
this.analyticalServiceNumber(this.$store.state.rpTools.editData);
this.loadChartData();
this.myChart && this.myChart.hideLoading();
});
}).catch(() => {
this.myChart && this.myChart.hideLoading();
this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
});
});
}).catch(() => {
this.$messageBox(this.$t('tip.requestingStationDataFailed'));
this.$store.dispatch('rpTools/setStations', []);
});
}
});
});
} catch (error) {
this.$messageBox(this.$t('error.loadingOperationGraphFailed'));
}
},
async loadChartData() {
try {
const stations = this.$store.state.rpTools.stations;
const planData = this.$store.state.rpTools.planData;
this.stationsObj = {};
stations.forEach(item => {
this.stationsObj[Math.floor(item.kmRange)] = item;
});
this.viewDisabled = true;
this.option.series = [];
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) {
this.viewDisabled = false;
this.$messageBox(this.$t('error.loadingOperationGraphFailed') + this.$t('global.colon') + error.message);
}
},
async loadInitData() {
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart();
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
}
return series;
},
loadInitChart() {
return new Promise((resolve, reject) => {
try {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
if (this.$route.query.planName || this.$route.query.prdType === '05') {
this.option.title.text = this.mapName;
}
this.myChart = echarts.init(document.getElementById(this.runPlanId));
this.myChart.setOption(this.option, {notMerge: true});
this.reSize({ width: this.$store.state.rpTools.width, height: this.$store.state.rpTools.height });
resolve(true);
} catch (error) {
reject(error);
}
});
},
destroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
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);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = 0 + this.planConvert.TranslationTime; time < 3600 * 24 + this.planConvert.TranslationTime; time++) {
list.push(time);
}
const startValue = 3600 * 6;
const offsetTime = 3600 * 1;
this.option.xAxis[0].data = list;
if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
}
if (!this.option.dataZoom[0].endValue) {
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
}
},
yAxisInit() {
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) {
let data = '';
const arr = [];
param.forEach(item => {
const station = this.stationsObj[Math.floor((item.data[1] - this.planConvert.EdgeHeight) / this.planConvert.CoordMultiple)] || { name: '', kmRange: '' };
if (!arr.includes(`${item.data[0]}${item.data[1]}`)) {
arr.push(`${item.data[0]}${item.data[1]}`);
const list = [
`${this.$t('planMonitor.stationName')}${station.name}<br>`,
`${this.$t('planMonitor.stationKilometerMark')}${station.kmRange} m <br>`,
`${this.$t('planMonitor.arriveTime')}${timeFormat(item.data[0] + this.planConvert.TranslationTime)}<br>`,
`${this.$t('planMonitor.serverTrainNum')}: ${item.seriesName}${item.data[3]}(${item.data[3][0] == '2' ? 'Up' : 'Down'})`,
`<hr size=1 style="margin: 3px 0">`
];
data += list.join('');
}
});
return data;
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
},
createRpTrip(data) {
addRpTrip(data).then(resp => {
this.loadChartData();
}).catch(error => {
if (this.myChart) {
const op = this.myChart.getOption();
op.graphic[0].elements = [];
this.myChart.setOption(op, {notMerge: true});
}
})
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">
@import "src/styles/mixin.scss";
#PlanSchedule {
z-index: 0;
width: 100%;
height: calc(100% - 45px);
position: relative;
margin-top: 45px;
.left {
height: 100%;
width: 100%;
float: left;
}
.position {
position: absolute;
top: 0px;
right: 50px;
width: 220px;
height: calc(100% - 45px);
}
.data_table_box{
height: 50%;
}
}
</style>