|
|
@@ -12,9 +12,21 @@ import { cardTypeMap, cyclicalOp } from './consts'
|
|
|
import BusinessChar from './components/BusinessChar'
|
|
|
import RatioPanels from './components/RatioPanels'
|
|
|
import PermSelect from '@/pages/Customer/Company/components/PermSelect'
|
|
|
+import { getAuthCache, setAuthCache } from '@/utils/auth'
|
|
|
+import { PERMISSION_SELECT_KEY, WORKBENCH_CYCLICAL_KEY } from '@/utils/cache/cacheEnum'
|
|
|
|
|
|
const Dashboard = () => {
|
|
|
const timer = useRef(null)
|
|
|
+ const permAuthCache = getAuthCache(PERMISSION_SELECT_KEY)
|
|
|
+ let defaultPermValue = 'onself'
|
|
|
+ if (permAuthCache && permAuthCache.workbench) {
|
|
|
+ defaultPermValue = permAuthCache.workbench
|
|
|
+ }
|
|
|
+ const cyclicalAuthCache = getAuthCache(WORKBENCH_CYCLICAL_KEY)
|
|
|
+ let defaultCyclicalValue = 'week'
|
|
|
+ if (cyclicalAuthCache) {
|
|
|
+ defaultCyclicalValue = cyclicalAuthCache
|
|
|
+ }
|
|
|
const [state, setState] = useState({
|
|
|
disabled: true,
|
|
|
loading: true,
|
|
|
@@ -30,7 +42,11 @@ const Dashboard = () => {
|
|
|
serviceLogChainRatio: {},
|
|
|
aggregation: {},
|
|
|
businessChar: {},
|
|
|
- params: { businessGroupId: '', dataPermission: 'oneself', cyclical: 'week' }
|
|
|
+ params: {
|
|
|
+ businessGroupId: '',
|
|
|
+ dataPermission: defaultPermValue,
|
|
|
+ cyclical: defaultCyclicalValue
|
|
|
+ }
|
|
|
})
|
|
|
const { toggleModal, setModalProps } = useModal()
|
|
|
// 展示服务弹窗详情
|
|
|
@@ -208,6 +224,11 @@ const Dashboard = () => {
|
|
|
params: { ...state.params, staffIds: null, dataPermission }
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ const handleCyclicalChange = value => {
|
|
|
+ setAuthCache(WORKBENCH_CYCLICAL_KEY, value)
|
|
|
+ setState({ ...state, immediate: true, params: { ...state.params, cyclical: value } })
|
|
|
+ }
|
|
|
return (
|
|
|
<div>
|
|
|
<div className="shadow-card">
|
|
|
@@ -240,10 +261,8 @@ const Dashboard = () => {
|
|
|
loading={state.loading}
|
|
|
options={cyclicalOp}
|
|
|
dropdownMatchSelectWidth={false}
|
|
|
- defaultValue="week"
|
|
|
- onChange={e =>
|
|
|
- setState({ ...state, immediate: true, params: { ...state.params, cyclical: e } })
|
|
|
- }
|
|
|
+ defaultValue={defaultCyclicalValue}
|
|
|
+ onChange={handleCyclicalChange}
|
|
|
/>
|
|
|
</span>
|
|
|
</div>
|