Browse Source

标段列表,显示层次调整

MaiXinRong 2 years ago
parent
commit
5e4b3a3b11

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

@@ -1074,8 +1074,6 @@ $(document).ready(function() {
     ledgerSpread.bind(spreadNS.Events.ClipboardChanging, function (e, info) {
     ledgerSpread.bind(spreadNS.Events.ClipboardChanging, function (e, info) {
         const copyText = SpreadJsObj.getFilterCopyText(info.sheet);
         const copyText = SpreadJsObj.getFilterCopyText(info.sheet);
         SpreadJsObj.Clipboard.setCopyData(copyText);
         SpreadJsObj.Clipboard.setCopyData(copyText);
-        info.copyData.text = copyText;
-        info.copyData.html = SpreadJsObj.getFilterCopyHTML(info.sheet);
     });
     });
     if (!ledgerSpreadSetting.readOnly) {
     if (!ledgerSpreadSetting.readOnly) {
         ledgerSpread.bind(spreadNS.Events.SelectionChanged, function (e, info) {
         ledgerSpread.bind(spreadNS.Events.SelectionChanged, function (e, info) {

+ 21 - 2
app/public/js/shares/show_level.js

@@ -29,7 +29,7 @@ $.cs_showLevel = function (setting) {
             if (l.type === 'sort') {
             if (l.type === 'sort') {
                 let count = typeof l.count === 'function' ? l.count() : l.count;
                 let count = typeof l.count === 'function' ? l.count() : l.count;
                 count = Math.min(count, 5);
                 count = Math.min(count, 5);
-                for (let i = 1; i <= count; ++i) {
+                for (let i = 1; i <= l.count; ++i) {
                     html.push(`<a class="dropdown-item" name="showLevel" tag="${i}" href="javascript: void(0);">${sortTitle[i-1]}</a>`);
                     html.push(`<a class="dropdown-item" name="showLevel" tag="${i}" href="javascript: void(0);">${sortTitle[i-1]}</a>`);
                 }
                 }
             } else {
             } else {
@@ -48,7 +48,26 @@ $.cs_showLevel = function (setting) {
                 closeWaitingView();
                 closeWaitingView();
             });
             });
         });
         });
+        refreshMenuVisible();
     };
     };
 
 
-    return { initShowLevel } ;
+    const refreshMenuVisible = function () {
+        const showMenu = function (tag, visible) {
+            if (visible) $(`[tag=${tag}]`).show();
+            if (!visible) $(`[tag=${tag}]`).hide();
+        };
+        for (const l of setting.levels) {
+            if (l.type === 'sort') {
+                let visibleCount = typeof l.visible_count === 'function' ? l.visible_count() : l.visible_count;
+                for (let i = 1; i <= l.count; ++i) {
+                    showMenu(i, i <= visibleCount);
+                }
+            } else {
+                const visible = typeof l.visible === 'function' ? l.visible() : l.visible;
+                showMenu(l.type, visible);
+            }
+        }
+    };
+
+    return { initShowLevel, refreshMenuVisible } ;
 };
 };

+ 1 - 0
app/public/js/tender_list.js

@@ -399,6 +399,7 @@ $(document).ready(() => {
             $('.c-body').html(getTenderTreeHtml());
             $('.c-body').html(getTenderTreeHtml());
             localHideList();
             localHideList();
             $('#cate-set').modal('hide');
             $('#cate-set').modal('hide');
+            tenderTreeShowLevel.refreshMenuVisible();
         });
         });
     });
     });
     // 新增标段
     // 新增标段

+ 1 - 0
app/public/js/tender_list_info.js

@@ -476,6 +476,7 @@ $(document).ready(() => {
             $('.c-body').html(getTenderTreeHtml());
             $('.c-body').html(getTenderTreeHtml());
             localHideList();
             localHideList();
             $('#cate-set').modal('hide');
             $('#cate-set').modal('hide');
+            tenderTreeShowLevel.refreshMenuVisible();
         });
         });
     });
     });
     // 新增标段
     // 新增标段

+ 1 - 0
app/public/js/tender_list_manage.js

@@ -412,6 +412,7 @@ $(document).ready(() => {
             $('.c-body').html(getTenderTreeHtml());
             $('.c-body').html(getTenderTreeHtml());
             localHideList();
             localHideList();
             $('#cate-set').modal('hide');
             $('#cate-set').modal('hide');
+            tenderTreeShowLevel.refreshMenuVisible();
         });
         });
     });
     });
 
 

+ 1 - 0
app/public/js/tender_list_progress.js

@@ -448,6 +448,7 @@ $(document).ready(() => {
             $('.c-body').html(getTenderTreeHtml());
             $('.c-body').html(getTenderTreeHtml());
             localHideList();
             localHideList();
             $('#cate-set').modal('hide');
             $('#cate-set').modal('hide');
+            tenderTreeShowLevel.refreshMenuVisible();
         });
         });
     });
     });
     // 新增标段
     // 新增标段

+ 16 - 11
app/public/js/tender_showhide.js

@@ -155,6 +155,15 @@ function doTrStatus(node, status, all = '') {
 }
 }
 
 
 let tenderTreeShowLevel;
 let tenderTreeShowLevel;
+const getChildrenLevel = function (node) {
+    let iLevel = node.level;
+    if (node.children && node.children.length > 0) {
+        for (const c of node.children) {
+            iLevel = Math.max(iLevel, getChildrenLevel(c));
+        }
+    }
+    return iLevel;
+};
 
 
 $(document).ready(() => {
 $(document).ready(() => {
     // 展开和收起
     // 展开和收起
@@ -211,20 +220,16 @@ $(document).ready(() => {
         selector: '#show-level',
         selector: '#show-level',
         levels: [
         levels: [
             {
             {
-                type: 'sort', count: function () {
-                    const getChildrenLevel = function (node) {
-                        let iLevel = node.level;
-                        if (node.children && node.children.length > 0) {
-                            for (const c of node.children) {
-                                iLevel = Math.max(iLevel, getChildrenLevel(c));
-                            }
-                        }
-                        return iLevel;
-                    };
+                type: 'sort', count: 5, visible_count: function () {
                     return tenderTree.map(getChildrenLevel).reduce((x, y) => { return Math.max(x, y); }, 0) - 1;
                     return tenderTree.map(getChildrenLevel).reduce((x, y) => { return Math.max(x, y); }, 0) - 1;
                 }
                 }
             },
             },
-            { type: 'last', title: '最底层' },
+            {
+                type: 'last', title: '最底层', visible: function () {
+                    const count = tenderTree.map(getChildrenLevel).reduce((x, y) => { return Math.max(x, y); }, 0) - 1;
+                    return count > 0;
+                }
+            },
         ],
         ],
         showLevel: function (tag) {
         showLevel: function (tag) {