index.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { miniAppList } from "@/services/distributor/miniApp"
  2. import { PageContainer, ProTable } from "@ant-design/pro-components"
  3. import { Table } from "antd"
  4. import { columns, childrenColumns } from "./tableConfig"
  5. import { useAjax } from "@/Hook/useAjax"
  6. const Page: React.FC = () => {
  7. let getList = useAjax((params) => miniAppList(params), { type: 'table' })
  8. return <PageContainer>
  9. <ProTable<any, any>
  10. headerTitle={"微信小程序列表"}
  11. rowKey={(r) => r.id}
  12. search={{
  13. labelWidth: 120,
  14. }}
  15. scroll={{ x: "auto" }}
  16. request={async (params) => {
  17. return await getList.run(params)
  18. }}
  19. columns={columns()}
  20. // showHeader={false}//隐藏标题
  21. // options={false}//隐藏工具栏
  22. // ghost={true}//幽灵模式
  23. // bordered
  24. expandable={{
  25. rowExpandable: (record) => record?.appCarrierList?.length > 0,
  26. expandRowByClick: true,
  27. expandedRowRender: (record) => {
  28. return <Table
  29. columns={childrenColumns}
  30. dataSource={record.appCarrierList}
  31. rowKey={(r) => r.id}
  32. pagination={false}
  33. size='small'
  34. bordered
  35. />
  36. },
  37. }}
  38. />
  39. </PageContainer>
  40. }
  41. export default Page