lanjianrong 4 år sedan
förälder
incheckning
d5b7f605cc
1 ändrade filer med 18 tillägg och 27 borttagningar
  1. 18 27
      src/pages/Workbench/Dashboard/index.jsx

+ 18 - 27
src/pages/Workbench/Dashboard/index.jsx

@@ -77,21 +77,24 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       pageSize: 100
     })
     if (code === consts.RET_CODE.SUCCESS && canSetState) {
+      // list存起来,同时将员工列表id整个塞进params获取当前部门所有人的数据(变向)
       setState({
         ...state,
-        staffList: list
+        staffList: list,
+        params: { ...state.params, staffIds: list.map(item => item.id) }
       })
     }
     return list
   }
   const handleStaffClick = id => {
     const sId = `s_${id}`
-    if (state.params.staffIds?.includes(sId)) {
+    // 反选,调整回选择部门下的所有人
+    if (state.params.staffIds?.length === 1 && state.params.staffIds?.includes(sId)) {
       setState({
         ...state,
         selectId: null,
         immediate: true,
-        params: { ...state.params, staffIds: null }
+        params: { ...state.params, staffIds: state.staffList.map(item => `s_${item.id}`) }
       })
       return
     }
@@ -188,8 +191,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '7day')}
-          className="text-primary cursor-pointer hover:text-hex-967bbd"
-        >
+          className="text-primary cursor-pointer hover:text-hex-967bbd">
           {name}
         </span>
       )
@@ -200,8 +202,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '15day')}
-          className="text-primary cursor-pointer hover:text-hex-967bbd"
-        >
+          className="text-primary cursor-pointer hover:text-hex-967bbd">
           {name}
         </span>
       )
@@ -212,8 +213,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '30day')}
-          className="text-primary cursor-pointer hover:text-hex-967bbd"
-        >
+          className="text-primary cursor-pointer hover:text-hex-967bbd">
           {name}
         </span>
       )
@@ -224,8 +224,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '3month')}
-          className="text-primary cursor-pointer hover:text-hex-967bbd"
-        >
+          className="text-primary cursor-pointer hover:text-hex-967bbd">
           {name}
         </span>
       )
@@ -236,8 +235,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (name, record) => (
         <span
           onClick={() => handleReminderList(record.type, '9month')}
-          className="text-primary cursor-pointer hover:text-hex-967bbd"
-        >
+          className="text-primary cursor-pointer hover:text-hex-967bbd">
           {name}
         </span>
       )
@@ -250,8 +248,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (_, record) => (
         <span
           onClick={() => handleReminderList(record.type, 'expiry')}
-          className="text-primary cursor-pointer hover:text-hex-967bbd"
-        >
+          className="text-primary cursor-pointer hover:text-hex-967bbd">
           {record.remind.expiry}
         </span>
       )
@@ -262,8 +259,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       render: (_, record) => (
         <span
           onClick={() => handleReminderList(record.type, 'unexpired')}
-          className="text-primary cursor-pointer hover:text-hex-967bbd"
-        >
+          className="text-primary cursor-pointer hover:text-hex-967bbd">
           {record.remind.unexpired}
         </span>
       )
@@ -408,8 +404,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                   [styles.active]: state.selectId === item.id
                 })}
                 key={item.id}
-                onClick={() => handleStaffClick(item.id)}
-              >
+                onClick={() => handleStaffClick(item.id)}>
                 <img
                   className="w-full max-w-30px h-30px border rounded-30px"
                   src={
@@ -441,8 +436,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                       className={[
                         'text-xl',
                         state.clientChainRatio.percentage.startsWith('-') ? 'text-green-500' : 'text-red-500'
-                      ].join(' ')}
-                    >
+                      ].join(' ')}>
                       {state.clientChainRatio.percentage}
                     </span>
                   </div>
@@ -475,8 +469,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                         state.customerChainRatio.percentage.startsWith('-')
                           ? 'text-green-500'
                           : 'text-red-500'
-                      ].join(' ')}
-                    >
+                      ].join(' ')}>
                       {state.customerChainRatio.percentage}
                     </span>
                   </div>
@@ -548,8 +541,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                         state.serviceLogChainRatio.percentage.startsWith('-')
                           ? 'text-green-500'
                           : 'text-red-500'
-                      ].join(' ')}
-                    >
+                      ].join(' ')}>
                       {state.serviceLogChainRatio.percentage}
                     </span>
                   </div>
@@ -580,8 +572,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
               title="数据汇总"
               className="shadow-card"
               bodyStyle={{ padding: state.loading ? '24px' : 0 }}
-              loading={state.loading}
-            >
+              loading={state.loading}>
               <ul>
                 <li className="px-12px py-16px border-b-1">
                   新增客户<b className="px-1">{state.aggregation.clientCount}</b>个,服务