outaozhen 5 lat temu
rodzic
commit
c43e57dad5
1 zmienionych plików z 12 dodań i 16 usunięć
  1. 12 16
      src/pages/Customer/Contact/index.jsx

+ 12 - 16
src/pages/Customer/Contact/index.jsx

@@ -16,7 +16,7 @@ import { useModal } from '@/components/Modal'
 
 const Contact = props => {
   const { toggleDrawer, setDrawerProps } = useModal()
-  const { dispatch, collapsed, shouldUpdate } = props
+  const { collapsed } = props
   const needSubtractHeight = 48 + 48 + 48 + 64 + 24 + 32 // 需要被裁掉的高度
   const needSubtractWidth = (collapsed ? 208 : 48) + 48 + 48 + 48 // 需要被裁掉的高度
 
@@ -45,12 +45,6 @@ const Contact = props => {
       }
     } = await queryContact(payload)
     if (code === consts.RET_CODE.SUCCESS) {
-      if (shouldUpdate) {
-        dispatch({
-          type: 'refresh/commitAction',
-          payload: 'contact'
-        })
-      }
       setState({ ...state, data: client, journal: log, servicelist: serviceLog, total })
       if (addClient.visible) {
         setAddClient({ ...addClient, loading: false, visible: false })
@@ -340,12 +334,16 @@ const Contact = props => {
       show: false
     }
   })
+
+  // useEffect(() => {
+  //   if (shouldUpdate) {
+  //     initData()
+  // }, [shouldUpdate])
+
+  // 默认刷新一次列表请求数据
   useEffect(() => {
-    if (shouldUpdate) {
-      initData()
-    }
-    // initData()
-  }, [shouldUpdate])
+    initData()
+  }, [])
 
   const handleSearch = value => {
     initData({ search: value })
@@ -397,7 +395,6 @@ const Contact = props => {
           columnsStateMap={columnsStateMap}
           onColumnsStateChange={map => setColumnsStateMap(map)}
           headerTitle="联系人"
-          // type="contactlist"
           // toolBarRender={() => [
           //   <Button key="button" type="primary">
           //     <SvgIcon type="icon-plus" />
@@ -416,8 +413,7 @@ const Contact = props => {
   )
 }
 
-export default connect(({ district, loading, refresh }) => ({
+export default connect(({ district, loading }) => ({
   districtName: district,
-  getlist: loading.effects['contact/fetch'],
-  shouldUpdate: refresh.contact
+  getlist: loading.effects['contact/fetch']
 }))(Contact)