This commit is contained in:
ival 2019-08-20 18:35:59 +08:00
commit 0191158f87
17 changed files with 203 additions and 38 deletions

View File

@ -420,10 +420,11 @@ export function getSimulationInfo(group) {
} }
/** 获取可用的设备指令*/ /** 获取可用的设备指令*/
export function getAvailableDeviceCommand() { export function getAvailableDeviceCommand(params) {
return request({ return request({
url: `/api/simulation/deviceCommand/available`, url: `/api/simulation/deviceCommand/available`,
method: 'get' method: 'get',
params
}); });
} }

View File

@ -48,12 +48,20 @@ export function JLmapDriving(dom, data, skinCode) {
const renderer = SetRender(dom); const renderer = SetRender(dom);
renderer.domElement.style.position = 'absolute'; renderer.domElement.style.position = 'absolute';
renderer.domElement.style.top = '0'; renderer.domElement.style.top = '0';
var renderercctv = new THREE.WebGLRenderer();
renderercctv.setSize(dom.offsetWidth*0.2, dom.offsetHeight*0.2);
renderercctv.domElement.style.position = 'absolute';
renderercctv.domElement.style.top = '0';
document.getElementById('jlsimulation').appendChild(renderer.domElement); document.getElementById('jlsimulation').appendChild(renderer.domElement);
document.getElementById('jlcctv').appendChild(renderercctv.domElement);
// 定义相机 // 定义相机
let camera = SetCamera(dom); let camera = SetCamera(dom);
// 定义场景(渲染容器) // 定义场景(渲染容器)
const scene = SetScene(); const scene = SetScene();
const speed = 0; const speed = 0;
let drivingcode = null; let drivingcode = null;
@ -80,6 +88,8 @@ export function JLmapDriving(dom, data, skinCode) {
this.atospeed = null; this.atospeed = null;
this.trainnum = null; this.trainnum = null;
this.stime = null; this.stime = null;
this.drivecount = 0;
this.drivedata = null;
this.webwork=new Worker('../../static/workertest/trainworker.js'); this.webwork=new Worker('../../static/workertest/trainworker.js');
// 地图模型数据 // 地图模型数据
@ -91,6 +101,12 @@ export function JLmapDriving(dom, data, skinCode) {
const controls3 = new MouseControls(camera2, 1.6); const controls3 = new MouseControls(camera2, 1.6);
controls3.enabled = true; controls3.enabled = true;
scene.add(controls3.getObject()); scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 20);
cameracctv.position.set( 5, 1,27 );
cameracctv.rotation.y = Math.PI/5*3;
camera2.add(cameracctv);
// 订阅仿真socket // 订阅仿真socket
this.Subscribe = new Jl3dDriving(scope); this.Subscribe = new Jl3dDriving(scope);
// 连接到通信 // 连接到通信
@ -122,7 +138,9 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.animateswitch == true) { if (scope.animateswitch == true) {
// 根据相机渲染场景 // 根据相机渲染场景
renderer.render(scene, camera2); renderer.render(scene, camera2);
renderercctv.render(scene,cameracctv);
// updatcontrols(); // updatcontrols();
// renderercctv
controls3.update(); controls3.update();
// 检测动画构造器播放动画 // 检测动画构造器播放动画
@ -176,6 +194,10 @@ export function JLmapDriving(dom, data, skinCode) {
this.updatestoptime = function(stime) { this.updatestoptime = function(stime) {
scope.stime = stime; scope.stime = stime;
}; };
this.updatedrivedata = function(drivedata){
scope.drivecount += 1;
scope.drivedata = drivedata;
};
this.updatedrivingcode = function(code) { this.updatedrivingcode = function(code) {
drivingcode = code; drivingcode = code;

View File

@ -93,12 +93,13 @@ export function Jl3dDriving(jlmap3d) {
// //
// //
// } // }
if (data.type == 'Simulation_Driver_Change') { if (data.type == 'Simulation_Driver_Change') {
drivingcode = data.body.code; drivingcode = data.body.code;
jlmap3d.updatedrivingcode( data.body.code); jlmap3d.updatedrivingcode( data.body.code);
} }
if(data.type == 'Simulation_Drive_Data_Routing'){
jlmap3d.updatedrivedata(data.body);
}
if (data.type == 'Simulation_TrainSpeed') { if (data.type == 'Simulation_TrainSpeed') {
if (trainlisttest) { if (trainlisttest) {
@ -167,14 +168,14 @@ export function Jl3dDriving(jlmap3d) {
} else { } else {
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len; syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
} }
scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata); //scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
} else { } else {
if (data.body[i].directionType == '02') { if (data.body[i].directionType == '02') {
syncdata.percent = trainlisttest.list[code].progress; syncdata.percent = trainlisttest.list[code].progress;
} else { } else {
syncdata.percent = 1 - trainlisttest.list[code].progress; syncdata.percent = 1 - trainlisttest.list[code].progress;
} }
scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata); //scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
} }
if (data.body[i].parkRemainTime>0) { if (data.body[i].parkRemainTime>0) {

View File

@ -564,6 +564,7 @@ THREE.FBXLoader = ( function () {
if ( parameters.opacity < 1.0 ) { if ( parameters.opacity < 1.0 ) {
parameters.transparent = true; parameters.transparent = true;
parameters.alphaTest = 0.1;
} }
if ( materialNode.ReflectionFactor ) { if ( materialNode.ReflectionFactor ) {
@ -634,6 +635,7 @@ THREE.FBXLoader = ( function () {
case 'TransparentColor': case 'TransparentColor':
parameters.alphaMap = self.getTexture( textureMap, child.ID ); parameters.alphaMap = self.getTexture( textureMap, child.ID );
parameters.transparent = true; parameters.transparent = true;
parameters.alphaTest = 0.1;
break; break;
case 'AmbientColor': case 'AmbientColor':

View File

@ -6,6 +6,8 @@ const scriptRecord = {
state: { state: {
mapLocation: {}, //地图定位, mapLocation: {}, //地图定位,
simulationPause: true , simulationPause: true ,
scriptId:"",
}, },
getters: { getters: {
mapLocation: (state)=>{ mapLocation: (state)=>{
@ -14,6 +16,9 @@ const scriptRecord = {
simulationPause:(state)=>{ simulationPause:(state)=>{
return state.simulationPause; return state.simulationPause;
}, },
scriptId: (state)=>{
return state.scriptId;
},
}, },
mutations: { mutations: {
setMapLocation: (state, mapLocation) => { setMapLocation: (state, mapLocation) => {
@ -22,6 +27,9 @@ const scriptRecord = {
setSimulationPause: (state, simulationPause) => { setSimulationPause: (state, simulationPause) => {
state.simulationPause = simulationPause; state.simulationPause = simulationPause;
}, },
setscriptId: (state, scriptId) => {
state.scriptId = scriptId;
},
}, },
actions: { actions: {
/** /**
@ -33,6 +41,9 @@ const scriptRecord = {
updateSimulationPause: ({ commit }, simulationPause) => { updateSimulationPause: ({ commit }, simulationPause) => {
commit('setSimulationPause', simulationPause); commit('setSimulationPause', simulationPause);
}, },
updateScriptId: ({ commit }, scriptId) => {
commit('setscriptId', scriptId);
},
} }
}; };
export default scriptRecord; export default scriptRecord;

View File

@ -19,6 +19,8 @@
<div id="jlsimulation" class="jlmap3ddraw"> <div id="jlsimulation" class="jlmap3ddraw">
<canvas id="canvastexture" /> <canvas id="canvastexture" />
</div> </div>
<div id="jlcctv" class="jlmap3cctv">
</div>
<Drive-Mmi v-if="mmishow" ref="mmiui" /> <Drive-Mmi v-if="mmishow" ref="mmiui" />
@ -124,6 +126,13 @@ export default {
this.stoptimes = newVal; this.stoptimes = newVal;
} }
} }
},
'jlmap3d.drivecount': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata);
}
}
} }
}, },
beforeDestroy() { beforeDestroy() {
@ -287,6 +296,17 @@ export default {
z-index: -1; z-index: -1;
} }
.jlmap3cctv{
float: left;
left: 0;
top:0;
//left:20%;
width: 20%;
height: 20%;
position:absolute;
z-index: -1;
}
#canvastexture { #canvastexture {
position: absolute; position: absolute;
float: left; float: left;

View File

@ -112,21 +112,37 @@ export default {
nowatpspeed:0, nowatpspeed:0,
nowatospeed:0, nowatospeed:0,
mmimodel:null, mmimodel:null,
nstate:"tiaoting",
nimage:null, nimage:null,
dstate:"info",
dimage:null, dimage:null,
m1state:"rm",
m1image:null, m1image:null,
m2state:"cbtc",
m2image:null, m2image:null,
m3state:"zhefan",
m3image:null, m3image:null,
m4state:"out",
m4image:null, m4image:null,
m5state:"state15",
m5image:null, m5image:null,
m6state:"fache",
m6image:null, m6image:null,
m7state:"aoac",
m7image:null, m7image:null,
m8state:"jinjizhidong",
m8image:null, m8image:null,
m9state:"ato",
m9image:null, m9image:null,
m10state:"jinduan",
m10image:null, m10image:null,
c1state:"qianyin",
c1image:null, c1image:null,
c2state:"rm",
c2image:null, c2image:null,
c3state:"normal",
c3image:null, c3image:null,
c5state:"normal",
c5image:null, c5image:null,
images:null, images:null,
} }
@ -204,6 +220,75 @@ export default {
this.mmimodel.updateato(atospeed); this.mmimodel.updateato(atospeed);
} }
}, },
updatedrivedata(drivedata){
console.log(drivedata);
if(drivedata == "breaker"){
}
if(drivedata == "carwash"){
}
if(drivedata == "aircom"){
}
if(drivedata == "atb"){
}
if(drivedata == "bm"){
}
if(drivedata == "rm"){
if(this.m1state == "start"){
this.m1state = 'rm';
this.m1image = this.images.m1[this.m1state];
}else if(this.m1state == "rm"){
this.m1state = 'am';
this.m1image = this.images.m1[this.m1state];
}else if(this.m1state == "am"){
this.m1state = 'cm';
this.m1image = this.images.m1[this.m1state];
}else if(this.m1state == "cm"){
this.m1state = 'start';
this.m1image = this.images.m1[this.m1state];
}
}
if(drivedata == "cbtc"){
if(this.m2state == "start"){
this.m2state = 'il';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "il"){
this.m2state = 'itc';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "itc"){
this.m2state = 'cbtc';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "cbtc"){
this.m2state = 'start';
this.m2image = this.images.m2[this.m2state];
}
}
//doormode
if(drivedata == "AA"){
this.m7state = 'aoac';
this.m7image = this.images.m7[this.m7state];
}
if(drivedata == "AM"){
this.m7state = 'aomc';
this.m7image = this.images.m7[this.m7state];
}
if(drivedata == "MM"){
this.m7state = 'momc';
this.m7image = this.images.m7[this.m7state];
}
if(drivedata == "elflute"){
}
if(drivedata == "relieve"){
}
},
updatelen(len) { updatelen(len) {
//this.malen = 150+"px"; //this.malen = 150+"px";
if(len>=750){ if(len>=750){

View File

@ -82,6 +82,7 @@ export default {
// debugger; // debugger;
// this.$store // this.$store
localStore.set("script_mapId", id); localStore.set("script_mapId", id);
this.$store.dispatch('scriptRecord/updateScriptId',id);
this.getQuestPageList(id); this.getQuestPageList(id);
}, },
async getQuestPageList(id){ async getQuestPageList(id){

View File

@ -18,6 +18,7 @@
</template> </template>
<script> <script>
// import localStore from 'storejs';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import {listPublishMap} from '@/api/jmap/map'; import {listPublishMap} from '@/api/jmap/map';
import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import WindowResizeHandler from '@/mixin/WindowResizeHandler';
@ -31,7 +32,7 @@
loading:false, loading:false,
mapList: [], mapList: [],
taskStatusList: [], taskStatusList: [],
disabled:null, disabled:true,
formModel: { formModel: {
name: '', name: '',
mapId: '', mapId: '',
@ -77,6 +78,11 @@
// return '' // return ''
// } // }
}, },
watch:{
'$store.state.scriptRecord.scriptId': function (val) {
this.formModel.mapId=val;
}
},
mounted() { mounted() {
this.loadInitData(); this.loadInitData();
}, },
@ -88,6 +94,7 @@
this.mapList = []; this.mapList = [];
listPublishMap().then(response => { listPublishMap().then(response => {
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } }); this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } });
this.formModel.mapId=this.$store.state.scriptRecord.scriptId|| this.mapList[0].value;
}) })
}, },
doCreate() { doCreate() {

View File

@ -30,12 +30,12 @@
<div class="addCommand">添加指令</div> <div class="addCommand">添加指令</div>
<el-form :model="commandData" ref="commandData" :rules="commandRules" label-width="100px" class="actionInfo" label-position="right"> <el-form :model="commandData" ref="commandData" :rules="commandRules" label-width="100px" class="actionInfo" label-position="right">
<el-form-item label="执行者" class="conditionVO" prop="action.memberId"> <el-form-item label="执行者" class="conditionVO" prop="action.memberId">
<el-select v-model="commandData.action.memberId" placeholder="请选择执行者" :disabled="isPause"> <el-select v-model="commandData.action.memberId" placeholder="请选择执行者" :disabled="isPause" @change="changeRole">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id"></el-option> <el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="action.deviceCommand"> <el-form-item label="执行指令" class="conditionVO" prop="action.deviceCommand">
<el-select v-model="commandData.action.deviceCommand " placeholder="请选择设备指令" @change="changeCommand" class="inputStyle" :disabled="isPause"> <el-select v-model="commandData.action.deviceCommand " placeholder="请选择执行指令" @change="changeCommand" class="inputStyle" :disabled="isPause">
<el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand"></el-option> <el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -50,7 +50,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="addCommandAction('commandData')" :disabled="isPause" :loading="adding">添加动作</el-button> <el-button type="primary" @click="addCommandAction('commandData')" :disabled="isPause" :loading="adding">添加指令</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
@ -132,6 +132,7 @@
stationList:[], stationList:[],
memberList:[], memberList:[],
deviceCommandList:[], deviceCommandList:[],
orginMemberList:[],
rules:{ rules:{
actionVO:{ actionVO:{
memberId:[ memberId:[
@ -151,7 +152,7 @@
{ required: true, message: '请选择主体角色', trigger: 'change' } { required: true, message: '请选择主体角色', trigger: 'change' }
], ],
deviceCommand:[ deviceCommand:[
{ required: true, message: '请选择设备指令', trigger: 'change' } { required: true, message: '请选择执行指令', trigger: 'change' }
] ]
}, },
param:{ param:{
@ -172,6 +173,7 @@
initData(){ initData(){
getScriptMemberData(this.group).then(resp => { getScriptMemberData(this.group).then(resp => {
let roleTypeList=ConstConfig.ConstSelect.roleType; let roleTypeList=ConstConfig.ConstSelect.roleType;
this.orginMemberList=resp.data;
let lastData=JSON.stringify(resp.data); let lastData=JSON.stringify(resp.data);
roleTypeList.forEach(function(element){ roleTypeList.forEach(function(element){
let rolename=element.value; let rolename=element.value;
@ -179,12 +181,21 @@
}); });
lastData=JSON.parse(lastData); lastData=JSON.parse(lastData);
this.memberList=lastData; this.memberList=lastData;
getAvailableDeviceCommand().then(response=>{
this.deviceCommandList=response.data;
this.getDeviceCode(); this.getDeviceCode();
});
}).catch(error => {}) }).catch(error => {})
}, },
changeRole(index){
let role=this.orginMemberList.find(elem=>{return elem.id==index}).role;
let data={role:role};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList=response.data;
if(response.data.length<=0)
{
this.commandData.action.deviceCommand="";
this.isJinLu=false;
}
});
},
getDeviceCode(){ getDeviceCode(){
let params = {deviceType:"StationStand"}; let params = {deviceType:"StationStand"};
let group=this.group; let group=this.group;
@ -206,12 +217,12 @@
this.adding=true; this.adding=true;
addScriptAction(group,data).then(response=>{ addScriptAction(group,data).then(response=>{
this.adding=false; this.adding=false;
this.$message.success('添加动作成功'); this.$message.success('添加指令成功');
this.$emit('create'); this.$emit('create',true);
this.initCommandActionData(); this.initCommandActionData();
}).catch(error => { }).catch(error => {
this.adding=false; this.adding=false;
this.$messageBox(`添加动作失败: ${error.message}`); this.$messageBox(`添加指令失败: ${error.message}`);
}); });
} }
else { else {
@ -232,12 +243,12 @@
{ {
addScriptAction(group,data).then(response=>{ addScriptAction(group,data).then(response=>{
this.modifying=false; this.modifying=false;
this.$message.success('添加动作成功'); this.$message.success('添加对话成功');
this.$emit('create'); this.$emit('create',true);
this.initActionData(); this.initActionData();
}).catch(error => { }).catch(error => {
this.modifying=false; this.modifying=false;
this.$messageBox(`添加动作失败: ${error.message}`); this.$messageBox(`添加对话失败: ${error.message}`);
}); });
} }
else else
@ -246,14 +257,14 @@
modifyScriptAction(group,actionId,data).then(response=>{ modifyScriptAction(group,actionId,data).then(response=>{
this.modifying=false; this.modifying=false;
this.isNotModify=true; this.isNotModify=true;
this.$parent.$parent.setDisabled(this.isNotModify); this.$parent.$parent.$parent.setDisabled(this.isNotModify);
this.$emit('modifyButtonName'); this.$emit('modifyButtonName');
this.$message.success('修改动作成功'); this.$message.success('修改对话成功');
this.$emit('create'); this.$emit('create',false);
this.initActionData(); this.initActionData();
}).catch(error => { }).catch(error => {
this.modifying=false; this.modifying=false;
this.$messageBox(`修改动作失败: ${error.message}`); this.$messageBox(`修改对话失败: ${error.message}`);
}); });
} }
} }
@ -314,7 +325,7 @@
{ {
this.clearValidate(); this.clearValidate();
this.isNotModify=false; this.isNotModify=false;
this.$parent.$parent.setDisabled(this.isNotModify); this.$parent.$parent.$parent.setDisabled(this.isNotModify);
this.initData(); this.initData();
this.modalData.actionVO.id=data.id; this.modalData.actionVO.id=data.id;
this.modalData.actionVO.memberId=data.memberId; this.modalData.actionVO.memberId=data.memberId;

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="actionPaneInner"> <div class="actionPaneInner">
<div class="actionList"> <div class="actionList">
<span class="titleStyle">剧本动作</span> <span class="titleStyle">剧本编制</span>
</div> </div>
<div class="tab-pane-big"> <div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar" class="elScrollbar"> <el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar" class="elScrollbar">
@ -53,7 +53,7 @@
behaviorName:"", behaviorName:"",
memberName:"", memberName:"",
operateType:"add", operateType:"add",
buttonName:"添加动作", buttonName:"添加对话",
} }
}, },
components: { components: {
@ -62,10 +62,19 @@
mounted(){ mounted(){
this.loadInitData(); this.loadInitData();
}, },
watch:{
actionInfoList: function(val){
this.$nextTick(function(){
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
});
}
},
methods:{ methods:{
loadInitData() { loadInitData() {
let group=this.$route.query.group; let group=this.$route.query.group;
getAvailableDeviceCommand().then(response=>{ let data={role:"Driver"};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList=response.data; this.deviceCommandList=response.data;
this.loadOtherData(this.$route.query); this.loadOtherData(this.$route.query);
}); });
@ -137,21 +146,16 @@
reloadTable(){ reloadTable(){
this.loadInitData(); this.loadInitData();
}, },
create(){ create(data){
this.reloadTable(); this.reloadTable();
this.$nextTick(function(){
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
});
}, },
modifyAction(row){ modifyAction(row){
this.operateType="modify"; this.operateType="modify";
this.buttonName="修改动作" this.buttonName="修改对话"
this.$refs.addBehavior.doShow(row); this.$refs.addBehavior.doShow(row);
}, },
modifyButtonName(){ modifyButtonName(){
this.buttonName="添加动作", this.buttonName="添加对话",
this.operateType="add" this.operateType="add"
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

Before

Width:  |  Height:  |  Size: 394 KiB

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB