Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly1

This commit is contained in:
fan 2022-11-29 10:36:36 +08:00
commit b71e2d959b
3 changed files with 66 additions and 32 deletions

View File

@ -544,3 +544,11 @@ export function createSimulation(id) {
method: 'post' method: 'post'
}); });
} }
/** 根据地图ID和功能ID获取仿真GroupId */
export function getGroupByMapAndFunction(mapId, functionId) {
return request({
url: `/simulation/new/map/${mapId}/function/${functionId}`,
method: 'get'
});
}

View File

@ -82,7 +82,7 @@ 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 } from '@/api/login';
import { createSimulation, getSimulationInfoNew } 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';
export default { export default {
@ -144,7 +144,7 @@ export default {
return this.$route.query.projectDevice; return this.$route.query.projectDevice;
}, },
role() { role() {
return this.$route.query.role; return this.$route.query.roleCode;
} }
}, },
watch: { watch: {
@ -180,7 +180,6 @@ export default {
this.checkOrgnizationInfo(); this.checkOrgnizationInfo();
}) })
.catch(error => { .catch(error => {
debugger;
console.log(error); console.log(error);
// if (error.code === '30001') { // if (error.code === '30001') {
// this.tipsMsg = this.$t('login.accountOrPasswordIsIncorrect'); // this.tipsMsg = this.$t('login.accountOrPasswordIsIncorrect');
@ -244,10 +243,12 @@ export default {
if (res.data) { if (res.data) {
const {mapId, functionId} = res.data; const {mapId, functionId} = res.data;
if (functionId && mapId) { if (functionId && mapId) {
if (params.type == 'IM') {
createSimulation(functionId).then(resp => { createSimulation(functionId).then(resp => {
const group = resp.data; const group = resp.data;
if (this.role) { if (this.role) {
assignUsersPlayRoles(this.role, group).then(() => { const data = [{userId: this.$store.state.user.id, memberId:this.role}];
assignUsersPlayRoles(data, group).then(() => {
this.enterSimulation(group, mapId); this.enterSimulation(group, mapId);
}); });
} else { } else {
@ -260,6 +261,19 @@ export default {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message); this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
} }
}); });
} else {
getGroupByMapAndFunction(mapId, functionId).then(resp => {
const group = resp.data;
if (this.role) {
const data = [{userId: this.$store.state.user.id, memberId:this.role}];
assignUsersPlayRoles(data, group).then(() => {
this.enterSimulation(group, mapId);
});
} else {
this.enterSimulation(group, mapId);
}
});
}
} else { } else {
this.$message.error('请先配置项目信息'); this.$message.error('请先配置项目信息');
} }

View File

@ -11,7 +11,7 @@
</template> </template>
<script> <script>
import { getProjectDeviceList, deleteProjectDevice } from '@/api/project'; import { getProjectDeviceList, deleteProjectDevice, getDeviceDetail } from '@/api/project';
import DeviceAdd from './add'; import DeviceAdd from './add';
import EditConfigGateway from './editConfigGateway'; import EditConfigGateway from './editConfigGateway';
import EditConfig from './editConfig'; import EditConfig from './editConfig';
@ -203,8 +203,18 @@ export default {
this.queryList.reload(); this.queryList.reload();
}, },
getPath(index, row) { 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 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;
}
this.url = url; this.url = url;
this.$messageBox(); this.$messageBox();
this.$confirm(`登录路径:${url}`, '登录路径', { this.$confirm(`登录路径:${url}`, '登录路径', {
@ -218,6 +228,8 @@ export default {
this.$message.success('登录路径已经复制到粘贴板'); this.$message.success('登录路径已经复制到粘贴板');
}); });
} }
});
}
} }
}; };
</script> </script>