Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes-kanban
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
ximai
mes-kanban
Commits
196744fe
Commit
196744fe
authored
Nov 05, 2024
by
沈翠玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改成希迈定制
parent
f6558628
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
100 deletions
+86
-100
proxy.ts
config/proxy.ts
+2
-2
routes.ts
config/routes.ts
+58
-57
access.ts
src/access.ts
+2
-8
app.tsx
src/app.tsx
+13
-21
AvatarDropdown.tsx
src/components/RightContent/AvatarDropdown.tsx
+2
-2
index.tsx
src/pages/common/Pwd/index.tsx
+1
-1
api.ts
src/services/mgr/api.ts
+6
-6
typing.d.ts
src/services/mgr/typing.d.ts
+2
-3
No files found.
config/proxy.ts
View file @
196744fe
...
@@ -9,14 +9,14 @@
...
@@ -9,14 +9,14 @@
export
default
{
export
default
{
dev
:
{
dev
:
{
'/api/'
:
{
'/api/'
:
{
target
:
'http://
localhost:20093
'
,
target
:
'http://
192.168.222.60:8088
'
,
changeOrigin
:
true
,
changeOrigin
:
true
,
pathRewrite
:
{
'^/api'
:
''
},
pathRewrite
:
{
'^/api'
:
''
},
},
},
},
},
test
:
{
test
:
{
'/api/'
:
{
'/api/'
:
{
target
:
'http
s://proapi.azurewebsites.net
'
,
target
:
'http
://192.168.222.60:8088
'
,
changeOrigin
:
true
,
changeOrigin
:
true
,
pathRewrite
:
{
'^'
:
''
},
pathRewrite
:
{
'^'
:
''
},
},
},
...
...
config/routes.ts
View file @
196744fe
...
@@ -91,24 +91,25 @@ export default [
...
@@ -91,24 +91,25 @@ export default [
],
],
},
},
{
{
key
:
'def4'
,
path
:
'/kanban'
,
path
:
'/kanban'
,
name
:
'kanban'
,
name
:
'kanban'
,
icon
:
'FundOutlined'
,
icon
:
'FundOutlined'
,
routes
:
[
routes
:
[
{
//
{
path
:
'productionProgressKanban'
,
//
path: 'productionProgressKanban',
name
:
'productionProgressKanban'
,
//
name: 'productionProgressKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/ProductionProgress'
,
//
component: './kanban/ProductionProgress',
},
//
},
{
//
{
path
:
'productProgressKanban'
,
//
path: 'productProgressKanban',
name
:
'productProgressKanban'
,
//
name: 'productProgressKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/ProductProgress'
,
//
component: './kanban/ProductProgress',
},
//
},
{
{
path
:
'productionComprehensKanban'
,
path
:
'productionComprehensKanban'
,
name
:
'productionComprehensKanban'
,
name
:
'productionComprehensKanban'
,
...
@@ -116,48 +117,48 @@ export default [
...
@@ -116,48 +117,48 @@ export default [
layout
:
false
,
layout
:
false
,
component
:
'./kanban/productionComprehens'
,
component
:
'./kanban/productionComprehens'
,
},
},
{
//
{
path
:
'materialSynthesisKanban'
,
//
path: 'materialSynthesisKanban',
name
:
'materialSynthesisKanban'
,
//
name: 'materialSynthesisKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/materialSynthesis'
,
//
component: './kanban/materialSynthesis',
},
//
},
{
//
{
path
:
'weldingProcessKanban'
,
//
path: 'weldingProcessKanban',
name
:
'weldingProcessKanban'
,
//
name: 'weldingProcessKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/weldingProcessKanban'
,
//
component: './kanban/weldingProcessKanban',
},
//
},
{
//
{
path
:
'evacuationProcessKanban'
,
//
path: 'evacuationProcessKanban',
name
:
'evacuationProcessKanban'
,
//
name: 'evacuationProcessKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/evacuationProcessKanban'
,
//
component: './kanban/evacuationProcessKanban',
},
//
},
{
//
{
path
:
'paintingProcessKanban'
,
//
path: 'paintingProcessKanban',
name
:
'paintingProcessKanban'
,
//
name: 'paintingProcessKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/paintingProcessKanban'
,
//
component: './kanban/paintingProcessKanban',
},
//
},
{
//
{
path
:
'airBottleProcessKanban'
,
//
path: 'airBottleProcessKanban',
name
:
'airBottleProcessKanban'
,
//
name: 'airBottleProcessKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/airBottleProcessKanban'
,
//
component: './kanban/airBottleProcessKanban',
},
//
},
{
//
{
path
:
'qiPingComprehensKanban'
,
//
path: 'qiPingComprehensKanban',
name
:
'qiPingComprehensKanban'
,
//
name: 'qiPingComprehensKanban',
target
:
'_blank'
,
//
target: '_blank',
layout
:
false
,
//
layout: false,
component
:
'./kanban/qipingComprehens'
,
//
component: './kanban/qipingComprehens',
},
//
},
// {
// {
// path: 'jiejingProduction',
// path: 'jiejingProduction',
// name: 'jiejingProduction',
// name: 'jiejingProduction',
...
@@ -518,7 +519,7 @@ export default [
...
@@ -518,7 +519,7 @@ export default [
],
],
},
},
{
{
key
:
'
personalSetting
'
,
key
:
'
def3
'
,
path
:
'/personalSetting'
,
path
:
'/personalSetting'
,
name
:
'personalSetting'
,
name
:
'personalSetting'
,
icon
:
'user'
,
icon
:
'user'
,
...
...
src/access.ts
View file @
196744fe
...
@@ -7,15 +7,9 @@ export default function access(initialState: {
...
@@ -7,15 +7,9 @@ export default function access(initialState: {
})
{
})
{
const
{
currentUser
,
permissions
}
=
initialState
||
{};
const
{
currentUser
,
permissions
}
=
initialState
||
{};
return
{
return
{
canAdmin
:
currentUser
&&
currentUser
.
roles
.
s
plit
(
','
).
s
ome
((
r
)
=>
r
===
'admin'
),
canAdmin
:
currentUser
&&
currentUser
.
roles
.
some
((
r
)
=>
r
===
'admin'
),
grantAccess
:
(
accessCode
:
string
)
=>
{
grantAccess
:
(
accessCode
:
string
)
=>
{
return
(
return
true
;
currentUser
&&
(
permissions
?.
findIndex
((
p
:
string
)
=>
p
?.
toUpperCase
()
===
accessCode
?.
toUpperCase
())
>=
0
||
accessCode
==
''
||
accessCode
==
undefined
)
);
},
},
};
};
}
}
src/app.tsx
View file @
196744fe
...
@@ -7,7 +7,6 @@ import RightContent from '@/components/RightContent';
...
@@ -7,7 +7,6 @@ import RightContent from '@/components/RightContent';
import
Footer
from
'@/components/Footer'
;
import
Footer
from
'@/components/Footer'
;
import
{
import
{
currentUser
as
queryCurrentUser
,
currentUser
as
queryCurrentUser
,
getPermission
,
token
as
getToken
,
token
as
getToken
,
}
from
'./services/mgr/api'
;
}
from
'./services/mgr/api'
;
import
{
import
{
...
@@ -22,7 +21,6 @@ import {
...
@@ -22,7 +21,6 @@ import {
UserOutlined
,
UserOutlined
,
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
{
decodeToken
}
from
'react-jwt'
;
import
{
decodeToken
}
from
'react-jwt'
;
import
{
getMenu
}
from
'@/services/mgr/api'
;
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
const
loginPath
=
'/user/login'
;
const
loginPath
=
'/user/login'
;
...
@@ -191,7 +189,7 @@ export async function getInitialState(): Promise<{
...
@@ -191,7 +189,7 @@ export async function getInitialState(): Promise<{
const
fetchUserInfo
=
async
()
=>
{
const
fetchUserInfo
=
async
()
=>
{
try
{
try
{
const
msg
=
await
queryCurrentUser
();
const
msg
=
await
queryCurrentUser
();
return
msg
.
data
;
return
msg
;
}
catch
(
error
)
{
}
catch
(
error
)
{
history
.
push
(
loginPath
);
history
.
push
(
loginPath
);
}
}
...
@@ -217,23 +215,17 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
...
@@ -217,23 +215,17 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
return
{
return
{
menu
:
{
menu
:
{
params
:
{
params
:
{
loginName
:
initialState
?.
currentUser
?.
login
Name
,
loginName
:
initialState
?.
currentUser
?.
user
?.
nick
Name
,
},
},
request
:
async
(
params
,
defaultMenuData
)
=>
{
request
:
async
(
params
,
defaultMenuData
)
=>
{
if
(
params
?.
loginName
)
{
if
(
params
?.
loginName
)
{
const
defaultResult
=
defaultMenuData
.
filter
((
item
:
any
)
=>
{
const
defaultResult
=
defaultMenuData
.
filter
((
item
:
any
)
=>
{
return
item
.
key
?.
substring
(
0
,
3
)
==
'def'
;
return
item
.
key
?.
substring
(
0
,
3
)
==
'def'
;
});
});
const
menuData
=
await
getMenu
(
params
.
loginName
);
const
result
=
defaultResult
;
menuData
.
forEach
((
item
:
any
)
=>
(
item
.
icon
=
iconMapping
[
item
.
icon
]));
extendMenuProp
([],
defaultMenuData
);
const
result
=
[...
defaultResult
,
...
menuData
];
extendMenuProp
(
menuData
,
defaultMenuData
);
const
menuPaths
=
extractMenuPath
(
result
);
const
menuPaths
=
extractMenuPath
(
result
);
await
setInitialState
((
s
)
=>
({
...
s
,
menuPaths
}));
await
setInitialState
((
s
)
=>
({
...
s
,
menuPaths
}));
const
permissions
=
await
getPermission
(
params
.
loginName
);
await
setInitialState
((
s
)
=>
({
...
s
,
permissions
}));
return
result
;
return
result
;
}
else
return
[];
}
else
return
[];
},
},
...
@@ -244,15 +236,15 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
...
@@ -244,15 +236,15 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
onPageChange
:
()
=>
{
onPageChange
:
()
=>
{
const
{
location
}
=
history
;
const
{
location
}
=
history
;
// 如果没有登录,重定向到 login
// 如果没有登录,重定向到 login
if
(
!
initialState
?.
currentUser
&&
location
.
pathname
!==
loginPath
)
{
//
if (!initialState?.currentUser && location.pathname !== loginPath) {
history
.
push
(
loginPath
);
//
history.push(loginPath);
}
//
}
// 用于处理直接修改浏览器地址,进入页面
//
//
用于处理直接修改浏览器地址,进入页面
if
(
initialState
?.
menuPaths
)
{
//
if (initialState?.menuPaths) {
if
(
!
matchPath
(
location
.
pathname
,
{
path
:
initialState
.
menuPaths
,
exact
:
true
}))
{
//
if (!matchPath(location.pathname, { path: initialState.menuPaths, exact: true })) {
history
.
push
(
'/404'
);
//
history.push('/404');
}
//
}
}
//
}
},
},
links
:
isDev
links
:
isDev
?
[
?
[
...
...
src/components/RightContent/AvatarDropdown.tsx
View file @
196744fe
...
@@ -53,7 +53,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
...
@@ -53,7 +53,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
const
{
currentUser
}
=
initialState
;
const
{
currentUser
}
=
initialState
;
if
(
!
currentUser
||
!
currentUser
.
n
ame
)
{
if
(
!
currentUser
||
!
currentUser
.
user
.
nickN
ame
)
{
return
loading
;
return
loading
;
}
}
...
@@ -83,7 +83,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
...
@@ -83,7 +83,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
<
HeaderDropdown
overlay=
{
menuHeaderDropdown
}
>
<
HeaderDropdown
overlay=
{
menuHeaderDropdown
}
>
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
Avatar
size=
"small"
className=
{
styles
.
avatar
}
src=
"/avatars/simple.svg"
alt=
"avatar"
/>
<
Avatar
size=
"small"
className=
{
styles
.
avatar
}
src=
"/avatars/simple.svg"
alt=
"avatar"
/>
<
span
className=
{
`${styles.name} anticon`
}
>
{
currentUser
.
n
ame
}
</
span
>
<
span
className=
{
`${styles.name} anticon`
}
>
{
currentUser
.
user
.
nickN
ame
}
</
span
>
</
span
>
</
span
>
</
HeaderDropdown
>
</
HeaderDropdown
>
);
);
...
...
src/pages/common/Pwd/index.tsx
View file @
196744fe
...
@@ -50,7 +50,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
...
@@ -50,7 +50,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
name=
"username"
name=
"username"
disabled=
{
true
}
disabled=
{
true
}
label=
{
'用户名'
}
label=
{
'用户名'
}
initialValue=
{
initialState
?.
currentUser
?.
login
Name
}
initialValue=
{
initialState
?.
currentUser
?.
user
?.
nick
Name
}
fieldProps=
{
{
fieldProps=
{
{
size
:
'large'
,
size
:
'large'
,
prefix
:
<
UserOutlined
className=
{
styles
.
prefixIcon
}
/>,
prefix
:
<
UserOutlined
className=
{
styles
.
prefixIcon
}
/>,
...
...
src/services/mgr/api.ts
View file @
196744fe
...
@@ -5,7 +5,8 @@ import { MenuDataItem } from '@umijs/route-utils';
...
@@ -5,7 +5,8 @@ import { MenuDataItem } from '@umijs/route-utils';
import
{
Modal
}
from
'antd'
;
import
{
Modal
}
from
'antd'
;
export
async
function
login
(
body
:
Api
.
LoginMgrParams
,
options
?:
{
[
key
:
string
]:
any
})
{
export
async
function
login
(
body
:
Api
.
LoginMgrParams
,
options
?:
{
[
key
:
string
]:
any
})
{
const
resData
=
request
<
Api
.
ServiceResult
<
Api
.
LoginResult
>>
(
'/api/login'
,
{
localStorage
.
removeItem
(
'token'
);
const
resData
=
request
<
Api
.
LoginResult
>
(
'/api/login'
,
{
method
:
'POST'
,
method
:
'POST'
,
headers
:
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
...
@@ -13,12 +14,12 @@ export async function login(body: Api.LoginMgrParams, options?: { [key: string]:
...
@@ -13,12 +14,12 @@ export async function login(body: Api.LoginMgrParams, options?: { [key: string]:
data
:
body
,
data
:
body
,
...(
options
||
{}),
...(
options
||
{}),
});
});
localStorage
.
setItem
(
'token'
,
(
await
resData
).
data
.
token
);
localStorage
.
setItem
(
'token'
,
(
await
resData
).
token
);
return
resData
;
return
resData
;
}
}
export
async
function
logout
(
options
?:
{
[
key
:
string
]:
any
})
{
export
async
function
logout
(
options
?:
{
[
key
:
string
]:
any
})
{
const
res
=
await
request
<
Api
.
ServiceResult
<
null
>>
(
'/api/log
in
out'
,
{
const
res
=
await
request
<
Api
.
ServiceResult
<
null
>>
(
'/api/logout'
,
{
method
:
'POST'
,
method
:
'POST'
,
headers
:
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
...
@@ -30,8 +31,8 @@ export async function logout(options?: { [key: string]: any }) {
...
@@ -30,8 +31,8 @@ export async function logout(options?: { [key: string]: any }) {
}
}
export
async
function
currentUser
(
options
?:
{
[
key
:
string
]:
any
})
{
export
async
function
currentUser
(
options
?:
{
[
key
:
string
]:
any
})
{
return
request
<
Api
.
ServiceResult
<
Api
.
CurrentUser
>>
(
'/api/currentuser
'
,
{
return
request
<
Api
.
CurrentUser
>
(
'/api/getInfo
'
,
{
method
:
'
POS
T'
,
method
:
'
GE
T'
,
headers
:
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
},
},
...
@@ -263,7 +264,6 @@ export async function getMenu(userName: string, options?: { [key: string]: any }
...
@@ -263,7 +264,6 @@ export async function getMenu(userName: string, options?: { [key: string]: any }
},
},
);
);
return
(
await
resData
).
data
as
MenuDataItem
[];
return
(
await
resData
).
data
as
MenuDataItem
[];
return
[]
as
MenuDataItem
[];
}
}
export
async
function
getPermission
(
userName
:
string
,
options
?:
{
[
key
:
string
]:
any
})
{
export
async
function
getPermission
(
userName
:
string
,
options
?:
{
[
key
:
string
]:
any
})
{
...
...
src/services/mgr/typing.d.ts
View file @
196744fe
...
@@ -84,9 +84,8 @@ declare namespace Api {
...
@@ -84,9 +84,8 @@ declare namespace Api {
}
&
IdDto
;
}
&
IdDto
;
type
CurrentUser
=
{
type
CurrentUser
=
{
loginName
:
string
;
user
:
any
;
name
:
string
;
roles
:
any
[];
roles
:
string
;
};
};
type
CurrentAccount
=
{
type
CurrentAccount
=
{
...
...
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