Browse Source

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

chenshilong 7 years ago
parent
commit
1302850b58
50 changed files with 925 additions and 204 deletions
  1. 6 1
      config/gulpConfig.js
  2. BIN
      lib/jquery-ui/images/ui-icons_444444_256x240.png
  3. BIN
      lib/jquery-ui/images/ui-icons_555555_256x240.png
  4. BIN
      lib/jquery-ui/images/ui-icons_777620_256x240.png
  5. BIN
      lib/jquery-ui/images/ui-icons_777777_256x240.png
  6. BIN
      lib/jquery-ui/images/ui-icons_cc0000_256x240.png
  7. BIN
      lib/jquery-ui/images/ui-icons_ffffff_256x240.png
  8. 62 0
      lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2.min.js
  9. 4 3
      modules/all_models/bills.js
  10. 5 0
      modules/all_models/ration.js
  11. 1 3
      modules/all_schemas/bills_sub_schemas.js
  12. 1 1
      modules/complementary_glj_lib/controllers/gljController.js
  13. 1 1
      modules/complementary_ration_lib/routes/routes.js
  14. 3 2
      modules/pm/models/project_property_template.js
  15. 5 1
      modules/ration_glj/facade/glj_calculate_facade.js
  16. 18 0
      public/gljUtil.js
  17. 150 0
      public/web/gljUtil.js
  18. 10 3
      public/web/sheet/sheet_common.js
  19. 1 0
      public/web/sheet/sheet_data_helper.js
  20. 12 8
      public/web/tree_sheet/tree_sheet_controller.js
  21. 4 3
      public/web/tree_sheet/tree_sheet_helper.js
  22. 2 2
      web/building_saas/complementary_glj_lib/html/tools-gongliaoji.html
  23. 3 6
      web/building_saas/complementary_glj_lib/js/glj.js
  24. 1 0
      web/building_saas/complementary_glj_lib/js/gljClassTree.js
  25. 1 1
      web/building_saas/complementary_glj_lib/js/gljComponent.js
  26. 2 0
      web/building_saas/complementary_glj_lib/js/sheetOpr.js
  27. 2 2
      web/building_saas/complementary_ration_lib/html/anzhuang.html
  28. 67 9
      web/building_saas/complementary_ration_lib/html/dinge.html
  29. 2 2
      web/building_saas/complementary_ration_lib/html/fuzhu.html
  30. 2 2
      web/building_saas/complementary_ration_lib/html/gongliao.html
  31. 333 0
      web/building_saas/complementary_ration_lib/js/gljSelect.js
  32. 51 0
      web/building_saas/complementary_ration_lib/js/ration.js
  33. 1 1
      web/building_saas/complementary_ration_lib/js/ration_coe.js
  34. 79 50
      web/building_saas/complementary_ration_lib/js/ration_glj.js
  35. 2 63
      web/building_saas/complementary_ration_lib/js/repository_glj.js
  36. 1 0
      web/building_saas/complementary_ration_lib/js/section_tree.js
  37. 53 0
      web/building_saas/complementary_ration_lib/js/sheetsOpr.js
  38. 2 1
      web/building_saas/js/global.js
  39. 2 2
      web/building_saas/main/html/main.html
  40. 12 25
      web/building_saas/main/js/main.js
  41. 4 1
      web/building_saas/main/js/views/project_glj_view.js
  42. 1 0
      web/building_saas/main/js/views/project_property_basicInfo.js
  43. 1 0
      web/building_saas/main/js/views/project_property_bills_quantity_decimal.js
  44. 1 0
      web/building_saas/main/js/views/project_property_indicativeInfo.js
  45. 1 0
      web/building_saas/main/js/views/project_property_labour_coe_view.js
  46. 1 0
      web/building_saas/main/js/views/project_property_projFeature.js
  47. 11 9
      web/building_saas/main/js/views/tender_price_view.js
  48. 2 2
      web/building_saas/pm/html/project-management.html
  49. 1 0
      web/building_saas/pm/js/pm_gc.js
  50. 1 0
      web/building_saas/pm/js/pm_newMain.js

+ 6 - 1
config/gulpConfig.js

@@ -11,6 +11,7 @@ module.exports = {
         'lib/bootstrap/bootstrap.min.js',
         'web/building_saas/js/*.js',
         'public/web/scMathUtil.js',
+        'public/web/gljUtil.js',
         'public/web/PerfectLoad.js',
         'lib/lodash/lodash.js',
     ],
@@ -69,7 +70,7 @@ module.exports = {
         'public/web/number_util.js',
         'public/web/sheet/sheet_common.js',
        // 'lib/ztree/*.js',
-        'lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1',
+        'lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2',
        // 'lib/spreadjs/views/gc.spread.views.dataview.10.0.0.min.js',
        // "lib/spreadjs/views/common/gc.spread.common.10.0.0.min.js",
       //  'lib/spreadjs/views/plugins/gc.spread.views.gridlayout.10.0.0.min.js',
@@ -164,15 +165,18 @@ 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',
         'public/web/tree_sheet/tree_sheet_helper.js',
         'public/web/treeDataHelper.js',
         'public/web/sheet/sheet_common.js',
+        'public/web/sheet/sheet_data_helper.js',
         'web/building_saas/complementary_ration_lib/js/sheetsOpr.js',
         'public/web/QueryParam.js',
         'public/web/storageUtil.js',
@@ -185,6 +189,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',

BIN
lib/jquery-ui/images/ui-icons_444444_256x240.png


BIN
lib/jquery-ui/images/ui-icons_555555_256x240.png


BIN
lib/jquery-ui/images/ui-icons_777620_256x240.png


BIN
lib/jquery-ui/images/ui-icons_777777_256x240.png


BIN
lib/jquery-ui/images/ui-icons_cc0000_256x240.png


BIN
lib/jquery-ui/images/ui-icons_ffffff_256x240.png


File diff suppressed because it is too large
+ 62 - 0
lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2.min.js


+ 4 - 3
modules/all_models/bills.js

@@ -42,9 +42,8 @@ let billsSchema = new Schema({
     isTender_Labour: Boolean,
     isTender_Material: Boolean,
     isTender_Machine: Boolean,
-    tenderTargetPrice: String, // Decimal
-    tenderTargetUnitPrice: String, // Decimal
-    tenderTargetUnitPrice: String, // Decimal
+    targetUnitFee:String,//目标单价
+    targetTotalFee:String,//目标合价
     //工作内容//zhong 2017-8-31
     jobContentText: String, //清单工作内容列显示文本, 减少第一次拉数据时的循环次数
     jobContent: [subSchema.jobContentSchema],
@@ -57,6 +56,8 @@ let billsSchema = new Schema({
     flags: [subSchema.flagsSchema],
     //消耗量调整系数字段
     quantityCoe:subSchema.quantityCoeSchema,
+    //子目工程量调整系数
+    rationQuantityCoe:String,
     // 不调价
     is_adjust_price: {type: Number,default: 0},
     installationKey:String,//用来记录安装增加费的关联字段

+ 5 - 0
modules/all_models/ration.js

@@ -38,8 +38,13 @@ let rationSchema = new Schema({
     fees: [subSchema.feesSchema],
     //消耗量调整系数字段
     quantityCoe:subSchema.quantityCoeSchema,
+    //子目工程量调整系数
+    rationQuantityCoe:String,
+    tenderQuantity:String,//调整后工程量
     // 不调价
     is_adjust_price: {type: Number,default: 0},
+    targetUnitFee:String,//目标单价
+    targetTotalFee:String,//目标合价
     deleteInfo: deleteSchema,
     type: Number,                               // 1 定额、2 量价、3 工料机定额
     subType: Number,                            // 子类型:1人工、201材料、301机械、4主材、5设备

+ 1 - 3
modules/all_schemas/bills_sub_schemas.js

@@ -10,9 +10,7 @@ var feesSchema = new Schema({
     unitFee: String, // Decimal. 单价
     totalFee: String, // Decimal. 合价
     tenderUnitFee: String, // Decimal. 调价后单价
-    tenderTotalFee: String, // Decimal. 调价后合价
-    targetUnitFee:String,//目标单价
-    targetTotalFee:String//目标合价
+    tenderTotalFee: String // Decimal. 调价后合价
 });
 
 // 标记字段

+ 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);

+ 3 - 2
modules/pm/models/project_property_template.js

@@ -17,10 +17,11 @@ const displaySetting = {
     billsAutoHeight:true,
     rationAutoHeight:false,
     disPlayMainMaterial:true
-}
+};
 
 const tenderSetting = {
-    gljPriceTenderCoe:1 //工料机单价调整系数
+    gljPriceTenderCoe:1, //工料机单价调整系数
+    calcPriceOption:'coeBase'//根据调整系数计算报价
 };
 
 const calcOptions={

+ 5 - 1
modules/ration_glj/facade/glj_calculate_facade.js

@@ -157,7 +157,11 @@ function generateAdjustState(glj,coeList,adjustState,index,quantity) {
     if(glj._doc.createType=='replace'&&glj.rcode!=glj.code){
         adjustState.push({index:stateSeq.replace,content:glj.rcode+'换'+glj.code});
     }else if(glj._doc.createType=='add'){
-        let displayQuantity = glj._doc.hasOwnProperty('customQuantity')?parseFloat(glj.customQuantity):parseFloat(quantity);
+        let displayQuantity = quantity;
+        if(glj._doc.hasOwnProperty('customQuantity')&&(glj.customQuantity != null||glj.customQuantity != '')){
+            displayQuantity = glj.customQuantity;
+        }
+        displayQuantity = displayQuantity&&displayQuantity!=""?parseFloat(displayQuantity):0;
         adjustState.push({index:stateSeq.add,content:'添'+glj.code+'量'+ displayQuantity});
     }
     // to do

+ 18 - 0
public/gljUtil.js

@@ -0,0 +1,18 @@
+/**
+ * Created by zhang on 2018/6/7.
+ */
+import fs from 'fs';
+let _= require('lodash');
+const scMathUtil = require('./scMathUtil').getUtil();
+
+let gljNodeUtil = null;
+let data = fs.readFileSync(__dirname + '/web/gljUtil.js', 'utf8', 'r');
+eval(data + ' ; gljNodeUtil = gljUtil; ');
+
+module.exports = {
+    calcProjectGLJQuantity :calcProjectGLJQuantity
+};
+
+function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
+    gljNodeUtil.calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal,_,scMathUtil);
+}

+ 150 - 0
public/web/gljUtil.js

@@ -0,0 +1,150 @@
+/**
+ * Created by zhang on 2018/6/7.
+ */
+
+let gljUtil = {
+    calcProjectGLJQuantity:function (projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal,_,scMathUtil) {
+        let project_gljs = projectGLJDatas.gljList;
+        let mixRatioMap = projectGLJDatas.mixRatioMap;
+        let rations = rationDatas;
+        let rationMap = _.indexBy(rations,'ID');
+        let quantityMap={},changeArray=[];
+        let rationGljGroup = _.groupBy(rationGLJDatas,'projectGLJID');
+        let [billIDs,tech_billIDS] = this.getSubdivisionAndTechBillsLeavesID(billsDatas);//分别取分部分项和技术措施项目的所有叶子清单ID
+        for(let pglj of project_gljs ){
+            let pg_index = this.getIndex(pglj,gljKeyArray);
+            pglj.subdivisionQuantity = 0;
+            pglj.techQuantity = 0;
+            pglj.quantity = 0;
+            let gljGroup = rationGljGroup[pglj.id]?rationGljGroup[pglj.id]:[];//定额工料机没有,有可能是定额类型的工料机
+            let result = this.getQuantityPerGLJ(gljGroup,rations,rationMap,pglj,billIDs,tech_billIDS,q_decimal,_,scMathUtil);
+            pglj.subdivisionQuantity = result.subdivisionQuantity;
+            pglj.techQuantity = result.techQuantity;
+            pglj.quantity = result.quantity;
+            quantityMap[pg_index] = pglj;
+        }
+        //计算做为组成物的消耗量
+        for(let pkey in mixRatioMap){
+            let mixRatioList = mixRatioMap[pkey];
+            for(let m of mixRatioList){
+                let m_index = gljOprObj.getIndex(m,gljKeyArray);
+                let m_glj = quantityMap[m_index];
+                let p_glj = quantityMap[pkey];
+                if(m_glj&&p_glj){
+                    let quantity = scMathUtil.roundForObj(p_glj.quantity*parseFloat(m.consumption),q_decimal);
+                    let techQuantity = scMathUtil.roundForObj(p_glj.techQuantity*parseFloat(m.consumption),q_decimal);
+                    let subdivisionQuantity = scMathUtil.roundForObj(p_glj.subdivisionQuantity*parseFloat(m.consumption),q_decimal);
+                    m_glj.quantity =  scMathUtil.roundForObj(m_glj.quantity+quantity,q_decimal);
+                    m_glj.techQuantity =  scMathUtil.roundForObj(m_glj.techQuantity+techQuantity,q_decimal);
+                    m_glj.subdivisionQuantity =  scMathUtil.roundForObj(m_glj.subdivisionQuantity+subdivisionQuantity,q_decimal);
+                }
+            }
+        }
+    },
+    getQuantityPerGLJ : function (ration_glj_list,rations,rationMap,pglj,billIDs,tech_billIDS,q_decimal,_,scMathUtil) {
+        let result={};
+        let quantity_sum=0;//工料机汇总消耗量
+        let sum = 0;//分部分项总消耗量
+        let tech_sum = 0;//技术措施总消耗量
+        for(let rg of ration_glj_list){
+            let tem_ration = rationMap[rg.rationID];
+            let r_quantity = tem_ration?scMathUtil.roundForObj(tem_ration.quantity,q_decimal):0;
+            let glj_quantity = scMathUtil.roundForObj(rg.quantity, q_decimal);
+            if(!r_quantity){
+                continue;
+            }
+            let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal);
+            quantity_sum = scMathUtil.roundForObj(quantity_sum+total,q_decimal);
+            if(_.includes(billIDs,rg.billsItemID)){//计算分部分项
+                sum = scMathUtil.roundForObj(sum+total,q_decimal);
+            }
+            if(_.includes(tech_billIDS,rg.billsItemID)){//计算技术措施项目消耗量
+                tech_sum = scMathUtil.roundForObj(tech_sum+total,q_decimal);
+            }
+        }
+        for(let ra of rations){//计算定额类型工料机的消耗量
+            if(ra.type == rationType.gljRation&&ra.projectGLJID===pglj.id){
+                let r_quantity = scMathUtil.roundForObj(ra.quantity,q_decimal);
+                r_quantity = r_quantity?r_quantity:0;
+                quantity_sum = scMathUtil.roundForObj(quantity_sum+r_quantity,q_decimal);
+                if(_.includes(billIDs,ra.billsItemID)){//计算分部分项
+                    sum = scMathUtil.roundForObj(sum+r_quantity,q_decimal);
+                }
+                if(_.includes(tech_billIDS,ra.billsItemID)){//计算技术措施项目消耗量
+                    tech_sum = scMathUtil.roundForObj(tech_sum+r_quantity,q_decimal);
+                }
+            }
+
+        }
+        result.subdivisionQuantity = sum;
+        result.techQuantity = tech_sum;
+        result.quantity = quantity_sum;
+        return result;
+    },
+    getSubdivisionAndTechBillsLeavesID:function (billsDatas) {//分别取分部分项和技术措施项目的所有叶子清单ID
+       /* if(projectObj){//存在,说明在前端调用
+            return [projectObj.project.Bills.getSubdivisionProjectLeavesID(),projectObj.project.Bills.getTechLeavesID()];
+        }*/
+        let parentMap ={};
+        let subdivisionBillID  = null,techBillID = null,sIDs = [],tIDS = [];
+        for(let b of billsDatas){
+            if(parentMap[b.ParentID]){
+                parentMap[b.ParentID].push(b);
+            }else {
+                parentMap[b.ParentID]= [b];
+            }
+            if(this.isFlag(b)&&b.flagsIndex.fixed.flag==this.fixedFlag.SUB_ENGINERRING) {
+                subdivisionBillID = b.ID;
+            }
+            if(this.isFlag(b)&&b.flagsIndex.fixed.flag==this.fixedFlag.CONSTRUCTION_TECH){
+                techBillID = b.ID;
+            }
+        }
+
+        getLeaveIDs(subdivisionBillID,parentMap,sIDs);
+        getLeaveIDs(techBillID,parentMap,tIDS);
+        return [sIDs,tIDS];
+
+        function getLeaveIDs(ID,parentM,leaveIDs) {
+            if(parentM[ID] && parentM[ID].length > 0){
+                let children  =  parentM[ID];
+                for(let c of children){
+                    if(parentM[c.ID]){
+                        getLeaveIDs(c.ID,parentM,leaveIDs);
+                    }else {
+                        leaveIDs.push(c.ID);
+                    }
+                }
+            }
+
+        }
+
+
+
+    },
+    isFlag : function (v) {
+        return this.isDef(v.flagsIndex) && this.isDef(v.flagsIndex.fixed) && this.isDef(v.flagsIndex.fixed.flag);
+    }
+    ,
+    isDef:function (v) {
+        return v !== undefined && v !== null;
+    },
+    getIndex(obj, pops){
+        let t_index = '';
+        let k_arr = [];
+        for (let p of pops) {
+            let tmpK = (obj[p] == undefined || obj[p] == null || obj[p] == '') ? 'null' : obj[p];
+            k_arr.push(tmpK);
+        }
+        t_index = k_arr.join("|-|");
+        return t_index;
+    },
+    fixedFlag : {
+        // 分部分项工程
+        SUB_ENGINERRING: 1,
+        // 措施项目
+        MEASURE: 2,
+        // 施工技术措施项目
+        CONSTRUCTION_TECH: 3
+    }
+}

+ 10 - 3
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;
     },
@@ -461,7 +462,7 @@ var sheetCommonObj = {
         }
         return pasteText.join('\n');
     },
-    transferToTreeSetting:function(setting,treeSetting){
+    transferToTreeSetting:function(setting,treeSetting,treeCol){
         for(let h of setting.header){
             treeSetting.cols.push(getSettingCol(h))
         }
@@ -500,12 +501,18 @@ var sheetCommonObj = {
                 let decimal = getDecimal(header.decimalField);
                 col.formatter = getFormatter(decimal);
             }
-            col.readOnly = function (node) {
+            if(header.getText && treeCol){
+                col.data.getText = treeCol.getEvent(header.getText);
+            }
+
+
+
+            /*col.readOnly = function (node) {
                 if(node.data.ParentID == -1 || node.data.id == 'GJ'){//三材类别项不能编辑)
                     return true;
                 }
                 return false;
-            };
+            };*/
             return col;
         }
         function getCellType(header) {

+ 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;

+ 12 - 8
public/web/tree_sheet/tree_sheet_controller.js

@@ -141,8 +141,10 @@ var TREE_SHEET_CONTROLLER = {
         controller.prototype.upMove = function () {
             var that = this, sels = this.sheet.getSelections();
             if (this.tree.selected) {
-                if (this.tree.selected.upMove()) {
-                    TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
+                TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
+                TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected,that.tree.selected.serialNo(),true);//为了处理移动前子项是隐藏的情况,先把所有的列设置为显示
+                TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected.preSibling,that.tree.selected.preSibling.serialNo(),true);
+                    if (that.tree.selected.upMove()) {
                         TREE_SHEET_HELPER.refreshTreeNodeData(that.setting, that.sheet, [that.tree.selected, that.tree.selected.nextSibling], true);
                         TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected,that.tree.selected.serialNo());
                         TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected.nextSibling,that.tree.selected.nextSibling.serialNo());
@@ -150,15 +152,17 @@ var TREE_SHEET_CONTROLLER = {
                         if (that.event.refreshBaseActn) {
                             that.event.refreshBaseActn(that.tree);
                         }
-                    });
-                }
+                    }
+                });
             }
         };
         controller.prototype.downMove = function () {
             var that = this, sels = this.sheet.getSelections();
             if (this.tree.selected) {
-                if (this.tree.selected.downMove()) {
-                    TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
+                TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
+                    TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected,that.tree.selected.serialNo(),true);//为了处理移动前子项是隐藏的情况,先把所有的列设置为显示
+                    TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected.nextSibling,that.tree.selected.nextSibling.serialNo(),true);
+                    if (that.tree.selected.downMove()) {
                         TREE_SHEET_HELPER.refreshTreeNodeData(that.setting, that.sheet, [that.tree.selected, that.tree.selected.preSibling], true);
                         TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected,that.tree.selected.serialNo());
                         TREE_SHEET_HELPER.refreshChildrenVisiable(that.sheet,that.tree,that.tree.selected.preSibling,that.tree.selected.preSibling.serialNo());
@@ -166,8 +170,8 @@ var TREE_SHEET_CONTROLLER = {
                         if (that.event.refreshBaseActn) {
                             that.event.refreshBaseActn(that.tree);
                         }
-                    });
-                }
+                    }
+                });
             }
         };
 

+ 4 - 3
public/web/tree_sheet/tree_sheet_helper.js

@@ -83,6 +83,7 @@ var TREE_SHEET_HELPER = {
 
         sheet.options.protectionOptions = option;
         sheet.options.isProtected = true;
+        sheet.options.allowCellOverflow = false;
     },
     massOperationSheet: function (sheet, Operation) {
         sheet.suspendPaint();
@@ -183,11 +184,11 @@ var TREE_SHEET_HELPER = {
             }
         });
     },
-    refreshChildrenVisiable:function(sheet,tree,node,row){
+    refreshChildrenVisiable:function(sheet,tree,node,row,visiable){
         let iCount = node.posterityCount(), i, child;
         for (i = 0; i < iCount; i++) {
-            child = tree.items[row + i + 1];
-            sheet.setRowVisible(row + i + 1, child.visible, GC.Spread.Sheets.SheetArea.viewport);
+            child = tree.items[row + i +1];
+            sheet.setRowVisible(row + i + 1, visiable?visiable:child.visible, GC.Spread.Sheets.SheetArea.viewport);
         }
        sheet.invalidateLayout();
     },

File diff suppressed because it is too large
+ 2 - 2
web/building_saas/complementary_glj_lib/html/tools-gongliaoji.html


+ 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();

File diff suppressed because it is too large
+ 2 - 2
web/building_saas/complementary_ration_lib/html/anzhuang.html


File diff suppressed because it is too large
+ 67 - 9
web/building_saas/complementary_ration_lib/html/dinge.html


File diff suppressed because it is too large
+ 2 - 2
web/building_saas/complementary_ration_lib/html/fuzhu.html


File diff suppressed because it is too large
+ 2 - 2
web/building_saas/complementary_ration_lib/html/gongliao.html


+ 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 = {};

+ 2 - 1
web/building_saas/js/global.js

@@ -123,4 +123,5 @@ function getFeeIndex(fees) {
         }
     }
     return feesIndex;
-}
+}
+

File diff suppressed because it is too large
+ 2 - 2
web/building_saas/main/html/main.html


+ 12 - 25
web/building_saas/main/js/main.js

@@ -3,21 +3,6 @@
  */
 
 $(function () {
-/*
-    // 读取本地存储的高度(必须放在载入spread之前)
-    let mainResizeEles = {};
-    mainResizeEles.id = '#main';
-    mainResizeEles.resize = $('#main').find('.resize');
-    mainResizeEles.nearElement = $('#main').find('.top-content');
-    mainResizeEles.nearSpread = mainResizeEles.nearElement.children(".main-data-top");
-    mainResizeEles.farElement = $('#main').find('.bottom-content');
-    mainResizeEles.farSpread = mainResizeEles.farElement.children().find(".main-data-bottom");
-    mainResizeEles.nav = mainResizeEles.farElement.children('ul.nav');
-    loadSize(mainResizeEles, 'height', function() {
-        refreshSubSpread();
-        zmhs_obj.refresh();
-    });
-*/
     loadMainSize();
     $("#header-menu").removeAttr('style');
     projectInfoObj.showProjectInfo();
@@ -222,16 +207,18 @@ function setSizeWithPercent(tag,eles,nearSize,farSize,type) {
 }
 
 function setDefaultSize(tag,eles,type) {
-    let o_nearSize = eles.nearSpread[type]();
-    let o_farSize = eles.farSpread[type]();
-    if(tag == "#main"){
-        eles.nearSpread[type](o_nearSize);  //工料机汇总和main页面处理方式不同
-        eles.farSpread[type](o_farSize);
-    }else if(tag == "#project-glj-main"){
-        o_nearSize = parseFloat(o_nearSize);
-        o_farSize = parseFloat(o_farSize);
-        eles.nearSpread[type](o_nearSize - o_farSize + 30);
-        eles.farSpread[type](o_farSize);
+    let o_nearSize = 5;
+    let o_farSize = 2;
+    if(type == 'height'){
+        let headerHeight = $(".header").height();
+        let toolsbarHeight = $(".toolsbar").height();
+        let exand = tag == "#main" ? 1:50;
+        let totalHeight = $(window).height() - headerHeight - toolsbarHeight-exand;
+        const navSize = eles.nav ? eles.nav[type]() + 4 : 0;
+        totalHeight = totalHeight - navSize;
+        let nearSize = (o_nearSize/(o_nearSize + o_farSize))* totalHeight;
+        eles.nearSpread[type](nearSize);
+        eles.farSpread[type](totalHeight - nearSize);
     }
 }
 

+ 4 - 1
web/building_saas/main/js/views/project_glj_view.js

@@ -691,7 +691,7 @@ projectGljObject={
                 extend.supply_quantity = me.getSupplyQuantity(value, recode.quantity);
             }
             if(dataCode === 'supply_quantity'){//修改数量需做4舍5入
-                value= value.toDecimal(getDecimal('glj.quantity'));
+                value=  scMathUtil.roundForObj(value,getDecimal('glj.quantity'));
             }
             if(dataCode === 'is_evaluate'||dataCode === 'is_adjust_price'||dataCode === 'is_main_material'){
                 if(value == true){
@@ -707,6 +707,9 @@ projectGljObject={
                 value = scMathUtil.roundForObj(value,getDecimal("material"));
             }
             extend = Object.keys(extend).length > 0 ?  JSON.stringify(extend) : '';
+
+            if(recode[dataCode] == value) return;
+
             let updateData = {id: recode.id, field: dataCode, value: value, extend: extend};
             projectGLJ.pGljUpdate(updateData,callback);
         };

+ 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,

+ 11 - 9
web/building_saas/main/js/views/tender_price_view.js

@@ -64,17 +64,19 @@ let tender_obj={
         me.tenderController.showTreeData();
 
         function createTenderNode(mainNode,parent,next) {
-            let newNode = me.tenderTree.addNode(parent, next, mainNode.data.ID);
-            newNode.data = mainNode.data;
-            newNode.source =  mainNode.source;
-            newNode.sourceType = mainNode.sourceType;
-            newNode.mainNode = mainNode;
-            if(mainNode.children.length > 0){
-                for(let c of mainNode.children){
-                    createTenderNode(c,newNode,null);
+            if(mainNode.sourceType != ModuleNames.ration_glj){//主材、设备的工料机不用显示
+                let newNode = me.tenderTree.addNode(parent, next, mainNode.data.ID);
+                newNode.data = mainNode.data;
+                newNode.source =  mainNode.source;
+                newNode.sourceType = mainNode.sourceType;
+                newNode.mainNode = mainNode;
+                if(mainNode.children.length > 0){
+                    for(let c of mainNode.children){
+                        createTenderNode(c,newNode,null);
+                    }
                 }
+                return newNode;
             }
-            return newNode;
         }
     }
 

File diff suppressed because it is too large
+ 2 - 2
web/building_saas/pm/html/project-management.html


+ 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,