国际化和连接真实设备调整

This commit is contained in:
fan 2020-01-03 17:00:33 +08:00
parent 766a169282
commit 673df154b4
10 changed files with 98 additions and 65 deletions

View File

@ -265,10 +265,21 @@ export function getRealDevicesNew(group) {
} }
// 更新真实设备的连接关系 // 更新真实设备的连接关系
export function undateRealDevicesNew(group, data) { export function updateRealDevicesNew(group, data) {
return request({ return request({
url: `/api/jointTraining/room/${group}/realDevice`, url: `/api/jointTraining/room/${group}/realDevice`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
// 真实设备是否被其他仿真使用
export function realDeviceIsUsed(group, projectCode) {
return request({
url: `/api/jointTraining/room/${group}/realDeviceUsed`,
method: 'get',
params: {
projectCode: projectCode
}
});
}

View File

@ -185,6 +185,7 @@ export default {
personalDetails: 'information', personalDetails: 'information',
trainingPlatformEntrance: 'Training platform entrance', trainingPlatformEntrance: 'Training platform entrance',
designPlatformEntrance: 'Design platform entrance', designPlatformEntrance: 'Design platform entrance',
connect: 'connect',
china: 'China', china: 'China',
australia: 'Australia', australia: 'Australia',

View File

@ -21,5 +21,6 @@ export default {
normalOperation: 'Normal operation', normalOperation: 'Normal operation',
faultOperation: 'Fault operation', faultOperation: 'Fault operation',
local: 'Local', local: 'Local',
lineAdjustment: 'Driving schedule' lineAdjustment: 'Driving schedule',
connectRealDevices: 'Connect real devices'
}; };

View File

@ -185,6 +185,7 @@ export default {
personalDetails: '个人信息', personalDetails: '个人信息',
trainingPlatformEntrance: '实训平台入口', trainingPlatformEntrance: '实训平台入口',
designPlatformEntrance: '设计平台入口', designPlatformEntrance: '设计平台入口',
connect: '连接',
china: '中国', china: '中国',
australia: '澳大利亚', australia: '澳大利亚',

View File

@ -21,5 +21,6 @@ export default {
normalOperation: '正常操作', normalOperation: '正常操作',
faultOperation: '故障操作', faultOperation: '故障操作',
local: '现地', local: '现地',
lineAdjustment: '行调' lineAdjustment: '行调',
connectRealDevices: '连接真实设备'
}; };

View File

@ -86,16 +86,13 @@ class MenuContextHandler {
covert(menuList) { covert(menuList) {
const selected = this.getCurrentStateObject(); const selected = this.getCurrentStateObject();
let menu = []; let menu = [];
console.log(selected, 'selected');
const control = this.getStationControl(selected); const control = this.getStationControl(selected);
console.log(control, 'control');
if (control) { if (control) {
if ( this.getPrdType() != '') { if ( this.getPrdType() != '') {
const type = State2SimulationMap[this.getPrdType()]; const type = State2SimulationMap[this.getPrdType()];
// const status = State2ControlMap[control.status]; // 缺少车站控制模式字段 // const status = State2ControlMap[control.status]; // 缺少车站控制模式字段
const status = State2ControlMap['01']; // 缺少车站控制模式字段 const status = State2ControlMap['01']; // 缺少车站控制模式字段
menu = [...menuList[type]]; menu = [...menuList[type]];
console.log(menu, 'menu');
if (menu.constructor === Array) { if (menu.constructor === Array) {
menu.forEach(elem => { menu.forEach(elem => {
if (elem.type === 'separator') { if (elem.type === 'separator') {
@ -120,7 +117,6 @@ class MenuContextHandler {
} }
} }
} }
console.log(menu, '=========212');
return menu; return menu;
// if (menuList.constructor === Array) { // if (menuList.constructor === Array) {

View File

@ -2,7 +2,7 @@
<div> <div>
<div class="display-draft"> <div class="display-draft">
<el-button-group> <el-button-group>
<el-button v-if="isProject" type="primary" @click="setRelDevice">设置真实设备</el-button> <el-button v-if="isProject" type="primary" @click="setRelDevice">{{ $t('joinTraining.connectRealDevices') }}</el-button>
<el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">{{ $t('joinTraining.driverPerspective') }}</el-button> <el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">{{ $t('joinTraining.driverPerspective') }}</el-button>
<template v-if="isAdmin"> <template v-if="isAdmin">
<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>

View File

@ -14,7 +14,8 @@
<div> <div>
<ul> <ul>
<li v-for="(node, index) in options" :key="index" style="height: 45px"> <li v-for="(node, index) in options" :key="index" style="height: 45px">
<span>{{ handleDeviceTitle(node) }}</span> <span v-if="node.online" style="color: #339933;">{{ handleDeviceTitle(node) }}</span>
<span v-else style="color: #A9A9A9;">{{ handleDeviceTitle(node) }}</span>
<div style="float: right;"> <div style="float: right;">
<el-select <el-select
v-if="node.projectDeviceType ==='PSD'" v-if="node.projectDeviceType ==='PSD'"
@ -75,14 +76,14 @@
</ul> </ul>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button> <el-button type="primary" @click="doSave">{{ $t('global.connect') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button> <el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getRealDevicesNew, undateRealDevicesNew } from '@/api/chat'; import { getRealDevicesNew, updateRealDevicesNew, 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';
@ -96,7 +97,7 @@ export default {
loading: false, loading: false,
doorList: [], doorList: [],
deviceRelList: [], deviceRelList: [],
title: '设置真实设备连接' projectCode:''
}; };
}, },
computed: { computed: {
@ -105,7 +106,10 @@ export default {
'stationStandList', 'stationStandList',
'switchList', 'switchList',
'signalList' 'signalList'
]) ]),
title() {
return this.$t('joinTraining.connectRealDevices');
}
}, },
mounted() { mounted() {
}, },
@ -150,9 +154,9 @@ export default {
doShow() { doShow() {
this.dialogShow = true; this.dialogShow = true;
this.options = []; this.options = [];
const 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: projectCode}).then(resp => { getAllDeviceInProject({projectCode: this.projectCode}).then(resp => {
getRealDevicesNew(this.$route.query.group).then(res => { getRealDevicesNew(this.$route.query.group).then(res => {
resp.data.forEach((it, index) => { resp.data.forEach((it, index) => {
this.options.push({ this.options.push({
@ -201,19 +205,35 @@ export default {
this.doorList = []; this.doorList = [];
this.deviceRelList = []; this.deviceRelList = [];
}, },
doSave() { update() {
const paramsList = []; const paramsList = [];
this.options.forEach(item => { this.options.forEach(item => {
if (item.deviceCode || item.id) { if (item.deviceCode || item.id) {
paramsList.push(item); paramsList.push(item);
} }
}); });
undateRealDevicesNew(this.$route.query.group, paramsList).then(res => { updateRealDevicesNew(this.$route.query.group, paramsList).then(res => {
this.$message.success('更新真实设备连接关系成功!'); this.$message.success('更新真实设备连接关系成功!');
this.doClose(); this.doClose();
}).catch(() => { }).catch(() => {
this.$message.error('更新真实设备连接关系失败!'); this.$message.error('更新真实设备连接关系失败!');
}); });
},
doSave() {
// realDeviceIsUsed(this.$route.query.group, this.projectCode).then(resp => {
// if (resp.data) {
// this.$confirm('仿?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// }).then(()=> {
// this.undate();
// });
// } else {
// this.undate();
// }
// });
this.update();
} }
} }
}; };

View File

@ -144,7 +144,7 @@ export default {
} }
}; };
var validateAddr = (rule, value, callback) => { var validateAddr = (rule, value, callback) => {
if (!value) { if (!value && value !== 0) {
callback(new Error(rule.messageEmpty)); callback(new Error(rule.messageEmpty));
} else if (this.formModel.i_addr === this.formModel.o_addr) { } else if (this.formModel.i_addr === this.formModel.o_addr) {
callback(new Error('输入网关字地址与输出网关字地址不能相同!')); callback(new Error('输入网关字地址与输出网关字地址不能相同!'));

View File

@ -144,9 +144,11 @@ export default {
handleTime(time) { handleTime(time) {
const timeList = time.split('T'); const timeList = time.split('T');
let newTime = ''; let newTime = '';
timeList.forEach(elem => { if (timeList.length > 1) {
newTime += elem; newTime = timeList[0] + ' ' + timeList[1];
}); } else {
newTime = time;
}
return newTime; return newTime;
}, },
// //