Explorar o código

fix: 选择客户弹窗分页字段调整

lanjianrong %!s(int64=5) %!d(string=hai) anos
pai
achega
52aae8b2a8
Modificáronse 1 ficheiros con 12 adicións e 6 borrados
  1. 12 6
      src/pages/Customer/Contact/components/CustomerModal/index.jsx

+ 12 - 6
src/pages/Customer/Contact/components/CustomerModal/index.jsx

@@ -17,8 +17,8 @@ const SearchModal = ({ clientId, onSelect }) => {
     laoding: true,
     customer: [],
     searchVal: '',
-    page: 1,
-    size: 10,
+    current: 1,
+    pageSize: 10,
     total: 0
   })
   const initData = async params => {
@@ -29,17 +29,23 @@ const SearchModal = ({ clientId, onSelect }) => {
         // 请求的是第一页
         setState({ ...state, customer, total, laoding: false })
       } else {
-        setState({ ...state, customer: state.customer.concat(customer), total, laoding: false })
+        setState({
+          ...state,
+          customer: state.customer.concat(customer),
+          total,
+          laoding: false,
+          pageSize: params?.pageSize || 1
+        })
       }
     }
   }
 
   useEffect(() => {
-    initData({ page: 1, size: 10 })
+    initData({ current: 1, pageSize: 10 })
   }, [])
   const onChange = e => {
     const { value = '' } = e.target || e.currentTarget
-    initData({ search: value, page: state.page, size: state.size })
+    initData({ search: value, current: state.current, pageSize: state.pageSize })
   }
 
   const { run: handleInputChange } = useDebounceFn(onChange)
@@ -80,7 +86,7 @@ const SearchModal = ({ clientId, onSelect }) => {
       scrollRef.current.scrollTop
     ) {
       // 已到底部
-      initData({ page: state.page + 1, size: state.size })
+      initData({ current: state.current + 1, pageSize: state.pageSize })
     }
   }
   // const { run: listScroller } = useThrottleFn(handleListScroll)