综合仿真页面调整&删除连接真实设备

This commit is contained in:
fan 2020-07-22 13:30:56 +08:00
parent da120ce273
commit 507fdd2593
11 changed files with 38 additions and 366 deletions

View File

@ -226,6 +226,7 @@ export const VersionBaseNoShow = ['heb', 'designheb']; // 登录页右下角版
export const MainBodyNoShow = ['heb', 'designheb', 'jyd', 'designjyd', 'tky', 'designtky', 'bxkc', 'designbxkc']; // 登录页右下角主体不展示
export const GenerateRouteProjectList = ['jsxt', 'refereeJsxt'];// 需要在公共路由中生成登录页面的项目
export const ProjectLoginStyleList = ['jsxt', 'refereeJsxt', 'gzb', 'designgzb', 'xty', 'designxty', 'xadt', 'designxadt', 'tky', 'designtky', 'jyd', 'designjyd', 'bxkc', 'designbxkc']; // 登录页样式
export const NoQrcodeList = ['heb', 'designheb'];
export const goOtherPlatformMenu = { // 导航栏快速切换平台
login: '/design/login',
design: '/login',

View File

@ -63,6 +63,7 @@ service.interceptors.response.use(
});
});
});
return response.data;
} else if (res.code === 500) {
const defaultError = { type: '服务异常:', message: '未知错误!'};
const errorTip = ConstConfig.ConstSelect.interfaceErrorConfig[res.code + ''];

View File

@ -53,9 +53,11 @@ StompClient.prototype = {
// sock断开回调
that.clientIns.ws.onclose = () => {
console.info(`通信连接已断开!`);
checkLoginLine().then(() => {
that.count++;
that.reconnect(that.count);
checkLoginLine().then((resp) => {
if (resp.code == 200) {
that.count++;
that.reconnect(that.count);
}
}).catch((err) => {
that.logOut(err);
});

View File

@ -79,7 +79,7 @@
<el-checkbox v-model="isAutoLogin">{{ $t('login.autoLogin') }}</el-checkbox>
</div>
<el-popover
v-if="!project.endsWith('heb')"
v-if="!noQrcodeList.includes(project)"
placement="right"
title=""
width="200"
@ -120,7 +120,7 @@ import bgCctvImg from '@/assets/bg_cctv.jpg';
import bgLswImg from '@/assets/bg_lsw.jpg';
import bgPsdImg from '@/assets/bg_psd.png';
import { UrlConfig } from '@/scripts/ConstDic';
import { loginInfo, ProjectIcon, ProjectLoginStyleList, VersionBaseNoShow, MainBodyNoShow} from '@/scripts/ProjectConfig';
import { loginInfo, ProjectIcon, ProjectLoginStyleList, VersionBaseNoShow, MainBodyNoShow, NoQrcodeList} from '@/scripts/ProjectConfig';
import { removeToken, getToken } from '@/utils/auth';
import LangStorage from '@/utils/lang';
import FloatPart from './floatPart';
@ -176,8 +176,8 @@ export default {
lang: 'zh',
language: '中文',
versionBaseNoShow: VersionBaseNoShow,
mainBodyNoShow: MainBodyNoShow
mainBodyNoShow: MainBodyNoShow,
noQrcodeList: NoQrcodeList
};
},
computed: {

View File

@ -17,7 +17,6 @@
:is-admin="isAdmin"
:device-code="deviceCode"
:countdown-time="countdownTime"
:admin-mode="adminMode"
@getUserRole="getUserRole"
@hidepanel="hidepanel"
@startCounting="startCounting"
@ -38,7 +37,6 @@
@runPlanViewShow="runPlanViewShow"
@faultChooseShow="faultChooseShow"
@switchStationMode="switchStationMode"
@changeAdminMode="changeAdminMode"
/>
<join-fault-choose ref="faultChoose" :group="group" :offset="offset" />
<join-run-plan-Load ref="runPlanLoad" :group="group" />
@ -140,7 +138,6 @@ export default {
questionList: [],
practicalExamTime: 0,
isAdmin: false,
adminMode: true,
deviceShow: false
};
},
@ -250,7 +247,6 @@ export default {
this.group = this.$route.query.group;
this.mapId = this.$route.query.mapId;
this.lineCode = this.$route.query.lineCode;
// this.drawWay = this.$route.query.drawWay;
Message.closeAll();
},
async mounted() {
@ -351,7 +347,6 @@ export default {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
@ -375,11 +370,6 @@ export default {
this.endViewLoading();
}
},
async initDeviceVo() {
// getLoginInfo(getToken()).then(resp => {
// this.$store.dispatch('SetProjecteDevice', resp.data.deviceVO);
// });
},
initMemberUserInfo() {
getSimulationMemberList(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId: this.$store.state.user.id});
@ -465,7 +455,6 @@ export default {
resp['code'] = 200;
resp.data['userRole'] = 'ADMIN';
} else {
await this.initDeviceVo();
resp = await this.getUserRole();
}
if (resp && resp.code == 200) {
@ -509,11 +498,6 @@ export default {
this.jl3dmaintainershow = true;
break;
}
if (this.isAdmin && this.adminMode) {
this.$store.dispatch('training/setPrdType', swch || '02');
this.$store.dispatch('training/setRoles', 'AUDIENCE');
this.hideIbp();
}
},
startCounting() {
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
@ -690,10 +674,6 @@ export default {
addSimulationMember() {
this.$refs.addMember.doShow();
},
changeAdminMode(adminMode, swch) { // (/)
this.adminMode = adminMode;
this.setSimulationPrdType(swch);
},
checkRoleChange(data) {
data.forEach(item => {
if (item.messageType === 'KICK_OUT' && item.userId == this.userId) {

View File

@ -3,13 +3,12 @@
<chat-box :group="group" :user-role="userRole" />
<div class="display-draft" :class="{'display-type-hb': $route.query.lineCode == '07' && $store.state.training.prdType=='01'}" :style="{bottom: offsetBottom + 'px'}">
<el-button-group>
<el-button v-if="isAdmin && adminMode" @click="handleEquipment">设备管理</el-button>
<el-button v-if="isAdmin && adminMode" @click="memberManage">成员管理</el-button>
<el-button v-if="isAdmin && adminMode && project !=='heb'" type="primary" @click="generateQrCode">生成二维码</el-button>
<el-button v-if="hasRealDevice && !dataError " type="primary" @click="setRelDevice">{{ $t('joinTraining.connectRealDevices') }}</el-button>
<el-button v-if="isAdmin" @click="handleEquipment">设备管理</el-button>
<el-button v-if="isAdmin" @click="memberManage">成员管理</el-button>
<el-button v-if="isAdmin && !noQrcodeList.includes(project)" type="primary" @click="generateQrCode">生成二维码</el-button>
<el-button v-if="isDriver && !dataError" type="jumpjlmap3d" @click="jumpjlmap3d">{{ $t('joinTraining.driverPerspective') }}</el-button>
<el-button v-if="isStationSupervisor && !dataError" type="jmap3dcctv" @click="jlmap3dcctv">cctv</el-button>
<template v-if="isAdmin && adminMode && project != 'refereeJsxt'">
<template v-if="isAdmin && project != 'refereeJsxt'">
<el-button type="success" :disabled="isDisable || dataError" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button>
<el-button type="danger" :disabled="dataError" @click="end">{{ $t('joinTraining.initialize') }}</el-button>
</template>
@ -24,7 +23,6 @@
</div>
<qr-code ref="qrCode" />
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<real-device ref="realDevice" />
<equipment ref="equipment" />
</div>
</template>
@ -38,8 +36,8 @@ import { ranAsPlan, exitRunPlan, clearSimulation } from '@/api/simulation';
import { exitFullscreen } from '@/utils/screen';
import { getSimulationQrcode } from '@/api/jointSimulation';
import { getSessionStorage } from '@/utils/auth';
import RealDevice from './menuDraft/realDevice';
import { refereeExitSimulation, quitCurrentRace, startPracticalCompetition, submitPracticalCompetition } from '@/api/competition';
import { NoQrcodeList } from '@/scripts/ProjectConfig';
import { prefixIntrger } from '@/utils/date';
import localStore from 'storejs';
@ -49,7 +47,6 @@ export default {
ChatBox,
QrCode,
SetTime,
RealDevice,
Equipment
},
props: {
@ -83,12 +80,6 @@ export default {
return false;
}
},
adminMode: {
type: Boolean,
default() {
return false;
}
},
offsetBottom: {
type: [String, Number],
default: 15
@ -104,7 +95,8 @@ export default {
stationList: [],
stationLists: [],
jsStart: true,
isGoback: false
isGoback: false,
noQrcodeList: NoQrcodeList
};
},
computed: {
@ -120,9 +112,6 @@ export default {
isDriver() {
return this.userRole == 'DRIVER';
},
hasRealDevice() {
return getSessionStorage('project').endsWith('gzb') && this.userRole === 'CI';
},
project() {
return getSessionStorage('project');
}
@ -348,9 +337,6 @@ export default {
jlmap3dcctv() {
this.$emit('hidejl3dcctv');
},
setRelDevice() {
this.$refs.realDevice.doShow();
},
formatTime(initTime) {
const hh = prefixIntrger(initTime.getHours(), 2);
const mm = prefixIntrger(initTime.getMinutes(), 2);

View File

@ -1,293 +0,0 @@
<template>
<el-dialog
v-dialogDrag
:title="title"
:visible.sync="dialogShow"
width="500px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
center
>
<div v-if="options.length">
<ul>
<li v-for="(node, index) in options" :key="index" style="height: 45px">
<span v-if="node.online" style="color: #339933;">{{ handleDeviceTitle(node) }}</span>
<span v-else style="color: #A9A9A9;">{{ handleDeviceTitle(node) }}</span>
<div style="float: right;">
<el-select
v-if="node.projectDeviceType ==='PSD'"
v-model="node.deviceCode"
:placeholder="$t('global.choose')"
filterable
clearable
size="mini"
@change="psdDeviceChange"
>
<el-option
v-for="item in doorList"
:key="item.code"
:label="item.name"
:value="item.code"
:disabled="item.disabled"
style="margin-left: 10px"
/>
</el-select>
<el-select
v-else-if="node.projectDeviceType ==='SWITCH'"
v-model="node.deviceCode"
:placeholder="$t('global.choose')"
filterable
clearable
size="mini"
@change="switchDeviceChange"
>
<el-option
v-for="item in switchList"
:key="item.code"
:label="item.name"
:value="item.code"
:disabled="item.disabled"
style="margin-left: 10px"
/>
</el-select>
<el-select
v-else-if="node.projectDeviceType ==='SIGNAL'"
v-model="node.deviceCode"
:placeholder="$t('global.choose')"
filterable
clearable
size="mini"
@change="signalDeviceChange"
>
<el-option
v-for="item in signalList"
:key="item.code"
:label="item.name"
:value="item.code"
:disabled="item.disabled"
style="margin-left: 10px"
/>
</el-select>
</div>
</li>
</ul>
</div>
<div v-else style="height: 50px; text-align: center; color: #C0C0C0;line-height: 50px">
<span>未查询到真实设备</span>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.connect') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getRealDevicesInRoomNew, updateRealDevicesNew} from '@/api/jointTraining';
import { hasDoorStationList } from '@/api/jmap/map';
import {getAllDeviceInProject} from '@/api/project';
import { mapGetters } from 'vuex';
import { getSessionStorage } from '@/utils/auth';
export default {
name: 'RealDevice',
data() {
return {
dialogShow: false,
options: [],
loading: false,
doorList: [],
deviceRelList: [],
projectCode:''
};
},
computed: {
...mapGetters('map', [
'stationList',
'stationStandList',
'switchList',
'signalList'
]),
title() {
return this.$t('joinTraining.connectRealDevices');
}
},
mounted() {
},
methods: {
handleDeviceTitle(node) {
let connectDeviceName = '';
if (node.connectDeviceCode) {
if (node.projectDeviceType === 'PSD') {
this.doorList.forEach(item => {
if (item.code === node.connectDeviceCode) {
connectDeviceName = item.name;
}
});
} else if (node.projectDeviceType === 'SWITCH') {
this.switchList.forEach(item => {
if (item.code === node.connectDeviceCode) {
connectDeviceName = item.name;
}
});
} else if (node.projectDeviceType === 'SIGNAL') {
this.signalList.forEach(item => {
if (item.code === node.connectDeviceCode) {
connectDeviceName = item.name;
}
});
}
}
const online = node.connectDeviceCode ? this.$t('joinTraining.connectedDevice') + connectDeviceName + ']' : this.$t('joinTraining.notConnected');
return node.projectDeviceCode + online;
},
psdDeviceChange() {
const psdDevices = [];
this.options.forEach(item => {
if (item.projectDeviceType === 'PSD' || item.deviceCode) {
psdDevices.push(item.deviceCode);
}
});
this.doorList.forEach(it => {
it.disabled = psdDevices.includes(it.code);
});
},
switchDeviceChange() {
const switchDevices = [];
this.options.forEach(item => {
if (item.projectDeviceType === 'SWITCH' || item.deviceCode) {
switchDevices.push(item.deviceCode);
}
});
this.switchList.forEach(it => {
it.disabled = switchDevices.includes(it.code);
});
},
signalDeviceChange() {
const signalDevices = [];
this.options.forEach(item => {
if (item.projectDeviceType === 'SIGNAL' || item.deviceCode) {
signalDevices.push(item.deviceCode);
}
});
this.signalList.forEach(it => {
it.disabled = signalDevices.includes(it.code);
});
},
doShow() {
this.dialogShow = true;
this.options = [];
this.projectCode = getSessionStorage('project').toUpperCase();
this.getDoorList(this.$route.query.mapId, this.stationList);
getAllDeviceInProject({projectCode: this.projectCode, group:this.$route.query.group}).then(resp => {
getRealDevicesInRoomNew(this.$route.query.group).then(res => {
resp.data.forEach((it, index) => {
this.options.push({
deviceCode: '',
id: null,
online: it.online,
projectDeviceId: it.id,
projectDeviceCode: it.code,
projectDeviceType: it.type,
connectDeviceCode: it.deviceCode,
roomId: this.$route.query.roomId
});
res.data.forEach(item => {
if (it.id == item.projectDeviceId) { // it.idnumber item.projectDeviceIdstring
this.options[index].id = item.id;
this.options[index].deviceCode = item.deviceCode;
}
});
});
this.psdDeviceChange();
this.switchDeviceChange();
this.signalDeviceChange();
});
}).catch(() => {
this.$message.error(this.$t('error.getRealDeviceFailed'));
});
},
async getDoorList(mapId, stationList) {
const doorList = [];
hasDoorStationList(mapId).then(res =>{
stationList.forEach(item => {
res.data.forEach(it =>{
if (item.code === it.stationCode) {
const direction = parseInt(it.doorLocationType) % 2 === 0 ? this.$t('trainRoom.uplinkPlatform') : this.$t('trainRoom.downlinkPlatform');
doorList.push({code: it.code, name: item.name + direction});
}
});
});
this.doorList = doorList;
}).catch(() => {
this.$messageBox(this.$t('error.getScreenDoorsListFailed'));
});
},
doClose() {
this.dialogShow = false;
this.options = [];
this.doorList = [];
this.deviceRelList = [];
},
update() {
const paramsList = [];
this.options.forEach(item => {
if (item.deviceCode || item.id) {
paramsList.push(item);
}
});
updateRealDevicesNew(this.$route.query.group, paramsList).then(res => {
this.$message.success(this.$t('tip.updateRealDeviceConnectionSuccess'));
this.doClose();
}).catch(() => {
this.$message.error(this.$t('tip.updateRealDeviceConnectionFailed'));
});
},
doSave() {
// realDeviceIsUsed(this.$route.query.group, this.projectCode).then(resp => {
// if (resp.data) {
// this.$confirm('仿?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// }).then(()=> {
// this.update();
// });
// } else {
// this.update();
// }
// });
this.update();
}
}
};
</script>
<style scoped lang="scss">
/deep/ {
.el-dialog__body {
padding: 0px 20px;
}
}
.listBox {
margin: 0px;
max-height: 270px;
overflow-y: auto;
padding-inline-start: 0px;
width: 100%;
.listLi {
list-style: none;
height: 30px;
line-height: 30px;
}
}
.tipLable {
line-height: 33px;
}
</style>

View File

@ -1,31 +1,25 @@
<template>
<div class="schema" :style="{top: offset+'px'}">
<el-select
v-if="isAdmin && adminMode"
v-model="swch"
size="small"
style="width: 100px;"
@change="switchMode"
>
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-select v-if="showSelectStation" v-model="chiShowStation" style="width: 100px;" size="small" @change="switchStationMode">
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-button-group>
<template>
<el-button v-if="userRole=== 'DISPATCHER'" size="small" @click="goBigScreen">大屏</el-button>
</template>
<template>
<el-button v-if="runing && !dataError" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
</template>
<template v-if="isAdmin && adminMode">
<template v-if="isAdmin">
<el-button v-if="!runing && !dataError" size="small" type="warning" @click="loadRunPlan">
{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- -->
</template>
<template v-if="isAdmin && adminMode">
<template v-if="isAdmin">
<el-button v-if="mode==OperateMode.FAULT && !dataError" size="small" type="danger" @click="setFault">{{ $t('joinTraining.faultSetting') }}</el-button>
</template>
</el-button-group>
<el-radio-group
v-if="isAdmin && adminMode && !dataError && !isScreen"
v-if="isAdmin && !dataError && !isScreen"
v-model="mode"
size="small"
@change="changeOperateMode(mode)"
@ -33,10 +27,6 @@
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('joinTraining.normalOperation') }}</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">{{ $t('joinTraining.faultOperation') }}</el-radio-button>
</el-radio-group>
<el-radio-group v-if="isAdmin" v-model="adminMode" size="small" @change="changeAdminMode">
<el-radio-button class="mode" :label="true">管理模式</el-radio-button>
<el-radio-button class="mode" :label="false">演练模式</el-radio-button>
</el-radio-group>
</div>
</template>
<script>
@ -109,8 +99,7 @@ export default {
{ value: '07', name: '大屏'}
],
runing: false,
userId: '',
adminMode: true
userId: ''
};
},
computed: {
@ -165,10 +154,6 @@ export default {
}
});
},
switchMode(swch) {
this.chiShowStation = this.showStation;
this.$store.dispatch('training/setPrdType', swch);
},
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
@ -190,8 +175,18 @@ export default {
switchStationMode(val) {
this.$emit('switchStationMode', val);
},
changeAdminMode(adminMode) {
this.$emit('changeAdminMode', adminMode, this.swch);
goBigScreen() {
const routeData = this.$router.resolve({
path:`/bigSplitScreen/${this.$route.query.mapId}`,
query:{
lineCode: this.$route.query.lineCode,
mapId:this.$route.query.mapId,
group:this.$route.query.group,
prdType: '07',
try:0
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}
}
};

View File

@ -56,7 +56,7 @@ module.exports = {
// },
// parallel: require('os').cpus().length > 1, // 是否为 Babel 或 TypeScript 使用 thread-loader。该选项在系统的 CPU 有多于一个内核时自动启用,仅作用于生产构建。
configureWebpack: config => {
const appTarget = process.env.VUE_APP_PRO == 'local' ? 'HYD' : 'Common'; // 其他环境变量 区分配置
const appTarget = process.env.VUE_APP_PRO == 'local' ? 'HEB' : 'Common'; // 其他环境变量 区分配置
config.plugins.push(new webpack.NormalModuleReplacementPlugin(/(.*)_APP_TARGET(\.*)/,
function (resourse) {
resourse.request = resourse.request.replace(/APP_TARGET/, `${appTarget}`);