Selaa lähdekoodia

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

TonyKang 6 vuotta sitten
vanhempi
commit
52d3581874

+ 10 - 0
modules/pm/controllers/pm_controller.js

@@ -28,6 +28,7 @@ const _ = require('lodash');
 import SectionTreeDao from '../../complementary_ration_lib/models/sectionTreeModel';
 let sectionTreeDao = new SectionTreeDao();
 let consts = require('../../main/models/project_consts');
+const rationLibModel = mongoose.model('std_ration_lib_map');
 
 //统一回调函数
 let callback = function(req, res, err, message, data){
@@ -206,6 +207,15 @@ module.exports = {
             let engineeringLibModel = new EngineeringLibModel();
             let engineeringInfo = project !== null && project.property.engineering_id !== undefined ?
                 await engineeringLibModel.getEngineering(project.property.engineering_id) : null;
+            //查找定额库的定额库编码
+            if (Array.isArray(engineeringInfo.ration_lib)) {
+                let rationLibIDs = engineeringInfo.ration_lib.map(data => data.id);
+                let rationLibs = await rationLibModel.find({ID: {$in: rationLibIDs}}, 'ID libCode');
+                for (let rationLib of rationLibs) {
+                    let lib = engineeringInfo.ration_lib.find(data => data.id == rationLib.ID);
+                    lib.libCode = rationLib.libCode;
+                }
+            }
             let projInfo = project._doc;
             if (engineeringInfo !== null) {
                 if(engineeringInfo.billsGuidance_lib){

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

@@ -47,7 +47,7 @@
     </script>
 </head>
 
-<body>
+<body oncontextmenu="return false;"> <!--屏蔽input鼠标右键-->
 <!--<div id="toolToastWrap" style="left: 20px; right: 30px; position: fixed; z-index: 10001; top: 100px;">
     <div id="toolToast" class="toolToast">
         <span id="tool-toast-content">右键不支持粘贴外部内容,请使用Ctrl+V粘贴。<span id="toolToastBtn">我知道了</span></span>
@@ -1204,6 +1204,31 @@
             </div>
         </div>
     </div>
+
+    <!--弹出 批量替换下一步-->
+    <div class="modal fade" id="mreplace_next_div" data-backdrop="static" style="z-index: 1060">
+        <input type="hidden" id =''>
+        <div class="modal-dialog modal-lg"  role="document">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">选择替换范围</h5>
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                        <span aria-hidden="true">&times;</span>
+                    </button>
+                </div>
+                <div class="modal-body" style="padding: 0px">
+                    <div class="row" style="height:400px"><!--sjs id设置在这个div-->
+                        <div class="col-12" style="overflow: hidden" id="scopeSpread"></div>
+                    </div>
+                </div>
+                <div class="modal-footer">
+                    <button class="btn btn-primary" id="scope_position_confirm">确定</button>
+                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                </div>
+            </div>
+        </div>
+    </div>
+
     <!--工料机类型选择-->
     <div class="modal fade" id="glj_class_div" data-backdrop="static">
         <div class="modal-dialog modal-m" role="document" id="class_con">

+ 28 - 9
web/building_saas/main/js/models/exportStandardInterface.js

@@ -39,6 +39,9 @@ const XMLStandard = (function () {
         //加载数据间隔,减少服务器压力
         const TIMEOUT_TIME = 500;
 
+        function isDef(v) {
+            return typeof v !== 'undefined' && v !== null;
+        }
         /*
          * 检查
          * 创建节点时检查节点的数据
@@ -386,7 +389,7 @@ const XMLStandard = (function () {
                 {name: '定额编号', value: source.viewCode, required: true, minLen: 1, maxLen: 80, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '项目名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '单位', value: source.unit, required: true, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE},
-                {name: '定额库编码', value: source.libCode, required: true}, //todo
+                {name: '定额库编码', value: source.libCode, required: true},
                 {name: '原始定额编号', value: source.code, minLen: 1, maxLen: 80, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '子目类型', value: source.subType, required: true, type: TYPE.INT, enumeration: ['0', '1', '2', '3', '4', '5', '6']},  //todo
                 {name: '工程量', value: source.quantity, required: true, type: TYPE.DECIMAL},
@@ -490,7 +493,7 @@ const XMLStandard = (function () {
         //技术措施清单定义
         function JSCSBills(source) {
             let attrs = [
-                {name: '技术措施清单', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
                 {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.NUM2, required: true},
             ];
             element.call(this, '技术措施清单', attrs);
@@ -633,7 +636,8 @@ const XMLStandard = (function () {
                 {name: '计算基础', value: source.calcBase,  maxLen: 255},
                 {name: '费率', value: source.feeRate, type: TYPE.DECIMAL},
                 {name: '金额', value: source.commonTotalFee, type: TYPE.NUM2, required: true},
-                {name: '不计入合价标志', value: !!source.isEstimate, type: TYPE.BOOL},
+                {name: '不计入合价标志', value: false, type: TYPE.BOOL},
+                {name: '招标人标志', value: true, type: TYPE.BOOL},
                 {name: '备注', value: source.remark, maxLen: 255}
             ];
             element.call(this, '其他列项', attrs);
@@ -916,13 +920,22 @@ const XMLStandard = (function () {
             //获取单位工程详细数据
             let tenderDetail = PROJECT.createNew(tenderData.ID, userID);
             await tenderDetail.loadDataSync();
+            //设置定额库编码
+            tenderDetail.rationLibMap = {};
+            let defaultLib = null;
+            if (tenderDetail.projectInfo.engineeringInfo && Array.isArray(tenderDetail.projectInfo.engineeringInfo.ration_lib)) {
+                defaultLib = tenderDetail.projectInfo.engineeringInfo.ration_lib.find(data => data.isDefault);
+                for (let lib of tenderDetail.projectInfo.engineeringInfo.ration_lib) {
+                    tenderDetail.rationLibMap[lib.id] = lib;
+                }
+            }
             //单位工程
             let tenderSource = {
                 code: getIncreamentData('projectCode'),
                 name: tenderData.name,
                 engineeringName: tenderData.property.engineeringName,
                 summaryInfo: summaryInfo[tenderData.ID],
-                defaultRationLibCode: tenderData.defaultRationLibCode,
+                defaultRationLibCode: defaultLib.libCode,
                 taxType: tenderData.property.taxType
             };
             let tender = curTenderEle = new Tender(tenderSource);
@@ -994,9 +1007,12 @@ const XMLStandard = (function () {
         }
         /*
         * 加载清单项目
-        * @param {Object}node(清单树节点) {Array}allRation(项目所有定额数据) {Array}allRationGlj(项目所有定额人材机数据) {Object}decimal(项目小数位数)
+        * @param {Object}node(清单树节点) {Object}detail
         * */
-        function loadBills(node, allRation, allRationGlj, decimal) {
+        function loadBills(node, detail) {// allRation, allRationGlj, decimal,
+            let allRation = detail.Ration.datas,
+                allRationGlj = detail.ration_glj.datas,
+                decimal = detail.projectInfo.property.decimal;
             let source = {
                 code: node.data.code,
                 name: node.data.name,
@@ -1102,6 +1118,9 @@ const XMLStandard = (function () {
                     isSubcontract: rationData.isSubcontract,
                     remark: rationData.remark
                 };
+                if (rationData.from === 'std' && isDef(rationData.libID)) {    //来自标准库,设置定额库编码
+                    rationSource.libCode = detail.rationLibMap[rationData.libID].libCode;
+                }
                 let ration = new Ration(rationSource);
                 //创建工料分析
                 let gljAnalyze = new GljAnalyze();
@@ -1167,11 +1186,11 @@ const XMLStandard = (function () {
                     fbfxBills.children.push(fbBills);
                     //创建清单项目节点
                     for (let subNode of node.children) {
-                        let fx = loadBills(subNode, detail.Ration.datas, detail.ration_glj.datas, curPMData.tender.property.decimal);
+                        let fx = loadBills(subNode, detail);
                         fbBills.children.push(fx);
                     }
                 } else {
-                    let fxBills = loadBills(node, detail.Ration.datas, detail.ration_glj.datas, curPMData.tender.property.decimal);
+                    let fxBills = loadBills(node, detail);
                     fbfxBills.children.push(fxBills);
                 }
             }
@@ -1249,7 +1268,7 @@ const XMLStandard = (function () {
                         parent.children.push(jscsClass);
                         loadJSCS(jscsClass, node.children);
                     } else {    //清单项目
-                        parent.children.push(loadBills(node, detail.Ration.datas, detail.ration_glj.datas, curPMData.tender.property.decimal));
+                        parent.children.push(loadBills(node, detail));
                     }
                 }
             }

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

@@ -397,7 +397,8 @@ const filterTypeArray = ['1','2','3','4','5'];
 
 const installFeeType = ['子目费用','分项费用','措施费用'];
 const installSectionBase = ['分别按人材机乘系数','人工','材料','机械'];
-const supplyComboMap = [{text:"自行采购",value:0},{text:"完全甲供",value:2},{text:"部分甲供",value:1},{text:"甲定乙供",value:3}];//后来调整了下拉选项的顺序,为了不改之前的业务逻辑,这里的值对换了一下
+//2019-04-02 ,{text:"部分甲供",value:1}  “部分甲供”隐藏,“完全甲供”改文字为“甲供材料”。
+const supplyComboMap = [{text:"自行采购",value:0},{text:"甲供材料",value:2},{text:"甲定乙供",value:3}];//后来调整了下拉选项的顺序,为了不改之前的业务逻辑,这里的值对换了一下
 const materialComboMap = [
     {text:materialType[materialTypeMap.GC],value:materialTypeMap.GC},
     {text:materialType[materialTypeMap.GJ],value:materialTypeMap.GJ},

+ 16 - 11
web/building_saas/main/js/models/project.js

@@ -32,18 +32,23 @@ var PROJECT = {
         };
         tools.doAfterLoad = function(result, callback){
             var counter;
+            //必须要先load ProjectInfo的信息
+            let projectInfoModule = result.find(data => data.moduleName === ModuleNames.projectInfo);
+            if (projectInfoModule) {
+                me._project.projectInfo = projectInfoModule.data;
+            }
             result.forEach(function(item){
-                if (me.modules[item.moduleName]){
-                    me.modules[item.moduleName].loadData(item.data);
-                } else if (item.moduleName === me.projCounter) {
-                    counter = item.data;
-                } else if (item.moduleName === me.projSetting) {
-                    me._project.projSetting = item.data;
-                    me._project.projSetting.moduleName = me.projSetting;
-                }else if(item.moduleName === ModuleNames.projectGLJ){
-                    me._project.projectGLJ.loadToCache(item.data);
-                } else if (item.moduleName === ModuleNames.projectInfo) {
-                    me._project.projectInfo = item.data;
+                if (item.moduleName !== ModuleNames.projectInfo) {
+                    if (me.modules[item.moduleName]){
+                        me.modules[item.moduleName].loadData(item.data);
+                    } else if (item.moduleName === me.projCounter) {
+                        counter = item.data;
+                    } else if (item.moduleName === me.projSetting) {
+                        me._project.projSetting = item.data;
+                        me._project.projSetting.moduleName = me.projSetting;
+                    } else if(item.moduleName === ModuleNames.projectGLJ){
+                        me._project.projectGLJ.loadToCache(item.data);
+                    }
                 }
             });
             for (module in counter) {

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

@@ -646,8 +646,7 @@ var projectObj = {
                     this.locateAtRation(libID, code);
                     this.doAfterGetRationTree = null;
                 };
-            }
-            else {
+            } else {
                 if($('#stdRationLibSelect').select().val() != libID){
                     let libOpts = $('#stdRationLibSelect').find('option');
                     for(let libOpt of libOpts){
@@ -661,8 +660,7 @@ var projectObj = {
                         this.locateAtRation(libID, code);
                         this.doAfterGetRationTree = null;
                     };
-                }
-                else {
+                } else {
                     rationLibObj.locateAtRation(node.data.libID, code);
                 }
             }
@@ -2358,7 +2356,7 @@ $('#compilationIllustration').keyup(function () {
 });
 $('#property_ok').click(async function () {
     //test-----
-  /*  $.bootstrapLoading.start();
+    /*$.bootstrapLoading.start();
     let xmlObj = new XMLStandard(userID, 1);
     await xmlObj.toXml(projectObj.project.ID());
     console.log(xmlObj);

+ 1 - 1
web/building_saas/pm/html/project-management.html

@@ -38,7 +38,7 @@
     </style>
 </head>
 
-<body>
+<body oncontextmenu="return false;">  <!--屏蔽input鼠标右键-->
 <img src="/web/dest/css/img/folder_open.png" id="folder_open_pic" style="display: none">
 <img src="/web/dest/css/img/folder_close.png" id="folder_close_pic" style="display: none">
 <img src="/web/dest/css/img/project.png" id="proj_pic" style="display: none">