Merge remote-tracking branch 'origin/test' into thailand

This commit is contained in:
fan 2023-06-02 14:27:34 +08:00
commit 2a85d2e6cf
9 changed files with 174 additions and 97 deletions

View File

@ -515,10 +515,10 @@ export function getStandListByRunLineOrTrainCode(group, params) {
params
});
}
/** 上饶列车控制 */
export function srTrainControl(group, params) {
/** 沙盘列车控制 */
export function sandTableTrainControl(group, params) {
return request({
url: `/api/sr/${group}/control`,
url: `/api/sandTable/${group}/control`,
method: 'put',
params
});

View File

@ -28,7 +28,7 @@
<el-button :type="right?'':'primary'" size="mini" icon="el-icon-arrow-left" @click="adjustDirection('left')" />
</el-col>
<el-col :span="3" style="text-align: center;">
<img style="width: 50px" :src="right? rightTrainPic:leftTrainPic">
<img style="width: 50px" :src="trainPic">
</el-col>
<el-col :span="3">
<el-button :type="right?'primary':''" size="mini" icon="el-icon-arrow-right" @click="adjustDirection('right')" />
@ -40,7 +40,7 @@
<script>
import LeftTrain from '@/assets/left_train.png';
import RightTrain from '@/assets/right_train.png';
import { srTrainControl } from '@/api/simulation';
import { sandTableTrainControl } from '@/api/simulation';
export default {
name: 'TrainOperation',
data() {
@ -52,6 +52,7 @@ export default {
groupNumber: '',
changeSpeedFlag: false,
right: true,
reversal: false,
train: null,
marks: {
0: '0',
@ -68,6 +69,15 @@ export default {
}
};
},
computed: {
trainPic() {
if ((this.right && this.reversal) || (!this.right && !this.reversal)) {
return this.leftTrainPic;
} else {
return this.rightTrainPic;
}
}
},
methods: {
handleClose() {
this.$store.dispatch('menuOperation/setSelected', {device: {}});
@ -75,6 +85,10 @@ export default {
},
doShow(val) {
const train = this.$store.getters['map/getDeviceByCode'](val.groupNumber);
if (train && train.trainWindowCode) {
const trainWindow = this.$store.getters['map/getDeviceByCode'](train.trainWindowCode);
this.reversal = trainWindow.reversal;
}
this.groupNumber = train.groupNumber;
this.train = train;
if (this.right != train.right) {
@ -90,16 +104,16 @@ export default {
this.changeSpeedFlag = true;
},
changeSpeed(val) {
srTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: this.speed }).then(resp => {
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: this.speed }).then(resp => {
}).catch(err => { this.$message.error(err.message); this.speed = this.train.speed; }).finally(() => { this.changeSpeedFlag = false; });
},
adjustDirection(value) {
srTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: value === 'right', speed: this.speed }).then(resp => {
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: value === 'right', speed: this.speed }).then(resp => {
this.right = value === 'right';
}).catch(err => { this.$message.error(err.message); });
},
brakeTrain() {
srTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: 0 }).then(resp => {
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: 0 }).then(resp => {
this.speed = 0;
}).catch(err => { this.$message.error(err.message); });
}

View File

@ -27,7 +27,8 @@ const user = {
// resourcesUrl: '',
// uploadUrl: '',
ossUrl:'',
baseSite: ''
baseSite: '',
deviceConfig: null
},
mutations: {
@ -102,6 +103,9 @@ const user = {
},
setBaseSite: (state, baseSite) => {
state.baseSite = baseSite;
},
setDeviceConfig: (state, deviceConfig) => {
state.deviceConfig = deviceConfig;
}
},
@ -164,6 +168,7 @@ const user = {
commit('SET_COMPANYNAME', user.companyName);
commit('SET_COMPANYPROJECTLIST', user.projectCodes);
commit('SET_THIRDLOGIN', response.data.thirdLogin);
commit('setDeviceConfig', JSON.parse(response.data.deviceVO.config || '{}'));
resolve(user);
}).catch(error => {
reject(error);

View File

@ -253,8 +253,7 @@ export default {
projectDevice:this.$route.query.projectDevice,
type:this.$route.query.type,
simType:paramVO.type,
project: this.project,
singleClient:true
project: this.project
};
if (config) {
if (config.client) { query.client = config.client; }

View File

@ -294,33 +294,31 @@ export default {
});
},
assignUser(group, mapId) {
this.$store.dispatch('GetUserInfo', getToken()).then(res => {
getLoginInfo(getToken()).then(resp => {
const deviceVO = resp.data.deviceVO;
if (deviceVO) {
const config = JSON.parse(deviceVO.config || '{}');
if (config && config.roleCode) {
const params = [{userId: res.id, memberId:config.roleCode}];
assignUsersPlayRoles(params, group).then(() => {
this.enterSimulation(group, mapId, config);
}).catch(res=>{
this.loading = false;
this.$message.error('切换角色失败');
this.$store.dispatch('LogOut');
});
} else {
getLoginInfo(getToken()).then(resp => {
const deviceVO = resp.data.deviceVO;
if (deviceVO) {
const config = JSON.parse(deviceVO.config || '{}');
if (config && config.roleCode) {
const params = [{userId: resp.data.accountVO.id, memberId:config.roleCode}];
assignUsersPlayRoles(params, group).then(() => {
this.enterSimulation(group, mapId, config);
}).catch(res=>{
this.loading = false;
this.$message.error('请先配置设备相关信息');
this.$message.error('切换角色失败');
this.$store.dispatch('LogOut');
}
});
} else {
this.enterSimulation(group, mapId);
this.loading = false;
this.$message.error('请先配置设备相关信息');
this.$store.dispatch('LogOut');
}
}).catch(res=>{
this.loading = false;
this.$message.error('获取用户信息失败');
this.$store.dispatch('LogOut');
});
} else {
this.enterSimulation(group, mapId);
}
}).catch(res=>{
this.loading = false;
this.$message.error('获取用户信息失败');
this.$store.dispatch('LogOut');
});
},
enterSimulation(group, mapId, config) {
@ -333,8 +331,7 @@ export default {
mapId: mapId,
simType:paramVO.type,
project: this.projectCode,
projectDevice:this.$route.query.projectDevice,
singleClient:true
projectDevice:this.$route.query.projectDevice
};
if (config) {
if (config.client) { query.client = config.client; }

View File

@ -155,7 +155,7 @@ export default {
return this.$store.state.training.roleDeviceCode;
},
menuShow() {
return !this.$route.query.singleClient && !this.$route.query.projectDevice;
return !this.$route.query.singleClient;
}
},
watch: {

View File

@ -61,8 +61,16 @@ export default {
watch: {
'$store.state.training.roles': function (val) {
const clientIdList = this.$store.state.training.domConfig ? this.$store.state.training.domConfig.clientList : [];
if (!clientIdList || !clientIdList.length) {
this.initTerminalList();
if (this.$route.query.projectDevice) {
const deviceClientIdList = this.$store.state.user.deviceConfig.clientList || [];
this.initTerminalList(deviceClientIdList);
if (this.$route.query.client && !this.nowTerminal.id) {
this.changeQueryClient();
} else {
this.initPictureShow();
}
} else if (!clientIdList || !clientIdList.length) {
this.initTerminalList(clientIdList);
if (this.$store.state.trainingNew.trainingDetail && this.$store.state.trainingNew.trainingDetail.client) {
const client = this.findTerminalFromMap(this.$store.state.trainingNew.trainingDetail.client);
if (client) {
@ -74,7 +82,7 @@ export default {
this.initPictureShow();
}
} else if (!this.terminalList.length) {
this.initTerminalList();
this.initTerminalList([]);
this.changeQueryClient();
}
}
@ -131,9 +139,8 @@ export default {
}
},
//
initTerminalList() {
initTerminalList(clientIdList) {
this.terminalList = [];
const clientIdList = this.$store.state.training.domConfig ? this.$store.state.training.domConfig.clientList : [];
const mapClientMap = this.$store.state.map.map ? this.$store.state.map.map.mapClientVOMap : {};
const mapClientList = mapClientMap ? mapClientMap[this.$route.query.simType] : [];
if (!mapClientList.length) {

View File

@ -31,8 +31,8 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联客户端:" prop="client">
<el-select v-model="formIbp.client" placeholder="请选择" size="small">
<el-form-item label="客户端列表:" prop="client">
<el-select v-model="formIbp.clientList" multiple placeholder="请选择" size="small">
<el-option
v-for="item in clientList"
:key="item.id"
@ -41,6 +41,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="初始客户端:" prop="client">
<el-select v-model="formIbp.client" placeholder="请选择" size="small">
<template v-for="item in clientList">
<el-option
v-if="formIbp.clientList.includes(item.id)"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</template>
</el-select>
</el-form-item>
</el-form>
<el-form v-show="['IM','CW','DRIVE','DEPOT'].includes(data.type)" ref="formIm" :model="formIm" label-width="100px" :rules="rulesIm">
<el-form-item label="关联角色:" prop="roleCode">
@ -53,8 +65,8 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联客户端:" prop="client">
<el-select v-model="formIm.client" placeholder="请选择" size="small">
<el-form-item label="客户端列表:" prop="client">
<el-select v-model="formIm.clientList" multiple placeholder="请选择" size="small">
<el-option
v-for="item in clientList"
:key="item.id"
@ -63,6 +75,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="初始客户端:" prop="client">
<el-select v-model="formIm.client" placeholder="请选择" size="small">
<template v-for="item in clientList">
<el-option
v-if="formIm.clientList.includes(item.id)"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</template>
</el-select>
</el-form-item>
</el-form>
<el-form v-show="data.type === 'LW'" ref="formLw" :model="formLw" label-width="100px" :rules="rulesLw">
<el-form-item label="关联车站:" prop="stationCode">
@ -85,8 +109,8 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联客户端:" prop="client">
<el-select v-model="formLw.client" placeholder="请选择" size="small">
<el-form-item label="客户端列表:" prop="client">
<el-select v-model="formLw.clientList" multiple placeholder="请选择" size="small">
<el-option
v-for="item in clientList"
:key="item.id"
@ -95,6 +119,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="初始客户端:" prop="client">
<el-select v-model="formLw.client" placeholder="请选择" size="small">
<template v-for="item in clientList">
<el-option
v-if="formLw.clientList.includes(item.id)"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</template>
</el-select>
</el-form-item>
</el-form>
<el-form v-show="data.type === 'ISCS_LW' || data.type === 'ISCS_CW'" ref="formIscs" :model="formIscs" label-width="100px" :rules="rulesIscs">
<el-form-item :label="data.type === 'ISCS_LW'?'现地工作站:': '行调工作站'" prop="deviceCode">
@ -137,8 +173,8 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联客户端:" prop="client">
<el-select v-model="formIscs.client" placeholder="请选择" size="small">
<el-form-item label="客户端列表:" prop="client">
<el-select v-model="formIscs.clientList" multiple placeholder="请选择" size="small">
<el-option
v-for="item in clientList"
:key="item.id"
@ -147,6 +183,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="初始客户端:" prop="client">
<el-select v-model="formIscs.client" placeholder="请选择" size="small">
<template v-for="item in clientList">
<el-option
v-if="formIscs.clientList.includes(item.id)"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</template>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
@ -170,25 +218,29 @@ export default {
lwList: [],
formIm:{
roleCode:'',
client:''
client:'',
clientList: []
},
formIbp: {
part: '',
deviceCode: '',
roleCode:'',
client:''
client:'',
clientList: []
},
formLw: {
stationCode: '',
roleCode:'',
client:''
client:'',
clientList: []
},
formIscs: {
deviceCode: '',
picture: '',
stationCode: '',
roleCode:'',
client:''
client:'',
clientList: []
},
clientList: [],
pictureList: [
@ -201,6 +253,9 @@ export default {
],
client: [
{ required: true, message: '请选择关联客户端', trigger: 'change'}
],
clientList: [
{ required: true, message: '请选择客户端列表', trigger: 'change'}
]
},
rulesIbp: {
@ -215,6 +270,9 @@ export default {
],
client: [
{ required: true, message: '请选择关联客户端', trigger: 'change'}
],
clientList: [
{ required: true, message: '请选择客户端列表', trigger: 'change'}
]
},
rulesLw: {
@ -226,6 +284,9 @@ export default {
],
client: [
{ required: true, message: '请选择关联客户端', trigger: 'change'}
],
clientList: [
{ required: true, message: '请选择客户端列表', trigger: 'change'}
]
},
rulesIscs: {
@ -237,6 +298,9 @@ export default {
],
client: [
{ required: true, message: '请选择关联客户端', trigger: 'change'}
],
clientList: [
{ required: true, message: '请选择客户端列表', trigger: 'change'}
]
},
partList: [{label: '左', value: 'LEFT'}, {label: '右', value: 'RIGHT'}, {label: '全部', value: 'WHOLE'}],
@ -252,19 +316,19 @@ export default {
initData(row) {
getDeviceDetail(row.id).then(resp => {
if (resp.data.config && resp.data.type === 'VR_IBP') {
this.formIbp = {part: '', deviceCode: '', roleCode:'', client:''};
this.formIbp = {part: '', deviceCode: '', roleCode:'', client:'', clientList: []};
const form = JSON.parse(resp.data.config);
this.formIbp = Object.assign(this.formIbp, form);
} else if (resp.data.config && resp.data.type === 'LW') {
this.formLw = {stationCode: '', roleCode:'', client:''};
this.formLw = {stationCode: '', roleCode:'', client:'', clientList: []};
const form = JSON.parse(resp.data.config);
this.formLw = Object.assign(this.formLw, form);
} else if (resp.data.config && ['IM', 'CW', 'DRIVE', 'DEPOT'].includes(resp.data.type)) {
this.formIm = { roleCode:'', client:''};
this.formIm = { roleCode:'', client:'', clientList: []};
const form = JSON.parse(resp.data.config);
this.formIm = Object.assign(this.formIm, form);
} else if (resp.data.config && (resp.data.type === 'ISCS_LW' || resp.data.type === 'ISCS_CW')) {
this.formIscs = {deviceCode: '', picture: '', stationCode: '', roleCode:'', client:''};
this.formIscs = {deviceCode: '', picture: '', stationCode: '', roleCode:'', client:'', clientList: []};
const form = JSON.parse(resp.data.config);
this.formIscs = Object.assign(this.formIscs, form);
}
@ -377,10 +441,10 @@ export default {
this.dialogVisible = false;
this.data = {};
this.lwList = [];
this.formIbp = {part: '', deviceCode: '', roleCode:'', client:''};
this.formLw = {stationCode: '', roleCode:'', client:''};
this.formIm = { roleCode:'', client:''};
this.formIscs = {deviceCode: '', picture: '', stationCode: '', roleCode:'', client:''};
this.formIbp = {part: '', deviceCode: '', roleCode:'', client:'', clientList: []};
this.formLw = {stationCode: '', roleCode:'', client:'', clientList: []};
this.formIm = { roleCode:'', client:'', clientList: []};
this.formIscs = {deviceCode: '', picture: '', stationCode: '', roleCode:'', client:'', clientList: []};
this.$refs.formIbp.resetFields();
this.$refs.formLw.resetFields();
this.$refs.formIscs.resetFields();

View File

@ -41,7 +41,8 @@ export default {
stationCode: '',
standCode: '',
roleCode:'',
client:''
client:'',
clientList: []
},
rules: {
addr: [
@ -64,6 +65,9 @@ export default {
],
client: [
{ required: true, message: '请选择关联客户端', trigger: 'change'}
],
clientList: [
{ required: true, message: '请选择客户端列表', trigger: 'change'}
]
},
stationList: [],
@ -96,7 +100,8 @@ export default {
{ prop: 'standCode', label: '关联站台:', type: 'select', options: this.standList, optionLabel: 'name', optionValue: 'code', deviceChange: this.standCodeChange},
{ prop: 'psdCode', label: '关联屏蔽门:', type: 'select', options: this.psdList, optionLabel: 'code', optionValue: 'code' },
{ prop: 'roleCode', label: '关联角色:', type: 'select', options: this.roleList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'name', optionValue: 'id' }
{ prop: 'client', label: '初始客户端:', type: 'select', options: this.clientList, optionLabel: 'name', optionValue: 'id' },
{ prop: 'clientList', label: '客户端列表:', type: 'select', options: this.clientList, optionLabel: 'name', optionValue: 'id' }
]
};
} else if (this.data.type === 'LSW') {
@ -106,7 +111,8 @@ export default {
{ prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' },
{ prop: 'quadrant', label: '屏幕配置:', type: 'select', options: this.screenList, optionLabel: 'label', optionValue: 'value'},
{ prop: 'roleCode', label: '关联角色:', type: 'select', options: this.roleList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' }
{ prop: 'client', label: '初始客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'clientList', label: '客户端列表:', type: 'select', options: this.clientList, optionLabel: 'name', optionValue: 'id' }
]
};
} else if (this.data.type === 'CCTV') {
@ -115,7 +121,8 @@ export default {
items: [
{ prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' },
{ prop: 'roleCode', label: '关联角色:', type: 'select', options: this.roleList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' }
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'clientList', label: '客户端列表:', type: 'select', options: this.clientList, optionLabel: 'name', optionValue: 'id' }
]
};
} else if ( this.data.type === 'SANDBOX') {
@ -124,7 +131,8 @@ export default {
items: [
{ prop: 'deviceCode', label: '教研机', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code'},
{ prop: 'roleCode', label: '关联角色:', type: 'select', options: this.roleList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' }
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'clientList', label: '客户端列表:', type: 'select', options: this.clientList, optionLabel: 'name', optionValue: 'id' }
]
};
} else if (this.data.type === 'ILW') {
@ -133,7 +141,8 @@ export default {
items: [
{ prop: 'deviceCode', label: '教研机', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code'},
{ prop: 'roleCode', label: '关联角色:', type: 'select', options: this.roleList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' }
{ prop: 'client', label: '关联客户端:', type: 'select', options: this.clientList, optionLabel: 'label', optionValue: 'value' },
{ prop: 'clientList', label: '客户端列表:', type: 'select', options: this.clientList, optionLabel: 'name', optionValue: 'id' }
]
};
}
@ -160,6 +169,7 @@ export default {
psdCode: data.psdCode,
roleCode:data.roleCode || '',
client:data.client || '',
clientList: data.clientList || [],
addr: data.addr,
quantity: data.quantity
};
@ -211,30 +221,6 @@ export default {
this.$message.error('获取客户端列表失败');
});
}).catch(() => { this.$message.error('获取线路功能数据失败!'); });
// const self = this;
// querySimulationMemberByMapId(mapId).then(resp => {
// if (resp.data) {
// getMapFunctioById(functionId).then(response=>{
// if (resp.data) {
// const roleList = resp.data[response.data.simType];
// const clientListMapIn = ConstConfig.ConstSelect.clientMap;
// this.clientListMap = clientListMapIn[response.data.simType];
// const covertRoleList = [];
// roleList.forEach(member => {
// const data = self.handleMember(member, self.stationList);
// covertRoleList.push(data);
// });
// this.clientList = [];
// self.roleList = covertRoleList;
// const roleCode = this.formData.roleCode;
// const role = this.roleList.find(each=>{ return each.value == roleCode; });
// if (role) { this.clientList = this.clientListMap[role.memberType] || []; }
// }
// });
// }
// }).catch(() => {
// this.$message.error('');
// });
}).catch(() => {
this.$message.error('获取车站列表失败');
});
@ -343,7 +329,8 @@ export default {
quadrant: this.formData.quadrant,
roleCode: this.formData.roleCode,
mapId:this.formData.mapId,
client: this.formData.client
client: this.formData.client,
clientList: this.formData.clientList
};
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
setDeviceConfig(data).then(() => {
@ -360,7 +347,8 @@ export default {
deviceCode: this.formData.deviceCode,
roleCode: this.formData.roleCode,
mapId:this.formData.mapId,
client: this.formData.client
client: this.formData.client,
clientList: this.formData.clientList
};
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
setDeviceConfig(data).then(() => {
@ -378,7 +366,8 @@ export default {
psdCode: this.formData.psdCode,
mapId:this.formData.mapId,
roleCode: this.formData.roleCode,
client: this.formData.client
client: this.formData.client,
clientList: this.formData.clientList
};
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
setDeviceConfig(data).then(() => {
@ -410,7 +399,8 @@ export default {
deviceCode: this.formData.deviceCode,
roleCode: this.formData.roleCode,
mapId:this.formData.mapId,
client: this.formData.client
client: this.formData.client,
clientList: this.formData.clientList
};
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
setDeviceConfig(data).then(() => {
@ -426,7 +416,8 @@ export default {
const param = {
deviceCode: this.formData.deviceCode,
roleCode: this.formData.roleCode,
client: this.formData.client
client: this.formData.client,
clientList: this.formData.clientList
};
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
setDeviceConfig(data).then(() => {