Unverified Commit 33886c4a authored by gaoyan's avatar gaoyan Committed by GitHub

Modify userlist page,add userType column (#2038)

* fix BusException logic error if BusException.msg is empty, use I18n message * modify user list page, add usertype column, and disable passwordChange model
parent baa8cbd8
...@@ -65,6 +65,7 @@ export default { ...@@ -65,6 +65,7 @@ export default {
'user.username': 'User Name', 'user.username': 'User Name',
'user.jobnumber': 'Job Number', 'user.jobnumber': 'Job Number',
'user.phone': 'Phone Number', 'user.phone': 'Phone Number',
'user.type': 'User Type',
'user.nickname': 'Nick Name', 'user.nickname': 'Nick Name',
'user.create': 'Create User', 'user.create': 'Create User',
'user.update': 'Modify User', 'user.update': 'Modify User',
......
...@@ -62,6 +62,7 @@ export default { ...@@ -62,6 +62,7 @@ export default {
'user.username': '用户名', 'user.username': '用户名',
'user.jobnumber': '工号', 'user.jobnumber': '工号',
'user.phone': '手机号', 'user.phone': '手机号',
'user.type': '注册类型',
'user.nickname': '昵称', 'user.nickname': '昵称',
'user.create': '添加用户', 'user.create': '添加用户',
'user.update': '修改用户', 'user.update': '修改用户',
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
import React, {useEffect, useRef, useState} from "react"; import React, {useRef, useState} from "react";
import {LockTwoTone} from "@ant-design/icons"; import {LockTwoTone} from "@ant-design/icons";
import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table"; import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table";
import {Button} from "antd"; import {Button} from "antd";
...@@ -41,6 +41,7 @@ import {CreateBtn} from "@/components/CallBackButton/CreateBtn"; ...@@ -41,6 +41,7 @@ import {CreateBtn} from "@/components/CallBackButton/CreateBtn";
import PasswordModal from "@/pages/AuthCenter/User/components/PasswordModal"; import PasswordModal from "@/pages/AuthCenter/User/components/PasswordModal";
import RoleModalTransfer from "../RoleModalTransfer"; import RoleModalTransfer from "../RoleModalTransfer";
import UserModalForm from "@/pages/AuthCenter/User/components/UserModalForm"; import UserModalForm from "@/pages/AuthCenter/User/components/UserModalForm";
import {USER_TYPE_ENUM, UserType} from "@/pages/AuthCenter/User/components/constants";
const UserProTable = () => { const UserProTable = () => {
...@@ -151,81 +152,90 @@ const UserProTable = () => { ...@@ -151,81 +152,90 @@ const UserProTable = () => {
}; };
/** /**
* table columns * table columns
*/ */
const columns: ProColumns<UserBaseInfo.User>[] = [ const columns: ProColumns<UserBaseInfo.User>[] = [
{ {
title: l("user.username"), title: l("user.username"),
dataIndex: "username", dataIndex: "username",
}, },
{ {
title: l("user.nickname"), title: l("user.nickname"),
dataIndex: "nickname", dataIndex: "nickname",
}, },
{ {
title: l("user.jobnumber"), title: l("user.jobnumber"),
dataIndex: "worknum", dataIndex: "worknum",
}, },
{ {
title: l("user.phone"), title: l("user.phone"),
dataIndex: "mobile", dataIndex: "mobile",
hideInSearch: true, hideInSearch: true,
}, },
{ {
title: l("global.table.isEnable"), title: l("user.type"),
dataIndex: "enabled", dataIndex: "userType",
hideInSearch: true, valueEnum: USER_TYPE_ENUM()
render: (_: any, record: UserBaseInfo.User) => { },
return <EnableSwitchBtn key={`${record.id}_enable`} record={record} {
onChange={() => handleChangeEnable(record)}/>; title: l("global.table.isEnable"),
}, dataIndex: "enabled",
filters: STATUS_MAPPING(), hideInSearch: true,
filterMultiple: false, render: (_: any, record: UserBaseInfo.User) => {
valueEnum: STATUS_ENUM(), return <EnableSwitchBtn key={`${record.id}_enable`} record={record}
}, onChange={() => handleChangeEnable(record)}/>;
{ },
title: l("global.table.createTime"), filters: STATUS_MAPPING(),
dataIndex: "createTime", filterMultiple: false,
sorter: true, valueEnum: STATUS_ENUM(),
valueType: "dateTime", },
hideInTable: true, {
hideInSearch: true, title: l("global.table.createTime"),
}, dataIndex: "createTime",
{ sorter: true,
title: l("global.table.updateTime"), valueType: "dateTime",
dataIndex: "updateTime", hideInTable: true,
hideInSearch: true, hideInSearch: true,
sorter: true, },
valueType: "dateTime", {
}, title: l("global.table.updateTime"),
{ dataIndex: "updateTime",
title: l("global.table.operate"), hideInSearch: true,
valueType: "option", sorter: true,
width: "12vh", valueType: "dateTime",
render: (_: any, record: UserBaseInfo.User) => [ },
<EditBtn key={`${record.id}_edit`} onClick={() => handleEditVisible(record)}/>, {
<AssignBtn key={`${record.id}_delete`} onClick={() => handleAssignRole(record)} title: l("global.table.operate"),
title={l('user.assignRole')}/>, valueType: "option",
<Button width: "12vh",
className={"options-button"} render: (_: any, record: UserBaseInfo.User) => [
key={`${record.id}_change`} <EditBtn key={`${record.id}_edit`} onClick={() => handleEditVisible(record)}/>,
icon={<LockTwoTone/>} <AssignBtn key={`${record.id}_delete`} onClick={() => handleAssignRole(record)}
title={l("button.changePassword")} title={l('user.assignRole')}/>,
onClick={() => { <>
handleChangePassword(record); {record.userType == UserType.LOCAL &&
}} <Button
/>, className={"options-button"}
<> key={`${record.id}_change`}
{(access.canAdmin && record.username !== "admin") && icon={<LockTwoTone/>}
<PopconfirmDeleteBtn key={`${record.id}_delete`} onClick={() => handleDeleteUser(record)} title={l("button.changePassword")}
description={l("user.deleteConfirm")}/> onClick={() => {
} handleChangePassword(record);
</> }}
, />
], }
}, </>,
]; <>
{(access.canAdmin && record.username !== "admin") &&
<PopconfirmDeleteBtn key={`${record.id}_delete`} onClick={() => handleDeleteUser(record)}
description={l("user.deleteConfirm")}/>
}
</>
,
],
},
];
/** /**
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const UserType = {LOCAL:0, LDAP:1}
export const USER_TYPE_ENUM = () => {
return {0: "LOCAL", 1: "LDAP"}
}
...@@ -24,6 +24,7 @@ declare namespace UserBaseInfo { ...@@ -24,6 +24,7 @@ declare namespace UserBaseInfo {
password?: string; password?: string;
avatar?: string; avatar?: string;
worknum?: string; worknum?: string;
userType?: number;
mobile?: string; mobile?: string;
enabled: boolean; enabled: boolean;
isDelete: boolean; isDelete: boolean;
...@@ -61,4 +62,4 @@ export type RowPermissions = ExcludeNameAndEnableColumns & { ...@@ -61,4 +62,4 @@ export type RowPermissions = ExcludeNameAndEnableColumns & {
roleName: string; roleName: string;
tableName: string; tableName: string;
expression: string; expression: string;
}; };
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment