forked from fanruan/fineui
Browse Source
* commit 'c1ca16a5992eedddada2dde80b07979ef5133e34': 无JIRA任务 添加一个路由,方便一些 无jira任务 fix: multi_select_combo 和 multi_select_insert_combo 统一逻辑,只有勾选了全选才认为是全选.es6
windy
6 years ago
7 changed files with 119 additions and 42 deletions
@ -0,0 +1,65 @@
|
||||
!(function () { |
||||
var Store = BI.inherit(Fix.Model, { |
||||
_init: function () { |
||||
|
||||
}, |
||||
|
||||
state: function () { |
||||
return { |
||||
activeCard: Demo.showIndex |
||||
}; |
||||
}, |
||||
|
||||
computed: {}, |
||||
|
||||
watch: {}, |
||||
|
||||
actions: { |
||||
init: function (cb) { |
||||
var tree = BI.Tree.transformToTreeFormat(Demo.CONFIG); |
||||
var traversal = function (array, callback) { |
||||
var t = []; |
||||
BI.some(array, function (i, item) { |
||||
var match = callback(i, item); |
||||
if (match) { |
||||
t.push(item.id); |
||||
} |
||||
var b = traversal(item.children, callback); |
||||
if (BI.isNotEmptyArray(b)) { |
||||
t = BI.concat([item.id], b); |
||||
} |
||||
}); |
||||
return t; |
||||
}; |
||||
var paths = traversal(tree, function (index, node) { |
||||
if (!node.children || BI.isEmptyArray(node.children)) { |
||||
if (node.value === Demo.showIndex) { |
||||
return true; |
||||
} |
||||
} |
||||
}); |
||||
BI.each(Demo.CONFIG, function (index, item) { |
||||
if (BI.contains(paths, item.id)) { |
||||
item.open = true; |
||||
} |
||||
}); |
||||
|
||||
cb(); |
||||
}, |
||||
|
||||
handleTreeSelectChange: function (v) { |
||||
this.model.activeCard = v; |
||||
var matched = BI.some(Demo.CONFIG, function (index, item) { |
||||
if (item.value === v) { |
||||
BI.history.navigate(item.text, {trigger: true}); |
||||
return true; |
||||
} |
||||
}); |
||||
if (!matched) { |
||||
BI.history.navigate("", {trigger: true}); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
BI.store("demo.store.main", Store); |
||||
})(); |
Loading…
Reference in new issue