lanjianrong 4 lat temu
rodzic
commit
9ab68ae876

+ 5 - 5
src/components/Table/src/BasicTable.tsx

@@ -36,7 +36,6 @@ const BasicTable: {
   onSizeChange,
   bordered,
   rowSelection,
-  dataSource,
   onLoad,
   ...resetProps
 }) => {
@@ -56,7 +55,7 @@ const BasicTable: {
     sizeRef: 'middle',
     columnsStateMap: columnsStateMap,
     params: { staffIds: defaultStaffIds, dataPermission: defaultPermAuthCache },
-    dataSource
+    dataSource: resetProps.dataSource
   })
 
   const columnsRef = useMemo(() => {
@@ -81,8 +80,6 @@ const BasicTable: {
   })
 
   useLayoutEffect(() => {
-    console.log('11')
-
     state.dataSource && redoHeight(state.dataSource)
   }, [state.dataSource])
 
@@ -134,6 +131,8 @@ const BasicTable: {
       return {
         ...rowSelection,
         onChange: selectedRowKeys => {
+          console.log(selectedRowKeys)
+
           rowOnChange(selectedRowKeys)
           setState({ ...state, selectKeysRef: selectedRowKeys })
         }
@@ -142,6 +141,8 @@ const BasicTable: {
     return {
       ...rowSelection,
       onChange: selectedRowKeys => {
+        console.log(selectedRowKeys)
+
         setState({ ...state, selectKeysRef: selectedRowKeys })
       }
     }
@@ -172,7 +173,6 @@ const BasicTable: {
       <div ref={tableElRef} className={styles.BasicTable}>
         <ProTable
           {...resetProps}
-          dataSource={state.dataSource}
           rowKey={rowKey || 'id'}
           columns={originalColumns}
           params={computedParams}

+ 1 - 1
src/components/Table/src/hooks/useTableScroll.ts

@@ -110,7 +110,7 @@ export function useTableScroll({
   const { run: debounceRedoHeight } = useDebounceFn(redoHeight, { wait: 80 })
 
   // Greater than animation time 80
-  useWindowSizeFn(() => debounceRedoHeight(), 80)
+  useWindowSizeFn(() => debounceRedoHeight(), 0)
 
   useUpdateLayoutEffect(() => {
     debounceRedoHeight()

+ 8 - 4
src/pages/Customer/Client/index.jsx

@@ -16,6 +16,7 @@ import { getPermAuthCache } from '@/utils/auth'
 import { useModal } from '@/components/ModalStore'
 import { Plus } from '@icon-park/react'
 import { PageContainer } from '@ant-design/pro-layout'
+import { LoadingOutlined } from '@ant-design/icons'
 const Client = props => {
   const dispatchModal = useModal()
   const {
@@ -38,6 +39,7 @@ const Client = props => {
   })
 
   const [state, setState] = useState({
+    loading: false,
     params: {},
     orderIds: []
   })
@@ -446,6 +448,7 @@ const Client = props => {
 
   // 批量设置-确认触发
   const tagsSettingConfirm = async clientIds => {
+    setState({ ...state, loading: true })
     let requestSuccess = true
     if (tagState.tagIds.length) {
       const { code = -1 } = await apiBatchLink({
@@ -469,6 +472,7 @@ const Client = props => {
         requestSuccess = false
       }
     }
+    setState({ ...state, loading: false })
     requestSuccess && refreshData()
   }
 
@@ -525,10 +529,10 @@ const Client = props => {
             )}
           </PersonLabel>
         </div>
-        <Button onClick={() => tagsSettingConfirm(selectedRowKeys)}>
-          <Check size={14} />
-          确认
-        </Button>
+        <Button
+          onClick={() => tagsSettingConfirm(selectedRowKeys)}
+          icon={state.loading ? <LoadingOutlined /> : <Check size={14} />}
+        />
       </div>
     )
   }

+ 9 - 5
src/pages/Customer/Company/index.jsx

@@ -8,13 +8,14 @@ import PersonLabel from './components/PersonLabel'
 import { TagTypeEnum, TagDataTypeEnum, LabelModeType } from './components/PersonLabel/const'
 import { Add, Down, Check, Plus } from '@icon-park/react'
 import { apiBatchLink } from '@/services/customer'
-import styles from './index.less'
 import { generateFilterField, generateSortField } from '@/utils/utils'
 import { PermDataTypeEunm } from './components/PermSelect'
 import BasicTable from '@/components/Table'
 import { getPermAuthCache } from '@/utils/auth'
 import { useModal } from '@/components/ModalStore'
 import { PageContainer } from '@ant-design/pro-layout'
+import styles from './index.less'
+import { LoadingOutlined } from '@ant-design/icons'
 // import FilterCascader from '@/components/Table/src/components/FilterCascader'
 
 const Company = props => {
@@ -40,6 +41,7 @@ const Company = props => {
   })
 
   const [state, setState] = useState({
+    loading: false,
     params: {},
     orderIds: []
   })
@@ -367,6 +369,7 @@ const Company = props => {
 
   // 批量设置-确认触发
   const tagsSettingConfirm = async clientIds => {
+    setState({ ...state, loading: true })
     let requestSuccess = true
     if (tagState.tagIds.length) {
       const { code = -1 } = await apiBatchLink({
@@ -390,6 +393,7 @@ const Company = props => {
         requestSuccess = false
       }
     }
+    setState({ ...state, loading: false })
     requestSuccess && refreshData()
   }
 
@@ -446,10 +450,10 @@ const Company = props => {
             )}
           </PersonLabel>
         </div>
-        <Button onClick={() => tagsSettingConfirm(selectedRowKeys)}>
-          <Check size={14} />
-          确认
-        </Button>
+        <Button
+          onClick={() => tagsSettingConfirm(selectedRowKeys)}
+          icon={state.loading ? <LoadingOutlined /> : <Check size={14} />}
+        />
       </div>
     )
   }