import { Button, DatePicker, Input, Select } from 'antd'; import { stringify } from 'qs'; import { useEffect, useRef, useState } from 'react'; import { FormItemPlugin, FormPlugin } from '@/components/FormPlugin'; import { GapBox } from '@/components/GapBox'; import PageContainerPlugin from '@/components/PageContainer/PageContainerPlugin'; import { FooterPagination, HeaderPagination } from '@/components/PaginationPlugin'; import { MoreSearchButton, SearchButton } from '@/components/SearchButton'; import type { ColumnsTypeUltra } from '@/components/TableColumnsFilterPlugin'; import { TablePlugin } from '@/components/TablePlugin'; import { staffType } from '@/configs/staffsConfig'; import { stateOptions, userSex, userState } from '@/configs/usersConfig'; import type { IAjaxDataBase, IParamsBase } from '@/interfaces/common'; import { type IUserEditModalType, UserEditModal } from '@/pages/User/List/components/UserEditModal'; import { UserServices } from '@/services/UserServices'; import { useAuthStore } from '@/store/AuthStore'; import { tableFixedByPhone, toArray } from '@/utils/common'; import { useRequest } from '@/utils/useRequest'; interface IAjaxData extends IAjaxDataBase { data: any[]; } type IParams = IParamsBase & { login_name?: string; nick_name?: string; user_phone?: string; state?: number; create_dateL?: string; create_dateU?: string; }; /** 企业列表页面 */ const CompanyListForm: React.FC = () => { const auth = useAuthStore().auth; const [params, setParams] = useState({ curr_page: 1, page_count: 20 }); const [ajaxData, setAjaxData] = useState({ count: 0, data: [] }); const [showMoreSearch, setShowMoreSearch] = useState(false); const UserEditModalRef = useRef(null); const { loading: userLoading, request: userRequest } = useRequest(UserServices.getUserList, { onSuccessCodeZero: (res) => { setAjaxData({ count: res.count || 0, data: toArray(res.data), }); }, }); const columns: ColumnsTypeUltra = [ { title: '操作', width: 50, fixed: tableFixedByPhone('left'), render: (_, item) => ( {auth.SF_ERP_USER_EDIT && ( )} ), }, { title: '用户名', dataIndex: 'login_name', width: 120 }, { title: '企业名称', dataIndex: 'company_name', width: 120 }, { title: '类型', dataIndex: 'staff_type', width: 60, render: (value) => staffType[value] }, { title: '昵称', dataIndex: 'nick_name', width: 120 }, { title: '手机', dataIndex: 'user_phone', width: 120 }, { title: '性别', dataIndex: 'user_sex', width: 60, render: (value) => userSex[value] }, { title: '状态', dataIndex: 'state', width: 60, ellipsis: true, render: (value) => userState[value] }, { title: '备注', dataIndex: 'comments', width: 300, }, { title: '创建时间', width: window.dfConfig.isPhone ? 160 : 160, dataIndex: 'create_date', ellipsis: true, }, ]; function page(curr: number) { if (!userLoading) { params.curr_page = curr; console.log(params); userRequest(stringify(params)); } } useEffect(() => { page(1); }, []); return ( <> { params.login_name = e.target.value.trim() || undefined; }} onPressEnter={() => page(1)} /> { params.nick_name = e.target.value.trim() || undefined; }} onPressEnter={() => page(1)} /> { params.user_phone = e.target.value.trim() || undefined; }} onPressEnter={() => page(1)} />
{ page(1); }} /> { setShowMoreSearch((v) => !v); }} />