|
@@ -1018,90 +1018,90 @@ $(document).ready(function() {
|
|
|
}
|
|
|
};
|
|
|
contractContextMenuOptions.items.sprBase = '----';
|
|
|
- contractContextMenuOptions.items.copyBlock = {
|
|
|
- name: '复制整块(只复制节点)',
|
|
|
- icon: 'fa-files-o',
|
|
|
- callback: function (key, opt) {
|
|
|
- const copyBlockList = [];
|
|
|
- const sheet = contractSheet;
|
|
|
- const sel = sheet.getSelections()[0];
|
|
|
- let iRow = sel.row;
|
|
|
- const pid = sheet.zh_tree.nodes[iRow].contract_pid;
|
|
|
- while (iRow < sel.row + sel.rowCount) {
|
|
|
- const node = sheet.zh_tree.nodes[iRow];
|
|
|
- if (node.contract_pid !== pid) {
|
|
|
- toastr.error('仅可同时选中同层节点');
|
|
|
- return;
|
|
|
- }
|
|
|
- const posterity = sheet.zh_tree.getPosterity(node);
|
|
|
- iRow += posterity.length + 1;
|
|
|
- posterity.unshift(node);
|
|
|
- const copyData = sheet.zh_tree.getDefaultData(posterity);
|
|
|
- const newCopyData = _.filter(_.cloneDeep(copyData), function (d) {
|
|
|
- return d.c_code === undefined;
|
|
|
- });
|
|
|
- const newCopyBlock = [];
|
|
|
- for (const p of newCopyData) {
|
|
|
- const children = _.filter(newCopyData, function (item) {
|
|
|
- return item.contract_pid === p.contract_id;
|
|
|
- });
|
|
|
- if (children.length > 0) {
|
|
|
- let i = 1;
|
|
|
- for (const c of children) {
|
|
|
- c.order = i;
|
|
|
- i++;
|
|
|
- }
|
|
|
- } else {
|
|
|
- p.is_leaf = 1;
|
|
|
- }
|
|
|
- if (_.findIndex(newCopyBlock, { contract_id: p.contract_id }) === -1) {
|
|
|
- newCopyBlock.push(p);
|
|
|
- }
|
|
|
- }
|
|
|
- copyBlockList.push(newCopyBlock);
|
|
|
- }
|
|
|
- setLocalCache(copyBlockTag, JSON.stringify({ block: copyBlockList }));
|
|
|
- },
|
|
|
- visible: function (key, opt) {
|
|
|
- const sheet = contractSheet;
|
|
|
- const selection = sheet.getSelections();
|
|
|
- const row = selection[0].row;
|
|
|
- const select = contractTree.nodes[row];
|
|
|
- return select;
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- const sheet = contractSheet;
|
|
|
- const selection = sheet.getSelections();
|
|
|
- const row = selection[0].row;
|
|
|
- const select = contractTree.nodes[row];
|
|
|
- console.log(select);
|
|
|
- return !(select && select.level > 1 && !select.c_code);
|
|
|
- }
|
|
|
- };
|
|
|
- if (permission_edit) {
|
|
|
- contractContextMenuOptions.items.pasteBlock = {
|
|
|
- name: '粘贴整块',
|
|
|
- icon: 'fa-clipboard',
|
|
|
- disabled: function (key, opt) {
|
|
|
- //const block = treeOperationObj.block || [];
|
|
|
- const copyInfo = JSON.parse(getLocalCache(copyBlockTag));
|
|
|
- return !(copyInfo && copyInfo.block && copyInfo.block.length > 0);
|
|
|
- },
|
|
|
- callback: function (key, opt) {
|
|
|
- //const block = treeOperationObj.block || [];
|
|
|
- const copyInfo = JSON.parse(getLocalCache(copyBlockTag));
|
|
|
- if (copyInfo.block.length > 0) {
|
|
|
- contractTreeSpreadObj.pasteBlock(contractSpread, copyInfo);
|
|
|
- } else {
|
|
|
- document.execCommand('paste');
|
|
|
- }
|
|
|
- },
|
|
|
- visible: function (key, opt) {
|
|
|
- return permission_edit;
|
|
|
- }
|
|
|
- };
|
|
|
- contractContextMenuOptions.items.sprBlock = '----';
|
|
|
- }
|
|
|
+ // contractContextMenuOptions.items.copyBlock = {
|
|
|
+ // name: '复制整块(只复制节点)',
|
|
|
+ // icon: 'fa-files-o',
|
|
|
+ // callback: function (key, opt) {
|
|
|
+ // const copyBlockList = [];
|
|
|
+ // const sheet = contractSheet;
|
|
|
+ // const sel = sheet.getSelections()[0];
|
|
|
+ // let iRow = sel.row;
|
|
|
+ // const pid = sheet.zh_tree.nodes[iRow].contract_pid;
|
|
|
+ // while (iRow < sel.row + sel.rowCount) {
|
|
|
+ // const node = sheet.zh_tree.nodes[iRow];
|
|
|
+ // if (node.contract_pid !== pid) {
|
|
|
+ // toastr.error('仅可同时选中同层节点');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // const posterity = sheet.zh_tree.getPosterity(node);
|
|
|
+ // iRow += posterity.length + 1;
|
|
|
+ // posterity.unshift(node);
|
|
|
+ // const copyData = sheet.zh_tree.getDefaultData(posterity);
|
|
|
+ // const newCopyData = _.filter(_.cloneDeep(copyData), function (d) {
|
|
|
+ // return d.c_code === undefined;
|
|
|
+ // });
|
|
|
+ // const newCopyBlock = [];
|
|
|
+ // for (const p of newCopyData) {
|
|
|
+ // const children = _.filter(newCopyData, function (item) {
|
|
|
+ // return item.contract_pid === p.contract_id;
|
|
|
+ // });
|
|
|
+ // if (children.length > 0) {
|
|
|
+ // let i = 1;
|
|
|
+ // for (const c of children) {
|
|
|
+ // c.order = i;
|
|
|
+ // i++;
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // p.is_leaf = 1;
|
|
|
+ // }
|
|
|
+ // if (_.findIndex(newCopyBlock, { contract_id: p.contract_id }) === -1) {
|
|
|
+ // newCopyBlock.push(p);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // copyBlockList.push(newCopyBlock);
|
|
|
+ // }
|
|
|
+ // setLocalCache(copyBlockTag, JSON.stringify({ block: copyBlockList }));
|
|
|
+ // },
|
|
|
+ // visible: function (key, opt) {
|
|
|
+ // const sheet = contractSheet;
|
|
|
+ // const selection = sheet.getSelections();
|
|
|
+ // const row = selection[0].row;
|
|
|
+ // const select = contractTree.nodes[row];
|
|
|
+ // return select;
|
|
|
+ // },
|
|
|
+ // disabled: function (key, opt) {
|
|
|
+ // const sheet = contractSheet;
|
|
|
+ // const selection = sheet.getSelections();
|
|
|
+ // const row = selection[0].row;
|
|
|
+ // const select = contractTree.nodes[row];
|
|
|
+ // console.log(select);
|
|
|
+ // return !(select && select.level > 1 && !select.c_code);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // if (permission_edit) {
|
|
|
+ // contractContextMenuOptions.items.pasteBlock = {
|
|
|
+ // name: '粘贴整块',
|
|
|
+ // icon: 'fa-clipboard',
|
|
|
+ // disabled: function (key, opt) {
|
|
|
+ // //const block = treeOperationObj.block || [];
|
|
|
+ // const copyInfo = JSON.parse(getLocalCache(copyBlockTag));
|
|
|
+ // return !(copyInfo && copyInfo.block && copyInfo.block.length > 0);
|
|
|
+ // },
|
|
|
+ // callback: function (key, opt) {
|
|
|
+ // //const block = treeOperationObj.block || [];
|
|
|
+ // const copyInfo = JSON.parse(getLocalCache(copyBlockTag));
|
|
|
+ // if (copyInfo.block.length > 0) {
|
|
|
+ // contractTreeSpreadObj.pasteBlock(contractSpread, copyInfo);
|
|
|
+ // } else {
|
|
|
+ // document.execCommand('paste');
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // visible: function (key, opt) {
|
|
|
+ // return permission_edit;
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // contractContextMenuOptions.items.sprBlock = '----';
|
|
|
+ // }
|
|
|
if (permission_edit) {
|
|
|
contractContextMenuOptions.items.batchInsert = {
|
|
|
name: '批量插入',
|
|
@@ -1132,8 +1132,8 @@ $(document).ready(function() {
|
|
|
return !(valid && first && first.level > 1);
|
|
|
}
|
|
|
};
|
|
|
+ contractContextMenuOptions.items.sprTag = '----';
|
|
|
}
|
|
|
- contractContextMenuOptions.items.sprTag = '----';
|
|
|
contractContextMenuOptions.items.showLast = {
|
|
|
name: '显示至最底层',
|
|
|
callback: function (key, opt, menu, e) {
|