zhongzewei 7 lat temu
rodzic
commit
5b04100ccc
24 zmienionych plików z 562 dodań i 129 usunięć
  1. 3 0
      config/gulpConfig.js
  2. 1 1
      modules/complementary_glj_lib/controllers/gljController.js
  3. 1 1
      modules/complementary_ration_lib/routes/routes.js
  4. 1 0
      public/web/sheet/sheet_common.js
  5. 1 0
      public/web/sheet/sheet_data_helper.js
  6. 3 6
      web/building_saas/complementary_glj_lib/js/glj.js
  7. 1 0
      web/building_saas/complementary_glj_lib/js/gljClassTree.js
  8. 1 1
      web/building_saas/complementary_glj_lib/js/gljComponent.js
  9. 2 0
      web/building_saas/complementary_glj_lib/js/sheetOpr.js
  10. 21 6
      web/building_saas/complementary_ration_lib/html/dinge.html
  11. 333 0
      web/building_saas/complementary_ration_lib/js/gljSelect.js
  12. 51 0
      web/building_saas/complementary_ration_lib/js/ration.js
  13. 1 1
      web/building_saas/complementary_ration_lib/js/ration_coe.js
  14. 79 50
      web/building_saas/complementary_ration_lib/js/ration_glj.js
  15. 2 63
      web/building_saas/complementary_ration_lib/js/repository_glj.js
  16. 1 0
      web/building_saas/complementary_ration_lib/js/section_tree.js
  17. 53 0
      web/building_saas/complementary_ration_lib/js/sheetsOpr.js
  18. 1 0
      web/building_saas/main/js/views/project_property_basicInfo.js
  19. 1 0
      web/building_saas/main/js/views/project_property_bills_quantity_decimal.js
  20. 1 0
      web/building_saas/main/js/views/project_property_indicativeInfo.js
  21. 1 0
      web/building_saas/main/js/views/project_property_labour_coe_view.js
  22. 1 0
      web/building_saas/main/js/views/project_property_projFeature.js
  23. 1 0
      web/building_saas/pm/js/pm_gc.js
  24. 1 0
      web/building_saas/pm/js/pm_newMain.js

+ 3 - 0
config/gulpConfig.js

@@ -164,9 +164,11 @@ module.exports = {
     ],
     compleRation_ration_css: [
         'lib/jquery-contextmenu/jquery.contextMenu.css',
+        'lib/ztree/css/zTreeStyle.css',
         'lib/spreadjs/sheets/css/gc.spread.sheets.sc.css'
     ],
     compleRation_ration_jspaths:[
+        'lib/ztree/jquery.ztree.core.js',
         'web/building_saas/complementary_ration_lib/js/global.js',
         'public/web/id_tree.js',
         'public/web/tree_sheet/tree_sheet_controller.js',
@@ -186,6 +188,7 @@ module.exports = {
         'public/web/ztree_common.js',
         'public/web/ration_glj_units.js',
         'web/building_saas/complementary_ration_lib/js/ration.js',
+        'web/building_saas/complementary_ration_lib/js/gljSelect.js',
         'web/building_saas/complementary_ration_lib/js/ration_glj.js',
         'web/building_saas/complementary_ration_lib/js/ration_coe.js',
         'web/building_saas/complementary_ration_lib/js/ration_assist.js',

+ 1 - 1
modules/complementary_glj_lib/controllers/gljController.js

@@ -83,7 +83,7 @@ class GljController extends BaseController{
         let stdGljLibId = data.stdGljLibId,
             userId = data.userId,
             compilationId = data.compilationId
-            gljDao.getGljItems(stdGljLibId, userId, compilationId, function(err, data){
+            gljDao.getGljItems(stdGljLibId, req.session.sessionUser.id, req.session.sessionCompilation._id, function(err, data){
                 callback(req,res,err,'Get Items',data)
             });
     }

+ 1 - 1
modules/complementary_ration_lib/routes/routes.js

@@ -35,7 +35,7 @@ module.exports = function (app) {
 
     router.post('/getGljDistType', gljController.init, gljController.getGljDistType);
     router.post('/getGljTree', gljController.init, gljController.getGljTree);
-    router.post('/getGljItems', compleRationController.init, compleRationController.getGljItems);
+    router.post('/getGljItems', gljController.init, gljController.getGljItems);
     router.post('/getGljItemsOccupied', compleRationController.init, compleRationController.getGljItemsOccupied);
     router.post('/getRationsCodes', compleRationController.init, compleRationController.getRationsCodes);
     router.post('/getGljItemsByIds', compleRationController.init, compleRationController.getGljItemsByIds);

+ 1 - 0
public/web/sheet/sheet_common.js

@@ -12,6 +12,7 @@ var sheetCommonObj = {
         spreadBook.options.showVerticalScrollbar = true;
         spreadBook.options.allowCopyPasteExcelStyle = false;
         spreadBook.options.allowUserDragDrop = true;
+        spreadBook.options.allowContextMenu = false;
         spreadBook.options.allowUserEditFormula = false;
         return spreadBook;
     },

+ 1 - 0
public/web/sheet/sheet_data_helper.js

@@ -52,6 +52,7 @@ var SheetDataHelper = {
         spread.options.scrollbarMaxAlign = true;
         spread.options.cutCopyIndicatorVisible = false;
         spread.options.allowCopyPasteExcelStyle = false;
+        spread.options.allowContextMenu = false;
         spread.options.allowUserDragDrop = false;
         spread.options.allowUndo = false;//that.mainSpread.commandManager().setShortcutKey(undefined, GC.Spread.Commands.Key.z, true, false, false, false); 屏蔽undo
         spread.options. allowUserEditFormula = false;

+ 3 - 6
web/building_saas/complementary_glj_lib/js/glj.js

@@ -18,10 +18,7 @@ let pageOprObj = {
         //repositoryGljObj.getRationGljIds(gljLibId);
         repositoryGljObj.getGljDistType(function () {
             repositoryGljObj.currentRepositoryId = me.stdGljLibId;
-           /* repositoryGljObj.getGljTree(stdGljLibId, function () {
-                repositoryGljObj.getGljItems(me.stdGljLibId, me.userId, me.compilationId);
-            });*/
-            repositoryGljObj.getGljItems(me.stdGljLibId, me.userId, me.compilationId, function () {
+            repositoryGljObj.getGljItems(me.stdGljLibId, function () {
                 gljClassTreeObj.getGljClassTree(stdGljLibId);
             });
         });
@@ -134,9 +131,9 @@ let repositoryGljObj = {
             }
         });
     },
-    getGljItems: function(stdGljLibId, userId, compilationId, callback) {
+    getGljItems: function(stdGljLibId, callback) {
         let me = this;
-        CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId, userId: userId, compilationId: compilationId}, function (rstData) {
+        CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
             me.complementaryGljList = rstData.complementaryGljs;
             me.workBook.getSheet(0).setRowCount(me.stdGljList.length);

+ 1 - 0
web/building_saas/complementary_glj_lib/js/gljClassTree.js

@@ -41,6 +41,7 @@ let gljClassTreeObj = {
         },
         options: {
             tabStripVisible:  false,
+            allowContextMenu: false,
             allowCopyPasteExcelStyle : false,
             allowExtendPasteRange: false,
             allowUserDragDrop : false,

+ 1 - 1
web/building_saas/complementary_glj_lib/js/gljComponent.js

@@ -89,7 +89,7 @@ let gljComponentOprObj = {
                                     componentTypeTreeOprObj.onClick(null, 'componentTree', co.rootNode);
                                 }
                                 //弹出窗口
-                                $('#componentBtn').click();
+                                $('#component').modal('show');
                             }},
                             "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
                                 //删除

+ 2 - 0
web/building_saas/complementary_glj_lib/js/sheetOpr.js

@@ -8,6 +8,7 @@ let sheetOpr = {
         spreadBook.options.allowCopyPasteExcelStyle = false;
         spreadBook.options.tabStripVisible = false;
         spreadBook.options.scrollbarMaxAlign = true;
+        spreadBook.options.allowContextMenu = false;
         //spreadBook.options.showHorizontalScrollbar = false;
         spreadBook.options.allowUserDragDrop = false;
         return spreadBook;
@@ -42,6 +43,7 @@ let sheetOpr = {
         spreadBook.options.allowCopyPasteExcelStyle = false;
         spreadBook.options.allowExtendPasteRange = true;
         spreadBook.options.allowUserDragDrop = false;
+        spreadBook.options.allowContextMenu = false;
         var spreadNS = GC.Spread.Sheets;
         var sheet = spreadBook.getSheet(0);
         sheet.suspendPaint();

+ 21 - 6
web/building_saas/complementary_ration_lib/html/dinge.html

@@ -11,6 +11,7 @@
     <link rel="stylesheet" href="/web/building_saas/css/main.css" type="text/css">
     <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css" type="text/css">
     <link rel="stylesheet" href="/lib/jquery-contextmenu/jquery.contextMenu.css" type="text/css">
+    <link rel="stylesheet" href="/lib/ztree/css/zTreeStyle.css" type="text/css">
     <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.sc.css" type="text/css">
     <!--endinject-->
     <style type="text/css">
@@ -20,6 +21,7 @@
             background-color: #fff;
             border-bottom: 1px solid #fff;
         }
+        .modal-lg{max-width: 1000px}
     </style>
 </head>
 <body>
@@ -133,7 +135,7 @@
                         <!--工作内容-->
                         <div class="tab-pane" id="tgz" role="tabpanel">
                             <div class="main-data">
-                                <div class="form-check m-2"><label class="form-check-label"><input type="radio"  class="form-check-input" name="optionsRadios" value="ALL" disabled="true"> 适合本项所有定额</label>&nbsp;&nbsp;<label class="form-check-label"><input type="radio" class="form-check-input disabled" name="optionsRadios" value="PARTIAL" disabled="true"> 适合本项部分定额</label></div>
+                                <div class="form-check m-2"><label class="form-check-label"><input type="radio"  class="form-check-input" name="optionsRadios" value="ALL" disabled="true"> 适合本项所有定额</label><label style="margin-left: 35px;" class="form-check-label"><input type="radio" class="form-check-input disabled" name="optionsRadios" value="PARTIAL" disabled="true"> 适合本项部分定额</label></div>
                                 <!-- <p class="m-2">适合本项所有定额</p> -->
                                 <table class="table table-sm table-bordered m-0" id="tableAll">
                                     <tr>
@@ -147,7 +149,7 @@
                         <!--附注-->
                         <div class="tab-pane" id="tfz" role="tabpanel">
                             <div class="main-data">
-                                <div class="form-check m-2"><label class="form-check-label"><input type="radio" class="form-check-input" name="fzRadios" value="ALL" disabled=""> 适合本项所有定额</label>&nbsp;&nbsp;<label class="form-check-label"><input type="radio" class="form-check-input" name="fzRadios" value="PARTIAL" disabled> 适合本项部分定额</label></div>
+                                <div class="form-check m-2"><label class="form-check-label"><input type="radio" class="form-check-input" name="fzRadios" value="ALL" disabled=""> 适合本项所有定额</label><label style="margin-left: 35px" class="form-check-label"><input type="radio" class="form-check-input" name="fzRadios" value="PARTIAL" disabled> 适合本项部分定额</label></div>
                                 <!-- <p class="m-2">适合本项所有定额</p> -->
                                 <table class="table table-sm table-bordered m-0" id="fzTableAll">
                                     <tr>
@@ -467,7 +469,7 @@
             </div>
             <div class="modal-body">
                 <div style="width: 33%; float: left;">
-                    <div  class="modal-auto-height" id="componentTreeDiv" style="overflow: hidden">
+                    <div  class="modal-auto-height" id="gljSelTreeDiv" style="overflow: hidden">
                         <!--<div class="print-list">-->
                         <div style="width: 100%; height: 100%; overflow: auto">
                             <ul id="selGljTree" class="ztree"></ul>
@@ -489,14 +491,14 @@
                                 </div>
                             </div>
                         </div>
-                        <div class="modal-auto-height col-12" style="overflow: hidden" id="componentSheet">
+                        <div class="modal-auto-height col-12" style="overflow: hidden" id="gljSelSheet">
                         </div>
                     </div>
                 </div>
             </div>
             <div class="modal-footer">
-                <button type="button" id="componentsCacnel" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                <a href="javascript:void(0);" id="componentsConf" class="btn btn-primary">确定</a>
+                <button type="button"  class="btn btn-secondary" data-dismiss="modal">取消</button>
+                <a href="javascript:void(0);" id="gljSelY" class="btn btn-primary">确定</a>
             </div>
         </div>
     </div>
@@ -510,6 +512,7 @@
 <!--inject:js-->
 <script type="text/javascript" src="/lib/popper/popper.min.js"></script>
 <script type="text/javascript" src="/lib/bootstrap/bootstrap.min.js"></script>
+<script type="text/javascript" src="/lib/ztree/jquery.ztree.core.js"></script>
 <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/global.js"></script>
 <script type="text/javascript" src="/public/web/id_tree.js"></script>
 <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
@@ -530,6 +533,7 @@
 <script type="text/javascript" src="/public/web/ztree_common.js"></script>
 <script type="text/javascript" src="/public/web/ration_glj_units.js"></script>
 <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration.js"></script>
+<script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/gljSelect.js"></script>
 <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration_glj.js"></script>
 <!--     <script type="text/javascript" src="/public/web/sheet/sheet_creater.js"></script>-->
 <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration_coe.js"></script>
@@ -573,6 +577,17 @@
             rationInstObj.bindRationInstDel();
             rdSpread.setActiveSheetIndex(3);
         });
+        //解决spreadjs sheet初始化没高度宽度
+        $('#modalCon').width($(window).width()*0.5);
+        $('#gljSelTreeDiv').height($(window).height() - 300);
+        $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
+        $("#gljSelSheet").width($('#modalCon').width() * 0.63);
+        $(window).resize(function () {
+            $('#modalCon').width($(window).width()*0.5);
+            $('#gljSelTreeDiv').height($(window).height() - 300);
+            $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
+            $("#gljSelSheet").width($('#modalCon').width()* 0.63);
+        });
     });
 </script>
 </body>

+ 333 - 0
web/building_saas/complementary_ration_lib/js/gljSelect.js

@@ -0,0 +1,333 @@
+/**
+ * Created by Zhong on 2017/8/25.
+ */
+
+let gljSelOprObj = {
+    parentNodeIds: {},
+    treeObj:null,
+    rootNode: null,//分类树根节点
+    radiosSelected: null,//allGljs, stdGljs, complementaryGljs
+    workBook: null,
+    selectedList: [],//选中的工料机
+    setting: {
+        header: [
+            {headerName:"选择", headerWidth: 40, dataCode: "select", hAlign: "center", vAlign: "center"},
+            {headerName:"编码",headerWidth:80,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
+            {headerName:"名称",headerWidth:120,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
+            {headerName:"规格型号",headerWidth:80,dataCode:"specs", dataType: "String", hAlign: "center", vAlign: "center"},
+            {headerName:"单位",headerWidth:80,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
+            {headerName:"单价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
+            {headerName:"类型",headerWidth:80,dataCode:"gljType", dataType: "String",  hAlign: "center", vAlign: "center"}
+        ]
+    },
+    setProp: function (prop, value, gljList) {
+        for(let i = 0, len = gljList.length; i < len; i++){
+            gljList[i][prop] = value;
+        }
+    },
+    sortGlj: function(gljList) {
+        gljList.sort(function(a, b){
+            let rst = 0;
+            if (a.code > b.code) rst = 1
+            else if (a.code < b.code) rst = -1;
+            return rst;
+        });
+    },
+    switchToGljId: function (gljList) {
+        for(let glj of gljList){
+            glj.gljId = glj.ID;
+            delete glj.ID;
+        }
+    },
+    getSelGljItems: function(stdGljLibId, callback) {
+        let me = this;
+        CommonAjax.post('/complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
+            me.stdGljList = rstData.stdGljs;
+            me.complementaryGljList = rstData.complementaryGljs;
+            me.switchToGljId(me.stdGljList);
+            me.switchToGljId(me.complementaryGljList);
+            me.setProp('type', 'std', me.stdGljList);
+            me.setProp('type', 'complementary', me.complementaryGljList);
+            me.sortGlj(me.stdGljList);
+            me.sortGlj(me.complementaryGljList);
+            if(callback){
+                callback();
+            }
+        });
+    },
+    getGljClassTree: function (gljLibId, callback) {
+        let me = this;
+        let url = '/complementartGlj/api/getGljTree';
+        let postData = {gljLibId: gljLibId};
+        let sucFunc = function (rstData) {
+            zTreeHelper.createTree(rstData, gljSelTreeOprObj.setting, "selGljTree", gljSelOprObj);
+            let rootNode = gljSelOprObj.treeObj.getNodes()[0];
+            if(rootNode && rootNode.isParent && rootNode.isFirstNode){
+                gljSelOprObj.rootNode = rootNode;
+            }
+            gljSelOprObj.buildSheet($('#gljSelSheet')[0]);
+            if(callback){
+                callback();
+            }
+        };
+        let errFunc = function () {
+
+        };
+        CommonAjax.post(url, postData, sucFunc, errFunc);
+    },
+    buildSheet: function (container) {
+        let me = gljSelOprObj;
+        me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
+        me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
+        me.workBook.getSheet(0).setFormatter(-1, 1, "@", GC.Spread.Sheets.SheetArea.viewport);
+        me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditStarting, me.onCellEditStart);
+        me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
+        me.workBook.bind(GC.Spread.Sheets.Events.ButtonClicked, me.onButtonClicked);//复选框点击事件
+        me.bindBtnOpr($('#gljSelY'));
+        me.radiosChange();
+    },
+    onClipboardPasting: function (sender, args) {
+        args.cancel = true;
+    },
+    onCellEditStart: function (sender, args) {
+        args.cancel = true;
+    },
+    onButtonClicked: function (sender, args) {
+        let me = gljSelOprObj;
+        let val = args.sheet.getValue(args.row, args.col);
+        let thisGlj = me.currentCache[args.row];
+        thisGlj.isChecked = val;
+        if(args.sheet.isEditing()){
+            args.sheet.endEdit(true);
+        }
+        else{
+            //设置选中
+            if(val === true){
+                let isExist = false;
+                for(let i = 0, len = me.selectedList.length; i < len; i++){
+                    if(me.selectedList[i].gljId === thisGlj.gljId){
+                        isExist = true;
+                        break;
+                    }
+                }
+                if(!isExist){
+                    thisGlj.consumeAmt = 0;
+                    me.selectedList.push(thisGlj);
+                }
+            }
+            else if(val === false){
+                for(let i = 0, len = me.selectedList.length; i < len; i++){
+                    if(me.selectedList[i].gljId === thisGlj.gljId){
+                        me.selectedList.splice(i, 1);
+                        break;
+                    }
+                }
+            }
+        }
+    },
+    setShowGljList: function (gljList, clearChecked) {
+        //初始为所有工料机
+        let  me = this;
+        let curRationGlj = rationGLJOprObj.cache['_GLJ_' + rationGLJOprObj.currentRationItem.ID];
+        for(let i = 0; i < gljList.length; i++){
+            //去除与已添加的组成物重复的条目
+            let isExist = false;
+            for(let j = 0; j < curRationGlj.length; j++){
+                if(curRationGlj[j].gljId === gljList[i].gljId){
+                    isExist = true;
+                    break;
+                }
+            }
+            if(!isExist){
+                if(clearChecked){
+                    gljList[i].isChecked = false;
+                }
+            }
+            else {
+                gljList[i].isChecked = true;
+            }
+            me.showGljList.push(gljList[i]);
+        }
+    },
+    //初始默认radio
+    initRadio: function () {
+        let me = gljSelOprObj;
+        $('#gljSearchKeyword').val('');//恢复搜索文本
+        me.selectedList = [].concat(rationGLJOprObj.cache['_GLJ_' + rationGLJOprObj.currentRationItem.ID]);
+        //默认radio所有工料机
+        if(typeof $("input[name='glj']:checked")[0] !== 'undefined'){
+            $("input[name='glj']:checked")[0].checked = false;
+        }
+        $("input[value = 'allGljs']")[0].checked = true;
+        me.radiosSelected = 'allGljs';
+        //初始为所有工料机
+        me.showGljList = [];
+        if(me.radiosSelected === 'allGljs'){
+            me.setShowGljList(me.stdGljList, true);
+            me.setShowGljList(me.complementaryGljList, true);
+            me.sortGlj(me.showGljList);
+        }
+    },
+    filterDatasAndShow: function () {
+        let me = gljSelOprObj;
+        let val = $("input[name='glj']:checked").val();
+        me.radiosSelected = val;
+        //选择改变,数据重新筛选显示
+        me.showGljList = [];
+        if(me.radiosSelected === 'allGljs'){
+            me.setShowGljList(me.stdGljList);
+            me.setShowGljList(me.complementaryGljList);
+        }
+        else if(me.radiosSelected === 'stdGljs'){
+            me.setShowGljList(me.stdGljList);
+        }
+        else if(me.radiosSelected === 'complementaryGljs'){
+            me.setShowGljList(me.complementaryGljList);
+        }
+        //搜索匹配
+        let searchStr = $('#gljSearchKeyword').val();
+        if(searchStr && searchStr.trim() != ''){
+            let reg = new RegExp(searchStr);
+            me.showGljList = _.filter(me.showGljList, function (data) {
+                return reg.test(data.code) || reg.test(data.name);
+            });
+        }
+        me.sortGlj(me.showGljList);
+        //重新显示
+        me.showGljItems(me.showGljList, me.gljCurTypeId);
+        //切换radio后更新cache
+        if (me.currentOprParent = 1) {
+            if(me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
+                me.currentCache = me.getParentCache(me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]);
+            }
+            else{
+                me.currentCache = [];
+            }
+        } else {
+            me.currentCache = me.getCache();
+        }
+    },
+    //监听radios选择事件
+    radiosChange: function () {
+        let me = gljSelOprObj;
+        $('.glj-radio').change(function () {
+            me.filterDatasAndShow();
+        });
+    },
+
+    getParentCache: function (nodes) {
+        let me = gljSelOprObj, rst = [];
+        for(let i = 0; i < me.showGljList.length; i++){
+            if(nodes.indexOf(me.showGljList[i].gljClass) !== -1){
+                rst.push(me.showGljList[i]);
+            }
+        }
+        rst.sort(function (a, b) {
+            let rst = 0;
+            if(a.code > b.code) rst = 1;
+            else if(a.code < b.code)rst = -1;
+            return rst;
+        });
+        return rst;
+    },
+    getCache: function() {
+        let me = gljSelOprObj, rst = [];
+        for (let i = 0; i < me.showGljList.length; i++) {
+            if (me.showGljList[i].gljClass == me.gljCurTypeId) {
+                rst.push(me.showGljList[i]);
+            }
+        }
+        return rst;
+    },
+    showGljItems: function(data, type) {
+        let me = gljSelOprObj;
+        if (me.workBook) {
+            let cacheSection = [];
+            let pArr = me.parentNodeIds["_pNodeId_" + type];
+            for (let i = 0; i < data.length; i++) {
+                if (pArr && pArr.indexOf(data[i].gljClass) >= 0) {
+                    cacheSection.push(data[i]);
+                } else if (type == data[i].gljClass) {
+                    cacheSection.push(data[i]);
+                }
+            }
+            sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+            sheetsOprObj.showDataForGljSel(me.workBook.getSheet(0), me.setting, cacheSection, rationGLJOprObj.distTypeTree);
+            me.workBook.getSheet(0).setRowCount(cacheSection.length);
+            cacheSection = null;
+        }
+    },
+    //组成物窗口按钮操作
+    bindBtnOpr: function (conf) {//确定、取消、关闭按钮
+        let me = gljSelOprObj, that = rationGLJOprObj;
+        conf.click(function () {
+            that.cache['_GLJ_' + that.currentRationItem.ID] = me.selectedList;
+            that.updateRationItem(function () {
+                that.sheet.getParent().focus();
+                sheetCommonObj.cleanData(that.sheet, that.setting, -1);
+                that.showGljItems(that.currentRationItem.ID);
+                $('#selGlj').modal('hide');
+            });
+        });
+    }
+};
+
+let gljSelTreeOprObj = {
+     setting: {
+        view: {
+            expandSpeed: "",
+            selectedMulti: false
+        },
+        edit: {
+            enable: false,
+            editNameSelectAll: true,
+            showRemoveBtn: true,
+            showRenameBtn: true,
+            removeTitle: "删除节点",
+            renameTitle: "更改名称"
+        },
+        data: {
+            keep: {
+                parent:true,
+                leaf:true
+            },
+            key: {
+                children: "items",
+                name: "Name"
+            },
+            simpleData: {
+                enable: false,
+                idKey: "ID",
+                pIdKey: "ParentID",
+                rootPId: -1
+            }
+        },
+        callback:{
+            onClick: function(event,treeId,treeNode) {
+                let me = gljSelOprObj, gljTypeId = treeNode.ID;
+                if(me.gljCurTypeId !== treeNode.ID){
+                    me.gljCurTypeId = treeNode.ID;
+                    if (me.parentNodeIds["_pNodeId_" + treeNode.ID]) {
+                        me.currentOprParent = 1;
+                        me.currentCache = me.getParentCache(me.parentNodeIds["_pNodeId_" + treeNode.ID]);
+                    } else {
+                        me.currentCache = me.getCache();
+                    }
+                }
+                me.showGljItems(me.showGljList, gljTypeId);
+            }
+        }
+    }
+};
+
+$(document).ready(function () {
+    $('#gljSearchKeyword').change(function () {
+        gljSelOprObj.filterDatasAndShow();
+    });
+    $('#gljSearchKeyword').bind('keypress', function (e) {
+        if(e.keyCode === 13){
+            $(this).blur();
+            return false;
+        }
+    });
+});

+ 51 - 0
web/building_saas/complementary_ration_lib/js/ration.js

@@ -54,6 +54,7 @@ let rationOprObj = {
         let me = rationOprObj;
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
         me.getRationsCodes(rationRepId);
+        me.onContextmenuOpr();
         me.rationDelOpr();
         me.setCombo(me.workBook.getSheet(0), 'dynamic');
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
@@ -163,6 +164,52 @@ let rationOprObj = {
         }
         return cacheSection;
     },
+    onContextmenuOpr: function () {//右键菜单
+        let me = this;
+        $.contextMenu({
+            selector: '#rationItemsSheet',
+            build: function($triggerElement, e){
+                //控制允许右键菜单在哪个位置出现
+                let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
+                let sheet = me.workBook.getSheet(0);
+                let  delDis = false;
+                let cacheSection = me.getCache();
+                let ration = cacheSection[target.row];
+                if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
+                    if(typeof target.row !== 'undefined'){
+                        //控制按钮是否可用
+                        sheet.setActiveCell(target.row, target.col);
+                        if(!cacheSection ||target.row >= cacheSection.length){//右键定位在有数据的行,删除键才显示可用
+                            delDis = true;
+                        }
+                        else{//有数据
+                            if(typeof target.col === 'undefined'){//定位不在表格内
+                                delDis = true;
+                            }
+                            else {
+                                delDis = ration.type === 'std' ? true : false;
+                            }
+                        }
+                    }
+                    else{
+                        delDis = true;
+                    }
+                    return {
+                        callback: function(){},
+                        items: {
+                            "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
+                                me.mixDel = 1;
+                                me.mixUpdateRequest([], [], [ration.ID]);
+                            }}
+                        }
+                    };
+                }
+                else{
+                    return false;
+                }
+            }
+        });
+    },
     rationDelOpr: function () {
         let me = rationOprObj;
         me.workBook.commandManager().register('rationDelete', function () {
@@ -280,6 +327,10 @@ let rationOprObj = {
         }
     },
     onCellEditEnd: function(sender, args) {
+        let edV = args.sheet.getValue(args.row, args.col);
+        if(edV){
+            args.sheet.setValue(args.row, args.col, edV.toString().trim());
+        }
         let me = rationOprObj, rObj = sheetsOprObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row),
             updateArr = [], addArr = [];
         let dataCode = me.setting.header[args.col].dataCode;

+ 1 - 1
web/building_saas/complementary_ration_lib/js/ration_coe.js

@@ -10,7 +10,7 @@ var rationCoeOprObj = {
     cache: {},
     setting: {
         header:[
-            {headerName:"编号",headerWidth:120,dataCode:"serialNo", dataType: "Number", hAlign: 'left'},
+            {headerName:"编号",headerWidth:120,dataCode:"serialNo", dataType: "Number", hAlign: 'center'},
             {headerName:"名称",headerWidth:400,dataCode:"name", dataType: "String", hAlign: 'left'},
             {headerName:"内容",headerWidth:300,dataCode:"content", dataType: "String", hAlign: 'left'}
         ],

+ 79 - 50
web/building_saas/complementary_ration_lib/js/ration_glj.js

@@ -15,7 +15,7 @@ var rationGLJOprObj = {
             {headerName:"名称",headerWidth:400,dataCode:"name", dataType: "String"},
             {headerName:"规格型号",headerWidth:120,dataCode:"specs", dataType: "String"},
             {headerName:"单位",headerWidth:160,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
-            {headerName:"基价单价",headerWidth:160, dataCode:"basePrice", dataType: "Number", formatter:"0.00",  precision: 2},
+            {headerName:"定额价",headerWidth:160, dataCode:"basePrice", dataType: "Number", formatter:"0.00",  precision: 2},
             {headerName:"定额消耗",headerWidth:160, dataCode:"consumeAmt", dataType: "Number", formatter: "0.000", precision: 3},
             {headerName:"类型",headerWidth:160,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"}
         ],
@@ -79,13 +79,84 @@ var rationGLJOprObj = {
         var me = this;
         me.sheet = sheet;
         me.getGljDistType(function () {
-           // me.onContextmenuOpr();
-            sheetCommonObj.initSheet(me.sheet, me.setting, 30);
-            me.bindRationGljDelOpr();
-            me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
-            me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
-            me.sheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStarting);
-            me.sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
+            gljSelOprObj.getGljClassTree(pageOprObj.gljLibId, function () {
+                gljSelOprObj.getSelGljItems(pageOprObj.gljLibId, function () {
+                    sheetCommonObj.initSheet(me.sheet, me.setting, 30);
+                    me.onContextmenuOpr();
+                    me.bindRationGljDelOpr();
+                    me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
+                    me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
+                    me.sheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStarting);
+                    me.sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
+                });
+            });
+        });
+    },
+    onContextmenuOpr: function () {//右键菜单
+        let me = this;
+        $.contextMenu({
+            selector: '#rdSpread',
+            build: function($triggerElement, e){
+                //控制允许右键菜单在哪个位置出现
+                let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.sheet.getParent());
+                let sheet = me.sheet;
+                let addDis = false, delDis = false;
+                let rationGlj = [];
+                if(me.sheet.getParent().getActiveSheet() === me.sheet && target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
+                    if(typeof target.row !== 'undefined'){
+                        //控制按钮是否可用
+                        sheet.setActiveCell(target.row, target.col);
+                        //当前定额为补充定额时按钮有效
+                        if(me.currentRationItem && me.currentRationItem.type === 'complementary'){
+                            rationGlj =  me.cache['_GLJ_' + me.currentRationItem.ID];
+                            if(!rationGlj ||target.row >= rationGlj.length){//右键定位在有数据的行,删除键才显示可用
+                                delDis = true;
+                            }
+                            else{//有数据
+                                if(typeof target.col === 'undefined'){//定位不在表格内
+                                    delDis = true;
+                                }
+                            }
+                        }
+                        else{
+                            addDis = true;
+                            delDis = true;
+                        }
+                    }
+                    else{
+                        addDis = true;
+                        delDis = true;
+                    }
+                    return {
+                        callback: function(){},
+                        items: {
+                            "add": {name: "添加人材机", disabled: addDis, icon: "fa-plus", callback: function (key, opt) {
+                                //默认radio所有工料机
+                                gljSelOprObj.initRadio();
+                                gljSelOprObj.gljCurTypeId = null;
+                                //默认点击树根节点
+                                if(gljSelOprObj.rootNode){
+                                    gljSelOprObj.treeObj.selectNode(gljSelOprObj.rootNode);
+                                    gljSelTreeOprObj.setting.callback.onClick(null, 'componentTree', gljSelOprObj.rootNode);
+                                }
+                                //弹出窗口
+                                $('#selGlj').modal('show');
+                            }},
+                            "delete": {name: "删除人材机", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
+                                rationGlj.splice(target.row, 1);
+                                me.updateRationItem(function(){
+                                    me.sheet.getParent().focus();
+                                });
+                                sheetCommonObj.cleanData(me.sheet, me.setting, -1);
+                                me.showGljItems(me.currentRationItem.ID);
+                            }},
+                        }
+                    };
+                }
+                else{
+                    return false;
+                }
+            }
         });
     },
     bindRationGljDelOpr: function () {
@@ -287,47 +358,6 @@ var rationGLJOprObj = {
             args.sheet.setValue(args.row, args.col, '');
         }
     },
-    onContextmenuOpr: function () {
-        let me = rationGLJOprObj;
-        $.contextMenu({
-            selector: '#rdSpread',
-            build: function ($triggerElement, e) {
-                //控制允许右键菜单在哪个位置出现
-                let sheet = me.sheet;
-                let offset = $triggerElement.offset(),
-                    x = e.pageX - offset.left,
-                    y = e.pageY - offset.top;
-                let target = sheet.hitTest(x, y);
-                if(sheet.parent.getActiveSheetIndex() === 0 && target.hitTestType === 3 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'){
-                    let delDis = true, cacheSection;
-                    sheet.setActiveCell(target.row, target.col);
-                    if(me.currentRationItem){
-                        let cacheSection = me.cache["_GLJ_" + me.currentRationItem.ID];
-                        if(target.row < cacheSection.length){
-                            delDis = false;
-                        }
-                    }
-                    return {
-                        callback: function(key, options) {
-                        },
-                        items: {
-                            "delete": {name: "删除", icon: 'fa-remove', disabled: delDis, callback: function (key, opt) {
-                                cacheSection.splice(target.row, 1);
-                                me.updateRationItem(function () {
-                                    me.sheet.getParent().focus(true);
-                                });
-                                sheetCommonObj.cleanData(me.sheet, me.setting, -1);
-                                me.showGljItems(me.currentRationItem.ID);
-                            }}
-                        }
-                    };
-                }
-                else{
-                    return false;
-                }
-            }
-        });
-    },
     getRecoveryArr: function (tempDelArr, newArr) {//获得更新的code不存在,恢复删除的被更新数据
         let rst = [];
         for(let i = 0, len = tempDelArr.length; i < len; i++){
@@ -484,7 +514,6 @@ var rationGLJOprObj = {
 
     buildRationItemGlj: function(){
         var me = this, rst = [];
-        console.log(me.currentRationItem && me.cache["_GLJ_" + me.currentRationItem.ID]);
         if (me.currentRationItem && me.cache["_GLJ_" + me.currentRationItem.ID]) {
             var cacheArr = me.cache["_GLJ_" + me.currentRationItem.ID];
             for (var i = 0; i < cacheArr.length; i++) {

+ 2 - 63
web/building_saas/complementary_ration_lib/js/repository_glj.js

@@ -111,20 +111,6 @@ repositoryGljObj = {
                 callback();
             }
         });
-   /*     $.ajax({
-            type: 'post',
-            url: "api/getGljDistType",
-            dataType: 'json',
-            success: function (result) {
-                if(!result.error && callback){
-                    me.distTypeTree = me.getComboData(result.data);
-                    /!*let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
-                    combo.items(me.distTypeTree.comboDatas).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);*!/
-                    me.workBook.getSheet(0).getCell(-1, 5, GC.Spread.Sheets.SheetArea.viewport).value(me.distTypeTree.comboDatas[0].text);
-                    callback();
-                }
-            }
-        })*/
     },
     getGljTree: function(gljLibId, callback) {
         var me = this;
@@ -137,34 +123,11 @@ repositoryGljObj = {
             }
             callback();
         });
-/*
-        $.ajax({
-            type:"POST",
-            url:"api/getGljTree",
-            data:{"gljLibID": gljLibID},
-            dataType:"json",
-            cache:false,
-            timeout:20000,
-            success:function(result,textStatus,status){
-                if(status.status == 200) {
-                    zTreeHelper.createTree(result.data, gljSetting, "repositoryTree", me);
-                    if (result.data && result.data.length > 0) {
-                        me.gljCurTypeId = result.data[0].ID;
-                    } else {
-                        gljTypeTreeOprObj.addRootNode();
-                    }
-                    callback();
-                }
-            },
-            error:function(err){
-                alert(err.responseJSON.error);
-            }
-        })*/
     },
     getGljItems: function(gljLibId) {
         var me = this;
-        CommonAjax.post('api/getGljItems', {gljLibId: gljLibId}, function (rstData) {
-            me.gljList = rstData;
+        CommonAjax.post('api/getGljItems', {stdGljLibId: gljLibId}, function (rstData) {
+            me.gljList = rstData.stdGljs.concat(rstData.complementaryGljs);
             me.workBook.getSheet(0).setRowCount(rstData.length);
             me.sortGlj();
             let rootNode = me.treeObj.getNodes()[0];
@@ -174,30 +137,6 @@ repositoryGljObj = {
             }
         });
 
-       /* $.ajax({
-            type:"POST",
-            url:"api/getGljItems",
-            data:{"repositoryId": gljLibID},
-            dataType:"json",
-            cache:false,
-            timeout:5000,
-            success:function(result){
-                if(!result.error) {
-                    me.gljList = result.data;
-                    me.workBook.getSheet(0).setRowCount(result.data.length);
-                    me.sortGlj();
-                    let rootNode = me.treeObj.getNodes()[0];
-                    if(rootNode && rootNode.isParent && rootNode.isFirstNode){
-                        me.treeObj.selectNode(rootNode);
-                        gljTypeTreeOprObj.onClick(null, 'repositoryTree', rootNode);
-                    }
-                    //me.showGljItems(result.data, me.gljCurTypeId);
-                }
-            },
-            error:function(err){
-                alert(err.responseJSON.error);
-            }
-        })*/
     },
     showGljItems: function(data, type) {
         var me = repositoryGljObj;

+ 1 - 0
web/building_saas/complementary_ration_lib/js/section_tree.js

@@ -104,6 +104,7 @@ let sectionTreeObj = {
             rootId: -1
         },
         options: {
+            allowContextMenu: false,
             tabStripVisible:  false,
             allowCopyPasteExcelStyle : false,
             allowExtendPasteRange: false,

+ 53 - 0
web/building_saas/complementary_ration_lib/js/sheetsOpr.js

@@ -80,6 +80,59 @@ let sheetsOprObj = {
         sheet.resumePaint();
         //me.shieldAllCells(sheet);
     },
+    showDataForGljSel: function(sheet, setting, data, distTypeTree) {
+        var me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        let checkBoxType = new GC.Spread.Sheets.CellTypes.CheckBox();
+        if(typeof setting.owner !== 'undefined' && setting.owner === 'gljComponent'){
+            sheet.setRowCount(data.length + 5);
+        }
+        else{
+            sheet.setRowCount(typeof repositoryGljObj !== 'undefined' && repositoryGljObj.currentOprParent === 1 ? data.length : data.length + 10);
+        }
+        for (var col = 0; col < setting.header.length; col++) {
+            var hAlign = "left", vAlign = "center";
+            if (setting.header[col].hAlign) {
+                hAlign = setting.header[col].hAlign;
+            } else if (setting.header[col].dataType !== "String"){
+                hAlign = "right";
+            }
+            vAlign = setting.header[col].vAlign?setting.header[col].vAlign:vAlign;
+            me.setAreaAlign(sheet.getRange(-1, col, -1, 1), hAlign, vAlign);
+            if (setting.header[col].formatter) {
+                sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
+            }
+            for (var row = 0; row < data.length; row++) {
+                if(setting.header[col].dataCode === 'gljType' && data[row].gljType){
+                    let distTypeVal =  distTypeTree.distTypes[distTypeTree.prefix + data[row].gljType].data.fullName;
+                    sheet.setValue(row, col, distTypeVal, ch);
+                }
+                else {
+                    sheet.setValue(row, col, data[row][setting.header[col].dataCode], ch);
+                    sheet.setTag(row, 0, data[row].ID, ch);
+                }
+                //复选框
+                if(setting.header[col].dataCode === 'isComplementary'){
+                    sheet.setCellType(row, col, checkBoxType);
+                    sheet.getCell(row, col).value(1);
+                }
+                //新增组成物表,选择复选框
+                if(setting.header[col].dataCode === 'select'){
+                    sheet.setCellType(row, col, checkBoxType)
+                    if(data[row].isChecked === true){
+                        sheet.getCell(row, col).value(1);
+                    }
+                }
+            }
+            for(let i = data.length; i < sheet.getRowCount(); i++){
+                sheet.setCellType(i, 6, null);
+            }
+        }
+        sheet.resumeEvent();
+        sheet.resumePaint();
+        //me.shieldAllCells(sheet);
+    },
     combineRowData: function(sheet, setting, row, repositoryGljObj) {
         let me = this;
         var rst = {};

+ 1 - 0
web/building_saas/main/js/views/project_property_basicInfo.js

@@ -11,6 +11,7 @@ let basicInfoView = {
             {name: '值', dataCode: 'value', width: 120, vAlign: 'center', hAlign: 'left'}
         ],
         options: {
+            allowContextMenu: false,
             tabStripVisible:  false,
             allowCopyPasteExcelStyle : false,
             allowExtendPasteRange: false,

+ 1 - 0
web/building_saas/main/js/views/project_property_bills_quantity_decimal.js

@@ -29,6 +29,7 @@ let billsDecimalView = {
             {name: '小数位数', dataCode: 'decimal', width: 80, vAlign: 'center', hAlign: 'center'}
         ],
         options: {
+            allowContextMenu: false,
             tabStripVisible:  false,
             allowCopyPasteExcelStyle : false,
             allowUserDragDrop : false,

+ 1 - 0
web/building_saas/main/js/views/project_property_indicativeInfo.js

@@ -13,6 +13,7 @@ let indicativeInfoObj = {
             {name: '单方造价', dataCode: 'perCentiare', width: 80, vAlign: 'center', hAlign: 'right'}
         ],
         options: {
+            allowContextMenu: false,
             tabStripVisible:  false,
             allowCopyPasteExcelStyle : false,
             allowExtendPasteRange: false,

+ 1 - 0
web/building_saas/main/js/views/project_property_labour_coe_view.js

@@ -36,6 +36,7 @@ let labourCoeView = {
         me.spread.options.tabStripVisible = false;
         me.spread.options.showVerticalScrollbar = true;
         me.spread.options.showHorizontalScrollbar = true;
+        me.spread.options.allowContextMenu = false;
         let sheetArea = GC.Spread.Sheets.SheetArea;
         let sheet = me.spread.getSheet(0);
         me.sheet = sheet;

+ 1 - 0
web/building_saas/main/js/views/project_property_projFeature.js

@@ -12,6 +12,7 @@ let projFeatureView = {
             {name: '值', dataCode: 'value', width: 120, vAlign: 'center', hAlign: 'center'}
         ],
         options: {
+            allowContextMenu: false,
             tabStripVisible:  false,
             allowCopyPasteExcelStyle : false,
             allowExtendPasteRange: false,

+ 1 - 0
web/building_saas/pm/js/pm_gc.js

@@ -34,6 +34,7 @@ const gcTreeObj = {
         },
         options: {
             tabStripVisible:  false,
+            allowContextMenu: false,
             allowCopyPasteExcelStyle : false,
             allowExtendPasteRange: false,
             allowUserDragDrop : false,

+ 1 - 0
web/building_saas/pm/js/pm_newMain.js

@@ -52,6 +52,7 @@ const projTreeObj = {
         },
         options: {
             tabStripVisible:  false,
+            allowContextMenu: false,
             allowCopyPasteExcelStyle : false,
             allowExtendPasteRange: false,
             allowUserDragDrop : true,