Commit 61854cd8 by chenwq

```

feat(AccountManage): 账号管理页面搜索表单优化

- 搜索表单中的级联选择器禁用清除功能
- 组织筛选项添加"全部"选项支持
- 初始值设置为包含组织筛选的默认值
- 当选择"全部"时不对组织进行筛选
```
1 parent f6450718
......@@ -44,7 +44,7 @@ export function SearchForm<T extends Record<string, unknown>>({
/>
);
if (field.type === 'cascader')
return <UCascader {...common} style={{ width }} options={field.options} />;
return <UCascader {...common} style={{ width }} options={field.options} allowClear={false} />;
if (field.type === 'date') return <UDatePicker {...common} style={{ width }} />;
if (field.type === 'dateRange')
return (
......
......@@ -67,7 +67,12 @@ export default function AccountManage() {
);
const fields: FieldSchema<Record<string, unknown>>[] = [
{ name: 'keyword', label: '账号 / 姓名', type: 'input', placeholder: '模糊搜索' },
{ name: 'orgId', label: '所属组织', type: 'cascader', options: toOrgCascaderOptions(orgTree) },
{
name: 'orgId',
label: '所属组织',
type: 'cascader',
options: withAllOption(toOrgCascaderOptions(orgTree)),
},
{
name: 'roleId',
label: '角色',
......@@ -135,7 +140,7 @@ export default function AccountManage() {
<UCard size="small">
<SearchForm
fields={fields}
initialValues={{ roleId: '', status: '' }}
initialValues={{ orgId: [''], roleId: '', status: '' }}
onSearch={(values, pagination) => {
setParams(toParams(values, pagination));
setQueryVersion((version) => version + 1);
......
......@@ -26,6 +26,7 @@ export function createAccountPageParams(
size: pagination.size,
keyword: values.keyword as string | undefined,
mobile: values.mobile as string | undefined,
// “全部”对应空值,不附加组织筛选条件。
orgId: typeof orgId === 'number' ? orgId : undefined,
roleId: values.roleId === '' || values.roleId === undefined ? undefined : Number(values.roleId),
status: values.status === '' || values.status === undefined ? undefined : Number(values.status),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!