فهرست منبع

Merge branch 'master' of http://192.168.1.12:3000/SmartCost/ConstructionCost

TonyKang 7 سال پیش
والد
کامیت
d7413cff70

+ 13 - 10
modules/complementary_glj_lib/controllers/gljController.js

@@ -16,17 +16,20 @@ class GljController extends BaseController{
         let gljLibId = null, engineeringId, sessionCompilation = req.session.sessionCompilation,
             rationValuation = sessionCompilation.ration_valuation,
             billValuation = sessionCompilation.bill_valuation,
-            engineeringLibModel = new EngineeringLibModel();
-        if(rationValuation[0]){
-            let engineeringList = rationValuation[0].engineering_list;
-            engineeringId = engineeringList.length > 0 ? engineeringList[0].engineering_id : null;
-            let engineeringInfo = await engineeringLibModel.getEngineering(engineeringId);
-            gljLibId = engineeringInfo.glj_lib.length > 0 && typeof engineeringInfo.glj_lib !== 'undefined' ? engineeringInfo.glj_lib[0].id : null;
+            engineeringLibModel = new EngineeringLibModel(),
+            valuationIDs = [] ;
+        for(let r of rationValuation){//{ "glj_lib.0": {$exists:1} }
+            if(r.id){
+                valuationIDs.push(r.id);
+            }
+        }
+        for(let b of billValuation){
+            if(b.id){
+                valuationIDs.push(b.id);
+            }
         }
-        else if(billValuation[0]){
-            let engineeringList = billValuation[0].engineering_list;
-            engineeringId = engineeringList.length > 0 ? engineeringList[0].engineering_id : null;
-            let engineeringInfo = await engineeringLibModel.getEngineering(engineeringId);
+        if(valuationIDs.length > 0){
+            let engineeringInfo = await engineeringLibModel.findDataByCondition({'valuationID': {"$in": valuationIDs},"glj_lib.0": {$exists:1}});//数组大于0
             gljLibId = engineeringInfo.glj_lib.length > 0 && typeof engineeringInfo.glj_lib !== 'undefined' ? engineeringInfo.glj_lib[0].id : null;
         }
         res.render('building_saas/complementary_glj_lib/html/tools-gongliaoji.html',{

+ 16 - 0
modules/main/controllers/project_controller.js

@@ -136,5 +136,21 @@ module.exports = {
             }
             res.json(result);
         })
+    },
+    getDefaultColSetting: async function(req, res){
+        let data = JSON.parse(req.body.data);
+        let result={
+            error: 0,
+            data: null
+        };
+        try{
+            result.data = await project_facade.getDefaultColSetting(data.libID);
+        }
+        catch(err){
+            logger.err(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        res.json(result);
     }
 };

+ 7 - 1
modules/main/facade/project_facade.js

@@ -15,13 +15,15 @@ let project_glj_model = mongoose.model('glj_list');
 let ration_glj_facade = require("../../ration_glj/facade/ration_glj_facade");
 const uuidV1 = require('uuid/v1');
 const gljUtil = require('../../../public/gljUtil');
+let stdColSettingModel = mongoose.model('std_main_col_lib');
 
 module.exports = {
     markUpdateProject:markUpdateProject,
     removeProjectMark:removeProjectMark,
     updateNodes:updateNodes,
     calcInstallationFee:calcInstallationFee,
-    saveProperty: saveProperty
+    saveProperty: saveProperty,
+    getDefaultColSetting: getDefaultColSetting
 };
 
 async function calcInstallationFee(data) {
@@ -251,4 +253,8 @@ function saveProperty(data, callback){
             callback('', null);
         }}
     );
+}
+
+async function getDefaultColSetting(libID){
+    return await stdColSettingModel.findOne({ID: libID, deleted: false}, '-_id main_tree_col');
 }

+ 2 - 0
modules/main/facade/ration_facade.js

@@ -296,12 +296,14 @@ async function addRationGLJ(std,newRation) {
                 newGLJ.unit = std_glj.unit;
                 newGLJ.specs = std_glj.specs;
                 newGLJ.basePrice = std_glj.basePrice;
+                newGLJ.marketPrice = std_glj.basePrice;
                 newGLJ.shortName = std_glj.shortName;
                 newGLJ.type = std_glj.gljType;
                 newGLJ.repositoryId = std_glj.repositoryId;
                 newGLJ.adjCoe = std_glj.adjCoe;
                 newGLJ.materialType = std_glj.materialType;
                 newGLJ.materialCoe = std_glj.materialCoe;
+                newGLJ.createType = 'normal';
                 let info = await  ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId);
                 newGLJ = ration_glj_facade.createNewRecord(info);
                 newRationGLJList.push(newGLJ);

+ 1 - 0
modules/main/routes/project_route.js

@@ -14,6 +14,7 @@ module.exports = function (app) {
     projectRouter.post('/updateNodes', projectController.updateNodes);
     projectRouter.post('/calcInstallationFee', projectController.calcInstallationFee);
     projectRouter.post('/saveProperty', projectController.saveProperty);
+    projectRouter.post('/getDefaultColSetting', projectController.getDefaultColSetting);
 
     app.use('/project',projectRouter);
 };

+ 4 - 2
modules/pm/controllers/pm_controller.js

@@ -471,7 +471,8 @@ module.exports = {
         try {
             let userID = req.session.sessionUser.id;
             let rst = {receive: [], share: []}//接收的、由我分享的
-            let shareProjects = await projectModel.find({userID: userID, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'shareInfo.0': {$exists: true}});
+            let shareProjects = await projectModel.find({userID: userID,
+                $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], compilation: req.session.sessionCompilation._id, 'shareInfo.0': {$exists: true}});
             //项目类型为分享给别人
             let shareToUserIDs = [];
             for(let proj of shareProjects){
@@ -499,7 +500,8 @@ module.exports = {
                 }
             }
             rst.share = shareProjects;
-            let receiveProjects = await projectModel.find({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'shareInfo.userID': userID});
+            let receiveProjects = await projectModel.find({
+                $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], compilation: req.session.sessionCompilation._id, 'shareInfo.userID': userID});
             //设置原项目用户信息
             if(receiveProjects.length > 0){
                 let orgUserIDs = [];

+ 12 - 17
modules/ration_glj/facade/ration_glj_facade.js

@@ -125,6 +125,7 @@ function get_lib_glj_info(ration_glj) {
                 ration_glj.unit = glj.unit;
                 ration_glj.specs = glj.specs;
                 ration_glj.basePrice = glj.basePrice;
+                ration_glj.marketPrice = glj.basePrice;
                 ration_glj.shortName = glj.shortName;
                 ration_glj.type = glj.gljType;
                 ration_glj.repositoryId = glj.repositoryId;
@@ -161,8 +162,8 @@ function createNewRecord(ration_glj) {
     newRecoed.original_code = ration_glj.original_code;
     newRecoed.unit = ration_glj.unit;
     newRecoed.specs = ration_glj.specs;
-    newRecoed.from = ration_glj.from ? ration_glj.from : undefined;
-    newRecoed.createType = ration_glj.createType ? ration_glj.createType : undefined;
+    newRecoed.from = ration_glj.from ? ration_glj.from : 'std';
+    newRecoed.createType = ration_glj.createType ? ration_glj.createType : 'normal';
     newRecoed.shortName = ration_glj.shortName;
     newRecoed.billsItemID = ration_glj.billsItemID;
     newRecoed.type = ration_glj.type;
@@ -500,22 +501,16 @@ function save(user_id, datas, callback) {
 }
 
 async function getLibInfo(req) {
-    let gljLibId = null, engineeringId, sessionCompilation = req.session.sessionCompilation,
-        rationValuation = sessionCompilation.ration_valuation,
-        billValuation = sessionCompilation.bill_valuation,
-        engineeringLibModel = new EngineeringLibModel();
-    if (rationValuation[0]) {
-        let engineeringList = rationValuation[0].engineering_list;
-        engineeringId = engineeringList.length > 0 ? engineeringList[0].engineering_id : null;
-        let engineeringInfo = await engineeringLibModel.getEngineering(engineeringId);
-        gljLibId = engineeringInfo.glj_lib.length > 0 && typeof engineeringInfo.glj_lib !== 'undefined' ? engineeringInfo.glj_lib[0].id : null;
-    }
-    else if (billValuation[0]) {
-        let engineeringList = billValuation[0].engineering_list;
-        engineeringId = engineeringList.length > 0 ? engineeringList[0].engineering_id : null;
-        let engineeringInfo = await engineeringLibModel.getEngineering(engineeringId);
+    let gljLibId = null, engineerID, sessionCompilation = req.session.sessionCompilation,
+        engineeringLibModel = new EngineeringLibModel() ;
+    engineerID = req.params.engineerID;
+    if(engineerID){
+        let engineeringInfo = await engineeringLibModel.findDataByCondition({'_id': engineerID});
         gljLibId = engineeringInfo.glj_lib.length > 0 && typeof engineeringInfo.glj_lib !== 'undefined' ? engineeringInfo.glj_lib[0].id : null;
+    }else {
+        throw new Error("工程专业ID为空!");
     }
+
     let data = {
         userID: req.session.sessionUser.id,
         gljLibId: gljLibId,
@@ -575,7 +570,7 @@ function getGLJSearchInfo(ration_glj) {
         type: ration_glj.subType ? ration_glj.subType : ration_glj.type,//如果有subType,则是通过插入定额级的工料机进来的
         type_of_work: ration_glj.subType ? ration_glj.subType : ration_glj.type,
         base_price: ration_glj.basePrice,
-        market_price: ration_glj.basePrice,
+        market_price: ration_glj.marketPrice,
         repositoryId: ration_glj.repositoryId,
         adjCoe: ration_glj.adjCoe,
         materialType:ration_glj.materialType,

+ 1 - 1
modules/ration_glj/routes/ration_glj_route.js

@@ -8,7 +8,7 @@ let rgController = require('../controllers/ration_glj_controller');
 module.exports = function (app) {
 
     var rgRouter = express.Router();
-    rgRouter.get('/getGLJData', rgController.getGLJData);
+    rgRouter.get('/getGLJData/:engineerID', rgController.getGLJData);
     rgRouter.post('/addGLJ',rgController.addGLJ);
     rgRouter.post('/replaceGLJ',rgController.replaceGLJ);
     rgRouter.post('/mReplaceGLJ',rgController.mReplaceGLJ);

+ 2 - 1
web/building_saas/main/html/main.html

@@ -682,8 +682,9 @@
                                                 </label>
                                             </div>
                                         </fieldset>
-                                        <div id="col_setting_spread" style="height:300px;overflow:hidden">
+                                        <div id="col_setting_spread" style="height:280px;overflow:hidden">
                                         </div>
+                                        <div><a style="margin-left: 5px;" class="btn btn-sm" id="recColSetting" href="javascript:void(0);">恢复默认列设置</a></div>
                                     </div>
                                 </div>
                             </div>

+ 29 - 7
web/building_saas/main/js/models/calc_base.js

@@ -134,21 +134,26 @@ let cbTools = {
         mapObj['CHARGE'] = Object.create(null);
         mapObj['TAX'] = Object.create(null);
         mapObj['OTHERS'] = Object.create(null);
-        let filter = ['CSXMF', 'ZZCSXMF', 'ZZCSXMDEJJZJGCF', 'ZZCSXMDEJJRGF', 'ZZCSXMDEJJCLF', 'ZZCSXMDEJJJXF', 'QTXMF', 'GF', 'SJ', 'SQGCZJ'];
+        mapObj['ENGINEERINGCOST'] = Object.create(null);
+        let filter = ['CSXMF', 'ZZCSXMF', 'ZZCSXMDEJJZJGCF', 'ZZCSXMDEJJRGF', 'ZZCSXMDEJJCLF', 'ZZCSXMDEJJJXF', 'QTXMF', 'GF', 'SJ', 'SQGCZJ', 'AQWMSGZXFY'];
+        //安全文明施工专项费用只有税金和工程造价能用
         for(let figure in baseFigures){
             if(filter.indexOf(baseFigures[figure]['base']) === -1){
                 mapObj['CONSTRUCTION_ORGANIZATION'][figure] = baseFigures[figure];
             }
-            if(baseFigures[figure]['base'] !== 'QTXMF' && baseFigures[figure]['base'] !== 'SQGCZJ'){
+            if(baseFigures[figure]['base'] !== 'QTXMF' && baseFigures[figure]['base'] !== 'SQGCZJ' && baseFigures[figure]['base'] !== 'AQWMSGZXFY'){
                 mapObj['OTHER'][figure] = baseFigures[figure];
             }
-            if(baseFigures[figure]['base'] !== 'GF' && baseFigures[figure]['base'] !== 'SQGCZJ'){
+            if(baseFigures[figure]['base'] !== 'GF' && baseFigures[figure]['base'] !== 'SQGCZJ' && baseFigures[figure]['base'] !== 'AQWMSGZXFY'){
                 mapObj['CHARGE'][figure] = baseFigures[figure];
             }
             if(baseFigures[figure]['base'] !== 'SJ' && baseFigures[figure]['base'] !== 'SQGCZJ'){
                 mapObj['TAX'][figure] = baseFigures[figure];
             }
             if(baseFigures[figure]['base'] !== 'SQGCZJ'){
+                mapObj['ENGINEERINGCOST'][figure] = baseFigures[figure];
+            }
+            if(baseFigures[figure]['base'] !== 'SQGCZJ' && baseFigures[figure]['base'] !== 'AQWMSGZXFY'){
                 mapObj['OTHERS'][figure] = baseFigures[figure];
             }
             if(baseFigures[figure]['base'] === 'SQGCZJ'){
@@ -180,6 +185,9 @@ let cbTools = {
         else if(this.isFlag(node.data) && node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.TAX){
             return calcBase.baseFigureClass.TAX;
         }
+        else if(this.isFlag(node.data) && node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.ENGINEERINGCOST){
+            return calcBase.baseFigureClass.ENGINEERINGCOST;
+        }
         else {
             if(!parent){
                 return calcBase.baseFigureClass.OTHERS;
@@ -525,6 +533,13 @@ let baseFigureTemplate = {
         if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
         return cbTools.isDef(bill.feesIndex.common) && cbTools.isDef(bill.feesIndex.common[totalFeeType]) ? bill.feesIndex.common[totalFeeType] : 0;
     },
+    'AQWMSGZXFY': function (tender) {
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[calcBase.fixedFlag.SAFETY_CONSTRUCTION]['bill'];
+        if(cbTools.isUnDef(bill) || cbTools.isUnDef(bill.ID)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.common) && cbTools.isDef(bill.feesIndex.common[totalFeeType]) ? bill.feesIndex.common[totalFeeType] : 0;
+    },
     'JZMJ': function () {
         let buildingArea = projFeatureView.getFeature('buildingArea');
         return buildingArea ? parseFloat(buildingArea) : 0;
@@ -1006,6 +1021,7 @@ let baseFigureMap = {
     '其他项目费': {base: 'QTXMF',  fixedFlag: fixedFlag.OTHER, class: 'QTXM'},
     '规费': {base: 'GF', fixedFlag: fixedFlag.CHARGE, class: 'GF'},
     '税金': {base: 'SJ', fixedFlag: fixedFlag.TAX, class: 'SJ'},
+    '安全文明施工专项费用': {base: 'AQWMSGZXFY', fixedFlag: fixedFlag.SAFETY_CONSTRUCTION, class: 'CSXM'},
     //不于清单直接关联==========
     '建筑面积': {base: 'JZMJ', class: 'FBFX'},
     '税前工程造价': {base: 'SQGCZJ', class: 'SQGCZJ'},//安全文明施工专项费用使用
@@ -1187,9 +1203,12 @@ let cbAnalyzer = {
         }
         //转换成ID引用
         exp = cbParser.toIDExpr(exp);
-        if(this.cycleCalc(node, cbTools.getFigure(node), exp)){
+        if(this.cycleCalc(node, calcBase.baseFigures, exp)){
             throw '出现循环计算';
         }
+       /*  if(this.cycleCalc(node, cbTools.getFigure(node), exp)){
+            throw '出现循环计算';
+        }*/
         return exp;
      /*   if(this.inputLegal(exp)){
             if(this.arithmeticLegal(exp)){
@@ -1374,15 +1393,15 @@ let cbParser = {
         let exps = [];
         for(let i = 0, len = strs.length; i < len; i++){
             let exp = Object.create(null);
-            exp.orgExp = strs[i];
+            exp.orgExp = `{${strs[i]}}`;
             exps.push(exp);
         }
         //去{}
-        v = v.replace(/[{, },]/g, '');
+        //v = v.replace(/[{, },]/g, '');
         for(let i = 0, len = exps.length;i < len; i++){
             exps[i].compileExp = '$CBC.base(\'' + exps[i].orgExp + '\')';
             //暂估材料费作特殊处理
-            if(exps[i].orgExp === '暂估材料费(从子目汇总)' || exps[i].orgExp === '暂估材料费(从工料机汇总表汇总)'){
+            if(exps[i].orgExp === '{暂估材料费(从子目汇总)}' || exps[i].orgExp === '{暂估材料费(从工料机汇总表汇总)}'){
                 let reCount = v.split(exps[i].orgExp).length - 1;
                 while (reCount > 0){
                     v = v.replace(exps[i].orgExp, exps[i].compileExp);
@@ -1393,6 +1412,8 @@ let cbParser = {
                 v = v.replace(new RegExp(exps[i].orgExp, 'g'), exps[i].compileExp);
             }
         }
+        //去{}
+        v = v.replace(/[{, },]/g, '');
         //行引用
         let fidArr = this.getFIDArr(v);
         let fExps = [];
@@ -1514,6 +1535,7 @@ let calcBase = {
             node.changed = true;
         }
         catch (err){
+            console.log(err);
             if(typeof err === 'object'){
                 err = '表达式不正确'
             }

+ 2 - 0
web/building_saas/main/js/models/project_glj.js

@@ -678,6 +678,7 @@ ProjectGLJ.prototype.refreshTreeNodePriceIfNeed = function (data) {
         var nodes = _.filter(projectObj.project.mainTree.items, function (tem) {
             if (tem.sourceType == ModuleNames.ration_glj && tem.data.projectGLJID == data.id) {
                 tem.data.marketUnitFee = data.unit_price.market_price;
+                tem.data.marketPrice = data.unit_price.market_price;
                 return true;
             }
         })
@@ -720,6 +721,7 @@ ProjectGLJ.prototype.getImpactRationNodes = function (gljs) {
                 let tem_g = gljMap[item.data.projectGLJID];
                 if(tem_g){
                     item.data.marketUnitFee = this.getMarketPrice(tem_g);//这里要按计算的市场价为准,不能直接取
+                    item.data.marketPrice = this.getMarketPrice(tem_g);
                     nodes.push(item);
                 }
             } else if (rationMap[item.data.ID] == true) {  //受影响的定额

+ 7 - 2
web/building_saas/main/js/models/ration_glj.js

@@ -500,7 +500,8 @@ var ration_glj = {
             projectObj.mainController.refreshTreeNode(nodes);
         };
         ration_glj.prototype.getGLJData = function (cb) {
-            CommonAjax.get('/rationGlj/getGLJData', function (data) {
+            let engineerID = projectInfoObj.projectInfo.property.engineering_id;
+            CommonAjax.get('/rationGlj/getGLJData/'+engineerID, function (data) {
                 cb(data);
             })
         };
@@ -543,6 +544,7 @@ var ration_glj = {
                         specs: glj.specs,
                         subType: glj.gljType,
                         basePrice: glj.basePrice,
+                        marketPrice:glj.basePrice,
                         original_code: glj.code,
                         shortName: glj.shortName,
                         serialNo: serialNo,
@@ -617,6 +619,7 @@ var ration_glj = {
                     unit: glj.unit,
                     specs: glj.specs,
                     basePrice: glj.basePrice,
+                    marketPrice:glj.basePrice,
                     shortName: glj.shortName,
                     type: glj.gljType,
                     adjCoe: glj.adjCoe,
@@ -648,7 +651,7 @@ var ration_glj = {
             if (selectCode == gljOprObj.getIndex(oldData, gljKeyArray)) {
                 return callback(null);
             }
-            if (oldData.createType == 'normal') {//只有是定额下带的工料机才需把类型改成替换,其它的保持不变
+            if (oldData.createType===undefined || oldData.createType == 'normal') {// createTypel 默认是normal 只有是定额下带的工料机才需把类型改成替换,其它的保持不变
                 oldData.rcode = oldData.code;
                 oldData.createType = 'replace';
             }
@@ -659,6 +662,7 @@ var ration_glj = {
             oldData.unit = glj.unit;
             oldData.specs = glj.specs;
             oldData.basePrice = glj.basePrice;
+            oldData.marketPrice = glj.basePrice;
             oldData.repositoryId = glj.repositoryId;
             oldData.materialType = glj.materialType;
             oldData. materialCoe =  glj.materialCoe;
@@ -707,6 +711,7 @@ var ration_glj = {
                 specs: glj.specs,
                 type: glj.gljType,
                 basePrice: glj.basePrice,
+                marketPrice:glj.basePrice,
                 repositoryId: glj.repositoryId,
                 materialType: glj.materialType,   //三材类别
                 materialCoe: glj.materialCoe,

+ 12 - 4
web/building_saas/main/js/views/fee_rate_view.js

@@ -185,6 +185,14 @@ var feeRateObject={
         sheet.rowOutlines.group(22, 6);*/
        // sheet.getRange(-1, 0, -1, 1).width(300);
         sheet.showRowOutline(false);
+
+        // 默认折叠
+        for (let i in data){
+            if (!data[i].ParentID){
+                sheet.rowOutlines.setCollapsed(parseFloat(i), true);
+            };
+        };
+
         sheet.resumeEvent();
         sheet.resumePaint(false);
     },
@@ -204,11 +212,11 @@ var feeRateObject={
             }
         };
 
+        // 展开
         for (let i in rates){
-            if (!rates[i].ParentID){
-                sheet.rowOutlines.setCollapsed(parseFloat(i), true);
-                if (rates[i].ID == pID)
-                    sheet.rowOutlines.setCollapsed(parseFloat(i), false);
+            if (!rates[i].ParentID && (rates[i].ID == pID)){
+                sheet.rowOutlines.setCollapsed(parseFloat(i), false);
+                break;
             };
         };
 

+ 3 - 3
web/building_saas/main/js/views/glj_col.js

@@ -16,7 +16,7 @@ let gljCol = {
             {headerName: "定额价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right", decimalField: "glj.unitPrice"},
             {headerName: "调整价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right", decimalField: "glj.unitPrice"},
             {headerName: "市场价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right", decimalField: "glj.unitPrice"},
-            {headerName: "暂估", headerWidth: 65, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"
+            {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"
             }
         ],
         view: {
@@ -36,8 +36,8 @@ let gljCol = {
             {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
             {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
-            {headerName: "暂估", headerWidth: 60, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
-            {headerName: "主要\n材料", headerWidth: 60, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox'},
+            {headerName: "暂估", headerWidth: 45, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
+            {headerName: "主要\n材料", headerWidth: 45, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox'},
             {headerName: "供货方式", headerWidth: 80, dataCode: "supply", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:supplyComboMap},
             {headerName: "甲供数量", headerWidth: 100, dataCode: "supply_quantity", hAlign: "right", dataType: "Number",validator:"number",decimalField:'glj.quantity'},
             {headerName: "三材类别", headerWidth: 80, dataCode: "materialType", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:materialComboMap},

+ 6 - 1
web/building_saas/main/js/views/main_tree_col.js

@@ -484,10 +484,15 @@ let colSettingObj = {
         for(let i = 0; i < cols.length; i++){
             let colSetting = cols[i];
             if(colSetting.data.field === field){
-                return i
+                return i;
             }
         }
         return null;
+    },
+    getFieldByCol: function (col) {
+        let cols = projectObj.project.projSetting.main_tree_col.cols;
+        let colSetting = cols[col];
+        return colSetting ? colSetting.data.field : null;
     }
 
 };

+ 7 - 0
web/building_saas/main/js/views/project_glj_view.js

@@ -62,10 +62,17 @@ projectGljObject={
     },
     initProjectGljSheet:function () {
         this.projectGljSheet = this.projectGljSpread .getSheet(0);
+
         this.initSheet(this.projectGljSheet,this.projectGljSetting);
         this.projectGljSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onProjectGljSelectionChange);
         this.projectGljSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onProjectGljEditStarting);
         this.projectGljSheet.name('projectGljSheet');
+
+        this.projectGljSheet.setRowHeight(0, 45, 1);
+        let cell = this.projectGljSheet.getCell(0, 9, GC.Spread.Sheets.SheetArea.colHeader);
+        // console.log(cell.value());
+        cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center).vAlign(GC.Spread.Sheets.VerticalAlign.center).wordWrap(true);
+        // cell.wordWrap(true);
     },
     initMixRatio:function () {
         let me = projectGljObject;

+ 108 - 1
web/building_saas/main/js/views/project_view.js

@@ -674,7 +674,7 @@ var projectObj = {
                         col.data.autoHeight = true;
                         col.showHint = true;
                     }
-                    if(col.data.field ==='quantity'){
+                    if(col.data.field ==='quantity' || col.data.field ==='remark'){
                         col.showHint = true;
                     }
 
@@ -696,6 +696,7 @@ var projectObj = {
                 that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.beforeTreeSelectedChange, that.beforeMainTreeSelectedChange);
                 that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, that.treeSelectedChanged);
 
+                //that.bindEnterKey(that.mainSpread, 'mainEnterKey', that.mainSpreadEnterKey);
                 setTimeout(function () {
                     that.mainSpread.getActiveSheet().startEdit();//这两句需要挺多时间,而又需要在editend 事件前触发,而这些又不影响计算,所以这里用异步的方法
                     that.mainSpread.getActiveSheet().endEdit();
@@ -741,6 +742,84 @@ var projectObj = {
         });
 
     },
+    mainSpreadEnterKey: function () {
+        let me = projectObj;
+        let sheet = me.mainSpread.getActiveSheet();
+        let orgRow = sheet.getActiveRowIndex();
+        let orgCol = sheet.getActiveColumnIndex();
+        let orgField = colSettingObj.getFieldByCol(orgCol);
+        let selected = me.project.mainTree.items[orgRow];
+        if(sheet.isEditing()){
+            sheet.endEdit();
+        }
+        //正常情况,焦点应该是在下一行的同一列
+        let newRow = orgRow + 1, newCol = orgCol;
+        if(selected){
+            //在分项/补项的编码单元格回车,焦点应跳动至本行的工程量单元格
+            if(orgField && orgField === 'code' && selected.sourceType === me.project.Bills.getSourceType() && [billType.FX, billType.BX].includes(selected.data.type)){
+                let quantityCol = colSettingObj.getColByField('quantity');
+                let quantityVisible = colSettingObj.getVisible('quantity');
+                if(quantityCol && quantityVisible){
+                    newRow = orgRow;
+                    newCol = quantityCol;
+                }
+            }
+            //在分项/补项的工程量单元格回车,如果其下有定额/量价/人材机,焦点应跳动至其下第一条定额/量价/人材机的工程量;
+            //如果其下没有定额/量价/人材机,则自动在其下插入一条定额空行,在其后自动插入一条分项空行,焦点跳动至定额空行的编码单元格。
+            if(orgField && orgField === 'quantity' && selected.sourceType === me.project.Bills.getSourceType() && [billType.FX, billType.BX].includes(selected.data.type)
+                && selected.children.length === 0){
+                me.project.Ration.addNewRation(null,rationType.ration, function () {
+                    newRow = sheet.getActiveRowIndex();
+                    newCol = sheet.getActiveColumnIndex();
+                });
+            }
+            //在定额/量价/人材机的编码单元格回车,焦点应跳动至本行的工程量单元格
+            if(orgField && orgField === 'code' && selected.sourceType === me.project.Ration.getSourceType() && []){
+
+            }
+
+
+        }
+        //设置焦点
+        sheet.setActiveCell(newRow, newCol);
+        //触发表格事件
+        me.mainController.setTreeSelected(me.project.mainTree.items[newRow]);//SelectionChanged
+
+    },
+    //注册自定义回车键事件
+    bindEnterKey: function (workBook, registerName, operation) {
+        let me = this;
+        let sheet = workBook.getActiveSheet();
+        workBook.commandManager().register(registerName, operation);
+       /* workBook.commandManager().register(registerName, function(){
+            operation();
+           /!* let orgRow = sheet.getActiveRowIndex();
+            let orgCol = sheet.getActiveColumnIndex();
+            if(sheet.isEditing()){
+                sheet.endEdit();
+            }
+            let code = sheet.getValue(orgRow, 0);
+            let newRow, newCol;
+            if(!me.currentCache[orgRow] && code !== undefined && code !== null && orgCol !== me.setting.header.length - 1){
+                newRow = orgRow;
+                newCol = orgCol + 1;
+                sheet.setActiveCell(newRow, newCol);
+            }
+            else{
+                newRow = orgRow + 1;
+                newCol = me.currentCache[orgRow + 1] ? orgCol : 0;
+                sheet.setActiveCell(newRow, newCol);
+            }*!/
+            //触发事件
+            /!*me.onLeaveCell({type: 'LeaveCell'}, {sheet: sheet, sheetName: sheet.name(), cancel: false, row: orgRow, col: orgCol});
+            me.onEnterCell({type: 'EnterCell'}, {sheet: sheet, sheetName: sheet.name(), cancel: false, row: newRow, col: newCol});
+            let newSels = [{row: newRow, rowCount: 1, col: newCol, colCount: 1}];
+            let oldSels = [{row: orgRow, rowCount: 1, col: orgRow, colCount: 1}];
+            me.onSelectionChanged({type: 'SelectionChanged'}, {sheet: sheet, sheetName: sheet.name(), newSelections: newSels, oldSelections: oldSels});*!/
+        });*/
+        workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.enter, false, false, false, false);
+        workBook.commandManager().setShortcutKey(registerName, GC.Spread.Commands.Key.enter, false, false, false, false);
+    },
     loadMainSpreadContextMenu: function () {
         var project = this.project, spread = this.mainSpread, controller = this.mainController;
         $.contextMenu({
@@ -1663,6 +1742,33 @@ $('#poj-set').on('show.bs.modal', function () {
         calcOptions.init();
     }
 });
+
+//恢复默认列设置
+$('#recColSetting').click(function () {
+    let libID = projectObj.project.property.colLibID ? projectObj.project.property.colLibID : null;
+    if(!libID){
+        alert('项目没有绑定标准列设置');
+        return;
+    }
+    $(this).addClass('disabled');
+    CommonAjax.post('/project/getDefaultColSetting', {libID: libID}, function (rstData) {
+        if(!rstData || rstData.length === 0){
+            alert('标准列设置没有数据');
+            $('#recColSetting').removeClass('disabled');
+            return;
+        }
+        let sheet = colSettingObj.settingSpread.getActiveSheet();
+        SheetDataHelper.massOperationSheet(sheet, function () {
+            for(let row = 0; row < sheet.getRowCount(); row++){
+                sheet.setValue(row, 0, rstData.main_tree_col.cols[row].visible);
+            }
+        });
+        $('#recColSetting').removeClass('disabled');
+    }, function () {
+        $('#recColSetting').removeClass('disabled');
+    });
+});
+
 $('#property_ok').click(function () {
     let project = projectObj.project,
         projectID = project.ID(),
@@ -2345,6 +2451,7 @@ function disableTools(){
     $('#std_labour_coe_files').prop('disabled', 'disabled');
     //呈现选项
     $('#display-setting').find('input').prop('disabled', 'disabled');
+    $('#recColSetting').remove();
     //项目属性确定
     $('#property_ok').addClass('disabled');
     //特征及内容

+ 1 - 1
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -554,7 +554,7 @@ const billsGuidance = (function () {
     function bindBtn(){
         //打开清单指引库
         $('#stdBillsGuidanceTab').click(function () {
-            if(libSel.children().length === 0 && !projectReadOnly){
+            if(libSel.children().length === 0 && !projectReadOnly && !$(this).hasClass('disabled')){
                 initLibs(projectInfoObj.projectInfo.engineeringInfo.billsGuidance_lib);
             }
         });