Bläddra i källkod

feat: 关联联系人/客户/员工的弹窗列表豁免数据权限获取数据

lanjianrong 5 år sedan
förälder
incheckning
9d4280e2e8

+ 4 - 3
src/pages/Customer/Client/components/ConnectClient/index.jsx

@@ -23,9 +23,10 @@ const ConnectClient = ({ dataId, onSelect, preUrl = 'client', showFooter = true
     total: 0
   })
   const initData = async params => {
-    const { data: { client, total } = { client: [], total: 0 }, code = -1 } = await queryClient(
-      params
-    )
+    const { data: { client, total } = { client: [], total: 0 }, code = -1 } = await queryClient({
+      ...params,
+      waiver: true
+    })
     if (code === consts.RET_CODE.SUCCESS) {
       if (params?.current === 1) {
         scrollRef.current?.scrollTo({ top: 0 })

+ 1 - 1
src/pages/Customer/Company/components/ConnectCompany/index.jsx

@@ -25,7 +25,7 @@ const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
   })
   const initData = async params => {
     const { data: { customer, total } = { customer: [], total: 0 }, code = -1 } =
-      await queryCustomers(params)
+      await queryCustomers({ ...params, waiver: true })
     if (code === consts.RET_CODE.SUCCESS) {
       if (params?.current === 1) {
         scrollRef.current?.scrollTo({ top: 0 })

+ 15 - 2
src/pages/Hr/Employee/components/StaffModal/index.jsx

@@ -16,10 +16,14 @@ const StaffModal = ({ id, onSelect, postUrl }) => {
     list: [],
     current: 1,
     pageSize: 10,
+    noMore: false,
     total: 0
   })
   const initData = async params => {
-    const { data: { list, total } = { list: [], total: 0 }, code = -1 } = await queryStaff(params)
+    const { data: { list, total } = { list: [], total: 0 }, code = -1 } = await queryStaff({
+      ...params,
+      waiver: true
+    })
     if (code === consts.RET_CODE.SUCCESS) {
       if (params?.current === 1) {
         scrollRef.current?.scrollTo({ top: 0 })
@@ -70,6 +74,10 @@ const StaffModal = ({ id, onSelect, postUrl }) => {
       scrollRef.current.scrollTop
     ) {
       // 已到底部
+      if (state.current * state.pageSize > state.total) {
+        setState({ ...state, noMore: true })
+        return
+      }
       state.current * state.pageSize < state.total &&
         initData({ current: state.current + 1, pageSize: state.pageSize, search: state.searchVal })
     }
@@ -84,7 +92,11 @@ const StaffModal = ({ id, onSelect, postUrl }) => {
           onChange={handleInputChange}
         />
       }>
-      <div className={styles.modalContent} ref={scrollRef} onScroll={handleListScroll}>
+      <div
+        className={styles.modalContent}
+        ref={scrollRef}
+        onScroll={handleListScroll}
+        style={{ paddingBottom: 0 }}>
         <Spin spinning={state.loading}>
           {state.list.map(item => (
             <div key={item.id} className={styles.card}>
@@ -100,6 +112,7 @@ const StaffModal = ({ id, onSelect, postUrl }) => {
             </div>
           ))}
         </Spin>
+        {state.noMore && <div className="text-center text-gray-400 my-4">已到底部</div>}
       </div>
     </CustomModal>
   )