lanjianrong 5 lat temu
rodzic
commit
5b574055cf

+ 0 - 32
src/models/customer.js

@@ -1,32 +0,0 @@
-import consts from '@/consts'
-import { queryNatures } from '@/services/customer'
-
-export default {
-  namespace: 'customer',
-  state: {
-    natures: [] // 客户性质列表
-  },
-  effects: {
-    *fetch({ payload }, { call, put }) {
-      const response = yield call(queryNatures, payload)
-      if (response && response.code === consts.RET_CODE.SUCCESS) {
-        yield put({
-          type: 'changeState',
-          payload: {
-            key: 'natures',
-            data: response.data
-          }
-        })
-      }
-    }
-  },
-  reducers: {
-    // 通用reducer
-    changeState(state, action) {
-      return {
-        ...state,
-        [action.payload.key]: action.payload.data
-      }
-    }
-  }
-}

src/models/client.js → src/pages/Customer/Client/model.js


+ 3 - 3
src/pages/Customer/Company/components/AddCompany/index.jsx

@@ -17,7 +17,7 @@ const AddCompanyModal = ({ dataId, dataType, onConfirm, dispatch, natures }) =>
   useEffect(() => {
   useEffect(() => {
     const getNatures = () => {
     const getNatures = () => {
       dispatch({
       dispatch({
-        type: 'customer/fetch'
+        type: 'company/fetchNatures'
       })
       })
     }
     }
     !natures.length && getNatures()
     !natures.length && getNatures()
@@ -95,6 +95,6 @@ const AddCompanyModal = ({ dataId, dataType, onConfirm, dispatch, natures }) =>
   )
   )
 }
 }
 
 
-export default connect(({ customer }) => ({
-  natures: customer.natures
+export default connect(({ company }) => ({
+  natures: company.natures
 }))(AddCompanyModal)
 }))(AddCompanyModal)

+ 14 - 1
src/models/company.js

@@ -3,11 +3,12 @@ import {
   LabelStatusColorMap,
   LabelStatusColorMap,
   TagTypeEnum
   TagTypeEnum
 } from '@/pages/Customer/Company/components/PersonLabel/const'
 } from '@/pages/Customer/Company/components/PersonLabel/const'
-import { queryTagList } from '@/services/customer'
+import { queryNatures, queryTagList } from '@/services/customer'
 
 
 export default {
 export default {
   namespace: 'company',
   namespace: 'company',
   state: {
   state: {
+    natures: [], // 客户性质
     personTags: [], // 个人标签
     personTags: [], // 个人标签
     personTagColorMap: {}, // 个人标签的颜色映射关系
     personTagColorMap: {}, // 个人标签的颜色映射关系
     teamTags: [], // 协作标签
     teamTags: [], // 协作标签
@@ -37,6 +38,18 @@ export default {
           }
           }
         })
         })
       }
       }
+    },
+    *fetchNatures({ payload }, { call, put }) {
+      const response = yield call(queryNatures, payload)
+      if (response && response.code === consts.RET_CODE.SUCCESS) {
+        yield put({
+          type: 'changeState',
+          payload: {
+            key: 'natures',
+            data: response.data
+          }
+        })
+      }
     }
     }
   },
   },
   reducers: {
   reducers: {

+ 0 - 1
src/models/lock.js

@@ -16,7 +16,6 @@ export default {
           type: 'show',
           type: 'show',
           payload: response.data
           payload: response.data
         })
         })
-
       }
       }
       // console.log(response)
       // console.log(response)
     }
     }

src/models/staff.js → src/pages/Staff/model.js