|
@@ -18,6 +18,7 @@ import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
|
|
|
import { WORKBENCH_CYCLICAL_KEY } from '@/utils/cache/cacheEnum'
|
|
import { WORKBENCH_CYCLICAL_KEY } from '@/utils/cache/cacheEnum'
|
|
|
import styles from './index.less'
|
|
import styles from './index.less'
|
|
|
import { isDevMode } from '@/utils/env'
|
|
import { isDevMode } from '@/utils/env'
|
|
|
|
|
+import { isMobile } from '@/utils/is'
|
|
|
|
|
|
|
|
const Dashboard = ({ dispatch, departments = [] }) => {
|
|
const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
const { initialState: { currentUser } = { currentUser: {} } } = useModel('@@initialState')
|
|
const { initialState: { currentUser } = { currentUser: {} } } = useModel('@@initialState')
|
|
@@ -33,7 +34,6 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
selectId: '',
|
|
selectId: '',
|
|
|
disabled: true,
|
|
disabled: true,
|
|
|
loading: true,
|
|
loading: true,
|
|
|
- staffIds: null,
|
|
|
|
|
immediate: false,
|
|
immediate: false,
|
|
|
visible: false,
|
|
visible: false,
|
|
|
reminderData: [],
|
|
reminderData: [],
|
|
@@ -90,12 +90,25 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
})
|
|
})
|
|
|
if (code === consts.RET_CODE.SUCCESS && canSetState) {
|
|
if (code === consts.RET_CODE.SUCCESS && canSetState) {
|
|
|
// list存起来
|
|
// list存起来
|
|
|
- setState({ ...state, staffList: list })
|
|
|
|
|
|
|
+ setState({
|
|
|
|
|
+ ...state,
|
|
|
|
|
+ staffList: list,
|
|
|
|
|
+ params: { ...state.params, staffIds: list.map(item => `s_${item.id}`) }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
return list
|
|
return list
|
|
|
}
|
|
}
|
|
|
const handleStaffClick = id => {
|
|
const handleStaffClick = id => {
|
|
|
const sId = `s_${id}`
|
|
const sId = `s_${id}`
|
|
|
|
|
+ if (state.params.staffIds?.includes(sId)) {
|
|
|
|
|
+ setState({
|
|
|
|
|
+ ...state,
|
|
|
|
|
+ selectId: null,
|
|
|
|
|
+ immediate: true,
|
|
|
|
|
+ params: { ...state.params, staffIds: null }
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
setState({
|
|
setState({
|
|
|
...state,
|
|
...state,
|
|
|
selectId: id,
|
|
selectId: id,
|
|
@@ -315,7 +328,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
dataType="workbench"
|
|
dataType="workbench"
|
|
|
/>
|
|
/>
|
|
|
</span>
|
|
</span>
|
|
|
- {state.params.dataPermission === 'all' ? (
|
|
|
|
|
|
|
+ {!isMobile() && state.params.dataPermission === 'all' ? (
|
|
|
<TreeSelect
|
|
<TreeSelect
|
|
|
size="middle"
|
|
size="middle"
|
|
|
style={{ width: 150 }}
|
|
style={{ width: 150 }}
|
|
@@ -327,12 +340,22 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
treeData={departments}
|
|
treeData={departments}
|
|
|
allowClear
|
|
allowClear
|
|
|
onSelect={queryStaffList}
|
|
onSelect={queryStaffList}
|
|
|
|
|
+ onChange={e => {
|
|
|
|
|
+ if (!e)
|
|
|
|
|
+ setState({
|
|
|
|
|
+ ...state,
|
|
|
|
|
+ params: { ...state.params, staffIds: null },
|
|
|
|
|
+ staffList: [],
|
|
|
|
|
+ selectId: null
|
|
|
|
|
+ })
|
|
|
|
|
+ }}
|
|
|
/>
|
|
/>
|
|
|
) : null}
|
|
) : null}
|
|
|
</span>
|
|
</span>
|
|
|
|
|
|
|
|
<div className="flex items-center flex-row ml-2">
|
|
<div className="flex items-center flex-row ml-2">
|
|
|
- {['all', 'department'].includes(state.params.dataPermission) &&
|
|
|
|
|
|
|
+ {!isMobile() &&
|
|
|
|
|
+ ['all', 'department'].includes(state.params.dataPermission) &&
|
|
|
state.staffList.map(item => (
|
|
state.staffList.map(item => (
|
|
|
<div key={item.id} onClick={() => handleStaffClick(item.id)}>
|
|
<div key={item.id} onClick={() => handleStaffClick(item.id)}>
|
|
|
<div
|
|
<div
|