Pārlūkot izejas kodu

Merge branch '1.0.0_online' of http://192.168.1.12:3000/SmartCost/ConstructionCost into 1.0.0_online

TonyKang 6 gadi atpakaļ
vecāks
revīzija
e53574a987
35 mainītis faili ar 849 papildinājumiem un 255 dzēšanām
  1. 2 1
      modules/all_models/ration.js
  2. 2 2
      modules/all_models/std_glj.js
  3. 5 1
      modules/common/std/std_glj_lib_glj_list_model.js
  4. 1 0
      modules/complementary_glj_lib/models/gljModel.js
  5. 17 8
      modules/glj/models/glj_list_model.js
  6. 2 2
      modules/main/controllers/bills_controller.js
  7. 11 1
      modules/main/controllers/ration_controller.js
  8. 53 8
      modules/main/facade/ration_facade.js
  9. 1 0
      modules/main/routes/ration_route.js
  10. 5 68
      modules/pm/controllers/pm_controller.js
  11. 9 2
      modules/pm/facade/pm_facade.js
  12. 16 0
      modules/pm/models/project_model.js
  13. 0 1
      modules/pm/routes/pm_route.js
  14. 5 3
      modules/ration_glj/controllers/ration_glj_controller.js
  15. 25 12
      modules/ration_glj/facade/ration_glj_facade.js
  16. 94 80
      public/web/sheet/sheet_data_helper.js
  17. 0 3
      public/web/tree_sheet/tree_sheet_helper.js
  18. BIN
      web/building_saas/css/animated_favicon1.gif
  19. BIN
      web/building_saas/css/favicon.ico
  20. BIN
      web/building_saas/css/logo.png
  21. 6 6
      web/building_saas/main/html/main.html
  22. 3 2
      web/building_saas/main/js/models/calc_base.js
  23. 18 14
      web/building_saas/main/js/models/calc_program.js
  24. 1 1
      web/building_saas/main/js/models/main_consts.js
  25. 21 0
      web/building_saas/main/js/models/project.js
  26. 12 1
      web/building_saas/main/js/models/ration_glj.js
  27. 15 4
      web/building_saas/main/js/views/main_tree_col.js
  28. 1 15
      web/building_saas/main/js/views/project_info.js
  29. 21 3
      web/building_saas/main/js/views/project_view.js
  30. 23 4
      web/building_saas/main/js/views/sub_view.js
  31. 20 8
      web/building_saas/pm/js/pm_newMain.js
  32. BIN
      web/dest/css/logo.png
  33. 455 0
      web/over_write/js/jiangxi_2017.js
  34. 1 1
      web/users/html/login.html
  35. 4 4
      web/users/html/user-set.html

+ 2 - 1
modules/all_models/ration.js

@@ -55,7 +55,8 @@ let rationSchema = new Schema({
     libID: Number,
     maskName: String,
     caption: String,
-    isFromDetail:{type: Number,default:0},       // 1 true 2 false
+    evaluationProject:{type: Number,default:0},       // 1 true 0 false 估价项目
+    isFromDetail:{type: Number,default:0},       // 1 true 0 false
     adjustState: String,
     rationProjName: String,
     comments: String,                           // 说明

+ 2 - 2
modules/all_models/std_glj.js

@@ -9,7 +9,7 @@ const std_gljComponent = new Schema(
     {
         ID: Number,
         consumeAmt: Number,
-        consumeAmtProperties: {
+        consumeAmtProperty: {
             type: Schema.Types.Mixed,
             default: {}
         }
@@ -26,7 +26,7 @@ const std_glj = new Schema({
     name: String,
     specs: String,
     basePrice: Number,
-    basePriceProperties: {
+    priceProperty: {
         type: Schema.Types.Mixed,
         default: {}
     },

+ 5 - 1
modules/common/std/std_glj_lib_glj_list_model.js

@@ -64,7 +64,11 @@ class STDGLJLibGLJListModel extends BaseModel {
         // 整理数据
         for (let component of libGljData.component) {
             componentIdList.push(component.ID);
-            componentConsume[component.ID] = component.consumeAmt;
+            if(component.consumeAmt != undefined && component.consumeAmt != null) {
+                componentConsume[component.ID] = component.consumeAmt;
+            }else if(component.consumeAmtProperty){
+                componentConsume[component.ID] = component.consumeAmtProperty;
+            }
         }
 
         let condition = {ID: {$in: componentIdList}};

+ 1 - 0
modules/complementary_glj_lib/models/gljModel.js

@@ -286,6 +286,7 @@ class GljDao {
                 componentIdListCpt.push(component.ID);
             }
             let isStdFlag = component.isStd ? 'std' : 'cpt';
+            //对于补充人材机的组成物,不会有多单价的情况
             componentConsume[component.ID + '_' + isStdFlag] = component.consumeAmt;
         }
 

+ 17 - 8
modules/glj/models/glj_list_model.js

@@ -235,7 +235,7 @@ class GLJListModel extends BaseModel {
      * @param {object} data
      * @return {Promise} 返回插入成功的数据id
      */
-    async addList(data,unitFileId) {
+    async addList(data,unitFileId,ext) {
         let result = null;
         try {
             if (Object.keys(data).length <= 0) {
@@ -277,11 +277,11 @@ class GLJListModel extends BaseModel {
             if(this.ownCompositionTypes.indexOf(data.type)!=-1) {
                 //如果是新增
                 if(isAddProjectGLJ ){
-                    await this.compositionInit(data, unitPriceFileId);
+                    await this.compositionInit(data, unitPriceFileId,ext);
                 }
                 CompositionGLJ=await this.getCompositionGLJByData(data,unitPriceFileId);
                 if(isAddProjectGLJ==false&&CompositionGLJ.length==0){//如果不是新增,并且是有组成物的类型但又没有发现组成物的情况下,有可能是错误数据,重新在库中查找一下组成物,有则插入
-                    await this.compositionInit(data, unitPriceFileId);
+                    await this.compositionInit(data, unitPriceFileId,ext);
                     CompositionGLJ=await this.getCompositionGLJByData(data,unitPriceFileId);
 
                     if(CompositionGLJ.length>0){//如果这次发现又有组成物了,则把旧的单价数据删除,在后面的操作中会重新增加
@@ -535,7 +535,7 @@ class GLJListModel extends BaseModel {
      * @param {Number} projectId
      * @return {void}
      */
-    async compositionInit(data, unitPriceFileId) {
+    async compositionInit(data, unitPriceFileId,ext) {
         let gljId = data.glj_id === undefined ? 0 : data.glj_id;
         let projectId = data.project_id === undefined ? 0 : data.project_id;
         let mixRatioModel = new MixRatioModel();
@@ -553,9 +553,14 @@ class GLJListModel extends BaseModel {
         let e_mList = await mixRatioModel.findDataByCondition({unit_price_file_id: unitPriceFileId,connect_key: connect_key},null,false);
         if(e_mList.length <= 0){
             for (let tmp of compositionGljList) {
+                let consumpiton = tmp.consumption;
+                //只有标准的工料机的组成物才会有多单价、多组成物消耗量的情况 fromTable
+                if(fromTable == 'std' && ext && ext.quantityField &&( tmp.consumption[ext.quantityField]!= undefined && tmp.consumption[ext.quantityField]!=null)){
+                    consumpiton = tmp.consumption[ext.quantityField];
+                }
                 // 配合比数据插入
                 let mixRatioData = {
-                    consumption: tmp.consumption,
+                    consumption: consumpiton,
                     glj_id: tmp.ID,
                     unit_price_file_id: unitPriceFileId,
                     connect_key: connect_key,
@@ -601,7 +606,13 @@ class GLJListModel extends BaseModel {
                 };
                 gljInsertData.push(gljData);
             }
-            let basePrice = scMathUtil.roundTo(tmp.basePrice,-6);
+            let basePrice = tmp.basePrice;
+            //只有标准的工料机的组成物才会有多单价、多组成物消耗量的情况 fromTable
+            if(fromTable == 'std' && ext && ext.priceField &&( tmp.priceProperty[ext.priceField]!= undefined && tmp.priceProperty[ext.priceField]!=null)){
+                basePrice = tmp.priceProperty[ext.priceField];
+            }
+            basePrice = scMathUtil.roundTo(basePrice,-6);
+
             // 单价文件插入的数据
             let unitPriceData = {
                 base_price: basePrice,
@@ -630,8 +641,6 @@ class GLJListModel extends BaseModel {
         if(unitPriceInsertData.length >0) await unitPriceModel.add(unitPriceInsertData);
        //插入项目工料机
         if(gljInsertData.length > 0) await this.add(gljInsertData);
-
-
         return
     }
 

+ 2 - 2
modules/main/controllers/bills_controller.js

@@ -234,11 +234,10 @@ module.exports = {
                 }
                 let importData = JSON.parse(LZString.decompressFromUTF16(compressData));
                 //匹配的清单库
-                let stdDateA = +new Date();
                 const billsLibId = fields.billsLibId !== undefined && fields.billsLibId.length > 0 && fields.billsLibId[0]? parseInt(fields.billsLibId[0]) : null;
                 let stdBills = [], stdJobs = [], stdCharacters = [];
                 if(billsLibId){
-                    stdBills = await stdBillsModel.find({billsLibId: billsLibId, deleted: false}, '-_id code jobs items engineering billsLibId');
+                    stdBills = await stdBillsModel.find({billsLibId: billsLibId, deleted: false}, '-_id code jobs items engineering billsLibId ruleText');
                     stdJobs = await stdBillJobsModel.find({billsLibId: billsLibId, deleted: false});
                     stdCharacters = await stdBillCharacterModel.find({billsLibId: billsLibId, deleted: false});
                 }
@@ -350,6 +349,7 @@ function parseToCompleteBills(excelBills, fixedBills, stdData){
                     isMatch = true;
                     excelBill.programID = stdBill.engineering ? stdBill.engineering : null;
                     excelBill.billsLibId = stdBill.billsLibId ? stdBill.billsLibId : null;
+                    excelBill.ruleText = stdBill.ruleText ? stdBill.ruleText : '';
                     //set jobContent and itemCharacter
                     let tempJob = [], tempCharacter = [];
                     for(let billJob of stdBill.jobs){

+ 11 - 1
modules/main/controllers/ration_controller.js

@@ -9,7 +9,7 @@ let controller = {
     insertGLJAsRation:async function (req){
         let data = req.body.data;
         data = JSON.parse(data);
-        return await ration_glj_facade.insertGLJAsRation(data);
+        return await ration_glj_facade.insertGLJAsRation(data,req.session.sessionCompilation);
     },
     replaceRations:async function (req) {
         let data = req.body.data;
@@ -37,6 +37,16 @@ let controller = {
         let data = req.body.data;
         data = JSON.parse(data);
         return await ration_facade.getSameSectionRations(data,req.session.sessionUser.id, req.session.sessionCompilation._id);
+    },
+    //取定额默认的取费专业
+    getDefaultProgramID:async function(req){
+        let data = req.body.data;
+        data = JSON.parse(data);
+        data.userID = req.session.sessionUser.id;
+        data.compilationId = req.session.sessionCompilation._id;
+        return await ration_facade.getDefaultProgramID(data);
+
+
     }
 };
 

+ 53 - 8
modules/main/facade/ration_facade.js

@@ -30,7 +30,9 @@ module.exports = {
     replaceRations: replaceRations,
     addNewRation:addNewRation,
     addMultiRation: addMultiRation,
-    getSameSectionRations:getSameSectionRations
+    getSameSectionRations:getSameSectionRations,
+    getExtendData:getExtendData,
+    getDefaultProgramID:getDefaultProgramID
 };
 async function addNewRation(data,compilation) {
     let query = data.itemQuery;
@@ -166,6 +168,18 @@ async function replaceRations(userID,data,compilation) {
     return recodes;
 }
 
+async function getDefaultProgramID(data) {
+    let searchDao = new SearchDao();
+    let programID;
+    let std = await searchDao.getRationItem(data.userID,data.compilationId,[data.libID],data.code, null);
+    if(std.feeType == undefined || std.feeType == null || std.feeType ==''){//定额取费专业为空的情况下,取项目属性中的定额取费专业ID
+        programID = await getProgramForProject(data.projectID);
+    }else {
+        programID = std.feeType;
+    }
+    return programID;
+}
+
 async function replaceRation(nodeInfo,stdRation,defaultLibID,projectID,calQuantity,compilation) {
     if(nodeInfo.newCode == null||nodeInfo.newCode ==""){//说明是删除编号,则要变成一条空定额
         await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
@@ -181,7 +195,7 @@ async function replaceRation(nodeInfo,stdRation,defaultLibID,projectID,calQuanti
 
 async function addRationSubList(stdRation,newRation,needInstall,compilation) {
     let startTime = +new Date();
-    let ration_gljs = await addRationGLJ(stdRation,newRation);
+    let ration_gljs = await addRationGLJ(stdRation,newRation,compilation);
     let addRationGLJTime = +new Date();
     console.log("添加定额工料机时间-----"+(addRationGLJTime - startTime));
     let ration_coes = await addRationCoe(stdRation,newRation,compilation);
@@ -310,13 +324,38 @@ async function getCustomerCoe(projectID,rationID,seq,compilation){//取自定义
    }
 }
 
+//对于多单价,多组成物消耗量的编办,通过这个方法获取单价、组成物消耗量的字段,
+function getExtendData(property,compilation) {
+    let ext = {};
+    let region = property.region;
+    let taxType = property.taxType;
+    if(compilation.priceProperties && compilation.priceProperties.length > 0){//如果是具有多单价的编办,取单价对应的字段
+          let priceProperty  = _.find(compilation.priceProperties,{region:region,taxModel:parseInt(taxType)});
+          if(priceProperty){
+              ext['priceField'] =  priceProperty.price.dataCode;
+          }
+    }
+    if(compilation.consumeAmtProperties && compilation.consumeAmtProperties.length > 0){
+          let  consumeAmt =   _.find(compilation.consumeAmtProperties,{region:region,taxModel:parseInt(taxType)});
+          if(consumeAmt){
+              ext['quantityField'] =  consumeAmt.consumeAmt.dataCode;
+          }
+    }
+    return _.isEmpty(ext)?null:ext;
+}
+
 
 
-async function addRationGLJ(std,newRation) {
+
+async function addRationGLJ(std,newRation,compilation) {
     let newRationGLJList = [];
     let rationGLJShowList = [];
-    let unitPriceFileId = await projectDao.getUnitPriceFileId(newRation.projectID);
-    let sum=0;
+    let unitPriceFileId = 0;
+    let property = await projectDao.getProjectProperty(newRation.projectID);
+    if(property){
+        unitPriceFileId = property.unitPriceFile !== undefined ? property.unitPriceFile.id : 0;
+    }
+    let ext = getExtendData(property,compilation);
     let first = +new Date();
     if(std.hasOwnProperty('rationGljList') && std.rationGljList.length > 0){
         let stdGLJID =[];//标准工料机ID数组
@@ -350,9 +389,15 @@ async function addRationGLJ(std,newRation) {
                 std_glj = cptGLJMap[sub.gljId];
                 newGLJ.from = 'cpt';
             }else {
-               std_glj = stdGLJMap[sub.gljId];
-               newGLJ.from = 'std';
+                std_glj = stdGLJMap[sub.gljId];
+                newGLJ.from = 'std';
+                //多单价情况处理
+                if(ext && ext.priceField && std_glj && std_glj.priceProperty){
+                    std_glj.basePrice =  std_glj.priceProperty[ext.priceField];
+                }
             }
+            console.log("================================get std glj=============================================");
+            console.log(std_glj);
             let std_gljTime = +new Date();
             if(std_glj){
                 newGLJ.name = std_glj.name;
@@ -370,7 +415,7 @@ async function addRationGLJ(std,newRation) {
                 newGLJ.materialType = std_glj.materialType;
                 newGLJ.materialCoe = std_glj.materialCoe;
                 newGLJ.createType = 'normal';
-                let info = await  ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId);
+                let info =  await  ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
                 newGLJ = ration_glj_facade.createNewRecord(info);
                 newRationGLJList.push(newGLJ);
                 rationGLJShowList.push(info);

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

@@ -14,5 +14,6 @@ module.exports = function (app) {
     rationRouter.post('/addNewRation', rationController.action);
     rationRouter.post('/addMultiRation', rationController.action);
     rationRouter.post('/getSameSectionRations', rationController.action);
+    rationRouter.post('/getDefaultProgramID', rationController.action);
     app.use('/ration', rationRouter);
 };

+ 5 - 68
modules/pm/controllers/pm_controller.js

@@ -253,10 +253,13 @@ module.exports = {
             let usedCompilation = _.find(userData.used_list, function (o) {
                 return o.compilationId === compilationData._id.toString();
             });
+            //第一次使用该费用定额
             if (!usedCompilation) {
                 await userModel.update({_id: mongoose.Types.ObjectId(request.session.sessionUser.id)}, {$push: {used_list: {compilationId: compilationData._id}}});
-                //拷贝模板数据
+                //拷贝补充定额模板数据
                 await sectionTreeDao.copyDataFromTemplate(request.session.sessionUser.id, compilationData._id);
+                //拷贝例题数据
+
             }
         }
         // 清单计价
@@ -537,10 +540,9 @@ module.exports = {
             callback(req, res, 1, err, null);
         }
     },
-    //接收到的分享项目,返回未定义组、已定义组
     receiveProjects: async function(req, res) {
         try {
-            let rst = {grouped: [], ungrouped: []}
+            let rst = {grouped: [], ungrouped: []};
             let userID = req.session.sessionUser.id;
             let receiveProjects = await projectModel.find({
                 $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], compilation: req.session.sessionCompilation._id, 'shareInfo.userID': userID}, '-_id -property');
@@ -583,71 +585,6 @@ module.exports = {
             callback(req, res, 1, err, null);
         }
     },
-    getShareProjects: async function (req, res) {
-        try {
-            let userID = req.session.sessionUser.id;
-            let rst = {receive: [], share: []}//接收的、由我分享的
-            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){
-                proj._doc.shareType = 'shareTo';
-                 for(let shareToUser of proj.shareInfo){
-                     shareToUserIDs.push(shareToUser.userID);
-                 }
-            }
-            shareToUserIDs = Array.from(new Set(shareToUserIDs));
-            let shareToObjIDs = [];
-            for(let userID of shareToUserIDs){
-                shareToObjIDs.push(mongoose.Types.ObjectId(userID));
-            }
-            let shareToUsers = await userModel.find({_id: {$in: shareToObjIDs}});
-            for(let shareToUser of shareToUsers){
-                for(let proj of shareProjects){
-                    for(let user of proj.shareInfo){
-                        if(user.userID === shareToUser._id.toString()){
-                            user._doc.company = shareToUser.company;
-                            user._doc.email = shareToUser.email;
-                            user._doc.name = shareToUser.real_name;
-                            user._doc.mobile = shareToUser.mobile;
-                        }
-                    }
-                }
-            }
-            rst.share = shareProjects;
-            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 = [];
-                for(let proj of receiveProjects){
-                    orgUserIDs.push(proj.userID);
-                }
-                orgUserIDs = Array.from(new Set(orgUserIDs));
-                let userObjIDs = [];
-                for(let uID of orgUserIDs){
-                    userObjIDs.push(mongoose.Types.ObjectId(uID));
-                }
-                let orgUsersInfo = await userModel.find({_id: {$in : userObjIDs}});
-                for(let proj of receiveProjects){
-                    //设置项目类型为来自别人分享
-                    proj._doc.shareType = 'receive';
-                    for(let userData of orgUsersInfo){
-                        if(proj.userID == userData._id.toString()){
-                            let userInfo = {name: userData.real_name, mobile: userData.mobile, company: userData.company, email: userData.email};
-                            proj._doc.userInfo = userInfo;
-                        }
-                    }
-                }
-            }
-            rst.receive = receiveProjects;
-            callback(req, res, 0, 'success', rst);
-        }
-        catch (err){
-            callback(req, res, 1, err, null);
-        }
-    },
     getProjectsByQuery: async function (req, res) {
         try{
             let data = JSON.parse(req.body.data);

+ 9 - 2
modules/pm/facade/pm_facade.js

@@ -51,10 +51,17 @@ module.exports={
     isShare: isShare,
 };
 
-async function copyProject(userID, compilationID,data) {
+//拷贝父级项目
+async function copyParent(){
+
+}
+
+async function copyProject(userID, compilationID,data,newProjectID = null) {
     let projectMap = data.projectMap;
     let originalID = projectMap['copy'].document.ID;
-    let newProjectID = await getCounterID("projects");
+    if (!newProjectID) {
+        newProjectID = await getCounterID("projects");
+    }
     let newFeeName = null,newUnitName = null;
     let calcProgramFileID = uuidV1();//新的计算程序文件ID
     let labourCoeFileID = uuidV1();//新的人工调整系数文件ID

+ 16 - 0
modules/pm/models/project_model.js

@@ -681,6 +681,22 @@ ProjectsDAO.prototype.getUnitPriceFileId = async function (projectId) {
 };
 
 /**
+ * 根据项目id获取项目property信息
+ *
+ * @param {Number} projectId
+ * @return {Promise}
+ */
+ProjectsDAO.prototype.getProjectProperty = async function (projectId) {
+    let result = null;
+    let projectData = await Projects.findOne({ID: projectId},['property']);
+    if (projectData === null) {
+        return result;
+    }
+    return projectData.property;
+};
+
+
+/**
  * 获取当前用户的建设项目数据
  *
  * @paraconsolem {Number} userId

+ 0 - 1
modules/pm/routes/pm_route.js

@@ -56,7 +56,6 @@ module.exports = function (app) {
     //share
     pmRouter.post('/getProjectShareInfo', pmController.projectShareInfo);
     pmRouter.post('/share', pmController.share);
-    pmRouter.post('/getShareProjects', pmController.getShareProjects);
     pmRouter.post('/receiveProjects', pmController.receiveProjects);
 
     app.use('/pm/api', pmRouter);

+ 5 - 3
modules/ration_glj/controllers/ration_glj_controller.js

@@ -49,6 +49,8 @@ async function getGLJData(req, res) {
                 result.error=1;
                 result.message = err.message;
             }else {
+                //多单价字段
+                if(req.session.sessionCompilation.priceProperties) datas.priceProperties = req.session.sessionCompilation.priceProperties;
                 result.datas = datas;
             }
             res.json(result);
@@ -68,7 +70,7 @@ async function addGLJ(req, res){
     try {
         let data = req.body.data;
         data = JSON.parse(data);
-        let datas= await ration_glj_facade.addGLJ(data);
+        let datas= await ration_glj_facade.addGLJ(data,req.session.sessionCompilation);
         result.data=datas;
     }catch (err){
         logger.err(err);
@@ -85,7 +87,7 @@ async function replaceGLJ(req, res){
     try {
         let data = req.body.data;
         data = JSON.parse(data);
-        let rdata= await ration_glj_facade.replaceGLJ(data);
+        let rdata= await ration_glj_facade.replaceGLJ(data,req.session.sessionCompilation);
         result.data=rdata;
     }catch (err){
         logger.err(err);
@@ -102,7 +104,7 @@ async function mReplaceGLJ(req, res){
     try {
         let data = req.body.data;
         data = JSON.parse(data);
-        let mresult= await ration_glj_facade.mReplaceGLJ(data);
+        let mresult= await ration_glj_facade.mReplaceGLJ(data,req.session.sessionCompilation);
         result.data=mresult;
     }catch (err){
         logger.err(err);

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

@@ -26,7 +26,7 @@ import GljDao from "../../complementary_glj_lib/models/gljModel";
 const complementaryGljModel = mongoose.model('complementary_glj_lib');
 const stdGljModel = mongoose.model('std_glj_lib_gljList');
 const gljClassModel = mongoose.model('std_glj_lib_gljClass');
-import  projCounter from '../../main/models/proj_counter_model';
+const projectDao = require('../../pm/models/project_model').project;
 
 module.exports = {
     save: save,
@@ -175,11 +175,11 @@ function createNewRecord(ration_glj) {
     return newRecoed
 }
 
-async function getInfoFromProjectGLJ(ration_glj,unitPriceFileId) {
+async function getInfoFromProjectGLJ(ration_glj,unitPriceFileId,ext) {
     let data = getGLJSearchInfo(ration_glj);
     try {
         let projectGljModel = new GLJListModel();
-        let result = await projectGljModel.addList(data,unitPriceFileId);
+        let result = await projectGljModel.addList(data,unitPriceFileId,ext);
         let typeString = result.type+"";
         ration_glj.marketPrice = result.unit_price.market_price;
         ration_glj.adjustPrice = result.unit_price.base_price;
@@ -590,12 +590,22 @@ function getGLJSearchInfo(ration_glj) {
     return data;
 }
 
+async function prepareExtData(projectID,compilation) {
+    let ext , unitFileId ;
+    let property = await projectDao.getProjectProperty(projectID);
+    ext = projectDao.getExtendData(property,compilation);
+    unitFileId = property.unitPriceFile !== undefined ? property.unitPriceFile.id : 0;
+    return [unitFileId,ext];
+}
+
 
-async function addGLJ(rgList) {
+async function addGLJ(rgList,compilation) {
     let newRecodes = [];
+    if (rgList.length <= 0) return {};
+    let [unitFileId,ext] = await  prepareExtData(rgList[0].projectGLJID,compilation);
     for (let g of rgList) {
         let projectGljModel = new GLJListModel();
-        let result = await projectGljModel.addList(getGLJSearchInfo(g));
+        let result = await projectGljModel.addList(getGLJSearchInfo(g),unitFileId,ext);
         let typeString = result.type+'';
         g.marketPrice = result.unit_price.market_price;
         g.adjustPrice = result.unit_price.base_price;
@@ -625,10 +635,11 @@ async function addGLJ(rgList) {
     return result;
 }
 
-async function replaceGLJ(data) {
+async function replaceGLJ(data,compilation) {
     let rdata = {};
     let projectGljModel = new GLJListModel();
-    let result = await projectGljModel.addList(getGLJSearchInfo(data));
+    let [unitFileId,ext] = await  prepareExtData(data.projectID,compilation);
+    let result = await projectGljModel.addList(getGLJSearchInfo(data),unitFileId,ext);
     let typeString = result.type+'';
     data.projectGLJID = result.id;
 
@@ -653,10 +664,12 @@ async function replaceGLJ(data) {
     rdata.name = stateResult.rationName;
     return rdata;
 }
-async function mReplaceGLJ(data) {
+async function mReplaceGLJ(data,compilation) {
     let mresult = {};
     let projectGljModel = new GLJListModel();
-    let result = await projectGljModel.addList(getGLJSearchInfo(data.doc));
+    let [unitFileId,ext] = await prepareExtData(data.doc.projectID,compilation);
+    //
+    let result = await projectGljModel.addList(getGLJSearchInfo(data.doc),unitFileId,ext);
     let typeString = result.type+'';
     let newDoc = {};
     newDoc.projectGLJID = result.id;
@@ -771,7 +784,7 @@ async function getGLJClass(info, data) {
     return result;
 }
 
-async function insertGLJAsRation(data) {
+async function insertGLJAsRation(data,compilation) {
     let gljList = data.gljList;
     if (data.hasOwnProperty("selectedSerialNo")) { //如果需要,更新序列号。
         let query = {
@@ -781,11 +794,11 @@ async function insertGLJAsRation(data) {
         }
         await ration.update(query, {$inc: {serialNo: gljList.length}}, {multi: true});
     }
-
+    let [unitFileId,ext] = await prepareExtData(data.doc.projectID,compilation);
     for (let glj of gljList) {
         let p_glj = getGLJSearchInfo(glj);
         let projectGljModel = new GLJListModel();
-        let result = await projectGljModel.addList(p_glj);//逐条添加到项目工料机
+        let result = await projectGljModel.addList(p_glj,unitFileId,ext);//逐条添加到项目工料机
         let typeString = result.type+'';
         glj.marketPrice = result.unit_price.market_price;
         glj.adjustPrice = result.unit_price.base_price;

+ 94 - 80
public/web/sheet/sheet_data_helper.js

@@ -30,6 +30,7 @@ var __settingTemp = {
 };
 
 var SheetDataHelper = {
+    enterTime: 0,
     getObjPos: function (obj) {
         let target = obj;
         let pos = {x: obj.offsetLeft, y: obj.offsetTop};
@@ -144,89 +145,18 @@ var SheetDataHelper = {
             };
         };
         TipCellType.prototype.processMouseEnter = function (hitinfo) {
-            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
-            let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
-            if(tag !== undefined && tag){
-                text = tag;
-            }
-            if(sheet && sheet.getParent().qo){
-                setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
-            }
-            if (setting.pos && text && text !== '') {
-                //固定不显示的div,存储文本获取固定div宽度,toolTipElement由于显示和隐藏,获取宽度不正确
-                if(!this._fixedTipElement){
-                    let div = $('#fixedTip')[0];
-                    if (!div) {
-                        div = document.createElement("div");
-                        $(div).css("padding", 5)
-                            .attr("id", 'fixedTip');
-                        $(div).hide();
-                        document.body.insertBefore(div, null);
-                    }
-                    this._fixedTipElement = div;
+            let nowTime = Date.now();
+            SheetDataHelper.enterTime = nowTime;
+            const delayTime = 500;
+            let me = this;
+            setTimeout(function(){
+                if (nowTime - SheetDataHelper.enterTime == 0) {
+                    SheetDataHelper.showTipsDIv.call(me, setting, hitinfo);
                 }
-                $(this._fixedTipElement).width('');
-                $(this._fixedTipElement).html(text);
-                if (!this._toolTipElement) {
-                    let div = $('#autoTip')[0];
-                    if (!div) {
-                        div = document.createElement("div");
-                        $(div).css("position", "absolute")
-                            .css("border", "1px #C0C0C0 solid")
-                            .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
-                            .css("font", "0.9rem Calibri")
-                            .css("background", "Black")
-                            .css("color", "White")
-                            .css("padding", 5)
-                            .attr("id", 'autoTip');
-                        $(div).hide();
-                        document.body.insertBefore(div, null);
-                    }
-                    this._toolTipElement = div;
-                    $(this._toolTipElement).width('');
-                    //实时读取位置信息
-                    if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
-                        setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
-                    }
-                    $(this._toolTipElement).html(text);
-                    //定额库定额特殊处理
-                    if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdSectionRations' ||
-                        $(hitinfo.sheet.getParent().qo).hasClass('main-data-side-search')){
-                        let divWidth = $(this._fixedTipElement).width(),
-                            divHeight = $(this._fixedTipElement).height();
-                        if(divWidth > 600){
-                            divWidth = 590;
-                           $(this._toolTipElement).width(divWidth);
-                        }
-                        let top = setting.pos.y  + hitinfo.y - divHeight < 0 ? 0 :  setting.pos.y + hitinfo.cellRect.y - divHeight;
-                        if(hitinfo.col === 0){
-                            $(this._toolTipElement).css("top", top).css("left", setting.pos.x + hitinfo.cellRect.x - divWidth - 10);
-                        } else{
-                            $(this._toolTipElement).css("top", setting.pos.y + hitinfo.cellRect.y - divHeight - 10).css("left", setting.pos.x + hitinfo.cellRect.x - divWidth);
-                        }
-                    }
-                    else{
-                        $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
-                    }
-                    if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdSectionRations' &&
-                        hitinfo.col === 1){
-                        let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
-                        let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
-                            zoom = hitinfo.sheet.zoom();
-                        let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-                        let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
-                        if(textLength > cellWidth){
-                            $(this._toolTipElement).show("fast");
-                            TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
-                        }
-                    } else {
-                        $(this._toolTipElement).show("fast");
-                        TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
-                    }
-                }
-            }
+            }, delayTime);
         };
         TipCellType.prototype.processMouseLeave = function (hininfo) {
+            SheetDataHelper.enterTime = Date.now();
             TREE_SHEET_HELPER.tipDiv = 'hide';
             if (this._toolTipElement) {
                 $(this._toolTipElement).hide();
@@ -363,5 +293,89 @@ var SheetDataHelper = {
             let selections = sheet.getSelections();
             
         });
+    },
+    showTipsDIv: function(setting, hitinfo){
+        let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+        let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+        let sheet = hitinfo.sheet;
+        if(tag !== undefined && tag){
+            text = tag;
+        }
+        if(sheet && sheet.getParent().qo){
+            setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
+        }
+        if (setting.pos && text && text !== '') {
+            //固定不显示的div,存储文本获取固定div宽度,toolTipElement由于显示和隐藏,获取宽度不正确
+            if(!this._fixedTipElement){
+                let div = $('#fixedTip')[0];
+                if (!div) {
+                    div = document.createElement("div");
+                    $(div).css("padding", 5)
+                        .attr("id", 'fixedTip');
+                    $(div).hide();
+                    document.body.insertBefore(div, null);
+                }
+                this._fixedTipElement = div;
+            }
+            $(this._fixedTipElement).width('');
+            $(this._fixedTipElement).html(text);
+            if (!this._toolTipElement) {
+                let div = $('#autoTip')[0];
+                if (!div) {
+                    div = document.createElement("div");
+                    $(div).css("position", "absolute")
+                        .css("border", "1px #C0C0C0 solid")
+                        .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
+                        .css("font", "0.9rem Calibri")
+                        .css("background", "Black")
+                        .css("color", "White")
+                        .css("padding", 5)
+                        .attr("id", 'autoTip');
+                    $(div).hide();
+                    document.body.insertBefore(div, null);
+                }
+                this._toolTipElement = div;
+                $(this._toolTipElement).width('');
+                //实时读取位置信息
+                if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
+                    setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
+                }
+                $(this._toolTipElement).html(text);
+                //定额库定额特殊处理
+                if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdSectionRations' ||
+                    $(hitinfo.sheet.getParent().qo).hasClass('main-data-side-search')){
+                    let divWidth = $(this._fixedTipElement).width(),
+                        divHeight = $(this._fixedTipElement).height();
+                    if(divWidth > 600){
+                        divWidth = 590;
+                        $(this._toolTipElement).width(divWidth);
+                    }
+                    let top = setting.pos.y  + hitinfo.y - divHeight < 0 ? 0 :  setting.pos.y + hitinfo.cellRect.y - divHeight;
+                    if(hitinfo.col === 0){
+                        $(this._toolTipElement).css("top", top).css("left", setting.pos.x + hitinfo.cellRect.x - divWidth - 10);
+                    } else{
+                        $(this._toolTipElement).css("top", setting.pos.y + hitinfo.cellRect.y - divHeight - 10).css("left", setting.pos.x + hitinfo.cellRect.x - divWidth);
+                    }
+                }
+                else{
+                    $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
+                }
+                if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdSectionRations' &&
+                    hitinfo.col === 1){
+                    let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
+                    let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
+                        zoom = hitinfo.sheet.zoom();
+                    let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
+                    let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
+                    if(textLength > cellWidth){
+                        $(this._toolTipElement).show("fast");
+                        TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+                    }
+                } else {
+                    $(this._toolTipElement).show("fast");
+                    TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+                }
+            }
+        }
     }
 };

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

@@ -425,9 +425,6 @@ var TREE_SHEET_HELPER = {
             if (isRationNode&& options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()) {
                 sheetCommonObj.drowTriangle(ctx,x+w-12,y+h/2+2);
             }
-            if (sheet.name() === 'stdRationLib_chapter') {
-                console.log(rationLibObj.hasExplanationRuleText(options.row));
-            }
             //定额库章节树问号
             if(sheet.name() === 'stdRationLib_chapter' && this.enterCell && options.row === this.enterCell.row
                 && typeof rationLibObj !== 'undefined' && rationLibObj.hasExplanationRuleText(options.row)){

BIN
web/building_saas/css/animated_favicon1.gif


BIN
web/building_saas/css/favicon.ico


BIN
web/building_saas/css/logo.png


+ 6 - 6
web/building_saas/main/html/main.html

@@ -143,7 +143,7 @@
                           <div class="bottom-content">
                               <ul class="nav nav-tabs" role="tablist">
                                   <li class="nav-item" id="GLJ_div">
-                                      <a class="nav-link active" id="linkGLJ" data-toggle="tab" href="#subSpread" role="tab">人材机</a>
+                                      <a class="nav-link sub-item active" id="linkGLJ" data-toggle="tab" href="#subSpread" role="tab">人材机</a>
                                   </li>
                               <!--    <li class="nav-item">
                                       <a class="nav-link" id="linkFZTJ" data-toggle="tab" href="#subSpread" role="tab">附注条件</a>
@@ -152,22 +152,22 @@
                                       <a class="nav-link" id="linkFZDE" data-toggle="tab" href="#subSpread" role="tab">辅助定额</a>
                                   </li>-->
                                   <li class="nav-item" id = "ZMHS_div">
-                                      <a class="nav-link" id="linkZMHS" data-toggle="tab" href="#subSpread" role="tab">子目换算</a>
+                                      <a class="nav-link sub-item" id="linkZMHS" data-toggle="tab" href="#subSpread" role="tab">子目换算</a>
                                   </li>
                                   <li class="nav-item" id="AZZJF_div" style="display: none">
-                                      <a class="nav-link" id="linkAZZJF" data-toggle="tab" href="#subSpread" role="tab">安装增加费</a>
+                                      <a class="nav-link sub-item" id="linkAZZJF" data-toggle="tab" href="#subSpread" role="tab">安装增加费</a>
                                   </li>
                                   <li class="nav-item">
-                                      <a class="nav-link" id="linkGCLMX" data-toggle="tab" href="#subSpread" role="tab">工程量明细</a>
+                                      <a class="nav-link sub-item" id="linkGCLMX" data-toggle="tab" href="#subSpread" role="tab">工程量明细</a>
                                   </li>
                                   <li class="nav-item">
-                                      <a class="nav-link" id="linkJSCX" data-toggle="tab" href="#subSpread" role="tab">计算程序</a>
+                                      <a class="nav-link sub-item" id="linkJSCX" data-toggle="tab" href="#subSpread" role="tab">计算程序</a>
                                   </li>
                                  <!-- <li class="nav-item">   2018-11-08  新需求,隐藏说明信息
                                       <a class="nav-link" data-toggle="tab" href="#comments" role="tab" id="linkComments">说明信息</a>
                                   </li>-->
                                   <li class="nav-item" id = "TZJNR_div">
-                                      <a class="nav-link" id="linkTZJNR" data-toggle="tab" href="#subSpread" role="tab">特征及内容</a>
+                                      <a class="nav-link sub-item" id="linkTZJNR" data-toggle="tab" href="#subSpread" role="tab">特征及内容</a>
                                   </li>
                               </ul>
                               <!-- Tab panes -->

+ 3 - 2
web/building_saas/main/js/models/calc_base.js

@@ -1521,7 +1521,8 @@ let cbParser = {
         //暂估材料费特殊处理:CN(CN)
         let isZG = false;
         for(let i = 0, len = temp.length; i < len; i++){
-            if(temp[i] !== '' && rst.indexOf(temp[i]) === -1){
+            if(temp[i] !== ''){
+            //if(temp[i] !== '' && rst.indexOf(temp[i]) === -1){
                 if(temp[i] === '暂估材料费'){//处理暂估材料基数
                     isZG = true;
                     continue;
@@ -1632,7 +1633,7 @@ let cbParser = {
             return '$CBC.base(\'NONE\')';
         }
         //基数
-        let strs = this.getFigure(v);
+        let strs = _.uniq(this.getFigure(v));
         let exps = [];
         for(let i = 0, len = strs.length; i < len; i++){
             let exp = Object.create(null);

+ 18 - 14
web/building_saas/main/js/models/calc_program.js

@@ -603,7 +603,7 @@ let calcTools = {
         }
         return result;
     },
-    partASupplyFee: function (treeNode, baseName, isTender) {
+    partASupplyFee: function (treeNode, baseName, isTender, isRationPirce = true) {
         if (!treeNode.data.gljList) return 0;
         let projectGLJ = projectObj.project.projectGLJ;
 
@@ -643,6 +643,7 @@ let calcTools = {
                 if(supply.code == composition.code && supply.name == composition.name && supply.unit == composition.unit &&
                     supply.specs == composition.specs && supply.type == composition.type ){
                     composition.basePrice = supply.unit_price.base_price;
+                    composition.marketPrice = supply.unit_price.market_price;
                     composition.supply = supply.supply;
                     composition.supplyX = 1;
                     if (composition.supply == supplyType.BFJG){
@@ -657,7 +658,7 @@ let calcTools = {
 
         let sum = 0;
         for (let glj of treeNode.data.gljList){
-            let gljQ;
+            let gljQ, gljP;
             if (isTender){
                 calcTools.calcGLJTenderQty(treeNode, glj);
                 gljQ = glj.tenderQuantity;
@@ -665,6 +666,8 @@ let calcTools = {
             else
                 gljQ = glj.quantity;
 
+            gljP = isRationPirce ? glj.basePrice : glj.marketPrice;
+
             let X = 1;    // 部分甲供系数(默认1,即完全甲供)
             let tempSGLJ = supplyGLJsIdx[glj.projectGLJID];
             // 当前材料是甲供材料:①普通 ②商品硂等不计组成物的母体材料
@@ -676,7 +679,7 @@ let calcTools = {
                     Q = Q ? Q : 1;
                     X = tempSGLJ.supply_quantity / Q;
                 }
-                sum = (sum + glj.basePrice * gljQ * X).toDecimal(decimalObj.process);
+                sum = (sum + gljP * gljQ * X).toDecimal(decimalObj.process);
             }
             else{   // 当前材料不是甲供材料
                 if (compT.includes(glj.type)) {   // 混凝土等。组成物的母体,母体如果有组成物,则母体无法作为甲供材料,无法设置,此时要看其组成物是否是甲供材料;母体如果没有组成物,则母体有可能成为甲供材料。
@@ -689,7 +692,8 @@ let calcTools = {
                                 if (baseName.includes('甲供') && (c.supply == supplyType.BFJG)){
                                     X = c.supplyX;
                                 };
-                                sum = (sum + c.basePrice * c.consumption * gljQ * X).toDecimal(decimalObj.process);
+                                let cP = isRationPirce ? c.basePrice : c.marketPrice;
+                                sum = (sum + cP * c.consumption * gljQ * X).toDecimal(decimalObj.process);
                             }
                         }
                     };
@@ -921,7 +925,7 @@ let rationCalcBasesNameKinds = {
     RGF:        ['定额基价人工费', '定额人工费'],
     CLF:        ['定额基价材料费', '定额材料费'],
     QTCLF:      ['定额其他材料费'],
-    JXF:        ['定额基价机械费', '定额施工机具使用费'],
+    JXF:        ['定额基价机械费', '定额机械费', '定额施工机具使用费'],
     JSRGF:      ['定额基价机上人工费'],
     ZCF:        ['主材费'],
     SBF:        ['设备费'],
@@ -934,21 +938,21 @@ let rationCalcBasesNameKinds = {
     JC_ZCF:     ['主材费价差'],
     JC_SBF:     ['设备费价差'],
 
-    JG_RGF:     ['甲供定额基价人工费', '甲供定额人工费'],
-    JG_CLF:     ['甲供定额基价材料费', '甲供定额材料费'],
-    JG_JXF:     ['甲供定额基价机械费', '甲供定额施工机具费'],
+    JG_RGF:     ['甲供定额基价人工费', '甲供定额人工费', '甲供人工费'],
+    JG_CLF:     ['甲供定额基价材料费', '甲供定额材料费', '甲供材料费'],
+    JG_JXF:     ['甲供定额基价机械费', '甲供定额机械费', '甲供机械费', '甲供定额施工机具费'],
     JG_ZCF:     ['甲供主材费'],
     JG_SBF:     ['甲供设备费'],
 
-    JD_RGF:     ['甲定定额基价人工费', '甲定定额人工费'],
-    JD_CLF:     ['甲定定额基价材料费', '甲定定额材料费'],
-    JD_JXF:     ['甲定定额基价机械费', '甲定定额施工机具费'],
+    JD_RGF:     ['甲定定额基价人工费', '甲定定额人工费', '甲定人工费'],
+    JD_CLF:     ['甲定定额基价材料费', '甲定定额材料费', '甲定材料费'],
+    JD_JXF:     ['甲定定额基价机械费', '甲定定额机械费', '甲定机械费', '甲定定额施工机具费'],
     JD_ZCF:     ['甲定主材费'],
     JD_SBF:     ['甲定设备费'],
 
-    FB_RGF:     ['分包定额基价人工费'],
-    FB_CLF:     ['分包定额基价材料费'],
-    FB_JXF:     ['分包定额基价机械费'],
+    FB_RGF:     ['分包定额基价人工费', '分包人工费'],
+    FB_CLF:     ['分包定额基价材料费', '分包材料费'],
+    FB_JXF:     ['分包定额基价机械费', '分包机械费'],
     FB_ZCF:     ['分包主材费'],
     FB_SBF:     ['分包设备费'],
     FB_RGGR:    ['分包人工工日']

+ 1 - 1
web/building_saas/main/js/models/main_consts.js

@@ -257,7 +257,7 @@ const billText = {
     5:'补项'
 };
 
-const cpFeeTypes = [
+let cpFeeTypes = [
     {type: 'direct', name: '直接费'},
     {type: 'labour', name: '人工费'},
     {type: 'material', name: '材料费'},

+ 21 - 0
web/building_saas/main/js/models/project.js

@@ -406,6 +406,27 @@ var PROJECT = {
                 }
             })
         };
+
+        project.prototype.updateEvalproject = function (evalProject,data,callback){
+            let programID = null;
+            if(evalProject ==1){
+                programID =  this.calcProgram.compiledTemplateMaps["估价项目"];
+                callback(programID)
+            }else {//如果evalProject==0,则是去掉勾选估价项目选项,需要获取定额默认的取费专业。
+                let libID = data.from == 'cpt'?"compleRationLib":data.libID;
+                let query = {code:data.code,projectID:data.projectID,libID:libID};
+                CommonAjax.post("/ration/getDefaultProgramID",query,function (result) {
+                    if(callback){
+                        callback(result);
+                    }
+                })
+
+
+
+            }
+
+        };
+
         //判断项目是否安装工程
         project.prototype.isInstall = function () {
             return projectInfoObj.projectInfo.property.isInstall?true:false;//如果是undefinded 就也返回false

+ 12 - 1
web/building_saas/main/js/models/ration_glj.js

@@ -494,8 +494,19 @@ let ration_glj = {
            return node
         };
         ration_glj.prototype.getGLJData = function (cb) {
-            let engineerID = projectInfoObj.projectInfo.property.engineering_id;
+            let property = projectInfoObj.projectInfo.property;
+            let engineerID = property.engineering_id;
             CommonAjax.get('/rationGlj/getGLJData/'+engineerID, function (data) {
+                //编办中有多单价设置
+                if(data.datas.priceProperties && data.datas.priceProperties.length > 0){
+                     let tem = _.find(data.datas.priceProperties,{region:property.region,taxModel:parseInt(property.taxType)});
+                     if(tem){
+                         let dataCode = tem.price.dataCode;
+                         for(let glj of data.datas.stdGLJ){
+                             if(glj.priceProperty && gljUtil.isDef(glj.priceProperty[dataCode])) glj.basePrice = glj.priceProperty[dataCode];
+                         }
+                     }
+                };
                 cb(data);
             })
         };

+ 15 - 4
web/building_saas/main/js/views/main_tree_col.js

@@ -90,11 +90,16 @@ let MainTreeCol = {
             return false;
         },
         calcProgramName: function (node) {
-            if (
-                node.sourceType === projectObj.project.Ration.getSourceType() ||
+            if (node.sourceType === projectObj.project.Ration.getSourceType() ||
                 (calcTools.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
-            ) return false
-            else return true;
+            ) {
+                //当打勾估价项目选项后,该定额取费专业只读
+                if(node.data.evaluationProject == 1){
+                    return true;
+                }
+                return false;
+            }
+            return true;
         },
         non_editSubType: function (node) {
             return node.data.subType != 201 && node.data.subType != 4 && node.data.subType != 5
@@ -325,6 +330,12 @@ let MainTreeCol = {
                 return new GC.Spread.Sheets.CellTypes.CheckBox();
             }
         },
+        evaluationProject:function (node) {
+            if(node.sourceType == ModuleNames.ration){
+                return new GC.Spread.Sheets.CellTypes.CheckBox();
+            }
+
+        },
         commonTotalFee: function () {
             return projectObj.getCommonTotalFeeCellType();
         }

+ 1 - 15
web/building_saas/main/js/views/project_info.js

@@ -6,21 +6,7 @@ var projectInfoObj = {
     projectInfo: null,
     getFullPathHtml: function (proj) {
         let fullPath = [], i, pm = '<span class="text-truncate"><a href="/pm">项目管理</a></span>', angleRight = '<span class="text-truncate"><i class="fa fa-angle-right fa-fw"></i></span>';
-        // fullPath.push(pm);
         if (proj) {
-            /*
-            for (i = 0; i < proj.fullFolder.length; i++) {
-                if (i <= proj.fullFolder.length - 3) {
-                    fullPath.push(angleRight, '<span class="text-truncate" data-toggle="tooltip" data-placement="bottom" title="', proj.fullFolder[i], '"><i class="fa fa-folder-open-o"></i></span>');
-                } else if (i === proj.fullFolder.length - 2) {
-                    // 屏蔽原有代码 不显示中间内容
-                    // fullPath.push(angleRight, '<span class="text-truncate" data-toggle="tooltip" data-placement="bottom" title="' + proj.fullFolder[i] + '"><i class="fa fa-cubes"></i>' + proj.fullFolder[i] + '</span>');
-                } else if (i === proj.fullFolder.length - 1) {
-                    // 屏蔽原有代码 不显示中间内容
-                    // fullPath.push(angleRight, '<span class="text-truncate" data-toggle="tooltip" data-placement="bottom" title="' + proj.fullFolder[i] + '"><i class="fa fa-cube"></i>' + proj.fullFolder[i] + '</span>');
-                }
-            }
-             */
             let pathArr = proj.fullPath;
             let engName = pathArr[pathArr.length -2] || '',
                 projectName = pathArr[pathArr.length -3] || '',
@@ -32,7 +18,7 @@ var projectInfoObj = {
                 <span data-toggle="tooltip" data-placement="bottom" data-original-title="${engName}"><i class="fa fa-cube"></i>...</span>
                 <span class="text-muted px-1">\</span>
                  <span><i class="fa fa-sticky-note-o"></i></span>
-                <span class="text-truncate float-right"  data-toggle="tooltip" data-placement="bottom" data-original-title="${proj.name}">&nbsp;${proj.name}</span>`;
+                <span class="text-truncate"  data-toggle="tooltip" data-placement="bottom" data-original-title="${proj.name}">&nbsp;${proj.name}</span>`;
             fullPath.push(newHtml);
 
         }

+ 21 - 3
web/building_saas/main/js/views/project_view.js

@@ -22,6 +22,7 @@ var projectObj = {
     treeSelectedChanged: function (node) {
         let project = projectObj.project;
         let mainSheet = projectObj.mainController.sheet;
+        let init = true;
         //设置选中行底色和恢复前选中行底色
         let refreshNodes = [node];
         if(!project.mainTree.preSelected){
@@ -29,6 +30,7 @@ var projectObj = {
         }
         else {
             refreshNodes.push(project.mainTree.preSelected);
+            init = !(project.mainTree.preSelected == node)
         }
         project.mainTree.preSelected = node;
         projectObj.setNodesStyle(projectObj.mainController.sheet, refreshNodes);
@@ -36,9 +38,12 @@ var projectObj = {
             subViewObj.loadComments(node);
         }
         gljOprObj.mainTreeSelectedChange = gljOprObj.selectedNodeId != node.getID();
-        gljOprObj.showDataIfRationSelect(node);
+        if(init) subObj.initNavItem(node);
+       /*
+       2018-11-9 在NavItem里设置了默认显示的item,在里执行了click这个操作所以这两个操作不用重复执行了
+       gljOprObj.showDataIfRationSelect(node);
         if (activeSubSheetIsCalcProgram())
-            calcProgramObj.refreshCalcProgram(node, 3);
+            calcProgramObj.refreshCalcProgram(node, 3);*/
 
         //zhong 2017-9-1 特征及内容
         if(pageCCOprObj.active){
@@ -971,7 +976,6 @@ var projectObj = {
                 console.log("加载完成-----"+endTime);
                 console.log(`时间——${endTime - startTime}`);
                 that.project.projectMarkChecking();//是否需要重新进行造价计算
-                installationFeeObj.engineeringTypeChecking();//检查是否安装工程
                 autoFlashHeight();
                 projectObj.refreshMainSpread();
                 //定位到会话中的选项
@@ -1574,8 +1578,22 @@ var projectObj = {
             projectObj.onSubcontractClick(node);
         }else if(fieldName == "isEstimate"){
             projectObj.onIsEstimateClick(node,info);
+        }else if(fieldName == "evaluationProject"){
+            projectObj.onEvaluationProjectClic(node,info);
         }
+
     },
+    onEvaluationProjectClic:function (node,info) {
+        let checkboxValue = info.sheet.getCell(info.row, info.col).value();
+        let newval = checkboxValue?0:1;
+        projectObj.project.updateEvalproject(newval,node.data,function (programID) {
+            node.data.evaluationProject = newval;
+            node.data.programID = programID;
+            node.changed=true;
+            projectObj.project.calcProgram.calcAndSave(node);
+        })
+    },
+
     onIsEstimateClick: function(node,info){
         let checkboxValue = info.sheet.getCell(info.row, info.col).value();
         let cell = info.sheet.getCell(info.row, info.col), newval = 0;

+ 23 - 4
web/building_saas/main/js/views/sub_view.js

@@ -60,11 +60,26 @@ let subObj = {
     },
     initNavItem:function (node) {
      /*   1、造价书选中行类别是“大项费用”、“分部”、“分项”、“清单”时,显示按钮“工程量明细”、“计算程序”、“特征及内容”,默认打开“计算程序”。
-          2、选中行类别是“定额”、“量价”、“人材机”时,显示按钮“人材机”、“子目换算”、“工程量明细”、“计算程序”,默认打开“人材机”。
+          2、选中行类别是“定额”、“量价”、“人材机”时,显示按钮“人材机”、“子目换算”、“工程量明细”、“计算程序”、“安装增加费”,默认打开“人材机”。
      */
-
-
-
+        $('.sub-item').removeClass('active');
+        if(node.sourceType == ModuleNames.ration){
+            //GLJ_div //ZMHS_div
+            $("#GLJ_div").show();
+            $("#ZMHS_div").show();
+            installationFeeObj.engineeringTypeChecking();//检查是否安装工程
+            $("#TZJNR_div").hide();
+            $("#linkGLJ").addClass();
+            $("#linkGLJ").click();
+
+        }else {
+            $("#GLJ_div").hide();
+            $("#ZMHS_div").hide();
+            $("#AZZJF_div").hide();
+            $("#TZJNR_div").show();
+            $("#linkJSCX").click();
+        }
+        projectObj.mainSpread.focus();
     }
 };
 
@@ -84,6 +99,8 @@ $("#linkGLJ").click(function(){
 
 
 
+
+
 $("#linkAZZJF").click(function(){
     $("#subItems").children().hide();
     MaterialController.hideReplaceDiv();
@@ -121,6 +138,8 @@ $("#linkJSCX").click(function(){        // 计算程序
     gljOprObj.activeTab='#linkJSCX';
 });
 
+
+
 $("#linkZMHS").click(function(){        // 子目换算
     $("#subItems").children().hide();
     $("#tabZMHS").show();

+ 20 - 8
web/building_saas/pm/js/pm_newMain.js

@@ -798,7 +798,7 @@ const projTreeObj = {
             x = x + (node.depth() + 1) * indent +  node.depth() * levelIndent + imgWidth + 3;
             w = w - (node.depth() + 1) * indent - node.depth() * levelIndent - imgWidth - 3;
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-            if (node.data.shareInfo.length > 0) {
+            if (node.data.shareInfo && node.data.shareInfo.length > 0) {
                 let nowX = Math.floor(x) + w - 20;
                 let nowY = Math.floor((y + (y + h)) / 2);
                 ctx.drawImage(shareImg, nowX + 3, nowY - 7, shareImgWidth,shareImgHeight);
@@ -2503,7 +2503,7 @@ function AddTender() {
         };
         let selectedItem = projTreeObj.tree.selected;
         //地区
-        let region = $('#regionDiv').find('select').val() || '';
+        let region = $('#regionDiv').find('select').val() || '全省';
         let tenderInfo = {
             valuation: valuation,
             valuationType: valuationType,
@@ -3384,7 +3384,7 @@ function setUsersShareDiv(projName, users) {
     let $users = $('#shareUsers');
     //三行后限制死高度
     if (Math.ceil(users.length / perLineCount) > 2) {
-        $users.height(164);
+        $users.height(180);
     } else {
         $users.height('');
     }
@@ -3395,7 +3395,7 @@ function setUsersShareDiv(projName, users) {
         $preH4 = null;
     for (let i = 0; i < users.length; i++) {
         let user = users[i];
-        let $span = $(`<span class="badge badge-light mr-3">${user.name}(${user.phone})</span>`),
+        let $span = $(`<span class="badge badge-light mr-3" style="padding: 0">${user.name}(${user.phone})</span>`),
             $a = $(`<a href="javascript:void(0);" userID="${user.userID}" class="text-danger" title="移除分享"></a>`),
             $i = $('<i class="fa fa-remove"></i>');
         bindRemoveShare($a);
@@ -3431,7 +3431,6 @@ function setUsersShareDiv(projName, users) {
             if (shareUsers.length === 0) {
                 $('#shareUsers').hide();
             }
-            console.log(shareUsers);
         });
     }
 
@@ -3441,6 +3440,10 @@ $('#addShareUser').click(function () {
     //输入有效手机号的用户
     if (shareUserID) {
         const hintInfo = $('#share-info');
+        if (_.find(shareUsers, {userID: shareUserID})) {
+            setDangerInfo(hintInfo, '已添加此用户');
+            return;
+        }
         let allowCopy = $('#allowCopy').prop('checked'),
             name = $('#user_name').text(),
             phone = $('#user_mobile').text();
@@ -3456,8 +3459,10 @@ $('#addShareUser').click(function () {
         $('#sharePhone').focus();
         shareUserID = null;
     }
-    console.log(`shareUsers`);
-    console.log(shareUsers);
+});
+$('#share').on('hidden.bs.modal', function () {
+    $('#shareUsers').hide();
+    shareUsers = []
 });
 //确认分享
 $('#share-confirm').click(function(){
@@ -3477,7 +3482,14 @@ $('#share-confirm').click(function(){
     //分享
     CommonAjax.post('/pm/api/share', {user_id: userID, type: shareType.create,  projectID: shareSeleted.data.ID, shareData: shareData}, function (rstData) {
         //更新缓存
-        shareSeleted.data.shareInfo = shareSeleted.data.shareInfo.concat(shareData);
+        if (shareSeleted.data.shareInfo.length === 0) {
+            shareSeleted.data.shareInfo = shareSeleted.data.shareInfo.concat(shareData);
+            let sheet = projTreeObj.workBook.getSheet(0);
+            projTreeObj.renderSheetFuc(sheet, function () {
+                sheet.invalidateLayout();
+                sheet.repaint();
+            });
+        }
         $.bootstrapLoading.end();
         $('#share-confirm').removeClass('disabled');
         $('#share').modal('hide');

BIN
web/dest/css/logo.png


+ 455 - 0
web/over_write/js/jiangxi_2017.js

@@ -0,0 +1,455 @@
+/**
+ * Created by CSL on 2018/11/12.  江西计算程序、基数 等覆盖。
+ */
+
+let isJX2017 = true;
+
+// 一般计税取不含税市场价、不含税定额价。简易计税取含税市场价、含税定额价。打开项目时,4个价格根据计税类型只载入其二,所以这里可不作区分。
+function overwriteRationCalcBases (taxType){
+    if (typeof rationCalcBases == 'undefined') return;
+    for (let key in rationCalcBases) delete rationCalcBases[key];
+    // let isJY = taxType == '2';
+
+    rationCalcBases['人工费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['定额人工费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['材料费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['机械费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['定额机械费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['主材费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.MAIN_MATERIAL], priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['设备费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['人工费价差'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptDiffPrice, isTender);
+    };
+    rationCalcBases['材料费价差'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptDiffPrice, isTender);
+    };
+    rationCalcBases['机械费价差'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptDiffPrice, isTender);
+    };
+    rationCalcBases['主材费价差'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.MAIN_MATERIAL], priceTypes.ptDiffPrice, isTender);
+    };
+    rationCalcBases['设备费价差'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptDiffPrice, isTender);
+    };
+    rationCalcBases['人工工日'] = function (node, isTender) {
+        return calcTools.labourDays(node, isTender);
+    };
+    rationCalcBases['甲供人工费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲供人工费', isTender, false);
+    };
+    rationCalcBases['甲供材料费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲供材料费', isTender, false);
+    };
+    rationCalcBases['甲供机械费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲供机械费', isTender, false);
+    };
+    rationCalcBases['甲供主材费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲供主材费', isTender, false);
+    };
+    rationCalcBases['甲供设备费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲供设备费', isTender, false);
+    };
+    rationCalcBases['甲定人工费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲定人工费', isTender, false);
+    };
+    rationCalcBases['甲定材料费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲定材料费', isTender, false);
+    };
+    rationCalcBases['甲定机械费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲定机械费', isTender, false);
+    };
+    rationCalcBases['甲定主材费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲定主材费', isTender, false);
+    };
+    rationCalcBases['甲定设备费'] = function (node, isTender) {
+        return calcTools.partASupplyFee(node, '甲定设备费', isTender, false);
+    };
+    rationCalcBases['暂估材料费'] = function (node, isTender) {
+        return calcTools.estimateFee(node, true, isTender);
+    };
+    rationCalcBases['分包人工费'] = function (node, isTender) {
+        if (node.data.isSubcontract)
+            return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptMarketPrice, isTender)
+        else
+            return 0;
+    };
+    rationCalcBases['分包材料费'] = function (node, isTender) {
+        if (node.data.isSubcontract)
+            return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptMarketPrice, isTender)
+        else
+            return 0;
+    };
+    rationCalcBases['分包机械费'] = function (node, isTender) {
+        if (node.data.isSubcontract)
+            return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptMarketPrice, isTender)
+        else
+            return 0;
+    };
+    rationCalcBases['分包主材费'] = function (node, isTender) {
+        if (node.data.isSubcontract)
+            return calcTools.rationBaseFee(node, [gljType.MAIN_MATERIAL], priceTypes.ptMarketPrice, isTender)
+        else
+            return 0;
+    };
+    rationCalcBases['分包设备费'] = function (node, isTender) {
+        if (node.data.isSubcontract)
+            return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptMarketPrice, isTender)
+        else
+            return 0;
+    };
+    rationCalcBases['分包人工工日'] = function (node, isTender) {
+        if (node.data.isSubcontract)
+            return calcTools.labourDays(node, isTender)
+        else
+            return 0;
+    };
+};
+
+(function overwriteFeeTypes() {
+    if (typeof cpFeeTypes == 'undefined') return;
+    cpFeeTypes = [
+        {type: 'direct', name: '直接费'},
+        {type: 'labour', name: '人工费'},
+        {type: 'marketLabour', name: '市场价人工费'},
+        {type: 'marketMaterial', name: '市场价材料费'},
+        {type: 'machine', name: '机械费'},
+        {type: 'marketMachine', name: '市场价机械费'},
+        {type: 'mainMaterial', name: '主材费'},
+        {type: 'equipment', name: '设备费'},
+        {type: 'manage', name: '企业管理费'},
+        {type: 'surtax', name: '附加税费'},
+        {type: 'profit', name: '利润'},
+        {type: 'safeMeasures', name: '安全文明施工措施费'},
+        {type: 'environment', name: '安全文明环保费'},
+        {type: 'tempFacility', name: '临时设施费'},
+        {type: 'otherTotalMeasures', name: '其他总价措施费'},
+        {type: 'dirtMeasures', name: '扬尘治理措施费'},
+        {type: 'forceFee', name: '规费'},
+        {type: 'tax', name: '税金'},
+        {type: 'common', name: '工程造价'}
+    ];
+})();
+
+
+//清单计算基数相关
+if(typeof baseFigureMap !== 'undefined'){
+    baseFigureMap = {
+        //与清单直接关联=======
+        '分部分项工程费': {base: 'FBFXGCF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项直接费': {base: 'FBFXZJF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项定额人工费': {base: 'FBFXDEJJRGF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项人工费': {base: 'FBFXRGF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项材料费': {base: 'FBFXCLF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项定额机械费': {base: 'FBFXDEJJJXF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项机械费': {base: 'FBFXJXF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项主材费': {base: 'FBFXZCF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项设备费': {base: 'FBFXSBF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '分部分项人工工日': {base: 'FBFXRGGR', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
+        '措施项目费': {base: 'CSXMF', fixedFlag: fixedFlag.MEASURE, class: 'CSXM'},
+        '组织措施项目费': {base: 'ZZCSXMF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
+        '组织措施项目人工费': {base: 'ZZCSXMRGF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
+        '组织措施项目材料费': {base: 'ZZCSXMCLF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
+        '组织措施项目机械费': {base: 'ZZCSXMJXF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
+        '技术措施项目费': {base: 'JSCSXMF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目定额人工费': {base: 'JSCSXMDEJJRGF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目人工费': {base: 'JSCSXMRGF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目材料费': {base: 'JSCSXMCLF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目定额机械费': {base: 'JSCSXMDEJJJXF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目机械费': {base: 'JSCSXMJXF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目主材费': {base: 'JSCSXMZCF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目设备费': {base: 'JSCSXMSBF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '技术措施项目人工工日': {base: 'JSCSXMRGGR', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
+        '其他项目费': {base: 'QTXMF',  fixedFlag: fixedFlag.OTHER, class: 'QTXM'},
+        '规费': {base: 'GF', fixedFlag: fixedFlag.CHARGE, class: 'GF'},
+        '税金': {base: 'SJ', fixedFlag: fixedFlag.TAX, class: 'SJ'},
+        //不于清单直接关联==========
+        '建筑面积': {base: 'JZMJ', class: 'FBFX'},
+        '人材机价差': {base: 'RCJJC', class: 'RCJ'},
+        '人工价差': {base: 'RGJC', class: 'RCJ'},
+        '材料价差': {base: 'CLJC', class: 'RCJ'},
+        '机械价差': {base: 'JXJC', class: 'RCJ'},
+        '甲供人工费': {base: 'JGRGF', class: 'RCJ'},
+        '甲供材料费': {base: 'JGCLF', class: 'RCJ'},
+        '甲供机械费': {base: 'JGJXF', class: 'RCJ'},
+        '甲供主材费': {base: 'JGZCF', class: 'RCJ'},
+        '甲供设备费': {base: 'JGSBF', class: 'RCJ'},
+        '甲定人工费': {base: 'JDRGF', class: 'RCJ'},
+        '甲定材料费': {base: 'JDCLF', class: 'RCJ'},
+        '甲定机械费': {base: 'JDJXF', class: 'RCJ'},
+        '甲定主材费': {base: 'JDZCF', class: 'RCJ'},
+        '甲定设备费': {base: 'JDSBF', class: 'RCJ'},
+        '暂估材料费(从子目汇总)': {base: 'ZGCLFFZM', class: 'RCJ'},
+        '分包费': {base: 'FBF', class: 'FBF'},
+        '分包人工费': {base: 'FBRGF', class: 'FBF'},
+        '分包材料费': {base: 'FBCLF', class: 'FBF'},
+        '分包机械费': {base: 'FBJXF', class: 'FBF'},
+        '分包主材费': {base: 'FBZCF', class: 'FBF'},
+        '分包设备费': {base: 'FBSBF', class: 'FBF'},
+        '分包人工工日': {base: 'FBRGGR', class: 'FBF'},
+        '估价项目定额人工费': {base: 'GJXMDERGF', class: 'GJXM'},
+        '估价项目定额机械费': {base: 'GJXMDEJXF', class: 'GJXM'},
+        '估价项目直接费': {base: 'GJXMZJF', class: 'GJXM'},
+        '估价项目人工费': {base: 'GJXMRGF', class: 'GJXM'},
+        '估价项目材料费': {base: 'GJXMCLF', class: 'GJXM'},
+        '估价项目机械费': {base: 'GJXMJXF', class: 'GJXM'},
+        '估价项目主材费': {base: 'GJXMZCF', class: 'GJXM'},
+        '估价项目工日': {base: 'GJXMGR', class: 'GJXM'},
+    };
+}
+if(typeof baseFigureTemplate !== 'undefined'){
+    baseFigureTemplate['FBFXZJF'] =  function (tender) {//分部分项直接费
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.SUB_ENGINERRING])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.SUB_ENGINERRING]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.direct) && cbTools.isDef(bill.feesIndex.direct[totalFeeType]) ? bill.feesIndex.direct[totalFeeType] : 0;
+    };
+    baseFigureTemplate['FBFXRGF'] =  function (tender) {//分部分项人工费(市场人工费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.SUB_ENGINERRING])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.SUB_ENGINERRING]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketLabour) && cbTools.isDef(bill.feesIndex.marketLabour[totalFeeType]) ? bill.feesIndex.marketLabour[totalFeeType] : 0;
+    };
+    baseFigureTemplate['FBFXCLF'] =  function (tender) {//分部分项材料费(市场材料费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.SUB_ENGINERRING])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.SUB_ENGINERRING]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketMaterial) && cbTools.isDef(bill.feesIndex.marketMaterial[totalFeeType]) ? bill.feesIndex.marketMaterial[totalFeeType] : 0;
+    };
+    baseFigureTemplate['FBFXJXF'] =  function (tender) {//分部分项机械费(市场机械费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.SUB_ENGINERRING])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.SUB_ENGINERRING]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketMachine) && cbTools.isDef(bill.feesIndex.marketMachine[totalFeeType]) ? bill.feesIndex.marketMachine[totalFeeType] : 0;
+    };
+    baseFigureTemplate['ZZCSXMRGF'] =  function (tender) {//组织措施项目人工费(市场人工费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.CONSTRUCTION_ORGANIZATION])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.CONSTRUCTION_ORGANIZATION]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketLabour) && cbTools.isDef(bill.feesIndex.marketLabour[totalFeeType]) ? bill.feesIndex.marketLabour[totalFeeType] : 0;
+    };
+    baseFigureTemplate['ZZCSXMCLF'] =  function (tender) {//组织措施项目材料费(市场材料费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.CONSTRUCTION_ORGANIZATION])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.CONSTRUCTION_ORGANIZATION]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketMaterial) && cbTools.isDef(bill.feesIndex.marketMaterial[totalFeeType]) ? bill.feesIndex.marketMaterial[totalFeeType] : 0;
+    };
+    baseFigureTemplate['ZZCSXMJXF'] =  function (tender) {//组织措施项目机械费(市场机械费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.CONSTRUCTION_ORGANIZATION])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.CONSTRUCTION_ORGANIZATION]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketMachine) && cbTools.isDef(bill.feesIndex.marketMachine[totalFeeType]) ? bill.feesIndex.marketMachine[totalFeeType] : 0;
+    };
+    baseFigureTemplate['JSCSXMRGF'] =  function (tender) {//技术措施项目人工费(市场人工费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.CONSTRUCTION_TECH])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.CONSTRUCTION_TECH]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketLabour) && cbTools.isDef(bill.feesIndex.marketLabour[totalFeeType]) ? bill.feesIndex.marketLabour[totalFeeType] : 0;
+    };
+    baseFigureTemplate['JSCSXMCLF'] =  function (tender) {//技术措施项目材料费(市场材料费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.CONSTRUCTION_TECH])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.CONSTRUCTION_TECH]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketMaterial) && cbTools.isDef(bill.feesIndex.marketMaterial[totalFeeType]) ? bill.feesIndex.marketMaterial[totalFeeType] : 0;
+    };
+    baseFigureTemplate['JSCSXMJXF'] =  function (tender) {//技术措施项目机械费(市场机械费)
+        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.CONSTRUCTION_TECH])){
+            return 0;
+        }
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let bill = calcBase.fixedBills[fixedFlag.CONSTRUCTION_TECH]['bill'];
+        if(cbTools.isUnDef(bill)) return 0;
+        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
+        return cbTools.isDef(bill.feesIndex.marketMachine) && cbTools.isDef(bill.feesIndex.marketMachine[totalFeeType]) ? bill.feesIndex.marketMachine[totalFeeType] : 0;
+    };
+    baseFigureTemplate['FBRGF'] =  function (tender) {//分包人工费(市场人工费)
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.isSubcontract && ration.feesIndex && ration.feesIndex.marketLabour){
+                rst = parseFloat(rst + ration.feesIndex.marketLabour[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['FBCLF'] =  function (tender) {//分包材料费(市场材料费)
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.isSubcontract && ration.feesIndex && ration.feesIndex.marketMaterial){
+                rst = parseFloat(rst + ration.feesIndex.marketMaterial[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['FBJXF'] =  function (tender) {//分包机械费(市场机械费)
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.isSubcontract && ration.feesIndex && ration.feesIndex.marketMachine){
+                rst = parseFloat(rst + ration.feesIndex.marketMachine[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMDERGF'] =  function (tender) {//估计项目定额人工费
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.evaluationProject && ration.feesIndex && ration.feesIndex.labour){
+                rst = parseFloat(rst + ration.feesIndex.labour[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMDEJXF'] =  function (tender) {//估计项目定额机械费
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.evaluationProject && ration.feesIndex && ration.feesIndex.machine){
+                rst = parseFloat(rst + ration.feesIndex.machine[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMZJF'] =  function (tender) {//估计项目直接费
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.evaluationProject && ration.feesIndex && ration.feesIndex.direct){
+                rst = parseFloat(rst + ration.feesIndex.direct[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMRGF'] =  function (tender) {//估计项目人工费(市场人工费)
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.evaluationProject && ration.feesIndex && ration.feesIndex.marketLabour){
+                rst = parseFloat(rst + ration.feesIndex.marketLabour[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMCLF'] =  function (tender) {//估计项目材料费(市场材料费)
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.evaluationProject && ration.feesIndex && ration.feesIndex.marketMaterial){
+                rst = parseFloat(rst + ration.feesIndex.marketMaterial[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMJXF'] =  function (tender) {//估计项目机械费(市场机械费)
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.evaluationProject && ration.feesIndex && ration.feesIndex.marketMachine){
+                rst = parseFloat(rst + ration.feesIndex.marketMachine[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMZCF'] =  function (tender) {//估计项目主材费
+        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        for(let ration of rations){
+            if(ration.evaluationProject && ration.feesIndex && ration.feesIndex.mainMaterial){
+                rst = parseFloat(rst + ration.feesIndex.mainMaterial[totalFeeType]).toDecimal(decimalObj.ration.totalPrice)
+            }
+        }
+        return rst;
+    };
+    baseFigureTemplate['GJXMGR'] =  function (tender) {//估计项目工日
+        const quantityType = tender ? 'tenderQuantity' : 'quantity';
+        let rst = 0;
+        let rations = calcBase.project.Ration.datas;
+        let rationGljs = calcBase.project.ration_glj.datas;
+        for (let ration of rations) {
+            if (ration.evaluationProject && ration.type === rationType.ration) {
+                for(let glj of rationGljs){
+                    if(ration.ID === glj.rationID && glj.type === gljType.LABOUR){
+                        rst = parseFloat(rst + parseFloat(glj[quantityType] * ration[quantityType]).toDecimal(decimalObj.glj.quantity)).toDecimal(decimalObj.glj.quantity);
+                    }
+                }
+            }
+        }
+        return rst;
+    };
+}
+//增加清单基数分类估价项目、去除分类税前工程造价
+if(typeof $ !== 'undefined' && $('#cbClassList')){
+    $('#cbClassList').find('li:eq(8)').remove();
+    let $li = $('<li class="p-1"><a id="cb_GJXM" href="javascript:void(0);">估价项目</a></li>');
+    $li.insertAfter($('#cbClassList').find('li:eq(4)'));
+}
+if (typeof calcBaseView !== 'undefined') {
+    calcBaseView.billsCBClass = {ALL: [], FBFX: [], CSXM: [], QTXM: [], FBF: [], RCJ: [], GF: [], SJ: [], GJXM: []};
+}
+
+
+
+
+

+ 1 - 1
web/users/html/login.html

@@ -44,7 +44,7 @@
         <div class="modal-dialog modal-lg" role="document">
             <div class="modal-content">
                 <div class="modal-header">
-                    <h5 class="modal-title">选择登录版本</h5>
+                    <h5 class="modal-title">选择费用定额</h5>
                     <p class="m-0 text-warning"><i class="fa fa-exclamation-triangle"></i> <b>登录设置</b> 中可以修改您的登录习惯。</p>
                 </div>
                 <div class="modal-body">

+ 4 - 4
web/users/html/user-set.html

@@ -44,7 +44,7 @@
                         <legend class="my-3">登录设置</legend>
                         <form method="post" action="/user/save-preferences">
                             <div class="form-group">
-                                <label class="form-control-label">登录时选择版本</label>
+                                <label class="form-control-label">登录时选择费用定额</label>
                                 <div class="form-control">
                                     <div class="form-check form-check-inline">
                                       <input name="login_ask" type="radio" class="form-check-input" value="1"
@@ -54,14 +54,14 @@
                                     <div class="form-check form-check-inline">
                                       <input name="login_ask" type="radio" class="form-check-input" value="0"
                                         <% if(preferenceSetting.login_ask === 0) { %>checked="checked" <% } %>>
-                                      <span class="form-check-label">指定版本</span>
+                                      <span class="form-check-label">指定费用定额</span>
                                     </div>
                                 </div>
                             </div>
                             <div class="form-group">
-                                <label class="form-control-label">指定版本</label>
+                                <label class="form-control-label">指定费用定额</label>
                                 <select class="form-control" name="select_version">
-                                    <option value="">请选择版本</option>
+                                    <option value="">请选择费用定额</option>
                                     <% if (compilationList.length > 0) {%>
                                     <% compilationList.forEach(function(compilation) { %>
                                     <option value="<%= compilation._id %>" <% if(preferenceSetting.select_version === compilation._id.toString()) { %>selected="selected" <% } %>><%= compilation.name %></option>