武汉8号线调整
This commit is contained in:
parent
bc56e72414
commit
357635d085
@ -198,7 +198,6 @@ class MouseController extends Eventful {
|
||||
var newDevice = this.$jmap.getDeviceByCode(newEm.deviceCode) || {};
|
||||
var oldInstance = (this.$jmap.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
|
||||
var newInstance = (this.$jmap.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
|
||||
|
||||
// 如果之前和当前选中的实例不一致
|
||||
if (oldInstance != newInstance) {
|
||||
// 如果实例有取消选择函数并且被点击,则执行取消选中函数
|
||||
@ -207,12 +206,20 @@ class MouseController extends Eventful {
|
||||
oldDevice.instance['__down'] = false;
|
||||
oldInstance.mouseEvent['mouseout'](e);
|
||||
}
|
||||
if (oldInstance._type === 'Train' && oldInstance.trainB && oldInstance.trainB.mouseEvent) {
|
||||
oldDevice.instance['__click'] = false;
|
||||
oldInstance.trainB.mouseEvent['cancelMouseClick'](e);
|
||||
}
|
||||
|
||||
// 如果实例有选中函数并且被点击,则执行选中函数
|
||||
if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) {
|
||||
newDevice.instance['__down'] = true;
|
||||
newInstance.mouseEvent['mouseover'](e);
|
||||
}
|
||||
if (e.which == 1 && newInstance.mouseEvent && newInstance.mouseEvent.mouseClick) {
|
||||
newDevice.instance['__click'] = true;
|
||||
newInstance.mouseEvent['mouseClick'](e);
|
||||
}
|
||||
}
|
||||
|
||||
// 保存当前实例到全局
|
||||
|
@ -3,6 +3,7 @@ import Text from 'zrender/src/graphic/Text';
|
||||
import LangStorage from '@/utils/lang';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import store from '@/store/index';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
|
||||
class EMouse extends Group {
|
||||
constructor(device) {
|
||||
@ -105,7 +106,9 @@ class EMouse extends Group {
|
||||
// \nNumber of people: ${this.device.model.num ? this.device.model.num : 0}
|
||||
const path = window.location.href;
|
||||
const stationNames = new Map(store.state.map.map.stationList.map(s=>[s.code, s.name]));
|
||||
if (!path.includes('/practiceDisplay')) {
|
||||
if (getSessionStorage('project') === 'yjddzh') {
|
||||
text = `列车号:${this.device.model.groupNumber}\n位置:${this.device.model.locationKM}\n速度:${this.device.model.speed || 0} km/h\n方向:${this.device.model.right == 1 ? '下行' : '上行'}`;
|
||||
} else if (!path.includes('/practiceDisplay')) {
|
||||
if (LangStorage.getLang() == 'en') {
|
||||
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 {
|
||||
@ -120,7 +123,7 @@ class EMouse extends Group {
|
||||
}
|
||||
|
||||
const trainTip = this.device.style.Train.common.trainTip;
|
||||
if (trainTip) {
|
||||
if (trainTip || getSessionStorage('project') === 'yjddzh') {
|
||||
// 文字描述
|
||||
this.arrowText = new Text({
|
||||
zlevel: this.device.model.zlevel,
|
||||
@ -210,7 +213,41 @@ class EMouse extends Group {
|
||||
this.trainBorder.show();
|
||||
}
|
||||
}
|
||||
|
||||
mouseClick() {
|
||||
const scaleRate = parseFloat(this.device.model.model.zrOptions.scaleRate);
|
||||
const zrRect = {
|
||||
x: this.device.model.model.zrOptions.offsetX / scaleRate,
|
||||
y: this.device.model.model.zrOptions.offsetY / scaleRate,
|
||||
width: store.state.config.width / scaleRate,
|
||||
height: store.state.config.height / scaleRate
|
||||
};
|
||||
this.device.deviceModel.__click = true;
|
||||
const arrowTextRect = this.arrowText.getBoundingRect();
|
||||
const zrRectX = zrRect.x + zrRect.width;
|
||||
const zrRectY = zrRect.y + zrRect.height;
|
||||
const arrowTextRectX = arrowTextRect.x + arrowTextRect.width;
|
||||
const arrowTextRectY = arrowTextRect.y + arrowTextRect.height;
|
||||
if (arrowTextRectX > zrRectX || arrowTextRectY > zrRectY) {
|
||||
const offsetX = arrowTextRectX > zrRectX ? arrowTextRectX - zrRectX : 0;
|
||||
const offsetY = arrowTextRectY > zrRectY ? arrowTextRectY - zrRectY : 0;
|
||||
this.arrowText.setStyle({ x: this.device.model.point.x + 50 - offsetX, y: this.device.model.point.y + 25 - offsetY });
|
||||
}
|
||||
this.arrowText.show();
|
||||
if (this.device.style.Train.mouseOverStyle) {
|
||||
this.device.deviceModel.__click = true;
|
||||
this.trainBorder.show();
|
||||
}
|
||||
}
|
||||
cancelMouseClick() {
|
||||
if (this.device.deviceModel.__click) {
|
||||
this.arrowText.hide();
|
||||
this.device.deviceModel.__click = false;
|
||||
}
|
||||
if (this.device.style.Train.mouseOverStyle && this.device.deviceModel.__click) {
|
||||
this.trainBorder.hide();
|
||||
this.device.deviceModel.__click = false;
|
||||
}
|
||||
}
|
||||
mouseout() {
|
||||
if (this.device.model.style.Train.common.trainTip && this.device.deviceModel.__down) {
|
||||
this.arrowText.hide();
|
||||
|
@ -27,6 +27,9 @@ export default class TrainBody extends Group {
|
||||
store.dispatch('map/setTrainDetails', this.deviceModel);
|
||||
this.mouseEvent.mouseover();
|
||||
}
|
||||
if (this.deviceModel.__click) {
|
||||
this.mouseEvent.mouseClick();
|
||||
}
|
||||
this.on('mouseover', () => {
|
||||
store.dispatch('map/setTrainDetails', this.deviceModel);
|
||||
this.mouseEvent.mouseover();
|
||||
@ -35,6 +38,9 @@ export default class TrainBody extends Group {
|
||||
store.dispatch('map/setTrainDetails', null);
|
||||
this.mouseEvent.mouseout();
|
||||
});
|
||||
this.on('click', () => {
|
||||
this.mouseEvent.mouseClick();
|
||||
});
|
||||
}
|
||||
|
||||
create() {
|
||||
|
@ -101,6 +101,7 @@ export default class Train extends Group {
|
||||
stationCode: model.stationCode,
|
||||
runLevel: model.runLevel,
|
||||
preselectionMode: model.preselectionMode,
|
||||
locationKM: model.locationKM,
|
||||
model: model
|
||||
});
|
||||
const rect = this.trainB.getBoundingRectOfFont().clone();
|
||||
|
@ -27,7 +27,7 @@ export function handlerUrl(data) {
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.233/rtss-server';
|
||||
// BASE_API = 'http://114.116.51.125/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.90:9100'; // 周寅
|
||||
BASE_API = 'http://192.168.3.90:9000'; // 周寅
|
||||
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
|
||||
|
@ -3,6 +3,7 @@
|
||||
<div v-show="maskOpen" class="bigScreenMask" />
|
||||
<jlmap-visual ref="jlmapVisual" />
|
||||
<wh-train-list v-if="prdType=== '10'" ref="whTrainList" />
|
||||
<voice-command v-if="prdType === '10'" ref="whTrainList" />
|
||||
<div v-show="disPlay" class="bigScreenBack">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
@ -19,12 +20,14 @@ import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { TrainingMode } from '@/scripts/ConstDic';
|
||||
import WhTrainList from './whTrainList';
|
||||
import VoiceCommand from './voiceCommand';
|
||||
|
||||
export default {
|
||||
name: 'BigScreen',
|
||||
components: {
|
||||
JlmapVisual,
|
||||
WhTrainList
|
||||
WhTrainList,
|
||||
VoiceCommand
|
||||
},
|
||||
props: {
|
||||
widthLeft: {
|
||||
@ -190,14 +193,14 @@ export default {
|
||||
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
|
||||
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
|
||||
if (this.prdType === '10') {
|
||||
creatSubscribe(`/topic/yjddzh/trainPosition`, header);
|
||||
creatSubscribe(`/topic/yjddzh/trainPosition/simulation/${this.$route.query.group}`, header);
|
||||
}
|
||||
// await this.$store.dispatch('training/setHasSubscribed');
|
||||
},
|
||||
clearSubscribe() {
|
||||
clearSubscribe(`${displayTopic}\/${this.$route.query.group}`);
|
||||
if (this.prdType === '10') {
|
||||
clearSubscribe(`/topic/yjddzh/trainPosition`);
|
||||
clearSubscribe(`/topic/yjddzh/trainPosition/simulation/${this.$route.query.group}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
208
src/views/designPlatform/voiceCommand.vue
Normal file
208
src/views/designPlatform/voiceCommand.vue
Normal file
@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<div style="z-index: 99;bottom: 40px; left: 40px;position: absolute;">
|
||||
<div style="position: relative;">
|
||||
<el-button class="chat-box-footer-create chat-box-footer-send" :class="{'active': recordSending}" size="mini" type="primary" @click="startRecording()">
|
||||
<el-progress id="record_progress_bar" type="circle" :show-text="false" :percentage="100/60*seconds" :width="40" :stroke-width="2" status="success" />
|
||||
<i v-if="recordSending" class="el-icon-close close_icon" @click.stop="cancleRecording()" />
|
||||
<span class="iconfont icon-yuyin"></span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import RecordRTC from 'recordrtc';
|
||||
import { sendCommandNew } from '@/api/jmap/training';
|
||||
export default {
|
||||
name: 'VoiceCommand',
|
||||
data() {
|
||||
return {
|
||||
seconds: 0,
|
||||
recordSending: false,
|
||||
recorders: null,
|
||||
microphone:null,
|
||||
messageList: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
startRecording() {
|
||||
this.audioPlay = true;
|
||||
const that = this;
|
||||
if (!this.recordSending) {
|
||||
if (!this.recordSending && !this.recorders && !this.microphone) {
|
||||
const StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
|
||||
navigator.getUserMedia({ audio: true }, function (stream) {
|
||||
that.microphone = stream;
|
||||
that.recorders = new RecordRTC(that.microphone, {
|
||||
type: 'audio',
|
||||
recorderType: StereoAudioRecorder,
|
||||
numberOfAudioChannels: 1,
|
||||
bitsPerSecond:256000,
|
||||
desiredSampRate: 16000
|
||||
});
|
||||
that.recorders.startRecording();
|
||||
that.recordSending = true;
|
||||
that.audioPlay = false;
|
||||
that.inter = setInterval(() => {
|
||||
if (that.seconds < 60) {
|
||||
that.seconds++;
|
||||
} else {
|
||||
clearInterval(that.inter);
|
||||
that.stopRecording();
|
||||
}
|
||||
}, 1000);
|
||||
}, function (error) {
|
||||
switch (error.code || error.name) {
|
||||
case 'PERMISSION_DENIED':
|
||||
case 'PermissionDeniedError':
|
||||
that.$message({
|
||||
showClose: true,
|
||||
message: '用户拒绝提供信息',
|
||||
type: 'error'
|
||||
});
|
||||
break;
|
||||
case 'NOT_SUPPORTED_ERROR':
|
||||
case 'NotSupportedError':
|
||||
that.$message({
|
||||
showClose: true,
|
||||
message: '浏览器不支持硬件设备',
|
||||
type: 'error'
|
||||
});
|
||||
break;
|
||||
case 'MANDATORY_UNSATISFIED_ERROR':
|
||||
case 'MandatoryUnsatisfiedError':
|
||||
that.$message({
|
||||
showClose: true,
|
||||
message: '无法发现指定的硬件设备',
|
||||
type: 'error'
|
||||
});
|
||||
break;
|
||||
default:
|
||||
that.$message({
|
||||
showClose: true,
|
||||
message: '无法打开麦克风',
|
||||
type: 'error'
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.stopRecording(); // 发送语音
|
||||
}
|
||||
},
|
||||
cancleRecording() {
|
||||
if (this.microphone) {
|
||||
clearInterval(this.inter);
|
||||
this.seconds = 0;
|
||||
this.microphone.stop();
|
||||
this.microphone = null;
|
||||
this.recordSending = false;
|
||||
this.recorders = null;
|
||||
}
|
||||
},
|
||||
blobToBase64(blob, callback) {
|
||||
const fileReader = new FileReader();
|
||||
fileReader.onload = (e) => {
|
||||
callback(e.target.result);
|
||||
};
|
||||
fileReader.readAsDataURL(blob);
|
||||
},
|
||||
// 停止录制 发送语音
|
||||
stopRecording() {
|
||||
this.audioPlay = true;
|
||||
const that = this;
|
||||
this.recorders.stopRecording(function(blobURL) {
|
||||
clearInterval(that.inter);
|
||||
that.seconds = 0;
|
||||
const blob = that.recorders.getBlob();
|
||||
// const fd = new FormData();
|
||||
// fd.append('file', blob);
|
||||
that.blobToBase64(blob, (data) => {
|
||||
sendCommandNew(that.$route.query.group, 'YJDDZH_VOICE_COMMAND', {base64Str: data})
|
||||
.then(resp => {
|
||||
that.audioPlay = false;
|
||||
resp.data.command = '';
|
||||
that.messageList.push(resp.data);
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e);
|
||||
that.$message.error('语音指令发送失败: ' + e.message);
|
||||
that.audioPlay = false;
|
||||
});
|
||||
if (that.microphone) {
|
||||
that.microphone.stop();
|
||||
that.microphone = null;
|
||||
that.recordSending = false;
|
||||
that.recorders = null;
|
||||
}
|
||||
});
|
||||
// uploadAudioFiles(fd)
|
||||
// .then((resp) => {
|
||||
// that.audioPlay = false;
|
||||
// resp.data.command = '';
|
||||
// that.messageList.push(resp.data);
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.log(error);
|
||||
// that.$message.error('语音发送失败: ' + error.message);
|
||||
// that.audioPlay = false;
|
||||
// });
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#record_progress_bar{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.chat-box-footer-create{
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
line-height: 30px;
|
||||
cursor: pointer;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
background: green;
|
||||
border: none;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.chat-box-footer-send{
|
||||
background: #F2F2F2;
|
||||
right: 55px;
|
||||
cursor: pointer;
|
||||
.icon-yuyin{
|
||||
color: #333;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
}
|
||||
&.active{
|
||||
.icon-yuyin{
|
||||
color: green;
|
||||
}
|
||||
}
|
||||
.close_icon{
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 38px;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
padding: 3px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -4,9 +4,10 @@
|
||||
<div :show-close="false" class="menuTrainList_box" style="height: 100%;">
|
||||
<div class="menuTrainList">
|
||||
<el-table :data="trainList" height="100%" :highlight-current-row="true" style="border-radius:5px 0px 0px 5px;" @row-click="selectTrain">
|
||||
<el-table-column property="groupNum" label="车组号" width="130" />
|
||||
<el-table-column property="direction" label="方向" width="130" />
|
||||
<el-table-column property="location" label="公里标" width="130" />
|
||||
<el-table-column property="groupNum" label="车组号" width="100" />
|
||||
<el-table-column property="direction" label="方向" width="100" />
|
||||
<el-table-column property="location" label="公里标" width="100" />
|
||||
<el-table-column property="speed" label="速度" width="90" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
@ -33,15 +34,15 @@ export default {
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'$store.state.socket.whTrainInfo': function (val) {
|
||||
if (val) {
|
||||
this.trainMap.set(val.groupNum, {groupNum: val.groupNum, direction: val.roadType === 'RIGHT' ? '右' : '左', location: val.location});
|
||||
const trainList = [];
|
||||
for (const [key, value] of this.trainMap) {
|
||||
trainList.push(value);
|
||||
'$store.state.map.activeTrainListUpdate': function (val) {
|
||||
this.trainList = [];
|
||||
const activeTrainList = this.$store.state.map.activeTrainList;
|
||||
activeTrainList.forEach((trainCode)=>{
|
||||
const train = this.$store.getters['map/getDeviceByCode'](trainCode);
|
||||
if (train && train.sectionCode) {
|
||||
this.trainList.push({groupNum: train.code, direction: train.right == 1 ? '下行' : '上行', location: train.locationKM, speed: train.speed});
|
||||
}
|
||||
this.trainList = trainList;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -86,7 +87,6 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
padding: 7px 4px;
|
||||
width: 23px;
|
||||
|
Loading…
Reference in New Issue
Block a user