代码调整

This commit is contained in:
joylink_cuiweidong 2022-11-28 15:57:36 +08:00
parent 98e1a75705
commit 6a1bf40183

View File

@ -83,6 +83,8 @@ 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 } from '@/api/simulation';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
export default { export default {
name:'NormalLogin', name:'NormalLogin',
props: { props: {
@ -140,6 +142,9 @@ export default {
}, },
projectDevice() { projectDevice() {
return this.$route.query.projectDevice; return this.$route.query.projectDevice;
},
role() {
return this.$route.query.role;
} }
}, },
watch: { watch: {
@ -175,6 +180,7 @@ 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');
@ -233,44 +239,51 @@ export default {
} }
}, },
judgeOtherPage(params) { judgeOtherPage(params) {
// containDevice:false, //
// deviceRelatedMap:'', //
// deviceRelatedFunction:'' //
// itemMap: {DEFAULT_MEMBER: '1'}type: "METRO" // itemMap: {DEFAULT_MEMBER: '1'}type: "METRO"
const {containDevice, deviceRelatedMap, deviceRelatedFunction} = this.$store.state.projectConfig.deviceRelated; getBackProjectConfigByCode(this.project).then(res=>{
if (containDevice && deviceRelatedMap && deviceRelatedFunction) { if (res.data) {
createSimulation(deviceRelatedFunction).then(res => { const {mapId, functionId} = res.data;
getSimulationInfoNew(res.data).then(resp => { if (functionId && mapId) {
const paramVO = resp.data.paramVO; createSimulation(functionId).then(resp => {
const query = { const group = resp.data;
lineCode: resp.data.map.lineCode, if (this.role) {
group: res.data, assignUsersPlayRoles(this.role, group).then(() => {
mapId: resp.data.map.id, this.enterSimulation(group, mapId);
project: this.project, });
projectDevice:params.projectDevice, } else {
type:params.type this.enterSimulation(group, mapId);
}; }
if (paramVO && paramVO.domConfig && paramVO.domConfig.client) { }).catch(error=>{
query.client = paramVO.domConfig.client; if (error.code == 10003) {
} this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
if (paramVO && paramVO.domConfig && paramVO.domConfig.singleClient) { } else {
query.singleClient = paramVO.domConfig.singleClient; this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
} }
// if (this.loadingProjectList.includes(this.project)) { });
// this.$store.dispatch('app/transitionAnimations');
// }
this.$router.push({ path: `/display/demon`, query: query });
});
}).catch(error=>{
if (error.code == 10003) {
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
} else { } else {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message); this.$message.error('请先配置项目信息');
} }
}); }
} else { });
this.$message.error('请先配置项目设备登录信息'); },
} enterSimulation(group, mapId) {
getSimulationInfoNew(group).then(response=>{
debugger;
const paramVO = response.data.paramVO;
const query = {
lineCode: response.data.map.lineCode,
group: group,
mapId: mapId,
project: this.project
};
if (paramVO && paramVO.domConfig && paramVO.domConfig.client) {
query.client = paramVO.domConfig.client;
}
if (paramVO && paramVO.domConfig && paramVO.domConfig.singleClient) {
query.singleClient = paramVO.domConfig.singleClient;
}
this.$router.push({ path: `/display/demon`, query: query });
});
}, },
// //
handleLogin() { handleLogin() {