index.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { PageContainer } from "@ant-design/pro-components"
  2. import { columns } from "./tableConfig"
  3. import { useAjax } from "@/Hook/useAjax"
  4. import { useModel } from "@umijs/max"
  5. import { getAllKfs, getCustoms } from "@/services/miniApp/entWeChat"
  6. import { useEffect } from "react"
  7. import MyProTable from "@/components/MyProTable"
  8. const Page: React.FC = () => {
  9. let { initialState } = useModel("@@initialState")
  10. let getList = useAjax((params) => getCustoms(params), { type: 'table' })
  11. let GetAllKfs = useAjax((params) => getAllKfs(params))
  12. let publicData = {
  13. appId: initialState?.selectApp?.id || "",
  14. appType: initialState?.selectApp?.appType || ""
  15. }
  16. useEffect(()=>{
  17. GetAllKfs.run(publicData)
  18. },[])
  19. return <PageContainer title={false}
  20. >
  21. <MyProTable<any, any>
  22. scroll={{ x: 'max-content' }}
  23. params={publicData}
  24. headerTitle={"企微用户列表"}
  25. rowKey={(r) => r.corpUserId}
  26. search={{
  27. labelWidth: 120,
  28. }}
  29. request={async (params) => {
  30. if(params.corpId){
  31. return await getList.run(params)
  32. }
  33. }}
  34. columns={columns(GetAllKfs?.data?.data)}
  35. />
  36. </PageContainer>
  37. }
  38. export default Page