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 {
'user.username': 'User Name',
'user.jobnumber': 'Job Number',
'user.phone': 'Phone Number',
'user.type': 'User Type',
'user.nickname': 'Nick Name',
'user.create': 'Create User',
'user.update': 'Modify User',
......
......@@ -62,6 +62,7 @@ export default {
'user.username': '用户名',
'user.jobnumber': '工号',
'user.phone': '手机号',
'user.type': '注册类型',
'user.nickname': '昵称',
'user.create': '添加用户',
'user.update': '修改用户',
......
......@@ -18,7 +18,7 @@
*/
import React, {useEffect, useRef, useState} from "react";
import React, {useRef, useState} from "react";
import {LockTwoTone} from "@ant-design/icons";
import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table";
import {Button} from "antd";
......@@ -41,6 +41,7 @@ import {CreateBtn} from "@/components/CallBackButton/CreateBtn";
import PasswordModal from "@/pages/AuthCenter/User/components/PasswordModal";
import RoleModalTransfer from "../RoleModalTransfer";
import UserModalForm from "@/pages/AuthCenter/User/components/UserModalForm";
import {USER_TYPE_ENUM, UserType} from "@/pages/AuthCenter/User/components/constants";
const UserProTable = () => {
......@@ -151,81 +152,90 @@ const UserProTable = () => {
};
/**
* table columns
*/
const columns: ProColumns<UserBaseInfo.User>[] = [
{
title: l("user.username"),
dataIndex: "username",
},
{
title: l("user.nickname"),
dataIndex: "nickname",
},
{
title: l("user.jobnumber"),
dataIndex: "worknum",
},
{
title: l("user.phone"),
dataIndex: "mobile",
hideInSearch: true,
},
{
title: l("global.table.isEnable"),
dataIndex: "enabled",
hideInSearch: true,
render: (_: any, record: UserBaseInfo.User) => {
return <EnableSwitchBtn key={`${record.id}_enable`} record={record}
onChange={() => handleChangeEnable(record)}/>;
},
filters: STATUS_MAPPING(),
filterMultiple: false,
valueEnum: STATUS_ENUM(),
},
{
title: l("global.table.createTime"),
dataIndex: "createTime",
sorter: true,
valueType: "dateTime",
hideInTable: true,
hideInSearch: true,
},
{
title: l("global.table.updateTime"),
dataIndex: "updateTime",
hideInSearch: true,
sorter: true,
valueType: "dateTime",
},
{
title: l("global.table.operate"),
valueType: "option",
width: "12vh",
render: (_: any, record: UserBaseInfo.User) => [
<EditBtn key={`${record.id}_edit`} onClick={() => handleEditVisible(record)}/>,
<AssignBtn key={`${record.id}_delete`} onClick={() => handleAssignRole(record)}
title={l('user.assignRole')}/>,
<Button
className={"options-button"}
key={`${record.id}_change`}
icon={<LockTwoTone/>}
title={l("button.changePassword")}
onClick={() => {
handleChangePassword(record);
}}
/>,
<>
{(access.canAdmin && record.username !== "admin") &&
<PopconfirmDeleteBtn key={`${record.id}_delete`} onClick={() => handleDeleteUser(record)}
description={l("user.deleteConfirm")}/>
}
</>
,
],
},
];
/**
* table columns
*/
const columns: ProColumns<UserBaseInfo.User>[] = [
{
title: l("user.username"),
dataIndex: "username",
},
{
title: l("user.nickname"),
dataIndex: "nickname",
},
{
title: l("user.jobnumber"),
dataIndex: "worknum",
},
{
title: l("user.phone"),
dataIndex: "mobile",
hideInSearch: true,
},
{
title: l("user.type"),
dataIndex: "userType",
valueEnum: USER_TYPE_ENUM()
},
{
title: l("global.table.isEnable"),
dataIndex: "enabled",
hideInSearch: true,
render: (_: any, record: UserBaseInfo.User) => {
return <EnableSwitchBtn key={`${record.id}_enable`} record={record}
onChange={() => handleChangeEnable(record)}/>;
},
filters: STATUS_MAPPING(),
filterMultiple: false,
valueEnum: STATUS_ENUM(),
},
{
title: l("global.table.createTime"),
dataIndex: "createTime",
sorter: true,
valueType: "dateTime",
hideInTable: true,
hideInSearch: true,
},
{
title: l("global.table.updateTime"),
dataIndex: "updateTime",
hideInSearch: true,
sorter: true,
valueType: "dateTime",
},
{
title: l("global.table.operate"),
valueType: "option",
width: "12vh",
render: (_: any, record: UserBaseInfo.User) => [
<EditBtn key={`${record.id}_edit`} onClick={() => handleEditVisible(record)}/>,
<AssignBtn key={`${record.id}_delete`} onClick={() => handleAssignRole(record)}
title={l('user.assignRole')}/>,
<>
{record.userType == UserType.LOCAL &&
<Button
className={"options-button"}
key={`${record.id}_change`}
icon={<LockTwoTone/>}
title={l("button.changePassword")}
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 {
password?: string;
avatar?: string;
worknum?: string;
userType?: number;
mobile?: string;
enabled: boolean;
isDelete: boolean;
......@@ -61,4 +62,4 @@ export type RowPermissions = ExcludeNameAndEnableColumns & {
roleName: string;
tableName: 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