瀏覽代碼

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

MaiXinRong 5 年之前
父節點
當前提交
65189abe0a
共有 2 個文件被更改,包括 77 次插入0 次删除
  1. 18 0
      app/public/css/main.css
  2. 59 0
      app/view/report/index.ejs

+ 18 - 0
app/public/css/main.css

@@ -700,6 +700,24 @@ input.nospin[type="number"]{-moz-appearance:textfield;}
 .m-close-side:hover{
   background:#eae9e9;
 }
+.baobiao-close-side{
+  position: absolute;
+  left:15px;
+  top:250px;
+  background: #e1e1e1
+}
+.baobiao-close-side a{
+  color:#007bff;
+  height:80px;
+  line-height: 80px;
+  display: inline-block
+}
+.baobiao-close-side:hover{
+  background:#007bff;
+}
+.baobiao-close-side:hover a{
+  color:#fff;
+}
 .flowtoolsbar{
   display:none;
   position: absolute;

+ 59 - 0
app/view/report/index.ejs

@@ -124,6 +124,10 @@
                             </div>
                         </div>
                     </div>
+                    <div class="baobiao-close-side">
+                        <a href="javascript:void(0)" title="收起侧栏" onclick="collapseRptTreeMenu(this)"><i class="fa fa-chevron-left"></i></a>
+                        <!-- <a href="#" title="展开侧栏"><i class="fa fa-chevron-right"></i></a> -->
+                    </div>
                     <div class="sjs-height-4">
                         <div class="print-view form-view">
                             <div class="pageContainer">
@@ -216,8 +220,10 @@
         current_stage_times = STAGE_LIST[STAGE_LIST.length - 1].times;
         current_stage_status = STAGE_LIST[STAGE_LIST.length - 1].status;
     }
+
     buildStageSelection();
 
+    const ORG_TOP_TREE_NODES = JSON.parse(JSON.stringify(TOP_TREE_NODES));
     for (let item of TOP_TREE_NODES) {
         item.items = JSON.parse(item.items);
         if (item.items && item.items.length > 0) {
@@ -226,6 +232,15 @@
             }
         }
     }
+    for (let item of ORG_TOP_TREE_NODES) {
+        item.items = JSON.parse(item.items);
+        if (item.items && item.items.length > 0) {
+            for (let dtlItem of item.items) {
+                chkAndSetNode(dtlItem);
+            }
+        }
+    }
+    buildTplTree();
 
     function chkAndSetNode(parentItem) {
         if (parentItem.nodeType === 1) {
@@ -256,6 +271,33 @@
         return SCREEN_DPI;
     }
 
+    function buildTplTree() {
+        if (TOP_TREE_NODES.length > 0) {
+            //1. 整理模板树
+            const individualNode = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};
+            for (let tnIdx = TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {
+                if (TOP_TREE_NODES[tnIdx].pid !== -1) {
+                    TOP_TREE_NODES[tnIdx].isParent = true;
+                    TOP_TREE_NODES[tnIdx].nodeType = 1;
+                    individualNode.items.push(TOP_TREE_NODES[tnIdx]);
+                    TOP_TREE_NODES.splice(tnIdx, 1);
+                }
+            }
+            TOP_TREE_NODES.push(individualNode);
+            //2. 原始的模板树(恢复用)
+            const individualNodeOrg = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};
+            for (let tnIdx = ORG_TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {
+                if (ORG_TOP_TREE_NODES[tnIdx].pid !== -1) {
+                    ORG_TOP_TREE_NODES[tnIdx].isParent = true;
+                    ORG_TOP_TREE_NODES[tnIdx].nodeType = 1;
+                    individualNodeOrg.items.push(ORG_TOP_TREE_NODES[tnIdx]);
+                    ORG_TOP_TREE_NODES.splice(tnIdx, 1);
+                }
+            }
+            ORG_TOP_TREE_NODES.push(individualNode);
+        }
+    }
+
     function buildStageSelection() {
         $("#btnCurrentStage")[0].innerText = '第' + current_stage_order + '期';
         $("#optionSelectableStages").empty();
@@ -295,6 +337,23 @@
         };
     }
 
+    function collapseRptTreeMenu(dom) {
+        const parentDom = $(dom).parent().parent();
+        const brotherDom = parentDom.prev();
+        const nextDom = $(dom).children();
+        if (dom.title === '收起侧栏') {
+            dom.title = '展开侧栏';
+            brotherDom[0].style = 'display:none';
+            parentDom[0].className = 'col-12';
+            nextDom[0].className = 'fa fa-chevron-right';
+        } else {
+            dom.title = '收起侧栏';
+            parentDom[0].className = 'col-10';
+            brotherDom[0].style = 'display:';
+            nextDom[0].className = 'fa fa-chevron-left';
+        }
+    }
+
     setupDateFormat();
     rptTplObj.iniPage();
 </script>