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

This commit is contained in:
Yuan 2022-09-22 18:21:28 +08:00
commit 6313b17345
12 changed files with 489 additions and 214 deletions

View File

@ -17,7 +17,7 @@
</template>
<script>
import { getToken } from '@/utils/auth';
import { getToken, getUserIdKey } from '@/utils/auth';
import { getSessionStorage } from '@/utils/auth';
import { loginInfo, ProjectIcon } from '@/scripts/ProjectConfig';
import DeomonTopic from '@/views/demonstration/deomonTopic';
@ -89,16 +89,19 @@ export default {
}
});
window.addEventListener('storage', e => {
if (this.$route.path.includes('trainingDesign')) {
if (e.key == 'setTrainingOperate') {
const operate = JSON.parse(e.newValue);
this.$store.dispatch('trainingNew/setTrainingOperate', operate);
}
if (e.key == 'setSceneOperate') {
if (e.key == getUserIdKey('setSceneOperate')) {
if (this.$route.path.includes('trainingDesign')) {
const operate = JSON.parse(e.newValue);
this.$store.dispatch('trainingNew/setSceneOperate', operate);
}
}
if (e.key == getUserIdKey('nextNew')) {
if (this.$route.path.includes('trainingDesign') || this.$route.path.includes('trainingPreview')) {
const operate = JSON.parse(e.newValue);
this.$store.dispatch('training/nextNew', operate);
}
}
});
this.$nextTick(() => {
openIndexedDB();

View File

@ -529,3 +529,11 @@ export function getRobotDrivingParam(simulationId, groupNumber) {
method: 'get'
});
}
/** 查询所有pa系统的定时播放任务 */
export function queryPaTimedList(group, params) {
return request({
url: `/simulation/${group}/iscs/paTimedPlay`,
method: 'get',
params
});
}

View File

@ -6,6 +6,7 @@ import { State2SimulationMap } from './Config.js';
import { sendTrainingNextStepNew } from '@/api/jmap/training';
import { getCmdList } from '@/api/management/dictionary';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { getLocalStorage } from '@/utils/auth';
class Handler {
constructor() {
@ -185,9 +186,17 @@ class Handler {
}
getNewTrainingOperation() {
try {
const stepList = JSON.parse(store.state.trainingNew.trainingDetail.stepJson);
const step = stepList[store.state.trainingNew.stepOrder - 1];
const stepOperation = step.operations[store.state.trainingNew.operateOrder];
let trainingDetail = getLocalStorage('trainingDetail') || `{}`;
trainingDetail = JSON.parse(trainingDetail);
const stepList = JSON.parse(trainingDetail.stepJson || `[]`);
let stepOrder = getLocalStorage('stepOrder') || `1`;
stepOrder = JSON.parse(stepOrder);
let operateOrder = getLocalStorage('operateOrder') || `1`;
operateOrder = JSON.parse(operateOrder);
const step = stepList[stepOrder - 1];
// const index = stepOrder - 1 >= 0 ? stepOrder - 1 : 0;
// const step = stepList[index];
const stepOperation = step.operations[operateOrder];
return stepOperation;
} catch (e) {
console.error(e);

View File

@ -6,6 +6,7 @@ import Handler from '@/scripts/cmdPlugin/Handler';
import { deepAssign } from '@/utils/index';
import store from '@/store/index';
import { ScriptMode } from '@/scripts/ConstDic';
import { setLocalStorage } from '@/utils/auth';
/**
* 实训状态数据
@ -430,6 +431,7 @@ const training = {
// 下一步
nextNew: ({ commit, state }, operate) => {
setLocalStorage('nextNew', JSON.stringify(operate));
return new Promise((resolve, reject) => {
commit('setOperate', operate);
if (!state.started && !state.mode) {

View File

@ -1,3 +1,4 @@
import { setLocalStorage } from '@/utils/auth';
const training = {
namespaced: true,
state: {
@ -44,6 +45,7 @@ const training = {
},
setTrainingDetail: (state, detail) => {
state.trainingDetail = detail;
setLocalStorage('trainingDetail', JSON.stringify(detail));
},
setTrainingSwitch: (state, flag) => {
state.trainingSwitch = flag;
@ -53,18 +55,22 @@ const training = {
},
stepOrderIncrease: (state) => {
state.stepOrder++;
setLocalStorage('stepOrder', JSON.stringify(state.stepOrder));
},
clearStepOrder: (state) => {
state.stepOrder = 0;
setLocalStorage('stepOrder', JSON.stringify(state.stepOrder));
},
operateOrderIncrease: (state) => {
state.operateOrder++;
setLocalStorage('operateOrder', JSON.stringify(state.operateOrder));
},
setSimulationPause: (state, value) => {
state.simulationPause = value;
},
clearOperateOrder: (state) => {
state.operateOrder = 0;
setLocalStorage('operateOrder', JSON.stringify(state.operateOrder));
},
stepOverCountChange: (state) => {
state.stepOverCount++;
@ -88,13 +94,14 @@ const training = {
},
trainingStart: ({commit}) => {
commit('setTrainingSwitch', true);
setLocalStorage('nextNew', null);
},
trainingEnd: ({commit}) => {
commit('setTrainingSwitch', false);
setLocalStorage('nextNew', null);
},
setTrainingOperate: ({commit, state}, trainingOperate) => {
commit('setTrainingOperate', trainingOperate);
window.localStorage.setItem('setTrainingOperate', JSON.stringify(trainingOperate));
},
stepOrderIncrease: ({commit}) => {
commit('stepOrderIncrease');
@ -119,7 +126,7 @@ const training = {
},
setSceneOperate: ({commit}, sceneOperate) => {
commit('setSceneOperate', sceneOperate);
window.localStorage.setItem('setSceneOperate', JSON.stringify(sceneOperate));
setLocalStorage('setSceneOperate', JSON.stringify(sceneOperate));
},
handleCheckNewTrainingResult:({commit, state}, valid) => {
const stepList = JSON.parse(state.trainingDetail.stepJson);

View File

@ -1,4 +1,5 @@
import SessionStorage from 'sessionstorage';
import store from '@/store/index';
const TokenKey = 'Admin-Token';
@ -23,3 +24,22 @@ export function setSessionStorage(key, value) {
export function removeSessionStorage(key) {
return SessionStorage.removeItem(key);
}
// 操作LocalStorage
export function getLocalStorage(key) {
const idKey = getUserIdKey(key);
return localStorage.getItem(idKey);
}
export function setLocalStorage(key, value) {
const idKey = getUserIdKey(key);
return localStorage.setItem(idKey, value);
}
export function removeLocalStorage(key) {
const idKey = getUserIdKey(key);
return localStorage.removeItem(idKey);
}
export function getUserIdKey(key) {
const id = store.state.user.id;
const idKey = `${id}_${key}`;
return idKey;
}

View File

@ -104,8 +104,9 @@ export function objectIsEqual(obj1, obj2) {
} else if (!(obj2 instanceof Object)) {
return false;
}
const arr1 = Object.keys(obj1);
const arr2 = Object.keys(obj2);
// 仅过滤值为null的项
const arr1 = Object.keys(obj1).filter(key => { return obj1[key] != null; });
const arr2 = Object.keys(obj2).filter(key => { return obj1[key] != null; });
if (arr1.length !== arr2.length) {
return false;
}

View File

@ -10,8 +10,6 @@
<el-button v-if="record" v-loading="loading" type="danger" :disabled="loading" size="small" @click="init">初始化</el-button>
<el-button v-if="!isPause && record" size="small" type="primary" @click="pauseScript">暂停</el-button>
<el-button v-if="isPause && record" size="small" type="primary" @click="executePlayScript">恢复</el-button>
<!-- <el-button v-if="!trainingSwitch && trainingDetail" type="success" size="small" @click="handlerStart">开始</el-button>-->
<!-- <el-button v-if="trainingSwitch" type="danger" size="small" @click="handlerEnd">结束</el-button>-->
<el-button type="primary" size="small" @click="back">返回</el-button>
</el-button-group>
</div>
@ -19,7 +17,7 @@
</template>
<script>
import { clearSimulation, executeScriptNew, simulationPause, exitRunPlan } from '@/api/simulation';
import { startTraining, endTraining, endTrainingStep } from '@/api/jmap/training';
import { endTrainingStep } from '@/api/jmap/training';
import TrainingJlmap from './trainingJlmap';
import MenuDemon from '@/views/trainingManage/demonMenu.vue';
import TrainingTip from './trainingTip';
@ -140,31 +138,14 @@ export default {
await clearSimulation(this.$route.query.group);
}
},
handlerStart() {
startTraining(this.group, {mode: this.teachMode}).then(() => {
this.$store.dispatch('trainingNew/changeTeachMode', this.teachMode);
this.$store.dispatch('trainingNew/trainingStart');
}).catch(() => {
this.$message.error('开始实训失败!');
});
},
nextStep() {
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
const step = stepList[this.$store.state.trainingNew.stepOrder - 1];
const index = this.$store.state.trainingNew.stepOrder - 1 >= 0 ? this.$store.state.trainingNew.stepOrder - 1 : 0;
const step = stepList[index];
endTrainingStep(this.group, step.id).then(resp => {
}).catch(() => {
this.$message.error('进入下一步实训失败!');
});
},
handlerEnd() {
endTraining(this.group).then(() => {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/changeTeachMode', '');
}).catch(() => {
this.$message.error('结束实训失败!');
});
}
}
};

View File

@ -148,6 +148,7 @@ export default {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/clearOperateOrder');
this.$store.dispatch('trainingNew/setTrainingScore', resp.data);
}).catch(() => {
this.$message.error('结束实训失败!');

View File

@ -0,0 +1,119 @@
<template>
<el-dialog
v-dialogDrag
:visible.sync="visible"
width="600px"
:before-close="doClose"
class="iscs-voice-broadcast-dialog"
>
<div>
<div class="dialog-header">实时广播</div>
<div class="secondary-title">信息内容</div>
<el-input
v-model="messageContent"
type="textarea"
:row="4"
placeholder="请输入内容"
/>
<div class="release-button" @click="releaseRealTime">发布</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'RealTimeBroadcast',
props: {
resourcesList: {
type: Array,
default: function () {
return [];
}
}
},
data() {
return {
visible: false,
messageContent: ''
};
},
methods:{
doClose() {
this.visible = false;
},
doShow() {
this.visible = true;
},
releaseRealTime() {
this.visible = false;
this.$emit('releaseRealTime', this.messageContent);
this.messageContent = '';
}
}
};
</script>
<style scoped>
.dialog-header{
text-align: center;
font-size: 28px;
margin-bottom: 15px;
}
.information-description-box{
height: 100px;
width: 100%;
background: #DCDCDC;
border-left: 2px solid #898888;
overflow-x: auto;
overflow-y: auto;
}
.information-box{
white-space: nowrap;
background: #DCDCDC;
margin-top: 2px;
cursor: pointer;
}
.secondary-title{
text-align: center;
width: 100%;
font-size: 18px;
background: #A9A9A9;
border-top: 2px solid #898888;
border-left: 2px solid #898888;
border-right: 2px solid #fff;
border-bottom: 2px solid #fff;
}
.information-context-box{
background: #DCDCDC;
width: 100%;
height: 200px;
overflow-y: auto;
}
.release-button{
position: absolute;
right: 20px;
background: #CCCCCC;
color: #000;
font-weight: bold;
margin-top: 10px;
padding: 7px 15px;
border-top: 2px solid #fff;
border-left: 2px solid #fff;
border-right: 2px solid #454541;
border-bottom: 2px solid #454541;
cursor: pointer;
}
</style>
<style>
.iscs-voice-broadcast-dialog .el-dialog__body{
background: #A9A9A9;
padding-top: 10px;
padding-bottom: 60px;
}
.iscs-voice-broadcast-dialog .el-dialog__headerbtn{
top: 10px;
}
.iscs-voice-broadcast-dialog .el-dialog__header{
background-image: linear-gradient(#FFE4C4, #F4A460, #FFE4C4);
}
</style>

View File

@ -144,74 +144,87 @@
</el-col>
</el-row>
</div>
<!--<div class="time-control-pa-home">-->
<!--<el-row :gutter="50">-->
<!--<el-col :span="2">-->
<!--<div class="time-control-button">时间控制</div>-->
<!--</el-col>-->
<!--<el-col :span="20">-->
<!--<el-row :gutter="20" style="margin-top: 5px; font-size: 13px">-->
<!--<el-col :span="2">-->
<!--<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">排定描述</div>-->
<!--</el-col>-->
<!--<el-col :span="22">-->
<!--<el-input v-model="addModel.scheduledDescribe" size="mini" style="width: 100%" /></el-col>-->
<!--</el-row>-->
<!--<el-row style="margin-top: 5px; font-size: 13px">-->
<!--<el-col :span="2">-->
<!--<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">开始时间</div>-->
<!--</el-col>-->
<!--<el-col :span="5">-->
<!--<el-date-picker-->
<!--v-model="addModel.startTime"-->
<!--type="datetime"-->
<!--placeholder="选择日期时间"-->
<!--size="mini"-->
<!--/>-->
<!--</el-col>-->
<!--<el-col :span="2">-->
<!--<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">结束时间</div>-->
<!--</el-col>-->
<!--<el-col :span="5">-->
<!--<el-date-picker-->
<!--v-model="addModel.endTime"-->
<!--type="datetime"-->
<!--placeholder="选择日期时间"-->
<!--size="mini"-->
<!--/>-->
<!--</el-col>-->
<!--<el-col :span="2">-->
<!--<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">延时时间</div>-->
<!--</el-col>-->
<!--<el-col :span="5">-->
<!--<el-time-picker-->
<!--v-model="addModel.delayTime"-->
<!--placeholder="选择时间"-->
<!--size="mini"-->
<!--/>-->
<!--</el-col>-->
<!--<el-col :span="1">-->
<!--<div class="time-control-button-small">今日</div>-->
<!--</el-col>-->
<!--<el-col :span="1">-->
<!--<div class="time-control-button-small">一次</div>-->
<!--</el-col>-->
<!--<el-col :span="1">-->
<!--<div class="time-control-button-small" style="width: 43px;">无截至</div>-->
<!--</el-col>-->
<!--</el-row>-->
<!--</el-col>-->
<!--<el-col :span="2">-->
<!--<div class="time-control-button-small" style="height: 50px;width: 50px; position: relative;top: 10px;right: 30px;line-height: 14px;padding-top: 10px;padding-left: 10px">设定<br>确认</div>-->
<!--</el-col>-->
<!--</el-row>-->
<!--</div>-->
<div class="pa-grey-box" />
<div class="time-control-pa-home">
<el-row :gutter="50">
<el-col :span="2">
<div class="time-control-button">时间控制</div>
</el-col>
<el-col :span="20">
<el-row :gutter="20" style="margin-top: 5px; font-size: 13px">
<el-col :span="2">
<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">排定描述</div>
</el-col>
<el-col :span="22">
<el-input v-model="addModel.desc" size="mini" style="width: 100%" /></el-col>
</el-row>
<el-row style="margin-top: 5px; font-size: 13px">
<el-col :span="2">
<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">开始时间</div>
</el-col>
<el-col :span="5">
<el-date-picker
v-model="addModel.startTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
size="mini"
/>
</el-col>
<el-col :span="2">
<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">结束时间</div>
</el-col>
<el-col :span="5">
<el-date-picker
v-model="addModel.endTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
size="mini"
/>
</el-col>
<el-col :span="2">
<div style="width: 65px;color: #FFF;text-align: center;height: 28px;line-height: 28px">延时时间</div>
</el-col>
<el-col :span="5">
<el-time-picker
v-model="addModel.delayTime"
value-format="HH:mm:ss"
placeholder="选择时间"
size="mini"
/>
</el-col>
<el-col :span="1">
<div class="time-control-button-small" @click="setToday">今日</div>
</el-col>
<el-col :span="1">
<div class="time-control-button-small" @click="setOnce">一次</div>
</el-col>
<el-col :span="1">
<div class="time-control-button-small" style="width: 43px;" @click="setNoEnd">无截至</div>
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<div class="time-control-button-small" style="height: 50px;width: 50px; position: relative;top: 10px;right: 30px;line-height: 14px;padding-top: 10px;padding-left: 10px" @click="setTimerBroadcast">设定<br>确认</div>
</el-col>
</el-row>
</div>
<div class="pa-grey-box">
<template v-for="(item, index) in timedList">
<el-row :key="index" style="display: flex; align-items: center;">
<el-col :span="5">{{ item.desc|| '--' }}</el-col>
<el-col :span="5">{{ item.startTime|| '--' }}</el-col>
<el-col :span="5">{{ item.endTime|| '--' }}</el-col>
<el-col :span="5">{{ item.delayTime|| '--' }}</el-col>
<el-col :span="4"><el-button type="text" @click="removeTimed(item)">删除</el-button></el-col>
</el-row>
</template>
</div>
<div style="position: absolute; left: 73%; top: 67%;width: 13%;height: 30%;font-size: 12px;color: #fff;"><state-table /></div>
<div class="broadcast-mode">
<el-row>
<el-col :span="12"><div style="height: 40px;text-align: center; background: #000088;color: #fff;line-height: 40px">实时广播</div></el-col>
<el-col :span="12"><div class="broadcast-mode-button" style="top: 5px; left: 10%;width: 80%;">广播</div></el-col>
<el-col :span="12"><div class="broadcast-mode-button" style="top: 5px; left: 10%;width: 80%;" @click="realTimeBroadCast">广播</div></el-col>
</el-row>
</div>
<div class="broadcast-mode" style="top: 25%;">
@ -244,26 +257,35 @@
</el-col>
</el-row>
</div>
<audio id="lcd_voice" controls style="width: 0;height: 0;" />
<audio id="up_stand_voice" controls style="width: 0;height: 0;" />
<audio id="down_stand_voice" controls style="width: 0;height: 0;" />
<audio id="administrative_area_voice" controls style="width: 0;height: 0;" />
<audio id="gate_area_voice" controls style="width: 0;height: 0;" />
<audio id="transfer_channel_voice" controls style="width: 0;height: 0;" />
<audio id="voice" controls style="width: 0;height: 0;" />
<real-time-broadcast ref="realTimeBroadcast" @releaseRealTime="releaseRealTime" />
</div>
</template>
<script>
import StateTable from './stateTable';
import { queryIscsDeviceCod } from '@/api/iscs';
import { queryIscsResourcesByGroup } from '@/api/simulation';
import { queryIscsResourcesByGroup, queryPaTimedList } from '@/api/simulation';
import { sendCommandNew } from '@/api/jmap/training';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, getTopic } from '@/utils/stomp';
import RealTimeBroadcast from './realTimeBroadcast';
export default {
name: 'StationHome',
components: {
StateTable
StateTable,
RealTimeBroadcast
},
data() {
return {
addModel: {
scheduledDescribe: '',
desc: '',
startTime: '',
endTime: '',
delayTime: ''
@ -277,10 +299,14 @@ export default {
iscsDeviceMap: {},
iscsDeviceList: [],
iscsDeviceState: {},
deviceMap: {}
deviceMap: {},
timedList: []
};
},
watch: {
'$store.state.socket.simulationReset': function(val) {
this.initTimedPlayList();
},
'$route.query.stationId': function () {
const params2 = { mapId: this.$route.query.mapId, system: 'PA', station: this.$route.query.stationId };
queryIscsDeviceCod(params2).then(resp => {
@ -289,56 +315,9 @@ export default {
this.$set(device, 'state', this.iscsDeviceState[device.code] ? this.iscsDeviceState[device.code].state : '0');
this.iscsDeviceMap[device.code] = device;
const div = document.getElementById(device.position);
if (div) {
switch (device.state) {
case '0':
div.style.background = '#CCCCCC';
break;
case '1':
div.style.background = '#FF0000';
break;
case '2':
div.style.background = '#880000';
break;
case '3':
div.style.background = '#0000FF';
break;
case '4':
div.style.background = '#554488';
break;
case '5':
div.style.background = '#44CC55';
break;
case '6':
div.style.background = '#FF00FF';
break;
case '7':
div.style.background = '#887711';
break;
case '8':
div.style.background = '#006600';
break;
case '9':
div.style.background = '#778877';
break;
case '10':
div.style.background = '#555454';
break;
case '11':
div.style.background = '#556688';
break;
case '12':
div.style.background = '#887711';
break;
case '13':
div.style.background = '#115577';
break;
case '♬':
div.style.background = '';
break;
}
}
this.setElementColor(div, device.state);
});
this.initTimedPlayList();
});
},
'$store.state.socket.iscsStatePaMessages': function (list) {
@ -351,61 +330,17 @@ export default {
}
const device = this.iscsDeviceMap[item.code];
if (device) {
this.$set(this.deviceMap[device.position], 'state', item.state);
const oldState = parseInt(this.deviceMap[device.position].state);
const newState = parseInt(item.state);
const div = document.getElementById(device.position);
if (this.$route.query.stationId === item.stationCode && !['0', '12', '13'].includes(item.state) && this.atcBroadcast.includes(device.position)) {
const audio = document.getElementById('voice');
audio.src = this.$store.state.user.resourcesUrl + item.url;
audio.play();
if (!oldState || oldState > newState) {
this.$set(this.deviceMap[device.position], 'state', item.state);
this.setElementColor(div, item.state);
this.playBroadcast(item, device.position);
}
if (div) {
switch (item.state) {
case '0':
div.style.background = '#CCCCCC';
break;
case '1':
div.style.background = '#FF0000';
break;
case '2':
div.style.background = '#880000';
break;
case '3':
div.style.background = '#0000FF';
break;
case '4':
div.style.background = '#554488';
break;
case '5':
div.style.background = '#44CC55';
break;
case '6':
div.style.background = '#FF00FF';
break;
case '7':
div.style.background = '#887711';
break;
case '8':
div.style.background = '#006600';
break;
case '9':
div.style.background = '#778877';
break;
case '10':
div.style.background = '#555454';
break;
case '11':
div.style.background = '#556688';
break;
case '12':
div.style.background = '#887711';
break;
case '13':
div.style.background = '#115577';
break;
case '♬':
div.style.background = '';
break;
}
if (!this.atcBroadcast.includes(device.position) && !oldState) {
this.$set(this.deviceMap[device.position], 'state', item.state);
this.setElementColor(div, item.state);
}
}
});
@ -429,11 +364,175 @@ export default {
this.subscribe();
});
this.getResourcesList();
this.initTimedPlayList();
},
beforeDestroy() {
this.clearSubscribe();
},
methods: {
setElementColor(div, state) {
if (div) {
switch (state) {
case '0':
div.style.background = '#CCCCCC';
break;
case '1':
div.style.background = '#FF0000';
break;
case '2':
div.style.background = '#880000';
break;
case '3':
div.style.background = '#0000FF';
break;
case '4':
div.style.background = '#554488';
break;
case '5':
div.style.background = '#44CC55';
break;
case '6':
div.style.background = '#FF00FF';
break;
case '7':
div.style.background = '#887711';
break;
case '8':
div.style.background = '#006600';
break;
case '9':
div.style.background = '#778877';
break;
case '10':
div.style.background = '#555454';
break;
case '11':
div.style.background = '#556688';
break;
case '12':
div.style.background = '#887711';
break;
case '13':
div.style.background = '#115577';
break;
case '♬':
div.style.background = '';
break;
}
}
},
setToday() {
const year = new Date().getFullYear();
let month = new Date().getMonth() + 1;
if (month < 10) {
month = '0' + month;
}
const day = new Date().getDate();
this.addModel.startTime = year + '-' + month + '-' + day + ' 00:00:00';
this.addModel.endTime = year + '-' + month + '-' + day + ' 23:59:59';
this.addModel.delayTime = '00:01:00';
},
setOnce() {
const year = new Date().getFullYear();
let month = new Date().getMonth() + 1;
if (month < 10) {
month = '0' + month;
}
const day = new Date().getDate();
const hour = new Date().getHours();
const minute = new Date().getMinutes();
const second = new Date().getSeconds();
this.addModel.startTime = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
this.addModel.endTime = '';
this.addModel.delayTime = '';
},
setNoEnd() {
const year = new Date().getFullYear();
let month = new Date().getMonth() + 1;
if (month < 10) {
month = '0' + month;
}
const day = new Date().getDate();
const hour = new Date().getHours();
const minute = new Date().getMinutes();
const second = new Date().getSeconds();
this.addModel.startTime = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
this.addModel.endTime = '';
this.addModel.delayTime = '00:01:00';
},
playBroadcast(info, position) {
if (this.$route.query.stationId === info.stationCode && !['0', '12', '13'].includes(info.state) && this.atcBroadcast.includes(position)) {
const audio = document.getElementById(position.toLowerCase() + '_voice');
if (!audio) { return; }
audio.pause();
audio.src = this.$store.state.user.resourcesUrl + info.url;
audio.play();
const _that = this;
audio.addEventListener('ended', function() {
const device = _that.iscsDeviceMap[info.code];
const div = document.getElementById(device.position);
_that.$set(_that.deviceMap[device.position], 'state', '0');
div.style.background = '#CCCCCC';
}, false);
}
},
setTimerBroadcast() {
const iscsDeviceCodes = [];
this.enableAreaList.forEach(item => {
if (this.deviceMap[item]) {
iscsDeviceCodes.push(this.deviceMap[item].code);
}
});
if (!iscsDeviceCodes.length) {
this.$message.error('请选择广播设备');
return;
}
if (!this.addModel.desc) {
this.$message.error('请填写排定描述!');
return;
}
if (!this.addModel.startTime) {
this.$message.error('请选择开始时间!');
return;
}
if (this.resourcesList[this.messageIndex]) {
const params = {
resourceId: this.resourcesList[this.messageIndex].id,
iscsDeviceCodes: iscsDeviceCodes,
type: this.videoMode,
desc: this.addModel.desc,
startTime: this.addModel.startTime,
endTime: this.addModel.endTime,
delayTime: this.addModel.delayTime,
stationCode: this.$route.query.stationId
};
sendCommandNew(this.$route.query.group, 'ISCS_PA_Timed_Play', params).then(() => {
this.addModel = { desc: '', startTime: '', endTime: '', delayTime: '' };
this.initTimedPlayList();
}).catch(() => {
this.$message.error('设定定时广播失败!');
});
}
},
removeTimed(data) {
if (data) {
const params = {
stationCode: this.$route.query.stationId,
desc: data.desc
};
sendCommandNew(this.$route.query.group, 'ISCS_PA_Remove_Timed_Play', params).then(() => {
this.addModel = { desc: '', startTime: '', endTime: '', delayTime: '' };
this.initTimedPlayList();
}).catch(() => {
this.$message.error('设定定时广播失败!');
});
}
},
initTimedPlayList() {
queryPaTimedList(this.$route.query.group, { stationCode: this.$route.query.stationId }).then(resp => {
this.timedList = resp.data;
}).catch(() => { this.$message.error('获取定时广播信息失败!'); });
},
chooseMessage(index) {
this.messageIndex = index;
},
@ -530,12 +629,36 @@ export default {
return;
}
sendCommandNew(this.$route.query.group, 'ISCS_PA_Stop_Playing', { iscsDeviceCodes: iscsDeviceCodes }).then(resp => {
const audio = document.getElementById('voice');
audio.pause();
// const audio = document.getElementById('voice');
// audio.pause();
}).catch(() => {
this.$message.error('广播终止播放失败!');
});
},
realTimeBroadCast() {
this.$refs.realTimeBroadcast.doShow();
},
releaseRealTime(content) {
const iscsDeviceCodes = [];
this.enableAreaList.forEach(item => {
if (this.deviceMap[item]) {
iscsDeviceCodes.push(this.deviceMap[item].code);
}
});
if (!iscsDeviceCodes.length) {
this.$message.error('请选择广播设备');
return;
}
const params = {
iscsDeviceCodes: iscsDeviceCodes,
content: content,
type: 'REAL_TIME'
};
sendCommandNew(this.$route.query.group, 'ISCS_PA_Play', params).then(() => {
}).catch(() => {
this.$message.error('发布广播失败!');
});
},
releaseBroadcast() {
const iscsDeviceCodes = [];
this.enableAreaList.forEach(item => {
@ -554,10 +677,10 @@ export default {
type: this.videoMode
};
sendCommandNew(this.$route.query.group, 'ISCS_PA_Play', params).then(resp => {
this.voiceUrl = this.$store.state.user.resourcesUrl + this.resourcesList[this.messageIndex].url;
const audio = document.getElementById('voice');
audio.src = this.voiceUrl;
audio.play();
// this.voiceUrl = this.$store.state.user.resourcesUrl + this.resourcesList[this.messageIndex].url;
// const audio = document.getElementById('voice');
// audio.src = this.voiceUrl;
// audio.play();
}).catch(() => {
this.$message.error('发布广播失败!');
});
@ -760,7 +883,7 @@ export default {
.pa-grey-box{
position: absolute;
left: 12%;
top: 70%;
top: 74%;
width: 60%;
height: 18%;
background: #DDDDDD;

View File

@ -31,7 +31,8 @@ const typeMap = {
const typeList = [
{ value: 'RECORDING', label: '预录' },
{ value: 'EMERGENCY_RECORDING', label: '紧急预录' },
{ value: 'BGM', label: '背景音乐' }
{ value: 'BGM', label: '背景音乐' },
{ value: 'ATS', label: 'ATS预录' }
];
export default {
name: 'DeviceManage',