Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chatGLM
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
1
Merge Requests
1
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
刘坚-丰林-DEV
chatGLM
Commits
4cbcf488
Commit
4cbcf488
authored
Apr 16, 2023
by
littleforest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: finished search tool
parent
bf91a50a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
68 deletions
+109
-68
index.tsx
src/components/Footer/index.tsx
+2
-27
zh-CN.ts
src/locales/zh-CN.ts
+1
-1
index.less
src/pages/UserManage/index.less
+9
-0
index.tsx
src/pages/UserManage/index.tsx
+90
-40
api.ts
src/services/chatGLM/api.ts
+7
-0
No files found.
src/components/Footer/index.tsx
View file @
4cbcf488
import
{
GithubOutlined
}
from
'@ant-design/icons'
;
import
{
DefaultFooter
}
from
'@ant-design/pro-components'
;
import
{
DefaultFooter
}
from
'@ant-design/pro-components'
;
import
{
useIntl
}
from
'umi'
;
import
{
useIntl
}
from
'umi'
;
...
@@ -6,36 +5,12 @@ const Footer: React.FC = () => {
...
@@ -6,36 +5,12 @@ const Footer: React.FC = () => {
const
intl
=
useIntl
();
const
intl
=
useIntl
();
const
defaultMessage
=
intl
.
formatMessage
({
const
defaultMessage
=
intl
.
formatMessage
({
id
:
'app.copyright.produced'
,
id
:
'app.copyright.produced'
,
defaultMessage
:
'
蚂蚁集团体验技术部出品
'
,
defaultMessage
:
'
2023 长沙振升集团有限公司
'
,
});
});
const
currentYear
=
new
Date
().
getFullYear
();
const
currentYear
=
new
Date
().
getFullYear
();
return
(
return
<
DefaultFooter
copyright=
{
`${currentYear} ${defaultMessage}`
}
/>;
<
DefaultFooter
copyright=
{
`${currentYear} ${defaultMessage}`
}
links=
{
[
{
key
:
'Ant Design Pro'
,
title
:
'Ant Design Pro'
,
href
:
'https://pro.ant.design'
,
blankTarget
:
true
,
},
{
key
:
'github'
,
title
:
<
GithubOutlined
/>,
href
:
'https://github.com/ant-design/ant-design-pro'
,
blankTarget
:
true
,
},
{
key
:
'Ant Design'
,
title
:
'Ant Design'
,
href
:
'https://ant.design'
,
blankTarget
:
true
,
},
]
}
/>
);
};
};
export
default
Footer
;
export
default
Footer
;
src/locales/zh-CN.ts
View file @
4cbcf488
...
@@ -11,7 +11,7 @@ export default {
...
@@ -11,7 +11,7 @@ export default {
'layout.user.link.help'
:
'帮助'
,
'layout.user.link.help'
:
'帮助'
,
'layout.user.link.privacy'
:
'隐私'
,
'layout.user.link.privacy'
:
'隐私'
,
'layout.user.link.terms'
:
'条款'
,
'layout.user.link.terms'
:
'条款'
,
'app.copyright.produced'
:
'
蚂蚁集团体验技术部出品
'
,
'app.copyright.produced'
:
'
长沙振升集团有限公司
'
,
'app.preview.down.block'
:
'下载此页面到本地项目'
,
'app.preview.down.block'
:
'下载此页面到本地项目'
,
'app.welcome.link.fetch-blocks'
:
'获取全部区块'
,
'app.welcome.link.fetch-blocks'
:
'获取全部区块'
,
'app.welcome.link.block-list'
:
'基于 block 开发,快速构建标准页面'
,
'app.welcome.link.block-list'
:
'基于 block 开发,快速构建标准页面'
,
...
...
src/pages/UserManage/index.less
View file @
4cbcf488
...
@@ -41,3 +41,12 @@
...
@@ -41,3 +41,12 @@
font-family: PingFangSC-Regular, PingFang SC;
font-family: PingFangSC-Regular, PingFang SC;
line-height: 22px;
line-height: 22px;
}
}
.footer {
height: 20px;
color: rgba(0, 0, 0, 0.45);
font-weight: 400;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
line-height: 20px;
text-align: center;
}
src/pages/UserManage/index.tsx
View file @
4cbcf488
...
@@ -4,12 +4,25 @@ import {
...
@@ -4,12 +4,25 @@ import {
getUserMessage
,
getUserMessage
,
postDeleteUser
,
postDeleteUser
,
postResetUser
,
postResetUser
,
postEditUser
,
}
from
'@/services/chatGLM/api'
;
}
from
'@/services/chatGLM/api'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
type
{
ActionType
}
from
'@ant-design/pro-components'
;
import
type
{
ActionType
}
from
'@ant-design/pro-components'
;
import
{
PageContainer
}
from
'@ant-design/pro-components'
;
import
{
PageContainer
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
Button
,
Col
,
Divider
,
Form
,
Input
,
Modal
,
Radio
,
Row
,
Switch
,
message
}
from
'antd'
;
import
{
Button
,
Col
,
Divider
,
Form
,
Input
,
Modal
,
Radio
,
Row
,
Select
,
Switch
,
message
,
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
classNames
from
'classnames'
;
import
{
isEmpty
}
from
'lodash'
;
import
{
isEmpty
}
from
'lodash'
;
import
{
useRef
,
useState
}
from
'react'
;
import
{
useRef
,
useState
}
from
'react'
;
...
@@ -30,6 +43,9 @@ const UserManage = () => {
...
@@ -30,6 +43,9 @@ const UserManage = () => {
const
actionRef
=
useRef
<
ActionType
>
();
const
actionRef
=
useRef
<
ActionType
>
();
const
[
isModalAccountOpen
,
setIsModalAccountOpen
]
=
useState
(
false
);
const
[
isModalAccountOpen
,
setIsModalAccountOpen
]
=
useState
(
false
);
const
[
isModalDeleteAccountOpen
,
setIsModalDeleteAccountOpen
]
=
useState
(
false
);
const
[
isModalDeleteAccountOpen
,
setIsModalDeleteAccountOpen
]
=
useState
(
false
);
const
[
editMessage
,
setEditMessage
]
=
useState
({
id
:
''
,
});
const
[
deleteMessage
,
setDeleteMessage
]
=
useState
({
const
[
deleteMessage
,
setDeleteMessage
]
=
useState
({
name
:
''
,
name
:
''
,
id
:
' '
,
id
:
' '
,
...
@@ -44,16 +60,17 @@ const UserManage = () => {
...
@@ -44,16 +60,17 @@ const UserManage = () => {
const
[
accountModalName
,
setAccountModalName
]
=
useState
(
'新建账号'
);
const
[
accountModalName
,
setAccountModalName
]
=
useState
(
'新建账号'
);
const
[
accountForm
]
=
Form
.
useForm
();
const
[
accountForm
]
=
Form
.
useForm
();
const
isActiveSelectOption
=
[
{
label
:
'启用'
,
value
:
true
},
{
label
:
'禁用'
,
value
:
false
},
];
const
showModal
=
()
=>
{
const
showModal
=
()
=>
{
getRole
()
getRole
().
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
!
isEmpty
(
res
))
{
if
(
!
isEmpty
(
res
))
{
setRoles
(
res
);
setRoles
(
res
);
setIsModalAccountOpen
(
true
);
setIsModalAccountOpen
(
true
);
}
}
})
.
catch
((
err
)
=>
{
message
.
error
(
'获取用户权限失败,请重试'
);
});
});
};
};
...
@@ -66,6 +83,7 @@ const UserManage = () => {
...
@@ -66,6 +83,7 @@ const UserManage = () => {
{
{
title
:
'用户账号'
,
title
:
'用户账号'
,
dataIndex
:
'userName'
,
dataIndex
:
'userName'
,
hideInSearch
:
true
,
ellipsis
:
true
,
ellipsis
:
true
,
},
},
{
{
...
@@ -76,8 +94,18 @@ const UserManage = () => {
...
@@ -76,8 +94,18 @@ const UserManage = () => {
},
},
{
{
title
:
'账号状态'
,
title
:
'账号状态'
,
dataIndex
:
'iaActive'
,
dataIndex
:
'isActive'
,
hideInSearch
:
true
,
valueType
:
'select'
,
valueEnum
:
{
true
:
{
text
:
'启用'
,
status
:
'Success'
,
},
false
:
{
text
:
'禁用'
,
status
:
'Error'
,
},
},
render
(
text
,
record
)
{
render
(
text
,
record
)
{
return
(
return
(
<
div
className=
{
styles
.
isActive
}
>
<
div
className=
{
styles
.
isActive
}
>
...
@@ -108,7 +136,7 @@ const UserManage = () => {
...
@@ -108,7 +136,7 @@ const UserManage = () => {
key=
"editable"
key=
"editable"
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setAccountModalName
(
'编辑账号'
);
setAccountModalName
(
'编辑账号'
);
s
howModal
(
);
s
etEditMessage
({
id
:
record
.
id
}
);
const
data
=
{
const
data
=
{
id
:
record
.
id
,
id
:
record
.
id
,
Name
:
record
.
name
,
Name
:
record
.
name
,
...
@@ -117,7 +145,7 @@ const UserManage = () => {
...
@@ -117,7 +145,7 @@ const UserManage = () => {
isActive
:
record
.
isActive
,
isActive
:
record
.
isActive
,
};
};
accountForm
.
setFieldsValue
(
data
);
accountForm
.
setFieldsValue
(
data
);
console
.
log
(
data
);
showModal
(
);
}
}
}
}
>
>
编辑
编辑
...
@@ -165,6 +193,8 @@ const UserManage = () => {
...
@@ -165,6 +193,8 @@ const UserManage = () => {
CreatedAccount
(
values
)
CreatedAccount
(
values
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
setLoading
(
false
);
setLoading
(
false
);
setIsModalAccountOpen
(
false
);
actionRef
.
current
?.
reload
();
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -173,6 +203,20 @@ const UserManage = () => {
...
@@ -173,6 +203,20 @@ const UserManage = () => {
const
editAccountFinish
=
(
values
:
any
)
=>
{
const
editAccountFinish
=
(
values
:
any
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
const
data
=
{
...
values
,
id
:
editMessage
.
id
,
};
postEditUser
(
data
)
.
then
((
res
)
=>
{
setLoading
(
false
);
setIsModalAccountOpen
(
false
);
message
.
success
(
'编辑成功'
);
actionRef
.
current
?.
reload
();
})
.
catch
((
error
)
=>
{
setLoading
(
false
);
});
};
};
const
onHandleClickAccountFinish
=
(
values
:
any
)
=>
{
const
onHandleClickAccountFinish
=
(
values
:
any
)
=>
{
...
@@ -323,6 +367,8 @@ const UserManage = () => {
...
@@ -323,6 +367,8 @@ const UserManage = () => {
onFinish=
{
onHandleClickAccountFinish
}
onFinish=
{
onHandleClickAccountFinish
}
name=
"accountSetting"
name=
"accountSetting"
>
>
{
accountModalName
===
'添加账号'
&&
(
<>
<
Item
<
Item
name=
{
'UserName'
}
name=
{
'UserName'
}
label=
"用户账号"
label=
"用户账号"
...
@@ -333,14 +379,17 @@ const UserManage = () => {
...
@@ -333,14 +379,17 @@ const UserManage = () => {
>
>
<
Input
/>
<
Input
/>
</
Item
>
</
Item
>
{
accountModalName
===
'添加账号'
&&
(
<
Item
<
Item
name=
{
'Password'
}
name=
{
'Password'
}
label=
"密码"
label=
"密码"
rules=
{
[{
required
:
true
,
message
:
'请输入密码!'
},
{
validator
:
validatePassword
}]
}
rules=
{
[
{
required
:
true
,
message
:
'请输入密码!'
},
{
validator
:
validatePassword
},
]
}
>
>
<
Input
/>
<
Input
/>
</
Item
>
</
Item
>
</>
)
}
)
}
<
Item
name=
{
'Role'
}
label=
"角色"
rules=
{
[{
required
:
true
,
message
:
'请设置你的角色'
}]
}
>
<
Item
name=
{
'Role'
}
label=
"角色"
rules=
{
[{
required
:
true
,
message
:
'请设置你的角色'
}]
}
>
<
Radio
.
Group
>
<
Radio
.
Group
>
...
@@ -356,8 +405,8 @@ const UserManage = () => {
...
@@ -356,8 +405,8 @@ const UserManage = () => {
<
Item
name=
{
'Name'
}
label=
"姓名"
rules=
{
[{
required
:
true
,
message
:
'请输入你的姓名'
}]
}
>
<
Item
name=
{
'Name'
}
label=
"姓名"
rules=
{
[{
required
:
true
,
message
:
'请输入你的姓名'
}]
}
>
<
Input
placeholder=
"请输入(必填)"
/>
<
Input
placeholder=
"请输入(必填)"
/>
</
Item
>
</
Item
>
<
Item
name=
{
'isActive'
}
label=
"是否启用
"
>
<
Item
label=
"是否启用"
name=
{
'isActive'
}
valuePropName=
"checked
"
>
<
Switch
/>
<
Switch
checked
/>
</
Item
>
</
Item
>
<
Divider
/>
<
Divider
/>
<
Row
justify=
{
'end'
}
gutter=
{
8
}
>
<
Row
justify=
{
'end'
}
gutter=
{
8
}
>
...
@@ -382,18 +431,19 @@ const UserManage = () => {
...
@@ -382,18 +431,19 @@ const UserManage = () => {
columns=
{
columns
}
columns=
{
columns
}
actionRef=
{
actionRef
}
actionRef=
{
actionRef
}
cardBordered
cardBordered
request=
{
async
(
params
=
{},
sort
,
filter
)
=>
{
request=
{
async
(
params
=
{
pageSize
:
10
,
current
:
0
},
sort
,
filter
)
=>
{
console
.
log
(
sort
,
filter
,
params
);
const
defaultParams
=
{
const
defaultParams
=
{
Name
:
null
,
Name
:
!
isEmpty
(
params
?.
name
)
?
params
?.
name
:
null
,
Enabled
:
null
,
Enabled
:
!
isEmpty
(
params
?.
isActive
)
?
params
?.
isActive
:
null
,
PageSize
:
10
,
PageSize
:
params
.
pageSize
,
PageIndex
:
0
,
PageIndex
:
params
?.
current
-
1
,
};
};
const
response
=
await
getUserMessage
(
defaultParams
);
const
response
=
await
getUserMessage
(
defaultParams
);
return
{
return
{
data
:
response
.
items
,
data
:
response
.
items
,
total
:
response
.
totalCount
,
total
:
response
.
totalCount
,
success
:
true
,
success
:
!
isEmpty
(
response
)
,
};
};
}
}
}
}
rowKey=
"id"
rowKey=
"id"
...
...
src/services/chatGLM/api.ts
View file @
4cbcf488
...
@@ -105,3 +105,10 @@ export const postResetUser = (params?: any): Promise<string> => {
...
@@ -105,3 +105,10 @@ export const postResetUser = (params?: any): Promise<string> => {
body
:
JSON
.
stringify
(
params
),
body
:
JSON
.
stringify
(
params
),
});
});
};
};
export
const
postEditUser
=
(
params
?:
any
):
Promise
<
string
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/User/update'
,
{
method
:
'POST'
,
body
:
JSON
.
stringify
(
params
),
});
};
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