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

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({
url: `/api/jointTraining/room/${group}/realDevice`,
method: 'put',
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',
trainingPlatformEntrance: 'Training platform entrance',
designPlatformEntrance: 'Design platform entrance',
connect: 'connect',
china: 'China',
australia: 'Australia',

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<div>
<div class="display-draft">
<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>
<template v-if="isAdmin">
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button>

View File

@ -14,7 +14,8 @@
<div>
<ul>
<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;">
<el-select
v-if="node.projectDeviceType ==='PSD'"
@ -75,14 +76,14 @@
</ul>
</div>
<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>
</span>
</el-dialog>
</template>
<script>
import { getRealDevicesNew, undateRealDevicesNew } from '@/api/chat';
import { getRealDevicesNew, updateRealDevicesNew, realDeviceIsUsed } from '@/api/chat';
import { hasDoorStationList } from '@/api/jmap/map';
import {getAllDeviceInProject} from '@/api/project';
import { mapGetters } from 'vuex';
@ -96,7 +97,7 @@ export default {
loading: false,
doorList: [],
deviceRelList: [],
title: '设置真实设备连接'
projectCode:''
};
},
computed: {
@ -105,7 +106,10 @@ export default {
'stationStandList',
'switchList',
'signalList'
])
]),
title() {
return this.$t('joinTraining.connectRealDevices');
}
},
mounted() {
},
@ -150,9 +154,9 @@ export default {
doShow() {
this.dialogShow = true;
this.options = [];
const projectCode = getSessionStorage('project').toUpperCase();
this.projectCode = getSessionStorage('project').toUpperCase();
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 => {
resp.data.forEach((it, index) => {
this.options.push({
@ -201,19 +205,35 @@ export default {
this.doorList = [];
this.deviceRelList = [];
},
doSave() {
update() {
const paramsList = [];
this.options.forEach(item => {
if (item.deviceCode || item.id) {
paramsList.push(item);
}
});
undateRealDevicesNew(this.$route.query.group, paramsList).then(res => {
updateRealDevicesNew(this.$route.query.group, paramsList).then(res => {
this.$message.success('更新真实设备连接关系成功!');
this.doClose();
}).catch(() => {
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) => {
if (!value) {
if (!value && value !== 0) {
callback(new Error(rule.messageEmpty));
} else if (this.formModel.i_addr === this.formModel.o_addr) {
callback(new Error('输入网关字地址与输出网关字地址不能相同!'));

View File

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