# Conflicts:
#	public/config.js
This commit is contained in:
wangwenhua 2025-10-17 15:29:21 +08:00
commit ca43ccbdd3
11 changed files with 358 additions and 79 deletions

20
public/config.js vendored
View File

@ -1,11 +1,25 @@
// @ts-ignore
window._CONFIG = {
// 地图用图片资源地址
ImageryProviderUrl: '/map/mapWX/{z}/{x}/{y}.jpg',
RoadProviderUrl: '',
TerrainProviderUrl: '/map/mapTerrain/',
// 显示系统菜单
showSystemMenu: true,
// 使用第三方登录
useThirdLogin: false,
// 第三方登录地址
thirdLoginUrl: 'http://127.0.0.1:8080/thirdLogin',
// 第三方注册AppId
clientId: '0123456789',
evaluationSrc: 'http://192.168.0.189:8088/thirdLogin/thirdLoginPage?username=admin',
VUE_APP_API_URL: 'http://192.168.0.225:8099',
VUE_APP_WEBSOCKET_URL: 'ws://192.168.0.225:8099',
// 评估子系统 内嵌iframe地址
evaluationSrc: 'http://192.168.0.53:8088/thirdLogin/thirdLoginPage?username=admin',
// 服务端地址
VUE_APP_API_URL: 'http://192.168.0.53:8099',
// websocket服务地址
VUE_APP_WEBSOCKET_URL: 'ws://192.168.0.53:8099',
}

View File

@ -11,7 +11,7 @@ import openThirdLogin from './utils/openThirdLogin'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const allowList = ['thirdLogin', 'login', 'register', 'registerResult'] // no redirect allowList
const allowList = ['login', 'Welcome'] // no redirect allowList
const loginRoutePath = '/user/login'
const defaultRoutePath = '/user/welcome'
@ -58,11 +58,11 @@ router.beforeEach((to, from, next) => {
})
// 失败时,获取用户信息失败时,调用登出,来清空历史保留信息
store.dispatch('Logout').then(() => {
// if (process.env.NODE_ENV === 'production') {
// openThirdLogin()
// } else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
// }
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
}
})
})
} else {
@ -74,11 +74,11 @@ router.beforeEach((to, from, next) => {
// 在免登录名单,直接进入
next()
} else {
// if (process.env.NODE_ENV === 'production') {
// openThirdLogin()
// } else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
// }
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
}
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
}
}

View File

@ -10,13 +10,13 @@ const constantRouterComponents = {
BlankLayout: BlankLayout,
RouteView: RouteView,
PageView: PageView,
'403': () => import(/* webpackChunkName: "error" */ '@/views/exception/403'),
'404': () => import(/* webpackChunkName: "error" */ '@/views/exception/404'),
'500': () => import(/* webpackChunkName: "error" */ '@/views/exception/500'),
403: () => import(/* webpackChunkName: "error" */ '@/views/exception/403'),
404: () => import(/* webpackChunkName: "error" */ '@/views/exception/404'),
500: () => import(/* webpackChunkName: "error" */ '@/views/exception/500'),
// 你需要动态引入的页面组件
WorkplaceEquipment: () => import('@/views/dashboard/WorkplaceEquipment'),
Analysis: () => import('@/views/dashboard/Analysis')
Analysis: () => import('@/views/dashboard/Analysis'),
// 'TestWork': () => import(/* webpackChunkName: "TestWork" */ '@/views/dashboard/TestWork')
}
@ -24,7 +24,7 @@ const constantRouterComponents = {
const notFoundRouter = {
path: '*',
redirect: '/404',
hidden: true
hidden: true,
}
// 根级菜单
@ -36,9 +36,72 @@ const rootRouter = {
component: 'BasicLayout',
// redirect: '/dashboard/equipment',
meta: {
title: '首页'
title: '首页',
},
children: []
children: [],
}
const systemNav = {
id: '_67ed94a37b03415c8ee77a8991e79745',
title: '系统管理',
key: 'System',
name: '系统管理',
component: 'BasicLayout',
redirect: '/system/userlist',
parentId: '',
icon: 'dashboard',
children: [
{
id: '_1',
title: '菜单管理',
key: 'MenuList',
name: '菜单管理',
component: 'isystem/menuList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_5114bf6a963f41149ab2435c86551927',
title: '用户管理',
key: 'UserList',
name: '用户管理',
component: 'isystem/userList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_230a5ebe7cdc41acb997122d6de2d86f',
title: '角色管理',
key: 'RoleList',
name: '角色管理',
component: 'isystem/roleList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_2fd1683b13c241be84c34185ff55028e',
title: '字典管理',
key: 'DictIndex',
name: '字典管理',
component: 'isystem/dict/dictlist',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_85924f8619f1451e847c9f69705f360f',
title: '系统日志',
key: 'LogList',
name: '系统日志',
component: 'isystem/logList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
],
}
/**
@ -75,11 +138,11 @@ const rootRouter = {
// })
// })
// }
export const generatorDynamicRouter = token => {
export const generatorDynamicRouter = (token) => {
return new Promise((resolve, reject) => {
loginService
.getCurrentUserNav()
.then(res => {
.then((res) => {
console.log('generatorDynamicRouter response:', res)
const data = res.data
const childrenNav = []
@ -87,11 +150,14 @@ export const generatorDynamicRouter = token => {
// 后端数据, 根级树数组, 根级 PID
listToTree(data, childrenNav, '')
console.log('childrenNav', childrenNav)
if (window._CONFIG.showSystemMenu) {
childrenNav.push(systemNav)
}
const routers = generator(childrenNav)
console.log('routers', routers)
resolve(routers)
})
.catch(err => {
.catch((err) => {
reject(err)
})
})
@ -104,8 +170,8 @@ export const generatorDynamicRouter = token => {
* @param parent
* @returns {*}
*/
export const generator = (routerMap, parent) => {
return routerMap.map(item => {
export const generator = (routerMap, parent) => {
return routerMap.map((item) => {
const { title, show, hideChildren, hiddenHeaderContent, target, icon } = item || item.meta || {}
const currentRouter = {
// 如果路由设置了 path则作为默认 path否则 路由地址 动态拼接生成如 /dashboard/workplace
@ -123,9 +189,9 @@ export const generatorDynamicRouter = token => {
title: title,
icon: icon || undefined,
hiddenHeaderContent: hiddenHeaderContent,
target: target
target: target,
// permission: item.name
}
},
}
// 是否设置了隐藏菜单
if (show === false) {
@ -157,13 +223,13 @@ export const generatorDynamicRouter = token => {
* @param parentId 父ID
*/
const listToTree = (list, tree, parentId) => {
list.forEach(item => {
list.forEach((item) => {
// 判断是否为父级菜单
if (item.parentId === parentId) {
const child = {
...item,
key: item.key || item.name,
children: []
children: [],
}
// 迭代 list 找到当前菜单相符合的所有子菜单
listToTree(list, child.children, item.id)

View File

@ -1,5 +1,5 @@
export default () => {
const redirectUri = window.location.origin + '/user/thirdLogin'
const redirectUri = window.location.origin + '/user/welcome'
window.location.href =
window._CONFIG.thirdLoginUrl +
'?response_type=code&active_type=user&state=' +

View File

@ -26,7 +26,10 @@ const errorHandler = (error) => {
description: data.message,
})
}
if (error.response.status === 401 && !(data.result && data.result.isLogin)) {
if (
(error.response.status === 500 && error.response.data.message === '未找到授权信息') ||
(error.response.status === 401 && !(data.result && data.result.isLogin))
) {
notification.error({
message: '温馨提示',
description: '登录过期,请重新登录',
@ -35,13 +38,21 @@ const errorHandler = (error) => {
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {
// if (process.env.NODE_ENV === 'production') {
// openThirdLogin()
// } else {
window.location.reload()
// }
}, 1500)
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
window.location = '/user/login?redirect=' + window.location.pathname
}
}, 1000)
})
} else {
setTimeout(() => {
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
window.location = '/user/login?redirect=' + window.location.pathname
}
}, 1000)
}
}
}

View File

@ -38,8 +38,15 @@
:pageConfig="qxhj.pageConfig"
:showTool="qxhj.showTool"
>
<template #tablecell-lastBegTime="{ record }">
{{ record.lastBegTime.replace('T', ' ') }}
</template>
<template #tablecell-lastEndTime="{ record }">
{{ record.lastEndTime.replace('T', ' ') }}
</template>
<template #tablecell-action="{ record }">
<a-button type="text-primary" icon="edit" @click="handleOpenEditQxhjModal(record)"></a-button>
<a-button type="text-danger" icon="delete" @click="handleDeleteQxhj(record)"></a-button>
</template>
</AntQueryTable>
</a-card>
@ -91,6 +98,7 @@
</template>
<script>
import { getAction, postAction } from '@/api/manage'
export default {
name: 'Bzhjsjk',
data() {
@ -108,17 +116,13 @@ export default {
table: {},
immediate: false,
query: (queryParams) =>
this.$http({
url: `/baseData/weatherResource/list`,
method: 'get',
params: { scenarioId: this.xd.selectedKeys[0], ...queryParams },
}),
getAction(`/baseData/weatherResource/list`, { scenarioId: this.xd.selectedKeys[0], ...queryParams }),
columns: [
{ dataIndex: 'serial' },
{ title: '天气类型', dataIndex: 'weatherType' },
{ title: '持续开始时间', dataIndex: 'lastBegTime' },
{ title: '持续结束时间', dataIndex: 'lastEndTime' },
// { dataIndex: 'action', width: 100 },
{ dataIndex: 'action', width: 100 },
],
},
pageConfig: true,
@ -136,8 +140,8 @@ export default {
options: {
dataSource: () => ({
data: [
{ title: 'rain', id: 'rain' },
{ title: 'snow', id: 'snow' },
{ title: '下雨', id: 'rain' },
{ title: '下雪', id: 'snow' },
],
}),
},
@ -164,12 +168,7 @@ export default {
tableConfig: {
table: {},
immediate: false,
query: (queryParams) =>
this.$http({
url: `/environment/ebe/list`,
method: 'get',
params: { id: this.xd.selectedKeys[0], ...queryParams },
}),
query: (queryParams) => getAction(`/environment/ebe/list`, { id: this.xd.selectedKeys[0], ...queryParams }),
columns: [
{ dataIndex: 'serial' },
{ title: '电磁强度', dataIndex: 'fieldStrength' },
@ -219,6 +218,14 @@ export default {
}[this.layoutRight]
},
},
watch: {
'qxhjModal.formData': {
handler(v) {
console.log(JSON.parse(JSON.stringify(v)))
},
deep: true,
},
},
created() {
this.getXdListData()
},
@ -226,10 +233,7 @@ export default {
async getXdListData() {
try {
this.xd.loading = true
const res = await this.$http({
url: `/baseData/scenario/all`,
method: 'get',
})
const res = await getAction(`/baseData/scenario/all`)
this.xd.listData = res.data
if (this.xd.selectedKeys.length === 0) {
this.xd.selectedKeys = [this.xd.listData[0].id]
@ -252,22 +256,35 @@ export default {
this.qxhjModal.formData = { scenarioId: this.xd.selectedKeys[0] }
this.qxhjModal.visible = true
},
handleOpenEditQxhjModal(record) {
this.qxhjModal.title = `编辑气象环境`
this.qxhjModal.mode = 'edit'
this.qxhjModal.formData = { ...record }
this.qxhjModal.visible = true
async handleOpenEditQxhjModal(record) {
try {
const res = await getAction('/baseData/weatherResource/getInfo', { id: record.id })
this.qxhjModal.title = `编辑气象环境`
this.qxhjModal.mode = 'edit'
this.qxhjModal.formData = res.data
this.$set(this.qxhjModal.formData, 'lastBegTimeStr', res.data.lastBegTime.replace('T', ' '))
this.$set(this.qxhjModal.formData, 'lastEndTimeStr', res.data.lastEndTime.replace('T', ' '))
this.qxhjModal.visible = true
} catch (error) {
console.log(error)
}
},
handleSubmitQxhj(formData) {
return this.$http({
url: `/baseData/weatherResource/add`,
method: 'post',
data: formData,
})
return postAction(`/baseData/weatherResource/add`, formData)
},
handleSubmitQxhjSuccess() {
this.$refs['qxhj-table'].commitAction('query')
},
async handleDeleteQxhj(record) {
try {
await this.$confirm({ title: '温馨提示', content: '确定要删除该气象吗?' })
const res = await getAction('/baseData/weatherResource/remove/' + record.id)
this.$message.success(res.message)
this.$refs['qxhj-table'].commitAction('query')
} catch (error) {
console.log(error)
}
},
handleOpenAddDchjModal() {
this.dchjModal.title = '新建电磁环境'

View File

@ -28,49 +28,49 @@ export default {
{
title: '作战力量数据库',
image: require('@/assets/images/simulation-scene/database/zzllsjk.png'),
path: '/databaseSystem/zzllsjk',
path: '/bzstlsjk/zzllsjk',
},
{
title: '保障力量数据库',
image: require('@/assets/images/simulation-scene/database/bzllsjk.png'),
path: '/databaseSystem/bzllsjk',
path: '/bzstlsjk/bzllsjk',
},
{
title: '保障环境数据库',
image: require('@/assets/images/simulation-scene/database/bzhjsjk.png'),
path: '/databaseSystem/bzhjsjk',
path: '/bzstlsjk/bzhjsjk',
},
{
title: '装备数据库',
image: require('@/assets/images/simulation-scene/database/bzhjsjk.png'),
path: '/databaseSystem/zbsjk',
path: '/bzstlsjk/zbsjk',
},
],
ywyylsjk: [
{
title: '想定数据库',
image: require('@/assets/images/simulation-scene/database/xdsjk.png'),
path: '/databaseSystem/xdsjk',
path: '/ywyylsjk/xdsjk',
},
{
title: '方案数据库',
image: require('@/assets/images/simulation-scene/database/fasjk.png'),
path: '/databaseSystem/fasjk',
path: '/ywyylsjk/fasjk',
},
{
title: '进程数据库',
image: require('@/assets/images/simulation-scene/database/jcsjk.png'),
path: '/databaseSystem/jcsjk',
path: '/ywyylsjk/jcsjk',
},
{
title: '图形数据库',
image: require('@/assets/images/simulation-scene/database/txsjk.png'),
path: '/databaseSystem/txsjk',
path: '/ywyylsjk/txsjk',
},
{
title: '运行记录数据库',
image: require('@/assets/images/simulation-scene/database/yxjlsjk.png'),
path: '/databaseSystem/yxjlsjk',
path: '/ywyylsjk/yxjlsjk',
},
],
}

View File

@ -14,7 +14,7 @@
<a-button type="primary" icon="plus" @click="handleOpenAddModal">新增</a-button>
</template>
<template #tablecell-iconBase64="{ text }">
<img :src="text" alt="" style="width: 100px; height: 70px; object-fit: contain" />
<img :src="text" alt="" style="width: 24px; height: 24px; object-fit: contain" />
</template>
<template #tablecell-action="{ record }">
<a-button type="text-primary" icon="edit" @click="handleOpenEditModal(record)"></a-button>

View File

@ -30,6 +30,53 @@
<div class="tool_btn" style="grid-area: 1 / 1 / 2 / 4">
<a-menu :selectedKeys="[]" mode="horizontal" theme="dark">
<a-menu-item @click="handleOpenGuaranteeProcessPage()"> 保障流程 </a-menu-item>
<a-menu-item @click="handleOpenGuaranteeWeatherModal()"> 气象环境 </a-menu-item>
<a-modal
v-model="guaranteeWeatherModal.visible"
width="900px"
:maskClosable="false"
:destroyOnClose="true"
:footer="null"
>
<template #title>
<span>{{ guaranteeWeatherModal.title }}</span>
<a-button
type="primary"
icon="plus"
style="margin-left: 10px"
shape="circle"
@click="handleOpenAddQxhjModal"
></a-button>
</template>
<AntQueryTable
ref="qxhj-table"
height="100%"
:queryConfig="guaranteeWeatherModal.qxhj.queryConfig"
:tableConfig="guaranteeWeatherModal.qxhj.tableConfig"
:pageConfig="guaranteeWeatherModal.qxhj.pageConfig"
:showTool="guaranteeWeatherModal.qxhj.showTool"
>
<template #tablecell-lastBegTime="{ record }">
{{ record.lastBegTime.replace('T', ' ') }}
</template>
<template #tablecell-lastEndTime="{ record }">
{{ record.lastEndTime.replace('T', ' ') }}
</template>
<template #tablecell-action="{ record }">
<a-button type="text-primary" icon="edit" @click="handleOpenEditQxhjModal(record)"></a-button>
<a-button type="text-danger" icon="delete" @click="handleDeleteQxhj(record)"></a-button>
</template>
</AntQueryTable>
<AntFormModal
:visible.sync="guaranteeWeatherModal.qxhjModal.visible"
:title="guaranteeWeatherModal.qxhjModal.title"
:formItems="guaranteeWeatherModal.qxhjModal.formItems"
:formRules="guaranteeWeatherModal.qxhjModal.formRules"
:formData="guaranteeWeatherModal.qxhjModal.formData"
:onSubmit="handleSubmitQxhj"
@success="handleSubmitQxhjSuccess"
></AntFormModal>
</a-modal>
</a-menu>
</div>
<div
@ -298,6 +345,63 @@ export default {
actionList: [],
},
childWindow: null,
guaranteeWeatherModal: {
visible: false,
title: '气象环境',
qxhj: {
queryConfig: false,
tableConfig: {
table: {},
immediate: true,
query: (queryParams) =>
getAction(`/baseData/weatherResource/list`, { scenarioId: this.scenarioId, ...queryParams }),
columns: [
{ dataIndex: 'serial' },
{ title: '天气类型', dataIndex: 'weatherType' },
{ title: '持续开始时间', dataIndex: 'lastBegTime' },
{ title: '持续结束时间', dataIndex: 'lastEndTime' },
{ dataIndex: 'action', width: 100 },
],
},
pageConfig: true,
showTool: false,
},
qxhjModal: {
visible: false,
title: '',
mode: '',
formItems: [
{
label: '天气类型',
prop: 'weatherType',
component: 'AntOriginSelect',
options: {
dataSource: () => ({
data: [
{ title: '下雨', id: 'rain' },
{ title: '下雪', id: 'snow' },
],
}),
},
},
{
label: '持续开始时间',
prop: 'lastBegTimeStr',
component: 'a-date-picker',
options: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' },
},
{
label: '持续结束时间',
prop: 'lastEndTimeStr',
component: 'a-date-picker',
options: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' },
},
],
formRules: {},
formData: {},
},
},
}
},
computed: {
@ -621,6 +725,52 @@ export default {
',top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no'
)
},
handleOpenGuaranteeWeatherModal() {
this.guaranteeWeatherModal.visible = true
},
handleOpenAddQxhjModal() {
this.guaranteeWeatherModal.qxhjModal.title = '新建气象环境'
this.guaranteeWeatherModal.qxhjModal.mode = 'add'
this.guaranteeWeatherModal.qxhjModal.formData = { scenarioId: this.scenarioId }
this.guaranteeWeatherModal.qxhjModal.visible = true
},
async handleOpenEditQxhjModal(record) {
try {
const res = await getAction('/baseData/weatherResource/getInfo', { id: record.id })
this.guaranteeWeatherModal.qxhjModal.title = `编辑气象环境`
this.guaranteeWeatherModal.qxhjModal.mode = 'edit'
this.guaranteeWeatherModal.qxhjModal.formData = res.data
this.$set(
this.guaranteeWeatherModal.qxhjModal.formData,
'lastBegTimeStr',
res.data.lastBegTime.replace('T', ' ')
)
this.$set(
this.guaranteeWeatherModal.qxhjModal.formData,
'lastEndTimeStr',
res.data.lastEndTime.replace('T', ' ')
)
this.guaranteeWeatherModal.qxhjModal.visible = true
} catch (error) {
console.log(error)
}
},
handleSubmitQxhj(formData) {
return postAction(`/baseData/weatherResource/add`, formData)
},
handleSubmitQxhjSuccess() {
this.$refs['qxhj-table'].commitAction('query')
},
async handleDeleteQxhj(record) {
try {
await this.$confirm({ title: '温馨提示', content: '确定要删除该气象吗?' })
const res = await getAction('/baseData/weatherResource/remove/' + record.id)
this.$message.success(res.message)
this.$refs['qxhj-table'].commitAction('query')
} catch (error) {
console.log(error)
}
},
},
}
</script>

View File

@ -129,7 +129,7 @@ export default {
onCancel() {},
})
}
if (process.env.NODE_ENV === 'production') {
if (window._CONFIG.useThirdLogin) {
this.$store.dispatch('Logout').then(() => {
openThirdLogin()
})

View File

@ -23,6 +23,7 @@
</template>
<script>
import { getAction } from '@/api/manage'
import { mapState } from 'vuex'
export default {
@ -41,7 +42,7 @@ export default {
moduleCode: 'db_system',
moduleName: '数据库子系统',
icon: require('@/assets/images/simulation-scene/system-icon/database.png'),
modulePath: '/databaseSystem/zzllsjk',
modulePath: '/bzstlsjk/zzllsjk',
},
{
moduleCode: 'simulation_system',
@ -81,7 +82,27 @@ export default {
userInfo: (state) => state.user.info,
}),
},
created() {
async created() {
const searchParams = new URLSearchParams(window.location.search)
const searchCode = searchParams.get('code')
const localCode = window.localStorage.getItem('code')
if (searchCode) {
window.localStorage.setItem('code', searchCode)
window.location.href = window.location.origin + window.location.pathname
} else if (localCode) {
try {
const tokenRes = await getAction('/oauth2/thirdLogin', { code: localCode })
storage.set(ACCESS_TOKEN, tokenRes.data.token, 7 * 24 * 60 * 60 * 1000)
this.$store.commit('SET_TOKEN', tokenRes.data.token)
await this.$store.dispatch('GetInfo')
} catch (error) {
console.log(error)
} finally {
window.localStorage.removeItem('code')
}
} else {
this.$store.dispatch('GetInfo')
}
window.addEventListener('beforeunload', (e) => {
this.openChildren.forEach((childWindow) => {
childWindow && childWindow.close()