代码调整

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 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 { getLoginWmurl, checkLoginStatus, getLoginInfo, selectOrgnization } from '@/api/login';
import { getToken} from '@/utils/auth';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
import { getBackProjectConfigByCode } from '@/api/projectConfig'; import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { getGroupByMapAndFunction, getSimulationInfoNew } from '@/api/simulation'; import { getGroupByMapAndFunction, getSimulationInfoNew } from '@/api/simulation';
export default { export default {
@ -259,7 +261,19 @@ export default {
if (functionId && mapId) { if (functionId && mapId) {
getGroupByMapAndFunction(mapId, functionId).then(resp => { getGroupByMapAndFunction(mapId, functionId).then(resp => {
const group = resp.data; 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 { } else {
this.$message.error('请先配置项目信息'); this.$message.error('请先配置项目信息');
@ -267,7 +281,7 @@ export default {
} }
}); });
}, },
enterSimulation(group, mapId) { enterSimulation(group, mapId, config) {
getSimulationInfoNew(group).then(response=>{ getSimulationInfoNew(group).then(response=>{
const paramVO = response.data.paramVO; const paramVO = response.data.paramVO;
const query = { const query = {
@ -277,9 +291,12 @@ export default {
projectDevice:this.$route.query.projectDevice, projectDevice:this.$route.query.projectDevice,
simType:paramVO.type, simType:paramVO.type,
project: this.project, project: this.project,
singleClient:true, singleClient:true
client:this.$route.query.client
}; };
if (config) {
if (config.client) { query.client = config.client; }
// if (config.client) { query.client = config.client; }
}
this.$router.push({ path: `/display/demon`, query: query }); 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 md5 from 'js-md5';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
// getLoginWmurl, checkLoginStatus, // getLoginWmurl, checkLoginStatus,
import { getOrgList, selectOrgnization } from '@/api/login'; import { getOrgList, selectOrgnization, getLoginInfo } from '@/api/login';
import { createSimulation, getSimulationInfoNew, getGroupByMapAndFunction } from '@/api/simulation'; import { createSimulation, getSimulationInfoNew, getGroupByMapAndFunction } from '@/api/simulation';
import { getBackProjectConfigByCode } from '@/api/projectConfig'; import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { assignUsersPlayRoles } from '@/api/jointSimulation'; import { assignUsersPlayRoles } from '@/api/jointSimulation';
@ -143,9 +143,6 @@ export default {
}, },
projectDevice() { projectDevice() {
return this.$route.query.projectDevice; return this.$route.query.projectDevice;
},
role() {
return this.$route.query.roleCode;
} }
}, },
watch: { watch: {
@ -269,19 +266,25 @@ export default {
}); });
}, },
assignUser(group, mapId) { assignUser(group, mapId) {
if (this.role) { this.$store.dispatch('GetUserInfo', getToken()).then(res => {
this.$store.dispatch('changeRole'); getLoginInfo(getToken()).then(resp => {
this.$store.dispatch('GetUserInfo', getToken()).then(res => { const deviceVO = resp.data.deviceVO;
const data = [{userId: res.id, memberId:this.role}]; if (deviceVO) {
assignUsersPlayRoles(data, group).then(() => { 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); this.enterSimulation(group, mapId);
}); }
}); });
} else { });
this.enterSimulation(group, mapId);
}
}, },
enterSimulation(group, mapId) { enterSimulation(group, mapId, config) {
getSimulationInfoNew(group).then(response=>{ getSimulationInfoNew(group).then(response=>{
const paramVO = response.data.paramVO; const paramVO = response.data.paramVO;
const query = { const query = {
@ -290,9 +293,13 @@ export default {
mapId: mapId, mapId: mapId,
simType:paramVO.type, simType:paramVO.type,
project: this.project, project: this.project,
singleClient:true, projectDevice:this.$route.query.projectDevice,
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 }); this.$router.push({ path: `/display/demon`, query: query });
}); });
}, },

View File

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