Merge branch 'master' of https://10.60.166.105:52302/coscoshipping/fe_service_ebtp_frontend
This commit is contained in:
@ -140,6 +140,12 @@ export default [
|
|||||||
path: '/biddingAnnouncement/BiddingAnnoStructureForm',
|
path: '/biddingAnnouncement/BiddingAnnoStructureForm',
|
||||||
component: './Bid/BiddingAnnouncement/structure/BiddingAnnoStructureForm',
|
component: './Bid/BiddingAnnouncement/structure/BiddingAnnoStructureForm',
|
||||||
},
|
},
|
||||||
|
//供应商账号管理
|
||||||
|
{
|
||||||
|
name: '供应商',
|
||||||
|
path: '/SupplierUser',
|
||||||
|
component: './System/SupplierUser',
|
||||||
|
},
|
||||||
//==============================================================引入的业务路由
|
//==============================================================引入的业务路由
|
||||||
...approvalForm,//审批单
|
...approvalForm,//审批单
|
||||||
...juryRoom,//评标室内所有路由
|
...juryRoom,//评标室内所有路由
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
"@ant-design/pro-table": "2.34.0",
|
"@ant-design/pro-table": "2.34.0",
|
||||||
"@material-ui/core": "4.11.3",
|
"@material-ui/core": "4.11.3",
|
||||||
"@types/react-cookies": "0.1.0",
|
"@types/react-cookies": "0.1.0",
|
||||||
|
"@umijs/max": "^4.0.0",
|
||||||
"@umijs/route-utils": "1.0.37",
|
"@umijs/route-utils": "1.0.37",
|
||||||
"antd": "latest-4",
|
"antd": "latest-4",
|
||||||
"array-move": "3.0.1",
|
"array-move": "3.0.1",
|
||||||
@ -90,7 +91,6 @@
|
|||||||
"react-signature-canvas": "^1.0.3",
|
"react-signature-canvas": "^1.0.3",
|
||||||
"react-sortable-hoc": "^1.11.0",
|
"react-sortable-hoc": "^1.11.0",
|
||||||
"sm-crypto": "0.2.5",
|
"sm-crypto": "0.2.5",
|
||||||
"@umijs/max": "^4.0.0",
|
|
||||||
"umi-request": "^1.3.5",
|
"umi-request": "^1.3.5",
|
||||||
"use-merge-value": "1.0.2",
|
"use-merge-value": "1.0.2",
|
||||||
"wangeditor": "4.7.5"
|
"wangeditor": "4.7.5"
|
||||||
@ -109,6 +109,7 @@
|
|||||||
"@types/react-helmet": "^6.1.0",
|
"@types/react-helmet": "^6.1.0",
|
||||||
"@types/react-signature-canvas": "^1.0.2",
|
"@types/react-signature-canvas": "^1.0.2",
|
||||||
"@umijs/lint": "^4.0.0",
|
"@umijs/lint": "^4.0.0",
|
||||||
|
"@umijs/yorkie": "^2.0.5",
|
||||||
"carlo": "^0.9.46",
|
"carlo": "^0.9.46",
|
||||||
"chalk": "^4.0.0",
|
"chalk": "^4.0.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
99
src/pages/System/SupplierUser/components/UpdateForm.tsx
Normal file
99
src/pages/System/SupplierUser/components/UpdateForm.tsx
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Form, Input, Select } from 'antd';
|
||||||
|
import type { SupplierUserListItem } from '../data.d';
|
||||||
|
|
||||||
|
export interface UpdateFormProps {
|
||||||
|
onCancel: () => void;
|
||||||
|
onSubmit: (values: SupplierUserListItem) => void;
|
||||||
|
updateModalVisible: boolean;
|
||||||
|
values: Partial<SupplierUserListItem>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FormItem = Form.Item;
|
||||||
|
const { Option } = Select;
|
||||||
|
|
||||||
|
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { updateModalVisible, onCancel, onSubmit, values } = props;
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
const fieldsValue = await form.validateFields();
|
||||||
|
onSubmit({ ...values, ...fieldsValue });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
destroyOnClose
|
||||||
|
title="修改供应商用户"
|
||||||
|
visible={updateModalVisible}
|
||||||
|
onCancel={onCancel}
|
||||||
|
onOk={handleSubmit}
|
||||||
|
>
|
||||||
|
<Form
|
||||||
|
form={form}
|
||||||
|
initialValues={{
|
||||||
|
username: values.username,
|
||||||
|
name: values.name,
|
||||||
|
mobile: values.mobile,
|
||||||
|
status: values.status,
|
||||||
|
email: values.email,
|
||||||
|
remark: values.remark,
|
||||||
|
}}
|
||||||
|
layout="vertical"
|
||||||
|
>
|
||||||
|
<FormItem
|
||||||
|
name="username"
|
||||||
|
label="用户名"
|
||||||
|
rules={[{ required: true, message: '请输入用户名' }]}
|
||||||
|
>
|
||||||
|
<Input disabled placeholder="请输入用户名" />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
name="name"
|
||||||
|
label="姓名"
|
||||||
|
rules={[{ required: true, message: '请输入姓名' }]}
|
||||||
|
>
|
||||||
|
<Input placeholder="请输入姓名" />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
name="mobile"
|
||||||
|
label="手机号"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: '请输入手机号' },
|
||||||
|
{ pattern: /^1\d{10}$/, message: '手机号格式不正确' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input placeholder="请输入手机号" />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
name="email"
|
||||||
|
label="邮箱"
|
||||||
|
rules={[
|
||||||
|
{ required: false },
|
||||||
|
{ type: 'email', message: '邮箱格式不正确' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input placeholder="请输入邮箱" />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
name="status"
|
||||||
|
label="状态"
|
||||||
|
rules={[{ required: true, message: '请选择状态' }]}
|
||||||
|
>
|
||||||
|
<Select placeholder="请选择状态">
|
||||||
|
<Option value={1}>有效</Option>
|
||||||
|
<Option value={0}>无效</Option>
|
||||||
|
</Select>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
name="remark"
|
||||||
|
label="备注"
|
||||||
|
>
|
||||||
|
<Input.TextArea placeholder="请输入备注" rows={4} />
|
||||||
|
</FormItem>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default UpdateForm;
|
30
src/pages/System/SupplierUser/data.d.ts
vendored
Normal file
30
src/pages/System/SupplierUser/data.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
export interface SupplierUserListItem {
|
||||||
|
userId: string;
|
||||||
|
username: string;
|
||||||
|
name: string;
|
||||||
|
mobile: string;
|
||||||
|
supplierName: string;
|
||||||
|
creditCode: string;
|
||||||
|
status: number;
|
||||||
|
email?: string;
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TableListPagination {
|
||||||
|
total: number;
|
||||||
|
pageSize: number;
|
||||||
|
current: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TableListData {
|
||||||
|
list: SupplierUserListItem[];
|
||||||
|
pagination: Partial<TableListPagination>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TableListParams {
|
||||||
|
pageSize?: number;
|
||||||
|
current?: number;
|
||||||
|
keyword?: string;
|
||||||
|
status?: number;
|
||||||
|
sorter?: string;
|
||||||
|
}
|
178
src/pages/System/SupplierUser/index.tsx
Normal file
178
src/pages/System/SupplierUser/index.tsx
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, message, Popconfirm } from 'antd';
|
||||||
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
|
import { PageContainer } from '@ant-design/pro-layout';
|
||||||
|
import type { ProColumns, ActionType } from '@ant-design/pro-table';
|
||||||
|
import ProTable from '@ant-design/pro-table';
|
||||||
|
import type { SupplierUserListItem } from './data.d';
|
||||||
|
import { getSupplierUserList, updateSupplierUser, resetPassword } from './service';
|
||||||
|
import UpdateForm from './components/UpdateForm';
|
||||||
|
|
||||||
|
const SupplierUser: React.FC = () => {
|
||||||
|
const actionRef = useRef<ActionType>();
|
||||||
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||||
|
const [formValues, setFormValues] = useState({});
|
||||||
|
|
||||||
|
// 从URL查询参数获取并保存必要的参数
|
||||||
|
useEffect(() => {
|
||||||
|
const query = new URLSearchParams(window.location.search);
|
||||||
|
const token = query.get('token');
|
||||||
|
const roleCode = query.get('roleCode');
|
||||||
|
const mall3Check = query.get('mall3Check');
|
||||||
|
|
||||||
|
// 如果参数存在,保存到sessionStorage中
|
||||||
|
if (token) {
|
||||||
|
sessionStorage.setItem('Authorization', token);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roleCode) {
|
||||||
|
// 保存roleCode到sessionStorage
|
||||||
|
try {
|
||||||
|
const currentRoleData = sessionStorage.getItem('roleData');
|
||||||
|
if (currentRoleData) {
|
||||||
|
const roleDataObj = JSON.parse(currentRoleData);
|
||||||
|
roleDataObj.roleCode = roleCode;
|
||||||
|
sessionStorage.setItem('roleData', JSON.stringify(roleDataObj));
|
||||||
|
} else {
|
||||||
|
// 如果没有roleData,创建一个基本对象
|
||||||
|
sessionStorage.setItem('roleData', JSON.stringify({ roleCode }));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 如果解析失败,直接创建新对象
|
||||||
|
sessionStorage.setItem('roleData', JSON.stringify({ roleCode }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mall3Check) {
|
||||||
|
sessionStorage.setItem('Mall3Check', mall3Check);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleUpdate = async (fields: SupplierUserListItem) => {
|
||||||
|
const hide = message.loading('正在更新');
|
||||||
|
try {
|
||||||
|
await updateSupplierUser(fields);
|
||||||
|
hide();
|
||||||
|
message.success('更新成功');
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('更新失败请重试!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleResetPassword = async (username: string) => {
|
||||||
|
const hide = message.loading('正在重置密码');
|
||||||
|
try {
|
||||||
|
await resetPassword(username);
|
||||||
|
hide();
|
||||||
|
message.success('密码重置成功,新密码已通过邮件发送,请注意查收');
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('密码重置失败,请重试');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns: ProColumns<SupplierUserListItem>[] = [
|
||||||
|
{
|
||||||
|
title: '用户名',
|
||||||
|
dataIndex: 'username',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '姓名',
|
||||||
|
dataIndex: 'name',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '供应商名称',
|
||||||
|
dataIndex: 'supplierName',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '统一信用代码',
|
||||||
|
dataIndex: 'creditCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '手机号',
|
||||||
|
dataIndex: 'mobile',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
valueEnum: {
|
||||||
|
0: { text: '无效', status: 'Default' },
|
||||||
|
1: { text: '有效', status: 'Processing' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'option',
|
||||||
|
valueType: 'option',
|
||||||
|
render: (_, record) => [
|
||||||
|
<a
|
||||||
|
key="config"
|
||||||
|
onClick={() => {
|
||||||
|
handleUpdateModalVisible(true);
|
||||||
|
setFormValues(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</a>,
|
||||||
|
<Popconfirm
|
||||||
|
title="确认重置该用户的密码?"
|
||||||
|
onConfirm={() => handleResetPassword(record.username)}
|
||||||
|
key="reset"
|
||||||
|
>
|
||||||
|
<a>重置密码</a>
|
||||||
|
</Popconfirm>,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContainer>
|
||||||
|
<ProTable<SupplierUserListItem>
|
||||||
|
headerTitle="供应商用户列表"
|
||||||
|
actionRef={actionRef}
|
||||||
|
rowKey="userId"
|
||||||
|
search={{
|
||||||
|
labelWidth: 120,
|
||||||
|
}}
|
||||||
|
request={(params) =>
|
||||||
|
getSupplierUserList(params).then((res) => {
|
||||||
|
return {
|
||||||
|
data: res.data.records,
|
||||||
|
success: true,
|
||||||
|
total: res.data.total,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
columns={columns}
|
||||||
|
/>
|
||||||
|
<UpdateForm
|
||||||
|
onSubmit={async (value) => {
|
||||||
|
const success = await handleUpdate(value);
|
||||||
|
if (success) {
|
||||||
|
handleUpdateModalVisible(false);
|
||||||
|
setFormValues({});
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
handleUpdateModalVisible(false);
|
||||||
|
setFormValues({});
|
||||||
|
}}
|
||||||
|
updateModalVisible={updateModalVisible}
|
||||||
|
values={formValues}
|
||||||
|
/>
|
||||||
|
</PageContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SupplierUser;
|
23
src/pages/System/SupplierUser/service.ts
Normal file
23
src/pages/System/SupplierUser/service.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { SupplierUserListItem, TableListParams } from './data.d';
|
||||||
|
|
||||||
|
export async function getSupplierUserList(params: TableListParams) {
|
||||||
|
return request('/sys/supplier/user/list', {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateSupplierUser(params: SupplierUserListItem) {
|
||||||
|
return request('/sys/supplier/user/update', {
|
||||||
|
method: 'POST',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function resetPassword(username: string) {
|
||||||
|
return request('/sys/supplier/user/reset-password', {
|
||||||
|
method: 'POST',
|
||||||
|
data: { username },
|
||||||
|
});
|
||||||
|
}
|
@ -1,17 +1,24 @@
|
|||||||
import React, { useState, useRef, useMemo, useEffect } from 'react';
|
import React, { useState, useRef, useMemo, useEffect } from 'react';
|
||||||
import { message, Modal, Input, Form, PageHeader, Button, Spin, Tree, Checkbox, Row, Col } from 'antd';
|
import { message, Modal, Input, Form, PageHeader, Button, Spin, Tree, Checkbox, Row, Col, Upload, TreeSelect } from 'antd';
|
||||||
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
|
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
|
||||||
import tableProps from '@/utils/tableProps';
|
import tableProps from '@/utils/tableProps';
|
||||||
import { getPage, getDataById, allocationIF, assignsRoles, updateRole } from './service';
|
import { getPage, getDataById, allocationIF, assignsRoles, updateRole } from './service';
|
||||||
import { fetchAllDepartment } from '../Department/service';
|
import { fetchAllDepartment } from '../Department/service';
|
||||||
import { getDicData } from '@/utils/session';
|
import { getDicData } from '@/utils/session';
|
||||||
|
import { fetchIamUsers, syncIamUser } from './service';
|
||||||
|
import { UploadOutlined, DownloadOutlined, EditOutlined } from '@ant-design/icons';
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
|
|
||||||
const entrust: React.FC<{}> = () => {
|
const entrust: React.FC<{}> = () => {
|
||||||
const [roleModalForm] = Form.useForm();
|
const [roleModalForm] = Form.useForm();
|
||||||
|
const [editModalForm] = Form.useForm();
|
||||||
const [open, setOpen] = useState<boolean>(false);
|
const [open, setOpen] = useState<boolean>(false);
|
||||||
|
const [editOpen, setEditOpen] = useState<boolean>(false);
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [spin, spinSet] = useState<boolean>(false);
|
const [spin, spinSet] = useState<boolean>(false);
|
||||||
const [roles, setRoles] = useState<any>([]);
|
const [roles, setRoles] = useState<any>([]);
|
||||||
|
const [departments, setDepartments] = useState<any>([]);
|
||||||
|
const [departmentTreeData, setDepartmentTreeData] = useState<any>([]);
|
||||||
//查询分页数据
|
//查询分页数据
|
||||||
const [pageData, pageDataSet] = useState<any>({
|
const [pageData, pageDataSet] = useState<any>({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
@ -21,6 +28,14 @@ const entrust: React.FC<{}> = () => {
|
|||||||
labelCol: { span: 6 },
|
labelCol: { span: 6 },
|
||||||
wrapperCol: { span: 13 },
|
wrapperCol: { span: 13 },
|
||||||
};
|
};
|
||||||
|
const [syncModalOpen, setSyncModalOpen] = useState(false);
|
||||||
|
const [iamUsers, setIamUsers] = useState<any[]>([]);
|
||||||
|
const [iamLoading, setIamLoading] = useState(false);
|
||||||
|
const [iamTotal, setIamTotal] = useState(0);
|
||||||
|
const [iamPage, setIamPage] = useState({ pageNo: 1, pageSize: 10 });
|
||||||
|
const [iamSearch, setIamSearch] = useState('');
|
||||||
|
const [currentUser, setCurrentUser] = useState<any>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDepartmentList();
|
getDepartmentList();
|
||||||
}, []);
|
}, []);
|
||||||
@ -34,15 +49,58 @@ const entrust: React.FC<{}> = () => {
|
|||||||
{ title: '部门', dataIndex: 'orgName', hideInSearch: true },
|
{ title: '部门', dataIndex: 'orgName', hideInSearch: true },
|
||||||
{ title: '邮箱', dataIndex: 'email' },
|
{ title: '邮箱', dataIndex: 'email' },
|
||||||
{
|
{
|
||||||
title: '操作', width: '9%',
|
title: '操作', width: '12%',
|
||||||
valueType: 'option',
|
valueType: 'option',
|
||||||
render: (_, record) => [
|
render: (_, record) => [
|
||||||
<Button type='text' onClick={() => { chooseRole(record) }}>分配角色</Button>
|
<Button type='text' onClick={() => { chooseRole(record) }}>分配角色</Button>,
|
||||||
// <Button type='text' onClick={() => { handleUpdate(record) }}>修改</Button>,
|
<Button type='text' icon={<EditOutlined />} onClick={() => { handleEdit(record) }}>修改</Button>
|
||||||
// <Button type='text' onClick={() => { handleDelete(record.roleId) }}>删除</Button>
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 处理修改用户
|
||||||
|
const handleEdit = (record: any) => {
|
||||||
|
setCurrentUser(record);
|
||||||
|
editModalForm.resetFields();
|
||||||
|
editModalForm.setFieldsValue({
|
||||||
|
userId: record.userId,
|
||||||
|
name: record.name,
|
||||||
|
employeeNumber: record.employeeNumber,
|
||||||
|
email: record.email,
|
||||||
|
orgId: record.orgId,
|
||||||
|
orgName: record.orgName
|
||||||
|
});
|
||||||
|
setEditOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭修改Modal
|
||||||
|
const closeEditModal = () => {
|
||||||
|
editModalForm.resetFields();
|
||||||
|
setEditOpen(false);
|
||||||
|
setCurrentUser(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交修改
|
||||||
|
const onEditSubmit = async () => {
|
||||||
|
try {
|
||||||
|
const values = await editModalForm.validateFields();
|
||||||
|
const { success } = await updateRole(values);
|
||||||
|
if (success) {
|
||||||
|
message.success('修改成功!');
|
||||||
|
closeEditModal();
|
||||||
|
actionRef.current?.reload();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 部门选择变化
|
||||||
|
const handleDepartmentChange = (value: string, labelList: any) => {
|
||||||
|
const selectedLabel = labelList[labelList.length - 1];
|
||||||
|
editModalForm.setFieldsValue({ orgName: selectedLabel });
|
||||||
|
};
|
||||||
|
|
||||||
//分配角色查询数据
|
//分配角色查询数据
|
||||||
const chooseRole = (record: any) => {
|
const chooseRole = (record: any) => {
|
||||||
roleModalForm.resetFields();
|
roleModalForm.resetFields();
|
||||||
@ -81,6 +139,68 @@ const entrust: React.FC<{}> = () => {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 修改用户Modal
|
||||||
|
const editUserModal = (
|
||||||
|
<Modal
|
||||||
|
title="修改用户信息"
|
||||||
|
visible={editOpen}
|
||||||
|
width="50%"
|
||||||
|
centered
|
||||||
|
destroyOnClose={true}
|
||||||
|
onOk={onEditSubmit}
|
||||||
|
onCancel={closeEditModal}
|
||||||
|
>
|
||||||
|
<Form form={editModalForm} {...layout}>
|
||||||
|
<Form.Item label="用户ID" name="userId" hidden>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="用户名"
|
||||||
|
name="name"
|
||||||
|
rules={[{ required: true, message: '请输入用户名' }]}
|
||||||
|
>
|
||||||
|
<Input placeholder="请输入用户名" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="用户账号"
|
||||||
|
name="employeeNumber"
|
||||||
|
rules={[{ required: true, message: '请输入用户账号' }]}
|
||||||
|
>
|
||||||
|
<Input placeholder="请输入用户账号" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="邮箱"
|
||||||
|
name="email"
|
||||||
|
rules={[
|
||||||
|
{ type: 'email', message: '请输入正确的邮箱格式' },
|
||||||
|
{ required: true, message: '请输入邮箱' }
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input placeholder="请输入邮箱" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="部门"
|
||||||
|
name="orgId"
|
||||||
|
rules={[{ required: true, message: '请选择部门' }]}
|
||||||
|
>
|
||||||
|
<TreeSelect
|
||||||
|
placeholder="请选择部门"
|
||||||
|
treeData={departmentTreeData}
|
||||||
|
onChange={handleDepartmentChange}
|
||||||
|
showSearch
|
||||||
|
treeNodeFilterProp="title"
|
||||||
|
allowClear
|
||||||
|
treeDefaultExpandAll
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="部门名称" name="orgName" hidden>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
|
||||||
const setRoleModal = (
|
const setRoleModal = (
|
||||||
<Modal
|
<Modal
|
||||||
title={"分配角色"}
|
title={"分配角色"}
|
||||||
@ -160,6 +280,8 @@ const entrust: React.FC<{}> = () => {
|
|||||||
};
|
};
|
||||||
generateList(data);
|
generateList(data);
|
||||||
treeDataListSet(dataList);
|
treeDataListSet(dataList);
|
||||||
|
setDepartments(dataList);
|
||||||
|
setDepartmentTreeData(data);
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -168,7 +290,7 @@ const entrust: React.FC<{}> = () => {
|
|||||||
for (let i = 0; i < tree.length; i++) {
|
for (let i = 0; i < tree.length; i++) {
|
||||||
const node = tree[i];
|
const node = tree[i];
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
if (node.children.some((item) => item.key === key)) {
|
if (node.children.some((item: { key: any }) => item.key === key)) {
|
||||||
parentKey = node.key;
|
parentKey = node.key;
|
||||||
} else if (getParentKey(key, node.children)) {
|
} else if (getParentKey(key, node.children)) {
|
||||||
parentKey = getParentKey(key, node.children);
|
parentKey = getParentKey(key, node.children);
|
||||||
@ -191,7 +313,7 @@ const entrust: React.FC<{}> = () => {
|
|||||||
const loop = (data: any): any[] => {
|
const loop = (data: any): any[] => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
let res: any[] = [];
|
let res: any[] = [];
|
||||||
data.map((item: any, i: any) => {
|
data.map((item: { title: string; key: any; children?: any[] }, i: number) => {
|
||||||
const strTitle = item.title as string;
|
const strTitle = item.title as string;
|
||||||
const index = strTitle.indexOf(searchValue);
|
const index = strTitle.indexOf(searchValue);
|
||||||
const beforeStr = strTitle.substring(0, index);
|
const beforeStr = strTitle.substring(0, index);
|
||||||
@ -223,6 +345,48 @@ const entrust: React.FC<{}> = () => {
|
|||||||
return allData;
|
return allData;
|
||||||
}
|
}
|
||||||
}, [searchValue, allData]);
|
}, [searchValue, allData]);
|
||||||
|
// IAM用户加载
|
||||||
|
const loadIamUsers = async (pageNo: number, pageSize: number, search: string) => {
|
||||||
|
setIamLoading(true);
|
||||||
|
try {
|
||||||
|
const res = await fetchIamUsers({
|
||||||
|
pageNo,
|
||||||
|
pageSize,
|
||||||
|
search,
|
||||||
|
});
|
||||||
|
setIamUsers(res.data || []);
|
||||||
|
setIamTotal(res.total || 0);
|
||||||
|
} finally {
|
||||||
|
setIamLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (syncModalOpen) {
|
||||||
|
loadIamUsers(iamPage.pageNo, iamPage.pageSize, iamSearch);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [syncModalOpen, iamPage.pageNo, iamPage.pageSize, iamSearch]);
|
||||||
|
|
||||||
|
const handleSyncUser = async (user: any) => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '确认同步该用户信息到主表?',
|
||||||
|
content: `姓名:${user.name},工号:${user.employeeNo}`,
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: async () => {
|
||||||
|
try {
|
||||||
|
await syncIamUser(user);
|
||||||
|
message.success('同步成功');
|
||||||
|
loadIamUsers(iamPage.pageNo, iamPage.pageSize, iamSearch);
|
||||||
|
// 同步后刷新主表
|
||||||
|
actionRef.current?.reload();
|
||||||
|
} catch (e) {
|
||||||
|
message.error('同步失败');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Spin spinning={spin}>
|
<Spin spinning={spin}>
|
||||||
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
|
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
|
||||||
@ -266,11 +430,36 @@ const entrust: React.FC<{}> = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
toolBarRender={() => [
|
toolBarRender={() => [
|
||||||
// <Button onClick={() => { handleAdd() }} type="primary">
|
<Button onClick={() => setSyncModalOpen(true)} type="primary">同步用户信息</Button>,
|
||||||
// 新增
|
<Button
|
||||||
// </Button>,
|
type="primary"
|
||||||
]
|
icon={<DownloadOutlined />}
|
||||||
}
|
style={{ marginRight: 8 }}
|
||||||
|
onClick={() => {
|
||||||
|
window.open('/user_import_template.xlsx');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
下载导入模板
|
||||||
|
</Button>,
|
||||||
|
<Upload
|
||||||
|
name="file"
|
||||||
|
showUploadList={false}
|
||||||
|
accept=".xls,.xlsx"
|
||||||
|
action="/api/sys-manager-ebtp-project/v1/sysuser/import"
|
||||||
|
headers={{ /* 如有token可加Authorization */ }}
|
||||||
|
onChange={info => {
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
message.success('导入成功');
|
||||||
|
//导入后刷新主表
|
||||||
|
actionRef.current?.reload();
|
||||||
|
} else if (info.file.status === 'error') {
|
||||||
|
message.error('导入失败');
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button icon={<UploadOutlined />}>导入Excel</Button>
|
||||||
|
</Upload>
|
||||||
|
]}
|
||||||
pagination={{
|
pagination={{
|
||||||
...tableProps.pagination,
|
...tableProps.pagination,
|
||||||
onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }),
|
onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }),
|
||||||
@ -279,10 +468,57 @@ const entrust: React.FC<{}> = () => {
|
|||||||
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }); setOrgId(''); }}
|
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }); setOrgId(''); }}
|
||||||
/>
|
/>
|
||||||
{setRoleModal}
|
{setRoleModal}
|
||||||
|
{editUserModal}
|
||||||
|
{/* IAM用户同步Modal */}
|
||||||
|
<Modal
|
||||||
|
title="同步用户信息"
|
||||||
|
visible={syncModalOpen}
|
||||||
|
onCancel={() => setSyncModalOpen(false)}
|
||||||
|
footer={null}
|
||||||
|
width={900}
|
||||||
|
>
|
||||||
|
<Input.Search
|
||||||
|
placeholder="请输入姓名/工号"
|
||||||
|
onSearch={v => { setIamSearch(v); setIamPage({ ...iamPage, pageNo: 1 }); }}
|
||||||
|
style={{ marginBottom: 16, width: 300 }}
|
||||||
|
allowClear
|
||||||
|
/>
|
||||||
|
<ProTable
|
||||||
|
rowKey="employeeNo"
|
||||||
|
columns={[
|
||||||
|
{ title: '工号', dataIndex: 'employeeNo' },
|
||||||
|
{ title: '姓名', dataIndex: 'name' },
|
||||||
|
{ title: '状态', dataIndex: 'employeeStatusDesc' },
|
||||||
|
{ title: '公司', dataIndex: 'companyName' },
|
||||||
|
{ title: '岗位', dataIndex: 'positionName' },
|
||||||
|
{ title: '部门', dataIndex: 'departmentCode' },
|
||||||
|
{ title: '手机号', dataIndex: 'mobile' },
|
||||||
|
{ title: '邮箱', dataIndex: 'email' },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
render: (_: any, record: any) => (
|
||||||
|
<Button type="link" onClick={() => handleSyncUser(record)}>
|
||||||
|
同步
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={iamUsers}
|
||||||
|
loading={iamLoading}
|
||||||
|
pagination={{
|
||||||
|
current: iamPage.pageNo,
|
||||||
|
pageSize: iamPage.pageSize,
|
||||||
|
total: iamTotal,
|
||||||
|
onChange: (page, pageSize) => setIamPage({ pageNo: page, pageSize }),
|
||||||
|
}}
|
||||||
|
search={false}
|
||||||
|
options={false}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* 查看 */}
|
|
||||||
</Spin >
|
</Spin >
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -43,47 +43,18 @@ export async function assignsRoles(params: any) {
|
|||||||
data: params,
|
data: params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// import { TreeDataNode } from 'antd';
|
// IAM用户列表查询
|
||||||
|
export async function fetchIamUsers(params: any) {
|
||||||
|
return request('/api/sys-manager-ebtp-project/v1/sysuser/iam/users', {
|
||||||
|
method: 'post',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// export function userList(options?: { [key: string]: any }): Promise<{ data: any }> {
|
// 同步IAM用户到主表
|
||||||
// return request('/api/system/userList', {
|
export async function syncIamUser(user: any) {
|
||||||
// method: 'GET',
|
return request('/api/sys-manager-ebtp-project/v1/sysuser/sync', {
|
||||||
// ...(options || {}),
|
method: 'post',
|
||||||
// });
|
data: user,
|
||||||
// }
|
});
|
||||||
|
}
|
||||||
// export function treeData(options?: { [key: string]: any }): Promise<{ data: TreeDataNode[] }> {
|
|
||||||
// return request('/api/system/treeData', {
|
|
||||||
// method: 'GET',
|
|
||||||
// ...(options || {}),
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export function fetchUserList(options?: any) {
|
|
||||||
// return request('/api/sysuser/getPage', {
|
|
||||||
// method: 'POST',
|
|
||||||
// data: options,
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// //获取用户数据
|
|
||||||
// export function getUser(userId?: any) {
|
|
||||||
// return request(`/api/sysuser/${userId}`, {
|
|
||||||
// method: 'get',
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export function assignsRoles(options?: { [key: string]: any }): Promise<any> {
|
|
||||||
// return request('/api/sysuser/assignsRoles', {
|
|
||||||
// method: 'post',
|
|
||||||
// ...(options || {}),
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //查询用户详情
|
|
||||||
// export function getOneUserAll(options?: { [key: string]: any }): Promise<{ data: TreeDataNode[] }> {
|
|
||||||
// return request(`/api/sysuser/getOneUserAll/${options?.id}`, {
|
|
||||||
// method: 'GET',
|
|
||||||
// params: options,
|
|
||||||
// ...(options || {}),
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
@ -77,6 +77,7 @@ request.interceptors.request.use(async (url, options) => {
|
|||||||
url.startsWith('/api/api/mall-expe') ||
|
url.startsWith('/api/api/mall-expe') ||
|
||||||
url == '/api/sys-manager-ebtp-project/v1/userpassword/validatePassword' ||
|
url == '/api/sys-manager-ebtp-project/v1/userpassword/validatePassword' ||
|
||||||
url.startsWith('/api/notification') ||
|
url.startsWith('/api/notification') ||
|
||||||
|
url.startsWith('/api/sys-manager-ebtp-project/v1/login/accountLogin') ||
|
||||||
url == '/api/sys-manager-ebtp-project/outer/v1/ebtp/face/faceCompare' ||
|
url == '/api/sys-manager-ebtp-project/outer/v1/ebtp/face/faceCompare' ||
|
||||||
url == '/api/sys-manager-ebtp-project/outer/v1/ebtp/face/rgbArray2Base64' ||
|
url == '/api/sys-manager-ebtp-project/outer/v1/ebtp/face/rgbArray2Base64' ||
|
||||||
url == '/api/notification/v1/notification/savaSmsByPhoneNew'
|
url == '/api/notification/v1/notification/savaSmsByPhoneNew'
|
||||||
|
Reference in New Issue
Block a user