Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zlt2000
microservices-platform
提交
fcccb317
microservices-platform
项目概览
zlt2000
/
microservices-platform
9 个月 前同步成功
通知
16
Star
4
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
microservices-platform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fcccb317
编写于
10月 19, 2022
作者:
G
Gao Shan
提交者:
Gao Shan
10月 19, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增应用管理新增、修改功能
上级
36f9b6c1
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
702 addition
and
102 deletion
+702
-102
zlt-web/src/main/frontend/src/global.less
zlt-web/src/main/frontend/src/global.less
+5
-0
zlt-web/src/main/frontend/src/pages/files/File/index.tsx
zlt-web/src/main/frontend/src/pages/files/File/index.tsx
+5
-7
zlt-web/src/main/frontend/src/pages/system/App/components/CreateForm.tsx
...n/frontend/src/pages/system/App/components/CreateForm.tsx
+213
-0
zlt-web/src/main/frontend/src/pages/system/App/components/UpdateForm.tsx
...n/frontend/src/pages/system/App/components/UpdateForm.tsx
+203
-0
zlt-web/src/main/frontend/src/pages/system/App/index.tsx
zlt-web/src/main/frontend/src/pages/system/App/index.tsx
+113
-18
zlt-web/src/main/frontend/src/pages/system/Menu/index.less
zlt-web/src/main/frontend/src/pages/system/Menu/index.less
+1
-0
zlt-web/src/main/frontend/src/pages/system/Menu/index.tsx
zlt-web/src/main/frontend/src/pages/system/Menu/index.tsx
+76
-42
zlt-web/src/main/frontend/src/pages/system/Role/index.tsx
zlt-web/src/main/frontend/src/pages/system/Role/index.tsx
+30
-14
zlt-web/src/main/frontend/src/pages/system/Token/index.tsx
zlt-web/src/main/frontend/src/pages/system/Token/index.tsx
+33
-14
zlt-web/src/main/frontend/src/pages/system/User/index.tsx
zlt-web/src/main/frontend/src/pages/system/User/index.tsx
+1
-1
zlt-web/src/main/frontend/src/services/system/api.ts
zlt-web/src/main/frontend/src/services/system/api.ts
+20
-3
zlt-web/src/main/frontend/src/services/system/typings.d.ts
zlt-web/src/main/frontend/src/services/system/typings.d.ts
+2
-3
未找到文件。
zlt-web/src/main/frontend/src/global.less
浏览文件 @
fcccb317
...
...
@@ -17,6 +17,11 @@ body,
left: unset;
}
.hightligh{
background-color: @yellow-2 !important;
}
canvas {
display: block;
}
...
...
zlt-web/src/main/frontend/src/pages/files/File/index.tsx
浏览文件 @
fcccb317
import
{
deleteFile
,
file
}
from
'
@/services/files/api
'
;
import
type
{
ActionType
,
ProColumns
}
from
'
@ant-design/pro-components
'
;
import
{
ProFormSelect
,
PageContainer
,
ProFormText
,
ProTable
,
...
...
@@ -12,10 +11,10 @@ import React, { useRef, useState } from 'react';
const
{
Link
}
=
Typography
;
const
handleDelete
=
async
(
file
:
FILES
.
File
)
=>
{
const
handleDelete
=
async
(
delete
file
:
FILES
.
File
)
=>
{
const
hide
=
message
.
loading
(
'
正在删除
'
);
try
{
const
result
=
await
deleteFile
(
file
.
id
);
const
result
=
await
deleteFile
(
delete
file
.
id
);
hide
();
if
(
result
.
resp_code
===
0
)
{
message
.
success
(
'
删除File成功
'
);
...
...
@@ -33,7 +32,7 @@ const handleDelete = async (file: FILES.File) => {
const
TableList
:
React
.
FC
=
()
=>
{
const
actionRef
=
useRef
<
ActionType
>
();
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
({
tenantId
:
'
webApp
'
});
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
({
});
const
columns
:
ProColumns
<
FILES
.
File
>
[]
=
[
{
dataIndex
:
'
index
'
,
...
...
@@ -46,6 +45,7 @@ const TableList: React.FC = () => {
{
title
:
'
文件大小(B)
'
,
dataIndex
:
'
size
'
,
valueType
:
'
digit
'
,
},
{
title
:
'
媒体类型
'
,
...
...
@@ -68,7 +68,7 @@ const TableList: React.FC = () => {
title
:
'
操作
'
,
key
:
'
action
'
,
render
:
(
_
,
entity
)
=>
<
Popconfirm
title
=
{
`确认删除
File
?`
}
title
=
{
`确认删除
文件[
${
entity
.
name
}
]
?`
}
onConfirm
=
{
async
()
=>
{
const
success
=
await
handleDelete
(
entity
);
if
(
success
)
{
...
...
@@ -90,9 +90,7 @@ const TableList: React.FC = () => {
split
span
=
{
6
}
className
=
"query-filter"
initialValues
=
{
params
}
onFinish
=
{
async
(
values
)
=>
setParams
(
values
)
}
onReset
=
{
()
=>
setParams
({})
}
>
<
ProFormText
name
=
"name"
label
=
"搜索"
placeholder
=
"输入关键字"
/>
</
QueryFilter
>
...
...
zlt-web/src/main/frontend/src/pages/system/App/components/CreateForm.tsx
0 → 100644
浏览文件 @
fcccb317
import
{
ModalForm
,
ProForm
,
ProFormCheckbox
,
ProFormRadio
,
ProFormText
,
}
from
'
@ant-design/pro-components
'
;
import
React
from
'
react
'
;
export
type
FormValueType
=
{
authorizedGrantTypeCodes
?:
string
[];
}
&
Partial
<
SYSTEM
.
App
>
;
export
type
CreateFormProps
=
{
onVisibleChange
:
(
flag
:
boolean
)
=>
void
;
onSubmit
:
(
values
:
FormValueType
)
=>
Promise
<
void
>
;
visible
:
boolean
;
values
?:
SYSTEM
.
App
;
};
const
UpdateForm
:
React
.
FC
<
CreateFormProps
>
=
(
props
)
=>
{
return
(
<
ModalForm
title
=
"添加应用"
visible
=
{
props
.
visible
}
initialValues
=
{
{
autoapprove
:
'
true
'
,
accessTokenValiditySeconds
:
'
18000
'
,
refreshTokenValiditySeconds
:
'
28800
'
,
supportIdToken
:
'
true
'
,
idTokenValiditySeconds
:
'
60
'
,
authorizedGrantTypeCodes
:
'
authorization_code,password,client_credentials,implicit,refresh_token,password_code,openId,mobile_password
'
.
split
(
"
,
"
),
}
}
onFinish
=
{
props
.
onSubmit
}
modalProps
=
{
{
destroyOnClose
:
true
}
}
onVisibleChange
=
{
props
.
onVisibleChange
}
grid
=
{
true
}
rowProps
=
{
{
gutter
:
8
}
}
>
<
ProForm
.
Group
>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
应用标识不为空
'
,
},
]
}
colProps
=
{
{
span
:
12
}
}
width
=
"md"
name
=
"clientId"
label
=
"应用标识"
placeholder
=
"输入应用标识"
/>
<
ProFormText
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"clientName"
label
=
"应用名称"
placeholder
=
"输入应用名称"
/>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
应用密钥不为空
'
,
},
]
}
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"clientSecretStr"
label
=
"应用密钥"
placeholder
=
"输入应用密钥"
/>
<
ProFormText
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"webServerRedirectUri"
label
=
"回调地址"
placeholder
=
"输入回调地址"
/>
<
ProFormRadio
.
Group
name
=
"autoapprove"
label
=
"自动审批"
colProps
=
{
{
span
:
6
}
}
width
=
"lg"
options
=
{
[
{
label
:
'
是
'
,
value
:
'
true
'
,
},
{
label
:
'
否
'
,
value
:
'
false
'
,
},
]
}
/>
<
ProFormCheckbox
.
Group
name
=
"authorizedGrantTypeCodes"
label
=
"授权模式"
width
=
{
'
xl
'
}
colProps
=
{
{
span
:
18
}
}
options
=
{
[
{
label
:
'
授权码模式
'
,
value
:
'
authorization_code
'
,
},
{
label
:
'
密码模式
'
,
value
:
'
password
'
,
},
{
label
:
'
客户端模式
'
,
value
:
'
client_credentials
'
,
},
{
label
:
'
简化模式
'
,
value
:
'
implicit
'
,
},
{
label
:
'
刷新Token
'
,
value
:
'
refresh_token
'
,
},
{
label
:
'
密码验证码模式
'
,
value
:
'
password_code
'
,
},
{
label
:
'
openId模式
'
,
value
:
'
openId
'
,
},
{
label
:
'
手机号密码模式
'
,
value
:
'
mobile_password
'
,
},
]
}
/>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
令牌时效不为空
'
,
},
{
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'
g
'
),
message
:
'
令牌时效必须为整数
'
,
},
]
}
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"accessTokenValiditySeconds"
label
=
"令牌时效(s)"
placeholder
=
"输入令牌时效"
fieldProps
=
{
{
suffix
:
'
秒
'
}
}
/>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
刷新时效不为空
'
,
},
{
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'
g
'
),
message
:
'
刷新时效必须为整数
'
,
},
]
}
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"refreshTokenValiditySeconds"
label
=
"刷新时效(s)"
placeholder
=
"输入刷新时效"
fieldProps
=
{
{
suffix
:
'
秒
'
}
}
/>
<
ProFormRadio
.
Group
name
=
"supportIdToken"
label
=
"支持ID令牌"
width
=
"md"
colProps
=
{
{
span
:
12
}
}
options
=
{
[
{
label
:
'
是
'
,
value
:
true
,
},
{
label
:
'
否
'
,
value
:
false
,
},
]
}
/>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
ID时效不为空
'
,
},
{
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'
g
'
),
message
:
'
ID时效必须为整数
'
,
},
]
}
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"idTokenValiditySeconds"
label
=
"ID时效(s)"
placeholder
=
"输入ID时效"
fieldProps
=
{
{
suffix
:
'
秒
'
}
}
/>
</
ProForm
.
Group
>
</
ModalForm
>
);
};
export
default
UpdateForm
;
zlt-web/src/main/frontend/src/pages/system/App/components/UpdateForm.tsx
0 → 100644
浏览文件 @
fcccb317
import
{
ModalForm
,
ProForm
,
ProFormCheckbox
,
ProFormRadio
,
ProFormText
,
}
from
'
@ant-design/pro-components
'
;
import
{
Form
}
from
'
antd
'
;
import
React
,
{
useEffect
}
from
'
react
'
;
export
type
FormValueType
=
{
authorizedGrantTypeCodes
?:
string
[];
}
&
Partial
<
SYSTEM
.
App
>
;
export
type
UpdateFormProps
=
{
onVisibleChange
:
(
flag
:
boolean
)
=>
void
;
onSubmit
:
(
values
:
FormValueType
)
=>
Promise
<
void
>
;
visible
:
boolean
;
values
?:
SYSTEM
.
App
;
};
const
UpdateForm
:
React
.
FC
<
UpdateFormProps
>
=
(
props
)
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
values
}
=
props
;
useEffect
(()
=>
{
if
(
values
?.
authorizedGrantTypes
)
{
const
authorizedGrantTypeCodes
=
values
.
authorizedGrantTypes
.
split
(
"
,
"
)
const
formData
:
FormValueType
=
{
...
values
,
authorizedGrantTypeCodes
};
form
.
setFieldsValue
(
formData
);
}
},
[
form
,
values
]);
return
(
<
ModalForm
title
=
"修改应用"
form
=
{
form
}
visible
=
{
props
.
visible
}
onFinish
=
{
props
.
onSubmit
}
modalProps
=
{
{
destroyOnClose
:
true
}
}
onVisibleChange
=
{
props
.
onVisibleChange
}
grid
=
{
true
}
rowProps
=
{
{
gutter
:
8
}
}
>
<
ProForm
.
Group
>
<
ProFormText
readonly
colProps
=
{
{
span
:
12
}
}
width
=
"md"
name
=
"clientId"
label
=
"应用标识"
/>
<
ProFormText
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"clientName"
label
=
"应用名称"
placeholder
=
"输入应用名称"
/>
<
ProFormText
readonly
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"clientSecretStr"
label
=
"应用密钥"
/>
<
ProFormText
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"webServerRedirectUri"
label
=
"回调地址"
placeholder
=
"输入回调地址"
/>
<
ProFormRadio
.
Group
name
=
"autoapprove"
label
=
"自动审批"
colProps
=
{
{
span
:
6
}
}
width
=
"lg"
options
=
{
[
{
label
:
'
是
'
,
value
:
'
true
'
,
},
{
label
:
'
否
'
,
value
:
'
false
'
,
},
]
}
/>
<
ProFormCheckbox
.
Group
name
=
"authorizedGrantTypeCodes"
label
=
"授权模式"
width
=
{
'
xl
'
}
colProps
=
{
{
span
:
18
}
}
options
=
{
[
{
label
:
'
授权码模式
'
,
value
:
'
authorization_code
'
,
},
{
label
:
'
密码模式
'
,
value
:
'
password
'
,
},
{
label
:
'
客户端模式
'
,
value
:
'
client_credentials
'
,
},
{
label
:
'
简化模式
'
,
value
:
'
implicit
'
,
},
{
label
:
'
刷新Token
'
,
value
:
'
refresh_token
'
,
},
{
label
:
'
密码验证码模式
'
,
value
:
'
password_code
'
,
},
{
label
:
'
openId模式
'
,
value
:
'
openId
'
,
},
{
label
:
'
手机号密码模式
'
,
value
:
'
mobile_password
'
,
},
]
}
/>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
令牌时效不为空
'
,
},
{
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'
g
'
),
message
:
'
令牌时效必须为整数
'
,
},
]
}
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"accessTokenValiditySeconds"
label
=
"令牌时效(s)"
placeholder
=
"输入令牌时效"
fieldProps
=
{
{
suffix
:
'
秒
'
}
}
/>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
刷新时效不为空
'
,
},
{
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'
g
'
),
message
:
'
刷新时效必须为整数
'
,
},
]
}
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"refreshTokenValiditySeconds"
label
=
"刷新时效(s)"
placeholder
=
"输入刷新时效"
fieldProps
=
{
{
suffix
:
'
秒
'
}
}
/>
<
ProFormRadio
.
Group
name
=
"supportIdToken"
label
=
"支持ID令牌"
width
=
"md"
colProps
=
{
{
span
:
12
}
}
options
=
{
[
{
label
:
'
是
'
,
value
:
true
,
},
{
label
:
'
否
'
,
value
:
false
,
},
]
}
/>
<
ProFormText
rules
=
{
[
{
required
:
true
,
message
:
'
ID时效不为空
'
,
},
{
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'
g
'
),
message
:
'
ID时效必须为整数
'
,
},
]
}
width
=
"md"
colProps
=
{
{
span
:
12
}
}
name
=
"idTokenValiditySeconds"
label
=
"ID时效(s)"
placeholder
=
"输入ID时效"
fieldProps
=
{
{
suffix
:
'
秒
'
}
}
/>
</
ProForm
.
Group
>
</
ModalForm
>
);
};
export
default
UpdateForm
;
zlt-web/src/main/frontend/src/pages/system/App/index.tsx
浏览文件 @
fcccb317
import
{
app
,
deleteApp
}
from
'
@/services/system/api
'
;
import
{
app
,
saveOrUpdateApp
,
deleteApp
}
from
'
@/services/system/api
'
;
import
{
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
type
{
ActionType
,
ProColumns
}
from
'
@ant-design/pro-components
'
;
import
{
PageContainer
,
ProFormText
,
ProTable
,
QueryFilter
}
from
'
@ant-design/pro-components
'
;
import
{
Typography
,
message
,
Popconfirm
,
Button
}
from
'
antd
'
;
import
{
Typography
,
message
,
Popconfirm
,
Button
,
Space
}
from
'
antd
'
;
import
React
,
{
useRef
,
useState
}
from
'
react
'
;
import
CreateForm
from
'
./components/CreateForm
'
;
import
UpdateForm
from
'
./components/UpdateForm
'
;
const
{
Link
}
=
Typography
;
const
handleAdd
=
async
(
fields
:
SYSTEM
.
App
)
=>
{
const
hide
=
message
.
loading
(
'
正在添加
'
);
try
{
const
result
=
await
saveOrUpdateApp
({
...
fields
});
hide
();
if
(
result
.
resp_code
===
0
)
{
message
.
success
(
'
添加应用成功
'
);
return
true
;
}
else
{
message
.
error
(
result
.
resp_msg
);
return
false
;
}
}
catch
(
error
)
{
hide
();
message
.
error
(
'
添加应用失败
'
);
return
false
;
}
};
const
handleEdit
=
async
(
fields
:
SYSTEM
.
App
)
=>
{
const
hide
=
message
.
loading
(
'
正在更新
'
);
try
{
const
result
=
await
saveOrUpdateApp
({
...
fields
});
hide
();
if
(
result
.
resp_code
===
0
)
{
message
.
success
(
'
修改应用成功
'
);
return
true
;
}
else
{
message
.
error
(
result
.
resp_msg
);
return
false
;
}
}
catch
(
error
)
{
hide
();
message
.
error
(
'
修改应用失败
'
);
return
false
;
}
};
const
handleDelete
=
async
(
data
:
SYSTEM
.
App
)
=>
{
if
(
!
data
.
id
)
{
message
.
error
(
'
缺少ID信息,删除应用失败
'
);
return
false
;
}
const
hide
=
message
.
loading
(
'
正在删除
'
);
try
{
await
deleteApp
(
data
.
id
);
...
...
@@ -24,6 +68,9 @@ const handleDelete = async (data: SYSTEM.App) => {
const
TableList
:
React
.
FC
=
()
=>
{
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
();
const
actionRef
=
useRef
<
ActionType
>
();
const
[
createModalVisible
,
handleCreateModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
updateModalVisible
,
handleUpdateModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
currentRow
,
setCurrentRow
]
=
useState
<
SYSTEM
.
App
>
();
const
columns
:
ProColumns
<
SYSTEM
.
App
>
[]
=
[
{
dataIndex
:
'
index
'
,
...
...
@@ -56,7 +103,7 @@ const TableList: React.FC = () => {
key
:
'
autoapprove
'
,
width
:
40
,
align
:
'
center
'
,
render
:
(
_
,
record
)
=>
(
record
.
autoapprove
===
'
true
'
?
'
是
'
:
'
否
'
),
render
Text
:
(
_
,
record
)
=>
(
record
.
autoapprove
===
'
true
'
?
'
是
'
:
'
否
'
),
},
{
title
:
'
令牌时效
'
,
...
...
@@ -75,7 +122,7 @@ const TableList: React.FC = () => {
key
:
'
supportIdToken
'
,
width
:
40
,
align
:
'
center
'
,
render
:
(
_
,
record
)
=>
(
record
.
supportIdToken
?
'
是
'
:
'
否
'
),
render
Text
:
(
_
,
record
)
=>
(
record
.
supportIdToken
?
'
是
'
:
'
否
'
),
},
{
title
:
'
ID时效
'
,
...
...
@@ -88,19 +135,31 @@ const TableList: React.FC = () => {
key
:
'
action
'
,
fixed
:
'
right
'
,
width
:
40
,
render
:
(
_
,
entity
)
=>
<
Popconfirm
title
=
{
`确认删除用户[
${
entity
.
clientName
}
]?`
}
onConfirm
=
{
async
()
=>
{
const
success
=
await
handleDelete
(
entity
);
if
(
success
)
{
if
(
actionRef
.
current
)
{
actionRef
.
current
.
reload
();
}
}
}
}
>
<
Link
>
删除
</
Link
>
</
Popconfirm
>,
render
:
(
_
,
entity
)
=>
(
<
Space
>
<
Link
onClick
=
{
()
=>
{
setCurrentRow
(
entity
);
handleUpdateModalVisible
(
true
);
}
}
>
修改
</
Link
>
<
Popconfirm
title
=
{
`确认删除应用[
${
entity
.
clientId
}
]?`
}
onConfirm
=
{
async
()
=>
{
const
success
=
await
handleDelete
(
entity
);
if
(
success
)
{
if
(
actionRef
.
current
)
{
actionRef
.
current
.
reload
();
}
}
}
}
>
<
Link
>
删除
</
Link
>
</
Popconfirm
>
</
Space
>
),
},
];
return
(
...
...
@@ -133,7 +192,7 @@ const TableList: React.FC = () => {
<
Button
type
=
"primary"
onClick
=
{
()
=>
{
handleModalVisible
(
true
);
handle
Create
ModalVisible
(
true
);
}
}
>
<
PlusOutlined
/>
添加
...
...
@@ -141,6 +200,42 @@ const TableList: React.FC = () => {
</>,
]
}
/>
<
CreateForm
visible
=
{
createModalVisible
}
onVisibleChange
=
{
handleCreateModalVisible
}
onSubmit
=
{
async
(
values
)
=>
{
const
authorizedGrantTypeCodes
:
string
[]
=
values
.
authorizedGrantTypeCodes
||
[];
const
authorizedGrantTypes
=
authorizedGrantTypeCodes
.
join
(
'
,
'
);
delete
values
.
authorizedGrantTypeCodes
;
const
success
=
await
handleAdd
({
...
values
,
authorizedGrantTypes
});
if
(
success
)
{
handleCreateModalVisible
(
false
);
if
(
actionRef
.
current
)
{
actionRef
.
current
.
reload
();
}
}
}
}
/>
<
UpdateForm
onSubmit
=
{
async
(
values
)
=>
{
if
(
currentRow
)
{
const
authorizedGrantTypeCodes
:
string
[]
=
values
.
authorizedGrantTypeCodes
||
[];
const
authorizedGrantTypes
=
authorizedGrantTypeCodes
.
join
(
'
,
'
);
delete
values
.
authorizedGrantTypeCodes
;
const
success
=
await
handleEdit
({
...
currentRow
,
...
values
,
authorizedGrantTypes
});
if
(
success
)
{
handleUpdateModalVisible
(
false
);
if
(
actionRef
.
current
)
{
actionRef
.
current
.
reload
();
}
}
setCurrentRow
(
undefined
);
}
}
}
onVisibleChange
=
{
handleUpdateModalVisible
}
visible
=
{
updateModalVisible
}
values
=
{
currentRow
}
/>
</
PageContainer
>
);
};
...
...
zlt-web/src/main/frontend/src/pages/system/Menu/index.less
浏览文件 @
fcccb317
@import (reference) '~antd/es/style/themes/index';
zlt-web/src/main/frontend/src/pages/system/Menu/index.tsx
浏览文件 @
fcccb317
import
{
deleteMenus
,
menu
,
menuOnes
,
saveOrUpdateMenus
}
from
'
@/services/system/api
'
;
import
{
appAll
,
deleteMenus
,
menu
,
menuOnes
,
saveOrUpdateMenus
}
from
'
@/services/system/api
'
;
import
{
treeify
}
from
'
@/util/treeify
'
;
import
{
FolderOpenOutlined
,
MenuOutlined
,
PlusOutlined
,
ProfileOutlined
,
}
from
'
@ant-design/icons
'
;
import
{
idIDIntl
,
ProColumns
,
ProFormDigit
}
from
'
@ant-design/pro-components
'
;
import
{
ProFormRadio
,
ProFormTreeSelect
,
ProForm
,
ProFormSelect
}
from
'
@ant-design/pro-components
'
;
import
{
PageContainer
,
ProFormText
,
ProTable
,
QueryFilter
,
ModalForm
}
from
'
@ant-design/pro-components
'
;
import
{
Button
,
Space
,
Tag
,
Typography
,
TreeSelect
,
message
,
Popconfirm
}
from
'
antd
'
;
import
{
FolderOpenOutlined
,
MenuOutlined
,
PlusOutlined
,
ProfileOutlined
}
from
'
@ant-design/icons
'
;
import
type
{
ActionType
,
ProColumns
}
from
'
@ant-design/pro-components
'
;
import
{
ProFormDigit
}
from
'
@ant-design/pro-components
'
;
import
{
ProFormRadio
,
ProFormTreeSelect
,
ProForm
,
ProFormSelect
,
}
from
'
@ant-design/pro-components
'
;
import
{
PageContainer
,
ProFormText
,
ProTable
,
QueryFilter
,
ModalForm
,
}
from
'
@ant-design/pro-components
'
;
import
{
Button
,
Space
,
Tag
,
Typography
,
message
,
Popconfirm
}
from
'
antd
'
;
import
React
,
{
useRef
,
useEffect
,
useState
}
from
'
react
'
;
import
UpdateForm
from
'
./components/UpdateForm
'
;
const
{
Link
}
=
Typography
;
const
handleAdd
=
async
(
fields
:
SYSTEM
.
Menu
)
=>
{
...
...
@@ -67,28 +80,42 @@ const handleDelete = async (sysUser: SYSTEM.Menu) => {
}
};
const
Generator
:
React
.
FC
=
()
=>
{
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
({
tenantId
:
'
webApp
'
});
const
[
tenantId
,
setTenantId
]
=
useState
<
string
>
();
const
[
keyword
,
setKeyword
]
=
useState
<
string
>
();
const
[
apps
,
setApps
]
=
useState
<
SYSTEM
.
App
[]
>
([]);
const
actionRef
=
useRef
<
ActionType
>
();
const
[
createModalVisible
,
handleModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
updateModalVisible
,
handleUpdateModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
currentRow
,
setCurrentRow
]
=
useState
<
SYSTEM
.
Menu
>
();
const
[
data
,
setData
]
=
useState
<
SYSTEM
.
Menu
[]
>
();
const
[
keys
,
setKeys
]
=
useState
<
(
React
.
Key
)
[]
>
([]);
const
[
expandedRowKeys
,
setExpandedRowKeys
]
=
useState
<
(
React
.
Key
)
[]
>
([]);
const
[
keys
,
setKeys
]
=
useState
<
React
.
Key
[]
>
([]);
const
[
expandedRowKeys
,
setExpandedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
const
query
=
async
(
params
:
Record
<
string
,
string
|
number
>
)
=>
{
const
menus
=
await
menu
(
params
);
const
query
=
async
(
clientId
:
string
)
=>
{
const
menus
=
await
menu
(
clientId
);
const
treeData
=
treeify
(
menus
,
{});
menus
.
forEach
((
node
)
=>
{
if
(
node
.
children
&&
node
.
children
.
length
===
0
)
delete
node
.
children
;
});
setKeys
(
menus
.
map
(
m
=>
m
.
id
));
setKeys
(
menus
.
map
(
(
m
)
=>
m
.
id
));
setData
(
treeData
);
};
// useEffect(() => {
// query({ tenantId: 'webApp' });
// }, []);
useEffect
(()
=>
{
query
({
tenantId
:
'
webApp
'
});
(
async
()
=>
{
const
appData
=
(
await
appAll
())
||
[];
setApps
(
appData
);
if
(
appData
.
length
>
0
)
{
const
clientId
=
appData
[
0
].
clientId
;
setTenantId
(
clientId
);
query
(
clientId
);
}
})();
},
[]);
const
columns
:
ProColumns
<
SYSTEM
.
Menu
>
[]
=
[
...
...
@@ -96,6 +123,10 @@ const Generator: React.FC = () => {
title
:
'
菜单名称
'
,
key
:
'
name
'
,
width
:
120
,
onCell
:
(
record
)
=>
{
if
(
keyword
&&
record
.
name
?.
includes
(
keyword
))
return
{
className
:
'
hightligh
'
};
return
{};
},
render
(
dom
,
entity
)
{
if
(
entity
.
type
===
1
)
{
if
(
entity
.
url
?.
startsWith
(
'
javascript
'
))
{
...
...
@@ -127,12 +158,20 @@ const Generator: React.FC = () => {
title
:
'
菜单url
'
,
dataIndex
:
'
url
'
,
width
:
100
,
onCell
:
(
record
)
=>
{
if
(
keyword
&&
record
.
url
?.
includes
(
keyword
))
return
{
className
:
'
hightligh
'
};
return
{};
},
},
{
title
:
'
菜单path
'
,
dataIndex
:
'
path
'
,
width
:
100
,
ellipsis
:
true
,
onCell
:
(
record
)
=>
{
if
(
keyword
&&
record
.
path
?.
includes
(
keyword
))
return
{
className
:
'
hightligh
'
};
return
{};
},
},
{
title
:
'
样式
'
,
...
...
@@ -193,27 +232,32 @@ const Generator: React.FC = () => {
},
];
return
(
<
PageContainer
header
=
{
{
subTitle
:
'
生成代码
'
}
}
>
<
PageContainer
header
=
{
{
subTitle
:
'
维护系统菜单
'
}
}
>
<
QueryFilter
defaultCollapsed
split
span
=
{
6
}
initialValues
=
{
params
}
className
=
"query-filter"
onFinish
=
{
async
(
values
)
=>
query
(
values
)
}
onFinish
=
{
async
(
values
)
=>
{
setExpandedRowKeys
(
keys
);
setKeyword
(
values
.
searchValue
);
}
}
// onReset={() => setParams({})}
>
<
ProFormSelect
name
=
"tenantId"
label
=
"所属应用"
fieldProps
=
{
{
onChange
:
async
(
values
)
=>
query
({
tenantId
:
values
})
}
}
valueEnum
=
{
{
webApp
:
'
pc端
'
,
app
:
'
移动端
'
,
zlt
:
'
第三方应用
'
,
value
:
tenantId
,
allowClear
:
false
,
onChange
:
async
(
values
)
=>
{
setTenantId
(
values
);
query
(
values
);
}
,
}
}
options
=
{
apps
.
map
((
item
)
=>
{
return
{
label
:
item
.
clientId
,
value
:
item
.
clientId
};
})
}
/>
<
ProFormText
name
=
"searchValue"
/>
</
QueryFilter
>
...
...
@@ -227,7 +271,7 @@ const Generator: React.FC = () => {
menus
.
forEach
((
node
)
=>
{
if
(
node
.
children
&&
node
.
children
.
length
===
0
)
delete
node
.
children
;
});
setKeys
(
menus
.
map
(
m
=>
m
.
id
));
setKeys
(
menus
.
map
(
(
m
)
=>
m
.
id
));
setData
(
treeData
);
}
}
dataSource=
{
data
}
...
...
@@ -270,7 +314,7 @@ const Generator: React.FC = () => {
// layout="horizontal"
visible
=
{
createModalVisible
}
onVisibleChange
=
{
handleModalVisible
}
modalProps
=
{
{
destroyOnClose
:
true
,
okText
:
"
保存
"
}
}
modalProps
=
{
{
destroyOnClose
:
true
,
okText
:
'
保存
'
}
}
onFinish
=
{
async
(
values
)
=>
{
const
success
=
await
handleAdd
(
values
as
SYSTEM
.
Menu
);
if
(
success
)
{
...
...
@@ -289,11 +333,11 @@ const Generator: React.FC = () => {
request
=
{
async
()
=>
{
const
menus
=
await
menuOnes
();
if
(
menus
)
{
let
a
=
menus
.
map
(
item
=>
{
return
{
...
item
,
key
:
item
.
id
,
title
:
item
.
name
,
value
:
item
.
id
}
})
le
t
treeData
=
treeify
(
a
,
{});
le
t
root
=
{
const
a
=
menus
.
map
((
item
)
=>
{
return
{
...
item
,
key
:
item
.
id
,
title
:
item
.
name
,
value
:
item
.
id
}
;
})
;
cons
t
treeData
=
treeify
(
a
,
{});
cons
t
root
=
{
title
:
'
顶级目录
'
,
value
:
-
1
,
key
:
-
1
,
...
...
@@ -324,18 +368,8 @@ const Generator: React.FC = () => {
label
=
"菜单名"
placeholder
=
"输入菜单名"
/>
<
ProFormText
width
=
"md"
name
=
"url"
label
=
"菜单url"
placeholder
=
"输入菜单url"
/>
<
ProFormText
width
=
"md"
name
=
"path"
label
=
"菜单path"
placeholder
=
"输入菜单path"
/>
<
ProFormText
width
=
"md"
name
=
"url"
label
=
"菜单url"
placeholder
=
"输入菜单url"
/>
<
ProFormText
width
=
"md"
name
=
"path"
label
=
"菜单path"
placeholder
=
"输入菜单path"
/>
<
ProFormText
rules
=
{
[
{
...
...
zlt-web/src/main/frontend/src/pages/system/Role/index.tsx
浏览文件 @
fcccb317
import
{
deleteRole
,
pageRole
,
saveOrUpdateRole
}
from
'
@/services/system/api
'
;
import
{
appAll
,
deleteRole
,
pageRole
,
saveOrUpdateRole
}
from
'
@/services/system/api
'
;
import
{
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
type
{
ActionType
,
ProColumns
}
from
'
@ant-design/pro-components
'
;
import
{
...
...
@@ -10,9 +10,9 @@ import {
ProTable
,
QueryFilter
,
}
from
'
@ant-design/pro-components
'
;
import
{
Popconfirm
,
Space
,
Typography
}
from
'
antd
'
;
import
{
Form
,
Popconfirm
,
Space
,
Typography
}
from
'
antd
'
;
import
{
Button
,
message
}
from
'
antd
'
;
import
React
,
{
useRef
,
useState
}
from
'
react
'
;
import
React
,
{
use
Effect
,
use
Ref
,
useState
}
from
'
react
'
;
import
AssignAuth
from
'
./components/AssignAuth
'
;
import
UpdateForm
from
'
./components/UpdateForm
'
;
...
...
@@ -82,8 +82,10 @@ const handleDelete = async (data: SYSTEM.Role) => {
};
const
TableList
:
React
.
FC
=
()
=>
{
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
({
tenantId
:
'
webApp
'
});
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
({});
const
[
form
]
=
Form
.
useForm
();
const
actionRef
=
useRef
<
ActionType
>
();
const
[
apps
,
setApps
]
=
useState
<
SYSTEM
.
App
[]
>
([]);
const
[
createModalVisible
,
handleModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
updateModalVisible
,
handleUpdateModalVisible
]
=
useState
<
boolean
>
(
false
);
...
...
@@ -91,6 +93,18 @@ const TableList: React.FC = () => {
const
[
assignAuth
,
setAssignAuth
]
=
useState
<
AssignAuthProps
>
({
assignModalVisible
:
false
});
useEffect
(()
=>
{
(
async
()
=>
{
const
appData
=
(
await
appAll
())
||
[];
setApps
(
appData
);
if
(
appData
.
length
>
0
)
{
const
tenantId
=
appData
[
0
].
clientId
;
setParams
({
tenantId
});
form
.
setFieldsValue
({
tenantId
});
}
})();
},
[
form
]);
const
columns
:
ProColumns
<
SYSTEM
.
Role
>
[]
=
[
{
dataIndex
:
'
index
'
,
...
...
@@ -157,22 +171,24 @@ const TableList: React.FC = () => {
defaultCollapsed
split
span
=
{
6
}
initialValues
=
{
params
}
form
=
{
form
}
className
=
"query-filter"
onValuesChange
=
{
(
changedValues
,
allValues
)
=>
{
if
(
changedValues
.
tenantId
)
setParams
(
allValues
);
}
}
onFinish
=
{
async
(
values
)
=>
setParams
(
values
)
}
onReset
=
{
async
()
=>
setParams
({
tenantId
:
'
webApp
'
})
}
onReset
=
{
()
=>
{
form
.
setFieldsValue
({
tenantId
:
params
.
tenantId
});
setParams
({
tenantId
:
params
.
tenantId
});
}
}
>
<
ProFormSelect
name
=
"tenantId"
label
=
"所属应用"
fieldProps
=
{
{
onChange
:
async
(
values
)
=>
setParams
({
tenantId
:
values
})
}
}
valueEnum
=
{
{
webApp
:
'
pc端
'
,
app
:
'
移动端
'
,
zlt
:
'
第三方应用
'
,
}
}
allowClear
=
{
false
}
options
=
{
apps
.
map
((
item
)
=>
{
return
{
label
:
item
.
clientId
,
value
:
item
.
clientId
};
})
}
/>
<
ProFormSelect
name
=
"searchKey"
...
...
zlt-web/src/main/frontend/src/pages/system/Token/index.tsx
浏览文件 @
fcccb317
import
{
deleteToken
,
token
}
from
'
@/services/system/api
'
;
import
{
appAll
,
deleteToken
,
token
}
from
'
@/services/system/api
'
;
import
type
{
ActionType
,
ProColumns
}
from
'
@ant-design/pro-components
'
;
import
{
ProFormSelect
,
...
...
@@ -7,15 +7,15 @@ import {
ProTable
,
QueryFilter
,
}
from
'
@ant-design/pro-components
'
;
import
{
Typography
,
message
,
Popconfirm
}
from
'
antd
'
;
import
React
,
{
useRef
,
useState
}
from
'
react
'
;
import
{
Typography
,
message
,
Popconfirm
,
Form
}
from
'
antd
'
;
import
React
,
{
use
Effect
,
use
Ref
,
useState
}
from
'
react
'
;
const
{
Link
}
=
Typography
;
const
handleDelete
=
async
(
t
oken
:
SYSTEM
.
Token
)
=>
{
const
handleDelete
=
async
(
delT
oken
:
SYSTEM
.
Token
)
=>
{
const
hide
=
message
.
loading
(
'
正在删除
'
);
try
{
const
result
=
await
deleteToken
(
t
oken
.
tokenValue
);
const
result
=
await
deleteToken
(
delT
oken
.
tokenValue
);
hide
();
if
(
result
.
resp_code
===
0
)
{
message
.
success
(
'
删除Token成功
'
);
...
...
@@ -32,8 +32,22 @@ const handleDelete = async (token: SYSTEM.Token) => {
};
const
TableList
:
React
.
FC
=
()
=>
{
const
[
form
]
=
Form
.
useForm
();
const
actionRef
=
useRef
<
ActionType
>
();
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
({
tenantId
:
'
webApp
'
});
const
[
apps
,
setApps
]
=
useState
<
SYSTEM
.
App
[]
>
([]);
const
[
params
,
setParams
]
=
useState
<
Record
<
string
,
string
|
number
>>
({});
useEffect
(()
=>
{
(
async
()
=>
{
const
appData
=
(
await
appAll
())
||
[];
setApps
(
appData
);
if
(
appData
.
length
>
0
)
{
const
tenantId
=
appData
[
0
].
clientId
;
setParams
({
tenantId
});
form
.
setFieldsValue
({
tenantId
});
}
})();
},
[
form
]);
const
columns
:
ProColumns
<
SYSTEM
.
Token
>
[]
=
[
{
dataIndex
:
'
index
'
,
...
...
@@ -89,23 +103,28 @@ const TableList: React.FC = () => {
defaultCollapsed
split
span
=
{
6
}
form
=
{
form
}
className
=
"query-filter"
initialValues
=
{
params
}
onValuesChange
=
{
(
changedValues
,
allValues
)
=>
{
if
(
changedValues
.
tenantId
)
setParams
(
allValues
);
}
}
onFinish
=
{
async
(
values
)
=>
setParams
(
values
)
}
onReset
=
{
async
()
=>
setParams
({
tenantId
:
"
webApp
"
})
}
onReset
=
{
()
=>
{
form
.
setFieldsValue
({
tenantId
:
params
.
tenantId
});
setParams
({
tenantId
:
params
.
tenantId
});
}
}
>
<
ProFormSelect
name
=
"tenantId"
label
=
"所属应用"
fieldProps
=
{
{
value
:
params
.
tenantId
,
allowClear
:
false
,
onChange
:
async
(
values
)
=>
setParams
({
tenantId
:
values
})
}
}
valueEnum
=
{
{
webApp
:
'
pc端
'
,
app
:
'
移动端
'
,
zlt
:
'
第三方应用
'
,
}
}
allowClear
=
{
false
}
options
=
{
apps
.
map
((
item
)
=>
{
return
{
label
:
item
.
clientId
,
value
:
item
.
clientId
};
})
}
/>
<
ProFormText
name
=
"username"
label
=
"搜索"
placeholder
=
"输入用户名"
/>
</
QueryFilter
>
...
...
zlt-web/src/main/frontend/src/pages/system/User/index.tsx
浏览文件 @
fcccb317
...
...
@@ -173,7 +173,7 @@ const TableList: React.FC = () => {
{
title
:
'
性别
'
,
dataIndex
:
'
sex
'
,
render
:
(
value
)
=>
(
value
===
0
?
'
男
'
:
'
女
'
),
render
Text
:
(
value
)
=>
(
value
===
0
?
'
男
'
:
'
女
'
),
},
{
title
:
'
创建时间
'
,
...
...
zlt-web/src/main/frontend/src/services/system/api.ts
浏览文件 @
fcccb317
...
...
@@ -86,6 +86,7 @@ export async function role() {
}
export
async
function
pageRole
(
params
?:
{
[
key
:
string
]:
string
|
number
})
{
if
(
!
params
||
!
params
.
tenantId
)
return
{}
const
{
current
,
pageSize
,
...
rest
}
=
params
??
{};
const
result
=
await
request
<
SYSTEM
.
Page
<
SYSTEM
.
Role
>>
(
'
/api-user/roles
'
,
{
method
:
'
GET
'
,
...
...
@@ -121,6 +122,7 @@ export async function menuForAuth(roleId: number, tenantId: string) {
export
async
function
token
(
params
?:
{
[
key
:
string
]:
string
|
number
})
{
if
(
!
params
||
!
params
.
tenantId
)
return
{}
const
{
current
,
pageSize
,
...
rest
}
=
params
??
{};
const
result
=
await
request
<
SYSTEM
.
Page
<
SYSTEM
.
Token
>>
(
'
/api-uaa/tokens
'
,
{
method
:
'
GET
'
,
...
...
@@ -138,6 +140,21 @@ export async function app(params?: { [key: string]: string | number }) {
return
{
data
:
result
.
data
,
total
:
result
.
count
};
}
export
async
function
appAll
()
{
const
result
=
await
request
<
API
.
Result
<
SYSTEM
.
App
>>
(
'
/api-uaa/clients/all
'
,
{
method
:
'
GET
'
,
});
return
result
.
datas
;
}
export
async
function
saveOrUpdateApp
(
data
:
SYSTEM
.
App
):
Promise
<
API
.
Result
<
SYSTEM
.
App
>>
{
const
result
=
await
request
<
API
.
Result
<
SYSTEM
.
App
>>
(
'
/api-uaa/clients/saveOrUpdate
'
,
{
method
:
'
POST
'
,
data
,
});
return
result
;
}
export
async
function
deleteApp
(
id
:
number
)
{
const
url
=
`/api-uaa/clients/
${
id
}
`
await
request
<
void
>
(
url
,
{
...
...
@@ -165,10 +182,10 @@ export function exportGenerator(tables: string) {
});
}
export
async
function
menu
(
params
:
{
[
key
:
string
]:
string
|
number
}
)
{
export
async
function
menu
(
tenantId
:
string
)
{
const
result
=
await
request
<
SYSTEM
.
Page
<
SYSTEM
.
Menu
>>
(
'
/api-user/menus/findAlls
'
,
{
method
:
'
GET
'
,
params
,
params
:
{
tenantId
}
,
});
return
result
.
data
;
}
...
...
@@ -211,4 +228,4 @@ export async function deleteToken(token: string) {
params
:
{
token
}
});
return
result
;
}
\ No newline at end of file
}
zlt-web/src/main/frontend/src/services/system/typings.d.ts
浏览文件 @
fcccb317
...
...
@@ -30,7 +30,6 @@ declare namespace SYSTEM {
del
?:
boolean
;
roles
?:
Role
[];
roleId
?:
string
;
headImgUrl
?:
string
;
};
type
Menu
=
{
...
...
@@ -62,13 +61,13 @@ declare namespace SYSTEM {
};
type
App
=
{
id
:
number
;
id
?
:
number
;
accessTokenValiditySeconds
?:
number
;
additionalInformation
?:
string
;
authorities
?:
string
;
authorizedGrantTypes
?:
string
;
autoapprove
?:
string
;
clientId
?
:
string
;
clientId
:
string
;
clientName
?:
string
;
clientSecret
?:
string
;
clientSecretStr
?:
string
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录