Merge branch 'test_eg2d' of https://git.code.tencent.com/lian-cbtc/jl-client into test_eg2d

This commit is contained in:
fan 2021-07-16 14:41:00 +08:00
commit af076119ce
68 changed files with 1472 additions and 339 deletions

View File

@ -60,19 +60,49 @@ export function deleteModelDraft(id) {
})
}
/** 查询模型数据 */
/** 分页查询模型数据 */
export function getModelList() {
return request({
url: `/api/model2d/list`,
url: `/api/model2d/paging`,
method: 'get',
})
}
/** 查询某个模型所有历史版本数据 */
export function getModelVersions(code) {
return request({
url: `/api/model2d/${code}/versions`,
method: 'get'
})
}
/** 分页查询模型历史版本 */
export function getModelVersionsPaging(code) {
return request({
url: `/api/model2d/${code}/versions/paging`,
method: 'get'
})
}
/** 更新2d模型基础信息 */
export function updateModelBasicInfo(id) {
return request({
url: `/api/model2d/{id}/basic`,
method: 'put'
})
}
/** 回滚版本 */
export function setModelVersion(code, version) {
return request({
url: `/api/model2d/${code}/version/${version}`,
method: 'put'
})
}

View File

@ -36,6 +36,13 @@ export default {
backgroundHeight: 'backgroundHeight',
buttonCode: 'Button code',
buttonColor: 'Button color',
buttonLightColor: 'Button Light Color',
red: 'Red',
blue: 'Blue',
yellow: 'Yellow',
green: 'Green',
gray: 'White',
button: 'Button',
buttonWidth: 'Button width',
redButton: 'Red button',
blueButton: 'Blue button',

View File

@ -100,6 +100,7 @@ export default {
publishISCSManage:'publish ISCS Manage',
voiceTraining: 'Voice Training',
mapGroup: 'Map Group',
userModel: 'User Model',
drawingMange:'Drawing Mange',
newDraw: 'New Draw'
};

View File

@ -41,6 +41,13 @@ export default {
backgroundHeight: '背景板高度',
buttonCode: '按钮编号',
buttonColor: '按钮颜色',
buttonLightColor: '按钮灯颜色',
red: '红色',
blue: '蓝色',
yellow: '黄色',
green: '绿色',
gray: '白色',
button: '按钮',
buttonWidth: '按钮宽度',
redButton: '红色按钮',
blueButton: '蓝色按钮',

View File

@ -104,6 +104,7 @@ export default {
publishISCSManage:'发布ISCS管理',
voiceTraining: '语音训练',
mapGroup: '地图分组',
userModel: '模型管理',
drawingMange:'图纸管理',
newDraw: '新版绘制'
};

View File

@ -86,7 +86,12 @@ export default class button extends Group {
}
getImagePic() {
const color = colors.get(`${this.model.color}${this.model.pressed ? '_pressed' : ''}_${this.model.status}`);
let color;
if (this.model.status === 'on') {
color = colors.get(`${this.model.lightColor || this.model.color}${this.model.pressed ? '_pressed' : ''}_on`)
} else if (this.model.status === 'off') {
color = colors.get(`${this.model.color}${this.model.pressed ? '_pressed' : ''}_off`)
}
return color;
}

View File

@ -323,6 +323,9 @@ export function JLmap3dEdit(dom, data, mapid) {
let stationStopGroup = new THREE.Group();
scope.scene.add(stationStopGroup);
this.testrail = function(){
scope.scene.remove(stationStopGroup);
stationStopGroup = new THREE.Group();
scope.scene.add(stationStopGroup);
if(stationStopGroup.children.length == 0){
for(let k in scope.mapdata.sectionlist.sections.datalist){
if(scope.mapdata.sectionlist.sections.datalist[k].standTrack == true){
@ -338,27 +341,28 @@ export function JLmap3dEdit(dom, data, mapid) {
plane2.rotation.y = Math.PI/2;
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);
// 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);
}
}
}else{
for(let i=0,leni = stationStopGroup.children.length;i<leni;i++){
let k = stationStopGroup.children[i].code;
if(stationStopGroup.children[i].stopType == "left"){
stationStopGroup.children[i].position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].mesh.leftStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
}else{
stationStopGroup.children[i].position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].mesh.rightStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
}
}
}
// else{
// for(let i=0,leni = stationStopGroup.children.length;i<leni;i++){
// let k = stationStopGroup.children[i].code;
//
// if(stationStopGroup.children[i].stopType == "left"){
// stationStopGroup.children[i].position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].mesh.leftStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
// }else{
// stationStopGroup.children[i].position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].mesh.rightStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
// }
//
// }
// }
};
//自动匹配轨道信号灯道岔

View File

@ -16,6 +16,8 @@ import { ControlManager } from '@/jlmap3d/lesson3d/manager/controlmanager.js';
import { AnimateManager } from '@/jlmap3d/lesson3d/manager/animatemanager.js';
import { Fire } from '@/jlmap3d/lesson3d/utils/fire.js';
// import { AnimationManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js';
@ -29,6 +31,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
let scope = this;
this.dom = dom;
this.nowSceneType = "";
//定义当前课程角色
let nowRole = "";
@ -44,12 +47,16 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
light.position.set( 0, 4000, 0 );
scene.add( light );
let fire = new Fire();
fire.init(scene);
let animateManager = new AnimateManager();
let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex);
let assetModelManager = new AssetModelManager(scene,controlManager);
assetModelManager.lessonAssetsLoader(lessonData.assetList,lessonData.modelList).then((result) => {
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
animateManager.initAnimation(assetModelManager);
controlManager.init(animateManager.actions,assetModelManager);
@ -82,7 +89,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
this.changeIndex = function(nowIndex){
lessonIndex = nowIndex;
scope.nowSceneType = lessonData.lessonProgress[nowIndex].progressScene;
if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
controlManager.initControlMode(lessonIndex);
@ -108,10 +115,12 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
}
controlManager.initRoleMode(roleMode);
if(lessonData.lessonProgress[lessonIndex].action.length>0){
console.log(assetModelManager);
// if(lessonData.lessonProgress[lessonIndex].action.length>0){
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,roleMode,assetModelManager.lessonTriggerList);
}
// }
};
//循环渲染函数
function animate() {
@ -124,6 +133,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
if(controlManager.controlMode == "non"){
controlManager.updateOrbitControl();
}
fire.update();
animateManager.updateAnimation();
requestAnimationFrame(animate);

View File

@ -1,7 +1,7 @@
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function AssetModelManager(scene) {
export function AssetModelManager(editor,scene) {
let scope = this;
@ -9,7 +9,18 @@ export function AssetModelManager(scene) {
this.otherModel = new THREE.Group();
scene.add(this.otherModel);
let groupList = [];
groupList["standstation"] = new THREE.Group();
groupList["stopstation"] = new THREE.Group();
groupList["device"] = new THREE.Group();
groupList["xl"] = new THREE.Group();
groupList["dc"] = new THREE.Group();
let geometryDevice = new THREE.PlaneGeometry( 100, 100, 32 );
let materialDevice = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} );
let planeDevice = new THREE.Mesh( geometryDevice, materialDevice );
planeDevice.rotation.x = -Math.PI/2;
groupList["device"].add(planeDevice);
this.loadAsset = [];
@ -22,6 +33,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['FTDH'] = {
@ -32,6 +44,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['IN'] = {
@ -42,6 +55,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['OUT'] = {
@ -52,6 +66,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['PBMDH'] = {
@ -62,16 +77,26 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
//场景中可触发事件模型
this.lessonTriggerList = [];
scope.lessonTriggerList["standstation"] = [];
scope.lessonTriggerList["stopstation"] = [];
scope.lessonTriggerList["device"] = [];
scope.lessonTriggerList["xl"] = [];
scope.lessonTriggerList["dc"] = [];
//加载课程资源
this.lessonAssetsLoader = function(assetList,modelList){
this.lessonAssetsLoader = function(lessonData){
let initlist = [];
this.otherModel = groupList[lessonData.lessonProgress[0].progressScene];
scene.add(this.otherModel);
let assetList = lessonData.assetList;
if(assetList){
for(let i = 0;i<assetList.length;i++){
assetList[i].mesh = "";
@ -95,8 +120,9 @@ export function AssetModelManager(scene) {
Promise.all(initlist).then((result) => {
initTriggerList();
let modelList = lessonData.modelList;
for(let i=0;i<modelList.length;i++){
console.log(modelList[i]);
// console.log(modelList[i]);
let newModelTrigger = scope.loadAsset[modelList[i].modelId].mesh.clone(true);
newModelTrigger.showType = "loadModel";
newModelTrigger.label = modelList[i].label;
@ -108,13 +134,18 @@ export function AssetModelManager(scene) {
newModelTrigger.rotation.x = modelList[i].rot.x;
newModelTrigger.rotation.y = modelList[i].rot.y;
newModelTrigger.rotation.z = modelList[i].rot.z;
if(modelList[i].visible == true){
scope.otherModel.add(newModelTrigger);
}
scope.lessonTriggerList.push(newModelTrigger);
}
updateTriggerList(scope.lessonTriggerList);
newModelTrigger.sceneType = modelList[i].sceneType;
if(modelList[i].visible == true){
groupList[modelList[i].sceneType].add(newModelTrigger);
}
scope.lessonTriggerList[modelList[i].sceneType].push(newModelTrigger);
}
editor.changeIndex(0);
updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]);
resolve("loaderassets"); //['成功了', 'success']
}).catch((error) => {
//console.log(error);
@ -126,8 +157,8 @@ export function AssetModelManager(scene) {
}
this.addActionModel = function(actionModel){
scope.otherModel.add(actionModel);
this.addActionModel = function(actionModel,nowSceneType){
groupList[nowSceneType].add(actionModel);
}
// <el-option label="车站" value="standstation"></el-option>
@ -144,18 +175,18 @@ export function AssetModelManager(scene) {
scope.staticAsset['station'].mesh.getObjectByName("FTAN").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮";
scope.staticAsset['station'].mesh.getObjectByName("FTAN").actionName = "FTDH";
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
scope.staticAsset['station'].mesh.getObjectByName("FTKG").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔";
scope.staticAsset['station'].mesh.getObjectByName("FTKG").actionName = "FTDH";
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").label = "屏蔽门开关";
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").actionName = "PBMDH";
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
// console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
}
@ -170,9 +201,12 @@ export function AssetModelManager(scene) {
newModelTrigger.showType = "loadModel";
newModelTrigger.label = assetData.packageName;
newModelTrigger.position.copy(pos);
scope.otherModel.add(newModelTrigger);
scope.lessonTriggerList.push(newModelTrigger);
updateTriggerList(scope.lessonTriggerList);
newModelTrigger.sceneType = nowSceneType;
scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
groupList[nowSceneType].add(newModelTrigger);
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
}else{
scope.loadAsset[assetData.id] = {
modelId:assetData.id,
@ -182,6 +216,7 @@ export function AssetModelManager(scene) {
assetType:'loadModel',
isUse:true,
resourceType:"三维课程",
sceneType:nowSceneType,
};
fbxpromise(scope.loadAsset[assetData.id]).then(function(object){
@ -191,10 +226,12 @@ export function AssetModelManager(scene) {
newModelTrigger.modelId = assetData.id;
newModelTrigger.label = assetData.packageName;
newModelTrigger.position.copy(pos);
scope.otherModel.add(newModelTrigger);
scope.lessonTriggerList.push(newModelTrigger);
newModelTrigger.sceneType = nowSceneType;
updateTriggerList(scope.lessonTriggerList);
scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
groupList[nowSceneType].add(newModelTrigger);
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
// resolve("loadednew");
});
}
@ -207,14 +244,22 @@ export function AssetModelManager(scene) {
var loader = new THREE.FBXLoader();
if(asset.assetType == "static"){
loader.load( asset.url, function ( object ) {
if(asset.sceneType){
object.sceneType = asset.sceneType;
}
object.name = asset.modelId;
asset.mesh = object;
scene.add(object);
groupList[asset.sceneType].add(object);
// scene.add(object);
resolve();
} );
}else{
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
if(asset.sceneType){
object.sceneType = asset.sceneType;
}
asset.mesh = object;
if(asset.assetType == "default"){
// scene.add(object);
}else if(asset.assetType == 'loadModel'){

View File

@ -105,7 +105,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
this.initRoleMode = function(rMode,role){
roleMode = rMode;
nowRole = role;
console.log(roleMode);
// console.log(roleMode);
};
const worldOctree = new Octree();
@ -158,8 +158,8 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
eventBoxs[i].setFromObject(eventBoxs[i].mesh);
// console.log(eventBoxs[i]);
if(hitBox.intersectsBox(eventBoxs[i])){
console.log("相交");
console.log(eventBoxs[i].action);
// console.log("相交");
// console.log(eventBoxs[i].action);
if(eventBoxs[i].action.actionMode == "remove"){
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
@ -170,7 +170,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
}
console.log("slice");
// console.log("slice");
eventBoxs.splice(i,1);
i--;
}
@ -229,9 +229,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
document.addEventListener( 'mousedown', (event) => {
fpsMouseStatus = true;
// document.body.requestPointerLock();
console.log("mousedown-----------------------");
console.log(raycasterBoxs);
console.log(roleMode);
// console.log("mousedown-----------------------");
// console.log(raycasterBoxs);
// console.log(roleMode);
if(raycasterBoxs.length>0 && roleMode){
var mouse = new THREE.Vector2();
@ -504,6 +504,8 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
eventTrigger = lessonTriggerList;
scope.eventHitMode = true;
}
console.log(actions);
console.log(rMode);
nowActions = actions;
// let newEventBoxs = [];
// eventBoxs = newEventBoxs;

View File

@ -0,0 +1,236 @@
export function Fire() {
let scope = this;
this.points = {};
var last_time_activate = Date.now();
this.init = function(scene){
scope.points = new Points();
scope.points.init();
scene.add(scope.points.obj);
}
this.update = function(){
var now = Date.now();
scope.points.update();
if (now - last_time_activate > 10) {
scope.points.activateMover();
last_time_activate = Date.now();
}
}
var Mover = function() {
this.position = new THREE.Vector3();
this.velocity = new THREE.Vector3();
this.acceleration = new THREE.Vector3();
this.anchor = new THREE.Vector3();
this.mass = 1;
this.r = 0;
this.g = 0;
this.b = 0;
this.a = 1;
this.time = 0;
this.is_active = false;
};
Mover.prototype = {
init: function(vector) {
this.position = vector.clone();
this.velocity = vector.clone();
this.anchor = vector.clone();
this.acceleration.set(0, 0, 0);
this.a = 1;
this.time = 0;
},
updatePosition: function() {
this.position.copy(this.velocity);
},
updateVelocity: function() {
this.acceleration.divideScalar(this.mass);
this.velocity.add(this.acceleration);
// if (this.velocity.distanceTo(this.position) >= 1) {
// this.direct(this.velocity);
// }
},
applyForce: function(vector) {
this.acceleration.add(vector);
},
applyFriction: function() {
var friction = friction(this.acceleration, 0.1);
this.applyForce(friction);
},
applyDragForce: function(value) {
var drag = drag(this.acceleration, value);
this.applyForce(drag);
},
hook: function(rest_length, k) {
var force = hook(this.velocity, this.anchor, rest_length, k);
this.applyForce(force);
},
activate: function() {
this.is_active = true;
},
inactivate: function() {
this.is_active = false;
}
};
var Points = function() {
this.movers_num = 3000;
this.movers = [];
this.geometry = null;
this.material = null;
this.obj = null;
this.texture = null;
this.antigravity = new THREE.Vector3(0, 0.1, 0);
};
Points.prototype = {
init: function() {
this.createTexture();
this.geometry = new THREE.Geometry();
this.material = new THREE.PointsMaterial({
color: 0xff6633,
size: 3,
transparent: true,
opacity: 0.5,
map: this.texture,
// depthTest: false,
depthWrite:false,
alphaTest: 0.1,
blending: THREE.AdditiveBlending,
});
for (var i = 0; i < this.movers_num; i++) {
var mover = new Mover();
mover.init(new THREE.Vector3((10*Math.random()-49), 1.6, (10*Math.random()+11)));
this.movers.push(mover);
this.geometry.vertices.push(mover.position);
}
this.obj = new THREE.Points(this.geometry, this.material);
this.obj.renderOrder = 1;
},
update: function() {
var points_vertices = [];
for (var i = 0; i < this.movers.length; i++) {
var mover = this.movers[i];
if (mover.is_active) {
mover.applyForce(this.antigravity);
mover.updateVelocity();
mover.updatePosition();
if (mover.position.y > 8) {
mover.inactivate();
}
}
points_vertices.push(mover.position);
}
this.obj.geometry.vertices = points_vertices;
this.obj.geometry.verticesNeedUpdate = true;
},
activateMover: function() {
var count = 0;
for (var i = 0; i < this.movers.length; i++) {
var mover = this.movers[i];
if (mover.is_active) continue;
var rad1 = getRadian(Math.log(getRandomInt(200, 256)) / Math.log(256) * 270);
var rad2 = getRadian(getRandomInt(0, 360));
var force = getSpherical(rad1, rad2, 1);
mover.activate();
mover.init(new THREE.Vector3((10*Math.random()-49), 5, (10*Math.random()+11)));
mover.applyForce(force);
count++;
if (count >= 10) break;
}
},
createTexture: function() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var grad = null;
canvas.width = 200;
canvas.height = 200;
grad = ctx.createRadialGradient(100, 100, 20, 100, 100, 100);
grad.addColorStop(0.2, 'rgba(255, 255, 255, 1)');
grad.addColorStop(0.5, 'rgba(255, 255, 255, 0.3)');
grad.addColorStop(1.0, 'rgba(255, 255, 255, 0)');
ctx.fillStyle = grad;
ctx.arc(100, 100, 100, 0, Math.PI / 180, true);
ctx.fill();
this.texture = new THREE.Texture(canvas);
this.texture.minFilter = THREE.NearestFilter;
this.texture.needsUpdate = true;
}
};
var HemiLight = function() {
this.rad1 = getRadian(60);
this.rad2 = getRadian(30);
this.range = 1000;
this.hex1 = 0xffffff;
this.hex2 = 0x333333;
this.intensity = 1;
this.obj;
};
HemiLight.prototype = {
init: function(hex1, hex2) {
if (hex1) this.hex1 = hex1;
if (hex2) this.hex2 = hex2;
this.obj = new THREE.HemisphereLight(this.hex1, this.hex2, this.intensity);
this.setPosition();
},
setPosition: function() {
var points = getSpherical(this.rad1, this.rad2, this.range);
this.obj.position.copy(points);
}
};
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
function getDegree(radian) {
return radian / Math.PI * 180;
}
function getRadian(degrees) {
return degrees * Math.PI / 180;
}
function getSpherical(rad1, rad2, r) {
var x = Math.cos(rad1) * Math.cos(rad2) * r;
var z = Math.cos(rad1) * Math.sin(rad2) * r;
var y = Math.sin(rad1) * r;
return new THREE.Vector3(x, y, z);
}
function friction(acceleration, mu, normal, mass) {
var force = acceleration.clone();
if (!normal) normal = 1;
if (!mass) mass = 1;
force.multiplyScalar(-1);
force.normalize();
force.multiplyScalar(mu);
return force;
}
function drag(acceleration, value) {
var force = acceleration.clone();
force.multiplyScalar(-1);
force.normalize();
force.multiplyScalar(acceleration.length() * value);
return force;
}
function hook(velocity, anchor, rest_length, k) {
var force = velocity.clone().sub(anchor);
var distance = force.length() - rest_length;
force.normalize();
force.multiplyScalar(-1 * k * distance);
return force;
}
}

View File

@ -2,7 +2,7 @@ import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function AssetModelManager(scene) {
export function AssetModelManager(editor,scene) {
let scope = this;
@ -10,7 +10,18 @@ export function AssetModelManager(scene) {
this.otherModel = new THREE.Group();
scene.add(this.otherModel);
let groupList = [];
groupList["standstation"] = new THREE.Group();
groupList["stopstation"] = new THREE.Group();
groupList["device"] = new THREE.Group();
groupList["xl"] = new THREE.Group();
groupList["dc"] = new THREE.Group();
let geometryDevice = new THREE.PlaneGeometry( 100, 100, 32 );
let materialDevice = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} );
let planeDevice = new THREE.Mesh( geometryDevice, materialDevice );
planeDevice.rotation.x = -Math.PI/2;
groupList["device"].add(planeDevice);
this.loadAsset = [];
@ -23,6 +34,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['FTDH'] = {
@ -33,6 +45,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['IN'] = {
@ -43,6 +56,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['OUT'] = {
@ -53,6 +67,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
scope.staticAsset['PBMDH'] = {
@ -63,12 +78,30 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
sceneType:"standstation",
};
//场景中可触发事件模型
this.lessonTriggerList = [];
scope.lessonTriggerList["standstation"] = [];
scope.lessonTriggerList["stopstation"] = [];
scope.lessonTriggerList["device"] = [];
scope.lessonTriggerList["xl"] = [];
scope.lessonTriggerList["dc"] = [];
this.changeSceneGroup = function(groupType){
console.log(groupType);
console.log(editor.nowSceneType);
console.log(scope.lessonTriggerList[editor.nowSceneType]);
editor.nowSceneType = groupType;
scene.remove(this.otherModel);
this.otherModel = groupList[groupType];
scene.add(this.otherModel);
updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]);
}
this.saveModelList = function(){
let modelList = {
assetList:[],
@ -83,51 +116,63 @@ export function AssetModelManager(scene) {
assetType:scope.loadAsset[k].assetType,
isUse:scope.loadAsset[k].isUse,
resourceType:scope.loadAsset[k].resourceType,
sceneType:scope.loadAsset[k].sceneType,
});
}
for(let i=0;i<scope.lessonTriggerList.length;i++){
if(scope.lessonTriggerList[i].showType != "default"){
modelList.modelList.push({
name:scope.lessonTriggerList[i].name,
modelId:scope.lessonTriggerList[i].modelId,
label:scope.lessonTriggerList[i].label,
pos:{
x:scope.lessonTriggerList[i].position.x,
y:scope.lessonTriggerList[i].position.y,
z:scope.lessonTriggerList[i].position.z
},
rot:{
x:scope.lessonTriggerList[i].rotation.x,
y:scope.lessonTriggerList[i].rotation.y,
z:scope.lessonTriggerList[i].rotation.z
},
showType:scope.lessonTriggerList[i].showType,
visible:scope.lessonTriggerList[i].visible,
});
for(let g in scope.lessonTriggerList){
for(let i=0;i<scope.lessonTriggerList[g].length;i++){
if(scope.lessonTriggerList[g][i].showType != "default"){
modelList.modelList.push({
name:scope.lessonTriggerList[g][i].name,
modelId:scope.lessonTriggerList[g][i].modelId,
label:scope.lessonTriggerList[g][i].label,
pos:{
x:scope.lessonTriggerList[g][i].position.x,
y:scope.lessonTriggerList[g][i].position.y,
z:scope.lessonTriggerList[g][i].position.z
},
rot:{
x:scope.lessonTriggerList[g][i].rotation.x,
y:scope.lessonTriggerList[g][i].rotation.y,
z:scope.lessonTriggerList[g][i].rotation.z
},
showType:scope.lessonTriggerList[g][i].showType,
visible:scope.lessonTriggerList[g][i].visible,
sceneType:scope.lessonTriggerList[g][i].sceneType,
});
}
}
}
// console.log(modelList);
return modelList;
}
//加载课程资源
this.lessonAssetsLoader = function(assetList,modelList){
this.lessonAssetsLoader = function(lessonData){
let initlist = [];
if(assetList){
if(lessonData){
// scene.remove(this.otherModel);
this.otherModel = groupList[lessonData.lessonProgress[0].progressScene];
scene.add(this.otherModel);
let assetList = lessonData.assetList;
for(let i = 0;i<assetList.length;i++){
assetList[i].mesh = "";
// assetList[i].sceneType = "standstation";
if(assetList[i].modelId == "default1"){
}else{
scope.loadAsset[assetList[i].modelId] = assetList[i];
}
}
}else{
this.otherModel = groupList["standstation"];
scene.add(this.otherModel);
}
for(let k in scope.staticAsset){
initlist.push(fbxpromise(scope.staticAsset[k]));
}
@ -139,9 +184,11 @@ export function AssetModelManager(scene) {
Promise.all(initlist).then((result) => {
initTriggerList();
if(modelList){
if(lessonData){
let modelList = lessonData.modelList;
for(let i=0;i<modelList.length;i++){
let newModelTrigger = scope.loadAsset[modelList[i].modelId].mesh.clone(true);
// modelList[i].sceneType = "standstation";
newModelTrigger.showType = "loadModel";
newModelTrigger.label = modelList[i].label;
newModelTrigger.modelId = modelList[i].modelId;
@ -152,12 +199,14 @@ export function AssetModelManager(scene) {
newModelTrigger.rotation.x = modelList[i].rot.x;
newModelTrigger.rotation.y = modelList[i].rot.y;
newModelTrigger.rotation.z = modelList[i].rot.z;
scope.otherModel.add(newModelTrigger);
scope.lessonTriggerList.push(newModelTrigger);
newModelTrigger.sceneType = modelList[i].sceneType;
scope.lessonTriggerList[modelList[i].sceneType].push(newModelTrigger);
groupList[modelList[i].sceneType].add(newModelTrigger);
}
}
updateTriggerList(scope.lessonTriggerList);
editor.changeIndex(0);
updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]);
resolve("loaderassets"); //['成功了', 'success']
}).catch((error) => {
@ -167,12 +216,12 @@ export function AssetModelManager(scene) {
});
}
this.deleteAsset = function(selectModel){
this.deleteAsset = function(selectModel,nowSceneType){
scope.otherModel.remove(selectModel);
for(let i=0;i<scope.lessonTriggerList.length;i++){
if(scope.lessonTriggerList[i].uuid == selectModel.uuid){
if(scope.lessonTriggerList[nowSceneType][i].uuid == selectModel.uuid){
scope.lessonTriggerList.splice(i,1);
updateTriggerList(scope.lessonTriggerList);
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
break;
}
}
@ -191,15 +240,15 @@ export function AssetModelManager(scene) {
function initTriggerList(){
scope.staticAsset['station'].mesh.getObjectByName("FTAN").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮";
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
scope.staticAsset['station'].mesh.getObjectByName("FTKG").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔";
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").label = "屏蔽门开关";
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
@ -207,7 +256,7 @@ export function AssetModelManager(scene) {
}
//动态加载资源
this.lessonAssetsNewLoader = function(assetData,pos){
this.lessonAssetsNewLoader = function(assetData,pos,nowSceneType){
let isLoaded = false;
var rand = Math.floor(Math.random () * 900) + 100;
if(scope.loadAsset[assetData.id]){
@ -216,9 +265,12 @@ export function AssetModelManager(scene) {
newModelTrigger.showType = "loadModel";
newModelTrigger.label = assetData.packageName +rand;
newModelTrigger.position.copy(pos);
scope.otherModel.add(newModelTrigger);
scope.lessonTriggerList.push(newModelTrigger);
updateTriggerList(scope.lessonTriggerList);
newModelTrigger.sceneType = nowSceneType;
scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
groupList[nowSceneType].add(newModelTrigger);
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
}else{
scope.loadAsset[assetData.id] = {
modelId:assetData.id,
@ -228,6 +280,7 @@ export function AssetModelManager(scene) {
assetType:'loadModel',
isUse:true,
resourceType:"三维课程",
sceneType:nowSceneType,
};
console.log("new");
@ -236,15 +289,16 @@ export function AssetModelManager(scene) {
console.log(scope.loadAsset[assetData.id].mesh);
let newModelTrigger = scope.loadAsset[assetData.id].mesh.clone(true);
newModelTrigger.showType = "loadModel";
newModelTrigger.modelId = assetData.id;
newModelTrigger.label = assetData.packageName+rand;
newModelTrigger.position.copy(pos);
scope.otherModel.add(newModelTrigger);
scope.lessonTriggerList.push(newModelTrigger);
newModelTrigger.sceneType = nowSceneType;
updateTriggerList(scope.lessonTriggerList);
scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
groupList[nowSceneType].add(newModelTrigger);
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
// resolve("loadednew");
});
}
@ -255,14 +309,22 @@ export function AssetModelManager(scene) {
function fbxpromise(asset){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
console.log(asset);
if(asset.assetType == "static"){
loader.load( asset.url, function ( object ) {
if(asset.sceneType){
object.sceneType = asset.sceneType;
}
asset.mesh = object;
scene.add(object);
groupList[asset.sceneType].add(object);
// scope.otherModel.add(object);
resolve();
} );
}else{
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
if(asset.sceneType){
object.sceneType = asset.sceneType;
}
asset.mesh = object;
if(asset.assetType == "default"){

View File

@ -26,7 +26,7 @@ export function Lesson3dEditor(dom,lessonData) {
let scope = this;
this.dom = dom;
this.nowSceneType = "";
//定义相机
this.camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000);
this.camerass.position.set(0, 80, 40);
@ -35,7 +35,9 @@ export function Lesson3dEditor(dom,lessonData) {
//定义场景(渲染容器)
scene = new THREE.Scene();
scene.background = new THREE.Color(0xa0a0a0);
let bgTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/other.jpg");
scene.background = bgTexture;
// scene.background = new THREE.Color(0xa0a0a0);
this.renderer = new THREE.WebGLRenderer({ antialias: true });
@ -74,12 +76,12 @@ export function Lesson3dEditor(dom,lessonData) {
scene.add(transcontrol);
let assetModelManager = new AssetModelManager(scope,scene);
let assetModelManager = new AssetModelManager(scene);
console.log(lessonData);
if(lessonData){
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
if(lessonData.assetList.length>0 || lessonData.modelList.length>0){
assetModelManager.lessonAssetsLoader(lessonData.assetList,lessonData.modelList);
assetModelManager.lessonAssetsLoader(lessonData);
}else{
assetModelManager.lessonAssetsLoader();
}
@ -108,6 +110,30 @@ export function Lesson3dEditor(dom,lessonData) {
scope.renderer.setSize(dom.offsetWidth,dom.offsetHeight);
}
this.changeIndex = function(nowIndex){
lessonIndex = nowIndex;
scope.nowSceneType = lessonData.lessonProgress[lessonIndex].progressScene;
// if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
// controlManager.initControlMode(lessonIndex);
// controlManager.initRoleMode(true,nowRole);
// controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true);
// }else{
// controlManager.initRoleMode(false,nowRole);
// controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,false);
// }
}
this.editActionManager = function(type,value1,value2){
console.log(type);
console.log(value1);
console.log(value2);
if(type == "changeScene"){
assetModelManager.changeSceneGroup(value1);
scope.nowSceneType = value1;
}
}
this.createModelTrigger = function(assetData,mousePos){
var mouse = new THREE.Vector2();
@ -123,7 +149,7 @@ export function Lesson3dEditor(dom,lessonData) {
var intersects = raycaster.intersectObjects( scene.children,true );
if(intersects.length>0){
assetModelManager.lessonAssetsNewLoader(assetData,intersects[0].point);
assetModelManager.lessonAssetsNewLoader(assetData,intersects[0].point,scope.nowSceneType);
}
}
@ -138,6 +164,6 @@ export function Lesson3dEditor(dom,lessonData) {
this.deleteModel = function(selectModel){
transcontrol.detach();
assetModelManager.deleteAsset(selectModel);
assetModelManager.deleteAsset(selectModel,scope.nowSceneType);
}
}

View File

@ -330,37 +330,36 @@ class Jlmap {
getShowConfig() {
return this.showConfig;
}
showStationHandlePsd(oDevice, stationCode) {
const standDevice = this.mapDevice[oDevice.standCode];
if (standDevice && standDevice.deviceStationCode === stationCode || !stationCode) {
this.$painter.updateSpecialShowStation(oDevice, true);
} else {
this.$painter.updateSpecialShowStation(oDevice, false);
}
}
showStationHandleSection(oDevice, stationCode) {
const trainWinDevice = this.mapDevice[oDevice.trainWindowCode];
if (oDevice.stationCode === stationCode || !stationCode) {
this.$painter.updateSpecialShowStation(trainWinDevice, true);
} else {
this.$painter.updateSpecialShowStation(trainWinDevice, false);
}
}
showStationHandleStation (oDevice, stationCode) {
if ((oDevice.centralized && oDevice.code === stationCode) || !stationCode) {
this.$painter.updateSpecialShowStation(oDevice, true);
oDevice.chargeStationCodeList.forEach(staCode => {
const staDevice = this.mapDevice[staCode];
this.$painter.updateSpecialShowStation(staDevice, true);
});
} else if (oDevice.centralized && oDevice.code !== stationCode) {
this.$painter.updateSpecialShowStation(oDevice, false);
oDevice.chargeStationCodeList.forEach(staCode => {
const staDevice = this.mapDevice[staCode];
this.$painter.updateSpecialShowStation(staDevice, false);
});
}
}
// showStationHandlePsd(oDevice, stationCode) {
// if (store.getters['map/checkDeviceShow'](stationCode, oDevice.standCode) || !stationCode) {
// this.$painter.updateSpecialShowStation(oDevice, true);
// } else {
// this.$painter.updateSpecialShowStation(oDevice, false);
// }
// }
// showStationHandleSection(oDevice, stationCode) {
// const trainWinDevice = this.mapDevice[oDevice.trainWindowCode];
// if (oDevice.stationCode === stationCode || !stationCode) {
// this.$painter.updateSpecialShowStation(trainWinDevice, true);
// } else {
// this.$painter.updateSpecialShowStation(trainWinDevice, false);
// }
// }
// showStationHandleStation (oDevice, stationCode) {
// if ((oDevice.centralized && oDevice.code === stationCode) || !stationCode) {
// this.$painter.updateSpecialShowStation(oDevice, true);
// oDevice.chargeStationCodeList.forEach(staCode => {
// const staDevice = this.mapDevice[staCode];
// this.$painter.updateSpecialShowStation(staDevice, true);
// });
// } else if (oDevice.centralized && oDevice.code !== stationCode) {
// this.$painter.updateSpecialShowStation(oDevice, false);
// oDevice.chargeStationCodeList.forEach(staCode => {
// const staDevice = this.mapDevice[staCode];
// this.$painter.updateSpecialShowStation(staDevice, false);
// });
// }
// }
updateShowStation(list = [], stationCode = '') {
this.stationCode = stationCode;
@ -369,18 +368,19 @@ class Jlmap {
const code = elem.code;
const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
if (oDevice._type === deviceType.Station) {
this.showStationHandleStation(oDevice, stationCode);
} else if (oDevice._type === deviceType.Section) {
this.$painter.updateShowStation(oDevice, stationCode);
this.showStationHandleSection(oDevice, stationCode);
} else if (oDevice._type === deviceType.TrainWindow) {
// 不处理车次窗 勿删
} else if (oDevice._type === deviceType.Psd) {
this.showStationHandlePsd(oDevice, stationCode);
} else {
this.$painter.updateShowStation(oDevice, stationCode);
}
// if (oDevice._type === deviceType.Station) {
// this.showStationHandleStation(oDevice, stationCode);
// } else if (oDevice._type === deviceType.Section) {
// this.$painter.updateShowStation(oDevice, stationCode);
// this.showStationHandleSection(oDevice, stationCode);
// } else if (oDevice._type === deviceType.TrainWindow) {
// // 不处理车次窗 勿删
// } else if (oDevice._type === deviceType.Psd) {
// this.showStationHandlePsd(oDevice, stationCode);
// } else {
// this.$painter.updateShowStation(oDevice, stationCode);
// }
this.$painter.updateShowStation(oDevice, stationCode);
});
this.$painter.$transformHandle.revisibleAll();
if (stationCode) {

View File

@ -277,8 +277,7 @@ class MouseController extends Eventful {
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
}
if (item.instance && item.instance._type == deviceType.Switch) {
} else if (item.instance && item.instance._type == deviceType.Switch) {
const deviceBoundingRect = {
x1: item.intersection.x,
y1: item.intersection.y,
@ -288,8 +287,7 @@ class MouseController extends Eventful {
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
}
if (item.instance && item.instance._type == deviceType.Signal) {
} else if (item.instance && item.instance._type == deviceType.Signal) {
const deviceBoundingRect = {
x1: item.position.x,
y1: item.position.y,
@ -299,6 +297,27 @@ class MouseController extends Eventful {
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
} else if (item.instance && item.instance._type == deviceType.Psd) {
const deviceBoundingRect = {
x1: item.position.x,
y1: item.position.y,
x2: item.position.x,
y2: item.position.y
};
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
} else if (item.instance && item.instance._type !== deviceType.TrainWindow && item.instance._type !== deviceType.CheckBox && item.instance._type !== deviceType.Train) {
const rect = item.instance.getBoundingRect();
const deviceBoundingRect = {
x1: rect.x,
y1: rect.y,
x2: rect.x,
y2: rect.y
};
if (this.whetherInclude(boundingRect, deviceBoundingRect)) {
includeDeviceList.push(item);
}
}
});
this.deviceList = includeDeviceList;

View File

@ -199,11 +199,11 @@ class Painter {
device.instance.setShowStation(stationCode);
}
}
updateSpecialShowStation(device, flag) {
if (device && device.instance) {
device.instance.setShowStation(flag);
}
}
// updateSpecialShowStation(device, flag) {
// if (device && device.instance) {
// device.instance.setShowStation(flag);
// }
// }
/**
* 更新transform变化
* @param {*} opt

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import store from '@/store/index';
export default class Arrow extends Group {
constructor(model, {style}) {
@ -53,7 +54,7 @@ export default class Arrow extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.show();
this.isShowShape = true;
this.setState(this.model);

View File

@ -7,6 +7,7 @@ import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect';
import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
import store from '@/store/index';
export default class AutoTurnBack extends Group {
constructor(model, {style}) {
@ -172,7 +173,7 @@ export default class AutoTurnBack extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.isShowShape = true;
this.showMode();
} else {

View File

@ -6,6 +6,7 @@ import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text';
import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
import store from '@/store/index';
export default class AutomacticRoute extends Group {
constructor(model, {style}) {
@ -137,7 +138,7 @@ export default class AutomacticRoute extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.isShowShape = true;
this.showMode();
} else {

View File

@ -6,6 +6,7 @@ import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text';
import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
import store from '@/store/index';
export default class AxleReset extends Group {
constructor(model, {style}) {
@ -83,18 +84,18 @@ export default class AxleReset extends Group {
this.add(this.text);
}
setAshShow() {
this.control && this.control.setStyle({fill:'#FFF'});
}
setAshShow() {
this.control && this.control.setStyle({fill:'#FFF'});
}
// 设置状态
setState(model) {
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
}
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow();
} else {
if (!this.isShowShape) return;
}
}
createMouseEvent() {
@ -141,7 +142,7 @@ export default class AxleReset extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.isShowShape = true;
this.showMode();
} else {

View File

@ -1,6 +1,7 @@
import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Text from 'zrender/src/graphic/Text';
import store from '@/store/index';
export default class DirectionRod extends Group {
constructor(model, {style}) {
@ -97,7 +98,7 @@ export default class DirectionRod extends Group {
}
setShowStation(stationCode) {
if (!stationCode || this.model.deviceStationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.isShowShape = true;
this.showMode();
} else {

View File

@ -3,6 +3,7 @@
*/
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store/index';
export default class FloodGate extends Group {
constructor(model, {style}) {
@ -61,7 +62,7 @@ export default class FloodGate extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.isShowShape = true;
this.showMode();
} else {

View File

@ -6,6 +6,7 @@ import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text';
import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
import store from '@/store/index';
export default class GuideLock extends Group {
constructor(model, {style}) {
@ -86,22 +87,22 @@ export default class GuideLock extends Group {
}
handleSignal() {
this.control.setStyle({ fill: this.style.GuideLock.lamp.lightUpColor });
}
}
setAshShow() {
this.control && this.control.setStyle({fill:'#FFF'});
}
setAshShow() {
this.control && this.control.setStyle({fill:'#FFF'});
}
// 设置状态
setState(model) {
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
this.recover();
model.totalGuideLock && this.handleSignal();
}
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow();
} else {
if (!this.isShowShape) return;
this.recover();
model.totalGuideLock && this.handleSignal();
}
}
createMouseEvent() {
@ -148,7 +149,7 @@ export default class GuideLock extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.isShowShape = true;
this.showMode();
} else {

View File

@ -4,6 +4,7 @@
import Group from 'zrender/src/container/Group';
import EControl from '../element/EControl';
import EMouse from './EMouse';
import store from '@/store/index';
export default class LcControl extends Group {
constructor(model, {style}) {
@ -53,19 +54,18 @@ export default class LcControl extends Group {
this.add(this.control);
}
setAshShow() {
this.control && this.control.setControlColor('#7F7F7F');
}
setAshShow() {
this.control && this.control.setControlColor('#7F7F7F');
}
// 设置状态
setState(model) {
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
}
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow();
} else {
if (!this.isShowShape) return;
}
}
createMouseEvent() {
@ -89,7 +89,7 @@ export default class LcControl extends Group {
}
setShowMode() {}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.control.show();
this.isShowShape = true;
this.setState(this.model);

View File

@ -4,6 +4,7 @@
import Group from 'zrender/src/container/Group';
import EControl from '../element/EControl';
import EMouse from './EMouse';
import store from '@/store/index';
export default class LimitControl extends Group {
constructor(model, {style}) {
@ -57,18 +58,18 @@ export default class LimitControl extends Group {
this.add(this.control);
}
setAshShow() {
this.control && this.control.setControlColor('#FFF');
}
setAshShow() {
this.control && this.control.setControlColor('#FFF');
}
// 设置状态
setState(model) {
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow()
} else {
if (!this.isShowShape) return;
}
// 只响应前端自定义类型的状态变化
if (model._free) {
this.setAshShow();
} else {
if (!this.isShowShape) return;
}
}
createMouseEvent() {
@ -93,7 +94,7 @@ export default class LimitControl extends Group {
}
setShowMode() {}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.control.show();
this.isShowShape = true;
this.setState(this.model);

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Polyline from 'zrender/src/graphic/shape/Polyline';
import store from '@/store/index';
export default class Line2 extends Group {
constructor(model, {style}) {
@ -105,7 +106,7 @@ export default class Line2 extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.segment && this.segment.show();
this.viceSegment && this.viceSegment.show();
this.isShowShape = true;

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store/index';
export default class OutFrame extends Group {
constructor(model, {style}) {
@ -57,7 +58,7 @@ export default class OutFrame extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.box && this.box.show();
this.isShowShape = true;
this.setState(this.model);

View File

@ -2,6 +2,7 @@ import Polyline from 'zrender/src/graphic/shape/Polyline';
import Group from 'zrender/src/container/Group';
import JTriangle from '../../../utils/JTriangle';
import ESeparator from './ESeparator';
import store from '@/store/index';
export default class Line2 extends Group {
constructor(model, {style}) {
@ -135,7 +136,7 @@ export default class Line2 extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild((child) => {
child.show();
});

View File

@ -5,6 +5,7 @@ import EHorizontal2Door from './EHorizontal2Door';
import EHighlight from '../element/EHighlight';
import {traverseLineElements} from '../utils/ShapeStatusCovert';
import ERectDoor from './ERectDoor';
import store from '@/store/index';
export default class Line2 extends Group {
constructor(model, {style}) {
@ -90,8 +91,8 @@ export default class Line2 extends Group {
});
}
}
setShowStation(flag) {
if (flag) {
setShowStation(stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -3,6 +3,7 @@
*/
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import store from '@/store/index';
export default class Resource extends Group {
constructor(model, {style}) {
@ -70,7 +71,7 @@ export default class Resource extends Group {
}
setShowMode() {}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.image && this.image.show();
this.isShowShape = true;
this.setState(this.model);

View File

@ -6,6 +6,7 @@ import Rect from 'zrender/src/graphic/shape/Rect';
import Text from 'zrender/src/graphic/Text';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import EHighlight from '../element/EHighlight';
import store from '@/store/index';
const defaultStyle = {
distance: 12,
@ -188,7 +189,7 @@ export default class Responder extends Group {
}
setShowMode() {}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.block && this.block.show();
this.isShowShape = true;
this.setState(this.model);

View File

@ -10,6 +10,7 @@ import EModeStatus from './EModeStatus';
import EUnmanned from './EUnmanned';
import EAxle from './EAxle';
import EIndicatorLight from './EIndicatorLight';
import store from '@/store/index';
export default class SaidLamp extends Group {
constructor(model, {style}) {
@ -222,7 +223,7 @@ export default class SaidLamp extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.control && this.control.show();
this.isShowShape = true;
this.setState(this.model);

View File

@ -14,6 +14,7 @@ import ELimitName from './ELimitName'; // 成都三号线 限速名称
import { drawSectionStyle } from '../../../config/defaultStyle';
import EStopRouteImg from './EStopRouteImg';
import EBadShunt from './EBadShunt';
import store from '@/store/index';
const exec = (f, ...args) => { f && f(...args); };
const DerailerMap = {
@ -594,7 +595,7 @@ export default class Section extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -1175,7 +1175,7 @@ class Signal extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -2,6 +2,7 @@ import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Line from 'zrender/src/graphic/shape/Line';
import Text from 'zrender/src/graphic/Text';
import store from '@/store/index';
export default class SignalButton extends Group {
constructor(model, {style}) {
@ -131,7 +132,7 @@ export default class SignalButton extends Group {
setShowMode() {
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -2,6 +2,7 @@ import Group from 'zrender/src/container/Group';
import Line from 'zrender/src/graphic/shape/Line';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Text from 'zrender/src/graphic/Text';
import store from '@/store/index';
export default class SplitStation extends Group {
constructor(model, {style}) {
@ -132,7 +133,7 @@ export default class SplitStation extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -783,8 +783,8 @@ export default class Station extends Group {
this.troButton && this.troButton.hide();
}
}
setShowStation(flag) {
if (flag) {
setShowStation(stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
if (this.model.visible) {
this.eachChild(item => {
item.show();

View File

@ -4,6 +4,7 @@
import Polyline from 'zrender/src/graphic/shape/Polyline';
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import store from '@/store/index';
export default class StationCounter extends Group {
constructor(model, {style}) {
@ -90,7 +91,7 @@ export default class StationCounter extends Group {
}
setShowMode() {}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -4,6 +4,7 @@
import Rect from 'zrender/src/graphic/shape/Rect';
import Text from 'zrender/src/graphic/Text';
import Group from 'zrender/src/container/Group';
import store from '@/store/index';
export default class StationDelayUnlock extends Group {
constructor(model, {style}) {
@ -108,7 +109,7 @@ export default class StationDelayUnlock extends Group {
}
setShowMode() {}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -38,6 +38,7 @@ import ETrainSetButton from './ETrainSetButton';
import EStationPlatform from './EStationPlatform';
import {traverseLineElements, traverseStatusElements} from '../utils/ShapeStatusCovert';
import store from '@/store/index';
class StationStand extends Group {
constructor(model, {style, mapDevice}) {
@ -248,7 +249,7 @@ class StationStand extends Group {
}
}
setShowStation(stationCode) {
if ((!stationCode || this.model.deviceStationCode === stationCode) && this.model.visible) {
if ((!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) && this.model.visible) {
this.eachChild(item => {
item.show();
});

View File

@ -4,6 +4,7 @@ import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect';
import EFoldbackMode from './EFoldbackMode';
import EMouse from './EMouse';
import store from '@/store/index';
export default class StationTurnBack extends Group {
constructor(model, {style, lineCode}) {
@ -198,7 +199,7 @@ export default class StationTurnBack extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -12,6 +12,7 @@ import ESwBlock from './ESwBlock';
import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
import ETriangle from './ETriangle';
import store from '@/store/index';
export default class Switch extends Group {
constructor(model, {style, mapDevice}) {
@ -811,7 +812,7 @@ export default class Switch extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -1,6 +1,7 @@
import Text from 'zrender/src/graphic/Text';
import Group from 'zrender/src/container/Group';
import BoundingRect from 'zrender/src/core/BoundingRect';
import store from '@/store/index';
export default class Text2 extends Group {
constructor(model, {style, lineCode}) {
@ -11,8 +12,8 @@ export default class Text2 extends Group {
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.z = 6;
this.lineCode = lineCode;
this.z = 6;
this.lineCode = lineCode;
this.isShowShape = true;
this.create();
this.setState(model);
@ -69,7 +70,7 @@ export default class Text2 extends Group {
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -96,7 +96,7 @@ class EMouse extends Group {
text = ` The planned train: ${trainType} \n Table No.: ${this.device.model.serviceNumber} \n Train Trip No.: ${this.device.model.tripNumber}\n Destination: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n Train No.: ${this.device.model.groupNumber}\n Early or late: ${destinationText}\n Direction: ${direction ? 'up' : 'down'}\n Crew No.: \n Start Station: \n Terminal Station: \n Occupied Track: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n Current Station: \n Train-ground communication: normal \n Operation Speed level: 4 \n Detained: ${this.device.model.hold ? 'Detained' : 'Normal'}\n \n 跳停状态: ${this.device.model.jump ? 'Skip to continue moving' : 'Normal'}Stationary: ${!this.device.model.stop ? 'No' : 'Yes'}\n Blocked: No \n Speed: ${this.device.model.speed || 0} km/h \n Authorized Distance: ${this.device.model.maLen || 0} m`;
} else {
if (this.device.style.Train.moreTrainDetail) {
text = `列车类型: ${trainType}\n\0\0\0\0源:人工标记\n\0\0号: ${this.device.model.groupNumber}\n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0点: ${destinationText}${this.parseDt(this.device.model.dt)}\n运行方向: ${direction ? '上行' : '下行'}\nATP报告方向: ${direction ? '上行' : '下行'}\n起点站名: ${stationNames.get(this.device.model.startStation) || ''}\n终点站名: ${stationNames.get(this.device.model.endStation) || ''}\n占用轨道: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n所在车站: ${stationNames.get(this.device.model.stationCode) || ''}\n车次通信: 通信车\n运行时间: ${this.device.model.runningTime}s\n停站时间: ${this.device.model.parkingRemainTime < 0 ? '无效' : `${this.device.model.parkingRemainTime}s`}\n扣车状态: ${ this.device.model.hold ? '扣车' : '正常'}\n车载扣车: 不执行\n跳停状态: ${this.device.model.jump ? '跳停' : '正常'}\n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车状态: ${this.device.model.runLevel || 'CTC'}\n最高信号系统控制: CTC\n驾驶模式: ${this.device.model.driveMode}模式\n最高ATP模式: AM\nATP1状态: 激活\nATP2状态: 备用\n速度: ${this.device.model.speed || 0} km/h\n车门状态: ${this.device.model.model.doorCloseLock ? '关闭' : closeDoorTip}\n制动状态: 无紧急制动\n停车保证: 可保证停车\n站台无法进入: 否\n前方站台停车点: 中间\n折返策略: ${turnBackStrategyMap.get(this.device.model.turnBackStrategy) || ''}\n折返状态: ${turnBackStatusMap.get(this.device.model.turnBackStatus)}\n屏蔽门开门许可: 是\n运营里程: 无效\n总重量: 196T\n车长: 11860cm\n列车编组: 1`;
text = `列车类型: ${trainType}\n\0\0\0\0源:人工标记\n\0\0号: ${this.device.model.groupNumber}\n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0点: ${destinationText}${this.parseDt(this.device.model.dt)}\n运行方向: ${direction ? '上行' : '下行'}\nATP报告方向: ${direction ? '上行' : '下行'}\n起点站名: ${stationNames.get(this.device.model.startStation) || ''}\n终点站名: ${stationNames.get(this.device.model.endStation) || ''}\n占用轨道: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n所在车站: ${stationNames.get(this.device.model.stationCode) || ''}\n车次通信: 通信车\n运行时间: ${this.device.model.runningTime}s\n停站时间: ${this.device.model.parkingRemainTime < 0 ? '无效' : `${this.device.model.parkingRemainTime}s`}\n扣车状态: ${ this.device.model.hold ? '扣车' : '正常'}\n车载扣车: 不执行\n跳停状态: ${this.device.model.jump ? '跳停' : '正常'}\n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车状态: ${this.device.model.runLevel === 'CBTC' ? 'CTC' : this.device.model.runLevel}\n最高信号系统控制: CTC\n驾驶模式: ${this.device.model.driveMode}模式\n最高ATP模式: AM\nATP1状态: 激活\nATP2状态: 备用\n速度: ${this.device.model.speed || 0} km/h\n车门状态: ${this.device.model.model.doorCloseLock ? '关闭' : closeDoorTip}\n制动状态: 无紧急制动\n停车保证: 可保证停车\n站台无法进入: 否\n前方站台停车点: 中间\n折返策略: ${turnBackStrategyMap.get(this.device.model.turnBackStrategy) || ''}\n折返状态: ${turnBackStatusMap.get(this.device.model.turnBackStatus)}\n屏蔽门开门许可: 是\n运营里程: 无效\n总重量: 196T\n车长: 11860cm\n列车编组: 1`;
} else {
text = `列车类型: ${trainType} \n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0号: ${this.device.model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${direction ? '上行' : '下行'}\n乘务组号: \n起点站名: ${stationNames.get(this.device.model.startStation) || ''}\n终点站名: ${stationNames.get(this.device.model.endStation) || ''}\n占用轨道: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${this.device.model.hold ? '扣车' : '正常'}\n跳停状态: ${this.device.model.jump ? '跳停' : '正常'} \n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.model.speed || 0} km/h\n列车移动授权距离: ${this.device.model.maLen || 0} m`;
}

View File

@ -93,6 +93,7 @@ export default class Train extends Group {
turnBackStrategy: model.turnBackStrategy,
turnBackStatus: model.turnBackStatus,
stationCode: model.stationCode,
runLevel: model.runLevel,
model: model
});
const rect = this.trainB.getBoundingRectOfFont().clone();
@ -454,24 +455,22 @@ export default class Train extends Group {
}
setShowMode() { }
initShowStation(model) {
if (model.trainWindowModel && model.trainWindowModel.instance && !model.trainWindowModel.instance.isShowShape) {
if (model.trainWindowModel && model.trainWindowModel.instance && !store.getters['map/checkDeviceShow'](model.trainWindowModel.instance.stationCode, model.sectionModel.code)) {
this.eachChild(item => {
item.hide();
});
}
}
setShowStation(stationCode) {
if ((this.model.sectionModel && this.model.sectionModel.stationCode === stationCode) || !stationCode) {
if ((this.model.sectionModel && store.getters['map/checkDeviceShow'](stationCode, this.model.sectionModel.code)) || !stationCode) {
this.eachChild(item => {
item.show();
});
this.isShowShape = true;
this.setState(this.model, this);
} else {
this.eachChild(item => {
item.hide();
});
this.isShowShape = false;
}
}
// screenShow() {

View File

@ -15,6 +15,7 @@ class TrainWindow extends Group {
this.z = 9;
this.prdType = store.state.training.prdType;
this.isShowShape = model.isShowShape;
this.stationCode = '';
this.create();
this.createMouseEvent();
this.setState(model);
@ -92,19 +93,21 @@ class TrainWindow extends Group {
});
}
}
setShowStation(flag) {
if (flag) {
this.eachChild(item => {
item.show();
});
this.isShowShape = true;
this.setState(this.model);
} else {
this.eachChild(item => {
item.hide();
});
this.isShowShape = false;
}
setShowStation(stationCode) {
this.stationCode = stationCode;
// console.log(this.model);
// if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this.model.sectionModel)) {
// this.eachChild(item => {
// item.show();
// });
// this.isShowShape = true;
// this.setState(this.model);
// } else {
// this.eachChild(item => {
// item.hide();
// });
// this.isShowShape = false;
// }
}
getAnchorPoint() {
return this.model.point || this.model.position;

View File

@ -4,6 +4,7 @@
import Group from 'zrender/src/container/Group';
import EControl from '../element/EControl';
import EMouse from './EMouse';
import store from '@/store/index';
export default class ZcControl extends Group {
constructor(model, {style}) {
@ -110,7 +111,7 @@ export default class ZcControl extends Group {
}
setShowMode() {}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
this.eachChild(item => {
item.show();
});

View File

@ -8,7 +8,7 @@ export default class checkBox extends Group {
this._type = model._type;
this._code = model.code;
this.zlevel = model.zlevel;
this.z = model.z;
this.z = model.z || 999;
this.create();
}
@ -16,7 +16,7 @@ export default class checkBox extends Group {
const model = this.model;
this.box = new Rect({
zlevel: model.zlevel,
z: model.z,
z: model.z || 999,
draggable: false,
shape: {
x: model.point.x,

View File

@ -125,6 +125,8 @@ const PublishExamRule = () => import('@/views/publish/examRule/index');
const PublishExamRuleDraft = () => import('@/views/publish/examRule/draft/index');
const PublishIBP = () => import('@/views/publish/publishIBP/index');
const PublishISCS = () => import('@/views/publish/publishISCS/index');
const PublishModel = () => import('@/views/publish/userModel/index');
const PublishModelHistory = () => import('@/views/publish/userModel/history');
const TrainingPlatform = () => import('@/views/trainingPlatform/index');
@ -916,6 +918,19 @@ export const asyncRouter = [
meta: {
i18n: 'router.mapGroup'
}
},
{ //发布模型管理
path: 'userModel',
component: PublishModel,
meta: {
i18n: 'router.userModel'
},
},
{ //模型历史版本
path: 'userModel/history',
name: 'modelHistory',
component: PublishModelHistory,
hidden: true
}
]
},

View File

@ -139,8 +139,8 @@ export const IbpOperation = {
XXYS: {operate: '09', event: 'XXYS', name: '下行钥匙'},
SXYS: {operate: '11', event: 'SXYS', name: '上行钥匙'},
AXLE_RESET: {operate: '12', event: 'AXLE_RESET', name: '计轴复位'},
AXLE_PRE_RESET: {operate: '13', event: 'AXLE_PRE_RESET', name: '计轴复位'},
PRERESET_Z: {operate: '14', event: 'PRERESET_Z', name: '计轴预复'},
AXLE_PRE_RESET: {operate: '13', event: 'AXLE_PRE_RESET', name: '计轴区段复位'},
PRERESET_Z: {operate: '14', event: 'PRERESET_Z', name: '计轴预复'},
SD: {operate: '15', event: 'SD', name: '试灯'},
XXGM: {operate: '16', event: 'XXGM', name: '下行屏蔽门开门'},
SXGM: {operate: '17', event: 'SXGM', name: '上行屏蔽门开门'},

View File

@ -665,6 +665,19 @@ const map = {
}
return device;
},
checkDeviceShow: (state) => (stationCode, deviceCode) => {
if (state.map && state.map.displayList && state.map.displayList.length) {
let flag = false;
state.map.displayList.forEach(item => {
if (item.stationCodeList.includes(stationCode) && item.elementList.includes(deviceCode)) {
flag = true;
}
});
return flag;
} else {
return true;
}
}
},

View File

@ -6,7 +6,7 @@ export function getBaseUrl() {
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
BASE_API = 'http://192.168.2.175:9000'; // 旭强 有线
// BASE_API = 'http://192.168.8.114:9000'; // 旭强 无线
// BASE_API = 'http://192.168.3.120:9000'; // 张赛
// BASE_API = 'http://192.168.2.183:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -10,11 +10,23 @@
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor">
<el-select v-model="form.buttonColor" :placeholder="this.$t('ibp.selectTheButtonColor')">
<el-option :label="this.$t('ibp.redButton')" value="red" />
<el-option :label="this.$t('ibp.yellowButton')" value="yellow" />
<el-option :label="this.$t('ibp.greenButton')" value="green" />
<el-option :label="this.$t('ibp.blueButton')" value="blue" />
<el-option :label="this.$t('ibp.grayButton')" value="gray" />
<el-option
v-for="item in colors"
:key="`btn${item}`"
:label="`${$t(`ibp.${item}`)}${$t('ibp.button')}`"
:value="item"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonLightColor')" prop="buttonLightColor">
<el-select v-model="form.buttonLightColor">
<el-option label="默认" value=""></el-option>
<el-option
v-for="item in colors"
:key="`light${item}`"
:label="`${$t(`ibp.${item}`)}`"
:value="item"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonWidth')" prop="buttonWidth">
@ -86,14 +98,16 @@ export default {
{ label: "屏蔽门开门", value: "KM" },
{ label: "屏蔽门关门", value: "GM" },
{ label: "计轴复位", value: "AXLE_RESET" },
{ label: "计轴复位", value: "AXLE_PRE_RESET" },
{ label: "计轴预复", value: "PRERESET_Z" },
{ label: "计轴区段复位", value: "AXLE_PRE_RESET" },
{ label: "计轴预复", value: "PRERESET_Z" },
{ label: "试灯", value: "SD" }
],
colors: ["red", "yellow", "blue", "green", "gray"],
operateWithoutDirections: ["AXLE_RESET", "AXLE_PRE_RESET", "PRERESET_Z", "SD"],
form: {
code: "",
buttonColor: "red",
buttonLightColor: "",
buttonWidth: 25,
x: 10,
y: 10,
@ -125,6 +139,7 @@ export default {
this.isUpdate = true;
this.form.code = model.code;
this.form.buttonColor = model.color;
this.form.buttonLightColor = model.lightColor;
this.form.buttonWidth = model.width;
this.form.x = model.point.x;
this.form.y = model.point.y;
@ -167,6 +182,7 @@ export default {
_type: "SquareButton",
code: this.form.code,
color: this.form.buttonColor,
lightColor: this.form.buttonLightColor,
status: "off",
width: this.form.buttonWidth,
mean: this.form.mean,
@ -189,6 +205,7 @@ export default {
_type: "SquareButton",
code: this.form.code,
color: this.form.buttonColor,
lightColor: this.form.buttonLightColor,
status: "off",
width: this.form.buttonWidth,
mean: this.form.mean,
@ -205,6 +222,7 @@ export default {
this.form = {
code: "",
buttonColor: "red",
buttonLightColor: "",
buttonWidth: 25,
x: 10,
y: 10,

View File

@ -15,7 +15,7 @@
icon="el-icon-folder-add" @click="addProgress"></div>
</el-tab-pane>
<el-tab-pane label="课程三维资源列表" name="assetlist" >
<el-tab-pane label="场景三维资源" name="assetlist" >
<div class="progressdiv" v-for="(elementtrigger,indextrigger) in triggerList" :key="elementtrigger.label">
<div class="changeprogressdiv" @click="selectModel(elementtrigger)">{{elementtrigger.label}}</div>
<div class="delprogressdiv" v-if="(elementtrigger.showType == 'loadModel')" @click="deleteModel(elementtrigger)" >X</div>

View File

@ -8,26 +8,10 @@
</el-form-item>
<el-form-item label="课程类型">
<el-select v-model="form.type" placeholder="请选择活动区域">
<el-option label="ATC(CBTC)多媒体教学演练系统" value="1"></el-option>
<el-option label="ZDJ9转辙机检修作业指导虚拟仿真系统" value="2"></el-option>
<el-option label="城市轨道交通车站机电设备虚拟仿真系统" value="3"></el-option>
<el-option label="城市轨道交通电客车虚拟仿真教学系统" value="4"></el-option>
<el-option label="城市轨道交通服务礼仪一点通系统" value="5"></el-option>
<el-option label="城市轨道交通基础知识系统(视频无必要做)" value="6"></el-option>
<el-option label="城市轨道交通考试系统(开始系统另算)" value="7"></el-option>
<el-option label="城市轨道交通手信号系统" value="8"></el-option>
<el-option label="城市轨道交通行车组织系统" value="9"></el-option>
<el-option label="城市轨道交通作业多媒体系统" value="10"></el-option>
<el-option label="城市轨道线路系统" value="11"></el-option>
<el-option label="单车实验虚拟仿真实训系统操作视频" value="12"></el-option>
<el-option label="地铁应急仿真实训操作视频" value="13"></el-option>
<el-option label="地铁站务人员各岗一日作业虚拟仿真实训系统" value="14"></el-option>
<el-option label="电话闭塞" value="15"></el-option>
<el-option label="机电设备短视频" value="16"></el-option>
<el-option label="一次乘务" value="17"></el-option>
<el-option label="一日作业完整版" value="18"></el-option>
<el-option label="一日作业演示版" value="19"></el-option>
<el-select v-model="form.type" placeholder="请选择课程类型">
<el-option label="地铁车站" value="1"></el-option>
<el-option label="场景展示" value="2"></el-option>
<el-option label="单体设备展示" value="3"></el-option>
</el-select>
</el-form-item>

View File

@ -14,7 +14,10 @@
</el-form-item>
<el-form-item label="三维场景设置:">
<el-select v-model="lessonData.lessonData.lessonProgress[lessonEditIndex].progressScene" placeholder="请选择场景">
<el-select
v-model="lessonData.lessonData.lessonProgress[lessonEditIndex].progressScene"
placeholder="请选择场景"
@change="selectScene">
<el-option v-for="sceneItem in sceneDataList" :label="sceneItem.label" :value="sceneItem.value" :key="sceneItem.value"></el-option>
</el-select>
</el-form-item>
@ -383,6 +386,9 @@
}
},
selectScene(val){
editAction("changeScene",val);
},
updateData(){
// this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].stepTipsData;
},

View File

@ -200,6 +200,7 @@
},
mounted() {
window.updateTriggerList = this.updateTriggerList;
window.editAction = this.editAction;
this.init(this.$route.query.lessonId);
},
@ -268,6 +269,7 @@
changeProgressView(viewIndex){
this.lessonEditIndex = viewIndex;
this.$refs.lessonProPerty.reset();
this.jl3d.changeIndex(viewIndex);
},
removeProgress(removeIndex){
this.lessonData.removeLessonProgress(removeIndex);
@ -292,6 +294,9 @@
this.triggerList = newTriggerList;
console.log(this.triggerList);
},
editAction(type,value1,value2){
this.jl3d.editActionManager(type,value1,value2);
},
jumpPlayer(){
this.$router.push({ path: '/design/jlmap3d/lesson3dplayer', query: {lessonId: this.$route.query.lessonId} });

View File

@ -2,7 +2,7 @@
<div>
<div class="schema" :style="{top: offset+'px'}">
<select-station v-if="isLocalStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
<el-select v-if="isAdmin" v-model="speed" style="width: 100px;" size="small" @change="speedChange">
<el-select v-model="speed" style="width: 100px;" size="small" @change="speedChange">
<el-option
v-for="item in speedList"
:key="item.value"
@ -84,18 +84,6 @@ export default {
swch: '02',
isScriptCommand:false,
faultMode: false,
speedList:[
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' },
{ value: 6, label: '6倍速' },
{ value: 7, label: '7倍速' },
{ value: 8, label: '8倍速' },
{ value: 9, label: '9倍速' },
{ value: 10, label: '10倍速' }
],
speed: 1
// firstLoad: true
};
@ -133,6 +121,26 @@ export default {
},
isAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
},
speedList() {
return this.isAdmin ? [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' },
{ value: 6, label: '6倍速' },
{ value: 7, label: '7倍速' },
{ value: 8, label: '8倍速' },
{ value: 9, label: '9倍速' },
{ value: 10, label: '10倍速' }
] : [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' }
];
}
},
watch: {

View File

@ -57,12 +57,13 @@ export default {
this.showMemberId = val;
const member = this.$store.state.training.memberData[val];
const station = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
const lineCode = this.$store.getters['map/lineCode'];
if ((lineCode === '02' || lineCode === '05') && station) {
this.showStation = station.code;
const showStationCode = this.stationCentralizedMap[station.code];
this.setCenter(showStationCode);
} else if (station) {
// const lineCode = this.$store.getters['map/lineCode'];
// if ((lineCode === '02' || lineCode === '05') && station) {
// this.showStation = station.code;
// const showStationCode = this.stationCentralizedMap[station.code];
// this.setCenter(showStationCode);
// } else
if (station) {
this.showStation = station.code;
const showStationCode = this.stationCentralizedMap[station.code];
const mapDevice = this.$store.state.map.mapDevice;

View File

@ -499,22 +499,21 @@ export default {
}
});
this.$jlmap.updateShowMode(list, showMode);
EventBus.$emit('select_DrawType', showMode);
},
setShowStation(stationCode, setCenter) {
const lineCode = this.$store.getters['map/lineCode'];
if (lineCode === '02' || lineCode === '05') {
!setCenter && this.setCenter(stationCode);
} else {
const list = [];
const mapDevice = this.$store.state.map.mapDevice;
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$jlmap.updateShowStation(list, stationCode);
!setCenter && this.setCenter(stationCode);
// if (lineCode === '02' || lineCode === '05') {
// !setCenter && this.setCenter(stationCode);
// } else {
const list = [];
const mapDevice = this.$store.state.map.mapDevice;
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$jlmap.updateShowStation(list, stationCode);
!setCenter && this.setCenter(stationCode);
// }
},
setOffset(data, num, sum, obj) {
this.$jlmap.switchScreen(data, num, sum, obj);

View File

@ -552,18 +552,18 @@ export default {
// },
setShowStation(stationCode) {
const showStation = this.centralizedStationMap[stationCode];
const lineCode = this.$store.getters['map/lineCode'];
if (lineCode === '02' || lineCode === '05') {
this.$jlmap.setCenter(showStation);
} else {
const list = [];
const mapDevice = this.$store.state.map.mapDevice;
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$jlmap.updateShowStation(list, showStation);
this.$jlmap.setCenter(showStation);
// const lineCode = this.$store.getters['map/lineCode'];
// if (lineCode === '02' || lineCode === '05') {
// this.$jlmap.setCenter(showStation);
// } else {
const list = [];
const mapDevice = this.$store.state.map.mapDevice;
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$jlmap.updateShowStation(list, showStation);
this.$jlmap.setCenter(showStation);
// }
},
setCentralizedstationList(map) {
this.centralizedstationList = [];

View File

@ -8,8 +8,15 @@
<b>{{ mapInfo.name }}</b>
</el-tooltip>
</div>
<el-button type="text" class="operate-button" @click="showMap">绘图显隐</el-button>
<el-button type="text" class="operate-button" @click="showMap">显隐</el-button>
<el-button type="text" class="operate-button" @click="dataRelation">{{ $t('map.advanced') }}</el-button>
<el-dropdown class="operate-button" trigger="click">
<span class="el-dropdown-link">配置</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><span @click="showLocalConfig">现地配置</span></el-dropdown-item>
<el-dropdown-item><span @click="showScreenConfig">大屏配置</span></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown class="operate-button" trigger="click">
<span class="el-dropdown-link">数据操作</span>
<el-dropdown-menu slot="dropdown">
@ -19,7 +26,7 @@
</el-dropdown>
<el-button v-if="isSave" type="text" style="padding: 3px 0" :disabled="$attrs.mapSaveing" @click="saveMapEvent">{{ $t('map.save') }}</el-button>
</div>
<el-tabs v-show="projectType" v-model="enabledTab" class="mapEdit" type="card">
<el-tabs v-show="configShow === 'none'" v-model="enabledTab" class="mapEdit" type="card">
<el-tab-pane v-for="(each,index) in tabList" :key="index" :label="each.label" class="tab_pane_box" :name="each.name" :lazy="lazy">
<component
:is="each.menus"
@ -31,10 +38,14 @@
/>
</el-tab-pane>
</el-tabs>
<template v-show="!projectType">
<template v-if="configShow === 'local'">
<local-config ref="localConfig" :selected="selected" @goDraw="goDraw" />
</template>
<template v-show="configShow === 'screen'">
<split-screen
ref="splitScreen"
:selected="selected"
@goDraw="goDraw"
/>
</template>
</div>
@ -68,7 +79,7 @@ import SplitScreen from './splitScreen';
import FloodGate from './floodGate';
import DirectionRod from './directionRod';
import SignalButton from './signalButton';
import { EventBus } from '@/scripts/event-bus';
import LocalConfig from './localConfig';
export default {
name: 'MapOperate',
@ -99,7 +110,8 @@ export default {
SplitScreen,
FloodGate,
DirectionRod,
SignalButton
SignalButton,
LocalConfig
},
props: {
selected: {
@ -145,7 +157,7 @@ export default {
],
selectDevice:'',
enabledTab: 'Section',
projectType: true
configShow: 'none'
};
},
computed: {
@ -171,18 +183,20 @@ export default {
}
},
mounted() {
EventBus.$on('select_DrawType', (showMode) => {
if (showMode == '04') {
this.projectType = false;
} else {
this.projectType = true;
}
});
},
methods: {
dataRelation() {
this.$emit('selectView', 'path');
},
showLocalConfig() {
this.configShow = 'local';
},
showScreenConfig() {
this.configShow = 'screen';
},
goDraw() {
this.configShow = 'none';
},
showMap() {
this.$emit('showMap');
},

View File

@ -0,0 +1,310 @@
<template>
<div v-loading="loading" class="view-control-content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
<el-table-column label="车站">
<template slot-scope="scope">
<template v-for="stationCode in scope.row.stationCodeList">
<span :key="stationCode" style="margin-left: 10px">{{ getDeviceName(stationCode) }}</span>
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native.prevent="editModel(tableData, scope.$index)">
编辑
</el-button>
<el-button type="text" size="small" @click.native.prevent="deleteModel(tableData, scope.$index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-card class="box-card" shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header" class="clearfix">
<span style="font-size: 12px;">{{ cardTitle }}</span>
<el-button style="float: right; padding: 3px 3px" type="text" @click="clear">清空</el-button>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div style="padding: 10px;font-size: 14px;">
<div>
<span>车站</span>
<el-select v-model="addModel.stationCodeList" size="mini" style="width: 300px;" multiple placeholder="请选择">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div class="content-box-list" style="margin-top: 10px;">
<div class="title-box">设备列表</div>
<div class="list-box">
<div v-for="nor in addModel.elementList" :key="nor.code" class="list-content">
<div class="name">{{ getDeviceName(nor) }}</div>
<div class="close" @click="delList(nor, addModel.elementList)"><i class="el-icon-close" /></div>
</div>
</div>
</div>
</div>
</el-card>
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" @click="generateData">按集中站生成并保存</el-button>
<el-button type="primary" size="small" @click="save">保存</el-button>
<el-button type="primary" size="small" @click="back">返回</el-button>
</div>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { saveMap } from '@/api/jmap/mapdraft';
export default {
components: {
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
}
},
data() {
return {
tableData: [],
addModel: {
stationCodeList: [],
elementList: []
},
list: [],
field: '',
cardMode: 'generate',
index: '',
isPreview: true,
loading: false
};
},
computed: {
...mapGetters('map', [
'sectionList',
'stationList',
'signalList',
'switchList',
'stationStandList',
'automaticRouteButtonList',
'axleCounterResetButtonList',
'cycleButtonList',
'directionRodList',
'indicatorLightList',
'lineList',
'outerFrameList',
'psdList',
'responderList',
'tbStrategyList',
'tempSpeedLimitList',
'textList',
'totalGuideLockButtonVOList',
'localStationConfig',
'seclectDeviceList'
]),
cardTitle() {
if (this.cardMode === 'generate') {
return '生成数据';
} else if (this.cardMode === 'edit') {
return '编辑数据';
} else {
return '';
}
}
},
watch: {
selected: function (val, oldVal) {
this.deviceSelect(val);
}
},
mounted() {
this.initData();
},
methods: {
// deviceSelect(selected) {
// this.$refs.form && this.$refs.form.resetFields();
// this.$refs.make && this.$refs.make.resetFields();
// if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSection'.toUpperCase()) {
// if (selected.type === '01' || selected.type === '02' || selected.type === '03') {
// this.addModel.sectionCode = selected.code;
// this.field = '';
// }
// }
// },
initData() {
this.tableData = this.$store.state.map.map.displayList || [];
},
deviceSelect(selected) {
if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) {
this.seclectDeviceList.forEach(item => {
if (this.addModel.elementList.indexOf(item.code) < 0) {
this.addModel.elementList.push(item.code);
}
});
} else if (selected) {
if (this.addModel.elementList.indexOf(selected.code) < 0) {
this.addModel.elementList.push(selected.code);
}
}
},
getDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name || device.code;
},
deleteModel(list, index) {
list.splice(index, 1);
this.list.pop();
this.clearData();
this.cardMode = 'generate';
},
editModel(list, index) {
this.addModel = list[index];
this.index = index;
this.cardMode = 'edit';
},
cancelOverlab() {
this.cardMode = 'generate';
this.clear();
},
updateOverlab() {
if (this.index || this.index == 0) {
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
} else {
this.tableData.splice(this.index, 1, this.addModel);
}
this.clearData();
}
},
//
delList(model, list) {
list.forEach((nor, index) => {
if (nor == model) {
list.splice(index, 1);
}
});
this.seclectDeviceList.forEach((item, index) => {
if (item.code == model) {
this.seclectDeviceList.splice(index, 1);
}
});
},
save() {
const map = this.$store.state.map.map;
const param = {
displayList: this.tableData,
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存现地配置成功');
}).catch(() => {
this.$messageBox('保存现地配置失败');
});
},
back() {
this.$emit('goDraw');
},
generateOverlab() { //
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
} else {
this.tableData.push(this.addModel);
this.clearData();
}
},
clear() {
this.addModel = { stationCodeList: [], elementList: [] };
},
clearData() {
this.addModel = { stationCodeList: [], elementList: [] };
this.index = '';
this.cardMode = 'generate';
},
generateData() {
this.loading = true;
this.tableData = [];
this.stationList.forEach(item => {
if (item.centralized) {
this.tableData.push({stationCodeList: [...item.chargeStationCodeList, item.code], elementList: [...item.chargeStationCodeList, item.code]});
}
});
[...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList,
...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList,
...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList].forEach(item => {
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.stationCode));
target && target.elementList.push(item.code);
});
[...this.directionRodList].forEach(item => {
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.deviceStationCode));
target && target.elementList.push(item.code);
});
this.psdList.forEach(item => {
const stand = this.$store.getters['map/getDeviceByCode'](item.standCode);
const target = this.tableData.find(elem => elem.stationCodeList.includes(stand.stationCode));
target && target.elementList.push(item.code);
});
const map = this.$store.state.map.map;
const param = {
displayList: this.tableData,
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.loading = false;
this.$message.success('保存现地配置成功');
}).catch(() => {
this.loading = false;
this.$messageBox('保存现地配置失败');
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.title-box{
padding-left: 10px;
border-left: 4px solid red;
margin-bottom: 10px;
}
.list-box{
overflow: hidden;
.list-content{
float: left;
background: #e2e2e2;
margin: 5px;
border-radius: 5px;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding-right: 3px;
cursor: pointer;
&:hover{
background: #ccc;
}
.name{
float: left;
margin-right: 20px;
}
.close{
float: left;
width: 23px;
cursor: pointer;
}
}
}
</style>

View File

@ -70,6 +70,7 @@
<el-button type="primary" @click="save">保存</el-button>
<el-button v-if="isPreview" type="primary" @click="preview">预览</el-button>
<el-button v-if="!isPreview" type="primary" @click="recover">重置</el-button>
<el-button type="primary" @click="back">返回</el-button>
</div>
</el-scrollbar>
</div>
@ -269,6 +270,9 @@ export default {
};
this.$jlmap && this.$jlmap.setRecover(param);
},
back() {
this.$emit('goDraw');
},
clear() {
this.$refs.hostileForm.resetFields();
this.addModel.sectionCode = '';

View File

@ -26,7 +26,6 @@ export default {
reset: false,
show: false,
queryObject: {}
},
queryList: {
query: this.queryFunction,

View File

@ -0,0 +1,75 @@
<template>
<el-dialog v-dialogDrag :visible.sync="visible" :title="title" center :destroy-on-close="true">
<el-form :model="formData" :rules="formRules" ref="form">
<!-- <el-form-item label="模型编号" prop="code">
<el-input v-model="formData.code"></el-input>
</el-form-item> -->
<el-form-item label="模型名称" prop="name">
<el-input v-model="formData.name"></el-input>
</el-form-item>
<el-form-item label="版本" prop="version">
<el-select v-model="formData.version">
<el-option
v-for="item in versionOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="confirmHandler"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getModelVersions } from "@/api/management/model";
export default {
name: "EditModelInfo",
data() {
return {
visible: false,
title: "编辑模型",
formData: { code: "", name: "", type: "", version: "" },
versionOptions: [
{
label: "",
value: ""
}
],
formRules: {
// code: [{ required: true, message: "", trigger: "blur" }],
name: [{ required: true, message: "请输入模型名称", trigger: "blur" }]
}
};
},
mounted() {},
methods: {
initVersionInfo(code) {
getModelVersions(code).then(res => {
this.versionOptions = res.data.map(e => {
return {
label: e.version,
value: e.version
};
});
});
},
show(data) {
this.formData = data;
this.initVersionInfo(data.code);
this.visible = true;
},
close() {
this.visible = false;
this.$emit("close");
},
confirmHandler() {}
}
};
</script>
<style></style>

View File

@ -0,0 +1,95 @@
<template>
<div class="container">
<QueryListPage :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<div class="btn-area">
<el-button type="primary" @click="goBack">返回</el-button>
</div>
</div>
</template>
<script>
import { getModelVersionsPaging, setModelVersion } from "@/api/management/model";
export default {
name: "ModelHistory",
data() {
return {
pagerConfig: {
pageSize: "pageSize",
pageIndex: "pageNum"
},
queryForm: {
labelWidth: "80px",
reset: false,
show: false,
queryObject: {}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: "模型编号",
prop: "code"
// width:'300px'
},
{
title: "模型名称",
prop: "name"
// width:'200px'
},
{
title: "版本",
prop: "version"
// width:'200px'
},
{
title: "创建人ID",
prop: "createUserId"
},
{
title: "修改时间",
prop: "updateTime"
},
{
type: "button",
title: this.$t("global.operate"),
width: "100",
buttons: [
{
name: "应用",
handleClick: this.handleApply
}
]
}
]
}
};
},
methods: {
queryFunction() {
return getModelVersionsPaging(this.$route.query.code);
},
goBack() {
this.$router.go(-1)
},
handleApply(row, data) {
const {code, version} = {...data}
setModelVersion(code, version).then(resp=>{
this.$message.success(`成功切换为${version}版本`)
})
}
}
};
</script>
<style lang="scss" scoped>
.container {
padding: 10px;
.btn-area {
display: flex;
padding: 10px;
justify-content: center;
}
}
</style>

View File

@ -0,0 +1,105 @@
<template>
<div class="container">
<QueryListPage :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-model-info ref="editDialog" @close="reloadTable" />
</div>
</template>
<script>
import { getModelList } from "@/api/management/model";
import EditModelInfo from "./components/editInfo";
export default {
name: "publishModel",
components: { EditModelInfo },
data() {
return {
pagerConfig: {
pageSize: "pageSize",
pageIndex: "pageNum"
},
queryForm: {
labelWidth: "80px",
reset: true,
queryObject: {
code: {
type: "text",
label: "模型编号"
},
name: {
type: "text",
label: "模型名称"
},
type: {
type: "text",
label: "模型类型"
}
}
},
queryList: {
query: this.queryPublishedModelList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: "模型编号",
prop: "code"
},
{
title: "模型名称",
prop: "name"
},{
title: '当前版本',
prop: "version"
},
{
title: "创建时间",
prop: "createTime"
},
{
title: "修改时间",
prop: "updateTime"
},
{
type: "button",
title: this.$t("global.operate"),
width: "350",
buttons: [
// {
// name: "",
// handleClick: this.handleEdit
// },
{
name: "发布历史",
handleClick: this.handleHistory
},
// {
// name: this.$t("global.delete"),
// handleClick: this.handleDelete,
// type: "danger"
// }
]
}
]
}
};
},
methods: {
queryPublishedModelList(params) {
return getModelList(params);
},
reloadTable() {
this.queryList.reload();
},
handleEdit(row, data) {
this.$refs.editDialog.show(data);
},
handleDelete(row, data) {},
handleHistory(row, data) {
console.log(data.code);
this.$router.push({ name: `modelHistory`, query: { code: data.code } });
}
}
};
</script>
<style lang="sass" scoped></style>