|
|
@@ -78,7 +78,10 @@ export const UsersPage = () => {
|
|
|
setModalTitle('创建用户');
|
|
|
setEditingUser(null);
|
|
|
form.resetFields();
|
|
|
- form.setFieldsValue({ roleIds: [] });
|
|
|
+ form.setFieldsValue({
|
|
|
+ roleIds: [],
|
|
|
+ dataScopeType: 'personal'
|
|
|
+ });
|
|
|
setModalVisible(true);
|
|
|
};
|
|
|
|
|
|
@@ -88,7 +91,8 @@ export const UsersPage = () => {
|
|
|
setEditingUser(user);
|
|
|
form.setFieldsValue({
|
|
|
...user,
|
|
|
- roleIds: user.roles?.map((role: any) => role.id) || []
|
|
|
+ roleIds: user.roles?.map((role: any) => role.id) || [],
|
|
|
+ dataScopeType: user.dataScopeType || 'personal'
|
|
|
});
|
|
|
setModalVisible(true);
|
|
|
};
|
|
|
@@ -180,10 +184,25 @@ export const UsersPage = () => {
|
|
|
</Space>
|
|
|
),
|
|
|
},
|
|
|
+ {
|
|
|
+ title: '数据范围',
|
|
|
+ dataIndex: 'dataScopeType',
|
|
|
+ key: 'dataScopeType',
|
|
|
+ render: (type: string) => {
|
|
|
+ const scopeMap = {
|
|
|
+ personal: '个人数据',
|
|
|
+ department: '部门数据',
|
|
|
+ sub_department: '本部门及子部门',
|
|
|
+ company: '公司全部',
|
|
|
+ custom: '自定义'
|
|
|
+ };
|
|
|
+ return <Tag color="green">{scopeMap[type as keyof typeof scopeMap] || type}</Tag>;
|
|
|
+ },
|
|
|
+ },
|
|
|
{
|
|
|
title: '创建时间',
|
|
|
- dataIndex: 'created_at',
|
|
|
- key: 'created_at',
|
|
|
+ dataIndex: 'createdAt',
|
|
|
+ key: 'createdAt',
|
|
|
render: (date: string) => dayjs(date).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
},
|
|
|
{
|
|
|
@@ -333,6 +352,29 @@ export const UsersPage = () => {
|
|
|
</Form.Item>
|
|
|
)}
|
|
|
|
|
|
+ <Form.Item
|
|
|
+ name="roleIds"
|
|
|
+ label="角色"
|
|
|
+ rules={[{ required: true, message: '请选择用户角色' }]}
|
|
|
+ >
|
|
|
+ <RoleSelect mode="multiple" placeholder="请选择角色" />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item
|
|
|
+ name="dataScopeType"
|
|
|
+ label="数据范围"
|
|
|
+ required
|
|
|
+ rules={[{ required: true, message: '请选择数据范围类型' }]}
|
|
|
+ >
|
|
|
+ <Select placeholder="请选择数据范围类型">
|
|
|
+ <Select.Option value="personal">个人数据</Select.Option>
|
|
|
+ <Select.Option value="department">部门数据</Select.Option>
|
|
|
+ <Select.Option value="sub_department">本部门及子部门数据</Select.Option>
|
|
|
+ <Select.Option value="company">公司全部数据</Select.Option>
|
|
|
+ <Select.Option value="custom">自定义数据范围</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
<Form.Item
|
|
|
name="isDisabled"
|
|
|
label="状态"
|
|
|
@@ -344,14 +386,6 @@ export const UsersPage = () => {
|
|
|
<Select.Option value={1}>禁用</Select.Option>
|
|
|
</Select>
|
|
|
</Form.Item>
|
|
|
-
|
|
|
- <Form.Item
|
|
|
- name="roleIds"
|
|
|
- label="角色"
|
|
|
- rules={[{ required: true, message: '请选择用户角色' }]}
|
|
|
- >
|
|
|
- <RoleSelect mode="multiple" placeholder="请选择角色" />
|
|
|
- </Form.Item>
|
|
|
</Form>
|
|
|
</Modal>
|
|
|
</div>
|