From a66971d49535db1683dbada63816484c966f805f Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Jun 2021 17:25:58 +0800 Subject: [PATCH] =?UTF-8?q?null=E5=80=BC=E6=98=BE=E7=A4=BA=E6=88=90?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/ztree/0.treeview.js | 14 +++++++++----- .../trigger/searcher.multiselect.insert.js | 10 +++++----- .../multiselect/trigger/searcher.multiselect.js | 12 ++++++------ .../multitree/trigger/searcher.list.multi.tree.js | 6 +++--- .../multitree/trigger/searcher.multi.tree.js | 10 +++++----- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/case/ztree/0.treeview.js b/src/case/ztree/0.treeview.js index 62abc929e..e9cb06dd7 100644 --- a/src/case/ztree/0.treeview.js +++ b/src/case/ztree/0.treeview.js @@ -95,7 +95,7 @@ BI.TreeView = BI.inherit(BI.Pane, { expandSpeed: "", nameIsHTML: true, // 节点可以用html标签代替 dblClickExpand: false, - showLine: o.showLine, + showLine: o.showLine }, callback: { beforeExpand: beforeExpand, @@ -238,7 +238,7 @@ BI.TreeView = BI.inherit(BI.Pane, { _getNodeValue: function (node) { // 去除标红 - return node.value == null ? BI.replaceAll(node.text.replace(/<[^>]+>/g, ""), " ", " ") : node.value; + return BI.isUndefined(node.value) ? BI.replaceAll(node.text.replace(/<[^>]+>/g, ""), " ", " ") : node.value; }, // 获取半选框值 @@ -338,10 +338,14 @@ BI.TreeView = BI.inherit(BI.Pane, { n.isParent = n.isParent || n.parent; n.value = BI.isUndefined(n.value) ? n.text : n.value; // 处理标红 - if (BI.isKey(o.paras.keyword)) { - n.text = BI.$("
").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); + if (BI.isNotNull(n.text)) { + if (BI.isKey(o.paras.keyword)) { + n.text = BI.$("
").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); + } else { + n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); + } } else { - n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); + n.text = ""; } }); return nodes; diff --git a/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/src/widget/multiselect/trigger/searcher.multiselect.insert.js index 8a4f561ae..e055f86f8 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.insert.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.insert.js @@ -135,9 +135,9 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { var state = ""; BI.each(ob.assist, function (i, v) { if (i === 0) { - state += "" + (o.valueFormatter(v + "") || v); + state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); } else { - state += "," + (o.valueFormatter(v + "") || v); + state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); } }); this.editor.setState(state); @@ -151,9 +151,9 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { var state = ""; BI.each(ob.value, function (i, v) { if (i === 0) { - state += "" + (o.valueFormatter(v + "") || v); + state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); } else { - state += "," + (o.valueFormatter(v + "") || v); + state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); } }); this.editor.setState(state); @@ -193,4 +193,4 @@ BI.MultiSelectInsertSearcher.EVENT_PAUSE = "EVENT_PAUSE"; BI.MultiSelectInsertSearcher.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiSelectInsertSearcher.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiSelectInsertSearcher.EVENT_BLUR = "EVENT_BLUR"; -BI.shortcut("bi.multi_select_insert_searcher", BI.MultiSelectInsertSearcher); \ No newline at end of file +BI.shortcut("bi.multi_select_insert_searcher", BI.MultiSelectInsertSearcher); diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index 9a54ed077..ec26eccca 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -133,9 +133,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { var state = ""; BI.each(ob.assist, function (i, v) { if (i === 0) { - state += "" + (o.valueFormatter(v + "") || v); + state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); } else { - state += "," + (o.valueFormatter(v + "") || v); + state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); } }); this.editor.setState(state); @@ -149,9 +149,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { var state = ""; BI.each(ob.value, function (i, v) { if (i === 0) { - state += "" + (o.valueFormatter(v + "") || v); + state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); } else { - state += "," + (o.valueFormatter(v + "") || v); + state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); } }); this.editor.setState(state); @@ -161,7 +161,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { } }, - getState: function() { + getState: function () { return this.editor.getState(); }, @@ -191,4 +191,4 @@ BI.MultiSelectSearcher.EVENT_PAUSE = "EVENT_PAUSE"; BI.MultiSelectSearcher.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiSelectSearcher.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiSelectSearcher.EVENT_BLUR = "EVENT_BLUR"; -BI.shortcut("bi.multi_select_searcher", BI.MultiSelectSearcher); \ No newline at end of file +BI.shortcut("bi.multi_select_searcher", BI.MultiSelectSearcher); diff --git a/src/widget/multitree/trigger/searcher.list.multi.tree.js b/src/widget/multitree/trigger/searcher.list.multi.tree.js index a116bb482..2a8d9f4c5 100644 --- a/src/widget/multitree/trigger/searcher.list.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.list.multi.tree.js @@ -122,7 +122,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, { var text = ""; BI.each(ob.value, function (idx, path) { var childValue = BI.last(path); - text += (o.valueFormatter(childValue + "") || childValue) + "; "; + text += (path === "null" ? "" : (o.valueFormatter(childValue + "") || childValue) + "; "); count++; }); @@ -134,7 +134,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, { } }, - getState: function() { + getState: function () { return this.editor.getState(); }, @@ -161,4 +161,4 @@ BI.MultiListTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiListTreeSearcher.EVENT_START = "EVENT_START"; BI.MultiListTreeSearcher.EVENT_STOP = "EVENT_STOP"; BI.MultiListTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; -BI.shortcut("bi.multi_list_tree_searcher", BI.MultiListTreeSearcher); \ No newline at end of file +BI.shortcut("bi.multi_list_tree_searcher", BI.MultiListTreeSearcher); diff --git a/src/widget/multitree/trigger/searcher.multi.tree.js b/src/widget/multitree/trigger/searcher.multi.tree.js index bf1ba235b..65738cd2d 100644 --- a/src/widget/multitree/trigger/searcher.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.multi.tree.js @@ -16,7 +16,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { popup: {}, adapter: null, - masker: {}, + masker: {} }); }, @@ -136,7 +136,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { var names = BI.Func.getSortedResult(BI.keys(value)); BI.each(names, function (idx, name) { var childNodes = getChildrenNode(value[name]); - text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + "; "; + text += (name === "null" ? "" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + "; "; if (childNodes === "") { count++; } @@ -156,7 +156,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { BI.each(names, function (idx, name) { index++; var childNodes = getChildrenNode(ob[name]); - text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); + text += (name === "null" ? "" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); if (childNodes === "") { count++; } @@ -165,7 +165,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { } }, - getState: function() { + getState: function () { return this.editor.getState(); }, @@ -193,4 +193,4 @@ BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiTreeSearcher.EVENT_START = "EVENT_START"; BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP"; BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; -BI.shortcut("bi.multi_tree_searcher", BI.MultiTreeSearcher); \ No newline at end of file +BI.shortcut("bi.multi_tree_searcher", BI.MultiTreeSearcher);