|
@@ -45,8 +45,7 @@ const OptionSelect: React.FC<OptionSelectProps> = ({ multiple = true, type, onCh
|
|
|
const { optionType, dataIds } = authOptions?.[type] || {}
|
|
const { optionType, dataIds } = authOptions?.[type] || {}
|
|
|
|
|
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
- optionType:
|
|
|
|
|
- optionType || (multiple ? statisticOptionMap.STAFF : statisticOptionMap.SINGLE_STAFF),
|
|
|
|
|
|
|
+ optionType: optionType || (multiple ? statisticOptionMap.STAFF : statisticOptionMap.SINGLE_STAFF),
|
|
|
dataIds: dataIds || [],
|
|
dataIds: dataIds || [],
|
|
|
department: [],
|
|
department: [],
|
|
|
staff: []
|
|
staff: []
|
|
@@ -54,8 +53,7 @@ const OptionSelect: React.FC<OptionSelectProps> = ({ multiple = true, type, onCh
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
const queryStaffAndDepartment = async () => {
|
|
const queryStaffAndDepartment = async () => {
|
|
|
- const { code = -1, data: { department = [], staff = [] } = {} } =
|
|
|
|
|
- await queryUsageSelectOptions()
|
|
|
|
|
|
|
+ const { code = -1, data: { department = [], staff = [] } = {} } = await queryUsageSelectOptions()
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
setState({
|
|
setState({
|
|
|
...state,
|
|
...state,
|
|
@@ -88,7 +86,8 @@ const OptionSelect: React.FC<OptionSelectProps> = ({ multiple = true, type, onCh
|
|
|
dropdownMatchSelectWidth: true,
|
|
dropdownMatchSelectWidth: true,
|
|
|
onChange: value => trySetOpIds(value),
|
|
onChange: value => trySetOpIds(value),
|
|
|
treeDefaultExpandAll: true,
|
|
treeDefaultExpandAll: true,
|
|
|
- treeNodeFilterProp: 'title'
|
|
|
|
|
|
|
+ treeNodeFilterProp: 'title',
|
|
|
|
|
+ maxTagCount: 5
|
|
|
}
|
|
}
|
|
|
if ([statisticOptionMap.STAFF, statisticOptionMap.DEPARTMENT].includes(state.optionType)) {
|
|
if ([statisticOptionMap.STAFF, statisticOptionMap.DEPARTMENT].includes(state.optionType)) {
|
|
|
base.multiple = true
|
|
base.multiple = true
|
|
@@ -97,17 +96,10 @@ const OptionSelect: React.FC<OptionSelectProps> = ({ multiple = true, type, onCh
|
|
|
if ([statisticOptionMap.STAFF, statisticOptionMap.SINGLE_STAFF].includes(state.optionType)) {
|
|
if ([statisticOptionMap.STAFF, statisticOptionMap.SINGLE_STAFF].includes(state.optionType)) {
|
|
|
base.showCheckedStrategy = 'SHOW_PARENT'
|
|
base.showCheckedStrategy = 'SHOW_PARENT'
|
|
|
|
|
|
|
|
- base.treeData =
|
|
|
|
|
- state.optionType === statisticOptionMap.SINGLE_STAFF
|
|
|
|
|
- ? generateTree(state.staff)
|
|
|
|
|
- : state.staff
|
|
|
|
|
|
|
+ base.treeData = state.optionType === statisticOptionMap.SINGLE_STAFF ? generateTree(state.staff) : state.staff
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (
|
|
|
|
|
- [statisticOptionMap.DEPARTMENT, statisticOptionMap.SINGLE_DEPARTMENT].includes(
|
|
|
|
|
- state.optionType
|
|
|
|
|
- )
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ if ([statisticOptionMap.DEPARTMENT, statisticOptionMap.SINGLE_DEPARTMENT].includes(state.optionType)) {
|
|
|
base.treeCheckable = state.optionType === statisticOptionMap.SINGLE_DEPARTMENT ? false : true
|
|
base.treeCheckable = state.optionType === statisticOptionMap.SINGLE_DEPARTMENT ? false : true
|
|
|
base.treeData = state.department
|
|
base.treeData = state.department
|
|
|
}
|
|
}
|