lanjianrong 4 yıl önce
ebeveyn
işleme
6ebc017c3f

+ 9 - 9
src/pages/Workbench/Dashboard/components/RatioPanels.tsx

@@ -2,25 +2,25 @@ import React, { useState } from 'react'
 import ProTable from '@ant-design/pro-table'
 import { queryRatioPanelsList, queryServiceRatioPanelsList } from '@/services/dashboard'
 import consts from '@/consts'
-import { cardTypeMap } from '../consts'
+import { CardTypeMap } from '../util'
 import { Badge, Modal } from 'antd'
 import { useModal } from '@/components/ModalStore'
 import { servicelogEnum } from '@/pages/Customer/Client/components/ClientDetail/LowerList'
 
-const dataTypeEunm = {
-  0: {
+const dataTypeMap = {
+  [CardTypeMap.CLIENT]: {
     key: 'client',
     title: '新增客户'
   },
-  1: {
+  [CardTypeMap.COMPANY]: {
     key: 'customer',
     title: '新增单位'
   },
-  2: {
+  [CardTypeMap.BUSINESS]: {
     key: 'business',
     title: '新增商机'
   },
-  3: {
+  [CardTypeMap.SERVICE]: {
     key: 'service',
     title: '新增服务记录'
   }
@@ -315,11 +315,11 @@ const RatioPanels = ({ dataType, staffIds, retioCyclical, dataPermission, ...res
   return (
     <Modal
       {...resetModalProps}
-      title={`卡片详情(${dataTypeEunm[dataType].title})`}
+      title={`卡片详情(${dataTypeMap[dataType].title})`}
       footer={false}
       getContainer={() => document.getElementById('root')}
       width="90vw">
-      {dataType === cardTypeMap.SERVICE ? (
+      {dataType === CardTypeMap.SERVICE ? (
         <ServiceRatioPanels
           dispatchModal={dispatchModal}
           cyclical={retioCyclical}
@@ -340,7 +340,7 @@ const RatioPanels = ({ dataType, staffIds, retioCyclical, dataPermission, ...res
             request={async params => {
               const { code = -1, data } = await queryRatioPanelsList(params)
               return {
-                data: data[dataTypeEunm[dataType].key],
+                data: data[dataTypeMap[dataType].key],
                 success: code === consts.RET_CODE.SUCCESS,
                 total: data.total
               }

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

@@ -8,14 +8,12 @@ import { queryDashboard } from '@/services/dashboard'
 import { queryStaff } from '@/services/staff'
 import LeaderBoard from './components/LeaderBoard'
 import SoftLeaderboard from './components/SoftLeaderboard'
-import { cardTypeMap, cyclicalOp } from './consts'
-// import BusinessChar from './components/BusinessChar'
+import { CardTypeMap, cyclicalOp } from './util'
 import PermSelect, { PermDataTypeEunm } from '@/pages/Customer/Company/components/PermSelect'
 import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
 import { WORKBENCH_CYCLICAL_KEY } from '@/utils/cache/cacheEnum'
 import styles from './index.less'
 import { isDevMode } from '@/utils/env'
-import { isMobile } from '@/utils/is'
 import { useModal } from '@/components/ModalStore'
 import classNames from 'classnames'
 import { PageContainer } from '@ant-design/pro-layout'
@@ -409,7 +407,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                 {state.loading ? (
                   <Skeleton active avatar />
                 ) : (
-                  <Row className="cursor-pointer" onClick={() => handleRatioCard(cardTypeMap.CLIENT)}>
+                  <Row className="cursor-pointer" onClick={() => handleRatioCard(CardTypeMap.CLIENT)}>
                     <Col span={6}>
                       <div className="w-full max-w-12 h-12 rounded-1/2 bg-hex-0c7cd5 flex items-center justify-center">
                         <AddressBook size="26" fill="#fff" />
@@ -442,7 +440,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                 {state.loading ? (
                   <Skeleton active avatar />
                 ) : (
-                  <Row className="cursor-pointer" onClick={() => handleRatioCard(cardTypeMap.COMPANY)}>
+                  <Row className="cursor-pointer" onClick={() => handleRatioCard(CardTypeMap.COMPANY)}>
                     <Col span={6}>
                       <div className="w-full max-w-12 h-12 rounded-1/2 bg-hex-0c7cd5 flex items-center justify-center">
                         <City size="26" fill="#fff" />
@@ -478,7 +476,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
               ) : (
                 <Row
                   className="cursor-pointer"
-                  onClick={() => handleRatioCard(cardTypeMap.BUSINESS)}>
+                  onClick={() => handleRatioCard(CardTypeMap.BUSINESS)}>
                   <Col span={6}>
                     <div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
                       <Finance size="26" fill="#fff" />
@@ -514,7 +512,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                 {state.loading ? (
                   <Skeleton active avatar />
                 ) : (
-                  <Row onClick={() => handleRatioCard(cardTypeMap.SERVICE)} className="cursor-pointer">
+                  <Row onClick={() => handleRatioCard(CardTypeMap.SERVICE)} className="cursor-pointer">
                     <Col span={6}>
                       <div className="w-full max-w-12 h-12 rounded-1/2 bg-hex-0c7cd5 flex items-center justify-center">
                         <Comment size="26" fill="#fff" />

+ 5 - 5
src/pages/Workbench/Dashboard/consts.js

@@ -51,9 +51,9 @@ export const cyclicalOp = [
   }
 ]
 
-export const cardTypeMap = {
-  CLIENT: 0, // 客户
-  COMPANY: 1, // 单位
-  BUSINESS: 2, // 商机
-  SERVICE: 3 // 服务记录
+export enum CardTypeMap {
+  CLIENT = 0, // 客户
+  COMPANY = 1, // 单位
+  BUSINESS = 2, // 商机
+  SERVICE = 3 // 服务记录
 }