forked from p96170835/amis
优化 options 逻辑
This commit is contained in:
parent
806a2f74d1
commit
2a30b9ce50
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue