|
@@ -136,6 +136,7 @@ $(document).ready(function() {
|
|
|
};
|
|
|
const invalidAll = function () {
|
|
|
setObjEnable($('a[name=base-opr][type=add]'), false);
|
|
|
+ setObjEnable($('a[name=base-opr][type=add-child]'), false);
|
|
|
setObjEnable($('a[name=base-opr][type=delete]'), false);
|
|
|
setObjEnable($('a[name=base-opr][type=up-move]'), false);
|
|
|
setObjEnable($('a[name=base-opr][type=down-move]'), false);
|
|
@@ -190,6 +191,7 @@ $(document).ready(function() {
|
|
|
const valid = !sheet.zh_setting.readOnly;
|
|
|
|
|
|
setObjEnable($('a[name=base-opr][type=add]'), valid && first && first.level > 1);
|
|
|
+ setObjEnable($('a[name=base-opr][type=add-child]'), valid && first && !first.c_code && first.level >= 1);
|
|
|
setObjEnable($('a[name=base-opr][type=delete]'), valid && first && sameParent && first.level > 1 && childCanDel && this.checkDelete(first));
|
|
|
setObjEnable($('a[name=base-opr][type=up-move]'), valid && first && sameParent && first.level > 1 && preNode);
|
|
|
setObjEnable($('a[name=base-opr][type=down-move]'), valid && first && sameParent && first.level > 1 && !tree.isLastSibling(last));
|
|
@@ -504,7 +506,7 @@ $(document).ready(function() {
|
|
|
sheet.setSelection(tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
|
|
|
SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, tree.nodes.indexOf(node)]);
|
|
|
}
|
|
|
- } else if (type === 'add') {
|
|
|
+ } else if (type === 'add' || type === 'add-child') {
|
|
|
const sel = sheet.getSelections()[0];
|
|
|
if (sel) {
|
|
|
sheet.setSelection(tree.nodes.indexOf(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
|
|
@@ -863,7 +865,7 @@ $(document).ready(function() {
|
|
|
|
|
|
contractContextMenuOptions.items.create = {
|
|
|
name: '新增节点',
|
|
|
- icon: 'fa-sign-in',
|
|
|
+ icon: 'fa-plus',
|
|
|
callback: function (key, opt) {
|
|
|
contractTreeSpreadObj.baseOpr(contractSheet, 'add');
|
|
|
},
|
|
@@ -879,6 +881,25 @@ $(document).ready(function() {
|
|
|
return !(valid && first && first.level > 1);
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ contractContextMenuOptions.items.create3 = {
|
|
|
+ name: '新增子节点',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ contractTreeSpreadObj.baseOpr(contractSheet, 'add-child');
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const sheet = contractSheet;
|
|
|
+ const selection = sheet.getSelections();
|
|
|
+ const sel = selection ? selection[0] : sheet.getSelections()[0];
|
|
|
+ const row = sel ? sel.row : -1;
|
|
|
+ const tree = sheet.zh_tree;
|
|
|
+ if (!tree) return true;
|
|
|
+ const first = sheet.zh_tree.nodes[row];
|
|
|
+ const valid = !sheet.zh_setting.readOnly;
|
|
|
+ return !(valid && first && !first.c_code && first.level >= 1);
|
|
|
+ }
|
|
|
+ };
|
|
|
}
|
|
|
if (permission_add) {
|
|
|
contractContextMenuOptions.items.create2 = {
|