Merge remote-tracking branch 'origin/dev_dukang' into dev

# Conflicts:
#	src/scripts/cmdPlugin/CommandEnum.js
#	src/utils/baseUrl.js
This commit is contained in:
fan 2020-03-20 15:16:08 +08:00
commit 1e8d304249
25 changed files with 908 additions and 492 deletions

View File

@ -258,7 +258,7 @@ export function getRealDevices(group) {
} }
// 获取房间真实设备连接关系 // 获取房间真实设备连接关系
export function getRealDevicesNew(group) { export function getRealDevicesInRoom(group) {
return request({ return request({
url: `/api/jointTraining/room/${group}/realDevice/connect`, url: `/api/jointTraining/room/${group}/realDevice/connect`,
method: 'get' method: 'get'
@ -266,7 +266,7 @@ export function getRealDevicesNew(group) {
} }
// 更新真实设备的连接关系 // 更新真实设备的连接关系
export function updateRealDevicesNew(group, data) { export function updateRealDevices(group, data) {
return request({ return request({
url: `/api/jointTraining/room/${group}/realDevice`, url: `/api/jointTraining/room/${group}/realDevice`,
method: 'put', method: 'put',

248
src/api/jointTraining.js Normal file
View File

@ -0,0 +1,248 @@
import request from '@/utils/request';
// 文字聊天 发送文字
export function chatWithTextNew(data, group) {
return request({
url: `/api/v1/jointTraining/chatWithText?group=${group}`,
method: 'post',
data: {
message: data
}
});
}
// 生成分发二维码
export function getJoinTrainCodeNew(data, group) {
return request({
url: `/api/v1/jointTraining/qrCode?group=${group}`,
method: 'post',
data: data
});
}
// 创建房间
export function postCreateRoomNew(data) {
return request({
url: `/api/v1/jointTraining/room`,
method: 'post',
data: data
});
}
// 检查房间存在
export function checkRoomExistNew(params) {
return request({
url: `/api/simulationRoom`,
method: 'get',
params
});
}
// 获取房间详情
export function postRoomDetailNew(group) {
return request({
url: `/api/v1/jointTraining/room/${group}`,
method: 'get'
});
}
// 销毁房间
export function deljointTrainRoomNew(group) {
return request({
url: `/api/v1/jointTraining/room`,
method: 'delete',
params: {
group: group
}
});
}
// 查询有权限房间列表
export function getjointTrainListNew(params) {
return request({
url: `/api/v1/jointTraining/room/list`,
method: 'get',
params: params
});
}
// 加入房间
export function getjointTrainingNew(group) {
return request({
url: `/api/v1/jointTraining/room/join`,
method: 'put',
params: {
group: group
}
});
}
// 设置人员角色
export function putUserRolesNew(data, group) {
return request({
url: `/api/v1/jointTraining/room/user/role?group=${group}`,
method: 'put',
data: data
});
}
// 获取房间里的用户列表
export function getJointTrainRoomUserListNew(group) {
return request({
url: `/api/v1/jointTraining/room/${group}/user/list`,
method: 'get'
});
}
// 离开房间接口
export function putJointTrainingExitNew(group) {
return request({
url: `/api/v1/jointTraining/room/exit`,
method: 'put',
params: {
group: group
}
});
}
// 开始联合演练
export function startJointTrainingNew(group) {
return request({
url: `/api/v1/jointTraining/room/simulation`,
method: 'post',
params: {
group: group
}
});
}
// 获取个人信息
export function getUserRolesNew(group) {
return request({
url: `/api/v1/jointTraining/room/user/role`,
method: 'get',
params: {
group: group
}
});
}
// 返回房间
export function putJointTrainingStateNew() {
return request({
url: `/api/v1/jointTraining/room/back`,
method: 'put'
});
}
// 踢出用户
export function putJointTrainingUserkickedNew(userId, group) {
return request({
url: `/api/v1/jointTraining/room/user`,
method: 'put',
params: {
userId: userId,
group: group
}
});
}
// 管理员结束所有人的仿真
export function putJointTrainingSimulationNew(group) {
return request({
url: `/api/v1/jointTraining/room/simulation/all`,
method: 'put',
params: {
group: group
}
});
}
// 结束仿真返回房间
export function putJointTrainingSimulationUserNew(group) {
return request({
url: `/api/v1/jointTraining/room/simulation/user/exit`,
method: 'put',
params: {
group: group
}
});
}
// 进入仿真
export function putJointTrainingSimulationEntranceNew(group) {
return request({
url: `/api/v1/jointTraining/room/simulation/user/entrance`,
method: 'put',
params: {
group: group
}
});
}
/**
* 权限获取(房间权限)
*/
export function getPermissionJointNew(group) {
return request({
url: '/api/v1/jointTraining/qrCode',
method: 'get',
params: {
group: group
}
});
}
// 添加或更新真实设备和仿真对象连接
export function setRealDeviceNew(group, data) {
return request({
url: `/api/v1/jointTraining/room/realDevice?group=${group}`,
method: 'post',
data: data
});
}
// 删除真实设备和仿真对象连接
export function delRealDeviceNew(id, group) {
return request({
url: `/api/v1/jointTraining/room/realDevice/${id}`,
method: 'delete',
params: { group: group }
});
}
// 获取真实设备列表
export function getRealDevicesNew(group) {
return request({
url: `/api/v1/jointTraining/room/${group}/devices`,
method: 'get'
});
}
// 获取房间真实设备连接关系
export function getRealDevicesInRoomNew(group) {
return request({
url: `/api/v1/jointTraining/room/${group}/realDevice/connect`,
method: 'get'
});
}
// 更新真实设备的连接关系
export function updateRealDevicesNew(group, data) {
return request({
url: `/api/v1/jointTraining/room/${group}/realDevice`,
method: 'put',
data: data
});
}
// 真实设备是否被其他仿真使用
export function realDeviceIsUsedNew(group, projectCode) {
return request({
url: `/api/v1/jointTraining/room/${group}/realDeviceUsed`,
method: 'get',
params: {
projectCode: projectCode
}
});
}

View File

@ -25,7 +25,6 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable'; import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts'; import echarts from 'echarts';

View File

@ -1,6 +1,7 @@
<template> <template>
<el-dialog v-dialogDrag :title="$t('global.chooseRoom')" :visible.sync="dialogShow" width="30%" center> <el-dialog v-dialogDrag :title="$t('global.chooseRoom')" :visible.sync="dialogShow" width="30%" center>
<el-input v-model="input" :placeholder="$t('global.inputRoomNumber')" /> <el-input v-model="input" :placeholder="$t('global.inputRoomNumber')" />
<el-checkbox v-model="isNewMap">是否新版地图房间</el-checkbox>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button> <el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
<el-button v-loading="loading" :disabled="!input.length" type="primary" @click="comit">{{ $t('global.confirm') }}</el-button> <el-button v-loading="loading" :disabled="!input.length" type="primary" @click="comit">{{ $t('global.confirm') }}</el-button>
@ -10,6 +11,7 @@
<script> <script>
import { getPermissionJoint } from '@/api/chat'; import { getPermissionJoint } from '@/api/chat';
import { getPermissionJointNew } from '@/api/jointTraining';
export default { export default {
name: 'Dashboard', name: 'Dashboard',
@ -17,7 +19,8 @@ export default {
return { return {
input: '', input: '',
dialogShow: false, dialogShow: false,
loading: false loading: false,
isNewMap: false
}; };
}, },
computed: { computed: {
@ -35,7 +38,11 @@ export default {
async comit() { async comit() {
try { try {
this.loading = true; this.loading = true;
await getPermissionJoint(`${this.input}`); if (this.isNewMap) {
await getPermissionJointNew(`${this.input}`);
} else {
await getPermissionJoint(`${this.input}`);
}
this.dialogShow = false; this.dialogShow = false;
} catch (error) { } catch (error) {
this.$messageBox(`${this.$t('error.scanningError')}:${error.message}`); this.$messageBox(`${this.$t('error.scanningError')}:${error.message}`);

View File

@ -19,6 +19,7 @@ const DesignDisplay = () => import('@/views/display/designIndex');
const TrainRoom = () => import('@/views/trainRoom/index'); const TrainRoom = () => import('@/views/trainRoom/index');
const JointTraining = () => import('@/views/jointTraining/index'); const JointTraining = () => import('@/views/jointTraining/index');
const JointTrainingNew = () => import('@/views/newMap/jointTrainingNew/index');
const Error401 = () => import('@/views/error-page/401'); const Error401 = () => import('@/views/error-page/401');
const Errpr404 = () => import('@/views/error-page/404'); const Errpr404 = () => import('@/views/error-page/404');
@ -544,7 +545,7 @@ export const asyncRouter = [
}, },
{ {
path: '/jointTrainingNew', path: '/jointTrainingNew',
component: JointTraining, component: JointTrainingNew,
hidden: true hidden: true
}, },
{ {

View File

@ -13,7 +13,7 @@ const runPlan = {
width: 800, // 运行图canvas 容器 宽度 width: 800, // 运行图canvas 容器 宽度
height: 600, // 运行图canvas 容器 高度 height: 600, // 运行图canvas 容器 高度
refreshCount: 0, // 刷新页面重新加载 refreshCount: 0, // 刷新页面重新加载
setInitialPlanData: {} // 运行图原始数据 initialPlanData: {} // 运行图原始数据
}, },
getters: { getters: {
stations: (state) => { stations: (state) => {

View File

@ -40,6 +40,7 @@
<script> <script>
import { getjointTrainList, getjointTraining, putJointTrainingSimulationEntrance } from '@/api/chat'; import { getjointTrainList, getjointTraining, putJointTrainingSimulationEntrance } from '@/api/chat';
import { getjointTrainListNew, putJointTrainingSimulationEntranceNew, getjointTrainingNew } from '@/api/jointTraining';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { getPublishMapInfo } from '@/api/jmap/map'; import { getPublishMapInfo } from '@/api/jmap/map';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
@ -93,7 +94,10 @@ export default {
this.loading = false; this.loading = false;
const project = getSessionStorage('project'); const project = getSessionStorage('project');
const res = await getjointTrainList({projectCode:ProjectCode[project]}); const res = await getjointTrainList({projectCode:ProjectCode[project]});
this.trainingList = res.data || []; const resp = await getjointTrainListNew({projectCode: ProjectCode[project]});
const oldMapRoomList = res.data || [];
const newMapRoomList = resp.data || [];
this.trainingList = [...oldMapRoomList, ...newMapRoomList];
this.$nextTick(() => { this.$nextTick(() => {
var training = this.trainingList[0] || {}; var training = this.trainingList[0] || {};
if (training) { if (training) {
@ -115,15 +119,25 @@ export default {
async handleJoin() { async handleJoin() {
try { try {
this.loading = true; this.loading = true;
await getjointTraining(this.group); const rest = await getPublishMapInfo(this.mapId);
const drawWay = rest.data.drawWay;
if (drawWay) {
await getjointTrainingNew(this.group);
} else {
await getjointTraining(this.group);
}
if (this.state == '02') { if (this.state == '02') {
launchFullscreen(); launchFullscreen();
await putJointTrainingSimulationEntrance(this.group); const query = { lineCode: rest.data.lineCode, mapId: this.mapId, group: this.group, drawWay: drawWay };
const rest = await getPublishMapInfo(this.mapId); if (drawWay) {
const query = { lineCode: rest.data.lineCode, mapId: this.mapId, group: this.group }; await putJointTrainingSimulationEntranceNew(this.group);
this.$router.push({ path: `/jointTraining`, query: query }); this.$router.push({ path: `/jointTrainingNew`, query: query });
} else {
await putJointTrainingSimulationEntrance(this.group);
this.$router.push({ path: `/jointTraining`, query: query });
}
} else if (this.state == '01') { } else if (this.state == '01') {
const query = { group: this.group }; const query = { group: this.group, drawWay: drawWay };
this.$router.push({ path: `/trainroom`, query: query }); this.$router.push({ path: `/trainroom`, query: query });
} }
} catch (e) { } catch (e) {

View File

@ -19,6 +19,7 @@
<script> <script>
import { getjointTraining, putJointTrainingSimulationEntrance } from '@/api/chat'; import { getjointTraining, putJointTrainingSimulationEntrance } from '@/api/chat';
import { getjointTrainingNew, putJointTrainingSimulationEntranceNew} from '@/api/jointTraining';
import { getPublishMapInfo } from '@/api/jmap/map'; import { getPublishMapInfo } from '@/api/jmap/map';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
@ -59,18 +60,27 @@ export default {
async handleJoin() { async handleJoin() {
try { try {
this.loading = true; this.loading = true;
const rest = await getPublishMapInfo(this.mapId);
const drawWay = rest.data.drawWay;
if (this.state == '02') { if (this.state == '02') {
launchFullscreen(); launchFullscreen();
await putJointTrainingSimulationEntrance(this.group); if (drawWay) {
const rest = await getPublishMapInfo(this.mapId); await putJointTrainingSimulationEntranceNew(this.group);
const query = { lineCode: rest.data.lineCode, mapId: this.mapId, group: this.group }; } else {
await putJointTrainingSimulationEntrance(this.group);
}
const query = { lineCode: rest.data.lineCode, mapId: this.mapId, group: this.group, drawWay: drawWay };
this.$router.push({ path: `/jointTraining`, query: query }); this.$router.push({ path: `/jointTraining`, query: query });
} else if (this.state == '01') { } else if (this.state == '01') {
const query = { group: this.group }; const query = { group: this.group, drawWay: drawWay };
this.$router.push({ path: `/trainroom`, query: query }); this.$router.push({ path: `/trainroom`, query: query });
} }
this.dialogShow = false; this.dialogShow = false;
await getjointTraining(this.group); if (rest.drawWay) {
await getjointTrainingNew(this.group);
} else {
await getjointTraining(this.group);
}
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} finally { } finally {

View File

@ -28,7 +28,8 @@ import { getPublishMapInfo } from '@/api/jmap/map';
import { getGoodsTryUse } from '@/api/management/goods'; import { getGoodsTryUse } from '@/api/management/goods';
import { PermissionType } from '@/scripts/ConstDic'; import { PermissionType } from '@/scripts/ConstDic';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat'; import { postCreateRoom, getjointTraining } from '@/api/chat';
import { postCreateRoomNew, getjointTrainingNew, checkRoomExistNew } from '@/api/jointTraining';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { simulationNotify, schedulingNotify, createSimulationNew } from '@/api/simulation'; import { simulationNotify, schedulingNotify, createSimulationNew } from '@/api/simulation';
import LimitList from '@/views/components/limits/index'; import LimitList from '@/views/components/limits/index';
@ -158,7 +159,7 @@ export default {
async getJointTrainingList() { async getJointTrainingList() {
try { try {
if (this.mapId) { if (this.mapId) {
const res = await checkRoomExist({ mapId: this.mapId }); const res = await checkRoomExistNew({mapId: this.mapId});
this.jointGroup = res.data; this.jointGroup = res.data;
this.jointShow = false; this.jointShow = false;
if (res.data) { if (res.data) {
@ -171,7 +172,11 @@ export default {
}, },
async joinRoom() { async joinRoom() {
this.disabled = true; this.disabled = true;
await getjointTraining(this.jointGroup); if (this.drawWay) {
await getjointTrainingNew(this.jointGroup);
} else {
await getjointTraining(this.jointGroup);
}
this.$store.dispatch('socket/setInRoom', true); this.$store.dispatch('socket/setInRoom', true);
const query = { lineCode: this.courseModel.lineCode, group: this.jointGroup, drawWay: this.drawWay}; const query = { lineCode: this.courseModel.lineCode, group: this.jointGroup, drawWay: this.drawWay};
this.$router.push({ path: `/trainroom`, query: query }); this.$router.push({ path: `/trainroom`, query: query });
@ -183,7 +188,12 @@ export default {
mapId: Number(this.mapId), mapId: Number(this.mapId),
prdType: this.courseModel.prdType prdType: this.courseModel.prdType
}; };
const res = await postCreateRoom(param); let res = '';
if (this.drawWay) {
res = postCreateRoomNew(param);
} else {
res = await postCreateRoom(param);
}
if (res && res.code == 200) { if (res && res.code == 200) {
const query = { lineCode: this.courseModel.lineCode, group: res.data, drawWay: this.drawWay }; const query = { lineCode: this.courseModel.lineCode, group: res.data, drawWay: this.drawWay };
this.$router.push({ path: `/trainroom`, query: query }); this.$router.push({ path: `/trainroom`, query: query });

View File

@ -13,6 +13,7 @@ import { parser } from '@/ibp/utils/parser';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen'; import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat'; import { putJointTrainingSimulationUser } from '@/api/chat';
import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { handlerIbpEvent } from '@/api/simulation'; import { handlerIbpEvent } from '@/api/simulation';
import { IbpOperation } from '@/scripts/ConstDic'; import { IbpOperation } from '@/scripts/ConstDic';
import { getIbpInfoByStation } from '@/api/ibp'; import { getIbpInfoByStation } from '@/api/ibp';
@ -59,6 +60,9 @@ export default {
]), ]),
ibpId() { ibpId() {
return ['ibp', (Math.random().toFixed(5)) * 100000].join('_'); return ['ibp', (Math.random().toFixed(5)) * 100000].join('_');
},
drawWay() {
return this.$route.query.drawWay;
} }
}, },
watch: { watch: {
@ -237,10 +241,17 @@ export default {
back() { back() {
this.group = this.$route.query.group; this.group = this.$route.query.group;
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => { if (this.drawWay) {
this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode } }); putJointTrainingSimulationUserNew(this.group).then(() => {
exitFullscreen(); this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode, drawWay: this.drawWay } });
}); exitFullscreen();
});
} else {
putJointTrainingSimulationUser(this.group).then(() => {
this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode } });
exitFullscreen();
});
}
}); });
}, },
ibpDestroy() { ibpDestroy() {

View File

@ -1,7 +1,6 @@
<template> <template>
<div style="width: 100%; height: 100%;"> <div style="width: 100%; height: 100%;">
<div :id="iscsId" v-loading="loading" :style="{ width: widthCanvas +'px', height: canvasHeight +'px' }" class="iscs-canvas" /> <div :id="iscsId" v-loading="loading" :style="{ width: widthCanvas +'px', height: canvasHeight +'px' }" class="iscs-canvas" />
<!-- <el-button v-if="showBackButton" class="iscs-button" type="primary" @click="back">{{ $t('global.back') }}</el-button> -->
</div> </div>
</template> </template>
@ -12,7 +11,6 @@ import { parser } from '@/iscs/utils/parser';
import iscsData from '@/iscs/constant/iscsData'; import iscsData from '@/iscs/constant/iscsData';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen'; import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat';
import { handlerIscsEvent } from '@/api/simulation'; import { handlerIscsEvent } from '@/api/simulation';
import { IscsOperation } from '@/scripts/ConstDic'; import { IscsOperation } from '@/scripts/ConstDic';
@ -176,15 +174,6 @@ export default {
// this.$iscs && this.$iscs.resize({ width: this.width, height: this.height }); // this.$iscs && this.$iscs.resize({ width: this.width, height: this.height });
}); });
}, },
back() {
this.group = this.$route.query.group;
this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => {
this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode } });
exitFullscreen();
});
});
},
iscsDestroy() { iscsDestroy() {
if (this.$iscs) { if (this.$iscs) {
this.$iscs.dispose(); this.$iscs.dispose();

View File

@ -13,6 +13,7 @@ import iscsData from '@/iscs/constant/iscsData';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen'; import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat'; import { putJointTrainingSimulationUser } from '@/api/chat';
import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { handlerIscsEvent } from '@/api/simulation'; import { handlerIscsEvent } from '@/api/simulation';
import { IscsOperation } from '@/scripts/ConstDic'; import { IscsOperation } from '@/scripts/ConstDic';
@ -57,6 +58,9 @@ export default {
iscsId() { iscsId() {
return ['iscs', (Math.random().toFixed(5)) * 100000].join('_'); return ['iscs', (Math.random().toFixed(5)) * 100000].join('_');
}, },
drawWay() {
return this.$route.query.drawWay;
},
width() { width() {
return this.$store.state.config.width; return this.$store.state.config.width;
}, },
@ -171,10 +175,17 @@ export default {
back() { back() {
this.group = this.$route.query.group; this.group = this.$route.query.group;
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => { if (this.drawWay) {
this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode } }); putJointTrainingSimulationUserNew(this.group).then(() => {
exitFullscreen(); this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode, drawWay: this.drawWay } });
}); exitFullscreen();
});
} else {
putJointTrainingSimulationUser(this.group).then(() => {
this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode } });
exitFullscreen();
});
}
}); });
}, },
iscsDestroy() { iscsDestroy() {

View File

@ -83,7 +83,7 @@
</template> </template>
<script> <script>
import { getRealDevicesNew, updateRealDevicesNew, realDeviceIsUsed } from '@/api/chat'; import { getRealDevicesInRoom, updateRealDevices, realDeviceIsUsed } from '@/api/chat';
import { hasDoorStationList } from '@/api/jmap/map'; import { hasDoorStationList } from '@/api/jmap/map';
import {getAllDeviceInProject} from '@/api/project'; import {getAllDeviceInProject} from '@/api/project';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
@ -179,7 +179,7 @@ export default {
this.projectCode = getSessionStorage('project').toUpperCase(); this.projectCode = getSessionStorage('project').toUpperCase();
this.getDoorList(this.$route.query.mapId, this.stationList); this.getDoorList(this.$route.query.mapId, this.stationList);
getAllDeviceInProject({projectCode: this.projectCode, group:this.$route.query.group}).then(resp => { getAllDeviceInProject({projectCode: this.projectCode, group:this.$route.query.group}).then(resp => {
getRealDevicesNew(this.$route.query.group).then(res => { getRealDevicesInRoom(this.$route.query.group).then(res => {
resp.data.forEach((it, index) => { resp.data.forEach((it, index) => {
this.options.push({ this.options.push({
deviceCode: '', deviceCode: '',
@ -235,7 +235,7 @@ export default {
paramsList.push(item); paramsList.push(item);
} }
}); });
updateRealDevicesNew(this.$route.query.group, paramsList).then(res => { updateRealDevices(this.$route.query.group, paramsList).then(res => {
this.$message.success(this.$t('tip.updateRealDeviceConnectionSuccess')); this.$message.success(this.$t('tip.updateRealDeviceConnectionSuccess'));
this.doClose(); this.doClose();
}).catch(() => { }).catch(() => {

View File

@ -1,110 +1,79 @@
<template> <template>
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
v-dialogLoading="dialogLoading" v-dialogLoading="dialogLoading"
:title="title" :title="title"
:visible.sync="dialogShow" :visible.sync="dialogShow"
width="100%" width="100%"
:before-close="doClose" :before-close="doClose"
:close-on-click-modal="false" :close-on-click-modal="false"
:modal="false" :modal="false"
fullscreen fullscreen
> >
<div :id="runPlanId" v-loading="loading" /> <div :id="runPlanId" v-loading="loading" />
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getPublishMapInfo } from '@/api/jmap/map'; import { getPublishMapInfo } from '@/api/jmap/map';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import echarts from 'echarts'; import echarts from 'echarts';
import {toTimeStamp, formatDuring} from '@/utils/date'; import {toTimeStamp, formatDuring} from '@/utils/date';
// //
export default { export default {
name: 'RunPlanView', name: 'RunPlanView',
props: { props: {
group: { group: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: true, loading: true,
runPlanId: 'run-plan-view', runPlanId: 'run-plan-view',
myChart: null, myChart: null,
PlanConvert: {}, PlanConvert: {},
series: [], series: [],
option: { option: {
title: { title: {
text: '', text: '',
left: 'center' left: 'center'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '80px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
// right: '20px',
// feature: {
// dataZoom: {
// yAxisIndex: 'none'
// },
// restore: {},
// saveAsImage: {}
// }
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
}, },
grid: { formatter: this.axisTooltip,
top: '30px', borderWidth: 1
left: '120px', },
right: '40px', xAxis: [
bottom: '80px', {
containLabel: true, type: 'category',
backgroundColor: 'floralwhite' boundaryGap: false,
}, data: [],
toolbox: {
// right: '20px',
// feature: {
// dataZoom: {
// yAxisIndex: 'none'
// },
// restore: {},
// saveAsImage: {}
// }
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: { axisLine: {
onZero: false, onZero: false,
lineStyle: { lineStyle: {
@ -113,255 +82,286 @@
} }
}, },
axisLabel: { axisLabel: {
interval: 'auto', formatter: this.xAxisLableFormat,
formatter: this.yAxisLableFormat textStyle: {
}, color: '#333'
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
} }
}, },
min: 0, axisPointer: {
max: 0 snap: true,
}, label: {
// graphic: { formatter: this.xAxisPointFormat,
// type: 'line', backgroundColor: 'rgb(255,0,0,0.5)',
// progressive: true color: 'white'
// }, }
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '25px'
} }
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {},
runPlanData: {},
dialogLoading: false,
initialPlanData: []
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
title() {
return this.$t('display.runPlan.previewRunDiagram');
}
},
watch: {
'$store.state.runPlan.planLoadedCount': async function () {
try {
await this.loadChartPage();
if (this.dialogShow) {
await this.loadInitData(this.series);
} }
} catch (e) { ],
console.error(e); yAxis: {
} finally { type: 'value',
this.loading = false; splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
// graphic: {
// type: 'line',
// progressive: true
// },
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '25px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {},
runPlanData: {},
dialogLoading: false,
initialPlanData: []
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
title() {
return this.$t('display.runPlan.previewRunDiagram');
}
},
watch: {
'$store.state.runPlan.planLoadedCount': async function () {
try {
await this.loadChartPage();
if (this.dialogShow) {
await this.loadInitData(this.series);
} }
}, } catch (e) {
'$store.state.runPlan.planUpdateCount': function () { console.error(e);
this.updateRunPlanData(this.$store.state.runPlan.updateData); } finally {
}, this.loading = false;
'$store.state.app.windowSizeCount': function() {
this.reSize({ width: this.$store.state.app.width, height: this.$store.state.app.height - 55 });
} }
}, },
mounted() { '$store.state.runPlan.planUpdateCount': function () {
getPublishMapInfo(this.$route.query.mapId).then(res=>{ this.updateRunPlanData(this.$store.state.runPlan.updateData);
this.PlanConvert = this.$theme.loadPlanConvert(res.data.lineCode); },
this.initialPlanData = this.$store.state.runPlan.planData; '$store.state.app.windowSizeCount': function() {
this.loadChartPage(); this.reSize({ width: this.$store.state.app.width, height: this.$store.state.app.height - 55 });
}
},
mounted() {
getPublishMapInfo(this.$route.query.mapId).then(res=>{
this.PlanConvert = this.$theme.loadPlanConvert(res.data.lineCode);
this.initialPlanData = this.$store.state.runPlan.planData;
this.loadChartPage();
});
},
beforeDestroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
methods: {
async doShow() {
try {
this.dialogLoading = true;
this.dialogShow = true;
this.loadInitData(this.series);
} catch (e) {
console.error(e);
} finally {
this.dialogLoading = false;
}
},
async doClose() {
this.dialogShow = false;
},
async loadChartPage() {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
this.series = [];
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
this.pushModels(this.series, [this.PlanConvert.initializeYaxis(stations)]);
this.pushModels(this.series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 1, color: '#000' }));
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: document.documentElement.clientWidth - 10, height: document.documentElement.clientHeight - 55 });
this.myChart.on('click', this.mouseClick);
}
resolve(true);
} catch (error) {
reject(error);
}
}); });
}, },
beforeDestroy() { updateRunPlanData(data) {
if (this.myChart && this.myChart.isDisposed) { const stations = this.$store.state.runPlan.stations;
this.myChart.dispose(); const planData = this.$store.state.runPlan.planData;
this.myChart = null; const initialPlanData = this.$store.state.runPlan.initialPlanData;
} if (data[0] && initialPlanData[data[0].serviceNumber]) {
}, Object.keys(initialPlanData[data[0].serviceNumber].trainMap).forEach(item => {
methods: { if (initialPlanData[data[0].serviceNumber].trainMap[item + ''].tripNumber == data[0].tripNumber) {
async doShow() { data[0].directionCode = initialPlanData[data[0].serviceNumber].trainMap[item + ''].directionCode;
try {
this.dialogLoading = true;
this.dialogShow = true;
this.loadInitData(this.series);
} catch (e) {
console.error(e);
} finally {
this.dialogLoading = false;
}
},
async doClose() {
this.dialogShow = false;
},
async loadChartPage() {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
this.series = [];
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
this.pushModels(this.series, [this.PlanConvert.initializeYaxis(stations)]);
this.pushModels(this.series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 1, color: '#000' }));
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: document.documentElement.clientWidth -10, height: document.documentElement.clientHeight - 55 });
this.myChart.on('click', this.mouseClick);
}
resolve(true);
} catch (error) {
reject(error);
} }
}); });
}, }
updateRunPlanData(data) { if (data[0]) {
const stations = this.$store.state.runPlan.stations; data[0].secondTime = data[0].second;
const planData = this.$store.state.runPlan.planData; }
const initialPlanData = this.$store.state.runPlan.initialPlanData; this.series = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap,
if (data[0] && initialPlanData[data[0].serviceNumber]) { planData, this.series, { color: '#FF00DE', width: 0.5 }
Object.keys(initialPlanData[data[0].serviceNumber].trainMap).forEach(item => { );
if (initialPlanData[data[0].serviceNumber].trainMap[item+''].tripNumber == data[0].tripNumber) { this.myChart && this.myChart.setOption({ series: this.series });
data[0].directionCode = initialPlanData[data[0].serviceNumber].trainMap[item + ''].directionCode; },
} pushModels(series, models) {
}); if (models && models.length) {
} models.forEach(elem => {
if (data[0]) { if (elem) {
data[0].secondTime = data[0].second; series.push(elem);
} }
this.series = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap,
planData, this.series, { color: '#FF00DE', width: 0.5 }
);
this.myChart && this.myChart.setOption({ series: this.series });
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
}
return series;
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
this.option.xAxis[0].data = list;
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style="margin: 3px 0">`,
`${this.$t('display.runPlan.stationName')}: ${station.name}<br>`,
`${this.$t('display.runPlan.stationMark')}: ${station.kmRange} km <br>`,
`${this.$t('display.runPlan.arrivalTime')}: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
settingExac(data) {
this.absoluteTime = Math.abs(parseInt(data.endValue) - parseInt(data.startValue)) / 1000;
this.myChart && this.myChart.setOption({
xAxis: this.option.xAxis,
yAxis: this.option.yAxis
}); });
}
this.myChart && this.myChart.dispatchAction({ return series;
type: 'dataZoom', },
dataZoomIndex: [0, 1], popModels(series, models) {
startValue: parseInt(data.startValue / 1000), if (models && models.length) {
endValue: parseInt(data.endValue / 1000) models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
}); });
}, }
run(start) {
this.myChart && this.myChart.dispatchAction({ return series;
type: 'dataZoom', },
dataZoomIndex: [0, 1], xAxisPointFormat(params) {
startValue: parseInt(start - this.absoluteTime / 2), return timeFormat(params.value);
endValue: parseInt(start + this.absoluteTime / 2) },
}); yAxisPointFormat(params) {
this.loadInitData(this.series); return this.PlanConvert.computedFormatYAxis(this.stations, params);
}, },
reSize(opt) { xAxisLableFormat(value, index) {
if (this.myChart) { if (value % 60 === 0) {
this.myChart.resize({ width: opt.width, height: opt.height, silent: false }); return timeFormat(value);
} }
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
this.option.xAxis[0].data = list;
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style="margin: 3px 0">`,
`${this.$t('display.runPlan.stationName')}: ${station.name}<br>`,
`${this.$t('display.runPlan.stationMark')}: ${station.kmRange} km <br>`,
`${this.$t('display.runPlan.arrivalTime')}: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
settingExac(data) {
this.absoluteTime = Math.abs(parseInt(data.endValue) - parseInt(data.startValue)) / 1000;
this.myChart && this.myChart.setOption({
xAxis: this.option.xAxis,
yAxis: this.option.yAxis
});
this.myChart && this.myChart.dispatchAction({
type: 'dataZoom',
dataZoomIndex: [0, 1],
startValue: parseInt(data.startValue / 1000),
endValue: parseInt(data.endValue / 1000)
});
},
run(start) {
this.myChart && this.myChart.dispatchAction({
type: 'dataZoom',
dataZoomIndex: [0, 1],
startValue: parseInt(start - this.absoluteTime / 2),
endValue: parseInt(start + this.absoluteTime / 2)
});
this.loadInitData(this.series);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({ width: opt.width, height: opt.height, silent: false });
} }
} }
}; }
};
</script> </script>
<style scoped rel="stylesheet/scss" lang="scss"> <style scoped rel="stylesheet/scss" lang="scss">
/deep/ { /deep/ {

View File

@ -20,7 +20,7 @@
<script> <script>
import SetTime from './demon/setTime'; import SetTime from './demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { ranAsPlan, runDiagramOver, runDiagramGetTime } from '@/api/simulation'; import { ranAsPlan, runDiagramOver } from '@/api/simulation';
// import { timeFormat } from '@/utils/date'; // import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
@ -152,10 +152,7 @@ export default {
}); });
}, },
async loadSystemTime() { async loadSystemTime() {
// const rest = await runDiagramGetTime(this.group);
// if (rest && rest.code == 200) {
// this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(rest.data)}`));
// }
} }
} }
}; };

View File

@ -26,23 +26,24 @@
</template> </template>
<script> <script>
import MapSystemDraft from '@/views/mapsystem/index'; import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuDemonJoint from './menuDemon'; import MenuDemonJoint from './menuDemon';
import MenuDemonSchema from './menuSchema'; import MenuDemonSchema from './menuSchema';
import JoinFaultChoose from '@/views/display/demon/faultChoose'; import JoinFaultChoose from '@/views/newMap/displayNew/demon/faultChoose';
import JoinRunPlanLoad from '@/views/display/demon/runPlanLoad'; import JoinRunPlanLoad from '@/views/newMap/displayNew/demon/runPlanLoad';
import JoinRunPlanView from '@/views/display/demon/runPlanView'; import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView';
import menuSystemTime from '@/views/display/menuSystemTime'; import menuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import IbpPlate from '@/views/ibp/ibpsystem/index'; import IbpPlate from '@/views/ibp/ibpsystem/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { loadMapDataById } from '@/utils/loaddata'; import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { getUserRoles, deljointTrainRoom } from '@/api/chat'; import { getUserRolesNew, deljointTrainRoomNew} from '@/api/jointTraining';
import { runDiagramOver, getSimulationInfo } from '@/api/simulation'; import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import ibpData from '@/ibp/constant/ibpData'; import ibpData from '@/ibp/constant/ibpData';
import { timeFormat } from '@/utils/date';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
export default { export default {
@ -122,8 +123,8 @@ export default {
showClose: false, showClose: false,
callback: async (action) => { callback: async (action) => {
await this.$store.dispatch('training/over'); await this.$store.dispatch('training/over');
await runDiagramOver(this.group); await clearSimulation(this.group);
await deljointTrainRoom(this.group); await deljointTrainRoomNew(this.group);
this.$router.go(-1); this.$router.go(-1);
} }
}); });
@ -276,14 +277,25 @@ export default {
} }
}, },
async loadSimulationInfo() { async loadSimulationInfo() {
const resp = await getSimulationInfo(this.group); const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200) { if (resp && resp.code == 200) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.questId = Number(resp.data.questId) || 0; this.questId = Number(resp.data.questId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(resp.data.systemTime)}`));
if (resp.data.planRunning) {
this.$store.dispatch('training/simulationStart');
} else {
this.$store.dispatch('training/over');
}
if (this.isDemon) {
this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning);
} else if (this.isScript) {
this.$refs.menuScript.initPlannedDriving(resp.data.planRunning);
}
} }
}, },
async getUserRole() { async getUserRole() {
const res = await getUserRoles(this.group); const res = await getUserRolesNew(this.group);
const data = res.data || {}; const data = res.data || {};
this.userRole = data.userRole; this.userRole = data.userRole;
this.deviceCode = data.deviceCode; this.deviceCode = data.deviceCode;
@ -304,18 +316,18 @@ export default {
// 01 02 '' // 01 02 ''
const resp = await this.getUserRole(); const resp = await this.getUserRole();
if (resp && resp.code == 200) { if (resp && resp.code == 200) {
// Admin Instructor Dispatcher Attendant Audience Driver Repair IBP:IBP // Admin Instructor Dispatcher STATION_SUPERVISOR Audience Driver MAINTAINER IBP:IBP
this.userRole = resp.data.userRole; this.userRole = resp.data.userRole;
switch (this.userRole) { switch (this.userRole) {
case 'Admin': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Admin'); this.hideIbp(); break; case 'ADMIN': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'ADMIN'); this.hideIbp(); break;
case 'Instructor': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor'); this.hideIbp(); break; case 'INSTRUCTOR': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'INSTRUCTOR'); this.hideIbp(); break;
case 'Dispatcher': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher'); this.hideIbp(); break; case 'DISPATCHER': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'DISPATCHER'); this.hideIbp(); break;
case 'Attendant': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant'); this.hideIbp(); break; case 'STATION_SUPERVISOR': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR'); this.hideIbp(); break;
case 'Audience': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience'); this.hideIbp(); break; case 'AUDIENCE': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE'); this.hideIbp(); break;
case 'Driver': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver'); this.hideIbp(); break; case 'DRIVER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'DRIVER'); this.hideIbp(); break;
case 'Repair': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair'); this.hideIbp(); break; case 'MAINTAINER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'MAINTAINER'); this.hideIbp(); break;
case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break; case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break;
case 'BigScreen': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen'); this.hideIbp(); break; case 'BIGSCREEN': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BIGSCREEN'); this.hideIbp(); break;
} }
} }
await this.getTrainDetail(); await this.getTrainDetail();
@ -325,7 +337,7 @@ export default {
}, },
async getTrainDetail() { async getTrainDetail() {
try { try {
await loadMapDataById(this.mapId); await loadNewMapDataByGroup(this.group);
await this.$store.dispatch('training/setMapDefaultState'); await this.$store.dispatch('training/setMapDefaultState');
} catch (error) { } catch (error) {
this.$messageBox(this.$t('error.getMapDataFailed')); this.$messageBox(this.$t('error.getMapDataFailed'));

View File

@ -8,7 +8,7 @@
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button> <el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button>
<el-button type="danger" :disabled="!isDisable" @click="end">{{ $t('joinTraining.exitPlan') }}</el-button> <el-button type="danger" :disabled="!isDisable" @click="end">{{ $t('joinTraining.exitPlan') }}</el-button>
</template> </template>
<el-button v-if="!isBigScreen" type="primary" @click="back">{{ $t('global.back') }}</el-button> <el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
</el-button-group> </el-button-group>
</div> </div>
<qr-code ref="qrCode" /> <qr-code ref="qrCode" />
@ -19,11 +19,10 @@
<script> <script>
import QrCode from '@/components/QrCode'; import QrCode from '@/components/QrCode';
import SetTime from '@/views/display/demon/setTime'; import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { runDiagramIsStart, ranAsPlan, runDiagramOver, runDiagramGetTime } from '@/api/simulation'; import { ranAsPlan, clearSimulation } from '@/api/simulation';
import { exitFullscreen } from '@/utils/screen'; import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat'; import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import RealDevice from './menuDraft/realDevice'; import RealDevice from './menuDraft/realDevice';
@ -78,16 +77,13 @@ export default {
return this.$route.query.lineCode; return this.$route.query.lineCode;
}, },
isSpeaking() { isSpeaking() {
return this.userRole != 'Driver' && this.userRole != ''; return this.userRole != 'DRIVER' && this.userRole != '';
}, },
isDriver() { isDriver() {
return this.userRole == 'Driver'; return this.userRole == 'DRIVER';
}, },
isAdmin() { isAdmin() {
return this.userRole == 'Admin'; return this.userRole == 'ADMIN';
},
isBigScreen() {
return this.userRole == 'BigScreen';
}, },
isProject() { isProject() {
return getSessionStorage('project').endsWith('gzb'); return getSessionStorage('project').endsWith('gzb');
@ -127,14 +123,14 @@ export default {
methods: { methods: {
async initLoadPage() { async initLoadPage() {
try { try {
const resp = await runDiagramIsStart(this.group); // const resp = await runDiagramIsStart(this.group);
if (resp && resp.data) { // if (resp && resp.data) {
this.isDisable = true; // this.isDisable = true;
this.$store.dispatch('training/simulationStart'); // this.$store.dispatch('training/simulationStart');
} else { // } else {
this.isDisable = false; // this.isDisable = false;
this.$store.dispatch('training/over'); // this.$store.dispatch('training/over');
} // }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -222,45 +218,45 @@ export default {
} }
}); });
}, },
// Admin Instructor Dispatcher Attendant Audience Driver Repair // Admin Instructor Dispatcher Attendant Audience Driver MAINTAINER
addrolesList(list) { addrolesList(list) {
list.forEach(item => { list.forEach(item => {
if (this.userId == item.id) { if (this.userId == item.id) {
switch (item.userRole) { switch (item.userRole) {
case 'Instructor': case 'INSTRUCTOR':
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor'); this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'INSTRUCTOR');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
case 'Dispatcher': case 'DISPATCHER':
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher'); this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'DISPATCHER');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
case 'Attendant': case 'STATION_SUPERVISOR':
if (!item['deviceCode']) { if (!item['deviceCode']) {
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Attendant'); this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
break; break;
} }
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant'); this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
case 'Driver': case 'DRIVER':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver'); this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'DRIVER');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
case 'Repair': case 'MAINTAINER':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair'); this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'MAINTAINER');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
case 'IBP': case 'IBP':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
case 'BigScreen': case 'BIGSCREEN':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen'); this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BIGSCREEN');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
default: default:
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience'); this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE');
this.$emit('getUserRole'); this.$emit('getUserRole');
break; break;
} }
@ -275,14 +271,16 @@ export default {
this.$refs.chat.getChathistory(); this.$refs.chat.getChathistory();
} }
}, },
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
selectBeginTime() { selectBeginTime() {
this.$refs.setTime.doShow(); this.$refs.setTime.doShow();
}, },
start(model) { start(model) {
this.isDisable = true; this.isDisable = true;
const data = { const data = {
time: model.initTime, time: model.initTime
loadNumber:this.trainList.length
}; };
ranAsPlan(data, this.group).then(res => { ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => { this.$store.dispatch('training/simulationStart').then(() => {
@ -316,7 +314,7 @@ export default {
end() { end() {
this.isDisable = false; this.isDisable = false;
EventBus.$emit('trainView'); EventBus.$emit('trainView');
runDiagramOver(this.group).catch(() => { clearSimulation(this.group).catch(() => {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
this.isDisable = true; this.isDisable = true;
this.$messageBox(this.$t('error.endSimulationFailed')); this.$messageBox(this.$t('error.endSimulationFailed'));
@ -325,8 +323,8 @@ export default {
}, },
back() { back() {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => { putJointTrainingSimulationUserNew(this.group).then(() => {
this.$router.replace({ path: `/trainroom`, query: { lineCode: this.lineCode, group: this.group } }); this.$router.replace({ path: `/trainroom`, query: { lineCode: this.lineCode, group: this.group, drawWay: true } });
exitFullscreen(); exitFullscreen();
}); });
}); });

View File

@ -8,7 +8,7 @@
<script> <script>
import PopMenu from '@/components/PopMenu'; import PopMenu from '@/components/PopMenu';
import ChooseRole from './chooseRole'; import ChooseRole from './chooseRole';
import { putUserRoles } from '@/api/chat'; import { putUserRolesNew} from '@/api/jointTraining';
import { DeviceMenu } from '@/scripts/ConstDic'; import { DeviceMenu } from '@/scripts/ConstDic';
export default { export default {
@ -105,12 +105,12 @@ export default {
const params = [{ const params = [{
id: obj.id, id: obj.id,
nickName: obj.name, nickName: obj.name,
userRole: 'Driver', userRole: 'DRIVER',
stationCode: '', stationCode: '',
trainCode: this.selected._code trainCode: this.selected._code
}]; }];
await putUserRoles(params, this.group); await putUserRolesNew(params, this.group);
} }
}, },
async cancelDriver() { async cancelDriver() {
@ -119,12 +119,12 @@ export default {
const params = [{ const params = [{
id: data.id, id: data.id,
nickName: data.name, nickName: data.name,
userRole: 'Driver', userRole: 'DRIVER',
stationCode: '', stationCode: '',
trainCode: '' trainCode: ''
}]; }];
await putUserRoles(params, this.group); await putUserRolesNew(params, this.group);
} }
}, },
refresh() { refresh() {

View File

@ -83,7 +83,7 @@
</template> </template>
<script> <script>
import { getRealDevicesNew, updateRealDevicesNew, realDeviceIsUsed } from '@/api/chat'; import { getRealDevicesInRoomNew, updateRealDevicesNew} from '@/api/jointTraining';
import { hasDoorStationList } from '@/api/jmap/map'; import { hasDoorStationList } from '@/api/jmap/map';
import {getAllDeviceInProject} from '@/api/project'; import {getAllDeviceInProject} from '@/api/project';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
@ -179,7 +179,7 @@ export default {
this.projectCode = getSessionStorage('project').toUpperCase(); this.projectCode = getSessionStorage('project').toUpperCase();
this.getDoorList(this.$route.query.mapId, this.stationList); this.getDoorList(this.$route.query.mapId, this.stationList);
getAllDeviceInProject({projectCode: this.projectCode, group:this.$route.query.group}).then(resp => { getAllDeviceInProject({projectCode: this.projectCode, group:this.$route.query.group}).then(resp => {
getRealDevicesNew(this.$route.query.group).then(res => { getRealDevicesInRoomNew(this.$route.query.group).then(res => {
resp.data.forEach((it, index) => { resp.data.forEach((it, index) => {
this.options.push({ this.options.push({
deviceCode: '', deviceCode: '',

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="schema" :style="{top: offset+'px'}"> <div class="schema" :style="{top: offset+'px'}">
<el-select <el-select
v-if="userRole == 'Instructor' || userRole == 'Admin'" v-if="userRole == 'INSTRUCTOR' || userRole == 'ADMIN'"
v-model="swch" v-model="swch"
size="small" size="small"
:placeholder="this.$t('rules.productTypeInput')" :placeholder="this.$t('rules.productTypeInput')"
@ -14,17 +14,17 @@
<template> <template>
<el-button v-if="runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button> <el-button v-if="runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
</template> </template>
<template v-if="userRole == 'Admin'"> <template v-if="userRole == 'ADMIN'">
<el-button v-if="!runing" size="small" type="warning" :disabled="viewDisabled" @click="loadRunPlan"> <el-button v-if="!runing" size="small" type="warning" :disabled="viewDisabled" @click="loadRunPlan">
{{ $t('joinTraining.runGraphLoading') }}</el-button> {{ $t('joinTraining.runGraphLoading') }}</el-button>
</template> </template>
<template v-if="userRole == 'Instructor' || userRole == 'Admin'"> <template v-if="userRole == 'INSTRUCTOR' || userRole == 'ADMIN'">
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('joinTraining.faultSetting') }}</el-button> <el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('joinTraining.faultSetting') }}</el-button>
</template> </template>
</el-button-group> </el-button-group>
<el-radio-group <el-radio-group
v-if="userRole == 'Instructor' || userRole == 'Admin'" v-if="userRole == 'INSTRUCTOR' || userRole == 'ADMIN'"
v-model="mode" v-model="mode"
size="small" size="small"
@change="changeOperateMode(mode)" @change="changeOperateMode(mode)"
@ -39,7 +39,7 @@ import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic'; import { OperateMode } from '@/scripts/ConstDic';
// import { getStationList } from '@/api/runplan'; // import { getStationList } from '@/api/runplan';
import { getByGroupStationList } from '@/api/jmap/map'; import { getByGroupStationList } from '@/api/jmap/map';
import { getEveryDayRunPlanData } from '@/api/simulation'; import { getEveryDayRunPlanNew } from '@/api/simulation';
export default { export default {
name: 'MenuDemonSchema', name: 'MenuDemonSchema',
@ -109,8 +109,9 @@ export default {
// getStationList(opt.mapId).then(response => { // getStationList(opt.mapId).then(response => {
const stations = response.data; const stations = response.data;
this.$store.dispatch('runPlan/setStations', stations).then(() => { this.$store.dispatch('runPlan/setStations', stations).then(() => {
getEveryDayRunPlanData(this.group).then(resp => { getEveryDayRunPlanNew(this.group).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data); this.$store.dispatch('runPlan/setPlanData', resp.data);
this.$store.dispatch('runPlan/setInitialPlanData', resp.data);
this.viewDisabled = false; this.viewDisabled = false;
}).catch(error => { }).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []); this.$store.dispatch('runPlan/setPlanData', []);
@ -130,6 +131,9 @@ export default {
switchMode(swch) { switchMode(swch) {
this.$store.dispatch('training/setPrdType', swch); this.$store.dispatch('training/setPrdType', swch);
}, },
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
changeOperateMode(handle) { changeOperateMode(handle) {
this.$store.dispatch('training/changeOperateMode', { mode: handle }); this.$store.dispatch('training/changeOperateMode', { mode: handle });
}, },

View File

@ -8,6 +8,7 @@
import PopMenu from '@/components/PopMenu'; import PopMenu from '@/components/PopMenu';
import { DeviceMenu } from '@/scripts/ConstDic'; import { DeviceMenu } from '@/scripts/ConstDic';
import { putJointTrainingUserkicked } from '@/api/chat'; import { putJointTrainingUserkicked } from '@/api/chat';
import { putJointTrainingUserkickedNew} from '@/api/jointTraining';
export default { export default {
components: { components: {
@ -33,6 +34,9 @@ export default {
}, },
position() { position() {
return this.$store.state.menuOperation.menuPosition; return this.$store.state.menuOperation.menuPosition;
},
drawWay() {
return this.$route.query.drawWay;
} }
}, },
watch: { watch: {
@ -69,7 +73,11 @@ export default {
}, },
async kicked() { async kicked() {
try { try {
await putJointTrainingUserkicked(this.clickUserId, this.$route.query.group); if (this.drawWay) {
await putJointTrainingUserkickedNew(this.clickUserId, this.$route.query.group);
} else {
await putJointTrainingUserkicked(this.clickUserId, this.$route.query.group);
}
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }

View File

@ -34,6 +34,7 @@
<script> <script>
import { chatWithText } from '@/api/chat'; import { chatWithText } from '@/api/chat';
import { chatWithTextNew } from '@/api/jointTraining';
export default { export default {
props: { props: {
@ -68,6 +69,9 @@ export default {
}, },
userId() { userId() {
return this.$store.state.user ? this.$store.state.user.id : ''; return this.$store.state.user ? this.$store.state.user.id : '';
},
drawWay() {
return this.$route.query.drawWay;
} }
}, },
watch: { watch: {
@ -88,7 +92,11 @@ export default {
async handleSendText() { async handleSendText() {
try { try {
if (this.text.trim()) { if (this.text.trim()) {
await chatWithText(this.text, this.group); if (this.drawWay) {
await chatWithTextNew(this.text, this.group);
} else {
await chatWithText(this.text, this.group);
}
this.text = ''; this.text = '';
this.disabled = true; this.disabled = true;
} }

View File

@ -24,11 +24,12 @@
@change="handleUpdUser(node, index)" @change="handleUpdUser(node, index)"
/> />
<el-select <el-select
v-if="roleType == 'Attendant'" v-if="roleType.toUpperCase() == 'ATTENDANT' || roleType.toUpperCase() === 'STATION_SUPERVISOR'"
v-model="node.deviceCode" v-model="node.deviceCode"
:placeholder="$t('global.choose')" :placeholder="$t('global.choose')"
size="mini" size="mini"
:disabled="isDisable" :disabled="isDisable"
s
@change="handleUpdUser(node, index)" @change="handleUpdUser(node, index)"
> >
<el-option <el-option
@ -80,7 +81,7 @@ export default {
}, },
computed: { computed: {
hasDevice() { hasDevice() {
return ['Attendant', 'IBP'].includes(this.roleType); return ['ATTENDANT', 'IBP', 'STATION_SUPERVISOR'].includes(this.roleType.toUpperCase());
}, },
isDisable() { isDisable() {
return this.userId != this.room.creatorId; return this.userId != this.room.creatorId;

View File

@ -113,6 +113,7 @@ import eDevice from './e-device';
import AddPerson from './add-person'; import AddPerson from './add-person';
import QrCode from '@/components/QrCode'; import QrCode from '@/components/QrCode';
import { getJoinTrainCode, startJointTraining, deljointTrainRoom, putJointTrainingExit, putJointTrainingSimulation, putUserRoles, setRealDevice, delRealDevice } from '@/api/chat'; import { getJoinTrainCode, startJointTraining, deljointTrainRoom, putJointTrainingExit, putJointTrainingSimulation, putUserRoles, setRealDevice, delRealDevice } from '@/api/chat';
import { getJoinTrainCodeNew, startJointTrainingNew, deljointTrainRoomNew, putUserRolesNew, putJointTrainingExitNew, putJointTrainingSimulationNew, setRealDeviceNew, delRealDeviceNew } from '@/api/jointTraining';
import { getPlcGateway } from '@/api/simulation'; import { getPlcGateway } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
@ -171,6 +172,9 @@ export default {
group() { group() {
return this.$route.query.group; return this.$route.query.group;
}, },
drawWay() {
return this.$route.query.drawWay;
},
userId() { userId() {
return this.$store.state.user ? this.$store.state.user.id : ''; return this.$store.state.user ? this.$store.state.user.id : '';
}, },
@ -195,25 +199,25 @@ export default {
}); });
}, },
dispatcherList() { dispatcherList() {
return this.members.filter(elem => { return [elem.userRole].includes('Dispatcher'); }); return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('DISPATCHER'); });
}, },
attendantList() { attendantList() {
return this.members.filter(elem => { return [elem.userRole].includes('Attendant'); }); return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('ATTENDANT') || [elem.userRole.toUpperCase()].includes('STATION_SUPERVISOR'); });
}, },
instructorList() { instructorList() {
return this.members.filter(elem => { return [elem.userRole].includes('Instructor'); }); return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('INSTRUCTOR'); });
}, },
repairList() { repairList() {
return this.members.filter(elem => { return [elem.userRole].includes('Repair'); }); return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('REPAIR') || [elem.userRole.toUpperCase()].includes('MAINTAINER'); });
}, },
driverList() { driverList() {
return this.members.filter(elem => { return [elem.userRole].includes('Driver'); }); return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('DRIVER'); });
}, },
ibpList() { ibpList() {
return this.members.filter(elem => { return [elem.userRole].includes('IBP'); }); return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('IBP'); });
}, },
audienceList() { audienceList() {
return this.members.filter(elem => { return [elem.userRole].includes('Audience'); }); return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('AUDIENCE'); });
} }
}, },
async mounted() { async mounted() {
@ -235,19 +239,30 @@ export default {
this.$message.info(this.$t('error.theDeviceTypeAlreadyExists')); this.$message.info(this.$t('error.theDeviceTypeAlreadyExists'));
return; return;
} }
if (this.drawWay) {
await setRealDevice(this.group, roomDeviceVo); await setRealDeviceNew(this.group, roomDeviceVo);
} else {
await setRealDevice(this.group, roomDeviceVo);
}
}, },
async handleUpdDevice({deviceType, device}) { async handleUpdDevice({deviceType, device}) {
try { try {
await setRealDevice(this.group, device); if (this.drawWay) {
await setRealDeviceNew(this.group, device);
} else {
await setRealDevice(this.group, device);
}
} catch (e) { } catch (e) {
this.$messageBox(this.$t('error.connectToRealDeviceFailed')); this.$messageBox(this.$t('error.connectToRealDeviceFailed'));
} }
}, },
async handleDelDevice({deviceType, device}) { async handleDelDevice({deviceType, device}) {
try { try {
await delRealDevice(device.id, this.group); if (this.drawWay) {
await delRealDeviceNew(device.id, this.group);
} else {
await delRealDevice(device.id, this.group);
}
} catch (e) { } catch (e) {
this.$messageBox(this.$t('error.deleteRealDeviceFailed')); this.$messageBox(this.$t('error.deleteRealDeviceFailed'));
} }
@ -262,8 +277,12 @@ export default {
userRole: 'Audience', userRole: 'Audience',
deviceCode: '' deviceCode: ''
}]; }];
if (this.drawWay) {
await putUserRoles(params, this.group); params[0].userRole = 'AUDIENCE';
await putUserRolesNew(params, this.group);
} else {
await putUserRoles(params, this.group);
}
}, },
async handleUpdUser({roleType, user, deviceList}) { async handleUpdUser({roleType, user, deviceList}) {
let deviceCode = ''; let deviceCode = '';
@ -282,8 +301,17 @@ export default {
deviceCode: deviceCode, deviceCode: deviceCode,
ibpPart: user.ibpPart ibpPart: user.ibpPart
}]; }];
if (this.drawWay) {
await putUserRoles(params, this.group); params[0].userRole = roleType.toUpperCase();
if (roleType === 'Attendant') {
params[0].userRole = 'STATION_SUPERVISOR';
} else if (roleType === 'Repair') {
params[0].userRole = 'MAINTAINER';
}
await putUserRolesNew(params, this.group);
} else {
await putUserRoles(params, this.group);
}
this.stationList.forEach(item => { this.stationList.forEach(item => {
item.disabled = false; item.disabled = false;
@ -295,10 +323,22 @@ export default {
}); });
}, },
async handleDispatchUser({roleType, userList}) { async handleDispatchUser({roleType, userList}) {
const list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: roleType }; }); if (userList.length) {
if (list.length) {
try { try {
await putUserRoles(list, this.group); let list = [];
if (this.drawWay) {
if (roleType === 'Attendant') {
list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: 'STATION_SUPERVISOR' }; });
} else if (roleType === 'Repair') {
list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: 'MAINTAINER'}; });
} else {
list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: roleType.toUpperCase() }; });
}
await putUserRolesNew(list, this.group);
} else {
list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: roleType }; });
await putUserRoles(list, this.group);
}
list.forEach(item => { list.forEach(item => {
this.treeData.forEach(nor => { this.treeData.forEach(nor => {
if (item.id == nor.id) { if (item.id == nor.id) {
@ -315,7 +355,12 @@ export default {
}, },
async handlePostQrcode() { async handlePostQrcode() {
this.disabled = true; this.disabled = true;
const res = await getJoinTrainCode({}, this.group); let res = '';
if (this.drawWay) {
res = await getJoinTrainCodeNew({}, this.group);
} else {
res = await getJoinTrainCode({}, this.group);
}
if (res.code == '200') { if (res.code == '200') {
const param = { const param = {
url: res.data, url: res.data,
@ -339,7 +384,11 @@ export default {
this.disabled = true; this.disabled = true;
if (this.attendantList.findIndex(item => { return !item.deviceCode; }) < 0) { if (this.attendantList.findIndex(item => { return !item.deviceCode; }) < 0) {
try { try {
await startJointTraining(this.group); if (this.drawWay) {
await startJointTrainingNew(this.group);
} else {
await startJointTraining(this.group);
}
} catch (error) { } catch (error) {
this.$emit('message', {type:'error', message: this.$t('error.startedComprehensiveDrillFailure')}); this.$emit('message', {type:'error', message: this.$t('error.startedComprehensiveDrillFailure')});
this.disabled = false; this.disabled = false;
@ -352,7 +401,12 @@ export default {
async handleStop() { async handleStop() {
try { try {
this.disabled = true; this.disabled = true;
const res = await putJointTrainingSimulation(this.group); let res = '';
if (this.drawWay) {
res = await putJointTrainingSimulationNew(this.group);
} else {
res = await putJointTrainingSimulation(this.group);
}
this.mapId = res.data.mapId; this.mapId = res.data.mapId;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -368,7 +422,11 @@ export default {
type: 'warning' type: 'warning'
}).then(async () => { }).then(async () => {
try { try {
await deljointTrainRoom(this.group); if (this.drawWay) {
await deljointTrainRoomNew(this.group);
} else {
await deljointTrainRoom(this.group);
}
} catch (error) { } catch (error) {
this.$emit('message', {type:'error', message: this.$t('error.destroyedRoomFailed')}); this.$emit('message', {type:'error', message: this.$t('error.destroyedRoomFailed')});
} finally { } finally {
@ -381,7 +439,11 @@ export default {
async handleBack() { async handleBack() {
try { try {
this.disabled = true; this.disabled = true;
await putJointTrainingExit(this.group); if (this.drawWay) {
await putJointTrainingExitNew(this.group);
} else {
await putJointTrainingExit(this.group);
}
this.$emit('clearSubscribe'); this.$emit('clearSubscribe');
this.$router.go(-1); this.$router.go(-1);
} catch (error) { } catch (error) {

View File

@ -47,6 +47,7 @@ import eMembers from './e-members';
import eChat from './e-chat'; import eChat from './e-chat';
import eRoles from './e-roles'; import eRoles from './e-roles';
import { postRoomDetail, getJointTrainRoomUserList, getRealDevices, putJointTrainingSimulationEntrance, getjointTraining } from '@/api/chat'; import { postRoomDetail, getJointTrainRoomUserList, getRealDevices, putJointTrainingSimulationEntrance, getjointTraining } from '@/api/chat';
import { postRoomDetailNew, getJointTrainRoomUserListNew, putJointTrainingSimulationEntranceNew, getjointTrainingNew, getRealDevicesNew} from '@/api/jointTraining';
import { getPublishMapInfo, hasDoorStationList } from '@/api/jmap/map'; import { getPublishMapInfo, hasDoorStationList } from '@/api/jmap/map';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
import { getStationList } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
@ -87,6 +88,9 @@ export default {
group() { group() {
return this.$route.query.group; return this.$route.query.group;
}, },
drawWay() {
return this.$route.query.drawWay;
},
userId() { userId() {
return this.$store.state.user ? this.$store.state.user.id : ''; return this.$store.state.user ? this.$store.state.user.id : '';
} }
@ -95,7 +99,7 @@ export default {
members: { members: {
deep: true, deep: true,
handler() { handler() {
this.room.permissionRest = this.members.filter(elem => ['Audience'].includes(elem.userRole)).length; this.room.permissionRest = this.members.filter(elem => ['AUDIENCE'].includes(elem.userRole.toUpperCase())).length;
} }
}, },
// //
@ -125,8 +129,10 @@ export default {
methods: { methods: {
async loadInit() { async loadInit() {
await this.subscribe(); await this.subscribe();
if (!this.$store.state.socket.setInRoom) { if (!this.$store.state.socket.setInRoom && !this.drawWay) {
await getjointTraining(this.group); await getjointTraining(this.group);
} else if (!this.$store.state.socket.setInRoom && this.drawWay) {
await getjointTrainingNew(this.group);
} }
await this.getRoomInfo(); await this.getRoomInfo();
await this.getUserList(); await this.getUserList();
@ -139,7 +145,12 @@ export default {
}, 5000 * 60); }, 5000 * 60);
}, },
async getRoomInfo() { async getRoomInfo() {
const resp = await postRoomDetail(this.group); let resp = '';
if (this.drawWay) {
resp = await postRoomDetailNew(this.group);
} else {
resp = await postRoomDetail(this.group);
}
this.room = { this.room = {
permissionRest: 0, permissionRest: 0,
totalNum: Number(resp.data.permissionNum) + Number(resp.data.audiencePermissionNum), totalNum: Number(resp.data.permissionNum) + Number(resp.data.audiencePermissionNum),
@ -147,7 +158,12 @@ export default {
}; };
}, },
async getStandList() { async getStandList() {
const resp = await getRealDevices(this.group); let resp = '';
if (this.drawWay) {
resp = await getRealDevicesNew(this.group);
} else {
resp = await getRealDevices(this.group);
}
this.standList = resp.data || []; this.standList = resp.data || [];
}, },
async getStaionList(mapId) { async getStaionList(mapId) {
@ -171,7 +187,12 @@ export default {
}); });
}, },
async getUserList() { async getUserList() {
const res = await getJointTrainRoomUserList(this.group); let res = '';
if (this.drawWay) {
res = await getJointTrainRoomUserListNew(this.group);
} else {
res = await getJointTrainRoomUserList(this.group);
}
this.members = (res.data || []).map(elem => { return this.transformUser(elem); }); this.members = (res.data || []).map(elem => { return this.transformUser(elem); });
}, },
async dispatchUsers(users) { async dispatchUsers(users) {
@ -244,7 +265,7 @@ export default {
if (!old.inSimulation && user.inSimulation) { if (!old.inSimulation && user.inSimulation) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入仿真`}); this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入仿真`});
if (this.userId == user.id) { if (this.userId == user.id && user.userRole.toUpperCase() !== 'ADMIN') {
await this.jumpInSimulation(); await this.jumpInSimulation();
} }
} }
@ -255,10 +276,15 @@ export default {
}, },
async jumpInSimulation() { async jumpInSimulation() {
const room = this.room; const room = this.room;
await putJointTrainingSimulationEntrance(room.group); if (this.drawWay) {
await putJointTrainingSimulationEntranceNew(room.group);
} else {
await putJointTrainingSimulationEntrance(room.group);
}
const rest = await getPublishMapInfo(room.mapId); const rest = await getPublishMapInfo(room.mapId);
const query = { lineCode: rest.data.lineCode, mapId: room.mapId, group: room.group, roomId: room.id }; const query = { lineCode: rest.data.lineCode, mapId: room.mapId, group: room.group, roomId: room.id };
if (this.$route.query.drawWay) { if (this.$route.query.drawWay) {
query.drawWay = this.$route.query.drawWay;
this.$router.replace({ path: `/jointTrainingNew`, query: query}); this.$router.replace({ path: `/jointTrainingNew`, query: query});
} else { } else {
this.$router.replace({ path: `/jointTraining`, query: query }); this.$router.replace({ path: `/jointTraining`, query: query });