From 2a30b9ce5088ad3271b856aed5eb47242352fa7e Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Sun, 10 Nov 2019 23:51:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20options=20=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scss/components/form/_tree.scss | 4 ++-- src/components/Tree.tsx | 11 ++++++++--- src/renderers/Form/Options.tsx | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scss/components/form/_tree.scss b/scss/components/form/_tree.scss index 3e5def7b..9ed36626 100644 --- a/scss/components/form/_tree.scss +++ b/scss/components/form/_tree.scss @@ -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; } diff --git a/src/components/Tree.tsx b/src/components/Tree.tsx index f90f61c0..477c6925 100644 --- a/src/components/Tree.tsx +++ b/src/components/Tree.tsx @@ -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 (
  • - ) : !childrenItems && item.placeholder ? ( -
    {item.placeholder}
    + ) : !childrenItems && item.placeholder && unfolded[item[valueField]] ? ( + ) : null}
  • ); diff --git a/src/renderers/Form/Options.tsx b/src/renderers/Form/Options.tsx index d8f1e06b..bf187936 100644 --- a/src/renderers/Form/Options.tsx +++ b/src/renderers/Form/Options.tsx @@ -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; }