Merge pull request #7143 from z1769057083/master

fix: 移动端人员选择
This commit is contained in:
刘丹 2023-06-12 17:57:55 +08:00 committed by GitHub
commit d4442e917c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -438,14 +438,30 @@ export class UserSelect extends React.Component<
labelField = 'label',
options = []
} = this.props;
const _selection = this.props.selection?.slice() || [];
const _selection = this.props.selection?.concat() || [];
if (Array.isArray(options?.[0]?.leftOptions)) {
eachTree(options[0].leftOptions, (item: Option) => {
const index = _selection.findIndex(
(item2: Option) => item2[valueField] === item[valueField]
);
if (!!~index) {
_selection.splice(index, 1, {
..._selection[index],
label: item[labelField]
});
}
});
}
eachTree(options, (item: Option) => {
const res = _selection.find(
const index = _selection.findIndex(
(item2: Option) => item2[valueField] === item[valueField]
);
if (res) {
res.label = item[labelField];
if (!!~index) {
_selection.splice(index, 1, {
..._selection[index],
label: item[labelField]
});
}
});
return _selection;
@ -704,8 +720,6 @@ export class UserSelect extends React.Component<
</span>
) : null}
{}
{!option.isRef ? (
labelField === 'avatar' ? (
option[labelField] ? (