瀏覽代碼

不允许在台账首层应用模板

MaiXinRong 4 月之前
父節點
當前提交
50aff7157e
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      app/public/js/ledger.js

+ 6 - 2
app/public/js/ledger.js

@@ -1477,6 +1477,10 @@ $(document).ready(function() {
                 toastr.warning('请在协作范围内应用模板');
                 toastr.warning('请在协作范围内应用模板');
                 return;
                 return;
             }
             }
+            if (node.level === 1) {
+                toastr.warning('不可在顶层节点应用模板');
+                return;
+            }
 
 
             postData(window.location.pathname + '/update', {
             postData(window.location.pathname + '/update', {
                 postType: 'apply-template', postData: { id: ledgerTree.getNodeKey(node), templateId: template.id }
                 postType: 'apply-template', postData: { id: ledgerTree.getNodeKey(node), templateId: template.id }
@@ -2184,7 +2188,7 @@ $(document).ready(function() {
             icon: 'fa-file-excel-o',
             icon: 'fa-file-excel-o',
             disabled: function (key, opt) {
             disabled: function (key, opt) {
                 const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
                 const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
-                return readOnly || !node || !node._invalid
+                return readOnly || !node || node._invalid
                     || (node.children && node.children.length > 0)
                     || (node.children && node.children.length > 0)
                     || (!_.isNil(node.b_code) && node.b_code !== '');
                     || (!_.isNil(node.b_code) && node.b_code !== '');
             },
             },
@@ -2222,7 +2226,7 @@ $(document).ready(function() {
             icon: 'fa-link',
             icon: 'fa-link',
             disabled: function (key, opt) {
             disabled: function (key, opt) {
                 const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
                 const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
-                return readOnly || !node || !node._invalid
+                return readOnly || !node || node._invalid
                     || (node.children && node.children.length > 0)
                     || (node.children && node.children.length > 0)
                     || !ledgerTree.isLeafXmj(node);
                     || !ledgerTree.isLeafXmj(node);
             },
             },