Browse Source

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

TonyKang 6 years ago
parent
commit
f6abf2cab4
46 changed files with 540 additions and 292 deletions
  1. 5 3
      modules/all_models/bills.js
  2. 3 3
      modules/all_models/fee_rates.js
  3. 1 1
      modules/all_models/mix_ratio.js
  4. 7 4
      modules/all_models/project_glj.js
  5. 1 1
      modules/all_models/projects.js
  6. 5 3
      modules/all_models/ration.js
  7. 3 3
      modules/all_models/ration_coe.js
  8. 1 1
      modules/all_models/std_glj.js
  9. 1 1
      modules/all_models/unit_price.js
  10. 2 2
      modules/bills_lib/models/bills_lib_interfaces.js
  11. 13 6
      modules/complementary_glj_lib/controllers/gljController.js
  12. 13 49
      modules/complementary_glj_lib/models/gljModel.js
  13. 1 0
      modules/complementary_glj_lib/routes/routes.js
  14. 6 6
      modules/complementary_ration_lib/models/searchModel.js
  15. 2 2
      modules/complementary_ration_lib/models/sectionTreeModel.js
  16. 17 5
      modules/main/controllers/ration_controller.js
  17. 0 3
      modules/main/models/project.js
  18. 8 0
      modules/main/routes/main_route.js
  19. 2 2
      modules/pm/models/project_model.js
  20. 1 1
      modules/pm/models/project_property_template.js
  21. 3 3
      modules/ration_glj/facade/glj_calculate_facade.js
  22. 1 1
      modules/ration_glj/facade/ration_glj_facade.js
  23. 1 1
      modules/std_billsGuidance_lib/facade/facades.js
  24. 6 5
      modules/users/controllers/login_controller.js
  25. 2 2
      modules/users/models/log_model.js
  26. 5 4
      public/web/sheet/sheet_common.js
  27. 2 8
      web/building_saas/complementary_glj_lib/js/components.js
  28. 71 33
      web/building_saas/complementary_glj_lib/js/glj.js
  29. 1 15
      web/building_saas/complementary_glj_lib/js/gljClassTree.js
  30. 14 7
      web/building_saas/complementary_glj_lib/js/gljComponent.js
  31. 1 0
      web/building_saas/complementary_glj_lib/js/sheetOpr.js
  32. 2 13
      web/building_saas/complementary_ration_lib/js/ration.js
  33. 4 0
      web/building_saas/css/custom.css
  34. 9 6
      web/building_saas/main/html/main.html
  35. 4 4
      web/building_saas/main/js/models/bills.js
  36. 65 18
      web/building_saas/main/js/models/calc_program.js
  37. 12 11
      web/building_saas/main/js/models/ration.js
  38. 2 24
      web/building_saas/main/js/models/ration_glj.js
  39. 5 4
      web/building_saas/main/js/views/glj_view.js
  40. 189 13
      web/building_saas/main/js/views/locate_view.js
  41. 6 8
      web/building_saas/main/js/views/options_view.js
  42. 19 7
      web/building_saas/main/js/views/project_view.js
  43. 5 0
      web/building_saas/main/js/views/sub_view.js
  44. 10 0
      web/building_saas/main/js/views/tender_price_view.js
  45. 3 3
      web/users/html/login.html
  46. 6 6
      web/users/js/login.js

+ 5 - 3
modules/all_models/bills.js

@@ -6,10 +6,10 @@ let subSchema = require("../all_schemas/bills_sub_schemas");
 let deleteSchema = require('../all_schemas/delete_schema');
 let deleteSchema = require('../all_schemas/delete_schema');
 let Schema = mongoose.Schema;
 let Schema = mongoose.Schema;
 let billsSchema = new Schema({
 let billsSchema = new Schema({
-    ID: String,
+    ID: {type: String, index: true},
     ParentID: String,
     ParentID: String,
     NextSiblingID: String,
     NextSiblingID: String,
-    projectID: Number,
+    projectID:{type: Number, index: true} ,
     serialNo: Number,
     serialNo: Number,
     chapterID: Number,
     chapterID: Number,
     billsLibId: Number,
     billsLibId: Number,
@@ -71,7 +71,9 @@ let billsSchema = new Schema({
     engineeringContent:String,//工程内容
     engineeringContent:String,//工程内容
     serviceContent:String,//服务内容
     serviceContent:String,//服务内容
     claimVisa:String,//签证及索赔依据
     claimVisa:String,//签证及索赔依据
-    calcFlag: {type: Number}    // 叶子清单的计算类型。末定义:按定额计算。1:用户输入金额。2:用户输入单价。3:用户输入设计单价。
+    calcFlag: {type: Number},    // 叶子清单的计算类型。末定义:按定额计算。1:用户输入金额。2:用户输入单价。3:用户输入设计单价。
+    bookmarkBackground:String,//书签背景色
+    bookmarkAnnotation:String//批注
 });
 });
 
 
 mongoose.model("bills", billsSchema);
 mongoose.model("bills", billsSchema);

+ 3 - 3
modules/all_models/fee_rates.js

@@ -51,7 +51,7 @@ let ratesSchema = new Schema({
 },{versionKey:false,_id: false});
 },{versionKey:false,_id: false});
 
 
 let feeRatesSchema = new Schema({
 let feeRatesSchema = new Schema({
-    ID: String,
+    ID: {type: String, index: true},
     rates: [ratesSchema],
     rates: [ratesSchema],
     deleteInfo: deleteSchema
     deleteInfo: deleteSchema
 },{versionKey:false});
 },{versionKey:false});
@@ -60,7 +60,7 @@ mongoose.model('fee_rates', feeRatesSchema, 'fee_rates');
 
 
 
 
 let feeRateFileSchema = new Schema({
 let feeRateFileSchema = new Schema({
-    ID: String,
+    ID: {type: String, index: true},
     rootProjectID:Number,//顶层项目ID
     rootProjectID:Number,//顶层项目ID
     userID:String,
     userID:String,
     name:String,
     name:String,
@@ -75,7 +75,7 @@ mongoose.model('fee_rate_file', feeRateFileSchema, 'fee_rate_file');
 
 
 
 
 let feeRatesLibSchema = new Schema({
 let feeRatesLibSchema = new Schema({
-    ID: String,
+    ID: {type: String, index: true},
     region: String,                     // 工程所在地
     region: String,                     // 工程所在地
     libName: String,
     libName: String,
     rates: [ratesSchema]
     rates: [ratesSchema]

+ 1 - 1
modules/all_models/mix_ratio.js

@@ -23,7 +23,7 @@ let modelSchema = {
         index: true
         index: true
     },
     },
     // 单价文件表id (因为选择单价文件后配合比数据也需要同步,所以记录单价文件id)
     // 单价文件表id (因为选择单价文件后配合比数据也需要同步,所以记录单价文件id)
-    unit_price_file_id: Number,
+    unit_price_file_id: {type: Number, index: true},
     // 关联项目工料机的key 不能关联id,因为单价文件导入别的项目后项目工料机id不同
     // 关联项目工料机的key 不能关联id,因为单价文件导入别的项目后项目工料机id不同
     connect_key: {
     connect_key: {
         type: String,
         type: String,

+ 7 - 4
modules/all_models/project_glj.js

@@ -18,21 +18,24 @@ let modelSchema = {
     // 工料机总库ID
     // 工料机总库ID
     glj_id: Number,
     glj_id: Number,
     // 标段ID
     // 标段ID
-    project_id: Number,
+    project_id: {
+        type: Number,
+        index: true
+    },
     // 编码
     // 编码
     code: {
     code: {
         type: String,
         type: String,
-        index: true
+        index: false
     },
     },
     //原始的编码
     //原始的编码
     original_code: {
     original_code: {
         type: String,
         type: String,
-        index: true
+        index: false
     },
     },
     // 名称
     // 名称
     name: {
     name: {
         type: String,
         type: String,
-        index: true,
+        index: false,
         default: ''
         default: ''
     },
     },
     // 是否暂估 (0为否 1为是)
     // 是否暂估 (0为否 1为是)

+ 1 - 1
modules/all_models/projects.js

@@ -14,7 +14,7 @@ const shareSchema = new Schema({
     shareDate: String,
     shareDate: String,
 }, {versionKey: false, _id: false});
 }, {versionKey: false, _id: false});
 const ProjectSchema = new Schema({
 const ProjectSchema = new Schema({
-    "ID": Number,
+    "ID":{type: Number, index: true},
     "ParentID": Number,
     "ParentID": Number,
     "NextSiblingID": Number,
     "NextSiblingID": Number,
     "userID": String,
     "userID": String,

+ 5 - 3
modules/all_models/ration.js

@@ -27,8 +27,8 @@ var rationAssItemSchema = mongoose.Schema({
 // 定额、量价、工料机定额 合并存储
 // 定额、量价、工料机定额 合并存储
 let rationSchema = new Schema({
 let rationSchema = new Schema({
     // 公用属性部分
     // 公用属性部分
-    ID: String,
-    projectID: Number,
+    ID: {type: String, index: true},
+    projectID: {type: Number, index: true},
     billsItemID: String,
     billsItemID: String,
     serialNo: Number,
     serialNo: Number,
     code: String,
     code: String,
@@ -83,7 +83,9 @@ let rationSchema = new Schema({
     customQuantity:String,//自定义消耗
     customQuantity:String,//自定义消耗
     model: Number,// 机型
     model: Number,// 机型
     adjCoe:Number,
     adjCoe:Number,
-    remark:String
+    remark:String,
+    bookmarkBackground:String,//书签背景色
+    bookmarkAnnotation:String//批注
 });
 });
 
 
 let ration = mongoose.model("ration", rationSchema, "ration");
 let ration = mongoose.model("ration", rationSchema, "ration");

+ 3 - 3
modules/all_models/ration_coe.js

@@ -17,15 +17,15 @@ var coeSchema = mongoose.Schema({
 
 
 var coeListSchema = mongoose.Schema({
 var coeListSchema = mongoose.Schema({
     libID: Number,                      // 所属定额库ID
     libID: Number,                      // 所属定额库ID
-    ID: String,                         // 系数ID(流水号ID)
+    ID: {type: String, index: true},                         // 系数ID(流水号ID)
     name: String,                       // 名称
     name: String,                       // 名称
     content: String,                    // 说明
     content: String,                    // 说明
     original_code:String,               //原人材机编码
     original_code:String,               //原人材机编码
     option_codes:String,                //可选人材机编码
     option_codes:String,                //可选人材机编码
     option_list:[Schema.Types.Mixed],//下拉列表选项
     option_list:[Schema.Types.Mixed],//下拉列表选项
     select_code:String,
     select_code:String,
-    rationID:String,
-    projectID:Number,
+    rationID:{type: String, index: true},
+    projectID:{type: Number, index: true},
     coeID:Number,
     coeID:Number,
     isAdjust:Number, //0不调整,1调整
     isAdjust:Number, //0不调整,1调整
     seq:Number,//序数,排序用
     seq:Number,//序数,排序用

+ 1 - 1
modules/all_models/std_glj.js

@@ -20,7 +20,7 @@ const std_gljComponent = new Schema(
 
 
 const std_glj = new Schema({
 const std_glj = new Schema({
     deleted: Boolean,
     deleted: Boolean,
-    repositoryId: Number,
+    repositoryId: {type: Number,index: true},
     ID: Number,
     ID: Number,
     code: String,
     code: String,
     name: String,
     name: String,

+ 1 - 1
modules/all_models/unit_price.js

@@ -43,7 +43,7 @@ let modelSchema = {
     // 类型简称
     // 类型简称
     short_name: String,
     short_name: String,
     // 单价文件表id
     // 单价文件表id
-    unit_price_file_id: Number,
+    unit_price_file_id: {type: Number, index: true},
     // 对应标准库工料机id
     // 对应标准库工料机id
     glj_id: Number,
     glj_id: Number,
     //是否新增1为是,0为否
     //是否新增1为是,0为否

+ 2 - 2
modules/bills_lib/models/bills_lib_interfaces.js

@@ -1791,7 +1791,7 @@ billsLibDao.prototype.deleteBills = function(delData, callback){
 
 
 billsLibDao.prototype.getJobContent = function(gJobData, callback){
 billsLibDao.prototype.getJobContent = function(gJobData, callback){
     let billsLibId = gJobData.billsLibId;
     let billsLibId = gJobData.billsLibId;
-    JobContent.find({billsLibId: billsLibId, deleted: false}, '-_id').sort({code: 1}).exec(function(err, result){
+    JobContent.find({billsLibId: billsLibId, deleted: false}, '-_id').lean().sort({code: 1}).exec(function(err, result){
         if(err){
         if(err){
             callback(1, 'Error', null);
             callback(1, 'Error', null);
         }
         }
@@ -2249,7 +2249,7 @@ billsLibDao.prototype.edUpdateJob = function(data, callback){
 //----------------------ItemCharacter---------------------
 //----------------------ItemCharacter---------------------
 billsLibDao.prototype.getItemCharacter = function(gdata, callback){
 billsLibDao.prototype.getItemCharacter = function(gdata, callback){
     let billsLibId = gdata.billsLibId;
     let billsLibId = gdata.billsLibId;
-    ItemCharacter.find({billsLibId: billsLibId, deleted: false}, '-_id').sort({code: 1}).exec(function(err, result){
+    ItemCharacter.find({billsLibId: billsLibId, deleted: false}, '-_id').lean().sort({code: 1}).exec(function(err, result){
         if(err){
         if(err){
             callback(1, 'Error', null);
             callback(1, 'Error', null);
         }
         }

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

@@ -101,12 +101,19 @@ class GljController extends BaseController{
     }
     }
     getGljItems(req, res) {
     getGljItems(req, res) {
         let data = JSON.parse(req.body.data);
         let data = JSON.parse(req.body.data);
-        let stdGljLibId = data.stdGljLibId,
-            userId = data.userId,
-            compilationId = data.compilationId
-            gljDao.getGljItems(stdGljLibId, req.session.sessionUser.id, req.session.sessionCompilation._id, function(err, data){
-                callback(req,res,err,'Get Items',data)
-            });
+        let stdGljLibId = data.stdGljLibId;
+        let projection = data.projection;
+        gljDao.getGljItems(stdGljLibId, req.session.sessionUser.id, req.session.sessionCompilation._id, projection, function(err, data){
+            callback(req,res,err,'Get Items',data)
+        });
+    }
+    getStdItems(req, res) {
+        let data = JSON.parse(req.body.data),
+            stdGljLibId = data.stdGljLibId,
+            projection = data.projection;
+        gljDao.getStdItems(stdGljLibId, projection, function (err, data) {
+            callback(req, res, err, '获取人材机数据失败', data);
+        });
     }
     }
 
 
     updateComponent(req, res){
     updateComponent(req, res){

+ 13 - 49
modules/complementary_glj_lib/models/gljModel.js

@@ -41,59 +41,14 @@ class GljDao {
         }
         }
     }
     }
     //获得用户的补充工料机和用户当前所在编办的标准工料机
     //获得用户的补充工料机和用户当前所在编办的标准工料机
-    async getGljItems (stdGljLibId, userId, compilationId, callback){
+    async getGljItems (stdGljLibId, userId, compilationId, projection, callback){
         let me = this;
         let me = this;
         let rst = {stdGljs: [], complementaryGljs: []};
         let rst = {stdGljs: [], complementaryGljs: []};
         //批量获取异步
         //批量获取异步
-       /* let functions = [];
-        let count = await stdGljModel.find({repositoryId: stdGljLibId, $or: [{deleted: null}, {deleted: false}]}).count();
-        let findCount = Math.ceil(count/500);
-        for(let i = 0, len = findCount; i < len; i++){
-            functions.push((function(flag) {
-                return function (cb) {
-                    stdGljModel.find({repositoryId: stdGljLibId, deleted: null}, cb).skip(flag).sort({ID: 1}).limit(500);
-                }
-            })(i*500));
-        }
-        async.parallel(functions,  function (err, results) {
-            if(err){
-                callback(err, null);
-            }
-            else{
-                for(let stdGljs of results){
-                    rst.stdGljs = rst.stdGljs.concat(stdGljs);
-                }
-                callback(0, rst);
-            }
-        });*/
         async.parallel([
         async.parallel([
            async function (cb) {
            async function (cb) {
                try{
                try{
-                   let stdGljs = [];
-                   let first = await stdGljModel.find({repositoryId: stdGljLibId}).sort({ID: 1}).limit(1);
-                   let count = await stdGljModel.find({repositoryId: stdGljLibId, $or: [{deleted: null}, {deleted: false}]}).count();
-                   let findCount = Math.ceil(count/500);
-                   let flag = first[0].ID;
-                   //let flag = 0;
-                   //批量获取,非skip
-                   for(let i = 0, len = findCount; i < len; i++){
-                       let tempStdGlj;
-                       if(i === 0){
-                           tempStdGlj = await stdGljModel.find({repositoryId: stdGljLibId, deleted: null, ID: {$gte: flag}}).sort({ID: 1}).limit(500);
-                           if(tempStdGlj.length > 0){
-                               flag = tempStdGlj[tempStdGlj.length - 1].ID;
-                           }
-                       }
-                       else {
-                           tempStdGlj = await stdGljModel.find({repositoryId: stdGljLibId, deleted: null, ID: {$gt: flag}}).sort({ID: 1}).limit(500);
-                           if(tempStdGlj.length > 0){
-                               flag = tempStdGlj[tempStdGlj.length - 1].ID;
-                           }
-                       }
-                       if(tempStdGlj){
-                           stdGljs = stdGljs.concat(tempStdGlj);
-                       }
-                   }
+                   let stdGljs = await stdGljModel.find({repositoryId: stdGljLibId}, projection).lean();
                    me.sortToNumber(stdGljs);
                    me.sortToNumber(stdGljs);
                    rst.stdGljs = stdGljs;
                    rst.stdGljs = stdGljs;
                    cb(null);
                    cb(null);
@@ -104,7 +59,7 @@ class GljDao {
 
 
             },
             },
             function (cb) {
             function (cb) {
-                complementaryGljModel.find({userId: userId, compilationId: compilationId}, function (err, complementaryGljs) {
+                complementaryGljModel.find({userId: userId, compilationId: compilationId}, '-_id', {lean: true}, function (err, complementaryGljs) {
                     if(err){
                     if(err){
                         cb(err);
                         cb(err);
                     }
                     }
@@ -124,7 +79,16 @@ class GljDao {
             }
             }
         })
         })
 
 
-    };
+    }
+
+    async getStdItems (stdGljLibId, projection, callback) {
+        try {
+            let stdItems = await stdGljModel.find({repositoryId: stdGljLibId}, projection).lean();
+            callback(0, stdItems);
+        } catch (err) {
+            callback(1, null);
+        }
+    }
 
 
     getGljItemsByCode (repositoryId, codes, callback){
     getGljItemsByCode (repositoryId, codes, callback){
         gljModel.find({"repositoryId": repositoryId,"code": {"$in": codes}},function(err,data){
         gljModel.find({"repositoryId": repositoryId,"code": {"$in": codes}},function(err,data){

+ 1 - 0
modules/complementary_glj_lib/routes/routes.js

@@ -21,6 +21,7 @@ module.exports = function (app) {
     router.post("/getGljDistType", gljController.init, gljController.getGljDistType);
     router.post("/getGljDistType", gljController.init, gljController.getGljDistType);
     router.post("/getGljTree", gljController.init, gljController.getGljTree);
     router.post("/getGljTree", gljController.init, gljController.getGljTree);
     router.post("/getGljItems", gljController.init, gljController.getGljItems);
     router.post("/getGljItems", gljController.init, gljController.getGljItems);
+    router.post('/getStdItems', gljController.init, gljController.getStdItems);
     router.post("/updateComponent", gljController.init, gljController.updateComponent);
     router.post("/updateComponent", gljController.init, gljController.updateComponent);
     router.post("/mixUpdateGljItems", gljController.init, gljController.mixUpdateGljItems);
     router.post("/mixUpdateGljItems", gljController.init, gljController.mixUpdateGljItems);
     router.post("/updateRationBasePrc",compleRationController.init, compleRationController.updateRationBasePrc);//更新定额单价
     router.post("/updateRationBasePrc",compleRationController.init, compleRationController.updateRationBasePrc);//更新定额单价

+ 6 - 6
modules/complementary_ration_lib/models/searchModel.js

@@ -126,9 +126,9 @@ class SearchDao{
             //搜索定额
             //搜索定额
             let stdGljIds = [],
             let stdGljIds = [],
                 comGljIds = [];
                 comGljIds = [];
-            let stdRations = rationRepId.length === 0 ? [] : await stdRationModel.find(filter).sort({code: 1}).skip(skip.std).limit(limit);
+            let stdRations = rationRepId.length === 0 ? [] : await stdRationModel.find(filter).lean().sort({code: 1}).skip(skip.std).limit(limit);
             for(let i = 0, len = stdRations.length; i < len; i++){
             for(let i = 0, len = stdRations.length; i < len; i++){
-                stdRations[i]._doc.type = 'std';
+                stdRations[i].type = 'std';
                 for(let glj of stdRations[i].rationGljList){
                 for(let glj of stdRations[i].rationGljList){
                     stdGljIds.push(glj.gljId);
                     stdGljIds.push(glj.gljId);
                 }
                 }
@@ -136,9 +136,9 @@ class SearchDao{
             let compleRations = [];
             let compleRations = [];
             let residueLimit = limit - stdRations.length;
             let residueLimit = limit - stdRations.length;
             if (residueLimit > 0) {
             if (residueLimit > 0) {
-                compleRations = findCompleRtion ? await compleRationModel.find(compleFilter).sort({code: 1}).skip(skip.comple).limit(residueLimit) : [];
+                compleRations = findCompleRtion ? await compleRationModel.find(compleFilter).lean().sort({code: 1}).skip(skip.comple).limit(residueLimit) : [];
                 for(let i = 0, len = compleRations.length; i <len; i++){
                 for(let i = 0, len = compleRations.length; i <len; i++){
-                    compleRations[i]._doc.type = 'complementary';
+                    compleRations[i].type = 'complementary';
                     for(let glj of compleRations[i].rationGljList){
                     for(let glj of compleRations[i].rationGljList){
                         if(glj.type === 'std'){
                         if(glj.type === 'std'){
                             stdGljIds.push(glj.gljId);
                             stdGljIds.push(glj.gljId);
@@ -198,7 +198,7 @@ class SearchDao{
                     hintsArr.push(`附注:`);
                     hintsArr.push(`附注:`);
                     hintsArr = hintsArr.concat(ration.annotation.split('\n'));
                     hintsArr = hintsArr.concat(ration.annotation.split('\n'));
                 }
                 }
-                ration._doc.hint = hintsArr.join('<br>');
+                ration.hint = hintsArr.join('<br>');
             }
             }
             for(let ration of compleRations){
             for(let ration of compleRations){
                 let hintsArr = [];
                 let hintsArr = [];
@@ -217,7 +217,7 @@ class SearchDao{
                     hintsArr.push(`附注:`);
                     hintsArr.push(`附注:`);
                     hintsArr = hintsArr.concat(ration.annotation.split('\n'));
                     hintsArr = hintsArr.concat(ration.annotation.split('\n'));
                 }
                 }
-                ration._doc.hint = hintsArr.join('<br>');
+                ration.hint = hintsArr.join('<br>');
             }
             }
             rst.data = stdRations.concat(compleRations);
             rst.data = stdRations.concat(compleRations);
             callback(0, rst);
             callback(0, rst);

+ 2 - 2
modules/complementary_ration_lib/models/sectionTreeModel.js

@@ -57,9 +57,9 @@ class SectionTreeDao {
         try {
         try {
             let treeData;
             let treeData;
             if (type === rationLibType.complementary) {
             if (type === rationLibType.complementary) {
-                treeData = await compleRationSectionTreeModel.find({userId: userId, compilationId: compilationId, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]});
+                treeData = await compleRationSectionTreeModel.find({userId: userId, compilationId: compilationId, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]}).lean();
             } else {
             } else {
-                treeData = await stdSectionTreeModel.find({rationRepId: rationRepId});
+                treeData = await stdSectionTreeModel.find({rationRepId: rationRepId}).lean();
             }
             }
             callback(0, treeData);
             callback(0, treeData);
         } catch (err) {
         } catch (err) {

+ 17 - 5
modules/main/controllers/ration_controller.js

@@ -27,7 +27,15 @@ let controller = {
             data = JSON.stringify(data);
             data = JSON.stringify(data);
         }
         }
         data = JSON.parse(data);
         data = JSON.parse(data);
-        return await ration_facade.addNewRation(data,req.session.sessionCompilation);
+        let start = +new Date();
+        let result = await ration_facade.addNewRation(data,req.session.sessionCompilation);
+        //合并取项目工料机数据的情求,用于刷新项目工料机数据,当有添加、替换项目工料机的情况,才需要刷新
+        if(result.ration_gljs && result.ration_gljs.length > 0 && data.newData){
+            result.projectGLJDatas =  await getProjectGLJData(data.newData.projectID);
+        }
+        let end = +new Date();
+        console.log("实际插入时间为-------------------------------"+(end-start));
+        return result
     },
     },
     addMultiRation: async function (req) {
     addMultiRation: async function (req) {
         let data = req.body.data;
         let data = req.body.data;
@@ -82,16 +90,20 @@ let controller = {
         let result = await ration_facade.updateCoeAdjust(data,req.session.sessionCompilation);
         let result = await ration_facade.updateCoeAdjust(data,req.session.sessionCompilation);
         //合并取项目工料机数据的情求,用于刷新项目工料机数据,当有添加、替换项目工料机的情况,才需要刷新
         //合并取项目工料机数据的情求,用于刷新项目工料机数据,当有添加、替换项目工料机的情况,才需要刷新
         if(result.add.length > 0 || result.replace.length > 0){
         if(result.add.length > 0 || result.replace.length > 0){
-            let gljController = new GLJController();
-            let responseData = await gljController.getProjectGLJsByProjectID(data.projectID)
-            result.projectGLJDatas = responseData.data;
+            result.projectGLJDatas =  await getProjectGLJData(data.projectID);
         }
         }
         return result
         return result
 
 
     }
     }
+};
 
 
 
 
-};
+async function getProjectGLJData(projectID) {
+    let gljController = new GLJController();
+    let responseData = await gljController.getProjectGLJsByProjectID(projectID);
+    return responseData.data;
+}
+
 
 
 function prepareUpdateNodes(datas,nodes,type) {
 function prepareUpdateNodes(datas,nodes,type) {
     for(let d of datas){
     for(let d of datas){

+ 0 - 3
modules/main/models/project.js

@@ -103,10 +103,7 @@ Project.prototype.getData = function(projectID, callback){
     for (itemName in moduleMap){
     for (itemName in moduleMap){
         functions.push((function(itemName){
         functions.push((function(itemName){
             return function (cb) {
             return function (cb) {
-                let startTime = +new Date();
                 moduleMap[itemName].getData(projectID, function(err, moduleName, data){
                 moduleMap[itemName].getData(projectID, function(err, moduleName, data){
-                    let endTime = +new Date();
-                    console.log(moduleName+'---------------'+(endTime - startTime));
                     cb(err, {moduleName: moduleName, data: data})
                     cb(err, {moduleName: moduleName, data: data})
                 })
                 })
             }
             }

+ 8 - 0
modules/main/routes/main_route.js

@@ -5,6 +5,8 @@
 
 
 import BaseController from "../../common/base/base_controller";
 import BaseController from "../../common/base/base_controller";
 const projectModel = require("../../pm/models/project_model");
 const projectModel = require("../../pm/models/project_model");
+import OptionsDao from '../../options/models/optionsModel';
+import optionSetting from '../../options/models/optionTypes';
 let config = require("../../../config/config.js");
 let config = require("../../../config/config.js");
 module.exports =function (app) {
 module.exports =function (app) {
     const baseController = new BaseController();
     const baseController = new BaseController();
@@ -22,6 +24,11 @@ module.exports =function (app) {
                     //允许协作的项目允许编辑,非只读
                     //允许协作的项目允许编辑,非只读
                     projectReadOnly = !projectCooperate;
                     projectReadOnly = !projectCooperate;
                 }
                 }
+                let optionsDao = new OptionsDao();
+                let options = await optionsDao.getOptions(req.session.sessionUser.id, req.session.sessionCompilation._id);
+                if(options){
+                    options = await optionsDao.saveOptions(req.session.sessionUser.id, req.session.sessionCompilation._id, optionSetting);
+                }
                 res.render('building_saas/main/html/main.html',
                 res.render('building_saas/main/html/main.html',
                     {
                     {
                         userAccount: req.session.userAccount,
                         userAccount: req.session.userAccount,
@@ -32,6 +39,7 @@ module.exports =function (app) {
                         projectReadOnly: projectReadOnly,
                         projectReadOnly: projectReadOnly,
                         projectCooperate: projectCooperate,
                         projectCooperate: projectCooperate,
                         LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
                         LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
+                        options:JSON.stringify(options),
                         overWriteUrl:req.session.sessionCompilation.overWriteUrl
                         overWriteUrl:req.session.sessionCompilation.overWriteUrl
                     });
                     });
             } else {
             } else {

+ 2 - 2
modules/pm/models/project_model.js

@@ -66,7 +66,7 @@ ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, cal
                 'compilation': compilation,
                 'compilation': compilation,
                 'deleteInfo': null
                 'deleteInfo': null
             }, {'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': {'$in': [null, false]}}]
             }, {'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': {'$in': [null, false]}}]
-        }, '-_id');
+        }, '-_id', {lean: true});
         let projIDs= [];
         let projIDs= [];
         for(let project of projects){
         for(let project of projects){
             if(project.projType === projectType.project){
             if(project.projType === projectType.project){
@@ -78,7 +78,7 @@ ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, cal
         for(let proj of projects){
         for(let proj of projects){
             let summaryProj = summaryInfo[proj.ID];
             let summaryProj = summaryInfo[proj.ID];
             if(summaryProj){
             if(summaryProj){
-                proj._doc.totalCost = summaryProj.totalCost;
+                proj.totalCost = summaryProj.totalCost;
             }
             }
         }
         }
         callback(0, '', projects);
         callback(0, '', projects);

+ 1 - 1
modules/pm/models/project_property_template.js

@@ -33,7 +33,7 @@ const calcOptions={
 * 单位工程清单工程量精度模板
 * 单位工程清单工程量精度模板
 * */
 * */
 const billsQuantityDecimal = [
 const billsQuantityDecimal = [
-    {unit: '其他未列单位', decimal: 2},
+    {unit: '其他未列单位', decimal: 3},
     {unit: 't', decimal: 3},
     {unit: 't', decimal: 3},
     {unit: '吨', decimal: 3},
     {unit: '吨', decimal: 3},
     {unit: 'km', decimal: 3},
     {unit: 'km', decimal: 3},

+ 3 - 3
modules/ration_glj/facade/glj_calculate_facade.js

@@ -48,9 +48,9 @@ async function calculateQuantity(query,noNeedCal=null,refreshRationName = false)
              glj_result:[],
              glj_result:[],
              rationID:query.rationID
              rationID:query.rationID
          };
          };
-         let impactRation = await ration.findOne({ID:query.rationID,projectID:query.projectID});
+         let impactRation = await ration.findOne({ID:query.rationID});
          let gljList = await ration_glj.find(query);//{projectID:query.projectID,rationID:query.rationID}
          let gljList = await ration_glj.find(query);//{projectID:query.projectID,rationID:query.rationID}
-         let coeList = await ration_coe.find({projectID:query.projectID,rationID:query.rationID}).sort('seq').exec();
+         let coeList = await ration_coe.find({rationID:query.rationID}).sort('seq').exec();
          let assList=[], assRation = null, adjustState=[],mixRatioMap = {};
          let assList=[], assRation = null, adjustState=[],mixRatioMap = {};
          if(!impactRation){//如果定额不存在或者已删除,返回空
          if(!impactRation){//如果定额不存在或者已删除,返回空
              return null;
              return null;
@@ -101,7 +101,7 @@ async function calculateQuantity(query,noNeedCal=null,refreshRationName = false)
              setData.name = newName;
              setData.name = newName;
              result.rationName = newName;
              result.rationName = newName;
          }
          }
-         await ration.update({projectID:query.projectID,ID:query.rationID,deleteInfo: null},setData);
+         await ration.update({ID:query.rationID},setData);
          result.adjustState=adjustStateString;
          result.adjustState=adjustStateString;
          return result;
          return result;
     }catch (err){
     }catch (err){

+ 1 - 1
modules/ration_glj/facade/ration_glj_facade.js

@@ -561,7 +561,7 @@ function getGLJData(info, callback) {
             }
             }
         },
         },
         function (cb) {
         function (cb) {
-            gljDao.getGljItems(info.gljLibId, info.userID, info.compilationId, function (err, data) {
+            gljDao.getGljItems(info.gljLibId, info.userID, info.compilationId, {_id: 0}, function (err, data) {
                 if (err) {
                 if (err) {
                     cb(err);
                     cb(err);
                 } else {
                 } else {

+ 1 - 1
modules/std_billsGuidance_lib/facade/facades.js

@@ -40,7 +40,7 @@ async function getLibWithBills(libID){
     if(!billsLib){
     if(!billsLib){
         throw '引用的清单规则库不存在!';
         throw '引用的清单规则库不存在!';
     }
     }
-    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id');
+    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id').lean();
     //return {guidanceLib: guidanceLib[0], bills};
     //return {guidanceLib: guidanceLib[0], bills};
     return {bills};
     return {bills};
 }
 }

+ 6 - 5
modules/users/controllers/login_controller.js

@@ -215,11 +215,12 @@ class LoginController {
             // }
             // }
 
 
             // 判断极验验证码是否通过
             // 判断极验验证码是否通过
-            const captcha = new Captcha();
-            const captchResult = await captcha.validate(request);
-            if (!captchResult) {
-                throw '极验验证码错误';
-            }
+            // 先不使用,出现验证慢的情况
+            // const captcha = new Captcha();
+            // const captchResult = await captcha.validate(request);
+            // if (!captchResult) {
+            //     throw '极验验证码错误';
+            // }
 
 
             // 判断用户是否开启了只使用短信登录
             // 判断用户是否开启了只使用短信登录
             const userInfo = await userModel.findDataByAccount(userData.mobile);
             const userInfo = await userModel.findDataByAccount(userData.mobile);

+ 2 - 2
modules/users/models/log_model.js

@@ -64,7 +64,7 @@ class LogModel extends BaseModel {
         ip = ip[3] === undefined ? '' : ip[3];
         ip = ip[3] === undefined ? '' : ip[3];
 
 
         // let ipInfo = '127.0.0.1';//await this.getIpInfoFromApi(ip);
         // let ipInfo = '127.0.0.1';//await this.getIpInfoFromApi(ip);
-        let ipInfo = await this.getIpInfoFromApi(ip);
+       // let ipInfo = await this.getIpInfoFromApi(ip);
 
 
         let userAgentObject = new UAParser(request.headers['user-agent']);
         let userAgentObject = new UAParser(request.headers['user-agent']);
         let osInfo = userAgentObject.getOS();
         let osInfo = userAgentObject.getOS();
@@ -74,7 +74,7 @@ class LogModel extends BaseModel {
             os: osInfo.name + ' ' + osInfo.version + ' ' + cpuInfo.architecture,
             os: osInfo.name + ' ' + osInfo.version + ' ' + cpuInfo.architecture,
             browser: browserInfo.name + ' ' + browserInfo.version,
             browser: browserInfo.name + ' ' + browserInfo.version,
             ip: ip,
             ip: ip,
-            ip_info: ipInfo
+            ip_info: ""//ipInfo
         };
         };
 
 
         return this.addLog(userId, LogType.LOGIN_LOG, message);
         return this.addLog(userId, LogType.LOGIN_LOG, message);

+ 5 - 4
public/web/sheet/sheet_common.js

@@ -246,7 +246,6 @@ var sheetCommonObj = {
         }
         }
         return result;
         return result;
     },
     },
-    //todo
     analyzePasteData: function(setting, pastedInfo) {
     analyzePasteData: function(setting, pastedInfo) {
         var rst = [], propId = pastedInfo.cellRange.col, preStrIdx = 0, itemObj = {};//propId = 0 to proId = pastedInfo.cellRange.col, update by zhong
         var rst = [], propId = pastedInfo.cellRange.col, preStrIdx = 0, itemObj = {};//propId = 0 to proId = pastedInfo.cellRange.col, update by zhong
         for (var i = 0; i < pastedInfo.pasteData.text.length; i++) {
         for (var i = 0; i < pastedInfo.pasteData.text.length; i++) {
@@ -258,15 +257,17 @@ var sheetCommonObj = {
                     itemObj = {};
                     itemObj = {};
                 }
                 }
             } else if (pastedInfo.pasteData.text[i] === "\t" || pastedInfo.pasteData.text[i] === "\r") {
             } else if (pastedInfo.pasteData.text[i] === "\t" || pastedInfo.pasteData.text[i] === "\r") {
-                itemObj[setting.header[propId].dataCode] = pastedInfo.pasteData.text.slice(preStrIdx, i);
+                if (setting.header[propId]) {
+                    itemObj[setting.header[propId].dataCode] = pastedInfo.pasteData.text.slice(preStrIdx, i);
+                }
                 propId++;
                 propId++;
                 preStrIdx = i + 1;
                 preStrIdx = i + 1;
                 //if the last copied-cell were empty, should check whether the end of text
                 //if the last copied-cell were empty, should check whether the end of text
-                if (i == pastedInfo.pasteData.text.length - 1) {
+                if (i == pastedInfo.pasteData.text.length - 1 && setting.header[propId]) {
                     itemObj[setting.header[propId].dataCode] = pastedInfo.pasteData.text.slice(preStrIdx);
                     itemObj[setting.header[propId].dataCode] = pastedInfo.pasteData.text.slice(preStrIdx);
                     rst.push(itemObj);
                     rst.push(itemObj);
                 }
                 }
-            } else if (i == pastedInfo.pasteData.text.length - 1) {
+            } else if (i == pastedInfo.pasteData.text.length - 1 && setting.header[propId]) {
                 itemObj[setting.header[propId].dataCode] = pastedInfo.pasteData.text.slice(preStrIdx);
                 itemObj[setting.header[propId].dataCode] = pastedInfo.pasteData.text.slice(preStrIdx);
                 rst.push(itemObj);
                 rst.push(itemObj);
             }
             }

+ 2 - 8
web/building_saas/complementary_glj_lib/js/components.js

@@ -87,9 +87,7 @@ let componentOprObj = {
                         }
                         }
                     }
                     }
                     if(!isExist){
                     if(!isExist){
-                        if(clearChecked){
-                            gljList[i].isChecked = false;
-                        }
+                        gljList[i].isChecked = false;
                     }
                     }
                     else {
                     else {
                         gljList[i].isChecked = true;
                         gljList[i].isChecked = true;
@@ -223,7 +221,6 @@ let componentOprObj = {
                     cacheSection.push(data[i]);
                     cacheSection.push(data[i]);
                 }
                 }
             }
             }
-            sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
             sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, re.distTypeTree);
             sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, re.distTypeTree);
             me.workBook.getSheet(0).setRowCount(cacheSection.length);
             me.workBook.getSheet(0).setRowCount(cacheSection.length);
             cacheSection = null;
             cacheSection = null;
@@ -236,7 +233,6 @@ let componentOprObj = {
             //添加选择添加的组成物
             //添加选择添加的组成物
             let updateArr = [];
             let updateArr = [];
             let newComponent = [];
             let newComponent = [];
-            //re.currentGlj.component = [];
             for(let i = 0, len = me.selectedList.length; i < len; i++){
             for(let i = 0, len = me.selectedList.length; i < len; i++){
                 let isExist = false;
                 let isExist = false;
                 for(let j = 0, jLen = re.currentGlj.component.length; j < jLen; j++){
                 for(let j = 0, jLen = re.currentGlj.component.length; j < jLen; j++){
@@ -250,14 +246,12 @@ let componentOprObj = {
                 if(!isExist){
                 if(!isExist){
                     newComponent.push({isStd: typeof me.selectedList[i].isStd !== 'undefined' ? me.selectedList[i].isStd : false, ID: me.selectedList[i].ID, consumeAmt: 0});
                     newComponent.push({isStd: typeof me.selectedList[i].isStd !== 'undefined' ? me.selectedList[i].isStd : false, ID: me.selectedList[i].ID, consumeAmt: 0});
                 }
                 }
-                //re.currentGlj.component.push({ID: me.selectedList[i].ID, consumeAmt: 0});
             }
             }
             re.currentGlj.component = newComponent;
             re.currentGlj.component = newComponent;
             let gljBasePrc = that.reCalGljBasePrc(re.getCurrentComponent(re.currentGlj.component));
             let gljBasePrc = that.reCalGljBasePrc(re.getCurrentComponent(re.currentGlj.component));
             if(gljBasePrc !== re.currentGlj.basePrice){
             if(gljBasePrc !== re.currentGlj.basePrice){
                 re.currentGlj.basePrice = gljBasePrc;
                 re.currentGlj.basePrice = gljBasePrc;
                 re.reshowGljBasePrc(re.currentGlj);
                 re.reshowGljBasePrc(re.currentGlj);
-                //updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
             }
             }
             updateArr.push(re.currentGlj);
             updateArr.push(re.currentGlj);
             that.updateComponent(updateArr);
             that.updateComponent(updateArr);
@@ -282,7 +276,7 @@ let componentTypeTreeOprObj = {
     }
     }
 }
 }
 $(document).ready(function () {
 $(document).ready(function () {
-    $('#gljSearchKeyword').change(function () {
+    $('#gljSearchKeyword').bind('keyup', function () {
         componentOprObj.filterDatasAndShow();
         componentOprObj.filterDatasAndShow();
     });
     });
     $('#gljSearchKeyword').bind('keypress', function (e) {
     $('#gljSearchKeyword').bind('keypress', function (e) {

+ 71 - 33
web/building_saas/complementary_glj_lib/js/glj.js

@@ -60,8 +60,10 @@ let pageOprObj = {
         //repositoryGljObj.getRationGljIds(gljLibId);
         //repositoryGljObj.getRationGljIds(gljLibId);
         repositoryGljObj.getGljDistType(function () {
         repositoryGljObj.getGljDistType(function () {
             repositoryGljObj.currentRepositoryId = me.stdGljLibId;
             repositoryGljObj.currentRepositoryId = me.stdGljLibId;
-            repositoryGljObj.getGljItems(me.stdGljLibId, function () {
-                gljClassTreeObj.getGljClassTree(stdGljLibId);
+            gljClassTreeObj.getGljClassTree(stdGljLibId, function () {
+                repositoryGljObj.getGljItems(me.stdGljLibId, function () {
+                    gljClassTreeObj.initSelection(gljClassTreeObj.tree.selected);
+                });
             });
             });
         });
         });
     }
     }
@@ -70,6 +72,10 @@ let pageOprObj = {
 let repositoryGljObj = {
 let repositoryGljObj = {
     treeObj : null,
     treeObj : null,
     workBook: null,
     workBook: null,
+    // 是否获取了完整的人材机数据
+    // 第一次打开页面只加载补充人材机和标准人材机的编码
+    // 第一次打开选择组成物的窗口才加载标准人材机剩余数据
+    pullCompleteData: false,
     gljCurTypeId: -1,
     gljCurTypeId: -1,
     currentRepositoryId: -1,
     currentRepositoryId: -1,
     currentCache: null,
     currentCache: null,
@@ -83,7 +89,7 @@ let repositoryGljObj = {
         header:[
         header:[
             {headerName:"编码",headerWidth:80,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
             {headerName:"编码",headerWidth:80,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
             {headerName:"名称",headerWidth:160,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
             {headerName:"名称",headerWidth:160,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
-            {headerName:"规格型号",headerWidth:120,dataCode:"specs", dataType: "String", hAlign: "left", vAlign: "center"},
+            {headerName:"规格型号",headerWidth:120,dataCode:"specs", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
             {headerName:"单位",headerWidth:45,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"单位",headerWidth:45,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"定额价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
             {headerName:"定额价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
             {headerName:"类型",headerWidth:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"类型",headerWidth:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
@@ -179,8 +185,19 @@ let repositoryGljObj = {
         });
         });
     },
     },
     getGljItems: function(stdGljLibId, callback) {
     getGljItems: function(stdGljLibId, callback) {
-        let me = this;
-        CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
+        let me = this,
+            // 一开始获取的标准人材机只包含code,提升打开页面速度
+            projection = {
+                _id: 0,
+                ID: 1,
+                code: 1,
+                unit: 1,
+                name: 1,
+                priceProperty: 1,
+                basePrice: 1
+            };
+        $.bootstrapLoading.start();
+        CommonAjax.post('/complementartGlj/api/getGljItems', {stdGljLibId, projection}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
             me.stdGljList = rstData.stdGljs;
             //兼容多单价情况
             //兼容多单价情况
             for(let sGlj of me.stdGljList){
             for(let sGlj of me.stdGljList){
@@ -188,14 +205,44 @@ let repositoryGljObj = {
                     sGlj.basePrice = sGlj.priceProperty.price1;
                     sGlj.basePrice = sGlj.priceProperty.price1;
                 }
                 }
             }
             }
-            me.complementaryGljList = rstData.complementaryGljs;
-            me.workBook.getSheet(0).setRowCount(me.stdGljList.length);
             me.sortGlj(me.stdGljList);
             me.sortGlj(me.stdGljList);
             me.setProp('isStd', true, me.stdGljList);
             me.setProp('isStd', true, me.stdGljList);
+            me.complementaryGljList = rstData.complementaryGljs;
             me.sortGlj(me.complementaryGljList);
             me.sortGlj(me.complementaryGljList);
             if(callback){
             if(callback){
                 callback();
                 callback();
             }
             }
+            $.bootstrapLoading.end();
+        }, function () {
+            $.bootstrapLoading.end();
+        });
+    },
+    // 获取标准人材机数据
+    getStdItems: function (stdGljLibId, callback) {
+        $.bootstrapLoading.start();
+        let me = this;
+        let projection = {
+            _id: 0,
+            ID: 1,
+            specs: 1,
+            gljType: 1,
+            shortName: 1,
+            gljClass: 1
+        };
+        CommonAjax.post('/complementartGlj/api/getStdItems', {stdGljLibId, projection}, function (data) {
+            me.pullCompleteData = true;
+            // 更新标准人材机数据
+            let IDMapping = {};
+            for (let glj of data) {
+                IDMapping[glj.ID] = glj;
+            }
+            for (let glj of me.stdGljList) {
+                Object.assign(glj, IDMapping[glj.ID]);
+            }
+            callback();
+            $.bootstrapLoading.end();
+        }, function () {
+            $.bootstrapLoading.end();
         });
         });
     },
     },
     showGljItems: function(data, type) {
     showGljItems: function(data, type) {
@@ -283,32 +330,23 @@ let repositoryGljObj = {
     },
     },
 
 
     getCurrentComponent: function (gljComponent) {
     getCurrentComponent: function (gljComponent) {
-        let me = repositoryGljObj, rst = [];
-        for(let i = 0; i < gljComponent.length; i++){
-            let obj = {};
-            for(let j = 0; j < me.complementaryGljList.length; j++){
-                if(gljComponent[i].ID == me.complementaryGljList[j].ID){
-                    obj.isStd = false;
-                    obj.ID = me.complementaryGljList[j].ID;
-                    obj.code = me.complementaryGljList[j].code;
-                    obj.name = me.complementaryGljList[j].name;
-                    obj.unit = me.complementaryGljList[j].unit;
-                    obj.basePrice = me.complementaryGljList[j].basePrice;
-                    obj.consumeAmt = gljComponent[i].consumeAmt;
-                    rst.push(obj);
-                }
-            }
-            for(let j = 0; j < me.stdGljList.length; j++){
-                if(gljComponent[i].ID == me.stdGljList[j].ID){
-                    obj.isStd = true;
-                    obj.ID = me.stdGljList[j].ID;
-                    obj.code = me.stdGljList[j].code;
-                    obj.name = me.stdGljList[j].name;
-                    obj.unit = me.stdGljList[j].unit;
-                    obj.basePrice = me.stdGljList[j].basePrice;
-                    obj.consumeAmt = gljComponent[i].consumeAmt;
-                    rst.push(obj);
-                }
+        let me = repositoryGljObj,
+            rst = [];
+        for(let thisGlj of gljComponent){
+            let toFindGljList = thisGlj.isStd
+                ? me.stdGljList
+                : me.complementaryGljList;
+            let matchGlj = toFindGljList.find(glj => glj.ID === thisGlj.ID);
+            if (matchGlj) {
+                rst.push({
+                    isStd: thisGlj.isStd ? true : false,
+                    ID: matchGlj.ID,
+                    code: matchGlj.code,
+                    name: matchGlj.name,
+                    unit: matchGlj.unit,
+                    basePrice: matchGlj.basePrice,
+                    consumeAmt: thisGlj.consumeAmt
+                });
             }
             }
         }
         }
         rst.sort(function (a, b) {
         rst.sort(function (a, b) {

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

@@ -111,7 +111,6 @@ let gljClassTreeObj = {
     },
     },
 
 
     getGljClassTree: function (gljLibId, callback) {
     getGljClassTree: function (gljLibId, callback) {
-        console.log('enter1');
         let me = gljClassTreeObj;
         let me = gljClassTreeObj;
         let re = repositoryGljObj;
         let re = repositoryGljObj;
         let url = '/complementartGlj/api/getMixedTree';
         let url = '/complementartGlj/api/getMixedTree';
@@ -119,11 +118,6 @@ let gljClassTreeObj = {
         let sucFunc = function (rstData) {
         let sucFunc = function (rstData) {
             me.treeData = rstData;
             me.treeData = rstData;
             let compleTreeData = me.treeData.comple;
             let compleTreeData = me.treeData.comple;
-            /*zTreeHelper.createTree(rstData.std, componentSetting, "componentTree", componentOprObj);
-            let rootNode = componentOprObj.treeObj.getNodes()[0];
-            if(rootNode && rootNode.isParent && rootNode.isFirstNode){
-                componentOprObj.rootNode = rootNode;
-            }*/
             if (compleTreeData && compleTreeData.length > 0) {
             if (compleTreeData && compleTreeData.length > 0) {
                 me.gljCurTypeId = compleTreeData[0].ID;
                 me.gljCurTypeId = compleTreeData[0].ID;
             }
             }
@@ -135,15 +129,11 @@ let gljClassTreeObj = {
             me.initController(me.tree, me.sheet, me.setting.sheet);
             me.initController(me.tree, me.sheet, me.setting.sheet);
             me.controller.showTreeData();
             me.controller.showTreeData();
             me.sheet.setFormatter(-1, 0, '@');
             me.sheet.setFormatter(-1, 0, '@');
-            me.initSelection(me.tree.selected);
             if(callback){
             if(callback){
                 callback();
                 callback();
             }
             }
         };
         };
-        let errFunc = function () {
-
-        };
-        CommonAjax.post(url, postData, sucFunc, errFunc);
+        CommonAjax.post(url, postData, sucFunc);
     },
     },
 
 
     initTree: function (datas) {
     initTree: function (datas) {
@@ -155,10 +145,6 @@ let gljClassTreeObj = {
     initController: function (tree, sheet, setting) {
     initController: function (tree, sheet, setting) {
         this.controller = TREE_SHEET_CONTROLLER.createNew(tree, sheet, setting);
         this.controller = TREE_SHEET_CONTROLLER.createNew(tree, sheet, setting);
     },
     },
-
-    gljClassTreeAjax: function (postData, scFunc, errFunc) {
-        CommonAjax.post('api/updateNodes', {updateData: postData, lastOpr: userAccount}, scFunc, errFunc);
-    },
     //模仿默认点击
     //模仿默认点击
     initSelection: function (node) {
     initSelection: function (node) {
         let me = this,
         let me = this,

+ 14 - 7
web/building_saas/complementary_glj_lib/js/gljComponent.js

@@ -92,13 +92,20 @@ let gljComponentOprObj = {
                         callback: function(){},
                         callback: function(){},
                         items: {
                         items: {
                             "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
                             "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
-                                //默认radio所有工料机
-                                co.initRadio();
-                                co.gljCurTypeId = null;
-                                //默认点击树根节点
-                                co.initClassTree('std', gljClassTreeObj.treeData.std);
-                                //弹出窗口
-                                $('#component').modal('show');
+                                let oprFunc = function () {
+                                    //默认radio所有工料机
+                                    co.initRadio();
+                                    co.gljCurTypeId = null;
+                                    //默认点击树根节点
+                                    co.initClassTree('std', gljClassTreeObj.treeData.std);
+                                    //弹出窗口
+                                    $('#component').modal('show');
+                                };
+                                if (repositoryGljObj.pullCompleteData) {
+                                    oprFunc();
+                                } else {
+                                    repositoryGljObj.getStdItems(pageOprObj.stdGljLibId, oprFunc);
+                                }
                             }},
                             }},
                             "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
                             "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
                                 //删除
                                 //删除

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

@@ -43,6 +43,7 @@ let sheetOpr = {
         spreadBook.options.allowCopyPasteExcelStyle = false;
         spreadBook.options.allowCopyPasteExcelStyle = false;
         spreadBook.options.allowExtendPasteRange = true;
         spreadBook.options.allowExtendPasteRange = true;
         spreadBook.options.allowUserDragDrop = false;
         spreadBook.options.allowUserDragDrop = false;
+        spreadBook.options.allowUserDragFill = false;
         spreadBook.options.allowContextMenu = false;
         spreadBook.options.allowContextMenu = false;
         var spreadNS = GC.Spread.Sheets;
         var spreadNS = GC.Spread.Sheets;
         var sheet = spreadBook.getSheet(0);
         var sheet = spreadBook.getSheet(0);

+ 2 - 13
web/building_saas/complementary_ration_lib/js/ration.js

@@ -726,49 +726,38 @@ let rationOprObj = {
             sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
             sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
             sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
             sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
             sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
             sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
-            //sheetInst = rationInstObj.sheet, settingInst = rationInstObj.setting;
         if (me.workBook) {
         if (me.workBook) {
-            if (me.currentRations && me.currentRations["_SEC_ID_" + sectionID] && me.currentRations["_SEC_ID_" + sectionID].length > 0) {
+            sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
+            if (me.currentRations && me.currentRations["_SEC_ID_" + sectionID]) {
                 let cacheSection = me.currentRations["_SEC_ID_" + sectionID];
                 let cacheSection = me.currentRations["_SEC_ID_" + sectionID];
-                sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
                 sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection);
                 sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection);
-                //combo
-                //sheetCommonObj.setStaticCombo(me.workBook.getActiveSheet(), 0, 2, cacheSection.length, rationUnits, 10, false);
-                //--sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 2, me.workBook.getActiveSheet().getRowCount(), rationUnits, 10, false);
                 if(me.mixDel === 1){
                 if(me.mixDel === 1){
                     let row = me.workBook.getSheet(0).getSelections()[0].row;
                     let row = me.workBook.getSheet(0).getSelections()[0].row;
                     if (cacheSection && row < cacheSection.length) {
                     if (cacheSection && row < cacheSection.length) {
                         sheetCommonObj.cleanData(sheetGLJ, settingGLJ, -1);
                         sheetCommonObj.cleanData(sheetGLJ, settingGLJ, -1);
                         sheetCommonObj.cleanData(sheetCoe, settingCoe, -1);
                         sheetCommonObj.cleanData(sheetCoe, settingCoe, -1);
                         sheetCommonObj.cleanData(sheetAss, settingAss, -1);
                         sheetCommonObj.cleanData(sheetAss, settingAss, -1);
-                        //sheetCommonObj.cleanData(sheetInst, settingInst, -1);
                         rationGLJOprObj.getGljItems(cacheSection[row]);
                         rationGLJOprObj.getGljItems(cacheSection[row]);
                         rationCoeOprObj.getCoeItems(cacheSection[row]);
                         rationCoeOprObj.getCoeItems(cacheSection[row]);
                         rationAssistOprObj.getAssItems(cacheSection[row]);
                         rationAssistOprObj.getAssItems(cacheSection[row]);
-                        //rationInstObj.getInstItems(cacheSection[row]);
                     }
                     }
                     else {
                     else {
                         rationGLJOprObj.currentRationItem = null;
                         rationGLJOprObj.currentRationItem = null;
                         sheetCommonObj.cleanData(sheetGLJ, settingGLJ, -1);
                         sheetCommonObj.cleanData(sheetGLJ, settingGLJ, -1);
                         sheetCommonObj.cleanData(sheetCoe, settingCoe, -1);
                         sheetCommonObj.cleanData(sheetCoe, settingCoe, -1);
                         sheetCommonObj.cleanData(sheetAss, settingAss, -1);
                         sheetCommonObj.cleanData(sheetAss, settingAss, -1);
-                        //sheetCommonObj.cleanData(sheetInst, settingInst, -1);
                         sheetCommonObj.setDynamicCombo(sheetAss, 0, 5, sheetAss.getRowCount(), rationAssistOprObj.setting.comboItems, false, false);
                         sheetCommonObj.setDynamicCombo(sheetAss, 0, 5, sheetAss.getRowCount(), rationAssistOprObj.setting.comboItems, false, false);
                     }
                     }
                 }
                 }
 
 
             } else {
             } else {
                 sheetCommonObj.setDynamicCombo(sheetAss, 0, 5, sheetAss.getRowCount(), rationAssistOprObj.setting.comboItems, false, false);
                 sheetCommonObj.setDynamicCombo(sheetAss, 0, 5, sheetAss.getRowCount(), rationAssistOprObj.setting.comboItems, false, false);
-                //--sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 2, me.workBook.getActiveSheet().getRowCount(), rationUnits, 10, false);
                 //清除ration数据及工料机数据
                 //清除ration数据及工料机数据
                 rationGLJOprObj.currentRationItem = null;
                 rationGLJOprObj.currentRationItem = null;
-                sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
                 sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
                 sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
                 sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
                 sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
                 sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
                 sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
-                //sheetCommonObj.cleanSheet(sheetInst, settingInst, -1);
             }
             }
-            //--- me.workBook.focus(true);
         }
         }
         sectionTreeObj.workBook.focus(true);
         sectionTreeObj.workBook.focus(true);
     },
     },

+ 4 - 0
web/building_saas/css/custom.css

@@ -319,4 +319,8 @@ input.text-right{
     display: none;
     display: none;
     color: #43CD80;
     color: #43CD80;
     margin-left: 8px
     margin-left: 8px
+}
+/*占位底色*/
+.occupied {
+    background: #f1f1f1;
 }
 }

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

@@ -41,6 +41,7 @@
         let userID = '<%- userID %>';
         let userID = '<%- userID %>';
         let projectReadOnly = JSON.parse('<%- projectReadOnly %>');
         let projectReadOnly = JSON.parse('<%- projectReadOnly %>');
         let projectCooperate = JSON.parse('<%- projectCooperate %>');
         let projectCooperate = JSON.parse('<%- projectCooperate %>');
+        let projectOptins =  JSON.parse('<%- options %>');
         const G_SHOW_BLOCK_LIB = false;
         const G_SHOW_BLOCK_LIB = false;
 //        const G_SHOW_BLOCK_LIB = false;
 //        const G_SHOW_BLOCK_LIB = false;
     </script>
     </script>
@@ -352,16 +353,16 @@
                                                   <input class="form-check-input" type="radio" name="content_type" id="raion_glj" value="ration_glj">
                                                   <input class="form-check-input" type="radio" name="content_type" id="raion_glj" value="ration_glj">
                                                   <label class="form-check-label" for="raion_glj">工料机</label>
                                                   <label class="form-check-label" for="raion_glj">工料机</label>
                                               </div>
                                               </div>
-                                          <!--    <div class="form-check form-check-inline">
+                                              <div class="form-check form-check-inline">
                                                   <input class="form-check-input" type="radio" name="content_type" id="bookmark" value="bookmark">
                                                   <input class="form-check-input" type="radio" name="content_type" id="bookmark" value="bookmark">
                                                   <label class="form-check-label" for="bookmark">书签批注</label>
                                                   <label class="form-check-label" for="bookmark">书签批注</label>
-                                              </div>-->
+                                              </div>
                                           </div>
                                           </div>
                                           <!--搜索分项/清单 出现-->
                                           <!--搜索分项/清单 出现-->
                                           <div class="col-12"  id="outstandingOptions">
                                           <div class="col-12"  id="outstandingOptions">
                                               <div class="form-group form-check mb-0">
                                               <div class="form-group form-check mb-0">
                                                   <input type="checkbox" class="form-check-input" id ="outstanding">
                                                   <input type="checkbox" class="form-check-input" id ="outstanding">
-                                                  <label class="form-check-label" for="outstanding">超 <input type="number" style="width:50px"> % 时突出显示</label>
+                                                  <label class="form-check-label" for="outstanding">超 <input id="outInp" type="number" style="width:50px"> % 时突出显示</label>
                                               </div>
                                               </div>
                                           </div>
                                           </div>
                                       </div>
                                       </div>
@@ -432,7 +433,7 @@
                                                                   <input type="text" class="form-control" placeholder="描述">
                                                                   <input type="text" class="form-control" placeholder="描述">
                                                               </div>
                                                               </div>
                                                           </div>
                                                           </div>
-                                                          <button  class="btn btn-sm btn-primary">确定</button>
+                                                          <button  class="btn btn-sm btn-primary" id = "bookmarkSettingConfirm">确定</button>
                                                       </form>
                                                       </form>
                                                   </div>
                                                   </div>
                                               </div>
                                               </div>
@@ -443,6 +444,8 @@
                                       <div class=" container-fluid" id="annotationDiv">
                                       <div class=" container-fluid" id="annotationDiv">
                                           <div class="row">
                                           <div class="row">
                                               <div class="col-lg-12" style="padding: 0px" >
                                               <div class="col-lg-12" style="padding: 0px" >
+                                                  <input type="hidden" id="bookmarkNodeID">
+                                                  <input type="hidden" id="bookmarkNodeType">
                                                   <textarea class="form-control" id="annotationTextarea"  placeholder = "批注内容"></textarea>
                                                   <textarea class="form-control" id="annotationTextarea"  placeholder = "批注内容"></textarea>
                                               </div>
                                               </div>
                                           </div>
                                           </div>
@@ -451,7 +454,7 @@
                               </div>
                               </div>
 
 
                               <!--清单指引-->
                               <!--清单指引-->
-                              <div class="tab-pane" id="zy">
+                              <div class="tab-pane occupied" id="zy">
                                   <div class="sidebar-tools-bar container-fluid tools-bar-height-z">
                                   <div class="sidebar-tools-bar container-fluid tools-bar-height-z">
                                       <div class="p-1 row">
                                       <div class="p-1 row">
                                           <div class="col p-0">
                                           <div class="col p-0">
@@ -1449,7 +1452,7 @@
                         </label>
                         </label>
                     </div>
                     </div>
                     <div class="form-check">
                     <div class="form-check">
-                        <input class="form-check-input zlfb-check" type="checkbox" checked id="bill_recode"  >
+                        <input class="form-check-input zlfb-check" type="checkbox"  id="bill_recode"  >
                         <label class="form-check-label">
                         <label class="form-check-label">
                             清单重新编码
                             清单重新编码
                         </label>
                         </label>

+ 4 - 4
web/building_saas/main/js/models/bills.js

@@ -42,10 +42,10 @@ var Bills = {
                 }
                 }
                 if (uData.fees) {
                 if (uData.fees) {
                     for (let fee of uData.fees) {
                     for (let fee of uData.fees) {
-                        fee.unitFee = fee.unitFee.toFixed(2);
-                        fee.totalFee = fee.totalFee.toFixed(2);
-                        fee.tenderUnitFee = fee.tenderUnitFee.toFixed(2);
-                        fee.tenderTotalFee = fee.tenderTotalFee.toFixed(2);
+                        if(fee.unitFee) fee.unitFee = fee.unitFee.toFixed(2);
+                        if(fee.totalFee) fee.totalFee = fee.totalFee.toFixed(2);
+                        if(fee.tenderUnitFee) fee.tenderUnitFee = fee.tenderUnitFee.toFixed(2);
+                        if(fee.tenderTotalFee) fee.tenderTotalFee = fee.tenderTotalFee.toFixed(2);
                     }
                     }
                 }
                 }
                 return uData;
                 return uData;

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

@@ -2,6 +2,11 @@
  * Created by CSL on 2017-07-19.
  * Created by CSL on 2017-07-19.
  * 计算程序。所有定额、清单、父清单的计算都从此入。
  * 计算程序。所有定额、清单、父清单的计算都从此入。
  */
  */
+ 
+ /**
+ * Created by CSL on 2017-07-19.
+ * 计算程序。所有定额、清单、父清单的计算都从此入。
+ */
 
 
 let calcTools = {
 let calcTools = {
     getNodeByFlag: function (flag) {
     getNodeByFlag: function (flag) {
@@ -108,7 +113,7 @@ let calcTools = {
         delete treeNode.data.gljList;
         delete treeNode.data.gljList;
         if (this.isRationCategory(treeNode)) {
         if (this.isRationCategory(treeNode)) {
             if (treeNode.data.type != rationType.volumePrice) {
             if (treeNode.data.type != rationType.volumePrice) {
-                treeNode.data.gljList = projectObj.project.ration_glj.getGljArrByRation(treeNode.data);
+                treeNode.data.gljList = projectObj.project.calcProgram.getGljArrByRation(treeNode.data);
             }
             }
         }
         }
         else if (this.isBill(treeNode)){
         else if (this.isBill(treeNode)){
@@ -463,15 +468,21 @@ let calcTools = {
             sumU = undefined;
             sumU = undefined;
         }
         }
         else if (me.isLeafBill(treeNode)){
         else if (me.isLeafBill(treeNode)){
-            if (isGather){
-                me.getGLJList(treeNode, false);
-                sumT = eTFee();
+            if (projectObj.project.Bills.isEngineerEst(treeNode)){
+                sumT = treeNode.data.feesIndex['common'].totalFee;
+                sumU = treeNode.data.feesIndex['common'].unitFee;
             }
             }
-            else
-                sumT = eTFeeByChildren();
+            else{
+                if (isGather){
+                    me.getGLJList(treeNode, false);
+                    sumT = eTFee();
+                }
+                else
+                    sumT = eTFeeByChildren();
 
 
-            let q = nodeQ ? nodeQ : 1;
-            sumU = (sumT / q).toDecimal(decimalObj.bills.totalPrice);
+                let q = nodeQ ? nodeQ : 1;
+                sumU = (sumT / q).toDecimal(decimalObj.bills.totalPrice);
+            }
         }
         }
         else if (me.isRationCategory(treeNode)){
         else if (me.isRationCategory(treeNode)){
             me.getGLJList(treeNode, false);
             me.getGLJList(treeNode, false);
@@ -1404,6 +1415,8 @@ class CalcProgram {
         let me = this;
         let me = this;
         me.project = project;
         me.project = project;
         me.datas = [];
         me.datas = [];
+        me.rationMap = null;//定额 - 工料机映射临时变量
+        me.pgljMap = null;
         project.registerModule(ModuleNames.calc_program, me);
         project.registerModule(ModuleNames.calc_program, me);
     };
     };
 
 
@@ -1626,6 +1639,8 @@ class CalcProgram {
         };
         };
 
 
         let me = this;
         let me = this;
+        //设置定额工料机映射表
+        me.setRationMap();
         me.setUpdateDataToNode(treeNode);                                       // 先更新要计算的节点信息
         me.setUpdateDataToNode(treeNode);                                       // 先更新要计算的节点信息
         if(!treeNode.temData) treeNode.temData = _.cloneDeep(treeNode.data);    // 有可能会有多次计算,只有第一次才保存原始数据,用来对于更新。
         if(!treeNode.temData) treeNode.temData = _.cloneDeep(treeNode.data);    // 有可能会有多次计算,只有第一次才保存原始数据,用来对于更新。
 
 
@@ -1841,6 +1856,8 @@ class CalcProgram {
     saveNodes(treeNodes, callback){
     saveNodes(treeNodes, callback){
         if (treeNodes.length < 1) {
         if (treeNodes.length < 1) {
             $.bootstrapLoading.end();
             $.bootstrapLoading.end();
+            this.rationMap = null;
+            this.pgljMap = null;
             return;
             return;
         }
         }
 
 
@@ -1870,15 +1887,14 @@ class CalcProgram {
             return;
             return;
         };
         };
         $.bootstrapLoading.start();
         $.bootstrapLoading.start();
-        let startTime = +new Date();
         me.project.updateNodes(dataArr, function (data) {
         me.project.updateNodes(dataArr, function (data) {
-            let endShowTime = +new Date();
-            console.log(`保存所需时间——${endShowTime - startTime}`);
             for (let node of treeNodes){
             for (let node of treeNodes){
                 delete node.changed;
                 delete node.changed;
                 delete node.temData;
                 delete node.temData;
                 node.updateData = {};
                 node.updateData = {};
             };
             };
+            me.rationMap = null;
+            me.pgljMap = null;
             if(callback){
             if(callback){
                 callback(data);
                 callback(data);
             };
             };
@@ -1976,7 +1992,7 @@ class CalcProgram {
                 rationNodes.push(node)
                 rationNodes.push(node)
             else
             else
                 billNodes.push(node);
                 billNodes.push(node);
-        };
+        }
 
 
         // 多条定额同属一条叶子清单时,避免叶子清单重复计算
         // 多条定额同属一条叶子清单时,避免叶子清单重复计算
         for (let ration of rationNodes) {
         for (let ration of rationNodes) {
@@ -1984,14 +2000,14 @@ class CalcProgram {
             let leafBill = ration.parent;
             let leafBill = ration.parent;
             if (leafBill && leafBills.indexOf(leafBill) < 0)
             if (leafBill && leafBills.indexOf(leafBill) < 0)
                 leafBills.push(leafBill);
                 leafBills.push(leafBill);
-        };
+        }
 
 
         billNodes.merge(leafBills);
         billNodes.merge(leafBills);
 
 
         for (let bill of billNodes){
         for (let bill of billNodes){
             let changeBills = me.calculate(bill, true, false, tender);
             let changeBills = me.calculate(bill, true, false, tender);
             allChangedNodes.merge(changeBills);
             allChangedNodes.merge(changeBills);
-        };
+        }
 
 
         me.calcFormulaNodes(allChangedNodes, tender);
         me.calcFormulaNodes(allChangedNodes, tender);
         me.saveNodes(allChangedNodes, callback);
         me.saveNodes(allChangedNodes, callback);
@@ -2015,10 +2031,10 @@ class CalcProgram {
                     while (curNode){
                     while (curNode){
                         me.innerCalc(curNode, changedArr, tender);
                         me.innerCalc(curNode, changedArr, tender);
                         curNode = curNode.parent;
                         curNode = curNode.parent;
-                    };
-                };
-            };
-        };
+                    }
+                }
+            }
+        }
     };
     };
 
 
     // 计算叶子清单下的所有子结点、自身、所有父结点、公式引用结点(即跟该叶子清单相关的所有结点)。最后打包存储。
     // 计算叶子清单下的所有子结点、自身、所有父结点、公式引用结点(即跟该叶子清单相关的所有结点)。最后打包存储。
@@ -2129,6 +2145,37 @@ class CalcProgram {
 
 
 
 
     };
     };
+
+    setRationMap(){
+        if(this.rationMap == null){
+            this.rationMap = {};
+            for(let glj of projectObj.project.ration_glj.datas){
+                if(this.rationMap[glj.rationID]){
+                    this.rationMap[glj.rationID].push(glj)
+                }else {
+                    this.rationMap[glj.rationID] = [glj];
+                }
+            }
+        }
+        if(this.pgljMap == null ){
+            this.pgljMap = _.indexBy(projectObj.project.projectGLJ.datas.gljList, 'id');
+        }
+    };
+    getGljArrByRation(ration){
+        if (ration.type == rationType.gljRation){
+            let glj = JSON.parse(JSON.stringify(ration));
+            glj.type = glj.subType;
+            glj.quantity = 1;
+            glj.totalQuantity = parseFloatPlus(ration.quantity);
+            return [glj];
+        } else{
+            if(!this.rationMap) return [];
+            let result = this.rationMap[ration.ID];
+            if(!result) return [];
+            result = gljOprObj.combineWithProjectGlj(result,false,ration,this.pgljMap);
+            return result;
+        }
+    }
 };
 };
 
 
 // export default analyzer;
 // export default analyzer;

+ 12 - 11
web/building_saas/main/js/models/ration.js

@@ -564,6 +564,7 @@ var Ration = {
             let billItemID = null,serialNo=1,nextID=null;
             let billItemID = null,serialNo=1,nextID=null;
             let needInstall = false;
             let needInstall = false;
             if (selected === null) { return null; }
             if (selected === null) { return null; }
+            let startTime = +new Date();
             if (selected.sourceType === project.Bills.getSourceType() && selected.depth() > 0) {
             if (selected.sourceType === project.Bills.getSourceType() && selected.depth() > 0) {
                 if(selected.data.type === billType.FB){
                 if(selected.data.type === billType.FB){
                     return null;
                     return null;
@@ -613,18 +614,18 @@ var Ration = {
                         syncNodeOper(data);
                         syncNodeOper(data);
                         if(callback) callback(newNode);
                         if(callback) callback(newNode);
                     }else {
                     }else {
-                        project.projectGLJ.loadData(function () {
-                            syncNodeOper(data);
-                            if (newNode.parent.data.calcFlag)        // 删除定额时不用改Flag,反正添加定额时已经改好了。
-                                newNode.parent.updateData.calcFlag = null;
-                            project.calcProgram.calcAndSave(newNode,function () {
-                                if(project.Bills.isFBFX(newNode)) { //判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
-                                    installationFeeObj.calcInstallationFee();
-                                }
-                            });
-                            //如果添加规则中,添加内容为定额子目,则更新相关清单
-                            if(callback) callback(newNode);
+                        if(data.projectGLJDatas) projectObj.project.projectGLJ.refreshByDatas(data.projectGLJDatas);
+                        syncNodeOper(data);
+                        if (newNode.parent.data.calcFlag)  newNode.parent.updateData.calcFlag = null;    // 删除定额时不用改Flag,反正添加定额时已经改好了。
+                        project.calcProgram.calcAndSave(newNode,function () {
+                            let endShowTime = +new Date();
+                            console.log(`插入定额总时间——${endShowTime - startTime}`);
+                            if(project.Bills.isFBFX(newNode)) { //判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
+                                installationFeeObj.calcInstallationFee();
+                            }
                         });
                         });
+                        //如果添加规则中,添加内容为定额子目,则更新相关清单
+                        if(callback) callback(newNode);
                     }
                     }
                     $.bootstrapLoading.end();
                     $.bootstrapLoading.end();
                 });
                 });

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

@@ -40,27 +40,6 @@ let ration_glj = {
             this.datas = datas;
             this.datas = datas;
         };
         };
 
 
-        ration_glj.prototype.getGljArrByRation = function (ration) {
-            if (ration.type == rationType.gljRation){
-                let glj = JSON.parse(JSON.stringify(ration));
-                glj.type = glj.subType;
-                glj.quantity = 1;
-                glj.totalQuantity = parseFloatPlus(ration.quantity);
-                return [glj];
-            }
-            else{
-                let result = this.datas.filter(function (data) {
-                    if(data.rationID === ration.ID){
-                        gljOprObj.getTotalQuantity(data, ration);
-                        return true;
-                    }
-                    return false;
-                })
-                result = gljOprObj.combineWithProjectGlj(result);
-                return result;
-            }
-        };
-
         ration_glj.prototype.getGLJListByRationID = function (rationID) {
         ration_glj.prototype.getGLJListByRationID = function (rationID) {
             return  _.filter(this.datas, {'rationID': rationID})
             return  _.filter(this.datas, {'rationID': rationID})
         };
         };
@@ -93,9 +72,8 @@ let ration_glj = {
                     glj.basePrice = glj.marketUnitFee;
                     glj.basePrice = glj.marketUnitFee;
                     glj.adjustPrice = glj.marketUnitFee;
                     glj.adjustPrice = glj.marketUnitFee;
                     result.push(glj);
                     result.push(glj);
-                }
-                else{
-                    let rationGljs = this.getGljArrByRation(ration);
+                } else{
+                    let rationGljs = projectObj.project.calcProgram.getGljArrByRation(ration);
                     for (let glj of rationGljs) {
                     for (let glj of rationGljs) {
                         let sameGlj = findGlj(glj, result);
                         let sameGlj = findGlj(glj, result);
                         if (!sameGlj) {
                         if (!sameGlj) {

+ 5 - 4
web/building_saas/main/js/views/glj_view.js

@@ -702,27 +702,28 @@ var gljOprObj = {
         }
         }
         this.sheetData = newList;
         this.sheetData = newList;
     },
     },
-    combineWithProjectGlj: function (ration_gljs,needRatio=true) {
+    combineWithProjectGlj: function (ration_gljs,needRatio=true,ration,p_gljMap) {
         let projectGLJData = projectObj.project.projectGLJ.datas;
         let projectGLJData = projectObj.project.projectGLJ.datas;
         let projectGljs = projectGLJData.gljList;
         let projectGljs = projectGLJData.gljList;
         let mixRatioMap = projectGLJData.mixRatioMap;
         let mixRatioMap = projectGLJData.mixRatioMap;
         if (ration_gljs && ration_gljs.length > 0 && projectGljs && projectGljs.length > 0) {
         if (ration_gljs && ration_gljs.length > 0 && projectGljs && projectGljs.length > 0) {
-
+            let pgljMap = p_gljMap?p_gljMap:_.indexBy(projectGljs, 'id');
             for (let i = 0; i < ration_gljs.length; i++) {
             for (let i = 0; i < ration_gljs.length; i++) {
-                let glj = _.find(projectGljs, {'id': ration_gljs[i].projectGLJID});
+                let glj = pgljMap[ration_gljs[i].projectGLJID];
                 if (glj) {
                 if (glj) {
                     if(projectObj.project.projectGLJ.isEstimateType(ration_gljs[i].type )){
                     if(projectObj.project.projectGLJ.isEstimateType(ration_gljs[i].type )){
                         ration_gljs[i].isEstimate = glj.is_evaluate;
                         ration_gljs[i].isEstimate = glj.is_evaluate;
                     }
                     }
                     ration_gljs[i].shortName =projectObj.project.projectGLJ.getShortNameByID(ration_gljs[i].type);
                     ration_gljs[i].shortName =projectObj.project.projectGLJ.getShortNameByID(ration_gljs[i].type);
                     ration_gljs[i].isAdd = glj.unit_price.is_add;
                     ration_gljs[i].isAdd = glj.unit_price.is_add;
-                    ration_gljs[i]=this.setGLJPrice(ration_gljs[i],glj);//设置工料机价格
+                    ration_gljs[i]=this.setGLJPrice(ration_gljs[i],glj,false);//设置工料机价格
                     delete ration_gljs[i].subList; //置空,再设置
                     delete ration_gljs[i].subList; //置空,再设置
                     let connect_index = this.getIndex(glj, gljKeyArray);
                     let connect_index = this.getIndex(glj, gljKeyArray);
                     if (needRatio==true&&mixRatioMap.hasOwnProperty(connect_index)) {
                     if (needRatio==true&&mixRatioMap.hasOwnProperty(connect_index)) {
                         let mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs);
                         let mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs);
                         ration_gljs[i].subList = mixRatios;
                         ration_gljs[i].subList = mixRatios;
                     }
                     }
+                    if(ration) gljOprObj.getTotalQuantity(ration_gljs[i], ration);
                 }
                 }
             }
             }
         }
         }

+ 189 - 13
web/building_saas/main/js/views/locate_view.js

@@ -52,6 +52,8 @@ let locateObject={
             colHeaderHeight:30
             colHeaderHeight:30
         }
         }
     },
     },
+    bookmarkDatas:[],
+    seletedNodeID:null,//右键设置书签时选中的节点ID临时存储
     //为了兼容旧项目,这里给个默认值
     //为了兼容旧项目,这里给个默认值
     bookmarkPropertySetting:{
     bookmarkPropertySetting:{
         settingList :[
         settingList :[
@@ -102,10 +104,12 @@ let locateObject={
             this.bookmarkSpread = SheetDataHelper.createNewSpread($("#bookmarkSpread")[0]);
             this.bookmarkSpread = SheetDataHelper.createNewSpread($("#bookmarkSpread")[0]);
             sheetCommonObj.spreadDefaultStyle(this.bookmarkSpread);
             sheetCommonObj.spreadDefaultStyle(this.bookmarkSpread);
             this.initBookmarkSheet();
             this.initBookmarkSheet();
-           // this.subSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick,this.onSheetDoubleClick);
+            this.bookmarkSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick,this.onSheetDoubleClick);
+            if(!projectReadOnly) this.initBookmarkRightClick();
         }else {
         }else {
             this.bookmarkSpread.refresh();
             this.bookmarkSpread.refresh();
         }
         }
+        this.showBookmarkDatas();
     },
     },
     refreshWorkBook: function () {
     refreshWorkBook: function () {
         if (this.mainSpread) this.mainSpread.refresh();
         if (this.mainSpread) this.mainSpread.refresh();
@@ -124,6 +128,7 @@ let locateObject={
         sheetCommonObj.initSheet( this.bookmarkSheet, this.bookMarkSetting);
         sheetCommonObj.initSheet( this.bookmarkSheet, this.bookMarkSetting);
         this.bookmarkSheet.setRowCount(0);
         this.bookmarkSheet.setRowCount(0);
         this.bookmarkSheet.name('bookmark');
         this.bookmarkSheet.name('bookmark');
+        this.bookmarkSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.bookmarkSelectionChange);
     },
     },
     initOutstanding:function () {
     initOutstanding:function () {
         if(!projectObj.project.property.locateSetting) return;
         if(!projectObj.project.property.locateSetting) return;
@@ -154,6 +159,44 @@ let locateObject={
         sheetCommonObj.showData(this.subSheet,this.ration_setting,this.subRationDatas);
         sheetCommonObj.showData(this.subSheet,this.ration_setting,this.subRationDatas);
         this.subSheet.setRowCount(this.subRationDatas.length);
         this.subSheet.setRowCount(this.subRationDatas.length);
     },
     },
+    showBookmarkDatas:function(refresh = false){
+        let sheet = this.bookmarkSheet;
+        let sel = sheet.getSelections()[0];
+        let oldData = sel.row<this.bookmarkDatas.length?this.bookmarkDatas[sel.row]:null;
+        this.bookmarkDatas = this.getBookmarkDatas();
+        sheetCommonObj.showData(sheet, this.bookMarkSetting,this.bookmarkDatas);
+        let selectedID = null;
+        let focus = false;
+        if(oldData) selectedID = oldData.ID;
+        if(this.seletedNodeID && refresh == false){
+            selectedID =  this.seletedNodeID;
+            this.seletedNodeID = null;
+            focus = true;
+        }
+        sel.row = selectedID?_.findIndex(this.bookmarkDatas,{'ID':selectedID}):0;
+        sheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
+        sheet.setRowCount(this.bookmarkDatas.length);
+        if(sel.row!=-1) sheet.showRow(sel.row, GC.Spread.Sheets.VerticalPosition.bottom);
+        this.showAnnotation(sel.row,focus);
+    },
+    getBookmarkDatas:function(){
+        let datas = [];
+        let nodes = projectObj.project.mainTree.items;
+        for(let n of nodes){
+            if(!_.isEmpty(n.data.bookmarkBackground)){
+                let tem = {
+                    ID:n.data.ID,
+                    code:n.data.code,
+                    type:n.sourceType,
+                    name:n.data.name,
+                    bookmarkAnnotation:n.data.bookmarkAnnotation,
+                    bgColour:"#"+n.data.bookmarkBackground
+                };
+                datas.push(tem);
+            }
+        }
+        return datas;
+    },
 
 
     getSubRationDatas:function () {
     getSubRationDatas:function () {
         let datas = [];
         let datas = [];
@@ -175,28 +218,25 @@ let locateObject={
         let mainHeight = $(window).height()-$(".header").height()-$(".toolsbar").height()-$("#searchPanel").height();
         let mainHeight = $(window).height()-$(".header").height()-$(".toolsbar").height()-$("#searchPanel").height();
         let subHeight = 0;
         let subHeight = 0;
         if(options == "bookmark"){
         if(options == "bookmark"){
-            let bookMarkLibResize  = getBookmarkResize();
-            loadHeight(bookMarkLibResize);
+            loadHeight(getBookmarkResize());
         }else {
         }else {
             $('#locateTopDiv').height(mainHeight);
             $('#locateTopDiv').height(mainHeight);
             $('#locate_result').height(mainHeight);
             $('#locate_result').height(mainHeight);
             $('#locateBottomDiv').height(subHeight);
             $('#locateBottomDiv').height(subHeight);
             $('#locate_sub').height(subHeight - 7);
             $('#locate_sub').height(subHeight - 7);
             if(options == "ration_glj"){
             if(options == "ration_glj"){
-                let locateLibResize = getLocateLibResize();
-                loadHeight(locateLibResize);
+                loadHeight(getLocateLibResize());
             }
             }
         }
         }
+        if (refreshWorkBook) {
+            me.refreshWorkBook();
+        }
 
 
         function loadHeight(libResize) {
         function loadHeight(libResize) {
             SlideResize.loadVerticalHeight(libResize.eleObj.module, libResize.eleObj, libResize.limit, function () {
             SlideResize.loadVerticalHeight(libResize.eleObj.module, libResize.eleObj, libResize.limit, function () {
                 locateObject.refreshWorkBook();
                 locateObject.refreshWorkBook();
             });
             });
         }
         }
-
-        if (refreshWorkBook) {
-            me.refreshWorkBook();
-        }
     },
     },
     init:function () {
     init:function () {
         let me = this;
         let me = this;
@@ -368,6 +408,7 @@ let locateObject={
         if(options == "ration_glj"&&sheetName != "locate_sub" ) return;
         if(options == "ration_glj"&&sheetName != "locate_sub" ) return;
         let datas = options == "bills"? me.billsDatas:me.rationDatas;
         let datas = options == "bills"? me.billsDatas:me.rationDatas;
         if( args.sheet.name() == "locate_sub") datas = me.subRationDatas;
         if( args.sheet.name() == "locate_sub") datas = me.subRationDatas;
+        if(args.sheet.name() == "bookmark") datas = me.bookmarkDatas;
         me.locateNode(datas[args.row].ID);
         me.locateNode(datas[args.row].ID);
     },
     },
     gljSelectionChange:function (e,args) {
     gljSelectionChange:function (e,args) {
@@ -378,18 +419,140 @@ let locateObject={
             me.showSubRateDatas();
             me.showSubRateDatas();
         }
         }
     },
     },
+    bookmarkSelectionChange:function (e,args) {
+        let me = locateObject;
+        let newSel = args.newSelections[0];
+        let oldSel = args.oldSelections?args.oldSelections[0]:{};
+        if(newSel.row != oldSel.row){
+            me.showAnnotation(newSel.row);
+        }
+    },
+    showAnnotation:function (row,focus = false) {
+        let me = locateObject;
+        let recode =   me.bookmarkDatas[row];
+        if(recode){
+            $("#annotationTextarea").val(recode.bookmarkAnnotation);
+            $("#bookmarkNodeID").val(recode.ID);
+            $("#bookmarkNodeType").val(recode.type);
+            if(focus) $("#annotationTextarea").focus();
+        }
+    },
     locateNode:function (ID) {
     locateNode:function (ID) {
         let node =  projectObj.project.mainTree.findNode(ID);
         let node =  projectObj.project.mainTree.findNode(ID);
         if(node) projectObj.loadFocusLocation(node.serialNo(),1);
         if(node) projectObj.loadFocusLocation(node.serialNo(),1);
     },
     },
+    updateProjectProperty:function(fieldID,property){
+        let updateData = {type:ModuleNames.project,data:{'ID' : projectObj.project.ID()}};//,'property.locateSetting':outstd
+        updateData.data["property."+fieldID] = property;
+        $.bootstrapLoading.start();
+        projectObj.project.updateNodes([updateData],function () {
+            $.bootstrapLoading.end();
+            projectObj.project.property[fieldID] = property;
+        });
+    },
     updateOutStanding:function (outstanding,outInp) {
     updateOutStanding:function (outstanding,outInp) {
         let outstd = {outstanding:outstanding,outInp:outInp};
         let outstd = {outstanding:outstanding,outInp:outInp};
-        let updateData = {type:ModuleNames.project,data:{'ID' : projectObj.project.ID(),'property.locateSetting':outstd}};
+        this.updateProjectProperty('locateSetting',outstd);
+    },
+    updateBookmarkSetting:function () {
+        let setting = projectObj.project.property.bookmarkSetting?projectObj.project.property.bookmarkSetting:locateObject.bookmarkPropertySetting;
+        for(let s of setting.settingList){
+            s.describe = $("#"+s.background).val();
+        }
+        setting.selected = $("#bookmarkSelected").val();
+        this.updateProjectProperty("bookmarkSetting",setting);
+    },
+    setOrCancelBookmark:function(node){
+        $("#bookmark").prop("checked", true);
+        let setting = projectObj.project.property.bookmarkSetting?projectObj.project.property.bookmarkSetting:locateObject.bookmarkPropertySetting;
+        let background = null;
+        if(_.isEmpty(node.data.bookmarkBackground)) background = setting.selected;
+        let updateData = {type:node.sourceType,data:{'ID' : node.data.ID,bookmarkBackground:background}};
+        if(background == null) updateData.data.bookmarkAnnotation = null;
+        $.bootstrapLoading.start();
         projectObj.project.updateNodes([updateData],function () {
         projectObj.project.updateNodes([updateData],function () {
-            projectObj.project.property.locateSetting = outstd;
+            $.bootstrapLoading.end();
+            node.data.bookmarkBackground = background;
+            projectObj.mainController.refreshTreeNode([node]);
+            locateObject.seletedNodeID = node.data.ID;
+            //如果没有打开,自动打开书签批注设置
+            $('#locate').is(':visible')?locateObject.init():$("#locateTab").click();
+        });
+    },
+    initBookmarkRightClick:function(){
+        //如果当前行是无组成物的“普通材料”、“绿化苗木”、“外购砼构件”、“商品混凝土”、“商品砂浆”,则右键“添加计算材料”按钮有效。
+        let me = this;
+        $.contextMenu({
+            selector: '#bookmarkSpread',
+            build: function ($trigger, e) {
+                me.rightClickTarget = SheetDataHelper.safeRightClickSelection($trigger, e, me.bookmarkSpread);
+                return me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.viewport ||
+                    me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
+            },
+            items: {
+                "deleteBookmark": {
+                    name: "删除书签批注",
+                    icon: 'fa-remove',
+                    disabled: function () {
+                        return  me.bookmarkDatas.length == 0;
+                    },
+                    callback: function (key, opt) {
+                        me.deleteSelectedBookmark();
+                    }
+                },
+                "deleteAllBookmarks": {
+                    name: "删除所有书签批注",
+                    icon: 'fa-remove',
+                    disabled: function () {
+                        return  me.bookmarkDatas.length == 0;
+                    },
+                    callback: function (key, opt) {
+                        me.deleteBookmarkByDatas(me.bookmarkDatas);
+                    }
+                }
+            }
+        });
+    },
+    deleteSelectedBookmark:function () {
+        let sel = this.bookmarkSheet.getSelections()[0];
+        if(sel.row != -1 && this.bookmarkDatas.length>sel.row){
+            let record = this.bookmarkDatas[sel.row];
+            this.deleteBookmarkByDatas([record]);
+        }
+    },
+    deleteBookmarkByDatas:function(datas){
+        let postDatas = [];
+        for(let d of datas){
+            let tem = {
+                type:d.type,
+                data:{
+                    'ID':d.ID,
+                    'bookmarkAnnotation':null,
+                    'bookmarkBackground':null
+                }
+            };
+            postDatas.push(tem);
+        }
+       this.updateBookmarkNodes(postDatas);
+    },
+    updateBookmarkNodes:function (postDatas,refreshsNode = true) {
+        $.bootstrapLoading.start();
+        projectObj.project.updateNodes(postDatas,function () {
+            $.bootstrapLoading.end();
+            let nodes = [];
+            for(let p of postDatas){
+                let node =  projectObj.project.mainTree.findNode(p.data.ID);
+                if(!node) continue;
+                for(let key in p.data){
+                    if(key == 'ID') continue;
+                    node.data[key] = p.data[key];
+                }
+                nodes.push(node);
+            }
+            locateObject.showBookmarkDatas();
+            if(refreshsNode) projectObj.mainController.refreshTreeNode(nodes);
         });
         });
     }
     }
-
 };
 };
 
 
 
 
@@ -439,12 +602,25 @@ $('#outstanding').change(function(){
     me.updateOutStanding(outStd,scMathUtil.roundForObj(outInp,getDecimal('process')));
     me.updateOutStanding(outStd,scMathUtil.roundForObj(outInp,getDecimal('process')));
 });
 });
 
 
+$("#annotationTextarea").change(function(){
+    let updateData = {type:$("#bookmarkNodeType").val(),data:{'ID' :$("#bookmarkNodeID").val(),'bookmarkAnnotation':$(this).val()}};
+    let node =  projectObj.project.mainTree.findNode($("#bookmarkNodeID").val());
+    if(!node) return;
+    locateObject.updateBookmarkNodes([updateData],false);
+});
+
 $('#bookmarkSettingDropdown').on('shown.bs.dropdown', function showDropdown() {
 $('#bookmarkSettingDropdown').on('shown.bs.dropdown', function showDropdown() {
+    locateObject.initBookmarkSetting();
     let setting = projectObj.project.property.bookmarkSetting?projectObj.project.property.bookmarkSetting:locateObject.bookmarkPropertySetting;
     let setting = projectObj.project.property.bookmarkSetting?projectObj.project.property.bookmarkSetting:locateObject.bookmarkPropertySetting;
     $("#"+setting.selected).focus();
     $("#"+setting.selected).focus();
 });
 });
 
 
+$("#bookmarkSettingConfirm").click(function () {
+    locateObject.updateBookmarkSetting();
+    $("#bookmarkSettingDropdown").click();
+});
+
+
 function bookmarkSelected() {
 function bookmarkSelected() {
-    console.log("hehe");
     $("#bookmarkSelected").val($(this)[0].id);
     $("#bookmarkSelected").val($(this)[0].id);
 }
 }

+ 6 - 8
web/building_saas/main/js/views/options_view.js

@@ -8,15 +8,13 @@ let optionsOprObj = {
     rationQuanACToRationUnit: $('#generalOpts2'),
     rationQuanACToRationUnit: $('#generalOpts2'),
     getOptions: function () {
     getOptions: function () {
         let me = this;
         let me = this;
-        CommonAjax.post('/options/getOptions', [], function (rstData) {
-            me.options = rstData;
-            let gOpts = me.options[me.optionsTypes.GENERALOPTS];
-            if(isDef(gOpts)){
-                for(let attr in gOpts){
-                    me[attr].prop('checked', gOpts[attr]);
-                }
+        me.options = projectOptins;
+        let gOpts = me.options[me.optionsTypes.GENERALOPTS];
+        if(isDef(gOpts)){
+            for(let attr in gOpts){
+                me[attr].prop('checked', gOpts[attr]);
             }
             }
-        });
+        }
     },
     },
     saveOptions: function (type, opts) {
     saveOptions: function (type, opts) {
         let optSettingType = 'options.' + type;
         let optSettingType = 'options.' + type;

+ 19 - 7
web/building_saas/main/js/views/project_view.js

@@ -285,7 +285,7 @@ var projectObj = {
         let stdMatchCode, formatCode, matchs;
         let stdMatchCode, formatCode, matchs;
         let searchStdBillsAndUpdate = function (stdCode, formatCode) {
         let searchStdBillsAndUpdate = function (stdCode, formatCode) {
             let orgCode = node.data.code?node.data.code.substr(0, 9):"";
             let orgCode = node.data.code?node.data.code.substr(0, 9):"";
-            if (projectObj.project.projectInfo.engineeringInfo.bill_lib.length === 0) {
+            if (projectObj.project.projectInfo.engineeringInfo.bill_lib.length === 0 || updateCodeCheck(value,stdCode === orgCode)) {
                 normalUpdate(node,value,stdCode === orgCode);
                 normalUpdate(node,value,stdCode === orgCode);
             } else if (projectObj.project.projectInfo.engineeringInfo.bill_lib.length > 0) {
             } else if (projectObj.project.projectInfo.engineeringInfo.bill_lib.length > 0) {
                 let libId = projectObj.project.projectInfo.engineeringInfo.bill_lib[0].id;
                 let libId = projectObj.project.projectInfo.engineeringInfo.bill_lib[0].id;
@@ -384,6 +384,10 @@ var projectObj = {
             project.Bills.updateField(billnode.source, 'code', codeValue, toBX);
             project.Bills.updateField(billnode.source, 'code', codeValue, toBX);
             me.mainController.refreshTreeNode([billnode], false);
             me.mainController.refreshTreeNode([billnode], false);
         }
         }
+
+        function updateCodeCheck(value,sameStdCode) {//如果前9位相同,只改前三位,则只更新编号就行了,不用做其它处理
+            return sameStdCode && value && value.length == 12
+        }
     },
     },
     updateRationCode: function (node, value) {
     updateRationCode: function (node, value) {
         if(!isDef(node.data.code) && (!isDef(value) || value.toString().trim() == '')){
         if(!isDef(node.data.code) && (!isDef(value) || value.toString().trim() == '')){
@@ -1394,22 +1398,29 @@ var projectObj = {
                             return true;
                             return true;
                         }
                         }
                         return false;
                         return false;
-                    }
+                    },
+                    disabled: function () {
+                        let selected = project.mainTree.selected;
+                        if (projectReadOnly) {
+                            return true;
+                        }
+                        if(selected && selected.data.type != rationType.ration){
+                            return true;
+                        }
+                        return false;
+                    },
                 },
                 },
                 "setBookMark": {
                 "setBookMark": {
                     name: '设置/取消书签批注',
                     name: '设置/取消书签批注',
                     icon: 'fa-flag',
                     icon: 'fa-flag',
                     disabled: function () {
                     disabled: function () {
-                        if (projectReadOnly) {
+                        if (projectReadOnly || project.mainTree.selected.sourceType == ModuleNames.ration_glj) {
                             return true;
                             return true;
                         }
                         }
                         return false
                         return false
                     },
                     },
                     callback: function () {
                     callback: function () {
-                        $("#locateTab").click();
-                    },
-                    visible:function(){
-                        return false;
+                        locateObject.setOrCancelBookmark(project.mainTree.selected)
                     }
                     }
 
 
                 },
                 },
@@ -1875,6 +1886,7 @@ var projectObj = {
         if(node === tree.selected){
         if(node === tree.selected){
              style.backColor = colorSetting[mapping.SELECTED]['backColor'];
              style.backColor = colorSetting[mapping.SELECTED]['backColor'];
         }
         }
+        if(_ && !_.isEmpty(node.data.bookmarkBackground)) style.backColor = "#"+ node.data.bookmarkBackground;//设置书签和批注背景色
         //大项费用加粗(数字与中文字符大小不一问题由字体造成,暂时不考虑分别设置大小)
         //大项费用加粗(数字与中文字符大小不一问题由字体造成,暂时不考虑分别设置大小)
        /* if(node.sourceType === this.project.Bills.getSourceType() && node.data.type === billType.DXFY){
        /* if(node.sourceType === this.project.Bills.getSourceType() && node.data.type === billType.DXFY){
             style.font = 'bold 0.9rem Arial';
             style.font = 'bold 0.9rem Arial';

+ 5 - 0
web/building_saas/main/js/views/sub_view.js

@@ -12,6 +12,7 @@ let subObj = {
     fisrtLinked: true,  //提升焦点变换性能 2019年4月15日
     fisrtLinked: true,  //提升焦点变换性能 2019年4月15日
     TZJNRrePercent:null,
     TZJNRrePercent:null,
     showGljSubTab:false,
     showGljSubTab:false,
+    firstOpen:true,
     initSubSpread:function () {
     initSubSpread:function () {
         //清单精灵
         //清单精灵
         BillsElf.buildSheet();
         BillsElf.buildSheet();
@@ -128,6 +129,10 @@ let subObj = {
         if (gljOprObj.activeTab !== gljOprObj.preActiveTab) {   //提高焦点变换性能 2019年4月15日
         if (gljOprObj.activeTab !== gljOprObj.preActiveTab) {   //提高焦点变换性能 2019年4月15日
             refreshSubSpread();
             refreshSubSpread();
         }
         }
+        if(this.firstOpen == true){
+            $("#zmhs_toogle").click();
+            this.firstOpen = false;
+        }
     }
     }
 };
 };
 
 

+ 10 - 0
web/building_saas/main/js/views/tender_price_view.js

@@ -52,6 +52,7 @@ let tender_obj={
         this.tenderController = TREE_SHEET_CONTROLLER.createNew(this.tenderTree, this.tenderSheet, this.tenderTreeSetting);
         this.tenderController = TREE_SHEET_CONTROLLER.createNew(this.tenderTree, this.tenderSheet, this.tenderTreeSetting);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onSheetValueChange);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onSheetValueChange);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onTenderRangeChange);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onTenderRangeChange);
+        this.tenderSheet.bind(GC.Spread.Sheets.Events.EnterCell, this.onEnterCell);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onEditStarting);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onEditStarting);
         this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.treeSelectedChanged);
         this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.treeSelectedChanged);
        // this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.onSelectionChange);
        // this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.onSelectionChange);
@@ -202,6 +203,15 @@ let tender_obj={
         });
         });
 
 
     },
     },
+    onEnterCell : function (sender,args) {
+        let me = tender_obj, row = args.row, col = args.col;
+        if ([8, 9].includes(col)){
+            let node = me.tenderTree.items[row];
+            if (node.children && node.children.length > 0) {   // 父结点只读
+                me.tenderSheet.getCell(row, col).locked(true);// = true;
+            }
+        }
+    },
     updateChildrenValue:function (node,dataCode,value,datas,nodes) {
     updateChildrenValue:function (node,dataCode,value,datas,nodes) {
          if(node.children.length > 0){
          if(node.children.length > 0){
             for(let c of node.children){
             for(let c of node.children){

File diff suppressed because it is too large
+ 3 - 3
web/users/html/login.html


+ 6 - 6
web/users/js/login.js

@@ -42,8 +42,8 @@ $(document).ready(function () {
         captchaObj.appendTo('#captcha-box');
         captchaObj.appendTo('#captcha-box');
         captchaObj.onSuccess(function () {
         captchaObj.onSuccess(function () {
             $(".btn-area").slideDown("fast");
             $(".btn-area").slideDown("fast");
-            $('#login').click();
-            captchaObj.getValidate();
+            // $('#login').click();
+            // captchaObj.getValidate();
         });
         });
 
 
         $("#login").click(function () {
         $("#login").click(function () {
@@ -312,18 +312,18 @@ function login(captchaObj) {
                 }
                 }
             } else if(response.error === 2) {
             } else if(response.error === 2) {
                 // $('#phonepass').modal('hide');
                 // $('#phonepass').modal('hide');
-                captchaObj.reset();
+                // captchaObj.reset();
                 $('#check_ssoId').val(response.ssoId);
                 $('#check_ssoId').val(response.ssoId);
                 $('#phone').modal('show');
                 $('#phone').modal('show');
             } else if(response.error === 3) {
             } else if(response.error === 3) {
-                captchaObj.reset();
+                // captchaObj.reset();
                 $('#phonepass').modal('show');
                 $('#phonepass').modal('show');
                 $('#mobileLogin').val(response.data);
                 $('#mobileLogin').val(response.data);
             } else {
             } else {
                 // $('#phonepass').modal('hide');
                 // $('#phonepass').modal('hide');
                 let msg = response.msg !== undefined ? response.msg : '未知错误';
                 let msg = response.msg !== undefined ? response.msg : '未知错误';
                 showError(msg, $("input"));
                 showError(msg, $("input"));
-                captchaObj.reset();
+                // captchaObj.reset();
             }
             }
         },
         },
         error: function (result) {
         error: function (result) {
@@ -479,7 +479,7 @@ function setVersion(versionData) {
     let html = '';
     let html = '';
     for (let version of versionData) {
     for (let version of versionData) {
         let description = version.description ? version.description : '介绍内容';
         let description = version.description ? version.description : '介绍内容';
-        let tmpHtml = '<div class="col-sm-6">' +
+        let tmpHtml = '<div class="col-sm-6 mb-3">' +
             '<div class="card card-block">' +
             '<div class="card card-block">' +
             '<div class="card-body">' +
             '<div class="card-body">' +
             '<h3 class="card-title">'+ version.name +'</h3>' +
             '<h3 class="card-title">'+ version.name +'</h3>' +