代码调整

This commit is contained in:
joylink_cuiweidong 2022-12-02 17:06:31 +08:00
parent fe5ce61325
commit 31f5db5592
3 changed files with 45 additions and 35 deletions

View File

@ -58,7 +58,9 @@ import bgIscsImg from '@/assets/bg_iscs.jpg';
import bgCctvImg from '@/assets/bg_cctv.jpg';
import bgLswImg from '@/assets/bg_lsw.jpg';
import bgPsdImg from '@/assets/bg_psd.png';
import { getLoginWmurl, checkLoginStatus, getOrgList, selectOrgnization } from '@/api/login';
import { getLoginWmurl, checkLoginStatus, getLoginInfo, selectOrgnization } from '@/api/login';
import { getToken} from '@/utils/auth';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { getGroupByMapAndFunction, getSimulationInfoNew } from '@/api/simulation';
export default {
@ -259,7 +261,19 @@ export default {
if (functionId && mapId) {
getGroupByMapAndFunction(mapId, functionId).then(resp => {
const group = resp.data;
this.enterSimulation(group, mapId);
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);
});
}
}
});
});
} else {
this.$message.error('请先配置项目信息');
@ -267,7 +281,7 @@ export default {
}
});
},
enterSimulation(group, mapId) {
enterSimulation(group, mapId, config) {
getSimulationInfoNew(group).then(response=>{
const paramVO = response.data.paramVO;
const query = {
@ -277,9 +291,12 @@ export default {
projectDevice:this.$route.query.projectDevice,
simType:paramVO.type,
project: this.project,
singleClient:true,
client:this.$route.query.client
singleClient:true
};
if (config) {
if (config.client) { query.client = config.client; }
// if (config.client) { query.client = config.client; }
}
this.$router.push({ path: `/display/demon`, query: query });
});
}

View File

@ -81,7 +81,7 @@ import QCode from '@/assets/erCode.jpg';
import md5 from 'js-md5';
import Cookies from 'js-cookie';
// getLoginWmurl, checkLoginStatus,
import { getOrgList, selectOrgnization } from '@/api/login';
import { getOrgList, selectOrgnization, getLoginInfo } from '@/api/login';
import { createSimulation, getSimulationInfoNew, getGroupByMapAndFunction } from '@/api/simulation';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
@ -143,9 +143,6 @@ export default {
},
projectDevice() {
return this.$route.query.projectDevice;
},
role() {
return this.$route.query.roleCode;
}
},
watch: {
@ -269,19 +266,25 @@ export default {
});
},
assignUser(group, mapId) {
if (this.role) {
this.$store.dispatch('changeRole');
this.$store.dispatch('GetUserInfo', getToken()).then(res => {
const data = [{userId: res.id, memberId:this.role}];
assignUsersPlayRoles(data, group).then(() => {
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);
});
}
} else {
this.enterSimulation(group, mapId);
});
}
});
} else {
this.enterSimulation(group, mapId);
}
});
},
enterSimulation(group, mapId) {
enterSimulation(group, mapId, config) {
getSimulationInfoNew(group).then(response=>{
const paramVO = response.data.paramVO;
const query = {
@ -290,9 +293,13 @@ export default {
mapId: mapId,
simType:paramVO.type,
project: this.project,
singleClient:true,
client:this.$route.query.client
projectDevice:this.$route.query.projectDevice,
singleClient:true
};
if (config) {
if (config.client) { query.client = config.client; }
// if (config.client) { query.client = config.client; }
}
this.$router.push({ path: `/display/demon`, query: query });
});
},

View File

@ -197,22 +197,8 @@ export default {
getPath(index, row) {
getDeviceDetail(row.id).then(res=>{
if (res.data) {
let roleCode = '';
if (res.data.type == 'LW') {
const config = JSON.parse(res.data.config);
roleCode = config.roleCode;
}
let client = '';
if (res.data.config) {
const config = JSON.parse(res.data.config);
client = config.client;
}
let url = '';
url = `${window.location.protocol}//${window.location.host}/cbtc/login?project=${row.project.toLowerCase().replace(/_/, '')}&projectDevice=${row.code}&type=${row.type}`;
if (roleCode) {
url += '&roleCode=' + roleCode;
}
if (client) { url += '&client=' + client; }
this.url = url;
this.$messageBox();
this.$confirm(`登录路径:${url}`, '登录路径', {