uuidTem.tsx 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. import { useAjax } from "@/Hook/useAjax"
  2. import React, { useEffect } from "react"
  3. import { AreaChartOutlined, SearchOutlined, UserOutlined } from "@ant-design/icons"
  4. import { GetExternalUserRepeatByCorpListApiProps, getSelectQcUuidStatisticPageListApi } from "../../API/home"
  5. import { Avatar, Button, Card, Input, InputNumber, Select, Space, Table, Typography } from "antd";
  6. import SearchBox from "../../components/searchBox";
  7. import CorpDetails from "./corpDetails";
  8. import CorpUserDetails from "./corpUserDetails";
  9. const { Title, Text } = Typography;
  10. const UuidTem: React.FC<{ getCorpAllList: any }> = ({ getCorpAllList }) => {
  11. /*****************************************/
  12. const [queryParmas, setQueryParmas] = React.useState<GetExternalUserRepeatByCorpListApiProps>({ pageNum: 1, pageSize: 20 })
  13. const [queryParmasNew, setQueryParmasNew] = React.useState<GetExternalUserRepeatByCorpListApiProps>({ pageNum: 1, pageSize: 20 })
  14. const getSelectQcUuidStatisticPageList = useAjax((params) => getSelectQcUuidStatisticPageListApi(params))
  15. /*****************************************/
  16. useEffect(() => {
  17. getSelectQcUuidStatisticPageList.run(queryParmas)
  18. }, [queryParmas])
  19. return <>
  20. <Title level={3}><AreaChartOutlined style={{ color: '#ff85c0' }} /> Uuid维度统计列表</Title>
  21. <SearchBox
  22. bodyPadding={`16px 0 12px`}
  23. buttons={<>
  24. <Button onClick={() => {
  25. setQueryParmas({ pageNum: 1, pageSize: queryParmas.pageSize })
  26. setQueryParmasNew({ pageNum: 1, pageSize: queryParmas.pageSize })
  27. }}>重置</Button>
  28. <Button type="primary" onClick={() => {
  29. setQueryParmas({ ...queryParmasNew, pageNum: 1, pageSize: queryParmas.pageSize })
  30. }} loading={getSelectQcUuidStatisticPageList.loading} icon={<SearchOutlined />}>搜索</Button>
  31. </>}
  32. >
  33. <>
  34. <Select
  35. value={queryParmasNew?.corpIdList}
  36. onChange={(e) => setQueryParmasNew({ ...queryParmasNew, corpIdList: e })}
  37. showSearch
  38. style={{ minWidth: 150 }}
  39. maxTagCount={1}
  40. mode='multiple'
  41. placeholder="选择企业"
  42. filterOption={(input, option) =>
  43. ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
  44. }
  45. allowClear
  46. options={getCorpAllList?.data?.data?.map((item: any) => ({ label: item.corpName, value: item.corpId }))}
  47. />
  48. {/* <Input onChange={(e) => setQueryParmasNew({ ...queryParmasNew, corpName: e.target.value })} value={queryParmasNew?.corpName} placeholder="企微名称" allowClear /> */}
  49. <Input onChange={(e) => setQueryParmasNew({ ...queryParmasNew, name: e.target.value })} value={queryParmasNew?.name} placeholder="客户昵称" allowClear />
  50. <InputNumber placeholder="最小企业id个数" style={{ width: 125 }} value={queryParmasNew?.minCorpIdCount} onChange={(e) => setQueryParmasNew({ ...queryParmasNew, minCorpIdCount: e })} />
  51. <InputNumber placeholder="最大企业id个数" style={{ width: 125 }} value={queryParmasNew?.maxCorpIdCount} onChange={(e) => setQueryParmasNew({ ...queryParmasNew, maxCorpIdCount: e })} />
  52. <InputNumber placeholder="最小客服号id个数" style={{ width: 125 }} value={queryParmasNew?.minCorpUserIdCount} onChange={(e) => setQueryParmasNew({ ...queryParmasNew, minCorpUserIdCount: e })} />
  53. <InputNumber placeholder="最大客服号id个数" style={{ width: 125 }} value={queryParmasNew?.maxCorpUserIdCount} onChange={(e) => setQueryParmasNew({ ...queryParmasNew, maxCorpUserIdCount: e })} />
  54. </>
  55. </SearchBox>
  56. <Card>
  57. <Table
  58. columns={[
  59. {
  60. title: '客户名称',
  61. dataIndex: 'name',
  62. key: 'name',
  63. width: 180,
  64. render: (text: any, record: any) => {
  65. return <Space>
  66. <Avatar shape="square" size={20} icon={<UserOutlined />} src={record?.avatar} />
  67. <Text>{text}</Text>
  68. </Space>
  69. }
  70. },
  71. {
  72. title: '企业ID个数',
  73. dataIndex: 'corpIdCount',
  74. key: 'corpIdCount',
  75. width: 120,
  76. align: 'center',
  77. sorter: true,
  78. render: (text: number, record: any) => {
  79. return <CorpDetails name={record?.name} avatar={record?.avatar} corpIdCount={text} qcUuid={record?.qcUuid} />
  80. }
  81. },
  82. {
  83. title: '客服号ID个数',
  84. dataIndex: 'corpUserIdCount',
  85. key: 'corpUserIdCount',
  86. width: 120,
  87. align: 'center',
  88. sorter: true,
  89. render: (text: number, record: any) => {
  90. return <CorpUserDetails name={record?.name} avatar={record?.avatar} corpUserIdCount={text} qcUuid={record?.qcUuid} />
  91. }
  92. },
  93. {
  94. title: 'qcUUID',
  95. dataIndex: 'qcUuid',
  96. key: 'qcUuid',
  97. ellipsis: true,
  98. render: (text: string) => {
  99. return <Text copyable>{text}</Text>
  100. }
  101. }
  102. ]}
  103. scroll={{ y: 300, x: 1000 }}
  104. bordered
  105. dataSource={getSelectQcUuidStatisticPageList.data?.data?.records}
  106. loading={getSelectQcUuidStatisticPageList.loading}
  107. rowKey="qcUuid"
  108. pagination={{
  109. total: getSelectQcUuidStatisticPageList.data?.data?.total,
  110. current: getSelectQcUuidStatisticPageList?.data?.data?.current || 1,
  111. pageSize: getSelectQcUuidStatisticPageList?.data?.data?.size || 20,
  112. }}
  113. onChange={(pagination: any, _: any, sortData: any) => {
  114. let { current, pageSize } = pagination
  115. let newQueryForm = JSON.parse(JSON.stringify(queryParmas))
  116. if (sortData && sortData?.order) {
  117. newQueryForm['sortType'] = sortData?.order === 'ascend' ? 'ASC' : 'DESC'
  118. newQueryForm['orderByField'] = sortData?.field
  119. } else {
  120. delete newQueryForm['sortType']
  121. delete newQueryForm['orderByField']
  122. }
  123. newQueryForm.pageNum = current || newQueryForm.pageNum
  124. newQueryForm.pageSize = pageSize || newQueryForm.pageSize
  125. setQueryParmas({ ...newQueryForm })
  126. }}
  127. />
  128. </Card>
  129. </>
  130. }
  131. export default React.memo(UuidTem)