Explorar o código

新增显示层级:
1. 台账分解、台账审批
2. 计量台账、审核比较

MaiXinRong %!s(int64=6) %!d(string=hai) anos
pai
achega
3dc4c9178c

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

@@ -1638,8 +1638,36 @@ $(document).ready(function() {
     $('#hideSp').click(function () {
         $('#sp-list2').modal('hide');
     });
+    // 显示层次
+    (function (select, sheet) {
+        if (!sheet.zh_tree) return;
+        $(select).click(function () {
+            const tag = $(this).attr('tag');
+            const tree = sheet.zh_tree;
+            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;
+            }
+        });
+    })('a[name=showLevel]', ledgerSpread.getActiveSheet());
 });
 
+
+
 // 检查上报情况
 function checkAuditorFrom () {
     if ($('#auditors li').length === 0) {

+ 26 - 0
app/public/js/ledger_audit.js

@@ -159,4 +159,30 @@ $(document).ready(() => {
             });
         }
     }
+    // 显示层次
+    (function (select, sheet) {
+        if (!sheet.zh_tree) return;
+        $(select).click(function () {
+            const tag = $(this).attr('tag');
+            const tree = sheet.zh_tree;
+            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;
+            }
+        });
+    })('a[name=showLevel]', ledgerSpread.getActiveSheet());
 });

+ 15 - 15
app/public/js/path_tree.js

@@ -628,6 +628,21 @@ const createNewPathTree = function (type, setting) {
                 }
             })
         }
+
+        /**
+         * 展开至计算项
+         */
+        expandByCalcFields() {
+            const self = this;
+            this.expandByCustom(function (node) {
+                for (const field of self.setting.calcFields) {
+                    if (node[field]) {
+                        return true;
+                    }
+                }
+                return false;
+            })
+        }
     }
 
     class LedgerTree extends FxTree {
@@ -1202,21 +1217,6 @@ const createNewPathTree = function (type, setting) {
             }
             return loadedData;
         }
-
-        /**
-         * 展开至最底层项目节
-         */
-        expandByCalcFields() {
-            const self = this;
-            this.expandByCustom(function (node) {
-                for (const field of self.setting.calcFields) {
-                    if (node[field]) {
-                        return true;
-                    }
-                }
-                return false;
-            })
-        }
     }
 
     if (type === 'base') {

+ 38 - 1
app/public/js/stage.js

@@ -1259,5 +1259,42 @@ $(document).ready(() => {
         } else if (status === 'next' && lastPageNum < totalPageNum) {
             getAllList(parseInt(lastPageNum)+1);
         }
-    })
+    });
+    // 显示层次
+    (function (select, sheet) {
+        if (!sheet.zh_tree) return;
+        $(select).click(function () {
+            const tag = $(this).attr('tag');
+            const tree = sheet.zh_tree;
+            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;
+                case "curMeasure":
+                    tree.expandByCustom(function (node) {
+                        for (const field of ['contract_tp', 'qc_tp', 'gather_tp']) {
+                            if (node[field]) {
+                                return true;
+                            }
+                        }
+                        return false;
+                    });
+                    SpreadJsObj.refreshTreeRowVisible(sheet);
+                    break;
+            }
+        });
+    })('a[name=showLevel]', slSpread.getActiveSheet());
 });

+ 30 - 0
app/public/js/stage_compare.js

@@ -165,4 +165,34 @@ $(document).ready(function () {
             $('#select-qi').modal('hide');
         }
     });
+    // 显示层次
+    (function (select, sheet) {
+        if (!sheet.zh_tree) return;
+        $(select).click(function () {
+            const tag = $(this).attr('tag');
+            const tree = sheet.zh_tree;
+            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;
+                case "curMeasure":
+                    tree.expandByCalcFields();
+                    SpreadJsObj.refreshTreeRowVisible(sheet);
+                    break;
+            }
+        });
+    })('a[name=showLevel]', ledgerSpread.getActiveSheet());
 });

+ 16 - 0
app/view/ledger/audit.ejs

@@ -2,6 +2,22 @@
 <div class="panel-content">
     <div class="panel-title">
         <div class="title-main d-flex justify-content-between">
+            <div class="d-inline-block">
+                <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="javascirpt: void(0);">第一层</a>
+                        <a class="dropdown-item" name="showLevel" tag="2" href="javascirpt: void(0);">第二层</a>
+                        <a class="dropdown-item" name="showLevel" tag="3" href="javascirpt: void(0);">第三层</a>
+                        <a class="dropdown-item" name="showLevel" tag="4" href="javascirpt: void(0);">第四层</a>
+                        <a class="dropdown-item" name="showLevel" tag="5" href="javascirpt: void(0);">第五层</a>
+                        <a class="dropdown-item" name="showLevel" tag="last" href="javascirpt: void(0);">最底层</a>
+                        <a class="dropdown-item" name="showLevel" tag="leafXmj" href="javascirpt: void(0);">只显示项目节</a>
+                    </div>
+                </div>
+            </div>
             <div></div>
             <div>
                 <% if (tender.ledger_status === auditConst.status.checkNo) { %>

+ 16 - 0
app/view/ledger/explode.ejs

@@ -2,6 +2,22 @@
 <div class="panel-content">
     <div class="panel-title">
         <div class="title-main  d-flex justify-content-between"><!--工具-->
+            <div class="d-inline-block">
+                <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="javascirpt: void(0);">第一层</a>
+                        <a class="dropdown-item" name="showLevel" tag="2" href="javascirpt: void(0);">第二层</a>
+                        <a class="dropdown-item" name="showLevel" tag="3" href="javascirpt: void(0);">第三层</a>
+                        <a class="dropdown-item" name="showLevel" tag="4" href="javascirpt: void(0);">第四层</a>
+                        <a class="dropdown-item" name="showLevel" tag="5" href="javascirpt: void(0);">第五层</a>
+                        <a class="dropdown-item" name="showLevel" tag="last" href="javascirpt: void(0);">最底层</a>
+                        <a class="dropdown-item" name="showLevel" tag="leafXmj" href="javascirpt: void(0);">只显示项目节</a>
+                    </div>
+                </div>
+            </div>
             <div>
                 <div class="btn-group">
                     <a href="javascript:void(0)" id="insert" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title=""

+ 16 - 0
app/view/stage/compare.ejs

@@ -2,6 +2,22 @@
 <div class="panel-content">
     <div class="panel-title">
         <div class="title-main d-flex justify-content-between">
+            <div class="d-inline-block">
+                <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="javascirpt: void(0);">第一层</a>
+                        <a class="dropdown-item" name="showLevel" tag="2" href="javascirpt: void(0);">第二层</a>
+                        <a class="dropdown-item" name="showLevel" tag="3" href="javascirpt: void(0);">第三层</a>
+                        <a class="dropdown-item" name="showLevel" tag="4" href="javascirpt: void(0);">第四层</a>
+                        <a class="dropdown-item" name="showLevel" tag="5" href="javascirpt: void(0);">第五层</a>
+                        <a class="dropdown-item" name="showLevel" tag="last" href="javascirpt: void(0);">最底层</a>
+                        <a class="dropdown-item" name="curMeasure" tag="leafXmj" href="javascirpt: void(0);">只显示项目节</a>
+                    </div>
+                </div>
+            </div>
             <div>
                 <a class="btn btn-sm btn-light">
                     <div class="custom-control custom-checkbox">

+ 20 - 3
app/view/stage/index.ejs

@@ -2,6 +2,26 @@
 <div class="panel-content">
     <div class="panel-title">
         <div class="title-main d-flex justify-content-between">
+            <div class="d-inline-block">
+                <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="javascirpt: void(0);">第一层</a>
+                        <a class="dropdown-item" name="showLevel" tag="2" href="javascirpt: void(0);">第二层</a>
+                        <a class="dropdown-item" name="showLevel" tag="3" href="javascirpt: void(0);">第三层</a>
+                        <a class="dropdown-item" name="showLevel" tag="4" href="javascirpt: void(0);">第四层</a>
+                        <a class="dropdown-item" name="showLevel" tag="5" href="javascirpt: void(0);">第五层</a>
+                        <a class="dropdown-item" name="showLevel" tag="last" href="javascirpt: void(0);">最底层</a>
+                        <a class="dropdown-item" name="showLevel" tag="leafXmj" href="javascirpt: void(0);">只显示项目节</a>
+                        <a class="dropdown-item" name="showLevel" tag="curMeasure" href="javascirpt: void(0);">只显示本期计量</a>
+                    </div>
+                </div>
+            </div>
+            <div class="ml-1">
+                <button href="#row-view" class="btn btn-sm btn-light" data-toggle="modal" data-target="#row-view"><i class="fa fa-table"></i> 列显示</button>
+            </div>
             <div>
                 <div class="input-group input-group-sm mt-2">
                     <div class="input-group-prepend">
@@ -10,9 +30,6 @@
                     <input type="text" class="form-control m-0" <% if (stage.readOnly) { %> readonly="" <% } %>>
                 </div>
             </div>
-            <div class="ml-2">
-                <button href="#row-view" class="btn btn-sm btn-light" data-toggle="modal" data-target="#row-view"><i class="fa fa-table"></i> 列显示</button>
-            </div>
             <div class="ml-auto">
 
             </div>