优化 options 逻辑

This commit is contained in:
liaoxuezhi 2019-11-10 23:51:12 +08:00
parent 806a2f74d1
commit 2a30b9ce50
3 changed files with 12 additions and 5 deletions

View File

@ -229,12 +229,12 @@
&-item &-item>&-itemLabel,
&-item>&-placeholder {
&-item &-item>&-placeholder {
padding-left: $Tree-indent;
}
&-item &-item &-item>&-itemLabel,
&-item &-item>&-placeholder {
&-item &-item &-item>&-placeholder {
padding-left: $Tree-indent * 2;
}

View File

@ -540,7 +540,8 @@ export class TreeSelector extends React.Component<
/>
) : null;
const isLeaf = !item.children || !item.children.length;
const isLeaf =
(!item.children || !item.children.length) && !item.placeholder;
return (
<li
@ -646,8 +647,12 @@ export class TreeSelector extends React.Component<
) : null}
{childrenItems}
</ul>
) : !childrenItems && item.placeholder ? (
<div className={cx('Tree-placeholder')}>{item.placeholder}</div>
) : !childrenItems && item.placeholder && unfolded[item[valueField]] ? (
<ul className={cx('Tree-sublist')}>
<li className={cx('Tree-item')}>
<div className={cx('Tree-placeholder')}>{item.placeholder}</div>
</li>
</ul>
) : null}
</li>
);

View File

@ -540,6 +540,7 @@ export function registerOptionsControl(config: OptionsConfig) {
if (!payload.ok) {
env.notify('error', payload.msg || '新增失败,请仔细检查');
result = null;
} else {
result = payload.data || result;
}
@ -642,6 +643,7 @@ export function registerOptionsControl(config: OptionsConfig) {
if (!payload.ok) {
env.notify('error', payload.msg || '保存失败,请仔细检查');
result = null;
} else {
result = payload.data || result;
}