Browse Source

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

TonyKang 6 years ago
parent
commit
c0cdadeec9
43 changed files with 736 additions and 400 deletions
  1. 3 3
      Dockerfile
  2. 18 5
      config/config.js
  3. 69 0
      importserver.js
  4. 4 14
      modules/complementary_ration_lib/models/compleRationModel.js
  5. 4 4
      modules/glj/controllers/glj_controller.js
  6. 0 1
      modules/glj/facade/glj_facade.js
  7. 105 34
      modules/glj/models/glj_list_model.js
  8. 59 0
      modules/import/controllers/import_controller.js
  9. 16 0
      modules/import/routes/import_route.js
  10. 60 9
      modules/pm/controllers/pm_controller.js
  11. 60 2
      modules/pm/facade/pm_facade.js
  12. 5 1
      modules/pm/models/project_model.js
  13. 1 1
      modules/pm/routes/pm_route.js
  14. 10 10
      modules/users/models/user_model.js
  15. 1 0
      package.json
  16. 2 2
      public/gljUtil.js
  17. 6 4
      public/web/common_ajax.js
  18. 42 47
      public/web/gljUtil.js
  19. 3 2
      public/web/sheet/sheet_common.js
  20. 3 3
      server.js
  21. 5 0
      web/building_saas/css/custom.css
  22. 1 1
      web/building_saas/glj/html/project_glj.html
  23. 3 3
      web/building_saas/main/html/main.html
  24. 1 1
      web/building_saas/main/js/models/calc_base.js
  25. 10 3
      web/building_saas/main/js/models/project_glj.js
  26. 4 2
      web/building_saas/main/js/models/ration_glj.js
  27. 6 7
      web/building_saas/main/js/views/fee_rate_view.js
  28. 2 1
      web/building_saas/main/js/views/glj_col.js
  29. 3 3
      web/building_saas/main/js/views/glj_view.js
  30. 4 1
      web/building_saas/main/js/views/glj_view_contextMenu.js
  31. 25 19
      web/building_saas/main/js/views/material_calc_view.js
  32. 13 5
      web/building_saas/pm/html/project-management.html
  33. 77 41
      web/building_saas/pm/js/pm_newMain.js
  34. 7 6
      web/building_saas/pm/js/pm_share.js
  35. 59 0
      web/building_saas/pm/js/pm_tree.js
  36. BIN
      web/dest/css/img/edit.png
  37. 15 158
      web/over_write/js/chongqing_2018.js
  38. 14 0
      web/over_write/js/neimeng_2019.js
  39. 9 0
      web/over_write/js/zhejiang_2005.js
  40. 1 1
      web/users/html/login-infoinput.html
  41. 2 2
      web/users/html/login-sms.html
  42. 2 2
      web/users/html/login-ver.html
  43. 2 2
      web/users/html/login.html

+ 3 - 3
Dockerfile

@@ -10,10 +10,10 @@ RUN cnpm install
 
 RUN gulp build
 
-EXPOSE 2060
-
 ENV NODE_ENV=prod
 
-ENTRYPOINT babel-node --max-old-space-size=2048  server.js
+ENTRYPOINT ["babel-node", "--max-old-space-size=2048"]
+
+CMD ["server.js"]
 
 

File diff suppressed because it is too large
+ 18 - 5
config/config.js


+ 69 - 0
importserver.js

@@ -0,0 +1,69 @@
+/**
+ * Created by zhang on 2019/12/3.
+ */
+let express = require('express');
+
+let config = require("./config/config.js");
+let fileUtils = require("./modules/common/fileUtils");
+let dbm = require("./config/db/db_manager");
+let log = require("./logs/log_helper");
+
+config.setupDb(process.env.NODE_ENV);
+
+let path = require('path');
+let fs = require('fs');
+
+
+dbm.connect(process.env.NODE_ENV);
+//这里现在只引入了定额工料机里的models,当其它模块的models修改后使用:./modules/**/models/*.js引入所有的模块
+fileUtils.getGlobbedFiles('./modules/all_models/*.js').forEach(function(modelPath) {
+    require(path.resolve(modelPath));
+})
+
+
+
+
+let app = express();
+let _rootDir = __dirname;
+app.locals.rootDir = _rootDir;
+log.use(app);
+app.use(express.static(_rootDir));
+
+app.set('views', path.join(__dirname, 'web'));
+app.engine('.html', require('ejs').__express);
+app.set('view engine', 'html');
+
+let bodyParser = require('body-parser');
+app.use(bodyParser.urlencoded({limit: '100mb', extended: false}));
+app.use(bodyParser.json({limit: '100mb'}));
+
+
+
+//加载路由文件
+fileUtils.getGlobbedFiles('./modules/import/routes/*.js').forEach(function(modelPath) {
+    require(path.resolve(modelPath))(app);
+});
+
+//app.use(express.static(_rootDir+"/web"));
+//app.use(express.static(_rootDir+"/lib"));
+//let rations_Router = require("./modules/rationLibEditor/routes/rationLibEditor_route");
+//app.use("/rationLibEditor",rations_Router);
+
+//-----------------
+
+app.use(function(req, res, next) {
+    res.status(404).send('404 Error');
+});
+app.use(function(err, req, res, next) {
+    console.error(err.stack);
+    res.status(500).send('500 Error');
+});
+
+//设置外增的Date对象Format函数
+//备注: 经过测试nodejs 8.9.3版本不支持eval的方式修改prototype,为兼容考虑,把方法调整到stringUtil文件里
+require('./public/stringUtil').setupDateFormat();
+
+app.listen(2050, function(){
+    console.log('import server started!');
+});
+

+ 4 - 14
modules/complementary_ration_lib/models/compleRationModel.js

@@ -159,13 +159,13 @@ class CompleRatoinDao {
                 }
             }
             if(stdGljIds.length > 0) {
-                stdGljs = await stdGljModel.find({ID: {$in: stdGljIds}});
+                stdGljs = await stdGljModel.find({ID: {$in: stdGljIds}}).lean();
             }
             if(comGljIds.length > 0) {
                 comGljs = await complementaryGljModel.find({userId: userId, ID: {$in: comGljIds}});
             }
             if(!gUtil) gUtil = gljUtil;
-            let gljDatas = gUtil.sortRationGLJ(stdGljs.concat(comGljs));
+            let gljDatas = gUtil.sortRationGLJ(stdGljs.concat(comGljs), true);
             if(ration.jobContent && ration.jobContent.toString().trim() !== ''){
                 hintsArr.push(`工作内容:`);
                 hintsArr = hintsArr.concat(ration.jobContent.split('\n'));
@@ -219,16 +219,6 @@ class CompleRatoinDao {
                 return recurCompare(aArr, bArr, 0);
             });
         }
-        /*stdRations.sort(function (a, b) {
-            let rst = 0;
-            if(a.code > b.code){
-                rst = 1;
-            }
-            else if(a.code < b.code){
-                rst = -1;
-            }
-            return rst;
-        });*/
         sortByCode(stdRations);
         for(let ration of stdRations){
             let hintsArr = [];
@@ -240,10 +230,10 @@ class CompleRatoinDao {
                 stdGljIds.push(rationGlj.gljId);
             }
             if(stdGljIds.length > 0) {
-                stdGljs = await stdGljModel.find({ID: {$in: stdGljIds}});
+                stdGljs = await stdGljModel.find({ID: {$in: stdGljIds}}).lean();
             }
             if(!gUtil) gUtil = gljUtil;
-            let gljDatas =  gUtil.sortRationGLJ(stdGljs);
+            let gljDatas =  gUtil.sortRationGLJ(stdGljs, true);
             if(ration.jobContent && ration.jobContent.toString().trim() !== ''){
                 hintsArr.push(`工作内容:`);
                 hintsArr = hintsArr.concat(ration.jobContent.split('\n'));

+ 4 - 4
modules/glj/controllers/glj_controller.js

@@ -870,16 +870,16 @@ async function getGLJListByProjectID(projectId){
                 usedUnitPriceInfo.id = tmp.property.unitPriceFile.id;
             }
         }
+        responseData.data.originalList = await original_calc_model.find({"unit_price_file_id":unitPriceFileId}).lean();
+        responseData.data.freightList = await freight_calc_model .find({"unit_price_file_id":unitPriceFileId}).lean();
         // 先获取对应标段的项目工料机数据
         let gljListModel = new GLJListModel();
-        let [gljList, mixRatioConnectData,mixRatioMap,unitPriceMap] = await gljListModel.getListByProjectId(projectId, unitPriceFileId);
+        let [gljList, mixRatioConnectData,mixRatioMap,unitPriceMap] = await gljListModel.getListByProjectId(projectId, unitPriceFileId,responseData.data.freightList,responseData.data.originalList);
         responseData.data.gljList = gljList;
         responseData.data.mixRatioConnectData = mixRatioConnectData;
         responseData.data.mixRatioMap = mixRatioMap;
         responseData.data.usedTenderList = usedTenderList;
         responseData.data.unitPriceMap = unitPriceMap;
-        responseData.data.originalList = await original_calc_model.find({"unit_price_file_id":unitPriceFileId});
-        responseData.data.freightList = await freight_calc_model .find({"unit_price_file_id":unitPriceFileId});
         let gljTypeMap = glj_type_util.getStdGljTypeCacheObj().innerGljTypeObj;
         let unitPriceFileModel = new UnitPriceFileModel();
         let unitFileInfo =  await unitPriceFileModel.findDataByCondition({id: unitPriceFileId});
@@ -891,7 +891,7 @@ async function getGLJListByProjectID(projectId){
             usedUnitPriceInfo: usedUnitPriceInfo,
             gljTypeMap:gljTypeMap,
             vvTaxFileID:unitFileInfo.vvTaxFileID,
-            assistProductionFeeRate:unitFileInfo.assistProductionFeeRate?unitFileInfo.assistProductionFeeRate:0
+            assistProductionFeeRate:unitFileInfo.assistProductionFeeRate?unitFileInfo.assistProductionFeeRate:3
         };
     } catch (error) {
         console.log(error);

+ 0 - 1
modules/glj/facade/glj_facade.js

@@ -114,7 +114,6 @@ async function changeVvTaxFile(data){//对于车船税,现在只是在组成
 async function changeAssistProductionFeeRate(data){
     let unitFileID = data.unitFileID,assistProductionFeeRate = data.assistProductionFeeRate;
     let unitPriceFileModel = new UnitPriceFileModel();
-    //先更新单价文件中车船税文件ID
     await unitPriceFileModel.model.update({id:unitFileID},{assistProductionFeeRate:assistProductionFeeRate});
 }
 

+ 105 - 34
modules/glj/models/glj_list_model.js

@@ -79,7 +79,7 @@ class GLJListModel extends BaseModel {
      * @param {Number} unitPriceFileId
      * @return {Promise}
      */
-    async getListByProjectId(projectId, unitPriceFileId) {
+    async getListByProjectId(projectId, unitPriceFileId,freightList,originalList) {
         let gljData = null;
         /*let decimal =await decimal_facade.getProjectDecimal(projectId);
         let quantity_decimal = decimal&&decimal.glj.quantity?decimal.glj.quantity:6;//取消耗量保留小数据位,默认6位*/
@@ -91,37 +91,31 @@ class GLJListModel extends BaseModel {
             // 首先获取对应标段下所有的项目工料机数据
             let condition = {project_id: projectId};
             let fields = {_id: 0};
-            gljData = await this.db.find(condition, fields);
+            gljData = await this.model.find(condition, fields).lean();
+            // 整理获取有组成物的项目工料机的数据
+            let connect_keys = [];
+            for(let tmp of gljData) {
+                let c_key = this.getIndex(tmp,['code','name','specs','unit','type']);
+                //把有组成物类型的连接字段挑出来
+                if(this.ownCompositionTypes.indexOf(tmp.type)!=-1){
+                    connect_keys.push(c_key);
+                }
+                keyMap[c_key] = tmp; //工料机连接key和工料机的对照表;
+            }
+
+            //检查自采材料和综合电价功能在共享单价文件时,项目文件中可能会缺少项目工料机的情况,如果缺少,则自动插入
+            if(freightList && freightList.length > 0)  await this.materialCalcProjectGLJChecking(freightList,keyMap,gljData,connect_keys,projectId,unitPriceFileId);
+            if(originalList && originalList.length > 0) await this.materialCalcProjectGLJChecking(originalList,keyMap,gljData,connect_keys,projectId,unitPriceFileId);
             // 没有数据则直接返回空
             if (gljData.length <= 0) {
                 throw '无数据';
             }
-
             // 获取标段设置的单价文件数据
             let unitPriceModel = new UnitPriceModel();
             unitPriceList = await unitPriceModel.getDataByFileId(unitPriceFileId);
-            // 整理获取工料机ID list
-            let gljIdList = [];
-            for(let tmp of gljData) {
-                gljIdList.push(tmp.id);
-                let c_key = this.getIndex(tmp,['code','name','specs','unit','type']);
-                keyMap[tmp.id] = c_key; //工料机ID和连接key的对照表;
-            }
-            // 从定额工料机库中获取消耗量
-            condition = {
-                projectID: projectId
-               // projectGLJIDList: gljIdList 这里是取所有项目工料机,所以也是取所有定额工料机,不需要根据项目工料机ID再过滤
-            };
+
             //为了提高性成计算消耗量功能改成了在前端计算
-            // 整理获取有组成物的项目工料机的数据
-            let connect_keys = [];
-            for(let tmp of gljData) {
-                // 有组成物的类型才查找
-                let key = keyMap[tmp.id];
-                if(this.ownCompositionTypes.indexOf(tmp.type)!=-1){
-                    connect_keys.push(key);
-                }
-            }
+
             // 查找组成物的消耗量
             let totalComposition = {};
             let mixRatioData = {};
@@ -132,15 +126,7 @@ class GLJListModel extends BaseModel {
                 for (let tmp of mixRatioList) {
                    let t_index = tmp.connect_key;
                    let m_index = this.getIndex(tmp,['code','name','specs','unit','type']);
-                   /*
-                    let consumption=parseFloat(tmp.consumption);
-                    let r_quantity = quantityList[t_index]?quantityList[t_index]:0;
-                   if(quantityList[m_index]!==undefined){
-                       quantityList[m_index]=quantityList[m_index]+r_quantity*consumption;
-                   }else {
-                       quantityList[m_index] = r_quantity*consumption;
-                   }
-                    quantityList[m_index] = scMathUtil.roundTo(quantityList[m_index],-quantity_decimal);*/
+
                     if (mixRatioData[t_index] !== undefined) {
                         mixRatioData[t_index].push(tmp);
                     } else {
@@ -174,6 +160,92 @@ class GLJListModel extends BaseModel {
 
         return [gljData, mixRatioConnectData,mixRationMap,unitPriceList];
     }
+
+    async materialCalcProjectGLJChecking(materialList,keyMap,gljData,connect_keys,projectId,unitPriceFileId){
+        let missGLJs = [];
+        for(let m of materialList){
+            if(m.ration_gljs){
+                for(let rg of m.ration_gljs){
+                    let key = this.getIndex(rg);
+                    if(keyMap[key])  continue; //如果已经存在,则跳过,不用添加
+                    missGLJs.push(rg)
+                }
+            }
+        }
+        if(missGLJs.length > 0)   await this.handleMissGLJs(missGLJs,keyMap,gljData,connect_keys,projectId,unitPriceFileId)
+    }
+
+    //处理综合电价或材料计算共享的时候项目工料机缺少的情况
+    async handleMissGLJs(missGLJs,keyMap,gljData,connect_keys,projectId,unitPriceFileId){
+        let new_connect_keys = [];
+        let oldProjectIDMap = {};//记录来源的项目工料机对应的项目编号
+        let projectGLJIDList = [];
+        let key_to_projectIDMap={};//记录5大项key对应来源的项目工料机ID
+        for(let rg of missGLJs){
+            projectGLJIDList.push(rg.projectGLJID);
+           if(this.ownCompositionTypes.indexOf(rg.type)!=-1){//有工料机的类型还要检查组成物是否存在
+               let newkey = this.getIndex(rg);
+                new_connect_keys.push(newkey);
+                connect_keys.push(newkey);
+                key_to_projectIDMap[newkey] = rg.projectGLJID;
+           }
+        }
+        let oldProjectGLJs =  await this.model.find({'id':{'$in':projectGLJIDList}},'-_id').lean();
+        let counterModel = new CounterModel();
+
+        //处理缺少的项目工料机
+        for(let g of oldProjectGLJs){
+            oldProjectIDMap[g.id] = g.project_id;
+            g.id = await counterModel.getId(gljCollectionName);
+            g.project_id = projectId;
+            keyMap[this.getIndex(g)] = g;
+        }
+
+        //处理缺少的项目工料机中的组成物
+        if(new_connect_keys.length > 0){
+            let mixRatioModel = new MixRatioModel();
+            let e_mList = await mixRatioModel.model.find({unit_price_file_id: unitPriceFileId,connect_key: {'$in':new_connect_keys}}).lean();
+            let p_m = {};//以项目工料机来分组
+            for(let m of e_mList) {
+                let mkey = this.getIndex(m);
+                if (keyMap[mkey]) continue; //如果已经存在了,不用再增加
+                let oldPID = key_to_projectIDMap[m.connect_key];
+                if (p_m[oldPID]) {
+                    p_m[oldPID].push(m);
+                } else {
+                    p_m[oldPID] = [m];
+                }
+                keyMap[mkey] = m;//处理过了就添加,避免重复
+            }
+            //按组来处理组成物信息
+            for(let t_pid in p_m){
+                let codeList = [];
+                let mkeyMap = [];
+                for(let m of p_m[t_pid]){
+                    codeList.push(m.code);
+                    mkeyMap[this.getIndex(m)] = m;
+                }
+                let projectID = oldProjectIDMap[t_pid];
+                let m_projectGLJs =  await this.model.find({'project_id':projectID,'code':{'$in':codeList}},'-_id').lean();
+                for(let mg of m_projectGLJs){
+                    if(mkeyMap[this.getIndex(mg)]){//过滤掉单按编号不准确的工料机
+                        mg.id = await counterModel.getId(gljCollectionName);
+                        mg.project_id = projectId;
+                        oldProjectGLJs.push(mg);
+                    }
+                }
+            }
+        }
+
+        if(oldProjectGLJs.length > 0){
+            await this.db.create(oldProjectGLJs);
+            for(let o of oldProjectGLJs){
+                gljData.push(o);
+            }
+        }
+    }
+
+
     /**
      * 组合工料机数据和单价文件数据
      *
@@ -329,7 +401,6 @@ class GLJListModel extends BaseModel {
             data.id = await counterModel.getId(gljCollectionName);
         }
 
-        this.setScene('add');
         let result = await this.db.create(data);
         return result;
     }

+ 59 - 0
modules/import/controllers/import_controller.js

@@ -0,0 +1,59 @@
+/**
+ * Created by zhang on 2019/12/3.
+ */
+/**
+ * Created by jimiz on 2017/4/9.
+ */
+let logger = require("../../../logs/log_helper").logger;
+let pm_facade = require('../../pm/facade/pm_facade');
+let controller = {
+    importProject:async function (req){
+        let data = req.body.data;
+        let sessionInfo = {session:req.body.session};
+        let fields = req.body.fields;
+        return await pm_facade.importProject(data,sessionInfo,fields);
+    },
+    exportProject:async function(req){
+        let result={
+            error:0
+        };
+        let data = JSON.parse(req.body.dataString);
+        result.data = await pm_facade.exportProject(req.body.userID, data);
+        return result
+    },
+    copyProject:async function(req){
+        let result={
+            error:0
+        };
+        let data = JSON.parse(req.body.dataString);
+        result.data = await pm_facade.copyProject(req.body.userID,req.body.compilationID,data);
+        return result
+    }
+};
+
+
+module.exports = {
+    action:async function(req,res){//自动跳转到URL对应的controller方法
+        let result={
+            error:0
+        };
+        try {
+            let functionName = req.url.replace(/\//g,"");
+            result = controller[functionName]?await controller[functionName](req):"";
+        }catch (err){
+            logger.err(err);
+            if(typeof err == "string"){
+                result.error=2;
+                result.msg = err;
+            }else {
+                result.error=1;
+                result.msg = "导入失败请检查文件!"
+            }
+        }
+        res.json(result);
+    }
+};
+
+
+
+

+ 16 - 0
modules/import/routes/import_route.js

@@ -0,0 +1,16 @@
+/**
+ * Created by zhang on 2019/12/3.
+ */
+let express = require('express');
+
+module.exports = function (app) {
+    let importRouter = express.Router();
+    let importController = require('../controllers/import_controller');
+    importRouter.post('/importProject',importController.action);
+    importRouter.post('/exportProject',importController.action);
+    importRouter.post('/copyProject',importController.action);
+    importRouter.get('/test',function (req,res) {
+        res.json("hello word");
+    })
+    app.use('/import', importRouter);
+};

+ 60 - 9
modules/pm/controllers/pm_controller.js

@@ -29,6 +29,8 @@ import SectionTreeDao from '../../complementary_ration_lib/models/sectionTreeMod
 let sectionTreeDao = new SectionTreeDao();
 let consts = require('../../main/models/project_consts');
 import multiparty from 'multiparty';
+let rp = require('request-promise');
+
 //统一回调函数
 let callback = function(req, res, err, message, data){
     res.json({error: err, message: message, data: data});
@@ -382,6 +384,39 @@ module.exports = {
         }
     },
 
+    getGC: async function(req, res) {
+        const userID = req.session.sessionUser.id;
+        const compilationId = req.session.sessionCompilation._id;
+        try {
+            const rst = [];
+            const priceFilesTask = ProjectsData.getGCFiles(fileType.unitPriceFile, userID);
+            const feeRateFilesTask = ProjectsData.getGCFiles(fileType.feeRateFile, userID);
+            const tendersTask = ProjectsData.getGCFiles(projType.tender, userID);
+            const [priceFiles, rateFiles, tenders] = await Promise.all([priceFilesTask, feeRateFilesTask, tendersTask]);
+            // 建设项目
+            let projectIDs = tenders.reduce((acc, cur) => {
+                acc.push(cur.ParentID);
+                return acc;
+            }, []);
+            projectIDs = [...new Set(projectIDs)];
+            const projects = await ProjectsData.getProjectsByIds(userID, compilationId, projectIDs);
+            projects.forEach(project => {
+                const projectDoc = project._doc;
+                const relTenders = tenders.filter(tender => tender.ParentID === projectDoc.ID);
+                const unitPriceFiles = priceFiles.filter(file => relTenders.find(tender => tender.property.unitPriceFile.id === file.id));
+                const feeRateFiles = rateFiles.filter(file => relTenders.find(tender => tender.property.feeFile.id === file.ID));
+                projectDoc.children = relTenders;
+                projectDoc.unitPriceFiles = unitPriceFiles;
+                projectDoc.feeRateFiles = feeRateFiles;
+                rst.push(projectDoc);
+            });
+            callback(req, res, 0, 'success', rst);
+        } catch (err) {
+            console.log(err);
+            callback(req, res, true, err.message, null);
+        }
+    },
+
     getGCDatas: async function(request, response) {
         let userID = request.session.sessionUser.id;
         let compilatoinId = request.session.sessionCompilation._id;
@@ -510,8 +545,8 @@ module.exports = {
             error:0
         };
         try {
-            let data = JSON.parse(req.body.data);
-            result.data = await pm_facade.copyProject(req.session.sessionUser.id, req.session.sessionCompilation._id,data);
+            let data = {dataString:req.body.data,userID:req.session.sessionUser.id,compilationID:req.session.sessionCompilation._id};
+            result = await redirectToImportServer(data,"copyProject",req);
         }catch (err){
             console.log(err);
             result.error=1;
@@ -672,8 +707,8 @@ module.exports = {
             error:0
         };
         try {
-            let data = JSON.parse(req.body.data);
-            result.data = await pm_facade.exportProject(req.session.sessionUser.id, data);
+            let data = {dataString:req.body.data,userID:req.session.sessionUser.id};
+            result = await redirectToImportServer(data,"exportProject",req);
         }catch (err){
             console.log(err);
             result.error=1;
@@ -684,23 +719,39 @@ module.exports = {
     },
     importProject:async function(req,res){
         let form = new multiparty.Form({uploadDir: './tmp'});
-        let uploadFullName;
         form.parse(req, async function (err, fields, files) {
+            let path = "";
             try {
                 console.log(fields);
                 const file = typeof files.file !== 'undefined' ? files.file[0] : null;
                 if (err || !file) {
                     throw '上传失败。';
                 };
+                path = file.path;
                 let data = fs.readFileSync(file.path,'utf-8');
-                let result = await pm_facade.importProject(data,req,fields);
-                fs.unlinkSync(file.path);
+                let body = {data: data, fields:fields, session:req.session};
+                let result = await redirectToImportServer(body,"importProject",req);
                 res.json(result);
             }catch (e){
                 console.log(e);
                 res.json({error:1,msg:"导入失败请检查文件!"})
+            }finally {
+                fs.unlinkSync(path);
             }
-
         })
     }
-};
+};
+
+
+async function redirectToImportServer(data,action,req) {
+    let importURL = config.getImportURL(process.env.NODE_ENV,req.headers.origin);
+    let options = {
+        method: 'POST',
+        uri: `http://${importURL}/import/${action}`,
+        body: data,
+        timeout:220000,
+        json: true
+    };
+    console.log("post import data to:"+options.uri);
+    return await rp.post(options);
+}

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

@@ -26,6 +26,7 @@ module.exports={
     getShareInfo: getShareInfo,
     prepareInitialData: prepareInitialData,
     changeFile:changeFile,
+    checkFiles:checkFiles,
     copyForSectionError: copyForSectionError,
     exportProject:exportProject,
     importProject:importProject
@@ -132,7 +133,7 @@ async function copyExample(userID, compilation, projIDs){
             parentBulks.push({insertOne: {document: newData}});
         } else {
             //拷贝单位工程
-            let rootProjectID = projMapping[data.ParentID].ParentID;
+            let rootProjectID = projMapping[data.ParentID];
             let projectMap = {
                 copy: {
                     document: {userID: userID, ID: orgID, NextSiblingID: data.NextSiblingID, ParentID: data.ParentID, name: data.name, shareInfo: [],
@@ -1043,6 +1044,7 @@ async function exportMainData(userID,projectID) {
     let project = await projectModel.findOne({ID:projectID});
     if(!project) throw  new Error("没有找到该建设项目:"+projectID);
     result['compilationID'] = project.compilation;
+    result['from'] = "yanghu";
     result.projects.push(project);
     let subProjects = await  projectModel.find({"$or": [{'ParentID':projectID}, {"property.rootProjectID": projectID}]});
     for(let s of subProjects){
@@ -1116,7 +1118,10 @@ async function importProject(data,req,fields) {
     }
     let mainData = datas.length > 0 ?datas[0]:null;
     if(mainData){
-         if(mainData.compilationID != req.session.sessionCompilation._id){
+         if(mainData.from && mainData.from != "yanghu"){
+             result.error = 1;
+             result.msg = "导入失败:您要导入的文件是由“大司空云计价”导出,当前软件是“纵横公路养护云版”,请选择正确的软件再进行操作!";
+         }else if(mainData.compilationID != req.session.sessionCompilation._id){
              result.error = 1;
              result.msg = "编办不同,无法导入,请重新选择!";
          }else {
@@ -1351,4 +1356,57 @@ async function importFeeRateFiles(mainData,projectIDMap,feeRateFileIDMap,userID)
     }
     if(feeRateFiles.length > 0) await insertMany(feeRateFiles,feeRateFileModel);
     if(feeRates.length > 0) await insertMany(feeRates,feeRateModel);
+}
+
+// 检查单价、费率文件,处理rootProjectID为-1的旧数据(以前的初始化例题bug造成)
+async function checkFiles(projects) {
+    // fileID - tenderID 映射
+    const mapping = {};
+    const unitFileIDs = [];
+    const rateFileIDs = [];
+    projects.forEach(project => {
+        if (project.projType === projectType.tender) {
+            const priceFileID = project.property.unitPriceFile.id;
+            const feeFileID = project.property.feeFile.id;
+            if (!mapping[priceFileID]) {
+                mapping[priceFileID] = project;
+                unitFileIDs.push(priceFileID);
+            }
+            if (!mapping[feeFileID]) {
+                mapping[feeFileID] = project;
+                rateFileIDs.push(feeFileID);
+            }
+        }
+    });
+    // 检查是否存在rootProjectID为-1的
+    const errorUnitFiles = await unitPriceFileModel.find({id: {$in: unitFileIDs}, root_project_id: -1});
+    console.log(`errorUnitFiles`);
+    console.log(errorUnitFiles);
+    const unitFileTask = errorUnitFiles.map(file => {
+        const rootProjectID = mapping[file.id].ParentID;
+        return {
+            updateOne: {
+                filter: {id: file.id},
+                update: {$set: {root_project_id: rootProjectID}}
+            }
+        };
+    });
+    if (unitFileTask.length) {
+       await unitPriceFileModel.bulkWrite(unitFileTask);
+    }
+    const errorRateFiles = await feeRateFileModel.find({ID: {$in: rateFileIDs}, rootProjectID: -1});
+    console.log(`errorRateFiles`);
+    console.log(errorRateFiles);
+    const rateFileTask = errorRateFiles.map(file => {
+        const rootProjectID = mapping[file.ID].ParentID;
+        return {
+            updateOne: {
+                filter: {ID: file.ID},
+                update: {$set: {rootProjectID: rootProjectID}}
+            }
+        };
+    });
+    if (rateFileTask.length) {
+        await feeRateFileModel.bulkWrite(rateFileTask);
+    }
 }

+ 5 - 1
modules/pm/models/project_model.js

@@ -67,6 +67,7 @@ ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, cal
                 'deleteInfo': null
             }, {'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': {'$in': [null, false]}}]
         }, '-_id', {lean: true});
+        await pmFacade.checkFiles(projects);
         let projIDs= [];
         for(let project of projects){
             if(project.projType === projectType.project){
@@ -117,7 +118,6 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
             callback(1, '提交数据出错.', null);
         }
     };
-    console.log(datas);
     if (datas) {
         for (i = 0; i < datas.length && !hasError; i++) {
             data = datas[i];
@@ -148,6 +148,10 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                         user_id: userId,
                         root_project_id: data.updateData.property.rootProjectID
                     };
+                    if(compilation.overWriteUrl && compilation.overWriteUrl!=""){
+                        let overWrite = require("../../.."+compilation.overWriteUrl);
+                        if(overWrite.getDefalutAssistProductionFeeRate) insertData.assistProductionFeeRate = overWrite.getDefalutAssistProductionFeeRate();
+                    }
                     let addResult = await unitPriceFileModel.add(insertData);
                     if (!addResult) {
                         callback(1, '新增单价文件失败.', null);

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

@@ -53,7 +53,7 @@ module.exports = function (app) {
     pmRouter.post('/updateFiles', pmController.updateFiles);
     pmRouter.post('/defaultSettings', pmController.defaultSettings);
     //GC
-    pmRouter.post('/getGCDatas', pmController.getGCDatas);
+    pmRouter.post('/getGCDatas', pmController.getGC);
     pmRouter.post('/recGC', pmController.recGC);
     pmRouter.post('/delGC', pmController.delGC);
     //share

+ 10 - 10
modules/users/models/user_model.js

@@ -319,16 +319,16 @@ class UserModel extends BaseModel {
      * @return {version}
      */
     async getVersionFromUpgrade(ssoId, compilationId){
-        let version = '纵横公路养护造价(云版)';//'纵横公路养护造价(免费云版)'; 2019-03-28 需求修改,听说不知道多久的以后还会改回来--勿删!!!!!
-        /*let userData = await this.findDataBySsoId(ssoId);
-         if (userData.upgrade_list !== undefined) {
-         let compilationInfo = userData.upgrade_list.find(function (item) {
-         return item.compilationID === compilationId;
-         });
-         if (compilationInfo !== undefined && compilationInfo.isUpgrade === true) {
-         version = '纵横公路养护造价(专业版)';
-         }
-         }*/
+        let version = '纵横公路养护云造价(免费公用版)';//'纵横公路养护造价(免费云版)'; 2019-03-28 需求修改,听说不知道多久的以后还会改回来--勿删!!!!!
+        let userData = await this.findDataBySsoId(ssoId);
+        if (userData.upgrade_list !== undefined) {
+            let compilationInfo = userData.upgrade_list.find(function (item) {
+                return item.compilationID === compilationId;
+            });
+            if (compilationInfo !== undefined && compilationInfo.isUpgrade === true) {
+                version = '纵横公路养护造价(专业版)';
+            }
+        }
         return version;
     }
 

+ 1 - 0
package.json

@@ -51,6 +51,7 @@
     "node-schedule": "^1.3.0",
     "node-xlsx": "^0.11.2",
     "pdfkit": "^0.8.2",
+    "request-promise": "^4.2.5",
     "socket.io": "^2.0.3",
     "ua-parser-js": "^0.7.14",
     "uuid": "^3.1.0",

+ 2 - 2
public/gljUtil.js

@@ -70,8 +70,8 @@ function isCommercialConcreteType(type){
     return gljNodeUtil.isCommercialConcreteType(type);
 }
 
-function sortRationGLJ(list) {
-    return gljNodeUtil.sortRationGLJ(list);
+function sortRationGLJ(list, std) {
+    return gljNodeUtil.sortRationGLJ(list, std);
 }
 
 function sortProjectGLJ(list,lodash) {

+ 6 - 4
public/web/common_ajax.js

@@ -173,14 +173,16 @@ async function ajaxPost(url, data) {
             cache: false,
             timeout: 50000,
             success: function(result){
+                let message = "";
+                if(result) message = result.message?result.message:result.msg;
                 if (result.error === 0 || result.err ===0) {
                     resolve(result.data);
                 }else if(result.error === 2 ){
-                    alert(result.message);
-                    reject(result.message);
+                    alert(message);
+                    reject(message);
                 }else {
-                    alert('error: ' + result.message);
-                    reject(result.message);
+                    alert('error: ' + message);
+                    reject(message);
                 }
             },
             error: function(jqXHR, textStatus, errorThrown){

+ 42 - 47
public/web/gljUtil.js

@@ -13,28 +13,21 @@ let gljUtil = {
         let rationGljGroup = _.groupBy(rationGLJDatas,'projectGLJID');
         let IDarray =  this.getSubdivisionAndTechBillsLeavesID(billsDatas);//分别取分部分项和技术措施项目的所有叶子清单ID
         let billIDs = IDarray[0],tech_billIDS = IDarray[1];
-        let sField = isTender==true?"tenderSubdivisionQuantity":"subdivisionQuantity";
-        let tField = isTender==true?"tenderTechQuantity":"techQuantity";
+
+        //养护没有分部分项消耗量这一说的所以不用管
+
         let qField = isTender==true?"tenderQuantity":"quantity";
         let mField = "materialQuantity"; //材料计算的工料机消耗量
 
         for(let pglj of project_gljs ){
             let pg_index = this.getIndex(pglj,this.gljKeyArray);
-            pglj[sField] = 0;
-            pglj[tField] = 0;
             pglj[qField] = 0;
             pglj[mField] = 0;
             let gljGroup = rationGljGroup[pglj.id]?rationGljGroup[pglj.id]:[];//定额工料机没有,有可能是定额类型的工料机
             let result = this.getQuantityPerGLJ(gljGroup,rations,rationMap,pglj,billIDs,tech_billIDS,q_decimal,_,scMathUtil,isTender);
-            pglj[sField] = result.subdivisionQuantity;
-            pglj[tField] = result.techQuantity;
             pglj[qField] = result.quantity;
             quantityMap[pg_index] = pglj;
         }
-        //材料计算中,工料机的消耗量
-        if(projectGLJDatas.freightList) this.setMaterialCalcQuantity(quantityMap,projectGLJDatas.freightList,q_decimal,_,scMathUtil); //运费计算中工料机的消耗量
-        if(projectGLJDatas.originalList) this.setMaterialCalcQuantity(quantityMap,projectGLJDatas.originalList,q_decimal,_,scMathUtil);//原价计算中工料机的消耗量
-
         //计算做为组成物的消耗量
         for(let pkey in mixRatioMap){
             let mixRatioList = mixRatioMap[pkey];
@@ -44,16 +37,30 @@ let gljUtil = {
                 let p_glj = quantityMap[pkey];
                 if(m_glj&&p_glj&&!gljUtil.isConcreteType(p_glj.type) ){//混凝土、砂浆、配合比组成物的消耗量在定额下已经有体现了,不用再计算进去
                     let quantity = scMathUtil.roundForObj(parseFloat(p_glj[qField])*parseFloat(m.consumption),q_decimal);
-                    let techQuantity = scMathUtil.roundForObj(parseFloat(p_glj[tField])*parseFloat(m.consumption),q_decimal);
-                    let subdivisionQuantity = scMathUtil.roundForObj(parseFloat(p_glj[sField])*parseFloat(m.consumption),q_decimal);
-                    let materialQuantity = scMathUtil.roundForObj(parseFloat(p_glj[mField])*parseFloat(m.consumption),q_decimal);
                     m_glj[qField] =  scMathUtil.roundForObj(parseFloat(m_glj[qField])+quantity,q_decimal);
-                    m_glj[tField] =  scMathUtil.roundForObj(parseFloat(m_glj[tField])+techQuantity,q_decimal);
-                    m_glj[sField] =  scMathUtil.roundForObj(parseFloat(m_glj[sField])+subdivisionQuantity,q_decimal);
+                }
+            }
+        }
+
+        //材料计算中,工料机的消耗量
+        if(projectGLJDatas.freightList) this.setMaterialCalcQuantity(quantityMap,projectGLJDatas.freightList,q_decimal,_,scMathUtil,isTender); //运费计算中工料机的消耗量
+        if(projectGLJDatas.originalList) this.setMaterialCalcQuantity(quantityMap,projectGLJDatas.originalList,q_decimal,_,scMathUtil,isTender);//原价计算中工料机的消耗量
+
+        //因为材料计算里自采材料产生的消耗量和进行材料计算的父工料机的消耗量有关,所以材料计算中的组成物的消耗量要在上一步的组成物计算完后,再计算自采材料里组成物的消耗量,所认两个组成物计算不能合并,而且乘的值也不同
+        for(let pkey in mixRatioMap){
+            let mixRatioList = mixRatioMap[pkey];
+            for(let m of mixRatioList){
+                let m_index = this.getIndex(m,this.gljKeyArray);
+                let m_glj = quantityMap[m_index];
+                let p_glj = quantityMap[pkey];
+                if(m_glj&&p_glj&&!gljUtil.isConcreteType(p_glj.type)&& p_glj[mField] > 0){//混凝土、砂浆、配合比组成物的消耗量在定额下已经有体现了,不用再计算进去
+                    let materialQuantity = scMathUtil.roundForObj(parseFloat(p_glj[mField])*parseFloat(m.consumption),q_decimal);
+                    m_glj[qField] =  scMathUtil.roundForObj(parseFloat(m_glj[qField])+materialQuantity,q_decimal);
                     m_glj[mField] =  scMathUtil.roundForObj(parseFloat(m_glj[mField])+materialQuantity,q_decimal);
                 }
             }
         }
+
         //计算经过场外运输损耗后的总消耗量
         for(let pglj of project_gljs ){
             let offSiteTransportLossRate = this.getOffSiteTransportLossRate(pglj);
@@ -63,20 +70,24 @@ let gljUtil = {
             pglj.quantity = scMathUtil.roundForObj(pglj.quantity +  pglj.transportLossQuantity ,q_decimal);
         }
     },
-    setMaterialCalcQuantity:function (quantityMap,calcList,q_decimal,_,scMathUtil) {
+    setMaterialCalcQuantity:function (quantityMap,calcList,q_decimal,_,scMathUtil,isTender) {
+        let qField = isTender==true?"tenderQuantity":"quantity";
         for(let t of calcList){
-            let rationIDMap = _.indexBy(t.rations,"ID");
-            if(t.ration_gljs){
-                for(let rg of t.ration_gljs){
-                    let rIndex = this.getIndex(rg);
-                    let pglj = quantityMap[rIndex];
-                    let ration = rationIDMap[rg.rationID];
-                    if(pglj && ration){
-                        let rg_quantity = scMathUtil.roundForObj(rg.quantity,q_decimal);
-                        let r_quantity = scMathUtil.roundForObj(ration.quantity,q_decimal);
-                        let result = scMathUtil.roundForObj(rg_quantity * r_quantity,q_decimal);
-                        pglj.quantity = scMathUtil.roundForObj(pglj.quantity + result,q_decimal);
-                        pglj.materialQuantity = scMathUtil.roundForObj(pglj.materialQuantity + result,q_decimal);
+            if(quantityMap[t.connect_key] && quantityMap[t.connect_key][qField] > 0){
+                let rationIDMap = _.indexBy(t.rations,"ID");
+                if(t.ration_gljs){
+                    for(let rg of t.ration_gljs){
+                        let rIndex = this.getIndex(rg);
+                        let pglj = quantityMap[rIndex];
+                        let ration = rationIDMap[rg.rationID];
+                        if(pglj && ration){
+                            let rg_quantity = scMathUtil.roundForObj(rg.quantity,q_decimal);
+                            let r_quantity = scMathUtil.roundForObj(ration.quantity,q_decimal);
+                            let result = scMathUtil.roundForObj(rg_quantity * r_quantity,q_decimal);
+                            result = scMathUtil.roundForObj(quantityMap[t.connect_key][qField] * result,q_decimal);
+                            pglj.quantity = scMathUtil.roundForObj(pglj.quantity + result,q_decimal);
+                            pglj.materialQuantity = scMathUtil.roundForObj(pglj.materialQuantity + result,q_decimal);
+                        }
                     }
                 }
             }
@@ -105,8 +116,6 @@ let gljUtil = {
     getQuantityPerGLJ : function (ration_glj_list,rations,rationMap,pglj,billIDs,tech_billIDS,q_decimal,_,scMathUtil,isTender) {
         let result={};
         let quantity_sum=0;//工料机汇总消耗量
-        let sum = 0;//分部分项总消耗量
-        let tech_sum = 0;//技术措施总消耗量
         for(let rg of ration_glj_list){
             let tem_ration = rationMap[rg.rationID];
             let r_quantity = tem_ration?scMathUtil.roundForObj(tem_ration.quantity,q_decimal):0;
@@ -120,12 +129,6 @@ let gljUtil = {
             }
             let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal);
             quantity_sum = scMathUtil.roundForObj(quantity_sum+total,q_decimal);
-            if(_.includes(billIDs,rg.billsItemID)){//计算分部分项
-                sum = scMathUtil.roundForObj(sum+total,q_decimal);
-            }
-            if(_.includes(tech_billIDS,rg.billsItemID)){//计算技术措施项目消耗量
-                tech_sum = scMathUtil.roundForObj(tech_sum+total,q_decimal);
-            }
         }
         for(let ra of rations){//计算定额类型工料机的消耗量
             if(ra.type == this.rationType.gljRation&&ra.projectGLJID===pglj.id){
@@ -135,17 +138,8 @@ let gljUtil = {
                     r_quantity = this.getRationTenderQuantity(ra,q_decimal,scMathUtil);
                 }
                 quantity_sum = scMathUtil.roundForObj(quantity_sum+r_quantity,q_decimal);
-                if(_.includes(billIDs,ra.billsItemID)){//计算分部分项
-                    sum = scMathUtil.roundForObj(sum+r_quantity,q_decimal);
-                }
-                if(_.includes(tech_billIDS,ra.billsItemID)){//计算技术措施项目消耗量
-                    tech_sum = scMathUtil.roundForObj(tech_sum+r_quantity,q_decimal);
-                }
             }
-
         }
-        result.subdivisionQuantity = sum;
-        result.techQuantity = tech_sum;
         result.quantity = quantity_sum;
         return result;
     },
@@ -355,9 +349,10 @@ let gljUtil = {
         let str = type + "";
         return parseInt(str.substr(0,1));
     },
-    sortRationGLJ:function (list) {
+    sortRationGLJ:function (list, std) {
+        const field = std ? 'gljType' : 'type';
         list = _.sortByAll(list, [function (item) {
-            return gljUtil.getMainType(item.type);
+            return gljUtil.getMainType(item[field]);
         }, gljUtil.getCodeSortMath()]);
         return list;
     },

+ 3 - 2
public/web/sheet/sheet_common.js

@@ -184,7 +184,7 @@ var sheetCommonObj = {
                 this.setCheckBoxCell(row,col,sheet,val)
             }
             if(setting.header[col].cellType === "comboBox"){
-                this.setComboBox(row,col,sheet,setting.header[col].options,setting.header[col].editorValueType);
+                this.setComboBox(row,col,sheet,setting.header[col].options,setting.header[col].editorValueType,setting.header[col].editable,setting.header[col].maxDropDownItems);
             }
             if(setting.header[col].cellType === "selectButton"){
                 this.setSelectButton(row,col,sheet,setting.header[col]);
@@ -308,7 +308,7 @@ var sheetCommonObj = {
         sheet.getCell(row, col).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
 
     },
-    setComboBox(row,col,sheet,options,editorValueType,editable){
+    setComboBox(row,col,sheet,options,editorValueType,editable,maxDropDownItems){
         //let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
         let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
         if(options){
@@ -317,6 +317,7 @@ var sheetCommonObj = {
                 dynamicCombo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
             }
             if(editable) dynamicCombo.editable(true);
+            if(maxDropDownItems) dynamicCombo.maxDropDownItems(maxDropDownItems);
         }
         sheet.setCellType(row, col,dynamicCombo,GC.Spread.Sheets.SheetArea.viewport);
     },

+ 3 - 3
server.js

@@ -37,8 +37,8 @@ app.engine('.html', require('ejs').__express);
 app.set('view engine', 'html');
 
 let bodyParser = require('body-parser');
-app.use(bodyParser.urlencoded({limit: '10mb', extended: false}));
-app.use(bodyParser.json({limit: '10mb'}));
+app.use(bodyParser.urlencoded({limit: '100mb', extended: false}));
+app.use(bodyParser.json({limit: '100mb'}));
 
 app.use(session({
     name: 'yanghuSession',
@@ -95,7 +95,7 @@ app.use(async function (req, res, next) {
 });
 //加载路由文件
 fileUtils.getGlobbedFiles('./modules/**/routes/*.js').forEach(function(modelPath) {
-    require(path.resolve(modelPath))(app);
+    if(modelPath.indexOf("import/routes")==-1) require(path.resolve(modelPath))(app);//排除掉导出导入服务
 });
 
 //app.use(express.static(_rootDir+"/web"));

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

@@ -391,4 +391,9 @@ input.text-right{
 .annotate-color-7::before{
     color:#ECE0F5 !important;
     -webkit-text-stroke:.5px #ced4da;
+}
+.text-ellipsis {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
 }

+ 1 - 1
web/building_saas/glj/html/project_glj.html

@@ -224,7 +224,7 @@
             </div>
             <div class="modal-body">
                 <div class="form-group">
-                    <label>辅助生产间接费费率(%)</label>
+                    <label id = "assistProductionLabel">辅助生产间接费费率(%)</label>
                     <input class="form-control" id="assistProductionFeeRate" value="">
                 </div>
             </div>

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

@@ -5,7 +5,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
-    <title><%= projectData.name !== undefined ? projectData.name : '造价书' %>-纵横公路养护造价</title>
+    <title><%= projectData.name !== undefined ? projectData.name : '造价书' %>-纵横公路养护造价</title>
 
 
     <link rel="stylesheet" href="/lib/jquery-ui/jquery-ui.css" type="text/css">
@@ -25,7 +25,7 @@
     <link rel="stylesheet" href="/lib/spreadjs/views/gc.spread.views.dataview.10.0.0.css">
     <!-- jquery.contextmenu -->
    <!-- <link rel="stylesheet" href="/lib/jquery-contextmenu/jquery.contextMenu.css" type="text/css">-->
-   
+
     <link rel="shortcut icon" href="/web/building_saas/css/favicon.ico">
     <link rel="icon" type="image/gif" href="/web/building_saas/css/animated_favicon1.gif">
     <style type="text/css">
@@ -1031,7 +1031,7 @@
                 </div>
             </div>
         </div>
-    </div>    
+    </div>
     <!--弹出列设置-->
   <!--  <div class="modal fade" id="column" data-backdrop="static">
         <div class="modal-dialog modal-lg" role="document" style="width: 350px;">

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

@@ -100,7 +100,7 @@ let cbTools = {
         //首先提取出多处引用的进行排序
         for(let i = 0, len = figureF.length; i < len; i++){
             let figure = figureF[i];
-            if(figure.type === 'base' && cbTools.isDef(calcBase.baseFigures[figure.value])){
+            if(figure.type === 'base' &&  calcBase.baseFigures && cbTools.isDef(calcBase.baseFigures[figure.value])){
                 let bill = this.isDef(calcBase.baseFigures[figure.value]['fixedBill']) ? calcBase.baseFigures[figure.value]['fixedBill']['bill'] : null;
                 let figureMultiRef = calcBase.baseFigures[figure.value]['multiRef'];
                 if(this.isDef(figureMultiRef)){

+ 10 - 3
web/building_saas/main/js/models/project_glj.js

@@ -860,14 +860,19 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
          if(type == "freight" && temp.conveyance !="自办运输") return null;
         let sum =0;
         let gljMap = {};
-        let pgljMap =_.indexBy(this.datas.gljList, 'id');
+        let decimal = type == "freight"?getDecimal("glj.unitPrice"):getDecimal("glj.unitPriceHasMix");
+        //因为材料计算的数据是保存在单价文件里的,有可能存在共享的情况,这样的话就不能用单价文件里的项目工料机ID来匹配,要用5大项匹配
+        let pgljMap = {};
+        for(let pg of this.datas.gljList){
+            pgljMap[gljUtil.getIndex(pg)] = pg
+        }
         for(let g of temp.ration_gljs){
             gljMap[g.rationID]?gljMap[g.rationID].push(g):gljMap[g.rationID]=[g];
         }
         for(let r of temp.rations){
             sum = scMathUtil.roundForObj(sum + calcRation(r,gljMap[r.ID],pgljMap,priceMap),6);
         }
-        sum = scMathUtil.roundForObj(sum,getDecimal("glj.unitPrice"))+"";
+        sum = scMathUtil.roundForObj(sum,decimal)+"";
         if(type == "freight" && temp.unitFreight!= sum) return {ID:temp.ID,doc:{unitFreight:sum}};
         if(type == "price" && temp.supplyPrice !=sum) return {ID:temp.ID,doc:{supplyPrice:sum}};
     }
@@ -884,7 +889,7 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
             let machineSum = 0;
             let rationQuantity = scMathUtil.roundForObj(ration.quantity,getDecimal("ration.quantity"));
             for(let g of gljs){
-                gljOprObj.setGLJPrice(g,pMap[g.projectGLJID]);
+                gljOprObj.setGLJPrice(g,pMap[gljUtil.getIndex(g)]);
                 if(priceMap && priceMap[g.projectGLJID]) g.marketPrice = scMathUtil.roundForObj(priceMap[g.projectGLJID]);
                 let quantity = scMathUtil.roundForObj(g.quantity,getDecimal("glj.quantity"));
                 let t = scMathUtil.roundForObj(quantity * g.marketPrice * rationQuantity,processDecimal);//市场价
@@ -982,6 +987,8 @@ ProjectGLJ.prototype.calcMaterialRation = function(ID,type){//计算带定额的
         if(task && material){
             if(type == "freight") projectObj.project.projectGLJ.updateFreightCalc([task],material.id);
             if(type == "price") projectObj.project.projectGLJ.updatePriceCalc([task],material.id);
+        }else {
+            materialCalcObj.showDatas();
         }
     }
 };

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

@@ -424,7 +424,6 @@ let ration_glj = {
                 }
                 rationNode.data.adjustState = result.adjustState;
                 projectObj.mainController.refreshTreeNode([rationNode]);
-                gljOprObj.refreshView();
                 for (let o of oldData) {
                     if (this.needShowToTree(o)) {
                         let node = me.findGLJNodeByID(o.ID);  //找到对应的树节点
@@ -434,6 +433,7 @@ let ration_glj = {
                 project.calcProgram.calcAndSave(rationNode,function () {
                     installationFeeObj.calcInstallationFee();
                 });
+                gljOprObj.refreshView();
                 projectObj.project.projectGLJ.loadData();
             }catch (e){
                 console.log(e)
@@ -494,7 +494,9 @@ let ration_glj = {
                 projectObj.project.projectGLJ.loadData(function () {//等项目工料机加载完成后再给用户编辑
                     me.refreshTreeNodeIfNeeded(recode);//刷新造价书上的树节点(如果需要)
                     me.reCalcWhenGLJChange(recode);//触发计算定额以及父节点
-					zmhs_obj.refreshStableDataIfNeeded();                    $.bootstrapLoading.end();
+					zmhs_obj.refreshStableDataIfNeeded();
+                    gljOprObj.refreshView();
+					$.bootstrapLoading.end();
                     installationFeeObj.calcInstallationFee();
                 });
             };

+ 6 - 7
web/building_saas/main/js/views/fee_rate_view.js

@@ -594,13 +594,12 @@ var feeRateObject={
                      let doc = {"subFeeRate":temR.subFeeRate};
                      let valueKey = valueArray.join('-');
                      let valueMaps = r.subFeeRate.valueMaps;
-                     if(subRate.name == "工地转移(km)"&& value && value < 50){//工地转移50km以内按50km算
-                         valueKey = "50";
-                         temP.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
-                     }
-                     if(subRate.name == "综合里程(km)"&& value && value < 3){//综合里程3km以内按3km算
-                          valueKey = "3";
-                         temP.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
+                     if(me.feeRateSpecialHandle){//不同编办特殊处理
+                         let sf = me.feeRateSpecialHandle(subRate,value);
+                         if(!_.isEmpty(sf)){
+                             valueKey = sf.valueKey;
+                             temP.value = sf.value;
+                         }
                      }
                      let rate = _.find(valueMaps,{"ID":valueKey});
                      if(isDef(rate)) {//找到了,直接改费率值

+ 2 - 1
web/building_saas/main/js/views/glj_col.js

@@ -64,7 +64,8 @@ let gljCol = {
             {headerName: "消耗量", headerWidth: 80, dataCode: "consumption", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"}
         ],
         view: {
-            lockColumns: [0,1,2,3,4,5,6,7]
+            lockColumns: [0,1,2,3,4,5,6,7],
+            rowHeaderWidth: 25
         }
     },
     scopeSetting:{

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

@@ -1168,9 +1168,9 @@ var gljOprObj = {
                     //gljOprObj.sheetData = gljOprObj.sheetData.concat(result.showData);
                     project.projectGLJ.loadData(function () {
                         project.ration_glj.addToMainTree(result.showData);//组成物不会显示到造价书页面
-                        gljOprObj.refreshView();
                         project.calcProgram.calcAndSave(selected);
                         projectObj.mainController.refreshTreeNode([selected]);
+                        gljOprObj.refreshView();
                         $.bootstrapLoading.end();
                     });
                 }
@@ -1215,7 +1215,6 @@ var gljOprObj = {
                 let data = result.data;
                 let nodes = [selected];
                 project.projectGLJ.loadData(function () {//加载完项目工料机再计算
-                    gljOprObj.refreshView();
                     let node = project.ration_glj.updateGLJNodeAfterReplace(data);
                     if(node) nodes.push(node);
                     /*if (project.ration_glj.needShowToTree(data)) {//当替换的是主材或设备时,刷新对应的树节点
@@ -1232,6 +1231,7 @@ var gljOprObj = {
                     selected.data.name = result.name;
                     projectObj.mainController.refreshTreeNode(nodes);
                     project.calcProgram.calcAndSave(selected);
+                    gljOprObj.refreshView();
                     $.bootstrapLoading.end();
                 });
             }
@@ -1272,9 +1272,9 @@ var gljOprObj = {
                 }
             })
             project.projectGLJ.loadData(function () {
-                me.refreshView();
                 var rationNodes = me.refreshStateAfterMreplace(stateList, nodes);
                 project.calcProgram.calcNodesAndSave(rationNodes);
+                me.refreshView();
                 $.bootstrapLoading.end();
             });
         })

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

@@ -377,10 +377,13 @@ function getGLJData(actionType) {
     $('#actionType').val(actionType);
     $.bootstrapLoading.start();
     projectObj.project.ration_glj.getGLJData(function (result) {
-        // 目前只有浙江2015需要处理
+        // 目前只有浙江2015需要特殊处理处理
         if (gljOprObj.sortSelectViewGLJ) {
             gljOprObj.sortSelectViewGLJ(result.datas.stdGLJ);
             gljOprObj.sortSelectViewGLJ(result.datas.complementaryGLJs);
+        } else {
+            result.datas.stdGLJ = _.sortBy(result.datas.stdGLJ, 'code');
+            result.datas.complementaryGLJs = _.sortBy(result.datas.complementaryGLJs, 'code');
         }
         gljOprObj.treeData = result.datas.treeData;
         //zTreeHelper.createTree(result.datas.treeData, gljOprObj.gljTreeSetting, "gljTree", gljOprObj);

+ 25 - 19
web/building_saas/main/js/views/material_calc_view.js

@@ -8,14 +8,14 @@ materialCalcObj = {
     materialDatas:[],
     materialSetting:{
         header:[
-            {headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String"},
-            {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
-            {headerName: "预算价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},
-            {headerName: "供应地点", headerWidth: 100, dataCode: "supplyLocation", hAlign: "left", dataType: "String"},
+            {headerName: "编号", headerWidth: 70, dataCode: "code", dataType: "String"},
+            {headerName: "名称", headerWidth: 105, dataCode: "name", dataType: "String"},
+            {headerName: "预算价", headerWidth: 60, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},
+            {headerName: "供应地点", headerWidth: 75, dataCode: "supplyLocation", hAlign: "left", dataType: "String"},
             {headerName: "原价", headerWidth: 60, dataCode: "originalPrice", hAlign: "right", dataType: "String"},
             {headerName: "单位运费", headerWidth: 60, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
-            {headerName: "单位毛重(吨)", headerWidth: 60, dataCode: "grossWeightCoe_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
-            {headerName: "装卸总次数", headerWidth: 60, dataCode: "totalLoadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "单位毛重(吨)", headerWidth: 65, dataCode: "grossWeightCoe_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "装卸总次数", headerWidth: 53, dataCode: "totalLoadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
             {headerName: "每增加一次装卸损耗率", headerWidth: 80, dataCode: "handlingLossRate_n", hAlign: "right", dataType: "Number",validator:"number"},
             {headerName: "场外运输损耗率", headerWidth: 60, dataCode: "offSiteTransportLossRate_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
             {headerName: "场外运输损耗", headerWidth: 60, dataCode: "offSiteTransportLoss", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
@@ -25,6 +25,7 @@ materialCalcObj = {
         ],
         view: {
             lockColumns: ["code","name","marketPrice",'offSiteTransportLoss','purchaseStorage'],
+            rowHeaderWidth:25,
             colHeaderHeight:36
         }
     },
@@ -35,21 +36,22 @@ materialCalcObj = {
     userFreightList:[],
     freightSetting:{
         header:[
-            {headerName: "起讫地点", headerWidth: 80, dataCode: "start", dataType: "String"},
-            {headerName: "运输工具", headerWidth: 80, dataCode: "conveyance", dataType: "String"},
-            {headerName: "单位运价", headerWidth: 60, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
-            {headerName: "km运距", headerWidth: 60, dataCode: "kmDistance", hAlign: "right", dataType: "String",validator:"number"},
-            {headerName: "装卸费\n单价", headerWidth: 60, dataCode: "unitLoadingFee", hAlign: "right", dataType: "String",validator:"number"},
-            {headerName: "装卸\n次数", headerWidth: 60, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
-            {headerName: "其它\n费用", headerWidth: 60, dataCode: "otherFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
-            {headerName: "运价增\n加率(%)", headerWidth: 60, dataCode: "freightIncreaseRate", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
-            {headerName: "加权\n系数", headerWidth: 60, dataCode: "weightCoe", hAlign: "right", dataType: "Number",validator:"number"},
+            {headerName: "起讫地点", headerWidth: 85, dataCode: "start", dataType: "String"},
+            {headerName: "运输工具", headerWidth: 65, dataCode: "conveyance", dataType: "String"},
+            {headerName: "材料类型", headerWidth: 65, dataCode: "materialType", visible: false,dataType: "String",cellType:"comboBox",options:["","地方材料","外购材料","沥青、燃料等"]},
+            {headerName: "单位运价", headerWidth: 65, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
+            {headerName: "km运距", headerWidth: 55, dataCode: "kmDistance", hAlign: "right", dataType: "String",validator:"number"},
+            {headerName: "装卸费\n单价", headerWidth: 53, dataCode: "unitLoadingFee", hAlign: "right", dataType: "String",validator:"number"},
+            {headerName: "装卸\n次数", headerWidth: 41, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
+            {headerName: "其它\n费用", headerWidth: 41, dataCode: "otherFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "运价增\n加率(%)", headerWidth: 55, dataCode: "freightIncreaseRate", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "加权\n系数", headerWidth: 41, dataCode: "weightCoe", hAlign: "right", dataType: "Number",validator:"number"},
             {headerName: "计算式", headerWidth: 170, dataCode: "exp", hAlign: "left", dataType: "Number",getText:'forExp'},//,decimalField:"glj.unitPrice"
-            {headerName: "计算方式", headerWidth: 80, dataCode: "calcType",visible: false, dataType: "String",cellType:"comboBox",options:["全国","内蒙古"]},
-            {headerName: "材料类型", headerWidth: 80, dataCode: "materialType", visible: false,dataType: "String",cellType:"comboBox",options:["","地方材料","外购材料","沥青、燃料等"]}
+            {headerName: "计算方式", headerWidth: 80, dataCode: "calcType",visible: false, dataType: "String",cellType:"comboBox",options:["全国","内蒙古"]}
         ],
         view: {
             lockColumns: ["exp"],
+            rowHeaderWidth:25,
             colHeaderHeight:36
         },
         getText:{
@@ -78,6 +80,7 @@ materialCalcObj = {
         ],
         view: {
             lockColumns: [],
+            rowHeaderWidth:25,
             colHeaderHeight:36
         }
     },
@@ -93,10 +96,11 @@ materialCalcObj = {
             {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
             {headerName: "单位", headerWidth: 100, dataCode: "unit", dataType: "String"},
             {headerName: "数量", headerWidth: 100, dataCode: "quantity", dataType: "String",hAlign: "right",validator:"number"},
-            {headerName: "高原取费类别", headerWidth: 100, dataCode: "feeType", dataType: "String",visible: false,cellType:"comboBox",options:[]}
+            {headerName: "高原取费类别", headerWidth: 100, dataCode: "feeType", dataType: "String",visible: false,cellType:"comboBox",options:[],maxDropDownItems:5}
         ],
         view: {
             lockColumns: ["unit"],
+            rowHeaderWidth:25,
             colHeaderHeight:36
         }
 
@@ -639,7 +643,8 @@ materialCalcObj = {
             return;
         }
         if(dataCode == 'coe'||dataCode == 'supplyPrice'){
-            value = value?scMathUtil.roundForObj(value,getDecimal("glj.unitPrice"))+'':'0'//4舍五入加默认为0
+            let decimal = dataCode == 'supplyPrice'?getDecimal("glj.unitPriceHasMix"):getDecimal("glj.unitPrice");
+            value = value?scMathUtil.roundForObj(value,decimal)+'':'0'//4舍五入加默认为0
         }
         if(args.row >= me.priceDatas.length){//新增
             let newData = {
@@ -941,6 +946,7 @@ $(function () {
         me.updateMaterialRationAss($(this).val(),$(this));
     });
     $('#calcCoeDiv').on('show.bs.modal', function () {
+        if(materialCalcObj.getAssistProductionLabel) $("#assistProductionLabel").text(materialCalcObj.getAssistProductionLabel);
         $("#assistProductionFeeRate").val(scMathUtil.roundForObj(projectObj.project.projectGLJ.datas.constData.assistProductionFeeRate,getDecimal("feeRate")));
     })
     $("#calcCoeConfirm").click(function () {

+ 13 - 5
web/building_saas/pm/html/project-management.html

@@ -47,7 +47,7 @@
 <img src="/web/dest/css/img/refresh.png" id="refresh_pic" style="display: none">
 <img src="/web/dest/css/img/share.png" id="share_pic" style="display: none">
 <img src="/web/dest/css/img/copy.png" id="copy_pic" style="display: none">
-<img src="/web/dest/css/img/work.png" id="work_pic" style="display: none">
+<img src="/web/dest/css/img/edit.png" id="edit_pic" style="display: none">
 <div class="header">
     <div class="top-msg clearfix">
         <div class="alert alert-warning mb-0 py-0" role="alert" style="display: none;">
@@ -102,7 +102,15 @@
                         <div class="toolsbar">
                             <legend class="m-0 px-4">项目管理
                                 <div class="tools-btn btn-group align-top px-3 mt-2">
-                                    <a id="startA" href="javascript:void(0);" data-toggle="modal" data-target="#addPoj3" class="btn btn-sm"><i class="fa fa-sticky-note-o"></i> 新建</a>
+                                    <!--<a id="startA" href="javascript:void(0);" data-toggle="modal" data-target="#addPoj3" class="btn btn-sm"><i class="fa fa-sticky-note-o"></i> 新建</a>-->
+                                    <div class="btn btn-sm">
+                                        <a class="dropdown-toggle" id="addMenuBtn" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus"></i> 新建</a>
+                                        <div class="dropdown-menu dropright" id="addMenu">
+                                            <a href="javascript:;" id="addFolderSub" class="dropdown-item" data-toggle="modal" data-target="#add-folder-dialog"><i class="fa fa-folder-open-o" aria-hidden="true"></i> 新建文件夹</a>
+                                            <a href="javascript:;" id="addProjectSub" class="dropdown-item" data-toggle="modal" data-target="#add-project-dialog"><i class="fa fa-cubes" aria-hidden="true"></i> 新建建设项目</a>
+                                            <a href="javascript:;" id="addTenderSub" class="dropdown-item" data-toggle="modal" data-target="#add-tender-dialog"><i class="fa fa fa-sticky-note-o" aria-hidden="true"></i> 新建分段</a>
+                                        </div>
+                                    </div>
                                     <a id="upLevel" href="javascript:void(0);" class="btn btn-light btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
                                     <a id="downLevel" href="javascript:void(0);" class="btn btn-light btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
                                     <a id="upMove" href="javascript:void(0);" class="btn btn-light btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
@@ -344,7 +352,7 @@
                         </div>
                     </div>
                     <span class="form-text text-danger" id="engineering-info" style="display: none;">请选择养护类别</span>
-                    <div class="form-group row">
+                    <div class="form-group row" id="tender-feeStandard-group">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">费用标准</label>
                         <div class="col">
                             <select class="form-control  form-control-sm" id="tender-feeStandard"></select>
@@ -509,7 +517,7 @@
                 <div class="row">
                     <div class="col-6">
                         <h5>选择项目</h5>
-                        <div class="modal-auto-height">
+                        <div style="height: 400px">
                             <div id="replaceSpread" style="height: 100%"></div>
                         </div>
                         <!--<div class="custom-control custom-checkbox">
@@ -606,7 +614,7 @@
                 </div>
                 <table class="table table-sm" id="shareFindDiv">
                     <tbody style="display: block">
-                    <tr><th style="width: 112px;">姓名</th><th style="width: 165px;">公司</th><th style="width: 136px;">手机</th><th style="width: 160px;">邮箱</th><th style="width: 90px;">允许拷贝</th><th style="width: 90px;">允许协作</th><th style="width: 90px;">添加分享</th></tr>
+                    <tr><th style="width: 112px;">姓名</th><th style="width: 165px;">公司</th><th style="width: 136px;">手机</th><th style="width: 160px;">邮箱</th><th style="width: 90px;">允许拷贝</th><th style="width: 90px;">允许编辑</th><th style="width: 90px;">添加分享</th></tr>
                     <tr><td id="user_name">张三</td><td id="user_company">XX公司</td><td id="user_mobile">12345678900</td><td id="user_email"></td><td><input id="allowCopy" type="checkbox"></td><td><input id="allowCooperate" type="checkbox"></td><td><a id="share-confirm" href="javascript:void(0)" class="btn btn-sm btn-primary">添加分享</a></td></tr>
                     </tbody>
                 </table>

+ 77 - 41
web/building_saas/pm/js/pm_newMain.js

@@ -184,42 +184,69 @@ const projTreeObj = {
             this.bindEvent(newWorkBook);
             this.loadContextMenu();
             this.loadStartMenu();
+        }else {
+            workBook.refresh();
         }
         return newWorkBook;
     },
+    // 获取新建按钮是否是disabled
+    getAddBtnDisabled: function (action) {
+        switch (action) {
+            case projectType.folder:
+            case projectType.project:
+            case projectType.tender:
+                return false;
+            default:
+                return true;
+        }
+    },
+    refreshAddMenuItems: function () {
+        const items = [{
+            el: $('#addFolderSub'),
+            action: projectType.folder,
+        }, {
+            el: $('#addProjectSub'),
+            action: projectType.project,
+        }, {
+            el: $('#addTenderSub'),
+            action: projectType.tender,
+        }];
+        items.forEach(item => {
+            const disabled = this.getAddBtnDisabled(item.action);
+            if (disabled) {
+                item.el.addClass('disabled');
+            } else {
+                item.el.removeClass('disabled');
+            }
+        });
+    },
     //右键菜单项
     contextMenuItems: {
         addFolder: {
             name: "新建文件夹",
             icon: 'fa-folder-o',
             disabled: function () {
-                return false;
+                return projTreeObj.getAddBtnDisabled(projectType.folder);
             },
             callback: function (key, opt) {
                 $("#add-folder-dialog").modal("show");
-                setTimeout(function () {
-                    $('#folder-name')[0].focus();
-                }, 300);
             }
         },
         addProject: {
             name: "新建建设项目",
             icon: 'fa-cubes',
             disabled: function () {
-                return false;
+                return projTreeObj.getAddBtnDisabled(projectType.project);
             },
             callback: function (key, opt) {
                 $('#add-project-dialog').modal('show');
-                setTimeout(function () {
-                    $('#project-name')[0].focus();
-                }, 300);
             },
         },
         addTender: {
             name: "新建分段",
             icon: 'fa-sticky-note-o',
             disabled: function () {
-                return false;
+                return projTreeObj.getAddBtnDisabled(projectType.tender);
             },
             callback: function (key, opt) {
                 //弹出新建单位工程之前,判断当前使用版本,且当前使用单位工程数是否已到最大值
@@ -346,9 +373,6 @@ const projTreeObj = {
                 let selectedItem = projTreeObj.tree.selected;
                 return !(selectedItem && selectedItem.data.projType === projectType.project);
             },
-           /* visible:function () {
-                return false
-            },*/
             callback: function (key, opt) {
                 //获取当前节点的建设项目ID
                 projTreeObj.exportProject(projTreeObj.tree.selected.data.ID,projTreeObj.tree.selected.data.name);
@@ -370,14 +394,9 @@ const projTreeObj = {
                 }
                 return true;
             },
-          /*  visible:function () {
-              return false
-            },*/
             callback: function (key, opt) {
                 //获取当前节点的建设项目ID
                 $("#import").modal('show');
-
-               // projTreeObj.exportProject(projTreeObj.tree.selected.data.ID);
             }
         }
     },
@@ -1518,16 +1537,15 @@ const projTreeObj = {
                     await  setTimeoutSync(null,500);//设置间隔
                     sumString = sumString + spString +tenderString;
                 }
-
             }
-            $.bootstrapLoading.progressEnd();
           //  console.log(JSON.parse(sumString));
-
             saveProjectFile(sumString);
-
         }catch (e){
             alert("导出失败!请查看log.");
             console.log(e)
+        }finally {
+            await  setTimeoutSync(null,500);//设置间隔
+            $.bootstrapLoading.progressEnd();
         }
 
 
@@ -1612,18 +1630,19 @@ $(document).ready(function() {
     });
     //绑定新建建设项目、新建文件夹、重命名Enter键事件
     bindInputs($('#project-name'), $('#folder-name'), $('#rename-name'));
-
+    //绑定新建窗口显示事件
+    bindModalShown($('#add-folder-dialog'), $('#add-project-dialog'), $('#add-tender-dialog'));
     //绑定新建建设项目、新建文件夹、重命名弹窗隐藏事件
     bindModalsHidden($('#add-project-dialog'), $('#add-folder-dialog'), $('#rename-dialog'));
 
-    // 新增建设项目点击
-    /*$('#add-project-btn').click(function () {
-        let selectedItem = projTreeObj.tree.selected;
-        $('#add-project-dialog').modal('show');
-        setTimeout(function () {
-            $('#project-name')[0].focus();
-        }, 300);
-    });*/
+    // 新建子菜单有效性刷新
+    $('#addMenuBtn').click(function () {
+        const menuDisplay = !$('#addMenu').is(':visible');
+        if (!menuDisplay) {
+            return;
+        }
+        projTreeObj.refreshAddMenuItems();
+    });
 
     // 新增建设项目操作
     $('#addProjOk').click(function () {
@@ -1744,9 +1763,16 @@ $(document).ready(function() {
             $('#regionDiv').find('select').append($opt);
         }
     }
-
+    // 某些费用定额不显示费用标准
+    const compilationWithoutFeeStandard = [
+        // 内蒙2019
+        '5d776dad620cc0000dab6b2a'
+    ];
     // 新增单位工程弹层改变
     $('#add-tender-dialog').on('show.bs.modal', function() {
+        if (compilationWithoutFeeStandard.includes(compilationData._id)) {
+            $('#tender-feeStandard-group').hide();
+        }
         //clear info
         $('#poj-name-info').hide();
         $('#tender-name-info').hide();
@@ -1768,9 +1794,6 @@ $(document).ready(function() {
             setRegionOpts(regions);
             $('#regionDiv').show();
         }
-        setTimeout(function () {
-            $('#tender-name')[0].focus();
-        }, 300);
     });
 
     // 新增单位工程
@@ -2222,6 +2245,18 @@ function AddProject() {
     }
 }
 
+function bindModalShown(folderDialog, projDialog, tenderDialog) {
+    folderDialog.on('shown.bs.modal', function () {
+        $('#folder-name').focus();
+    });
+    projDialog.on('shown.bs.modal', function () {
+        $('#project-name').focus();
+    });
+    tenderDialog.on('shown.bs.modal', function () {
+        $('#tender-name').focus();
+    });
+}
+
 //新建建设项目、新建单项工程、新建文件夹、重命名弹窗隐藏事件
 function bindModalsHidden(projDialog, folderDialog, renameDialog){
     projDialog.on('hidden.bs.modal', function () {
@@ -2605,7 +2640,7 @@ function setProjOptions(projs, selected){
         $("#poj-name").val(firstProj.data.name);
         setFileOptions(firstProj.data.ID);
         for(let i = 0, len = projs.length; i < len; i++){
-            let $proj = $("<a>").val(projs[i].data.ID).text(projs[i].data.name);
+            let $proj = $(`<a class='text-ellipsis' title="${projs[i].data.name}">`).val(projs[i].data.ID).text(projs[i].data.name);
             $proj.addClass("dropdown-item");
             $proj.attr("href", "javascript:void(0);");
             $proj.click(function () {
@@ -2677,10 +2712,6 @@ function AddTender() {
         let unitPriceFileObj = getAddTenderFile(tenderName, $('#unit-price'), $("#unit-price").children());
         let feeFileObj = getAddTenderFile(tenderName, $('#tender-fee-rate'), $("#tender-fee-rate").children());
         let valuation = $("#valuation").val();
-        /*if(!valuation || valuation === ''){
-            setDangerInfo($('#valuation-info'), '请选择计价规则');
-            return false;
-        }*/
         /*
         * 计价规则只是隐藏显示了,工程专业id还是要通过养护类别、费用标准确定,因为后台结构没有变化
         * */
@@ -2689,6 +2720,7 @@ function AddTender() {
             setDangerInfo($('#engineering-info'), '请选择养护类别');
             return false;
         }
+        // 费用标准只是隐藏显示了(某些费用定额下)
         let feeName = $('#tender-feeStandard').val();
         if(!feeName || feeName === ''){
             setDangerInfo($('#feeStandard-info'), '请选择费用标准');
@@ -3665,6 +3697,7 @@ $("#confirm-import").click(function() {
             cache: false,
             contentType: false,
             processData: false,
+            timeout:300000,
             beforeSend: function() {
                 self.attr('disabled', 'disabled');
                 self.text('上传中...');
@@ -3674,6 +3707,9 @@ $("#confirm-import").click(function() {
                 $.bootstrapLoading.progressEnd();
                 if(response.error == 1){
                     alert(response.msg);
+                    setTimeout(function () {
+                        $.bootstrapLoading.progressEnd();//不做这个的话太快,页面不会自动关闭
+                    },500)
                 }else {
                     refreshAllPage();
                 }
@@ -3747,7 +3783,7 @@ function setShareToModal(selected){
                                           <th style="width: 136px;">手机</th>
                                           <th style="width: 136px;">邮箱</th>
                                           <th style="width: 90px;">允许拷贝</th>
-                                          <th style="width: 90px;">允许协作</th>
+                                          <th style="width: 90px;">允许编辑</th>
                                           <th style="width: 90px;">取消分享</th>
                                </tr>`;
         infoArr.push(theadHtml);
@@ -3858,4 +3894,4 @@ function refreshProjSummary(project, summaryInfo) {
         }
     }
     projTreeObj.refreshNodeData(refreshNodes);
-}
+}

+ 7 - 6
web/building_saas/pm/js/pm_share.js

@@ -429,9 +429,9 @@ const pmShare = (function () {
     }
     //互动单元格
     function getInteractionCell() {
-        let workImg = document.getElementById('work_pic'),
-            workImgWidth = 13,
-            workImgHeight = 13,
+        let editImg = document.getElementById('edit_pic'),
+            editImgWidth = 13,
+            editImgHeight = 13,
             copyImg = document.getElementById('copy_pic'),
             copyImgWidth = 13,
             copyImgHeight = 13;
@@ -455,11 +455,12 @@ const pmShare = (function () {
                 let acStyle = options.sheet.getActualStyle(options.row, options.col),
                     zoom = options.sheet.zoom();
                 let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: options.sheet, row: options.row, col: options.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-                let nowX  = Math.floor(x) + textLength + 3,
+                const imgIndent = 5;
+                let nowX  = Math.floor(x) + textLength + imgIndent,
                     nowY = Math.floor((y + (y + h)) / 2) - 7;
                 if (node.data.allowCooperate) {
-                    ctx.drawImage(workImg, nowX, nowY, workImgWidth, workImgHeight);
-                    nowX += workImgWidth;
+                    ctx.drawImage(editImg, nowX, nowY, editImgWidth, editImgHeight);
+                    nowX += editImgWidth;
                 }
                 if (node.data.allowCopy) {
                     ctx.drawImage(copyImg, nowX, nowY, copyImgWidth, copyImgHeight);

+ 59 - 0
web/building_saas/pm/js/pm_tree.js

@@ -251,9 +251,14 @@ const pmTree = {
                     node.parent.children.splice(iIndex, 1);
                 }
                 sortTreeItems(this);
+                this.sourceData = this.items.reduce((acc, cur) => {
+                    acc.push(cur.data);
+                    return acc;
+                }, []);
             };
 
             Tree.prototype.loadData = function (arrData) {
+                this.sourceData = arrData;
                 let i, that = this;
                 let nodesIndex = {};
                 function getPreNode(id){
@@ -319,6 +324,7 @@ const pmTree = {
             };
 
             Tree.prototype.addNodeData = function (data, parent, nextSibling, nodeState = null) {
+                this.sourceData.push(data);
                 var node = null;
                 var pNode = parent ? parent : this._root;
                 if (!nextSibling || (nextSibling.parent === pNode && pNode.childIndex(nextSibling) > -1)) {
@@ -379,6 +385,59 @@ const pmTree = {
 
             };
 
+            Tree.prototype.check = function (_root) {
+                if (this.sourceData.length !== this.items.length) {
+                    const data = this.sourceData.filter(item => {
+                        const findData = this.items.find(node => node.data.ID === item.ID);
+                        return !findData;
+                    });
+                    console.log('丢失数据:');
+                    console.log(data);
+                    return false;
+                }
+                return isValid(_root.children);
+                function isValid(nodes) {
+                    for (let node of nodes) {
+                        if (node.data.ParentID !== -1 &&
+                            (!node.parent || node.parent.data.ID !== node.data.ParentID)) {
+                            console.log(`${node.serialNo() + 1}:${node.data.name} parent对应错误`);
+                            return false;
+                        }
+                        if (node.data.ParentID === -1 && node.parent && node.parent !== _root) {
+                            console.log(`${node.serialNo() + 1}:${node.data.name} 不应有parent`);
+                            return false;
+                        }
+                        if (node.data.NextSiblingID !== -1 &&
+                            (!node.nextSibling || node.nextSibling.data.ID !== node.data.NextSiblingID)) {
+                            console.log(`${node.serialNo() + 1}:${node.data.name} next对应错误`);
+                            return false;
+                        }
+                        if (node.data.NextSiblingID === -1 && node.nextSibling) {
+                            console.log(`${node.serialNo() + 1}:${node.data.name} 不应有next`);
+                            return false;
+                        }
+                        let parent = node.parent,
+                            nodeIdx = parent.children.indexOf(node),
+                            nextIdx = parent.children.indexOf(node.nextSibling);
+                        if (nodeIdx !== -1 && nextIdx !== -1 && nodeIdx > nextIdx) {
+                            console.log(`${node.serialNo() + 1}:${node.data.name} node索引大于next索引`);
+                            return false;
+                        }
+                        if (node.nextSibling && node.parent !== node.nextSibling.parent) {
+                            console.log(`${node.serialNo() + 1}:${node.data.name} 与兄弟节点 ${node.nextSibling.serialNo() + 1}:${node.nextSibling.data.name} 父节点不同`);
+                            return false;
+                        }
+                        if (node.children.length) {
+                            let v = isValid(node.children);
+                            if (!v) {
+                                return false;
+                            }
+                        }
+                    }
+                    return true;
+                }
+            };
+
             Tree.prototype.refreshData = function () {
 
             };

BIN
web/dest/css/img/edit.png


+ 15 - 158
web/over_write/js/chongqing_2018.js

@@ -2,163 +2,20 @@
  * Created by zhang on 2018/8/14.
  */
 
-if(typeof projectGljObject !== 'undefined'){
-    projectGljObject.displayTypeMap=[
-        {ID:'LABOUR',text:'人工'},
-        {ID:'GENERAL_MATERIAL',text:'材料'},
-        {ID:'GENERAL_MACHINE',text:'施工机具'},//重庆2018定额中去掉了主材,机械的显示改为了施工机具
-        {ID:'MAIN_MATERIAL',text:'主材'}
-    ];
-}
-if(typeof gljUtil !== 'undefined'){
-    gljUtil.hasCompMachine = [301,304];//有组成物的机械
-    gljUtil.machineComposition = [303,305,306,307,308,309,310,311];//可以做为机械组成物的类型
-}
 
-//允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、其他材料费、机械台班、机上人工、仪器仪表、燃料动力费、折旧费、
-// 检修费、维护费、安拆费及场外运费、校验费、其他费用、主材、企业管理费、利润、一般风险费
-if(typeof allowGljType !== 'undefined'){
-    allowGljType = [1, 201, 202, 203, 204, 205, 206, 207, 301, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 4, 6, 7, 8];
-}
-if(typeof allowComponent !== 'undefined'){
-    //允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、仪器仪表、主材
-    allowComponent = [202, 203, 204, 301, 304, 4];
-}
-if(typeof componentType !== 'undefined'){
-    //可以作为组成物的工料机类型:普通材料、机上人工、燃料动力费、折旧费、检修费、维护费、安拆费及场外运费、校验费、其他费用、主材
-    componentType = [201, 303, 305, 306, 307, 308, 309, 310, 311, 4];
-}
-if(typeof machineAllowComponent !== 'undefined'){
-    //允许含有组成物的机械工料机类型:机械台班、仪器仪表
-    machineAllowComponent = [301, 304];
-}
-if(typeof machineComponent !== 'undefined'){
-    //可以作为机械工料机组成物的工料机类型:机械组成物、机上人工、燃料动力费、折旧费、检修费、维护费、安拆费及场外运费、校验费、其他费用
-    machineComponent = [303, 305, 306, 307, 308, 309, 310, 311];
+//重庆综合里程、工地转移费率值修改特殊处理
+
+if(typeof feeRateObject !== 'undefined'){
+   feeRateObject.feeRateSpecialHandle = function (subRate,value) {
+       let result = {};
+       if(subRate.name == "工地转移(km)"&& value && value < 50){//工地转移50km以内按50km算
+           result.valueKey = "50";
+           result.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
+       }
+       if(subRate.name == "综合里程(km)"&& value && value < 3){//综合里程3km以内按3km算
+           result.valueKey = "3";
+           result.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
+       }
+       return result;
+   }
 }
-if(typeof materialAllowComponent !== 'undefined'){
-    //允许含有组成物的材料工料机类型:混凝土、砂浆、配合比
-    materialAllowComponent = [202, 203, 204];
-}
-if(typeof materialComponent !== 'undefined'){
-    //可以作为材料工料机组成物的工料机类型:普通材料
-    materialComponent = [201];
-}
-
-// CSL, 2018-08-21 计算程序定额基数、取费类别的覆盖。-----------------------------------------------------------------------
-// 重庆养护作为原始代码模块,以下变量及方法定义已写入原始位置,此处无需覆盖。其它地区的养护需在此位置覆盖,参见neimeng_2019.js。
-// let isCQ2018 = true;
-// function overwriteRationCalcBases (taxType){};
-// (function overwriteFeeTypes() {})();
-
-
-//清单计算基数相关
-if(typeof baseFigureMap !== 'undefined'){
-    baseFigureMap = {
-        //与清单直接关联=======
-        '分部分项工程费': {base: 'FBFXGCF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
-        '分部分项定额人工费': {base: 'FBFXDEJJRGF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
-        '分部分项定额材料费': {base: 'FBFXDEJJCLF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
-        '分部分项定额施工机具使用费': {base: 'FBFXDEJJJXF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
-        '分部分项主材费': {base: 'FBFXZCF', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
-        '分部分项人工工日': {base: 'FBFXRGGR', fixedFlag: fixedFlag.SUB_ENGINERRING, class: 'FBFX'},
-        '措施项目费': {base: 'CSXMF', fixedFlag: fixedFlag.MEASURE, class: 'CSXM'},
-        '组织措施项目费': {base: 'ZZCSXMF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
-        '组织措施项目定额人工费': {base: 'ZZCSXMDEJJRGF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
-        '组织措施项目定额材料费': {base: 'ZZCSXMDEJJCLF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
-        '组织措施项目定额施工机具使用费': {base: 'ZZCSXMDEJJJXF', fixedFlag: fixedFlag.CONSTRUCTION_ORGANIZATION, class: 'CSXM'},
-        '安全文明施工专项费': {base: 'AQWMSGZXF', fixedFlag: fixedFlag.SAFETY_CONSTRUCTION, class: 'CSXM'},
-        '技术措施项目费': {base: 'JSCSXMF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
-        '技术措施项目定额人工费': {base: 'JSCSXMDEJJRGF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
-        '技术措施项目定额材料费': {base: 'JSCSXMDEJJCLF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
-        '技术措施项目定额施工机具使用费': {base: 'JSCSXMDEJJJXF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
-        '技术措施项目主材费': {base: 'JSCSXMZCF', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
-        '技术措施项目人工工日': {base: 'JSCSXMRGGR', fixedFlag: fixedFlag.CONSTRUCTION_TECH, class: 'CSXM'},
-        '其他项目费': {base: 'QTXMF',  fixedFlag: fixedFlag.OTHER, class: 'QTXM'},
-        '规费': {base: 'GF', fixedFlag: fixedFlag.CHARGE, class: 'GF'},
-        '税金': {base: 'SJ', fixedFlag: fixedFlag.TAX, class: 'SJ'},
-        '增值税': {base: 'ZZS', class: 'SJ', fixedFlag: fixedFlag.ADDED_VALUE_TAX},
-        //不于清单直接关联==========
-        '建筑面积': {base: 'JZMJ', class: 'FBFX'},
-        '人材机价差': {base: 'RCJJC', class: 'RCJ'},
-        '人工价差': {base: 'RGJC', class: 'RCJ'},
-        '材料价差': {base: 'CLJC', class: 'RCJ'},
-        '施工机具使用费价差': {base: 'JXJC', class: 'RCJ'},
-        '分部分项人材机价差': {base: 'FBFXRCJJC', class: 'RCJ'},
-        '分部分项人工价差': {base: 'FBFXRGJC', class: 'RCJ'},
-        '分部分项材料价差': {base: 'FBFXCLJC', class: 'RCJ'},
-        '分部分项施工机具使用费价差': {base: 'FBFXJXJC', class: 'RCJ'},
-        '技术措施项目人材机价差': {base: 'JSCSXMRCJJC', class: 'RCJ'},
-        '技术措施项目人工价差': {base: 'JSCSXMRGJC', class: 'RCJ'},
-        '技术措施项目材料价差': {base: 'JSCSXMCLJC', class: 'RCJ'},
-        '技术措施项目施工机具使用费价差': {base: 'JSCSXMJXJC', class: 'RCJ'},
-        '甲供定额人工费': {base: 'JGDEJJRGF', class: 'RCJ'},
-        '甲供定额材料费': {base: 'JGDEJJCLF', class: 'RCJ'},
-        '甲供定额施工机具使用费': {base: 'JGDEJJJXF', class: 'RCJ'},
-        '甲供人工费': {base: 'JGRGF', class: 'RCJ'},
-        '甲供材料费': {base: 'JGCLF', class: 'RCJ'},
-        '甲供施工机具使用费费': {base: 'JGJXF', class: 'RCJ'},
-        '甲供主材费': {base: 'JGZCF', class: 'RCJ'},
-        '甲定定额人工费': {base: 'JDDEJJRGF', class: 'RCJ'},
-        '甲定定额材料费': {base: 'JDDEJJCLF', class: 'RCJ'},
-        '甲定定额施工机具使用费': {base: 'JDDEJJJXF', class: 'RCJ'},
-        '甲定人工费': {base: 'JDRGF', class: 'RCJ'},
-        '甲定材料费': {base: 'JDCLF', class: 'RCJ'},
-        '甲定施工机具使用费': {base: 'JDJXF', class: 'RCJ'},
-        '甲定主材费': {base: 'JDZCF', class: 'RCJ'},
-        '暂估材料费(从子目汇总)': {base: 'ZGCLFFZM', class: 'RCJ'},
-        '税前工程造价': {base: 'SQGCZJ', class: 'SQGCZJ',
-            cycleCalcRef: [fixedFlag.SUB_ENGINERRING, fixedFlag.OTHER, fixedFlag.CHARGE],   //循环计算相关固定行,由于计算排除了本身,不用判断措施项目
-            multiRef: [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE, fixedFlag.OTHER, fixedFlag.CHARGE]},//相关固定行
-    };
-}
-if(typeof baseFigureTemplate !== 'undefined'){
-    baseFigureTemplate['ZZS'] =  function (tender) {//增值税
-        if(cbTools.isUnDef(calcBase.fixedBills[fixedFlag.ADDED_VALUE_TAX])){
-            return 0;
-        }
-        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
-        let bill = calcBase.fixedBills[fixedFlag.ADDED_VALUE_TAX]['bill'];
-        if(cbTools.isUnDef(bill)) return 0;
-        if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
-        return cbTools.isDef(bill.feesIndex.common) && cbTools.isDef(bill.feesIndex.common[totalFeeType]) ? bill.feesIndex.common[totalFeeType] : 0;
-    };
-}
-if(typeof figureClassTemplate !== 'undefined'){
-    figureClassTemplate['ADDED_VALUE_TAX'] = {flag: fixedFlag.ADDED_VALUE_TAX, filter: ['SJ', 'ZZS', 'SQGCZJ']}
-};
-//去除分类分包费
-if(typeof $ !== 'undefined' && $('#cbClassList')){
-    $('#cbClassList').find('li:eq(5)').remove();
-}
-//测试地区============
-/*if(typeof regions !== 'undefined') {
-    regions = [ '兰州', '定西', '天水', '平凉', '庆阳', '武威', '金昌', '张掖', '酒泉', '甘矿', '嘉峪关', '临夏', '合作', '武都', '白银'];
-}*/
-//==============
-
-
-
-//这个文档浏览器库和服务器端共用,所以这个文件中用到的变量都要记得做undefined判断,不然后端读取时会有问题
-//=================================================== 前后端分割线 ======================================================================
-if(typeof module !== 'undefined'){
-    module.exports = {
-        getCusCoeContent: getCusCoeContent,
-        getCustomerCoeData: getCustomerCoeData
-    };
-}
-
-function getCusCoeContent() {
-    return '人工×1,材料×1,施工机具×1,主材×1,设备×1'//2019-07-08 bug 添加自定义系数添加设备
-}
-
-function getCustomerCoeData() {
-    return [
-        {amount:1, operator:'*', gljCode:null, coeType:'定额'},
-        { amount:1, operator:'*', gljCode:null, coeType:'人工'},
-        { amount:1, operator:'*', gljCode:null, coeType:'材料'},
-        { amount:1, operator:'*', gljCode:null, coeType:'施工机具'},
-        { amount:1, operator:'*', gljCode:null, coeType:'主材'},
-        { amount:1, operator:'*', gljCode:null, coeType:'设备'}
-    ]
-}

+ 14 - 0
web/over_write/js/neimeng_2019.js

@@ -254,4 +254,18 @@ if(typeof materialCalcObj !== 'undefined' && materialCalcObj.rationSetting){
     if(h) h.visible = true;
     let mt = _.find(materialCalcObj.freightSetting.header,{"dataCode":"materialType"});
     if(mt) mt.visible = true;
+}
+
+
+//内蒙施工进出场(km)费率值修改特殊处理
+
+if(typeof feeRateObject !== 'undefined'){
+    feeRateObject.feeRateSpecialHandle = function (subRate,value) {
+        let result = {};
+        if(subRate.name == "施工进出场(km)"&& value && value < 5){//输入的数值(公里数)< 5时,该项费用不计取。
+            result.valueKey = "0";
+            result.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
+        }
+        return result;
+    }
 }

+ 9 - 0
web/over_write/js/zhejiang_2005.js

@@ -191,6 +191,12 @@ if(typeof gljUtil !== 'undefined'){
     gljUtil.getCodeSortMath = getCodeSortMath
 }
 
+if(typeof materialCalcObj !== 'undefined'){
+    materialCalcObj.getAssistProductionLabel = function () {
+        return "辅助生产现场经费费率(%)";
+    }
+}
+
 
 if(typeof module !== 'undefined'){
     let _= require('lodash');
@@ -206,6 +212,9 @@ if(typeof module !== 'undefined'){
                 let str = type + "";
                 return parseInt(str.substr(0,1));
             }
+        },
+        getDefalutAssistProductionFeeRate:function () {
+            return 15
         }
     };
 }

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

@@ -5,7 +5,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
-    <title>用户信息填写-纵横公路养护造价</title>
+    <title>用户信息填写-纵横公路养护造价</title>
     <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
     <link rel="stylesheet" href="/web/building_saas/css/main.css">
     <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">

+ 2 - 2
web/users/html/login-sms.html

@@ -4,7 +4,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
-    <title>用户登录-纵横建筑计价</title>
+    <title>用户登录-纵横公路养护云造价</title>
     <!-- inject:css -->
     <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
     <link rel="stylesheet" href="/web/building_saas/css/main.css">
@@ -17,7 +17,7 @@
     <div class="login-bg"></div>
     <div class="container login-panel">
         <form class="form-signin">
-            <h1 class="d-flex justify-content-center mb-5"><img src="/web/building_saas/img/building.png" width="40" height="40" class="mr-3" style="margin-top: 5px"> 纵横公路养护云</h1>
+            <h1 class="d-flex justify-content-center mb-5"><img src="/web/building_saas/img/building.png" width="40" height="40" class="mr-3" style="margin-top: 5px"> 纵横公路养护云造价</h1>
             <p class="mb-1">您关闭了「账号登录」,请通过手机验证码登录。</p>
             <p class="">请点击“获取验证码”,验证码将发送至手机 <%= mobile.substr(0, 3) + '****' + mobile.substr(7, 11) %>,注意查收。</p>
             <div class="form-row sms-login-modal">

+ 2 - 2
web/users/html/login-ver.html

@@ -4,7 +4,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
-    <title>用户登录-纵横公路养护云</title>
+    <title>用户登录-纵横公路养护云造价</title>
     <!-- inject:css -->
     <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
     <link rel="stylesheet" href="/web/building_saas/css/main.css">
@@ -17,7 +17,7 @@
     <div class="login-bg"></div>
     <div class="container login-panel ver-panel">
             <h1 class="d-flex justify-content-center mb-5">
-                <img src="/web/building_saas/img/building.png" width="40" height="40" class="mr-3" style="margin-top: 5px"> 纵横公路养护云</h1>
+                <img src="/web/building_saas/img/building.png" width="40" height="40" class="mr-3" style="margin-top: 5px"> 纵横公路养护云造价</h1>
             <div class="d-flex justify-content-between">
                 <h5 class="modal-title">选择费用定额</h5>
                 <p class=" text-warning"><i class="fa fa-exclamation-triangle"></i> <b>登录设置</b> 中可以修改您的登录习惯。</p>

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

@@ -4,7 +4,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
-    <title>用户登录-纵横公路养护造价</title>
+    <title>用户登录-纵横公路养护造价</title>
     <!-- inject:css -->
     <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
     <link rel="stylesheet" href="/web/building_saas/css/main.css">
@@ -19,7 +19,7 @@
         <form class="form-signin" method="post" onsubmit="return false">
             <h1 class="d-flex justify-content-center mb-5">
                 <img src="/web/building_saas/img/building.png" width="40" height="40" class="mr-3" style="margin-top: 5px">
-                纵横公路养护云
+                纵横公路养护云造价
             </h1>
             <div class="form-group user-login-modal">
                 <input id="inputEmail" class="form-control " name="inputEmail" placeholder="通行账号 邮箱/手机" autofocus="" />