lanjianrong 4 năm trước cách đây
mục cha
commit
bdb92b7423
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      src/pages/Workbench/Dashboard/index.jsx

+ 6 - 4
src/pages/Workbench/Dashboard/index.jsx

@@ -76,22 +76,24 @@ const Dashboard = ({ dispatch, departments = [] }) => {
       pageSize: 100
     })
     if (code === consts.RET_CODE.SUCCESS && canSetState) {
-      // list存起来
+      // 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
     }