代码调整

This commit is contained in:
joylink_cuiweidong 2022-12-02 14:00:27 +08:00
parent 692b8b97c6
commit d6e672270c
3 changed files with 249 additions and 16 deletions

View File

@ -58,6 +58,9 @@ import bgIscsImg from '@/assets/bg_iscs.jpg';
import bgCctvImg from '@/assets/bg_cctv.jpg'; import bgCctvImg from '@/assets/bg_cctv.jpg';
import bgLswImg from '@/assets/bg_lsw.jpg'; import bgLswImg from '@/assets/bg_lsw.jpg';
import bgPsdImg from '@/assets/bg_psd.png'; import bgPsdImg from '@/assets/bg_psd.png';
import { getLoginWmurl, checkLoginStatus, getOrgList, selectOrgnization } from '@/api/login';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { getGroupByMapAndFunction, getSimulationInfoNew } from '@/api/simulation';
export default { export default {
name:'LoginNew', name:'LoginNew',
// components: { Register }, // components: { Register },
@ -79,7 +82,9 @@ export default {
loginProLogo:'', loginProLogo:'',
aboutSystem:'', aboutSystem:'',
loadingText:'', loadingText:'',
deviceImg:'' deviceImg:'',
checkLogin: null,
sessionId:''
}; };
}, },
computed: { computed: {
@ -125,7 +130,6 @@ export default {
this.$store.dispatch('setLoginProLogo', this.loginProLogo); this.$store.dispatch('setLoginProLogo', this.loginProLogo);
this.$store.dispatch('setHomeTitle', homeTitle); this.$store.dispatch('setHomeTitle', homeTitle);
this.$store.dispatch('setCaseShow', caseShow); this.$store.dispatch('setCaseShow', caseShow);
// this.$store.dispatch('setCaseShow', caseShow);
this.loadedConfig = true; this.loadedConfig = true;
// helpShow // helpShow
// loginContectInformation false // loginContectInformation false
@ -167,6 +171,117 @@ export default {
}; };
this.loadingText = deviceMap[this.type].text; this.loadingText = deviceMap[this.type].text;
this.deviceImg = deviceMap[this.type].Img; this.deviceImg = deviceMap[this.type].Img;
this.loginRefresh();
},
loginRefresh() {
const self = this;
const params = { clientId: '1', secret: 'joylink' };
params.project = this.project;
if (this.$route.query.projectDevice) {
params.deviceCode = this.$route.query.projectDevice;
}
getLoginWmurl(params)
.then(response => {
this.sessionId = response.data.sessionId;
this.checkLoginStatus();
})
.catch(() => {
if (this.syncLogin) {
setTimeout(() => {
self.loginRefresh();
}, 3000);
} else {
this.$messageBox(this.$t('login.getLoginQrCode'));
}
});
},
clearTimer(timer) {
if (timer) {
clearTimeout(timer);
timer = null;
}
},
checkLoginStatus() {
const self = this;
//
if (this && this._isDestroyed) {
return;
}
//
//
this.clearTimer(this.checkLogin);
this.checkLogin = setTimeout(() => {
checkLoginStatus(self.sessionId)
.then(response => {
//
self.$store
.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token, type: 'class' })
.then(() => {
//
self.clearTimer(self.checkLogin);
this.checkOrgnizationInfo();
});
}).catch(error => {
if ((error.data && error.data.status === 'EXPIRE') || error.code != 200) {
self.loginRefresh();
} else {
self.checkLoginStatus();
}
});
}, 3000);
},
//
checkOrgnizationInfo() {
this.handleLoginSucessRoute();
// getOrgList().then(resp => {
// const orgList = resp.data;
// let orgId = '';
// if (orgList.length < 2) {
// if (orgList.length === 1) {
// orgId = orgList[0].orgId;
// selectOrgnization(orgId);
// }
// this.handleLoginSucessRoute();
// } else {
// this.showOrgList(orgList);
// }
// }).catch((error)=>{
// this.$message.error(error.message);
// });
},
//
handleLoginSucessRoute() {
getBackProjectConfigByCode(this.project).then(res=>{
if (res.data) {
const {mapId, functionId} = res.data;
if (functionId && mapId) {
getGroupByMapAndFunction(mapId, functionId).then(resp => {
const group = resp.data;
this.enterSimulation(group, mapId);
});
} else {
this.$message.error('请先配置项目信息');
}
}
});
},
enterSimulation(group, mapId) {
getSimulationInfoNew(group).then(response=>{
const paramVO = response.data.paramVO;
const query = {
lineCode: response.data.map.lineCode,
group: group,
mapId: mapId,
projectDevice:this.$route.query.projectDevice,
simType:paramVO.type,
project: this.project,
singleClient:true,
client:this.$route.query.client
};
this.$router.push({ path: `/display/demon`, query: query });
});
} }
} }
}; };
@ -231,6 +346,7 @@ export default {
} }
.loadingText{ .loadingText{
font-size: 36px; font-size: 36px;
color: #fff;
} }
</style> </style>

View File

@ -23,6 +23,16 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-form v-show="['IM','CW'].includes(data.type)" ref="formIm" :model="formIm" label-width="100px" :rules="rulesIm"> <el-form v-show="['IM','CW'].includes(data.type)" ref="formIm" :model="formIm" label-width="100px" :rules="rulesIm">
<el-form-item label="关联地图:" prop="mapId">
<el-select v-model="formIm.mapId" placeholder="请选择" size="small" @change="mapIdChange">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="关联角色:" prop="roleCode"> <el-form-item label="关联角色:" prop="roleCode">
<el-select v-model="formIm.roleCode" placeholder="请选择" size="small"> <el-select v-model="formIm.roleCode" placeholder="请选择" size="small">
<el-option <el-option
@ -141,6 +151,7 @@ export default {
roleList:[], roleList:[],
lwList: [], lwList: [],
formIm:{ formIm:{
mapId:'',
roleCode:'', roleCode:'',
client:'' client:''
}, },

View File

@ -10,8 +10,11 @@
<script> <script>
import { getDevicesByType, getDeviceDetail, setDeviceConfig } from '@/api/project'; import { getDevicesByType, getDeviceDetail, setDeviceConfig } from '@/api/project';
import { getAllMapOnline, getStationListNeedAttendant, getPsdListByStandCode, getStandListByStationCode } from '@/api/jmap/map'; // getStationListNeedAttendant
import { getAllMapOnline, querySimulationStationsByMapId, getPsdListByStandCode, getStandListByStationCode, querySimulationMemberByMapId} from '@/api/jmap/map';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { getMapFunctioById } from '@/api/trainingPlatform';
export default { export default {
name: 'EditConfigScreen', name: 'EditConfigScreen',
data() { data() {
@ -104,6 +107,7 @@ export default {
labelWidth: '150px', labelWidth: '150px',
items: [ items: [
{ prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' }, { prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' },
{ prop: 'mapId', label: '关联地图:', type: 'select', options: this.mapList, optionLabel: 'name', optionValue: 'id', deviceChange: this.mapIdChange},
{ prop: 'quadrant', label: '屏幕配置:', type: 'select', options: this.screenList, optionLabel: 'label', optionValue: 'value'}, { 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: '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' }
@ -114,6 +118,7 @@ export default {
labelWidth: '150px', labelWidth: '150px',
items: [ items: [
{ prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' }, { prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' },
{ prop: 'mapId', label: '关联地图:', type: 'select', options: this.mapList, optionLabel: 'name', optionValue: 'id', deviceChange: this.mapIdChange},
{ prop: 'roleCode', label: '关联角色:', type: 'select', options: this.roleList, 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' }
] ]
@ -123,6 +128,7 @@ export default {
labelWidth: '150px', labelWidth: '150px',
items: [ items: [
{ prop: 'deviceCode', label: '教研机', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code'}, { prop: 'deviceCode', label: '教研机', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code'},
{ prop: 'mapId', label: '关联地图:', type: 'select', options: this.mapList, optionLabel: 'name', optionValue: 'id', deviceChange: this.mapIdChange},
{ prop: 'roleCode', label: '关联角色:', type: 'select', options: this.roleList, 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' }
] ]
@ -156,34 +162,130 @@ export default {
quadrant: data.quadrant, quadrant: data.quadrant,
deviceCode: data.deviceCode, deviceCode: data.deviceCode,
psdCode: data.psdCode, psdCode: data.psdCode,
mapId:data.mapId,
roleCode:data.roleCode,
client:data.client,
addr: data.addr, addr: data.addr,
quantity: data.quantity quantity: data.quantity
}; };
}); if (['VR_PSD', 'LSW', 'CCTV'].includes(row.type)) {
if (row.type === 'VR_PSD') {
getAllMapOnline().then(resp => { getAllMapOnline().then(resp => {
if (resp.data && resp.data.length) { if (resp.data && resp.data.length) {
this.mapList = resp.data; this.mapList = resp.data;
this.formData.mapId = this.mapList[0].id; if (this.formData.mapId) { this.mapIdChange(this.formData.mapId); }
this.mapIdChange(this.mapList[0].id);
} }
}).catch(() => { }).catch(() => {
this.$message.error('获取地图列表失败'); this.$message.error('获取地图列表失败');
}); });
} }
});
}, },
mapIdChange(mapId) { mapIdChange(mapId) {
this.stationList = []; this.stationList = [];
if (mapId) { if (mapId) {
getStationListNeedAttendant(mapId).then(resp => { querySimulationStationsByMapId(mapId).then(resp => {
if (resp.data && resp.data.length) { if (resp.data && resp.data.length) {
this.stationList = resp.data; this.stationList = resp.data;
} }
const self = this;
querySimulationMemberByMapId(mapId).then(resp => {
if (resp.data) {
getBackProjectConfigByCode(self.data.project).then(res=>{
if (res.data) {
const functionId = res.data.functionId;
if (functionId) {
getMapFunctioById(functionId).then(response=>{
if (resp.data) {
const roleList = resp.data[response.data.simType];
const covertRoleList = [];
roleList.forEach(member => {
const data = self.handleMember(member, self.stationList);
covertRoleList.push(data);
});
self.roleList = covertRoleList;
}
});
} else {
self.$message.error('请先配置项目信息');
}
}
});
}
}).catch(() => {
this.$message.error('获取角色列表失败');
});
}).catch(() => { }).catch(() => {
this.$message.error('获取车站列表失败'); this.$message.error('获取车站列表失败');
}); });
} }
}, },
handleMember(member, stationList) {
const data = { value: member.id, label: '', memberType: member.type };
const device = stationList.find(station => station.code === member.deviceCode) || {};
switch (member.type) {
case 'DISPATCHER':
data.label = '行调' + (member.name ? `-${member.name }` : '');
break;
case 'STATION_SUPERVISOR':
data.label = '行值-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'DRIVER':
data.label = '司机-' + member.deviceCode;
break;
case 'MAINTAINER':
data.label = '通号' + (member.name ? `-${member.name }` : '');
break;
case 'DEPOT_DISPATCHER':
data.label = '调度-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'SIGNAL_BUILDING':
data.label = '信号楼-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'STATION_ASSISTANT':
data.label = '助理-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'STATION_MASTER':
data.label = '站长-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'STATION_SIGNALER':
data.label = '信号员-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'STATION_PASSENGER':
data.label = '客运员-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'STATION_SWITCH_MAN':
data.label = '扳道员-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'STATION_FACILITATOR':
data.label = '引导员-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'STATION_WORKER':
data.label = '工务工-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'DEVICE_MANAGER':
data.label = '设备管理员-' + device.name + (member.name ? `-${member.name }` : '');
break;
case 'TRAIN_MASTER':
data.label = '车务段段长' + (member.name ? `-${member.name }` : '');
break;
case 'ELECTRIC_DISPATCHER':
data.label = '工电调度' + (member.name ? `-${member.name }` : '');
break;
case 'PARENT_DEPARTMENT':
data.label = '上级部分' + (member.name ? `-${member.name }` : '');
break;
case 'SCHEDULING':
data.label = '派班员' + (member.name ? `-${member.name }` : '');
break;
case 'SHIFT_MANAGER':
data.label = '值班主任' + (member.name ? `-${member.name }` : '');
break;
case 'ENVIRONMENT_DISPATCHER':
data.label = '环控调度' + (member.name ? `-${member.name}` : '');
break;
}
return data;
},
stationCodeChange(stationCode) { stationCodeChange(stationCode) {
this.standList = []; this.standList = [];
if (stationCode) { if (stationCode) {
@ -216,6 +318,7 @@ export default {
deviceCode: this.formData.deviceCode, deviceCode: this.formData.deviceCode,
quadrant: this.formData.quadrant, quadrant: this.formData.quadrant,
roleCode: this.formData.roleCode, roleCode: this.formData.roleCode,
mapId:this.formData.mapId,
client: this.formData.client client: this.formData.client
}; };
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) }; const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
@ -232,6 +335,7 @@ export default {
const param = { const param = {
deviceCode: this.formData.deviceCode, deviceCode: this.formData.deviceCode,
roleCode: this.formData.roleCode, roleCode: this.formData.roleCode,
mapId:this.formData.mapId,
client: this.formData.client client: this.formData.client
}; };
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) }; const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
@ -248,6 +352,7 @@ export default {
const param = { const param = {
deviceCode: this.formData.deviceCode, deviceCode: this.formData.deviceCode,
psdCode: this.formData.psdCode, psdCode: this.formData.psdCode,
mapId:this.formData.mapId,
roleCode: this.formData.roleCode, roleCode: this.formData.roleCode,
client: this.formData.client client: this.formData.client
}; };
@ -280,6 +385,7 @@ export default {
const param = { const param = {
deviceCode: this.formData.deviceCode, deviceCode: this.formData.deviceCode,
roleCode: this.formData.roleCode, roleCode: this.formData.roleCode,
mapId:this.formData.mapId,
client: this.formData.client client: this.formData.client
}; };
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) }; const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(param) };
@ -314,7 +420,7 @@ export default {
this.stationList = []; this.stationList = [];
this.standList = []; this.standList = [];
this.psdList = []; this.psdList = [];
this.mapId = ''; // this.mapId = '';
this.roleList = []; this.roleList = [];
this.stationCode = ''; this.stationCode = '';
this.standCode = ''; this.standCode = '';