index.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { PageContainer } from "@ant-design/pro-components"
  2. import { columns } from "./tableConfig"
  3. import { useAjax } from "@/Hook/useAjax"
  4. import { useState } from "react"
  5. import { useModel } from "@umijs/max"
  6. import { appList } from "@/services/distributor/appList"
  7. import MyProTable from "@/components/MyProTable"
  8. const Page: React.FC = () => {
  9. let { state, getEnum } = useModel("global")
  10. let [key, setKey] = useState<any>(1)
  11. let getList = useAjax((params) => appList(params), { type: 'table' })
  12. return <PageContainer
  13. tabList={getEnum("APP_TYPE", "arr")}
  14. tabProps={{
  15. type: 'card',
  16. hideAdd: true,
  17. onChange: (e) => setKey(e),
  18. }}
  19. >
  20. <MyProTable<any, any>
  21. headerTitle={"抖音小程序列表"}
  22. rowKey={(r) => r.id}
  23. search={{
  24. labelWidth: 120,
  25. }}
  26. scroll={{ x: "auto" }}
  27. params={{
  28. appType: key
  29. }}
  30. request={async (params) => {
  31. if (params.appType) {
  32. return await getList.run(params)
  33. }
  34. }}
  35. columns={columns({ appType: key })}
  36. />
  37. </PageContainer>
  38. }
  39. export default Page