From e2101d641553f41b92838aded197257fa62bbc40 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 31 Dec 2020 17:04:55 +0800 Subject: [PATCH] =?UTF-8?q?BI-79568=20multi=5Flayer=5Fdown=5Flist=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=97=A0=E9=99=90=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + .../multilayerdownlist/popup.downlist.js | 73 +++++++++---------- 2 files changed, 34 insertions(+), 40 deletions(-) diff --git a/changelog.md b/changelog.md index 3e69fb307..8840dab71 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-12) +- multi_layer_down_list_combo支持无限层级 - 新增不带全选的同步复选下拉框 - 日期选择控件为年月选择器子组件新增POPUP弹出前事件 - 文件上传控件新增API(setMaxFileLength)以动态设置最大上传文件数量 diff --git a/src/widget/multilayerdownlist/popup.downlist.js b/src/widget/multilayerdownlist/popup.downlist.js index d0b6b0d63..aea707d1b 100644 --- a/src/widget/multilayerdownlist/popup.downlist.js +++ b/src/widget/multilayerdownlist/popup.downlist.js @@ -109,33 +109,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { }, innerVGap: 5 }; - item.el.childValues = []; - BI.each(item.children, function (i, child) { - child = child.el ? BI.extend(child.el, {children: child.children}) : child; - var fatherValue = BI.deepClone(item.el.value); - var childValue = BI.deepClone(child.value); - self.singleValues.push(child.value); - child.type = "bi.down_list_item"; - child.extraCls = " child-down-list-item"; - child.title = child.title || child.text; - child.textRgap = 10; - child.isNeedAdjustWidth = false; - child.logic = { - dynamic: true - }; - child.father = fatherValue; - self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue; - self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue; - child.value = self._createChildValue(fatherValue, childValue); - item.el.childValues.push(child.value); - if (BI.isNotEmptyArray(child.children)) { - child.type = "bi.down_list_group_item"; - self._createChildren(child); - child.height = self.constants.height; - child.iconCls2 = self.constants.nextIcon; - item.el.childValues = BI.concat(item.el.childValues, child.childValues); - } - }); + self._createChildren(item); } else { item.type = "bi.down_list_item"; item.title = item.title || item.text; @@ -177,27 +151,46 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { return result; }, - _createChildren: function (child) { + _createChildren: function (item) { var self = this; - child.childValues = []; - BI.each(child.children, function (i, c) { - var fatherValue = BI.deepClone(child.value); - var childValue = BI.deepClone(c.value); - c.type = "bi.down_list_item"; - c.title = c.title || c.text; - c.textRgap = 10; - c.isNeedAdjustWidth = false; - c.logic = { + this._formatEL(item).el.childValues = []; + BI.each(item.children, function (i, child) { + child = child.el ? BI.extend(child.el, {children: child.children}) : child; + var fatherValue = BI.deepClone(self._formatEL(item).el.value); + var childValue = BI.deepClone(child.value); + self.singleValues.push(child.value); + child.type = "bi.down_list_item"; + child.extraCls = " child-down-list-item"; + child.title = child.title || child.text; + child.textRgap = 10; + child.isNeedAdjustWidth = false; + child.logic = { dynamic: true }; - c.father = fatherValue; + child.father = fatherValue; self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue; self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue; - c.value = self._createChildValue(fatherValue, childValue); - child.childValues.push(c.value); + child.value = self._createChildValue(fatherValue, childValue); + self._formatEL(item).el.childValues.push(child.value); + if (BI.isNotEmptyArray(child.children)) { + child.type = "bi.down_list_group_item"; + child.iconCls2 = self.constants.nextIcon; + child.height = self.constants.height; + self._createChildren(child); + } }); }, + _formatEL: function(obj) { + if (obj && obj.el) { + return obj; + } + + return { + el: obj + }; + }, + _isGroup: function (i) { return i.length > 1; },