|
@@ -67,6 +67,13 @@ $(function () {
|
|
|
}, null, true);
|
|
|
|
|
|
const ledgerSpreadObj = {
|
|
|
+ getselectButton: function() {
|
|
|
+ return {
|
|
|
+ select_siblings: $('#select_siblings').is(':checked'),
|
|
|
+ select_other_siblings: $('#select_other_siblings').is(':checked'),
|
|
|
+ select_children: $('#select_children').is(':checked'),
|
|
|
+ }
|
|
|
+ },
|
|
|
refreshTree: function (sheet, data) {
|
|
|
SpreadJsObj.massOperationSheet(sheet, function () {
|
|
|
const tree = sheet.zh_tree;
|
|
@@ -131,8 +138,16 @@ $(function () {
|
|
|
select.is_select = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
selects.splice(0, selects.length);
|
|
|
selects.push(select);
|
|
|
- updateChildrenSelect(select.children, select.is_select);
|
|
|
- updateParentSelect(info.sheet.zh_tree, select.ledger_pid, select.is_select);
|
|
|
+ const select_msg = ledgerSpreadObj.getselectButton();
|
|
|
+ if (select_msg.select_children || select.is_select === 0) {
|
|
|
+ updateChildrenSelect(select.children, select.is_select);
|
|
|
+ }
|
|
|
+ if (select_msg.select_siblings) {
|
|
|
+ updateSiblingsSelect(info.sheet.zh_tree, select.ledger_pid, select.is_select, select_msg);
|
|
|
+ }
|
|
|
+ if(select.is_select === 1) {
|
|
|
+ updateParentSelect(info.sheet.zh_tree, select.ledger_pid, select.is_select);
|
|
|
+ }
|
|
|
// console.log(selects);
|
|
|
const refreshNode = ledgerTree.loadPostData({update: selects});
|
|
|
ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
|
|
@@ -188,6 +203,20 @@ function updateChildrenSelect(datas, is_select) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function updateSiblingsSelect(tree, pid, is_select, select_msg) {
|
|
|
+ console.log(tree);
|
|
|
+ const parent = pid !== -1 ? _.find(tree.nodes, { 'ledger_id': pid }) : tree;
|
|
|
+ if (parent) {
|
|
|
+ for(const d of parent.children) {
|
|
|
+ d.is_select = is_select;
|
|
|
+ if (select_msg.select_children || is_select === 0) {
|
|
|
+ updateChildrenSelect(d.children, is_select);
|
|
|
+ }
|
|
|
+ selects.push(d);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function updateParentSelect(tree, pid, is_select) {
|
|
|
if (pid !== -1) {
|
|
|
const parent = _.find(tree.nodes, { 'ledger_id': pid });
|