Procházet zdrojové kódy

feat: 客户-来源列增加筛选功能

lanjianrong před 4 roky
rodič
revize
a8860c49a2

+ 2 - 2
src/components/ModalStore/src/CreateProvider.tsx

@@ -82,6 +82,8 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
   }
 
   function push(key: string, compState: any) {
+    console.log(key)
+
     const isDrawer = key.startsWith('D')
     // eslint-disable-next-line no-param-reassign
     key = isDrawer && compState?.dataId ? `${key}@${compState?.dataId}` : key
@@ -128,8 +130,6 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
       return nextModals
     })
     if (isDrawer) {
-      console.log(state.currentModal.find(item => item.key === key))
-
       if (state.currentModal.find(item => item.key === key)) return
       // 利用事件循环,先让dom元素渲染出来再使其展示动画(否则可能导致抽屉无动画直接出现)
       setTimeout(() => {

+ 15 - 2
src/pages/Customer/Client/index.jsx

@@ -28,7 +28,8 @@ const Client = props => {
     teamTags,
     dispatch,
     shouldUpdate,
-    loading
+    loading,
+    sourceList
   } = props
 
   const { initialState: { permData } = { permData: {} } } = useModel('@@initialState')
@@ -83,6 +84,11 @@ const Client = props => {
 
   // 默认刷新一次列表请求数据
   useEffect(() => {
+    if (!sourceList?.length) {
+      dispatch({
+        type: 'client/fetchSourceList'
+      })
+    }
     if (!personTags.length) {
       dispatch({
         type: 'client/fetchPersonTags',
@@ -351,7 +357,13 @@ const Client = props => {
       dataIndex: 'sourceName',
       key: 'sourceName',
       width: 80,
-      search: false
+      search: false,
+      filters: true,
+      filterMultiple: false,
+      valueEnum: sourceList.reduce((prev, curr) => {
+        prev[curr.value] = { text: curr.label }
+        return prev
+      }, {})
     },
     {
       title: '备注',
@@ -600,6 +612,7 @@ const Client = props => {
 export default connect(({ client, refresh, loading }) => ({
   personTagColorMap: client.personTagColorMap,
   personTags: client.personTags,
+  sourceList: client.sourceList,
   teamTagColorMap: client.teamTagColorMap,
   teamTags: client.teamTags,
   loading: loading.models.client,

+ 2 - 2
src/pages/Workbench/Dashboard/components/RatioPanels.jsx

@@ -67,7 +67,7 @@ const ServiceRatioPanels = ({ dispatchModal, staffIds, cyclical, dataPermission
       render: (text, record) => (
         <span
           onClick={() => showDrawer(record[activeKeyMap[state.activeKey].id])}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
         >
           {text}
         </span>
@@ -186,7 +186,7 @@ const RatioPanels = ({ dataType, staffIds, retioCyclical, dataPermission, ...res
         render: (companyName, record) => (
           <span
             className="text-primary cursor-pointer hover:text-[#967bbd]"
-            onClick={() => dispatchModal('D_CLIENT_DETAIL', { dataId: record.companyId })}
+            onClick={() => dispatchModal('D_COMPANY_DETAIL', { dataId: record.companyId })}
           >
             {companyName}
           </span>

+ 7 - 11
src/pages/Workbench/Dashboard/index.jsx

@@ -187,7 +187,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '7day')}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
         >
           {name}
         </span>
@@ -199,7 +199,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '15day')}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
         >
           {name}
         </span>
@@ -211,7 +211,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '30day')}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
         >
           {name}
         </span>
@@ -223,7 +223,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '3month')}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
         >
           {name}
         </span>
@@ -235,7 +235,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '6month')}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
         >
           {name}
         </span>
@@ -247,7 +247,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, 'reminder')}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
         >
           {name}
         </span>
@@ -255,9 +255,6 @@ const Dashboard = ({ dispatch, departments = [] }) => {
     }
   ]
 
-  // const handleChangeGroupId = e =>
-  //   setState({ ...state, immediate: true, params: { ...state.params, businessGroupId: e } })
-
   // 处理权限Select下拉组件OnChange事件
   const handlePermChange = ({ staffIds = [], dataPermission }) => {
     if (staffIds?.length) {
@@ -346,8 +343,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
         </span>
 
         <div className="flex items-center flex-row ml-2">
-          {!isMobile() &&
-            ['all', 'department'].includes(state.params.dataPermission) &&
+          {['all', 'department'].includes(state.params.dataPermission) &&
             state.staffList.map(item => (
               <div key={item.id} onClick={() => handleStaffClick(item.id)}>
                 <div