瀏覽代碼

tuning for
1. scroll bar
2. GLJ-type initialization

TonyKang 8 年之前
父節點
當前提交
64fc071383

+ 7 - 7
lib/global.js

@@ -1,16 +1,16 @@
 /*全局自适应高度*/
 function autoFlashHeight(){
     var headerHeight = $(".header").height();
-    var toolsbarHeight = $(".toolsbar").height();
     var bottomContentHeight = $(".bottom-content").height();
-    var sidebarToolsBarHeight = $(".sidebar-tools-bar").height();
-    $(".main-data-side-f").height($(window).height()-headerHeight-toolsbarHeight-2);
-    $(".main-data-side-s").height($(window).height()-headerHeight-toolsbarHeight-sidebarToolsBarHeight-202);
-    $(".main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
-    $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1);
+    var toolsBar = $(".tools-bar").height();
+    $(".content").height($(window).height()-headerHeight);
+    $(".main-side").height($(window).height()-headerHeight-2);
+    $(".fluid-content").height($(window).height()-headerHeight-1);
     $(".side-content").height($(window).height()-headerHeight );
-    $(".poj-list").height($(window).height()-headerHeight-toolsbarHeight);
+    $(".poj-list").height($(window).height()-headerHeight);
     $(".form-list").height($(window).height()-headerHeight-50 );
+    $(".main-data-top").height($(window).height()-headerHeight-toolsBar-bottomContentHeight-2);
+    $(".main-data").height($(window).height()-headerHeight);
 };
 $(window).resize(autoFlashHeight);
 /*全局自适应高度结束*/

+ 2 - 2
modules/rationRepository/controllers/repositoryGljController.js

@@ -8,8 +8,8 @@ var callback = function(req,res,err,message, data){
 }
 module.exports ={
     getGljTree: function(req,res){
-        var libName = req.body.rationLibName;
-        gljRepository.getGljTypes(libName,function(err,data){
+        var rationLibId = req.body.rationLibId;
+        gljRepository.getGljTypes(rationLibId,function(err,data){
             callback(req,res,err, 'Get Tree', data)
         });
     },

+ 6 - 12
modules/rationRepository/models/gljRepository.js

@@ -36,18 +36,12 @@ var repositoryMap = require('./repositoryMap');
 var counter = require('../../../public/counter/counter');
 
 var gljItemDAO = function(){};
-gljItemDAO.prototype.getGljTypes = function(repositoryName, callback){
-    repositoryMap.getRealLibName(repositoryName, function(err, rst){
-        if (err || rst.length == 0) {
-            callback("获取定额库错误!",false)
-        } else {
-            gljTypeModel.find({"repositoryId": rst[0].ID, "$or": [{"isDeleted": null}, {"isDeleted": false} ]},function(err,data){
-                if(data.length) callback(false,data);
-                else  if(err) callback("获取工料机类型错误!",false)
-                else callback(false,false);
-            })
-        }
-    });
+gljItemDAO.prototype.getGljTypes = function(rationLibId, callback){
+    gljTypeModel.find({"repositoryId": rationLibId, "$or": [{"isDeleted": null}, {"isDeleted": false} ]},function(err,data){
+        if(data.length) callback(false,data);
+        else  if(err) callback("获取工料机类型错误!",false)
+        else callback(false,false);
+    })
 };
 
 gljItemDAO.prototype.getGljItemsByRep = function(repositoryId,callback){

+ 34 - 33
web/css/main.css

@@ -1,8 +1,7 @@
 /*building SAAS 0.1*/
 /*bootstrap 初始化*/
 body {
-    font-size: 0.9rem;
-    overflow: hidden;
+    font-size: 0.9rem
 }
 .dropdown-menu {
     font-size: 0.9rem
@@ -27,12 +26,12 @@ body {
   width:100%;
   z-index: 999
 }
-.in-1{padding-left:0px!important}
-.in-2{padding-left:21px!important}
-.in-3{padding-left:42px!important}
-.in-4{padding-left:63px!important}
-.in-5{padding-left:84px!important}
-.in-6{padding-left:105px!important}
+.in-1{padding-left:0rem!important}
+.in-2{padding-left:1rem!important}
+.in-3{padding-left:1.5rem!important}
+.in-4{padding-left:2rem!important}
+.in-5{padding-left:2.5rem!important}
+.in-6{padding-left:3rem!important}
 .main {
     position: relative;
     background: #f7f7f9;
@@ -63,12 +62,7 @@ body {
     background: #fff;
     color: #333
 }
-.main-nav .nav-tabs{
-  border-bottom: none
-}
 .content {
-    border-left: 1px solid #ccc;
-    margin-left: 29px;
     background: #fff
 }
 .tools-btn {
@@ -79,22 +73,29 @@ body {
     background: #f7f7f9;
 }
 .main-side {
-    border-top: 1px solid #ccc;
-    border-left: 1px solid #ccc;
-    overflow-y: hidden;
+    border-right: 1px solid #ccc;
+    overflow-y: auto;
 }
-.sidebar-bottom,.sidebar-bottom .col-lg-6,.sidebar-bottom .col-lg-12 {
-  height:200px
+.main-side .tab-bar {
+    padding:5px 10px;
+    height:38px;
+    position:fixed;
+}
+.main-side .tab-content {
+    margin-top: 38px
 }
 .top-content, .fluid-content {
-    overflow: auto;
+    overflow: hidden;
     border-bottom: 1px solid #ccc;
 }
-.bottom-content .nav {
+.warp-p2 {
+    padding: 2px
+}
+.bottom-content .nav,.top-content .nav {
     background: #f7f7f9;
     padding:0 0 0 2px
 }
-.bottom-content .nav-tabs .nav-link, .side-tabs .nav-tabs .nav-link {
+.bottom-content .nav-tabs .nav-link, .side-tabs .nav-tabs .nav-link,.top-content .nav-tabs .nav-link {
     border-radius: 0;
     padding: 0.2em 0.5em
 }
@@ -211,13 +212,14 @@ body {
         transform: translateX(10px);
     }
 }
+.bottom-content {
+    height: 370px;
+    overflow: hidden;
+}
 .bottom-content .tab-content .main-data-bottom{
-    height: 200px;
+    height: 340px;
     overflow: auto;
 }
-.bottom-content .tab-content .ovf-hidden{
-    overflow: hidden;
-}
 .form-signin {
     max-width: 500px;
     margin: 150px auto;
@@ -226,13 +228,9 @@ body {
     overflow: auto;
 }
 .poj-list span.poj-icon {
-  padding-right:7px;
+  padding-right:10px;
   color:#ccc
 }
-.poj-list a.tree-open,.poj-list a.tree-close{
-  width:15px;
-  display: inline-block;
-}
 .print-toolsbar{
   padding:5px
 }
@@ -268,7 +266,10 @@ body {
   width:inherit;
   height: inherit;
 }
-.modal-fixed-height {
-  height: 400px;
-  overflow-y: auto;
+.codeList{
+    max-height: 200px;
+    overflow:auto;
+}
+.main-data-top,.main-data-bottom,.main-data{
+  overflow: auto;
 }

文件差異過大導致無法顯示
+ 353 - 713
web/rationRepository/dinge.html


+ 10 - 11
web/rationRepository/gongliao.html

@@ -40,14 +40,13 @@
     <div class="main">
         <div class="content">
             <div class="container-fluid">
-                <div class="row" style="height: 660px">
-                  <div class="main-side col-lg-3 p-0">
-                    <div class="tab-content">
-                      <ul id="repositoryTree" class="ztree"></ul>
+                <div class="row">
+                    <div class="main-side col-lg-3 p-0">
+                        <ul id="repositoryTree" class="ztree"></ul>
+                    </div>
+                    <div class="main-content col-lg-9 p-0">
+                        <div id="GLJListSheet" class="main-data"></div>
                     </div>
-                  </div>
-                  <div id="GLJListSheet" class="main-content col-lg-9 p-0">
-                  </div>
                 </div>
             </div>
         </div>
@@ -225,14 +224,14 @@
                 onClick: gljTypeTreeOprObj.onClick
             }
         };
+        $(document).ready(function(){
+            pageOprObj.initPage($("#GLJListSheet")[0]);
+            //repositoryGljObj.buildSheet($("#GLJListSheet")[0]);
+        });
   	</script>
 </body>
 <script type="text/javascript">
     autoFlashHeight();
-    $(document).ready(function(){
-        pageOprObj.initPage($("#GLJListSheet")[0]);
-        //repositoryGljObj.buildSheet($("#GLJListSheet")[0]);
-    });
 </script>
 
 </html>

+ 24 - 13
web/rationRepository/js/repositoryGLJ.js

@@ -20,11 +20,11 @@ var pageOprObj = {
             html = html.replace("XXX定额库", rationLibName);
             $("#rationname")[0].outerHTML = html;
             me.rationLibName = rationLibName;
-            repositoryGljObj.getGljTree(rationLibName, function(repId){
-                repositoryGljObj.buildSheet(container);
-                repositoryGljObj.getGljItems(repId);
-                sheetCommonObj.shieldAllCells(repositoryGljObj.workBook.getSheet(0), repositoryGljObj.setting);
-            });
+            repositoryGljObj.currentRepositoryId = parseInt(rationLibId);
+            repositoryGljObj.getGljTree(rationLibId);
+            repositoryGljObj.buildSheet(container);
+            repositoryGljObj.getGljItems(rationLibId);
+            sheetCommonObj.shieldAllCells(repositoryGljObj.workBook.getSheet(0), repositoryGljObj.setting);
         }
     }
 }
@@ -53,12 +53,12 @@ repositoryGljObj = {
             ]
         }
     },
-    getGljTree: function(rationLibName, callback) {
+    getGljTree: function(rationLibId) {
         var me = this;
         $.ajax({
             type:"POST",
             url:"api/getGljTree",
-            data:{"rationLibName": rationLibName},
+            data:{"rationLibId": rationLibId},
             dataType:"json",
             cache:false,
             timeout:20000,
@@ -67,11 +67,8 @@ repositoryGljObj = {
                     zTreeHelper.createTree(result.data, gljSetting, "repositoryTree", me);
                     if (result.data && result.data.length > 0) {
                         me.gljCurTypeId = result.data[0].ID;
-                        if (callback) {
-                            var repId = -1;
-                            repId = result.data[0].repositoryId;
-                            callback(repId);
-                        }
+                    } else {
+                        gljTypeTreeOprObj.addRootNode();
                     }
                 }
             },
@@ -82,7 +79,6 @@ repositoryGljObj = {
     },
     getGljItems: function(repId) {
         var me = this;
-        me.currentRepositoryId = repId;
         $.ajax({
             type:"POST",
             url:"api/getGljItems",
@@ -398,6 +394,21 @@ var gljTypeTreeOprObj = {
             })
         }
     },
+    addRootNode: function() {
+        var me = repositoryGljObj, rawNode = {ParentID: -1, NextSiblingID: -1, Name: "所有"}, lastNodeId = -1;
+        if (me.treeObj) {
+            var rootNodes = me.treeObj.getNodes();
+            if (rootNodes.length == 0) {
+                gljTypeTreeOprObj.addNewNode(rawNode, lastNodeId, function(err, rst){
+                    if (!(err)) {
+                        var newNodes = [], isSilent = false;
+                        newNodes.push({ repositoryId: rst.data.repositoryId, ID: rst.data.ID, ParentID: rst.data.ParentID, NextSiblingID:-1, Name:"所有",isParent:false, items:[]});
+                        me.treeObj.addNodes(null, -1, newNodes, isSilent);
+                    }
+                });
+            }
+        }
+    },
     addNewNode : function(rawNode, lastNodeId, callback){
         $.ajax({
             type:"POST",