Преглед изворни кода

fix: 客户服务列调整

lanjianrong пре 5 година
родитељ
комит
0cc7335c8f
1 измењених фајлова са 13 додато и 76 уклоњено
  1. 13 76
      src/pages/workbench/Dashboard/components/RatioPanels.jsx

+ 13 - 76
src/pages/workbench/Dashboard/components/RatioPanels.jsx

@@ -41,105 +41,42 @@ const renderBadge = (count, active = false) => {
 }
 
 /** 服务环比数据Tab切换表格 */
-const ServiceRatioPanels = ({ cyclical, dataPermission, dataType }) => {
+const ServiceRatioPanels = ({ cyclical, dataPermission }) => {
+  const activeKeyMap = {
+    0: { key: 'clientName', title: '联系人' },
+    1: { key: 'customerName', title: '客户' },
+    2: { key: 'businessName', title: '商机' }
+  }
   const [state, setState] = useState({
     activeKey: '0',
     total: 0
   })
 
-  const clientColumns = [
-    {
-      dataIndex: 'clientName',
-      title: '联系人名称',
-      width: '10%'
-    },
+  const columns = [
     {
-      dataIndex: 'customerName',
-      title: '客户名称',
+      dataIndex: activeKeyMap[state.activeKey].key,
+      title: `${activeKeyMap[state.activeKey].title}名称`,
       width: '20%'
     },
     {
       dataIndex: 'status',
       title: '服务类型',
-      width: '10%',
-      render: type => servicelogEnum[type]
-    },
-    {
-      dataIndex: 'date',
-      title: '服务日期',
-      width: '10%',
-      valueType: 'date'
-    },
-    {
-      dataIndex: 'mark',
-      width: '50%',
-      title: '服务内容'
-    }
-  ]
-  const customerColumns = [
-    {
-      dataIndex: 'clientName',
-      title: '客户名称',
-      width: '10%'
-    },
-    {
-      dataIndex: 'status',
-      title: '服务类型',
-      width: '10%',
-      render: type => servicelogEnum[type]
-    },
-    {
-      dataIndex: 'date',
-      title: '服务日期',
-      width: '10%',
-      valueType: 'date'
-    },
-    {
-      dataIndex: 'mark',
-      width: '50%',
-      title: '服务内容'
-    }
-  ]
-  const businessColumns = [
-    {
-      dataIndex: 'name',
-      title: '商机名称',
-      width: '10%'
-    },
-    {
-      dataIndex: 'status',
-      title: '服务类型',
-      width: '10%',
+      width: '15%',
       render: type => servicelogEnum[type]
     },
     {
       dataIndex: 'date',
       title: '服务日期',
-      width: '10%',
+      width: '15%',
       valueType: 'date'
     },
     {
       dataIndex: 'mark',
-      width: '50%',
+      width: '45%',
       title: '服务内容'
     }
   ]
 
-  const dataMap = {
-    0: {
-      key: 'client',
-      columns: clientColumns
-    },
-    1: {
-      key: 'customer',
-      columns: customerColumns
-    },
-    2: {
-      key: 'business',
-      columns: businessColumns
-    }
-  }
-
   return (
     <ProTable
       size="small"
@@ -147,7 +84,7 @@ const ServiceRatioPanels = ({ cyclical, dataPermission, dataType }) => {
       rowKey={record => record.id}
       scroll={{ y: 400 }}
       border={true}
-      columns={dataMap[dataType].columns}
+      columns={columns}
       search={false}
       toolbar={{
         settings: false,