Selaa lähdekoodia

增加层级控制

ellisran 5 kuukautta sitten
vanhempi
commit
75f676bb0f
2 muutettua tiedostoa jossa 47 lisäystä ja 0 poistoa
  1. 31 0
      app/public/js/change_information.js
  2. 16 0
      app/view/change/information.ejs

+ 31 - 0
app/public/js/change_information.js

@@ -5469,6 +5469,37 @@ $(document).ready(() => {
         }
     }
 
+    // 显示层次
+    (function (select, sheet) {
+        $(select).click(function () {
+            if (!sheet.zh_tree) return;
+            const tag = $(this).attr('tag');
+            const tree = sheet.zh_tree;
+            setTimeout(() => {
+                showWaitingView();
+                switch (tag) {
+                    case "1":
+                    case "2":
+                    case "3":
+                    case "4":
+                    case "5":
+                        tree.expandByLevel(parseInt(tag));
+                        SpreadJsObj.refreshTreeRowVisible(sheet);
+                        break;
+                    case "last":
+                        tree.expandByCustom(() => { return true; });
+                        SpreadJsObj.refreshTreeRowVisible(sheet);
+                        break;
+                    case "leafXmj":
+                        tree.expandToLeafXmj();
+                        SpreadJsObj.refreshTreeRowVisible(sheet);
+                        break;
+                }
+                closeWaitingView();
+            }, 100);
+        });
+    })('a[name=showLevel]', ledgerSheet);
+
     function makeLedgerAndPosData() {
         const changeLedgers = _.filter(ledgerList, function (item) {
             return _.findIndex(changeList, { gcl_id: item.id}) !== -1;

+ 16 - 0
app/view/change/information.ejs

@@ -404,6 +404,22 @@
                                             <a href="javascript:void(0);" class="btn btn-sm btn-light text-primary" id="add-white-btn" data-original-title="添加清单"><i class="fa fa-plus" aria-hidden="true"></i> <span class="order_text"><% if (change.order_by === 0) { %>添加<% } else { %>插入<% } %></span>空白清单</a>
                                         </div>
                                     <% } %>
+                                    <div class="d-inline-block mr-2 judge-show" style="display: none;">
+                                        <div class="dropdown">
+                                            <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                                <i class="fa fa-list-ol"></i> 显示层级
+                                            </button>
+                                            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
+                                                <a class="dropdown-item" name="showLevel" tag="1" href="javascript: void(0);">第一层</a>
+                                                <a class="dropdown-item" name="showLevel" tag="2" href="javascript: void(0);">第二层</a>
+                                                <a class="dropdown-item" name="showLevel" tag="3" href="javascript: void(0);">第三层</a>
+                                                <a class="dropdown-item" name="showLevel" tag="4" href="javascript: void(0);">第四层</a>
+                                                <a class="dropdown-item" name="showLevel" tag="5" href="javascript: void(0);">第五层</a>
+                                                <a class="dropdown-item" name="showLevel" tag="last" href="javascript: void(0);">最底层</a>
+                                                <a class="dropdown-item" name="showLevel" tag="leafXmj" href="javascript: void(0);">只显示项目节</a>
+                                            </div>
+                                        </div>
+                                    </div>
                                     <div class="d-inline-block mr-2 judge-hide">
                                         <button type="button" class="btn btn-sm btn-light text-primary dropdown-toggle" data-toggle="dropdown" id="bpaixu">清单排序:<% if (change.order_by === 0) { %>清单编号<% } else { %>添加顺序<% } %></button>
                                         <div class="dropdown-menu" aria-labelledby="bpaixu">