This commit is contained in:
sunzhenyu 2021-12-02 10:00:49 +08:00
commit 8923a888c8
12 changed files with 383 additions and 10 deletions

View File

@ -3,6 +3,16 @@
<router-view /> <router-view />
<deomon-topic ref="deomonTopic" /> <deomon-topic ref="deomonTopic" />
<img v-show="loading" :src="loadingImg" class="AppAll"> <img v-show="loading" :src="loadingImg" class="AppAll">
<div
v-if="!$store.state.user.baseUrl"
v-loading="!$store.state.user.baseUrl"
element-loading-text="拼命加载中"
element-loading-background="rgba(0, 0, 0, 0)"
element-loading-spinner="el-icon-loading"
style="width: 100%;height: 100%;"
>
<img :src="appLoading" class="centerImg">
</div>
</div> </div>
</template> </template>
@ -13,6 +23,7 @@ import { loginInfo, ProjectIcon } from '@/scripts/ProjectConfig';
import DeomonTopic from '@/views/demonstration/deomonTopic'; import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import LoadingImg from '@/assets/loading.gif'; import LoadingImg from '@/assets/loading.gif';
import AppLoading from '@/assets/appLoading.png';
import { openIndexedDB } from '@/utils/indexedDb'; import { openIndexedDB } from '@/utils/indexedDb';
export default { export default {
@ -26,6 +37,7 @@ export default {
data() { data() {
return { return {
loadingImg: LoadingImg, loadingImg: LoadingImg,
appLoading: AppLoading,
loading: false loading: false
}; };
}, },
@ -113,4 +125,13 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.AppAll{position: absolute;top: 0;left: 0;width: 100%;height: 100%;z-index: 2003} .AppAll{position: absolute;top: 0;left: 0;width: 100%;height: 100%;z-index: 2003}
.centerImg {
position: absolute;
left:50%;
top: 50%;
width: 480px;
height: 456px;
margin-left: -240px;
margin-top: -228px;
}
</style> </style>

40
src/api/projectServer.js Normal file
View File

@ -0,0 +1,40 @@
import request from '@/utils/request';
/** 获取请求baseURL */
export function getBaseUrlByProject(project) {
return request({
url: `/api/projectServer/project/${project}`,
method: 'get'
});
}
/** 分页查询项目服务器 */
export function projectServerPaging(params) {
return request({
url: `/api/projectServer/paging`,
method: 'get',
params
});
}
/** 创建项目服务器数据 */
export function createProjectServer(data) {
return request({
url: `/api/projectServer`,
method: 'post',
data
});
}
/** 修改项目服务器数据 */
export function updateProjectServer(id, data) {
return request({
url: `/api/projectServer/${id}`,
method: 'put',
data
});
}
/** 删除项目服务器数据 */
export function deleteProjectServer(id) {
return request({
url: `/api/projectServer/${id}`,
method: 'delete'
});
}

BIN
src/assets/appLoading.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -99,5 +99,6 @@ export default {
publishISCSManage:'publish ISCS Manage', publishISCSManage:'publish ISCS Manage',
voiceTraining: 'Voice Training', voiceTraining: 'Voice Training',
mapGroup: 'Map Group', mapGroup: 'Map Group',
drawingMange:'Drawing Mange' drawingMange:'Drawing Mange',
projectServer: 'Project Server'
}; };

View File

@ -103,5 +103,6 @@ export default {
publishISCSManage:'发布ISCS管理', publishISCSManage:'发布ISCS管理',
voiceTraining: '语音训练', voiceTraining: '语音训练',
mapGroup: '地图分组', mapGroup: '地图分组',
drawingMange:'图纸管理' drawingMange:'图纸管理',
projectServer: '项目域名'
}; };

View File

@ -510,7 +510,7 @@ export default class Section extends Group {
model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit); model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit);
// 区段计轴预复位状态 (未处理) // 区段计轴预复位状态 (未处理)
// 区段延时解锁 // 区段延时解锁
model.delayUnlock && this.delayUnlock(); model.remain > 0 && this.delayUnlock();
// 设置灰显 // 设置灰显
if (model.noStatus || (model.atsNoStatus && store.state.training.prdType == '02')) { if (model.noStatus || (model.atsNoStatus && store.state.training.prdType == '02')) {
this.setAshShow(); this.setAshShow();

View File

@ -1,11 +1,13 @@
import Vue from 'vue'; import Vue from 'vue';
import store from '@/store/index'; import store from '@/store/index';
import router from './router/index'; import router from './router/index';
import {loginInfo} from '@/scripts/ProjectConfig'; import {loginInfo, ProjectCode, localPackageProject} from '@/scripts/ProjectConfig';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
import { setToken, getToken, removeToken, getSessionStorage } from '@/utils/auth'; import { setToken, getToken, removeToken, getSessionStorage } from '@/utils/auth';
import { getBaseUrlByProject } from '@/api/projectServer';
import localStore from 'storejs'; import localStore from 'storejs';
import { getBaseUrl } from '@/utils/baseUrl';
const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool', '/demo', '/thirdLogin']; // 不重定向白名单 const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool', '/demo', '/thirdLogin']; // 不重定向白名单
@ -66,8 +68,37 @@ function handleRoute(to, next, loginPath) {
} }
} }
router.beforeEach((to, from, next) => { router.beforeEach( async (to, from, next) => {
const project = getSessionStorage('project'); let project = '';
if (to.path.includes('login')) {
project = to.query.project;
const split = to.path.split('/')[1];
if (process.env.VUE_APP_PRO) {
project = localPackageProject[process.env.VUE_APP_PRO + split];
} else if (split == 'design') {
project = project ? split + project : split;
} else if (split == 'login') {
project = project || 'login';
} else {
project = split;
}
} else if (to.path.includes('thirdLogin')) {
project = to.query.project;
} else {
project = getSessionStorage('project');
}
if (!store.state.user.baseUrl && project) {
try {
const resp = await getBaseUrlByProject(ProjectCode[project]);
if (resp && resp.data && resp.data.domainName) {
store.dispatch('setBaseUrl', resp.data.domainName);
} else {
store.dispatch('setBaseUrl', getBaseUrl());
}
} catch (e) {
store.dispatch('setBaseUrl', getBaseUrl());
}
}
document.title = loginInfo[project || 'login'].browserTitle || loginInfo[project || 'login'].title; document.title = loginInfo[project || 'login'].browserTitle || loginInfo[project || 'login'].title;
NProgress.start(); NProgress.start();
const loginPath = getRouteInfo(to); const loginPath = getRouteInfo(to);

View File

@ -21,8 +21,6 @@ const Jlmap3dZzwwTest = () => import('@/views/jlmap3d/otherproject/zzww/zzwwtest
const XzExam = () => import('@/views/jlmap3d/otherproject/xzexam/xzexam'); const XzExam = () => import('@/views/jlmap3d/otherproject/xzexam/xzexam');
const LcJy = () => import('@/views/jlmap3d/otherproject/xzexam/lcjy'); const LcJy = () => import('@/views/jlmap3d/otherproject/xzexam/lcjy');
const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive'); const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation'); const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation');
const Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow'); const Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow');
@ -193,6 +191,7 @@ const UeditorDraftList = () => import('@/views/editor/listDraft');
const UploadPdfList = () => import('@/views/uploadPdf/list'); const UploadPdfList = () => import('@/views/uploadPdf/list');
const ThirdLogin = () => import('@/views/thirdLogin'); const ThirdLogin = () => import('@/views/thirdLogin');
const ProjectServer = () => import('@/views/system/serverManage');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig'; // import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth'; // import { getSessionStorage } from '@/utils/auth';
@ -1203,6 +1202,13 @@ export const asyncRouter = [
meta: { meta: {
i18n: 'router.voiceTraining' i18n: 'router.voiceTraining'
} }
},
{
path: 'projectServer',
component: ProjectServer,
meta: {
i18n: 'router.projectServer'
}
} }
// { // {
// path: 'deviceManage', // path: 'deviceManage',

View File

@ -19,7 +19,7 @@ const service = axios.create({
timeout: 600000 // 请求超时时间 timeout: 600000 // 请求超时时间
}); });
// request拦截器 // request拦截器108
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
if (getToken()) { if (getToken()) {
config.headers['X-Token'] = getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers['X-Token'] = getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改

View File

@ -593,7 +593,7 @@ export default {
}); });
} else if (this.project === 'zzwwtest') { } else if (this.project === 'zzwwtest') {
this.$router.push({ path: '/jlmap3d/zzwwtest', query: {lessonId:'35'} }); this.$router.push({ path: '/jlmap3d/zzwwtest', query: {lessonId:'35'} });
}else if (this.project === 'xzexam') { } else if (this.project === 'xzexam') {
this.$router.push({ path: '/jlmap3d/xzexam', query: {} }); this.$router.push({ path: '/jlmap3d/xzexam', query: {} });
} else if (this.project === 'richorlesson3d') { } else if (this.project === 'richorlesson3d') {
this.$router.push({ path: '/jlmap3d/lesson3dselect', query: {} }); this.$router.push({ path: '/jlmap3d/lesson3dselect', query: {} });

View File

@ -0,0 +1,110 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { createProjectServer, updateProjectServer } from '@/api/projectServer';
export default {
name: 'DeviceAdd',
props: {
projectList: {
type: Array,
required: true
}
},
data() {
return {
dialogVisible: false,
formModel: {
id: '',
domainName: '',
project: ''
},
loading: false
};
},
computed: {
form() {
const form = {
labelWidth: '120px',
items: [
{ prop: 'domainName', label: '域名', type: 'text', required: true, placeholder: '请输入域名' },
{ prop: 'project', label: '项目', type: 'select', required: true, options: this.projectList, placeholder: '请选择项目' }
]
};
return form;
},
rules() {
const crules = {
domainName: [
{ required: true, message: '请输入域名', trigger: 'blur' }
],
project: [
{ required: true, message: '请选择项目', trigger: 'change' }
]
};
return crules;
},
title() {
return this.formModel.id ? '修改项目域名' : '创建项目域名';
}
},
mounted() {
},
methods: {
show(data) {
if (data) {
this.formModel.id = data.id;
this.formModel.domainName = data.domainName;
this.formModel.project = data.project;
}
this.dialogVisible = true;
},
doSave() {
this.$refs.dataform.validateForm(() => {
this.loading = true;
const data = {
id: this.formModel.id,
domainName: this.formModel.domainName,
project: this.formModel.project.toUpperCase()
};
if (data.id) {
updateProjectServer(data.id, data).then(resp => {
this.$message.success('修改项目域名数据成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
} else {
createProjectServer(data).then(resp => {
this.$message.success('创建项目域名数据成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
});
},
handleClose() {
this.formModel = {
id: '',
domainName: '',
project: ''
};
this.$refs.dataform.resetForm();
this.dialogVisible = false;
this.loading = false;
}
}
};
</script>

View File

@ -0,0 +1,163 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-server ref="addServer" :project-list="projectList" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { projectServerPaging, deleteProjectServer } from '@/api/projectServer';
import { getSessionStorage } from '@/utils/auth';
import { ProjectList } from '@/scripts/ProjectConfig';
import AddServer from './add';
export default {
name: 'DeviceManage',
components: {
AddServer
},
data() {
return {
examResultList: [],
url: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
beforeQuery: this.beforeQuery,
reset: true,
queryObject: {
project: {
type: 'select',
label: '项目:',
config: {
data: []
}
}
}
},
queryList: {
query: projectServerPaging,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '域名',
prop: 'domainName'
},
{
title: '项目名称',
prop: 'projectCode',
type: 'tag',
columnValue: (row) => { return this.handleProjectName(row.project, this.projectList); },
tagType: (row) => { return 'success'; }
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return this.handleTime(row.createTime); },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '300',
buttons: [
{
name: '编辑',
handleClick: this.editConfig
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.createProjectServer}
]
},
currentModel: {}
};
},
computed: {
projectCode() {
return this.projectMap[getSessionStorage('project')];
},
projectList() {
return [{value: 'default', label: '默认'}, ...ProjectList];
}
},
mounted() {
this.queryForm.queryObject.project.config.data = this.projectList;
},
methods: {
createProjectDevice() {
this.$refs.add.show();
},
beforeQuery(params) {
params.project = params.project.toUpperCase();
return params;
},
computation(fieldValue, type) {
let list = [];
if (type === 'projectType') {
list = this.projectList;
} else if ( type === 'deviceType' ) {
list = this.deviceTypeList;
}
let value = '';
list.forEach((elem) => {
elem.label = fieldValue;
value = elem.value;
});
console.log(value, fieldValue, type);
return value;
},
handleTime(time) {
const timeList = time.split('T');
let newTime = '';
if (timeList.length > 1) {
newTime = timeList[0] + ' ' + timeList[1];
} else {
newTime = time;
}
return newTime;
},
//
handleDelete(index, row) {
this.$confirm('此操作将删除该域名数据!', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteProjectServer(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
handleProjectName(projectCode, projectList) {
const project = projectList.find(elem => elem.value.toUpperCase() === projectCode);
return project ? project.label : '无效项目';
},
createProjectServer() {
this.$refs.addServer.show();
},
editConfig(index, row) {
this.$refs.addServer.show(row);
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>