Browse Source

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

TonyKang 4 years ago
parent
commit
7f84780aa9

+ 1 - 0
modules/all_models/std_price_info_areas.js

@@ -3,6 +3,7 @@ const mongoose = require('mongoose');
 
 const Schema = mongoose.Schema;
 const priceInfoArea = new Schema({
+    serialNo: Number,
     ID: String,
     compilationID: String,
     name: String

+ 5 - 0
modules/main/controllers/info_price_controller.js

@@ -15,6 +15,11 @@ let controller = {
       data = JSON.parse(data);
       return await info_price_facade.getDataByCondition(data,req.session.sessionCompilation);
     },
+    getClassByAreaID:async function (req){
+        let data = req.body.data;
+        data = JSON.parse(data);
+        return await info_price_facade.getClassByAreaID(data,req.session.sessionCompilation);
+    },
     mutiApplyInfoPrice:async function (req){
       let data = req.body.data;
       data = JSON.parse(data);

+ 19 - 1
modules/main/facade/block_lib_facade.js

@@ -17,6 +17,24 @@ module.exports = {
 // userID、compilationID
 async function getLibNames(data) {
     let libNames = await blModel.find({userID: data.userID, compilationID: data.compilationID}, ["libID","libName","-_id"]);
+    // 块模板库改成组价模板,兼容旧数据
+    const bulks = [];
+    const reg = /块模板库/;
+    libNames.forEach(lib => {
+        if (reg.test(lib.libName)) {
+            const newLibName = lib.libName.replace('块模板库', '组价模板');
+            lib.libName = newLibName;
+            bulks.push({
+                updateOne: {
+                    filter: { libID: lib.libID },
+                    update: { libName: newLibName }
+                }
+            });
+        }
+    });
+    if (bulks.length) {
+        await blModel.bulkWrite(bulks);
+    }
     return libNames;
 };
 
@@ -79,7 +97,7 @@ async function copyTemplateLib(userID, userName, compilationID) {
         userID: userID,
         compilationID: compilationID,
         libID: uuid.v1(),
-        libName: `${userName}的块模板库`,
+        libName: `${userName}的组价模板`,
         datas: template.datas,
         share: template.share
     };

+ 32 - 0
modules/main/facade/info_price_facade.js

@@ -4,17 +4,20 @@
 module.exports={
   getOptions,
   getDataByCondition,
+  getClassByAreaID,
   mutiApplyInfoPrice
 };
 
 const mongoose = require('mongoose');
 let infoLibModel = mongoose.model("std_price_info_lib");
+let infoClassModel = mongoose.model("std_price_info_class");
 let infoItemsModel = mongoose.model("std_price_info_items");
 let infoAreasModel = mongoose.model("std_price_info_areas");
 let unitPriceModel = mongoose.model("unit_price"); 
 let _ = require("lodash");
 let gljUtil = require('../../../public/web/gljUtil');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
+let projectfacade = require('./project_facade');
 // 载入模块
 var Segment = require('segment');
 // 创建实例
@@ -46,6 +49,35 @@ async function getOptions(data,compilation){//data 是预留对象,暂时不
   return {areas:areas,periodMap:periodMap}
 }
 
+async function getClassByAreaID(data,compilation){
+  console.log(data);
+  //要先知道根据期数和编办查找库ID
+  let newList = [];
+  let lib = await infoLibModel.findOne({compilationID:compilation._id,period:data.period})
+  if(lib){
+    let infoClass =  await infoClassModel.find({areaID:data.areaID,libID:lib.ID}).lean();
+    let parentMap=_.groupBy(infoClass, 'ParentID');
+    for(let key in parentMap){
+      parentMap[key] = projectfacade.sortChildren(parentMap[key]);
+    }
+    
+    if(parentMap && parentMap['-1']){
+      getChildern(parentMap['-1'],newList,parentMap)
+    }
+  }
+  
+
+
+  function getChildern(children,list,pm){
+    for(let c of children){
+      list.push(c);
+      if(pm[c.ID]){
+        getChildern(pm[c.ID],list,pm)
+      }
+    }
+  }
+  return newList;
+}
 
 async function getDataByCondition(data,compilation){
   let result = {};

+ 1 - 1
modules/main/middleware/index.js

@@ -55,7 +55,7 @@ function isAjax(req) {
 // 登录状态全局判断
 async function stateChecking(req, res, next) {
     const url = req.originalUrl;
-    if (url=="\/"|| /^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/captcha/.test(url)) {
+    if (url=="\/"|| /^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld\/(?!getCategoryStaff)/.test(url) || /^\/captcha/.test(url)) {
         // 如果是登录页面或短信接口或cld接口则忽略判断数据
         next();
     } else {

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

@@ -8,6 +8,7 @@ module.exports = function (app) {
     let infoController = require('../controllers/info_price_controller');
     infoRouter.post('/getOptions', infoController.action);
     infoRouter.post('/getDataByCondition', infoController.action);
+    infoRouter.post('/getClassByAreaID', infoController.action);
     infoRouter.post('/mutiApplyInfoPrice', infoController.action);
 
     app.use('/infoPrice', infoRouter);

+ 1 - 0
public/web/sheet/sheet_common.js

@@ -164,6 +164,7 @@ var sheetCommonObj = {
         let styleRow=[];
         sheet.suspendPaint();
         sheet.suspendEvent();
+        sheet.setRowCount(data.length);
         for (let col = 0; col < setting.header.length; col++) {
             let hAlign = "left", vAlign = "center";
             if (setting.header[col].hAlign) {

+ 1 - 1
public/web/tree_sheet/tree_sheet_helper.js

@@ -692,7 +692,7 @@ var TREE_SHEET_HELPER = {
         },600)
     },
     delayShowTips:function(hitinfo,setting,tips){//延时显示
-        let delayTimes = 500; //延时时间
+        let delayTimes = 200; //延时时间
         let now_timeStamp = +new Date();
         TREE_SHEET_HELPER.tipTimeStamp = now_timeStamp;
         setTimeout(function () {

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

@@ -152,9 +152,13 @@
               <label class="mr-auto" id = "info-warning"></label>    
               <input type="hidden" class="form-control form-control-sm" id="info_glj_name">
               <input type="hidden" class="form-control form-control-sm" id="info_glj_code">       
+              <input type="hidden" class="form-control form-control-sm" id="info_class">       
               <button type="button" class="btn btn-primary  btn-sm" id="muti_apply_info">批量套用</button>
             </div>
-            <div class="main-data-bottom" id="info_price_sheet"> </div>
+            <div class="main-data-bottom" id="info_price_main" style="display: flex;overflow: hidden;"> 
+              <div id="info_class_sheet" style="width: 30%; overflow: hidden;"></div>
+              <div id="info_price_sheet" style=" width: 70%;overflow: hidden;"></div>
+            </div>
           </div>
         </div>
       </div>

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

@@ -117,7 +117,7 @@
               <a href="javascript:void(0)" class="btn btn-light btn-sm" id="downMove" data-toggle="tooltip"
                 data-placement="bottom" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
               <div class="btn-group ml-2">
-                <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="moreMenuA" role="button"
+                <a class="dropdown-toggle btn btn-light btn-sm" data-toggle="dropdown" href="#" id="moreMenuA" role="button"
                   aria-haspopup="true" aria-expanded="false">更多</a>
                 <div class="dropdown-menu dropright" id="moreMenu">
                   <a id="displayA" href="javascript:void(0);" data-toggle="dropdown"
@@ -220,7 +220,7 @@
                       if (G_SHOW_BLOCK_LIB) {
                         $("#div_more_dropdown_right").append(
                           '<a class="dropdown-item right-nav-link" href="javascript:void(0)" ' +
-                          'id="blockLibTab" relaPanel="#kmbk">块模板库</a>');
+                          'id="blockLibTab" relaPanel="#kmbk">组价模板</a>');
                       }
                     </script>
                   </div>
@@ -375,7 +375,7 @@
                                 id="apply_mbzm">应用</button>
                               <label class="applySuccess"><i class="fa fa-check" aria-hidden="true"></i>成功</label>
                               <button class=" btn btn-primary btn-sm cus-width" type="button"
-                                id="next_mbzm">下一条</button>
+                                id="next_mbzm" data-toggle="tooltip" data-placement="right" data-original-title="跳转到下一条有模板子目内容的定额">下一条</button>
                             </div>
 
                           </div>
@@ -940,10 +940,10 @@
                     <div class="top-content" style="overflow: hidden" id="kmbkTopDiv">
                       <div id="div_block_tree"></div>
                     </div>
-                    <div class="resize-y" id="kmbkResizeA"></div>
+<!--                     <div class="resize-y" id="kmbkResizeA"></div>
                     <div class="bottom-content" id="kmbkMidDiv">
                       <div id="div_block_bill"></div>
-                    </div>
+                    </div> -->
                     <div class="resize-y" id="kmbkResizeB"></div>
                     <div id="kmbkBottomDiv">
                       <div id="div_block_ration"></div>

+ 40 - 30
web/building_saas/main/js/models/calc_program.js

@@ -1813,39 +1813,49 @@ class CalcProgram {
                 };
             }
             else if ((commonCalcType == 1) || (commonCalcType == 3)){
-                let sum_rtf = 0, sum_rttf = 0;
-                for (let node of nodes) {
-                    let ruf = 0, rtuf = 0, rtf = 0, rttf = 0;
-                    if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
-                        ruf = parseFloatPlus(node.data.feesIndex[ft.type].unitFee).toDecimal(decimalObj.bills.unitPrice);
-                        rtuf = parseFloatPlus(node.data.feesIndex[ft.type].tenderUnitFee).toDecimal(decimalObj.bills.unitPrice);
-                        rtf = parseFloatPlus(node.data.feesIndex[ft.type].totalFee).toDecimal(decimalObj.bills.totalPrice);
-                        rttf = parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee).toDecimal(decimalObj.bills.totalPrice);
-                    };
-                    // 取费方式为子目含量,清单行/列的XX单价应 =ROUND( ∑ROUND(定额XX单价*含量,清单单价精度),清单单价精度)
-                    if (me.project.property.billsCalcMode === leafBillGetFeeType.rationContent) {
-                        buf = (buf + (ruf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
-                        node.data.tenderContaion = (node.data.tenderQuantity / bq).toDecimal(decimalObj.process);
-                        btuf = (btuf + (rtuf * parseFloatPlus(node.data.tenderContaion)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
+                if (treeNode.data.lockUnitPrice == true){       // 清单单价锁定
+                    if (treeNode.data.feesIndex && treeNode.data.feesIndex[ft.type]) {
+                        buf = parseFloatPlus(treeNode.data.feesIndex[ft.type].unitFee).toDecimal(decimalObj.bills.unitPrice);
+                        btuf = parseFloatPlus(treeNode.data.feesIndex[ft.type].tenderUnitFee).toDecimal(decimalObj.bills.unitPrice);
+                        btf = (bq * buf).toDecimal(decimalObj.bills.totalPrice);
+                        bttf = (btq * btuf).toDecimal(decimalObj.bills.totalPrice);
+                    }
+                }
+                else{
+                    let sum_rtf = 0, sum_rttf = 0;
+                    for (let node of nodes) {
+                        let ruf = 0, rtuf = 0, rtf = 0, rttf = 0;
+                        if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
+                            ruf = parseFloatPlus(node.data.feesIndex[ft.type].unitFee).toDecimal(decimalObj.bills.unitPrice);
+                            rtuf = parseFloatPlus(node.data.feesIndex[ft.type].tenderUnitFee).toDecimal(decimalObj.bills.unitPrice);
+                            rtf = parseFloatPlus(node.data.feesIndex[ft.type].totalFee).toDecimal(decimalObj.bills.totalPrice);
+                            rttf = parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee).toDecimal(decimalObj.bills.totalPrice);
+                        };
+                        // 取费方式为子目含量,清单行/列的XX单价应 =ROUND( ∑ROUND(定额XX单价*含量,清单单价精度),清单单价精度)
+                        if (me.project.property.billsCalcMode === leafBillGetFeeType.rationContent) {
+                            buf = (buf + (ruf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
+                            node.data.tenderContaion = (node.data.tenderQuantity / bq).toDecimal(decimalObj.process);
+                            btuf = (btuf + (rtuf * parseFloatPlus(node.data.tenderContaion)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
+                        };
+                        sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
+                        sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
                     };
-                    sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
-                    sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
-                };
 
-                if (me.project.property.billsCalcMode == leafBillGetFeeType.rationPriceConverse ||
-                    me.project.property.billsCalcMode == leafBillGetFeeType.rationPrice) {
-                    buf = (sum_rtf / bq).toDecimal(decimalObj.process);
-                    btuf = (sum_rttf / btq).toDecimal(decimalObj.process);
-                };
-                if (isBaseFeeType(ft.type) ||
-                    (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice && ft.type == "common")){
-                    btf = sum_rtf;
-                    bttf = sum_rttf;
+                    if (me.project.property.billsCalcMode == leafBillGetFeeType.rationPriceConverse ||
+                        me.project.property.billsCalcMode == leafBillGetFeeType.rationPrice) {
+                        buf = (sum_rtf / bq).toDecimal(decimalObj.process);
+                        btuf = (sum_rttf / btq).toDecimal(decimalObj.process);
+                    };
+                    if (isBaseFeeType(ft.type) ||
+                        (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice && ft.type == "common")){
+                        btf = sum_rtf;
+                        bttf = sum_rttf;
+                    }
+                    else{
+                        btf = (buf.toDecimal(decimalObj.bills.unitPrice) * bq).toDecimal(decimalObj.process);
+                        bttf = (btuf.toDecimal(decimalObj.bills.unitPrice) * btq).toDecimal(decimalObj.process);
+                    };
                 }
-                else{
-                    btf = (buf.toDecimal(decimalObj.bills.unitPrice) * bq).toDecimal(decimalObj.process);
-                    bttf = (btuf.toDecimal(decimalObj.bills.unitPrice) * btq).toDecimal(decimalObj.process);
-                };
             };
 
             ftObj.totalFee = btf.toDecimal(decimalObj.bills.totalPrice);

+ 10 - 10
web/building_saas/main/js/views/block_lib.js

@@ -55,13 +55,13 @@ var blockLibObj = {
     rationSheet: null,
     rationSetting: {
         header: [
-            {headerName: "编码", headerWidth: 45, dataCode: "code", dataType: "String", hAlign: "center"},
-            {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
-            {headerName: "单位", headerWidth: 40, dataCode: "unit", dataType: "String", hAlign: "center"},
-            {headerName: "含量", headerWidth: 40, dataCode: "contain", dataType: "Number"},
-            {headerName: "取费专业", headerWidth: 70, dataCode: "programName", dataType: "String", hAlign: "center"},
+            {headerName: "编码", headerWidth: 50, dataCode: "code", dataType: "String", hAlign: "center"},
+            {headerName: "名称", headerWidth: 200, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 70, dataCode: "unit", dataType: "String", hAlign: "center"},
+            /* {headerName: "含量", headerWidth: 40, dataCode: "contain", dataType: "Number"},
+            {headerName: "取费专业", headerWidth: 70, dataCode: "programName", dataType: "String", hAlign: "center"}, */
             {headerName: "综合单价", headerWidth: 70, dataCode: "unitFee", dataType: "Number"},
-            {headerName: "子目换算状态", headerWidth: 90, dataCode: "adjustState", dataType: "String"}
+           //{headerName: "子目换算状态", headerWidth: 90, dataCode: "adjustState", dataType: "String"}
         ],
         view: {
             lockColumns: [0, 1, 2, 3, 4, 5, 6]
@@ -121,10 +121,10 @@ var blockLibObj = {
         };
         showBlockTree(me.mainDatas);
 
-        me.billSpread = sheetCommonObj.buildSheet($('#div_block_bill')[0], me.billSetting, 1);
+        /* me.billSpread = sheetCommonObj.buildSheet($('#div_block_bill')[0], me.billSetting, 1);
         me.billSheet = me.billSpread.getSheet(0);
         sheetCommonObj.spreadDefaultStyle(me.billSpread);
-        me.billSheet.setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
+        me.billSheet.setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader); */
 
         me.rationSpread = sheetCommonObj.buildSheet($('#div_block_ration')[0], me.rationSetting, 1);
         me.rationSheet = me.rationSpread.getSheet(0);
@@ -142,13 +142,13 @@ var blockLibObj = {
         if (node.data.type == 2){
             let bill = node.data;
             let rations = bill.children;
-            sheetCommonObj.showData(me.billSheet, me.billSetting, [bill]);
+            //sheetCommonObj.showData(me.billSheet, me.billSetting, [bill]);
             let rCount = (rations.length > 0) ? rations.length : 1;
             me.rationSheet.setRowCount(rCount, GC.Spread.Sheets.SheetArea.viewport);
             sheetCommonObj.showData(me.rationSheet, me.rationSetting, rations);
         }
         else{
-            sheetCommonObj.cleanSheet(me.billSheet, me.billSetting, 1);
+            //sheetCommonObj.cleanSheet(me.billSheet, me.billSetting, 1);
             sheetCommonObj.cleanSheet(me.rationSheet, me.rationSetting, 1);
         }
     },

+ 1 - 0
web/building_saas/main/js/views/calc_program_view.js

@@ -56,6 +56,7 @@ let calcProgramObj = {
             case 4:
                 projectObj.project.calcProgram.innerCalc(treeNode, []);
                 projectObj.project.calcProgram.rationMap = null;
+                projectObj.project.calcProgram.pgljMap = null;
                 delete treeNode.changed;
                 break;
             case 3:

+ 0 - 1
web/building_saas/main/js/views/export_view.js

@@ -41,7 +41,6 @@ const ExportView = (() => {
         sheetCommonObj.spreadDefaultStyle(spread);
         let sheet = spread.getSheet(0);
         sheetCommonObj.initSheet(sheet, sheetSetting, 30);
-        sheet.setRowCount(datas.length);
         sheetCommonObj.showTreeData(sheet, sheetSetting, datas);
     }
     //获取设置的工程编号

+ 2 - 2
web/building_saas/main/js/views/index_view.js

@@ -239,8 +239,8 @@ let indexObj= {
         this.spread.setActiveSheetIndex(1);
         let sheet = this.spread.getActiveSheet();
         refreshValue();
-        this.setRowCountAndLock(sheet,this.engineerFeatureDatas);
         sheetCommonObj.showTreeData(sheet, this.engineerFeatureSetting,this.engineerFeatureDatas);
+        this.setRowCountAndLock(sheet,this.engineerFeatureDatas);
         function refreshValue() {
             let map = projectObj.project.property.engineerFeatures?_.indexBy(projectObj.project.property.engineerFeatures,'ID'):{};
             for(let f of indexObj.engineerFeatureDatas){
@@ -335,8 +335,8 @@ let indexObj= {
         let oldData = sel.row<this.ecoQuantityDatas.length?this.ecoQuantityDatas[sel.row]:null;
         this.ecoQuantityDatas = this.getIndexBillsData(parentMap);
         sheet.setRowCount(0);
-        this.setRowCountAndLock(sheet,this.ecoQuantityDatas);
         sheetCommonObj.showTreeData(sheet, this.ecoQuantitySetting,this.ecoQuantityDatas);
+        this.setRowCountAndLock(sheet,this.ecoQuantityDatas);
         sel.row = oldData?_.findIndex(this.ecoQuantityDatas,{'ID':oldData.ID}):0;
         sheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
 

+ 0 - 1
web/building_saas/main/js/views/item_increase_fee_view.js

@@ -104,7 +104,6 @@ let itemIncreaseFeeObj = {
             if(node.data.calcBase&&node.data.calcBase!="") delete tem.selected;//有基数计算的不可选
             this.scopeDatas.push(tem);
         }
-        this.scopeSheet.setRowCount(this.scopeDatas.length);
         sheetCommonObj.showTreeData(this.scopeSheet, this.scopeSetting,this.scopeDatas);
     },
     onScopeCheckBoxClick:function (sender,args) {

+ 8 - 2
web/building_saas/main/js/views/main_tree_col.js

@@ -321,8 +321,14 @@ let MainTreeCol = {
         unit: function (node,setting) {
             let tips = "";
             //在这里做要不要显示的判断
-             if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示
-                tips = node.data.itemCharacterText?node.data.itemCharacterText:'';
+             if(node.sourceType == ModuleNames.bills){//清单悬浮提示
+                //显示工程量计算规则
+                if(node.data.ruleText){
+                    tips += `<label class="font_blue">工程量计算规则:<br>${node.data.ruleText.replace(/\n/g,"<br>")}</label>`; 
+                }
+                if(projectObj.ifItemCharHiden(setting)){//项目特征列隐藏的时候
+                    tips += node.data.itemCharacterText?`<br>${node.data.itemCharacterText}`:'';
+                } 
              }
             if(node.sourceType == ModuleNames.ration && node.data.type == rationType.ration){//定额类型时,显示人材机,工作内容等
                 //这里的人材机需要进行过滤,在初始化时组装会影响性能,应实时显示

+ 122 - 52
web/building_saas/main/js/views/project_glj_view.js

@@ -13,50 +13,28 @@ let projectGljObject = {
   projectGljSheet: null,
   materialTreeSheet: null,
   projectGljSheetData: [],
+  infoPriceData:[],
+  infoClassData:[],
   mixRatioSetting: {},
   infoPriceSetting: {
-    header: [{
-        headerName: "材料名称",
-        headerWidth: 320,
-        dataCode: "name",
-        dataType: "String"
-      },
-      {
-        headerName: "规格型号",
-        headerWidth: 200,
-        dataCode: "specs",
-        hAlign: "left",
-        dataType: "String"
-      },
-      {
-        headerName: "单位",
-        headerWidth: 50,
-        dataCode: "unit",
-        dataType: "String",
-        hAlign: "center"
-      },
-      {
-        headerName: "含税市场价",
-        headerWidth: 100,
-        dataCode: "taxPrice",
-        hAlign: "right",
-        dataType: "Number",
-        validator: "number"
-      },
-      {
-        headerName: "不含税市场价",
-        headerWidth: 100,
-        dataCode: "noTaxPrice",
-        hAlign: "right",
-        dataType: "Number",
-        validator: "number"
-      } //,decimalField:"glj.unitPrice"
+    header: [
+      { headerName: "材料名称", headerWidth: 320, dataCode: "name",  dataType: "String"},
+      { headerName: "规格型号", headerWidth: 200, dataCode: "specs",hAlign: "left",dataType: "String" },
+      { headerName: "单位",headerWidth: 50,dataCode: "unit", dataType: "String", hAlign: "center"},
+      { headerName: "含税市场价", headerWidth: 100, dataCode: "taxPrice", hAlign: "right",dataType: "Number",  validator: "number" },
+      { headerName: "不含税市场价", headerWidth: 100,   dataCode: "noTaxPrice",   hAlign: "right",   dataType: "Number",    validator: "number"   } //,decimalField:"glj.unitPrice"
     ],
     view: {
       lockColumns: [0, 1, 2, 3, 4] //,
       //colHeaderHeight:30
     }
   },
+  infoClassSetting:{
+    header: [{ headerName: "分类", headerWidth: 420, dataCode: "name",  dataType: "String"}],
+    view: {
+      lockColumns: [0] 
+    }
+  },
   relatedRationSetting: {
     header: [{
         headerName: "编码",
@@ -224,6 +202,7 @@ let projectGljObject = {
     this.initSheet(this.infoPriceSheet, this.infoPriceSetting);
     this.infoPriceSheet.bind(GC.Spread.Sheets.Events.TopRowChanged, _.debounce(this.onInfoTopRowChanged, 100)); 
     this.infoPriceSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, this.onInfoPriceDoubleClick);
+    this.infoPriceSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, this.infoPriceSelectionChange);
     this.infoPriceSheet.name('infoPriceSheet');
     this.infoPriceSheet.setRowCount(0);
     this.getInfoPriceOptions();
@@ -234,6 +213,19 @@ let projectGljObject = {
       this.initInfoPriceRightClick();
     }
   },
+  initInfoClassSpread: function () {
+    if (this.infoClassSpread) return this.infoClassSpread.refresh();
+    this.infoClassSpread = SheetDataHelper.createNewSpread($("#info_class_sheet")[0]);
+    sheetCommonObj.spreadDefaultStyle(this.infoPriceSpread);
+    this.infoClassSheet = this.infoClassSpread.getSheet(0);
+    this.initSheet(this.infoClassSheet, this.infoClassSetting);
+    this.infoClassSheet.name('infoClassSheet');
+    this.infoClassSheet.setRowCount(0);
+    this.infoClassSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, this.infoClassSelectionChange);
+    if (projectReadOnly) {
+      disableSpread(this.infoClassSpread);
+    } 
+  },
   initSpreads: function () {
     if (this.projectGljSpread == null) this.initProjectGljSpread();
     //if(materialAdjustObj.spread == null) materialAdjustObj.initSpread();
@@ -529,20 +521,44 @@ let projectGljObject = {
     sheetCommonObj.showData(me.relatedRationSheet, me.relatedRationSetting, rations);
     me.relatedRationSheet.setRowCount(rations.length);
   },
+  setInfoClassSelection:function(){
+    let me = this;
+    let priceRow = me.infoPriceSheet.getSelections()[0].row;
+    let infoPrice = me.infoPriceData[priceRow];
+    if(infoPrice && me.infoClassData.length > 0){
+      const index = _.findIndex(me.infoClassData,{'ID':infoPrice.classID});
+      me.infoClassSheet.setSelection(index,0,1,1);
+      //me.infoClassSheet.clearSelection(); 清除焦点行
+      me.infoClassSheet.showRow(index, GC.Spread.Sheets.VerticalPosition.center);
+    }
+
+
+  },
   showInforPriceData: function (datas) {
     let me = this;
     me.infoPriceData = datas;
     sheetCommonObj.showData(me.infoPriceSheet, me.infoPriceSetting, datas);
     me.infoPriceSheet.setRowCount(datas.length);
+    if(datas.length > 0) me.setInfoClassSelection();
+  },
+  showInforClassData: function (datas) {
+    let me = this;
+    me.infoClassData = datas;
+    for(let d of datas){
+      d.collapsed = false;
+    }
+    sheetCommonObj.showTreeData(me.infoClassSheet, me.infoClassSetting, datas);
   },
   autoShowInfoPriceData: function () { 
     if (!$('#info-nav').hasClass('active')) return;
     let projectGLJData = this.getProjectGLJSelected();
-    $('#info_search_name').val(projectGLJData.name);
-    let code = projectGLJData.code.substr(0, 4);
-    $('#info_glj_name').val(projectGLJData.name);
-    $('#info_glj_code').val(code);
-    this.searchInfoPrice(null);
+    if(projectGLJData){
+      $('#info_search_name').val(projectGLJData.name);
+      let code = projectGLJData.code.substr(0, 4);
+      $('#info_glj_name').val(projectGLJData.name);
+      $('#info_glj_code').val(code);
+      this.searchInfoPrice(null);
+    }
   },
   getMixRatioSheetData: function (glj) {
     let data = {
@@ -622,9 +638,23 @@ let projectGljObject = {
     $("#tab_zaojiashu").click();
     locateObject.locateNode(record.ID);
   },
-  onInfoPriceDoubleClick: function name(sender, args) {
+  onInfoPriceDoubleClick: function(sender, args) {
     projectGljObject.preApplyInfoPrice(args.row);
   },
+  infoPriceSelectionChange:function(sender, args){
+    projectGljObject.setInfoClassSelection();
+  },
+  infoClassSelectionChange:function(sender, args){
+    let me = projectGljObject;
+    let row = args.newSelections[0].row;
+    let infoClass = me.infoClassData[row];
+    if(infoClass){
+      $("#info_class").val(infoClass.ID);
+      $("#info_glj_name").val("")//清除工料机名字搜索项
+      me.searchInfoPrice();
+    }
+
+  },
   onProjectGljSelectionChange: function (sender, args) {
     let me = projectGljObject;
     let newSel = args.newSelections[0];
@@ -657,6 +687,7 @@ let projectGljObject = {
     sel.colCount = 1;
     me.showMixRatioData();
     me.showRelatedRationDatas();
+    $("#info_class").val("");
     me.autoShowInfoPriceData();
   },
   rightClickCallback: function (row) {
@@ -1633,6 +1664,7 @@ let projectGljObject = {
   createSelectOptions: function (ele, opts, isArea) {
     ele.empty();
     let str = `<option value=""></option>`;
+    opts.sort((a, b) => a.serialNo - b.serialNo);
     for (let o of opts) {
       if (isArea == true) {
         str += `<option value="${o.ID}">${o.name}</option>`
@@ -1652,12 +1684,28 @@ let projectGljObject = {
       if (projectGljObject.infoPriceLastLoadingRow == me.infoPriceData.length) { //如果最后一行已经加载过了,就不用再加载了,不然会重复加载
         return;
       }
-      console.log(bottomRow);
       me.infoPriceLastLoadingRow = me.infoPriceData.length;
       //只有在空的搜索条件下才执行分页查询,其它情况无法分页
       if ($('#info_search_name').val() == "") me.searchInfoPrice(me.infoPriceData[me.infoPriceData.length - 1]._id)
     }
   },
+  searchInfoClass:async function(){
+    let me = projectGljObject;
+    let areaID = $('#info_area').val();
+    let year = $('#info_year').val();
+    let month = $('#info_month').val();
+    let datas = [];
+    $('#info_class').val("");
+    try {
+      if (year != "" && month != "" && areaID != ""){
+        let period = year + "-" + month;
+        datas = await ajaxPost("/infoPrice/getClassByAreaID", {areaID:areaID,period:period});
+      }
+      me.showInforClassData(datas);
+    } catch (error) {
+       console.log(error)
+    }
+  },
   searchInfoPrice: async function (objectID) {
     let year = $('#info_year').val();
     let month = $('#info_month').val();
@@ -1665,6 +1713,7 @@ let projectGljObject = {
     let keyWord = $('#info_search_name').val();
     let name =  $('#info_glj_name').val();
     let code =  $('#info_glj_code').val();
+    let classID = $("#info_class").val();
     let me = projectGljObject;
     try {
       if (year != "" && month != "" && areaID != "") {
@@ -1672,10 +1721,16 @@ let projectGljObject = {
           period: year + "-" + month,
           areaID: areaID
         }
+        if(classID!=""){
+          keyWord = "";
+          condition.classID = classID;
+        } 
+        
         if (projectGljObject.addCommonInfoPriceID) projectGljObject.addCommonInfoPriceID(condition);
         let data = {
           condition: condition
         };
+        
         if (keyWord != "") data.keyWord = keyWord;
         if (name !="") data.keyWord = name;
         if (objectID) data.lastID = objectID;
@@ -1687,6 +1742,7 @@ let projectGljObject = {
         } else {
           me.infoPriceTotalSize = result.totalSize;
           me.infoPriceLastLoadingRow = 0;
+
           me.showInforPriceData(result.items);
           if (result.totalSize == 0) {
             $("#info-warning").text("当前材料没有信息价! ");
@@ -1706,6 +1762,7 @@ let projectGljObject = {
   preApplyInfoPrice: function (row) {
     let info = this.infoPriceData[row];
     let projectGLJData = this.getProjectGLJSelected();
+    if(!projectGLJData) return;
     if (projectGLJData.ratio_data && projectGLJData.ratio_data.length > 0) return;
     let marketPrice = this.getInfoMarketPrice(info);
     if (projectGLJData.unit == info.unit) {
@@ -1750,8 +1807,17 @@ let projectGljObject = {
     return gljUtil.getInfoMarketPrice(info, taxType);
   },
   refreshInfoPrice: function () { 
-    $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height()-10);
-    projectGljObject.initInfoPriceSpread();
+    this.setInfoDivHeight();
+    if ($('#info_price_sheet').is(':visible')){
+      this.initInfoPriceSpread();
+      this.initInfoClassSpread();
+    }
+  },
+  setInfoDivHeight:function(){
+    let info_height = $("#mix_ratio_sheet").height() - $("#infoToolDiv").height()-10;
+    $('#info_price_main').height(info_height);
+    $('#info_class_sheet').height(info_height);
+    $('#info_price_sheet').height(info_height);
   }
 };
 
@@ -1810,8 +1876,7 @@ function loadProjectGljSize() {
         me.projectGljSpread ? me.projectGljSpread.refresh() : '';
         me.mixRatioSpread ? me.mixRatioSpread.refresh() : '';
         //信息价相关
-        $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height());
-        if ($('#info_price_sheet').is(':visible')) me.initInfoPriceSpread();
+        me.refreshInfoPrice();
       });
     }
 
@@ -2136,7 +2201,7 @@ $(function () {
     projectGljObject.refreshInfoPrice();
     projectGljObject.autoShowInfoPriceData(); 
   });
-  $('#info_year').change(function () {
+  $('#info_year').change(async function () {
     let periodMap = projectGljObject.infoPriceOptions.periodMap;
     let year = $(this).val();
     let month = $("#info_month").val();
@@ -2146,21 +2211,25 @@ $(function () {
     if (month != "") {
       if (_.includes(options, month)) {
         $("#info_month").val(month);
+        projectGljObject.searchInfoClass();
         projectGljObject.searchInfoPrice();
       }
     }
   });
-  $('#info_month').change(function () {
-    projectGljObject.searchInfoPrice();
+  $('#info_month').change(async function () {
+    await projectGljObject.searchInfoClass();
+    await projectGljObject.searchInfoPrice();
   });
-  $('#info_area').change(function () {
-    projectGljObject.searchInfoPrice();
+  $('#info_area').change(async function () {
+    await projectGljObject.searchInfoClass()
+    await projectGljObject.searchInfoPrice();
   });
   $('#info_search_name').on('keypress', function (e) {
     $("#info-warning").text("");
     if (e.keyCode === 13) {
       $('#info_glj_name').val("");
       $('#info_glj_code').val("");
+      $('#info_class').val("");
       projectGljObject.searchInfoPrice();
     }
   });
@@ -2168,6 +2237,7 @@ $(function () {
   $('#info_search_btn').on('click', function (e) {
     $('#info_glj_name').val("");
     $('#info_glj_code').val("");
+    $('#info_class').val("");
     projectGljObject.searchInfoPrice();
   });
 

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

@@ -3337,7 +3337,8 @@ $(function () {
                 let ration_glj_Map = _.groupBy(projectObj.project.ration_glj.datas, 'rationID');
                 vBlock_WC.datas.push(BlockController.getNodeDatas(node, ration_glj_Map));
                 vBlock_WC = JSON.parse(JSON.stringify(vBlock_WC));
-                let fileName = node.data.code + ' ' + node.data.name + ' ' + node.data.unit;
+                const unitFee = (node.data.feesIndex && node.data.feesIndex.common) ? node.data.feesIndex.common.unitFee : 0;
+                let fileName = node.data.code + ' ' + node.data.name + ' ' + node.data.unit + ' ' + unitFee;
                 fileName = fileName.replace(/^\s+|\s+$/g, "");    // 只去两头空格
 
                 let extN = blockLibObj.getSameNameNode(fileName);

+ 37 - 4
web/building_saas/main/js/views/side_tools.js

@@ -119,8 +119,9 @@ SlideResize.verticalSlide(bookMarkLibResize.eleObj, bookMarkLibResize.limit, fun
     locateObject.refreshWorkBook();
 });
 
+// 块模板库(旧:上中下结构)
 // 块模板库上下拖动(上中)
-let blockLibTopMid = {};
+/* let blockLibTopMid = {};
 blockLibTopMid.eleObj = {
     module: 'kmbk',
     resize: $('#kmbkResizeA'),
@@ -170,7 +171,33 @@ let blockLibMulti = {
         {container: $('#kmbkBottomDiv'), spread: $('#div_block_ration'), notSpread: 0, defaultProportion: 0.25},
     ],
     totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-5*2`
-};
+};*/
+
+// 组价模板(新的块模板库,上下结构)
+function getBlockResize() {
+    let resizeObj = {};
+    resizeObj.eleObj = {
+        module: 'zjmb',
+        resize: $('#kmbkResizeB'),
+        top: $('#kmbkTopDiv'),
+        topSpread: $('#div_block_tree'),
+        bottom: $('#kmbkBottomDiv'),
+        bottomSpread: $('#div_block_ration')
+    };
+    resizeObj.limit = {
+        min: 100,
+        max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-100-5`,
+        notTopSpread: 0,
+        notBottomSpread: 0,
+        totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-5`
+    };
+    return resizeObj;
+}
+
+let blockLibResize = getBlockResize();
+SlideResize.verticalSlide(blockLibResize.eleObj, blockLibResize.limit, function () {
+    blockLibObj.refreshSpread();
+});
 
 //加载各库内部上下高度(有的库需要上下拖动)
 function loadSideToolsHeight() {
@@ -184,9 +211,12 @@ function loadSideToolsHeight() {
         let options = $("input[name='content_type']:checked").val();
         locateObject.refreshView(options, true);
     } else if ($('#kmbk').is(':visible')) {
-        SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+        SlideResize.loadVerticalHeight(blockLibResize.eleObj.module, blockLibResize.eleObj, blockLibResize.limit, function () {
             blockLibObj.refreshSpread();
         });
+        /* SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+            blockLibObj.refreshSpread();
+        }); */
     }
 }
 
@@ -207,7 +237,10 @@ var sideToolsObj = {
                         sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 30, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
                     });
                 } else if (id === 'blockLibTab') {//块模板库
-                    SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+                    /* SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+                        blockLibObj.refreshSpread();
+                    }); */
+                    SlideResize.loadVerticalHeight(blockLibResize.eleObj.module, blockLibResize.eleObj, blockLibResize.limit, function () {
                         blockLibObj.refreshSpread();
                     });
                 }

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

@@ -53,7 +53,9 @@
                     <span style="display: none" id="copyShareEng-info" class="form-text text-danger">单项工程不可为空</span>
                 </div>
                 <div class="form-group">
-                    <p id="copyShare_name">拷贝后,工程将重命名为 "<b>建筑工程2(张三共享)</b>"</p>
+                    <label>单位工程</label>
+                    <input id="copyShare_name" class="form-control"></input>
+                    <span style="display: none" id="copyShareTender-info" class="form-text text-danger">已存在同名单位工程</span>
                 </div>
             </div>
             <div class="modal-footer">

+ 12 - 15
web/building_saas/pm/js/pm_share.js

@@ -813,7 +813,7 @@ const pmShare = (function () {
                   },
                   callback: function (key, opt) {
                       if($(".p-title").text().includes('免费')){
-                        hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单个分段进行拷贝');
+                        hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单位工程进行拷贝');
                         return;
                       }
                       copyContructionProject(tree.selected);
@@ -913,15 +913,20 @@ const pmShare = (function () {
                 return;
             }
             let copyMap = {copy: null, update: null};
-            let newName = getCopyName(selected);
+            let newName = $('#copyShare_name').val();
+            if (!newName) {
+                $('#copyShareTender-info').text('单位工程名称不可为空');
+                $('#copyShareTender-info').show();
+                return;
+            }
             //获取单项工程的单位工程
             let tenderQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], userID: userID, ParentID: engID};
             const rstData = await ajaxPost('/pm/api/getProjectsByQuery', {user_id: userID, query: tenderQuery, options: '-_id -property'}, false, 10000);
             let updateTender = null;
             for(let tender of rstData){
                 if(tender.name === newName){
-                    $('#copyShare_name').text('已存在此单位工程。');
-                    $('#copyShare_name').addClass('text-danger');
+                    $('#copyShareTender-info').text('已存在同名单位工程');
+                    $('#copyShareTender-info').show();
                     return;
                 }
                 if(tender.NextSiblingID == -1){
@@ -1125,27 +1130,19 @@ const pmShare = (function () {
         $('#copyShare').on('shown.bs.modal', function () {
             setCopyModal();
             //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
+            $('#copyShare_name').val(shareSeleted.data.name);
         });
         //拷贝工程改变选择建设项目
         $('#copyShare_selectProj').change(function () {
-            //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
             $('#copyShareProj-info').hide();
             $('#copyShareEng-info').hide();
+            $('#copyShareTender-info').hide();
             let curSelID = $(this).select().val();
             setEng(parseInt(curSelID));
         });
         //拷贝工程改变选择单项工程
         $('#copyShare_selectEng').change(function () {
-            //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
+            $('#copyShareTender-info').hide();
         });
         //确认拷贝
         $('#copyShare_confirm').click(function () {

+ 1 - 1
web/common/components/share/index.js

@@ -480,7 +480,7 @@ const SHARE_TO = (() => {
             $('#share-hint').text('');
             const { isFree, sharedUsers, recentUsers, contacts } = await getInitalData(projectID);
             if (isFree) {
-                hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单个分段进行分享。');
+                hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单位工程进行分享。');
             } else {
                 curSharedUsers = sharedUsers;
                 initSharedView(sharedUsers);

+ 3 - 2
web/over_write/js/chongqing_2018.js

@@ -10,9 +10,10 @@ if(typeof projectGljObject !== 'undefined'){
         {ID:'MAIN_MATERIAL',text:'主材'}
     ];
     $('#menu_index_info').show();
-  projectGljObject.addCommonInfoPriceID = function (condition) { 
+    //2020-11-06 暂时去掉主城区加载通用 
+ /*  projectGljObject.addCommonInfoPriceID = function (condition) { 
     if(condition.areaID != projectGljObject.commonInfoPriceID) condition.commonInfoPriceID = projectGljObject.commonInfoPriceID;
-  }
+  } */
 }
 if(typeof gljUtil !== 'undefined'){
     gljUtil.hasCompMachine = [301,304];//有组成物的机械