Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivWeb
Commits
b75e03e8
Commit
b75e03e8
authored
Jan 18, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Plain Diff
feat: 集成报表菜单
parents
507cedfc
3910aab1
Pipeline
#42979
passed with stages
in 9 minutes 22 seconds
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
91 additions
and
46 deletions
+91
-46
micor.js
config/micor.js
+1
-1
proxy.js
config/proxy.js
+1
-1
ExtendRightContent.js
src/components/GlobalHeader/ExtendRightContent.js
+6
-3
reducer.js
src/containers/App/store/reducer.js
+2
-0
BasicLayout.js
src/layouts/BasicLayout.js
+1
-1
BasicLayout1.js
src/layouts/BasicLayout1.js
+15
-6
SecurityLayout.js
src/layouts/SecurityLayout.js
+4
-4
Site.js
src/layouts/Site.js
+1
-1
micro.js
src/micro.js
+21
-18
login.js
src/pages/user/login/login.js
+10
-9
noSecret.js
src/pages/user/login/noSecret.js
+1
-1
baseLogin.js
src/pages/user/login/template/baseLogin.js
+1
-1
routes.js
src/utils/routes.js
+25
-0
utils.js
src/utils/utils.js
+2
-0
No files found.
config/micor.js
View file @
b75e03e8
...
...
@@ -17,7 +17,7 @@ export default {
// },
{
name
:
'civ_pandawork'
,
entry
:
`//
${
window
.
location
.
hostname
}
:808
1
/civ_pandawork`
,
entry
:
`//
${
window
.
location
.
hostname
}
:808
0
/civ_pandawork`
,
container
:
'#micro-container'
,
activeRule
:
'/civbase/civ_pandawork'
,
},
...
...
config/proxy.js
View file @
b75e03e8
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const
proxyURL
=
'http
://192.168.10.156:8666
'
;
const
proxyURL
=
'http
s://panda-water.com
'
;
module
.
exports
=
{
assetsRoot
:
process
.
env
.
NODE_ENV
!==
'production'
?
proxyURL
:
'./'
,
...
...
src/components/GlobalHeader/ExtendRightContent.js
View file @
b75e03e8
...
...
@@ -3,10 +3,10 @@ import { message } from 'antd';
import
_
,
{
words
}
from
'lodash'
;
import
{
connect
}
from
'react-redux'
;
import
{
withRouter
}
from
'react-router'
;
import
{
loadMicroApp
}
from
'qiankun'
;
import
{
useIntl
}
from
'@/locales/localeExports'
;
import
Icon
from
'@ant-design/icons'
;
import
{
setDefaultMountApp
}
from
'qiankun'
import
{
actionCreators
}
from
'../../containers/App/store'
;
import
HeaderSearch
from
'../HeaderSearch'
;
import
Avatar
from
'./AvatarDropdown'
;
...
...
@@ -125,7 +125,10 @@ const GlobalHeaderRight = props => {
const
url
=
_
.
isString
(
props
.
global
.
get
(
'homepage'
))
?
props
.
global
.
get
(
'homepage'
)
:
props
.
global
.
get
(
'homepage.url'
);
window
.
share
.
event
.
emit
(
'goHome'
,
`/civbase/civweb4/
${
url
}
`
);
window
.
share
.
event
.
emit
(
'goHome'
,
`/
${
url
}
`
);
// setDefaultMountApp()
// 1、window.globalConfig product
// 2. 拿到当前product
url
?
(
window
.
share
.
event
.
emit
(
'listenerMointer'
,
{
label
:
'首页'
,
...
...
src/containers/App/store/reducer.js
View file @
b75e03e8
...
...
@@ -7,6 +7,7 @@ import { Storage } from '@wisdom-utils/utils';
import
pkg
from
'../../../../package.json'
;
import
defaultSetting
from
'../../../../config/defaultSetting'
;
import
generRoutes
,
{
generFlatRoutes
}
from
'../../../utils/routes'
;
import
{
transformWidgets
}
from
'../../../utils/routes'
;
import
{
CLEAR_RCENT_KEYWORD
,
COMPLEX_CONFIG
,
...
...
@@ -105,6 +106,7 @@ const appReducer = (state = initialState, action) => {
window
.
globalConfig
&&
window
.
globalConfig
.
products
&&
Array
.
isArray
(
window
.
globalConfig
.
products
)
&&
window
.
globalConfig
.
products
.
map
(
item
=>
{
modulePkg
[
item
.
PackageName
]
=
item
;
});
config
.
widgets
=
transformWidgets
(
config
.
widgets
);
const
generMenu
=
generRoutes
(
config
.
widgets
||
[],
null
,
0
,
modulePkg
);
let
flatMenu
=
[];
if
(
generMenu
)
{
...
...
src/layouts/BasicLayout.js
View file @
b75e03e8
...
...
@@ -839,7 +839,7 @@ const BasicLayout = props => {
if
(
lastIndex
>=
0
)
{
history
.
push
(
newTabList
[
lastIndex
].
path
);
}
else
{
history
.
replace
(
`/
civweb4/
${
props
.
global
.
homepage
}
`
);
history
.
replace
(
`/
${
props
.
global
.
homepage
}
`
);
}
props
.
updateSelectedKeys
(
newActiveKey
);
props
.
updatePathname
(
newActiveKey
);
...
...
src/layouts/BasicLayout1.js
View file @
b75e03e8
...
...
@@ -271,6 +271,7 @@ const BasicLayout = props => {
// 处理隐藏菜单
let
currentRoutes
=
props
.
route
.
routes
.
filter
(
item
=>
!
item
.
hideInMenu
)[
props
.
currentMenuIndex
];
console
.
log
(
props
.
route
)
//props.currentMenuIndex
useEffect
(()
=>
{
const
initSelectRoute
=
findPathByLeafId
(
...
...
@@ -330,9 +331,11 @@ const BasicLayout = props => {
useEffect
(()
=>
{
siteAction
.
setGlobalConfig
(
props
.
global
);
if
(
!
Cookies
.
get
(
'token'
))
{
let
client
=
props
.
global
.
get
(
'client'
);
client
=
client
!==
'undefined'
||
!
_
.
isNull
(
client
)
||
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
history
.
replace
(
`/user/login?client=
${
client
}
`
);
let
client
=
props
.
global
&&
props
.
global
.
client
;
client
=
client
!==
'undefined'
&&
!
_
.
isNull
(
client
)
&&
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
let
generateType
=
props
.
global
.
get
(
'generateType'
);
generateType
=
!
_
.
isNull
(
generateType
)
&&
!
_
.
isUndefined
(
generateType
)
&&
generateType
!==
'undefined'
?
`&generateType=
${
generateType
}
`
:
''
;
history
.
replace
(
`/user/login?client=
${
client
}${
generateType
}
`
);
props
.
logout
();
return
;
}
...
...
@@ -351,13 +354,19 @@ const BasicLayout = props => {
// setChildrenRoutes(currentChildrenRoute)
window
.
share
.
event
.
on
(
'goHome'
,
url
=>
{
setChildrenRoutes
([
{
icon
:
<
HomeIcon
/>
,
path
:
url
,
name
:
'首页'
}
])
]);
setTabActiveKey
(
url
);
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
url
}
`
);
});
/**
* web4全屏退出,切换三级菜单高亮
...
...
@@ -443,7 +452,7 @@ const BasicLayout = props => {
}
const
handleSelectMenuItem
=
(
item
)
=>
{
debugger
setTabActiveKey
(
item
);
if
(
item
.
indexOf
(
'web_console'
)
===
-
1
)
{
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
item
}
`
);
...
...
@@ -546,7 +555,7 @@ const BasicLayout = props => {
<
div
className
=
{
layoutStyles
.
splitLine
}
><
/div
>
<
ul
className
=
{
classNames
(
layoutStyles
.
menu
,
'menu-vertical'
)}
>
{
currentRoutes
&&
(
currentRoutes
.
routes
||
[]).
map
((
item
,
index
)
=>
{
currentRoutes
&&
(
currentRoutes
.
routes
||
[]).
filter
(
item
=>
!
item
.
hideInMenu
).
map
((
item
,
index
)
=>
{
return
(
<
React
.
Fragment
key
=
{
index
}
>
<
li
key
=
{
index
}
className
=
{
classNames
(
layoutStyles
[
'menu-item'
],
{
[
layoutStyles
[
'active'
]]:
index
===
selectIndex
})}
onClick
=
{()
=>
handlerSecond
(
item
,
index
)}
>
...
...
src/layouts/SecurityLayout.js
View file @
b75e03e8
...
...
@@ -21,21 +21,21 @@ class SecurityLayout extends React.Component {
}
render
()
{
const
{
isReady
}
=
this
.
state
;
const
{
children
,
global
,
loading
}
=
this
.
props
;
const
isLogin
=
Cookies
.
get
(
'token'
)
!==
null
&&
global
.
token
!==
null
;
// const queryString = stringify({
// redirect: window.location.href,
// });
if
(
_
.
isNull
(
global
.
token
)
||
(
global
.
hasGateWay
&&
_
.
isNull
(
global
.
access_token
)))
{
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
let
client
=
global
.
client
||
Cookies
.
get
(
'city'
);
client
=
client
!==
'undefined'
||
!
_
.
isNull
(
client
)
||
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
client
=
client
!==
'undefined'
&&
!
_
.
isNull
(
client
)
&&
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
// event.emit(?'event:initConfig');
let
generateType
=
global
.
generateType
;
generateType
=
!
_
.
isNull
(
generateType
)
&&
!
_
.
isUndefined
(
generateType
)
&&
generateType
!==
'undefined'
?
`&generateType=
${
generateType
}
`
:
''
;
return
(
<
Redirect
to
=
{
`/user/login?client=
${
client
}
`
}
/
>
<
Redirect
to
=
{
`/user/login?client=
${
client
}
${
generateType
}
`
}
render
=
{()
=>
window
.
location
.
reload
()}
/
>
);
}
...
...
src/layouts/Site.js
View file @
b75e03e8
...
...
@@ -345,7 +345,7 @@ class Site {
window
.
history
.
replaceState
(
''
,
''
,
`/
civbase/civweb4/
${
self
.
globalConfig
.
homepage
}
`
,
`/
${
self
.
globalConfig
.
homepage
}
`
,
);
self
.
getCityStationsForUser
().
then
(
res
=>
{
window
.
share
.
event
.
emit
(
'updateSite'
,
res
);
...
...
src/micro.js
View file @
b75e03e8
...
...
@@ -17,6 +17,7 @@ import { actionCreators } from './containers/App/store';
import
{
FILTER_FOLER_REG
}
from
'./utils/constants'
;
import
loader
from
'./render'
;
import
store
from
'./stores'
;
// eslint-disable-next-line no-undef
const
Logger
=
logger
(
'micro'
);
const
MICRO_STATUS
=
{
...
...
@@ -72,7 +73,7 @@ export const initMicroApps = () => {
process
.
env
.
NODE_ENV
!==
'production'
?
micorConfig
.
dev
:
products
;
registerMicroApps
(
entrys
.
map
(
item
=>
{
item
.
loader
=
loader
;
...
...
@@ -81,7 +82,9 @@ export const initMicroApps = () => {
baseRoot
:
item
.
name
,
// eslint-
// disable-next-line no-undef
globalConfig
:
config
,
globalConfig
:
/civweb4/
.
test
(
item
.
name
)
?
Object
.
assign
({},
config
,
{
homepage
:
config
.
homepage
?
config
.
homepage
.
replace
(
/civweb
\/
/
,
''
):
config
.
homepage
}):
config
,
//createStoreage.get('globalConfig'),
XMLHttpRequest
:
window
.
XMLHttpRequest
,
};
...
...
@@ -122,14 +125,17 @@ export const initMicroApps = () => {
//createStoreage.get('globalConfig'),
global
:
globalStore
.
global
});
const
globalConfig
=
window
.
globalConfig
;
globalConfig
.
homepage
=
globalConfig
.
homepage
&&
/civweb4/
.
test
(
globalConfig
.
homepage
)
?
config
.
homepage
.
replace
(
/civweb4
\/
/
,
''
):
globalConfig
.
homepage
;
console
.
log
(
globalConfig
);
setGlobalState
({
// eslint-disable-next-line no-undef
globalConfig
:
window
.
globalConfig
,
globalConfig
:
globalConfig
,
//createStoreage.get('globalConfig'),
});
microStore
.
set
(
"props:globalConfig"
,
{
globalConfig
:
window
.
globalConfig
,
globalConfig
:
globalConfig
,
global
:
globalStore
.
global
});
start
({
...
...
@@ -208,26 +214,23 @@ export const initMicroApps = () => {
export
const
defaultApp
=
()
=>
{
// eslint-disable-next-line no-undef
const
config
=
createStoreage
.
get
(
'globalConfig'
);
const
config
=
window
.
globalConfig
;
if
(
config
&&
config
.
token
)
{
const
basePath
=
config
.
homepage
!==
''
&&
FILTER_FOLER_REG
.
test
(
config
.
homepage
)
?
'civweb4'
:
'civweb4'
;
if
(
config
&&
config
.
home
)
{
setDefaultMountApp
(
`/civbase/
${
config
.
home
.
path
.
replace
(
/^
\/
/
,
''
)}
`
);
}
else
{
const
homepage
=
_
.
isNull
(
config
.
homepage
)
?
'/index'
:
'/'
+
config
.
homepage
;
setDefaultMountApp
(
`/
${
pkg
.
name
.
toLocaleLowerCase
()}
/
${
basePath
}${
homepage
}
`
);
createStoreage
.
set
(
'init_web4'
,
true
)
}
// if(config.productType && config.productType !== 'civweb4') {
// setDefaultMountApp(`/civbase/${config.productType}/${config.homepage.replace(/^\//, '')}`);
// const basePath =config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage) ?'civweb4' :'civweb4';
// if(config && config.home) {
// setDefaultMountApp(`/civbase/${config.home.path.replace(/^\//, '')}`);
// } else {
// const homepage = _.isNull(config.homepage) ? '/index': '/' + config.homepage;
// setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/
civweb4
${homepage}`);
// setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/
${basePath}
${homepage}`);
// createStoreage.set('init_web4', true)
// }
// let homepage = config.homepage.replace('civweb4/', '');
const
url
=
!
config
.
home
?
`/civbase/civweb4/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
)}
`
:
`/civbase/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
)}
`
;
setDefaultMountApp
(
url
);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
}
};
...
...
src/pages/user/login/login.js
View file @
b75e03e8
...
...
@@ -43,9 +43,13 @@ class Login {
let
{
password
}
=
this
.
globalConfig
;
loginName
=
params
.
getParams
(
'loginName'
)
?
params
.
getParams
(
'loginName'
):
loginName
;
const
redirect
=
params
.
getParams
(
'redirect'
);
const
generateType
=
params
.
getParams
(
'generateType'
);
if
(
redirect
)
{
this
.
globalConfig
.
homepage
=
redirect
;
this
.
globalConfig
.
layout
=
'blank'
;
// this.globalConfig.layout = 'blank';
}
if
(
generateType
)
{
this
.
globalConfig
.
generateType
=
generateType
;
}
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
...
...
@@ -218,12 +222,12 @@ class Login {
:
response
;
if
(
result
&&
result
.
length
>
0
)
{
const
config
=
result
.
shift
();
const
homeType
=
config
.
productType
||
'civweb4'
;
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
config
,
{
theme
:
self
.
globalConfig
.
theme
,
menu
:
self
.
globalConfig
.
menu
,
style
:
self
.
globalConfig
.
style
,
homepage
:
params
.
getParams
(
'redirect'
)
||
self
.
globalConfig
.
homepage
||
config
.
homepage
,
// productType: config.productType || self.globalConfig.productType || 'civweb4'
homepage
:
homeType
+
'/'
+
(
params
.
getParams
(
'redirect'
)
||
self
.
globalConfig
.
homepage
||
config
.
homepage
),
});
if
(
self
.
globalConfig
.
hasOwnProperty
(
'webConfig'
))
{
...
...
@@ -235,8 +239,6 @@ class Login {
}
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
// createStoreage.set('globalConfig', self.globalConfig);
// window.globalConfig.productType = self.globalConfig.productType;
self
.
getProjectItems
().
then
(()
=>
{
window
.
subSysCfg
=
{};
result
.
forEach
(
item
=>
{
...
...
@@ -278,8 +280,9 @@ class Login {
:
response
;
if
(
resultData
&&
resultData
.
length
>
0
)
{
const
mainConf
=
resultData
.
shift
();
const
mainType
=
mainConf
.
productType
||
'civweb4'
;
if
(
mainConf
.
homepage
)
self
.
globalConfig
.
homepage
=
mainConf
.
homepage
;
self
.
globalConfig
.
homepage
=
`
${
mainType
}
/
${
mainConf
.
homepage
}
`
;
if
(
mainConf
.
bannerLogo
)
self
.
globalConfig
.
bannerLogo
=
mainConf
.
bannerLogo
;
if
(
mainConf
.
logo
)
self
.
globalConfig
.
logo
=
mainConf
.
logo
;
...
...
@@ -301,8 +304,6 @@ class Login {
}
else
{
// loginSuccess
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
// createStoreage.set('globalConfig', self.globalConfig);
// window.globalConfig.productType = self.globalConfig.productType;
// console.log("===loginSuccess===")
getIndustry
?
self
.
events
.
emit
(
'toggleIndustry'
)
...
...
@@ -609,7 +610,7 @@ class Login {
.
then
(
response
=>
{
self
.
globalConfig
.
layout
=
'blank'
;
//
self.globalConfig.layout = 'blank';
if
(
response
&&
response
.
token
)
{
const
tk
=
response
.
token
;
self
.
globalConfig
.
token
=
tk
;
...
...
src/pages/user/login/noSecret.js
View file @
b75e03e8
...
...
@@ -25,7 +25,7 @@ const Login = forwardRef((props, _ref) => {
// homepage: params.getParams('redirect')
// }));
// props.history.push('/' + params.getParams('redirect'))
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
`
);
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
&generateType=
${
props
.
global
.
generateType
}
`
);
// window.share.event.emit('triggerMicro', props.global);
initMicroApps
();
});
...
...
src/pages/user/login/template/baseLogin.js
View file @
b75e03e8
...
...
@@ -62,7 +62,7 @@ const Login = forwardRef((props, _ref) => {
action
&&
action
.
events
.
on
(
'loginSuccess'
,
event
=>
{
setSubmitting
(
false
);
props
.
updateCurrentIndex
&&
props
.
updateCurrentIndex
(
0
);
props
.
history
.
push
(
`/
?client=
${
props
.
global
.
client
}
`
);
props
.
history
.
push
(
`/`
);
// debugger
// window.share.event.emit('triggerMicro', props.global);
initMicroApps
();
...
...
src/utils/routes.js
View file @
b75e03e8
...
...
@@ -52,6 +52,7 @@ const getURL = url => {
};
const
generRotes
=
(
widgets
,
parent
,
level
=
0
)
=>
{
const
ret
=
[];
if
(
!
widgets
||
widgets
.
length
===
0
){
return
...
...
@@ -103,6 +104,7 @@ const generRotes = (widgets, parent, level = 0) => {
url
=
item
.
url
}
url
=
transformURL
(
url
);
//url = url.replace(/[(\\|)|(&)]widget=[0-9]*/, '')
const
convertURL
=
item
.
icon
&&
transformURL
(
item
.
icon
.
replace
(
/
\s
*/g
,
''
));
const
icon
=
(
item
&&
item
.
icon
&&
item
.
icon
!==
null
&&
isAbsoluteURL
(
convertURL
)
?
convertURL
:
/
(\\
|
\/)
/
.
test
(
convertURL
)
?
...
...
@@ -155,6 +157,29 @@ const generRotes = (widgets, parent, level = 0) => {
});
return
ret
;
};
export
const
transformWidgets
=
(
widgets
)
=>
{
if
(
!
widgets
||
widgets
.
length
===
0
)
{
return
[]
}
return
widgets
.
map
(
item
=>
{
const
widgets
=
item
.
widgets
;
const
homepage
=
window
.
globalConfig
.
homepage
;
const
homePageConvertArray
=
homepage
.
split
(
"/"
);
const
findIndex
=
widgets
&&
widgets
.
findIndex
(
item
=>
item
.
label
===
'系统菜单组'
);
if
(
findIndex
===
-
1
&&
homePageConvertArray
[
0
]
!==
'civweb4'
)
{
widgets
.
push
({
label
:
"系统菜单组"
,
icon
:
''
,
product
:
homePageConvertArray
[
0
],
shortName
:
"首页"
,
url
:
homePageConvertArray
.
slice
(
1
,
homePageConvertArray
.
length
).
join
(
"/"
)
});
item
.
widgets
=
widgets
;
}
return
item
;
});
}
export
function
simpleNormalizeChildren
(
children
)
{
for
(
let
i
=
0
;
i
<
children
.
length
;
i
++
)
{
if
(
Array
.
isArray
(
children
[
i
]))
{
...
...
src/utils/utils.js
View file @
b75e03e8
...
...
@@ -87,6 +87,8 @@ export function findPathByLeafId(leafId, nodes, path, key, clear) {
}
export
function
transformURL
(
path
)
{
//civweb4/
// path = path.replace(/[(\\|)|(&)]widget=[0-9]*/, '');
const
el
=
document
.
createElement
(
'input'
);
el
.
value
=
path
;
String
.
fromCharCode
(
92
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment