Browse Source

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

zhongzewei 7 năm trước cách đây
mục cha
commit
ffbac823ab

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

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

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

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

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