Browse Source

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

vian 4 years ago
parent
commit
94d0873cfc

+ 95 - 1
modules/main/facade/info_price_facade.js

@@ -15,6 +15,14 @@ let unitPriceModel = mongoose.model("unit_price");
 let _ = require("lodash");
 let gljUtil = require('../../../public/web/gljUtil');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
+// 载入模块
+var Segment = require('segment');
+// 创建实例
+var segment = new Segment();
+// 使用默认的识别模块及字典,载入字典文件需要1秒,仅初始化时执行一次即可
+segment.useDefault();
+
+
 async function getOptions(data,compilation){//data 是预留对象,暂时不用
   let compilationID = compilation._id;
   let areaMap={};
@@ -42,7 +50,27 @@ async function getOptions(data,compilation){//data 是预留对象,暂时不
 async function getDataByCondition(data,compilation){
   let result = {};
   data.condition["compilationID"] = compilation._id;
-  if(data.keyWord) data.condition.name = {"$regex":new RegExp(data.keyWord, "i")};
+  //特殊处理重庆的,地区选择非“通用”时,搜索范围应是当前选择的地区,加上“通用”中的信息价。
+  if (data.condition.commonInfoPriceID) { 
+    let idArray = [data.condition.areaID,data.condition.commonInfoPriceID];
+    data.condition.areaID = {$in: idArray}
+    delete data.condition.commonInfoPriceID;
+  }
+
+  //根据地区+期数+材料编号的前4位与信息价材料的分类编号匹配,如果有数据,则显示数据出来。
+  //先按编号匹配
+  if (data.code) { 
+    result = await getDataByCode(data.code, data);
+    if (result.totalSize > 0) return result;
+  }
+ 
+  //编号匹配不上的情况:
+  //有关键字的情况
+  if (data.keyWord) { 
+    return await getDataByKeyWord(data.keyWord,data);
+  } 
+
+  //查询所有的情况
   if(data.lastID){ //有最后一行说明是查询下一页
     data.condition["_id"] = {$gt:mongoose.Types.ObjectId(data.lastID)};
   }else{
@@ -52,6 +80,72 @@ async function getDataByCondition(data,compilation){
   return result;
 }
 
+
+async function getDataByCode(code, data) { 
+  let condition = { ...data.condition };
+  condition.code = code;
+  let totalSize = await infoItemsModel.find(condition).count();
+  if (data.lastID) { //有最后一行说明是查询下一页
+    condition["_id"] = {$gt:mongoose.Types.ObjectId(data.lastID)};
+  }
+  let items = [];
+  if (totalSize > 0) { 
+    items = await infoItemsModel.find(condition).lean().sort({"_id":1}).limit(50);
+  }
+   
+  return {totalSize,items}
+}
+
+
+async function getDataByKeyWord(keyword, data) {
+  let items = [];
+  let nameArray = [];
+  //混凝土 和 砼 认成一个
+ // keyword = keyword.replace(/混凝土/g, "砼");
+  if (keyword.length < 3) {
+    nameArray.push(keyword)
+  } else { 
+    nameArray = segment.doSegment(keyword, {
+      simple: true, //不返回词性
+      stripPunctuation: true //去除标点符号
+    });
+  }
+  let temArr = [];
+  for (let a of nameArray) { 
+    if (a == "混凝土") a = '砼';
+    if (a == '砼' || a.length > 1) temArr.push(a);
+  }
+  if (keyword.length == 1 && temArr.length == 0) temArr.push(keyword);
+  nameArray = temArr;
+  console.log(nameArray);
+
+  let allInfoPrice = await infoItemsModel.find(data.condition).lean().sort({"_id":1});
+
+  let maxNum = 0;//最大匹配数
+  let matchMap = {};//匹配储存
+
+  for (let info of allInfoPrice) { 
+    //specs
+    let mstring = info.name + info.spec;
+    mstring = mstring.replace(/混凝土/g, "砼");
+    let matchCount = 0;
+    for (let na of nameArray) { 
+      if (mstring.indexOf(na) != -1) { 
+        matchCount++;
+      }
+    }  
+    if (matchCount > 0) { 
+      matchMap[matchCount] ? matchMap[matchCount].push(info) : matchMap[matchCount] = [info];
+      if (matchCount > maxNum) maxNum = matchCount;
+    }
+  }
+  
+  if (maxNum > 0) items = matchMap[maxNum];
+  totalSize = items.length
+  return {totalSize,items}
+}
+
+
 async function mutiApplyInfoPrice(data,compilation){
   data.condition["compilationID"] = compilation._id;
   let infoPrices = await infoItemsModel.find(data.condition).lean();

+ 85 - 80
package-lock.json

@@ -4566,8 +4566,8 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "delegates": "1.0.0",
-            "readable-stream": "2.3.7"
+            "delegates": "^1.0.0",
+            "readable-stream": "^2.0.6"
           }
         },
         "balanced-match": {
@@ -4580,7 +4580,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "balanced-match": "1.0.0",
+            "balanced-match": "^1.0.0",
             "concat-map": "0.0.1"
           }
         },
@@ -4614,7 +4614,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "ms": "2.1.2"
+            "ms": "^2.1.1"
           }
         },
         "deep-extend": {
@@ -4637,7 +4637,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "minipass": "2.9.0"
+            "minipass": "^2.6.0"
           }
         },
         "fs.realpath": {
@@ -4650,14 +4650,14 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "aproba": "1.2.0",
-            "console-control-strings": "1.1.0",
-            "has-unicode": "2.0.1",
-            "object-assign": "4.1.1",
-            "signal-exit": "3.0.2",
-            "string-width": "1.0.2",
-            "strip-ansi": "3.0.1",
-            "wide-align": "1.1.3"
+            "aproba": "^1.0.3",
+            "console-control-strings": "^1.0.0",
+            "has-unicode": "^2.0.0",
+            "object-assign": "^4.1.0",
+            "signal-exit": "^3.0.0",
+            "string-width": "^1.0.1",
+            "strip-ansi": "^3.0.1",
+            "wide-align": "^1.1.0"
           }
         },
         "glob": {
@@ -4665,12 +4665,12 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "fs.realpath": "1.0.0",
-            "inflight": "1.0.6",
-            "inherits": "2.0.4",
-            "minimatch": "3.0.4",
-            "once": "1.4.0",
-            "path-is-absolute": "1.0.1"
+            "fs.realpath": "^1.0.0",
+            "inflight": "^1.0.4",
+            "inherits": "2",
+            "minimatch": "^3.0.4",
+            "once": "^1.3.0",
+            "path-is-absolute": "^1.0.0"
           }
         },
         "has-unicode": {
@@ -4683,7 +4683,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "safer-buffer": "2.1.2"
+            "safer-buffer": ">= 2.1.2 < 3"
           }
         },
         "ignore-walk": {
@@ -4691,7 +4691,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "minimatch": "3.0.4"
+            "minimatch": "^3.0.4"
           }
         },
         "inflight": {
@@ -4699,8 +4699,8 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "once": "1.4.0",
-            "wrappy": "1.0.2"
+            "once": "^1.3.0",
+            "wrappy": "1"
           }
         },
         "inherits": {
@@ -4718,7 +4718,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "number-is-nan": "1.0.1"
+            "number-is-nan": "^1.0.0"
           }
         },
         "isarray": {
@@ -4731,7 +4731,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "brace-expansion": "1.1.11"
+            "brace-expansion": "^1.1.7"
           }
         },
         "minimist": {
@@ -4744,8 +4744,8 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "safe-buffer": "5.1.2",
-            "yallist": "3.1.1"
+            "safe-buffer": "^5.1.2",
+            "yallist": "^3.0.0"
           }
         },
         "minizlib": {
@@ -4753,7 +4753,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "minipass": "2.9.0"
+            "minipass": "^2.9.0"
           }
         },
         "mkdirp": {
@@ -4761,7 +4761,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "minimist": "1.2.5"
+            "minimist": "^1.2.5"
           }
         },
         "ms": {
@@ -4774,9 +4774,9 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "debug": "3.2.6",
-            "iconv-lite": "0.4.24",
-            "sax": "1.2.4"
+            "debug": "^3.2.6",
+            "iconv-lite": "^0.4.4",
+            "sax": "^1.2.4"
           }
         },
         "node-pre-gyp": {
@@ -4784,16 +4784,16 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "detect-libc": "1.0.3",
-            "mkdirp": "0.5.3",
-            "needle": "2.3.3",
-            "nopt": "4.0.3",
-            "npm-packlist": "1.4.8",
-            "npmlog": "4.1.2",
-            "rc": "1.2.8",
-            "rimraf": "2.7.1",
-            "semver": "5.7.1",
-            "tar": "4.4.13"
+            "detect-libc": "^1.0.2",
+            "mkdirp": "^0.5.1",
+            "needle": "^2.2.1",
+            "nopt": "^4.0.1",
+            "npm-packlist": "^1.1.6",
+            "npmlog": "^4.0.2",
+            "rc": "^1.2.7",
+            "rimraf": "^2.6.1",
+            "semver": "^5.3.0",
+            "tar": "^4.4.2"
           }
         },
         "nopt": {
@@ -4801,8 +4801,8 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "abbrev": "1.1.1",
-            "osenv": "0.1.5"
+            "abbrev": "1",
+            "osenv": "^0.1.4"
           }
         },
         "npm-bundled": {
@@ -4810,7 +4810,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "npm-normalize-package-bin": "1.0.1"
+            "npm-normalize-package-bin": "^1.0.1"
           }
         },
         "npm-normalize-package-bin": {
@@ -4823,9 +4823,9 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "ignore-walk": "3.0.3",
-            "npm-bundled": "1.1.1",
-            "npm-normalize-package-bin": "1.0.1"
+            "ignore-walk": "^3.0.1",
+            "npm-bundled": "^1.0.1",
+            "npm-normalize-package-bin": "^1.0.1"
           }
         },
         "npmlog": {
@@ -4833,10 +4833,10 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "are-we-there-yet": "1.1.5",
-            "console-control-strings": "1.1.0",
-            "gauge": "2.7.4",
-            "set-blocking": "2.0.0"
+            "are-we-there-yet": "~1.1.2",
+            "console-control-strings": "~1.1.0",
+            "gauge": "~2.7.3",
+            "set-blocking": "~2.0.0"
           }
         },
         "number-is-nan": {
@@ -4854,7 +4854,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "wrappy": "1.0.2"
+            "wrappy": "1"
           }
         },
         "os-homedir": {
@@ -4872,8 +4872,8 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "os-homedir": "1.0.2",
-            "os-tmpdir": "1.0.2"
+            "os-homedir": "^1.0.0",
+            "os-tmpdir": "^1.0.0"
           }
         },
         "path-is-absolute": {
@@ -4891,10 +4891,10 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "deep-extend": "0.6.0",
-            "ini": "1.3.5",
-            "minimist": "1.2.5",
-            "strip-json-comments": "2.0.1"
+            "deep-extend": "^0.6.0",
+            "ini": "~1.3.0",
+            "minimist": "^1.2.0",
+            "strip-json-comments": "~2.0.1"
           }
         },
         "readable-stream": {
@@ -4902,13 +4902,13 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "core-util-is": "1.0.2",
-            "inherits": "2.0.4",
-            "isarray": "1.0.0",
-            "process-nextick-args": "2.0.1",
-            "safe-buffer": "5.1.2",
-            "string_decoder": "1.1.1",
-            "util-deprecate": "1.0.2"
+            "core-util-is": "~1.0.0",
+            "inherits": "~2.0.3",
+            "isarray": "~1.0.0",
+            "process-nextick-args": "~2.0.0",
+            "safe-buffer": "~5.1.1",
+            "string_decoder": "~1.1.1",
+            "util-deprecate": "~1.0.1"
           }
         },
         "rimraf": {
@@ -4916,7 +4916,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "glob": "7.1.6"
+            "glob": "^7.1.3"
           }
         },
         "safe-buffer": {
@@ -4954,9 +4954,9 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "code-point-at": "1.1.0",
-            "is-fullwidth-code-point": "1.0.0",
-            "strip-ansi": "3.0.1"
+            "code-point-at": "^1.0.0",
+            "is-fullwidth-code-point": "^1.0.0",
+            "strip-ansi": "^3.0.0"
           }
         },
         "string_decoder": {
@@ -4964,7 +4964,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "safe-buffer": "5.1.2"
+            "safe-buffer": "~5.1.0"
           }
         },
         "strip-ansi": {
@@ -4972,7 +4972,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "ansi-regex": "2.1.1"
+            "ansi-regex": "^2.0.0"
           }
         },
         "strip-json-comments": {
@@ -4985,13 +4985,13 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "chownr": "1.1.4",
-            "fs-minipass": "1.2.7",
-            "minipass": "2.9.0",
-            "minizlib": "1.3.3",
-            "mkdirp": "0.5.3",
-            "safe-buffer": "5.1.2",
-            "yallist": "3.1.1"
+            "chownr": "^1.1.1",
+            "fs-minipass": "^1.2.5",
+            "minipass": "^2.8.6",
+            "minizlib": "^1.2.1",
+            "mkdirp": "^0.5.0",
+            "safe-buffer": "^5.1.2",
+            "yallist": "^3.0.3"
           }
         },
         "util-deprecate": {
@@ -5004,7 +5004,7 @@
           "bundled": true,
           "optional": true,
           "requires": {
-            "string-width": "1.0.2"
+            "string-width": "^1.0.2 || 2"
           }
         },
         "wrappy": {
@@ -11196,6 +11196,11 @@
         }
       }
     },
+    "segment": {
+      "version": "0.1.3",
+      "resolved": "https://registry.npmjs.org/segment/-/segment-0.1.3.tgz",
+      "integrity": "sha1-YF+A/WxxMcRuOBA6F7Fojwnvr6c="
+    },
     "semver": {
       "version": "4.3.6",
       "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz",

+ 1 - 0
package.json

@@ -50,6 +50,7 @@
     "pdfkit": "^0.8.2",
     "qiniu": "^7.1.1",
     "request-promise": "^4.2.5",
+    "segment": "^0.1.3",
     "socket.io": "2.0.3",
     "ua-parser-js": "^0.7.14",
     "uuid": "^3.1.0",

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

@@ -509,4 +509,8 @@ margin-right: 100px !important;
 
 .top-msg{
   top:35px !important;
+}
+
+.fee_detail_height{
+  height:270px
 }

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

@@ -147,8 +147,11 @@
               </select>
               &nbsp;
               <input type="text" class="form-control form-control-sm" id="info_search_name">
-              <button type="button" class="btn btn-outline-primary btn-sm mr-auto" id="info_search_btn"><i
+              <button type="button" class="btn btn-outline-primary btn-sm" id="info_search_btn"><i
                   class="fa fa-search" aria-hidden="true"></i></button>
+              <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">       
               <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>

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

@@ -1843,8 +1843,8 @@
             <span aria-hidden="true">&times;</span>
           </button>
         </div>
-        <div class="modal-body">
-          <div class="row" style="height:250px">
+        <div class="modal-body" style="padding-top: 0px;padding-bottom: 0px;">
+          <div class="row" style="height:210px">
             <!--sjs id设置在这个div-->
             <div class=" col-8" style="overflow: hidden" id="feeItemSheet">
             </div>
@@ -1870,10 +1870,9 @@
               </div>
             </div>
           </div>
-          <br>
-          <div class="row" style="height:130px">
+          <div class="row" style="height:270px; margin-top: 5px">
             <!--sjs id设置在这个div-->
-            <div class="col-12" style="overflow: hidden" id="feeDetailSheet"></div>
+            <div class="col-12 fee_detail_height" style="overflow: hidden" id="feeDetailSheet"></div>
           </div>
         </div>
         <div class="modal-footer">

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

@@ -315,7 +315,6 @@ const BillsSub = (function() {
     //建表
     //@param {Object}module @return {void}
     function buildSheet(cmodule) {
-        console.log(cmodule);
         if(!cmodule.workBook){
             cmodule.workBook = new GC.Spread.Sheets.Workbook(cmodule.dom[0], {sheetCount: 1});
             sheetCommonObj.spreadDefaultStyle(cmodule.workBook);

+ 1 - 1
web/building_saas/main/js/views/main_tree_col.js

@@ -420,7 +420,7 @@ let MainTreeCol = {
       },
       lockUnitPrice: function (node) {
           //仅未使用基数计算的清单有效
-          if(!(node.data.calcBase&&node.data.calcBase!="")) return sheetCommonObj.getCheckBox();
+          if(node.sourceType == ModuleNames.bills && !(node.data.calcBase&&node.data.calcBase!="")) return sheetCommonObj.getCheckBox();
       },
         mainNodeCheckBox:function (node,setting,field) {//分部分项、措施项目下的清单、定额
             let Bills = projectObj.project.Bills;

+ 37 - 10
web/building_saas/main/js/views/project_glj_view.js

@@ -4,6 +4,7 @@
 let projectGljObject = {
   showTag: 'ration', //mixRatio/machine
   showMixRatioMark: '',
+  commonInfoPriceID:'',
   displayType: filterType.ALL,
   mixRatioType: [gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO, gljType.MAIN_MATERIAL],
   machineType: [gljType.GENERAL_MACHINE],
@@ -221,7 +222,7 @@ let projectGljObject = {
     sheetCommonObj.spreadDefaultStyle(this.infoPriceSpread);
     this.infoPriceSheet = this.infoPriceSpread.getSheet(0);
     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.TopRowChanged, _.debounce(this.onInfoTopRowChanged, 100)); 
     this.infoPriceSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, this.onInfoPriceDoubleClick);
     this.infoPriceSheet.name('infoPriceSheet');
     this.infoPriceSheet.setRowCount(0);
@@ -534,6 +535,15 @@ let projectGljObject = {
     sheetCommonObj.showData(me.infoPriceSheet, me.infoPriceSetting, datas);
     me.infoPriceSheet.setRowCount(datas.length);
   },
+  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);
+  },
   getMixRatioSheetData: function (glj) {
     let data = {
       id: glj.id,
@@ -647,6 +657,7 @@ let projectGljObject = {
     sel.colCount = 1;
     me.showMixRatioData();
     me.showRelatedRationDatas();
+    me.autoShowInfoPriceData();
   },
   rightClickCallback: function (row) {
     let me = projectGljObject;
@@ -1625,6 +1636,7 @@ let projectGljObject = {
     for (let o of opts) {
       if (isArea == true) {
         str += `<option value="${o.ID}">${o.name}</option>`
+        if (o.name == "通用") this.commonInfoPriceID = o.ID;
       } else {
         str += `<option value="${o}">${o}</option>`
       }
@@ -1642,16 +1654,17 @@ let projectGljObject = {
       }
       console.log(bottomRow);
       me.infoPriceLastLoadingRow = me.infoPriceData.length;
-      me.searchInfoPrice(me.infoPriceData[me.infoPriceData.length - 1]._id)
+      //只有在空的搜索条件下才执行分页查询,其它情况无法分页
+      if ($('#info_search_name').val() == "") me.searchInfoPrice(me.infoPriceData[me.infoPriceData.length - 1]._id)
     }
-
-
   },
   searchInfoPrice: async function (objectID) {
     let year = $('#info_year').val();
     let month = $('#info_month').val();
     let areaID = $('#info_area').val();
     let keyWord = $('#info_search_name').val();
+    let name =  $('#info_glj_name').val();
+    let code =  $('#info_glj_code').val();
     let me = projectGljObject;
     try {
       if (year != "" && month != "" && areaID != "") {
@@ -1659,11 +1672,14 @@ let projectGljObject = {
           period: year + "-" + month,
           areaID: areaID
         }
+        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;
+        if (code !="" ) data.code = code;
         let result = await ajaxPost("/infoPrice/getDataByCondition", data);
         if (objectID) { //分页查询
           sheetCommonObj.appendData(me.infoPriceSheet, me.infoPriceData.length, 0, me.infoPriceSetting, result.items);
@@ -1672,6 +1688,11 @@ let projectGljObject = {
           me.infoPriceTotalSize = result.totalSize;
           me.infoPriceLastLoadingRow = 0;
           me.showInforPriceData(result.items);
+          if (result.totalSize == 0) {
+            $("#info-warning").text("当前材料没有信息价! ");
+          } else { 
+            $("#info-warning").text("");
+          }
         }
       } else { //当有任意一个为空时,都清空表格
         me.infoPriceTotalSize = 0;
@@ -1727,6 +1748,10 @@ let projectGljObject = {
   getInfoMarketPrice: function (info) {
     let taxType = projectObj.project.property.taxType; //1: 一般计税 2: 简易计税
     return gljUtil.getInfoMarketPrice(info, taxType);
+  },
+  refreshInfoPrice: function () { 
+    $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height()-10);
+    projectGljObject.initInfoPriceSpread();
   }
 };
 
@@ -1787,8 +1812,6 @@ function loadProjectGljSize() {
         //信息价相关
         $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height());
         if ($('#info_price_sheet').is(':visible')) me.initInfoPriceSpread();
-
-
       });
     }
 
@@ -1845,6 +1868,7 @@ $(function () {
   SlideResize.verticalSlide(pojGljResizeEles.eleObj, pojGljResizeEles.limit, function () {
     projectGljObject.projectGljSpread.refresh();
     projectGljObject.mixRatioSpread ? projectGljObject.mixRatioSpread.refresh() : '';
+    projectGljObject.refreshInfoPrice();
   });
 
   let tr = getConficMaterialResizeEles();
@@ -2109,10 +2133,8 @@ $(function () {
     projectGljObject.showRelatedRationDatas();
   });
   $("#info-nav").on('shown.bs.tab', function () {
-    $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height());
-    projectGljObject.initInfoPriceSpread();
-    /*  
-     projectGljObject.showRelatedRationDatas(); */
+    projectGljObject.refreshInfoPrice();
+    projectGljObject.autoShowInfoPriceData(); 
   });
   $('#info_year').change(function () {
     let periodMap = projectGljObject.infoPriceOptions.periodMap;
@@ -2135,12 +2157,17 @@ $(function () {
     projectGljObject.searchInfoPrice();
   });
   $('#info_search_name').on('keypress', function (e) {
+    $("#info-warning").text("");
     if (e.keyCode === 13) {
+      $('#info_glj_name').val("");
+      $('#info_glj_code').val("");
       projectGljObject.searchInfoPrice();
     }
   });
 
   $('#info_search_btn').on('click', function (e) {
+    $('#info_glj_name').val("");
+    $('#info_glj_code').val("");
     projectGljObject.searchInfoPrice();
   });
 

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

@@ -3579,6 +3579,7 @@ $('#calcBaseFeeRateConf').click(function () {
     if(calcBaseValue !== selected.data.calcBase){
         needToSave = true;
         selected.data.userCalcBase = calcBaseValue;
+        selected.data.lockUnitPrice = null;
         projectObj.project.calcBase.calculate(selected);
     }
     if(validateFeeRate){

+ 5 - 6
web/building_saas/main/js/views/tender_price_view.js

@@ -10,11 +10,10 @@ let tender_obj={
     tenderSetting:{
         header:[
             {headerName: "项目编码", headerWidth: 170, dataCode: "code", dataType: "String",spanRows: [2],getText:'getText.code'},
-            {headerName: "类别", headerWidth: 50, dataCode: "subType", hAlign: "center", dataType: "String",spanRows: [2],getText:'getText.subType'},
+            // {headerName: "类别", headerWidth: 50, dataCode: "subType", hAlign: "center", dataType: "String",spanRows: [2],getText:'getText.subType'},
             {headerName: "项目名称", headerWidth: 200, dataCode: "name",showHint:true, hAlign: "left", dataType: "String",spanRows: [2]},
             {headerName: "计量\n单位", headerWidth: 60, dataCode: "unit", hAlign: "center", dataType: "String",spanRows: [2]},
             {headerName: "工程量", headerWidth: 70, dataCode: "quantity", hAlign: "right", dataType: "Number",validator:"number",spanRows: [2],getText:'getText.quantity'},
-            // {headerName: "不调价", headerWidth: 55, dataCode: "is_adjust_price", hAlign: "center", cellType : "checkBox",dataType: "Number",spanRows: [2]},
             {headerName: ["初始报价","综合单价"], headerWidth: 100, dataCode: "feesIndex.common.unitFee", hAlign: "right", dataType: "Number",validator:"number",spanCols : [2,1]},
             {headerName: ["","综合合价"], headerWidth: 100, dataCode: "feesIndex.common.totalFee", hAlign: "right", dataType: "Number",validator:"number",spanCols : [0,1]},
             {headerName: ["目标造价","综合单价"], headerWidth: 100, dataCode: "targetUnitFee", hAlign: "right", dataType: "Number",validator:"number",spanCols : [2,1]},
@@ -29,8 +28,8 @@ let tender_obj={
             {headerName: "子目工程量\n调整系数", headerWidth: 80, dataCode: "rationQuantityCoe", hAlign: "right", dataType: "Number",spanRows: [2],validator:"number"}
         ],
         view: {
-            // lockColumns: [0,1,2,3,4,6,7,10,11]
-            lockColumns: [0,1,2,3,4,5,6,9,10]
+            // lockColumns: [0,1,2,3,4,5,6,9,10]
+            lockColumns: [0,1,2,3,4,5,8,9]
         }
     },
     tenderTreeSetting:{
@@ -227,12 +226,12 @@ let tender_obj={
     },
     onEnterCell : function (sender,args) {
         let me = tender_obj, row = args.row, col = args.col, lock = false;
-        if ([7, 8].includes(col)){                                  // 目标单价、目标合价
+        if ([6, 7].includes(col)){                                  // 目标单价、目标合价
             let treeNode = me.tenderTree.items[row];
             if (calcTools.isCalcBaseBill(treeNode))                   // 公式结点只读
                 lock = true;
 
-            if ((col = 7) && calcTools.isParentBill(treeNode))
+            if ((col = 6) && calcTools.isParentBill(treeNode))
                 lock = true;
 
             if (lock)

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

@@ -10,8 +10,8 @@ let zmhs_obj = {
     coeSetting: {
         header: [
             {headerName: "调整", headerWidth: 35, dataCode: "isAdjust", dataType: "String", cellType: "checkBox"},
-            {headerName: "条件", headerWidth: 180, dataCode: "name", dataType: "String", cellType: "button",getText:'forName'},
-            {headerName: "内容", headerWidth: 70, dataCode: "content", dataType: "String", hAlign: "left",getText:'forContent',cellType:'tipsCell'}
+            {headerName: "条件", headerWidth: 140, dataCode: "name", dataType: "String", cellType: "button",getText:'forName'},
+            {headerName: "内容", headerWidth: 110, dataCode: "content", dataType: "String", hAlign: "left",getText:'forContent',cellType:'tipsCell'}
         ],
         view: {
             lockColumns:[0,1,2],

+ 18 - 105
web/building_saas/report/html/rpt_print.html

@@ -13,7 +13,21 @@
         page-break-before: auto;
         page-break-after: auto;
     }
-    @page {size: A4 portrait;}
+    @page {
+        size: A4 portrait;
+        margin-top: 0cm;
+        margin-bottom: 0cm;
+        margin-left: 0mm;
+        margin-right: 0mm;
+    }
+    @media print {
+        body {
+            margin-top: 0mm;
+            margin-bottom: 0mm;
+            margin-left: 0mm;
+            margin-right: 0mm
+        }
+    }
     body {page: page}
     div {page: page}
 </style>
@@ -36,107 +50,6 @@
 <script src="/lib/jquery/jquery-3.2.1.min.js"></script>
 <script type="text/javascript" src="/web/building_saas/report/js/jpc_output.js"></script>
 <script type="text/javascript" src="/web/building_saas/report/js/rpt_print.js"></script>
-<SCRIPT type="text/javascript">
-    let G_OFFSET_X = 0, G_OFFSET_Y = 0;
-    function loading() {
-        if (sessionStorage.multiRptsData) {
-            let multiRptData = JSON.parse(sessionStorage.multiRptsData);
-            let scaleFactor = parseInt(sessionStorage.scaleFactor);
-            for (let idx = 0; idx < multiRptData.length; idx++) {
-                let pageData = multiRptData[idx];
-                if (idx === 0) {
-                    $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
-                }
-                let orgPixelSize = getPixelSize(pageData);
-                let actArea = getActualArea(pageData);
-                let svgArr = rptPrintHelper.buildSvgArr(pageData, actArea, G_OFFSET_X, G_OFFSET_Y);
-                //let orientation = (pageData[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][0] < pageData[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][1])?"纵向":"横向";
-                let orientation = "纵向";
-                showPreviewData(svgArr, actArea, scaleFactor, sessionStorage.pageSize, orientation, orgPixelSize);
-            }
-            window.print();
-        } else if (sessionStorage.currentPageData) {
-            let pageData = JSON.parse(sessionStorage.currentPageData);
-            let scaleFactor = parseInt(sessionStorage.scaleFactor);
-            let orgPixelSize = getPixelSize(pageData);
-            let actArea = getActualArea(pageData);
-            let svgArr = rptPrintHelper.buildSvgArr(pageData, actArea, G_OFFSET_X, G_OFFSET_Y);
-            $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
-            //showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
-            showPreviewData(svgArr, actArea, scaleFactor, sessionStorage.pageSize, "纵向", orgPixelSize);
-            window.print();
-        } else if (sessionStorage.currentPageSvgData) {
-            let svgArr = JSON.parse(sessionStorage.currentPageSvgData);
-            let scaleFactor = 1;
-            //showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
-            showPreviewData(svgArr, null, scaleFactor, sessionStorage.pageSize, "纵向", null);
-            window.print();
-        } else {
-            //alert("没有报表数据!");
-        }
-    }
-
-    function showPreviewData(svgArr, actAreaArr, scaleFactor, pageSize, orientation, orgPixelSize) {
-        let orgHeight = 793, orgWidth = 1122;
-        if (pageSize === 'A3') {
-            orgHeight = 1122;
-            orgWidth = 793 * 2;
-        } else if (pageSize.indexOf('自定义') >= 0) {
-            //自定义
-        } else {
-            //其他size(LEGAL, 16K etc.)
-        }
-        let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
-        if (orientation === "纵向") {
-            pageHeight = orgWidth * scaleFactor;
-            pageWidth = orgHeight * scaleFactor;
-        }
-
-        for (let i = 0; i < svgArr.length; i++) {
-            let offsetHeight = 0, offsetWidth = 0;
-            if (actAreaArr) {
-                offsetWidth = actAreaArr[i].Left + (pageWidth - actAreaArr[i].Right) - 5;
-                offsetHeight = actAreaArr[i].Top + (pageHeight - actAreaArr[i].Bottom) - 5;
-                if (orgPixelSize[0] > orgPixelSize[1]) {
-                    //横向强制改纵向(系统是以纵向为准),那么计算offset的方式会有所不同
-                    offsetWidth = actAreaArr[i].Top + (pageWidth - actAreaArr[i].Bottom) - 5;
-                    offsetHeight = actAreaArr[i].Left + (pageHeight - actAreaArr[i].Right) - 5;
-                }
-            }
-            let div = $('<div class="pageBreak"></div>');
-            div.append($(svgArr[i].join("")));
-            $(div).find("svg").each(function(cIdx,elementSvg){
-                elementSvg.setAttribute('height', pageHeight - offsetHeight);
-                elementSvg.setAttribute('width', pageWidth - offsetWidth);
-            });
-            $("body").append(div);
-        }
-    }
-
-    function getActualArea(pageData) {
-        let rst = [];
-        for (let item of pageData.items) {
-            let area = {Left: 10000, Right: 0, Top: 10000, Bottom: 0};
-            for (let cell of item.cells) {
-                if (cell.area.Left < area.Left) {
-                    area.Left = cell.area.Left;
-                }
-                if (cell.area.Right > area.Right) {
-                    area.Right = cell.area.Right;
-                }
-                if (cell.area.Top < area.Top) {
-                    area.Top = cell.area.Top;
-                }
-                if (cell.area.Bottom > area.Bottom) {
-                    area.Bottom = cell.area.Bottom;
-                }
-            }
-            rst.push(area);
-        }
-        return rst;
-    }
-    function closing() {
-        //
-    }
-</SCRIPT>
-</html>
+<script type="text/javascript" src="/web/building_saas/report/js/rpt_preview_common.js"></script>
+<script>
+</script></html>

+ 115 - 0
web/building_saas/report/js/rpt_preview_common.js

@@ -0,0 +1,115 @@
+/**
+ * Created by Tony on 2020/10/16.
+ */
+
+let G_OFFSET_X = 0, G_OFFSET_Y = 0;
+function loading() {
+    if (sessionStorage.multiRptsData) {
+        let multiRptData = JSON.parse(sessionStorage.multiRptsData);
+        let scaleFactor = parseInt(sessionStorage.scaleFactor);
+        for (let idx = 0; idx < multiRptData.length; idx++) {
+            let pageData = multiRptData[idx];
+            if (idx === 0) {
+                $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
+            }
+            let orgPixelSize = getPixelSize(pageData);
+            let actArea = getActualArea(pageData);
+            let svgArr = rptPrintHelper.buildSvgArr(pageData, actArea, G_OFFSET_X, G_OFFSET_Y);
+            //let orientation = (pageData[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][0] < pageData[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][1])?"纵向":"横向";
+            let orientation = "纵向";
+            showPreviewData(svgArr, actArea, scaleFactor, sessionStorage.pageSize, orientation, orgPixelSize);
+        }
+        window.print();
+    } else if (sessionStorage.currentPageData) {
+        let pageData = JSON.parse(sessionStorage.currentPageData);
+        let scaleFactor = parseInt(sessionStorage.scaleFactor);
+        let orgPixelSize = getPixelSize(pageData);
+        let actArea = getActualArea(pageData);
+        let svgArr = rptPrintHelper.buildSvgArr(pageData, actArea, G_OFFSET_X, G_OFFSET_Y);
+        $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
+        //showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
+        showPreviewData(svgArr, actArea, scaleFactor, sessionStorage.pageSize, "纵向", orgPixelSize);
+        window.print();
+    } else if (sessionStorage.currentPageSvgData) {
+        let svgArr = JSON.parse(sessionStorage.currentPageSvgData);
+        let scaleFactor = 1;
+        //showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
+        showPreviewData(svgArr, null, scaleFactor, sessionStorage.pageSize, "纵向", null);
+        window.print();
+    } else {
+        //alert("没有报表数据!");
+    }
+}
+
+function showPreviewData(svgArr, actAreaArr, scaleFactor, pageSize, orientation, orgPixelSize) {
+    let orgHeight = 793, orgWidth = 1122;
+    let DFT_MARGIN = 3;
+    if (pageSize === 'A3') {
+        orgHeight = 1122;
+        orgWidth = 793 * 2;
+    } else if (pageSize.indexOf('自定义') >= 0) {
+        //自定义
+    } else {
+        //其他size(LEGAL, 16K etc.)
+    }
+    let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
+    if (orientation === "纵向") {
+        pageHeight = orgWidth * scaleFactor;
+        pageWidth = orgHeight * scaleFactor;
+    }
+
+    for (let i = 0; i < svgArr.length; i++) {
+        let offsetHeight = 0, offsetWidth = 0;
+        let paddingStr = '';
+        if (actAreaArr) {
+            paddingStr = `padding: ${actAreaArr[i].Top}px 0px 0px ${actAreaArr[i].Left}px`;
+            if (actAreaArr[i].Right > actAreaArr[i].Bottom) {
+                //横向,需要重新调整padding
+                paddingStr = `padding: ${actAreaArr[i].Left}px 0px 0px ${orgHeight - actAreaArr[i].Bottom}px`;
+            }
+            offsetWidth = actAreaArr[i].Left + (pageWidth - actAreaArr[i].Right) - DFT_MARGIN;
+            offsetHeight = actAreaArr[i].Top + (pageHeight - actAreaArr[i].Bottom) - DFT_MARGIN;
+            if (orgPixelSize[0] > orgPixelSize[1]) {
+                //横向强制改纵向(系统是以纵向为准),那么计算offset的方式会有所不同
+                offsetWidth = actAreaArr[i].Top + (pageWidth - actAreaArr[i].Bottom) - DFT_MARGIN;
+                //offsetHeight = actAreaArr[i].Left + (pageHeight - actAreaArr[i].Right) - (actAreaArr[i].Left - actAreaArr[i].Top) - DFT_MARGIN;
+                //新方式下,没那么复杂了
+                offsetHeight = actAreaArr[i].Left + (pageHeight - actAreaArr[i].Right) - DFT_MARGIN;
+            }
+        }
+        // let div = $('<div class="pageBreak"></div>');
+        let div = $(`<div class="pageBreak" style="${paddingStr}"></div>`);
+        div.append($(svgArr[i].join("")));
+        $(div).find("svg").each(function(cIdx,elementSvg){
+            elementSvg.setAttribute('height', pageHeight - offsetHeight);
+            elementSvg.setAttribute('width', pageWidth - offsetWidth);
+        });
+        $("body").append(div);
+    }
+}
+
+function getActualArea(pageData) {
+    let rst = [];
+    for (let item of pageData.items) {
+        let area = {Left: 10000, Right: 0, Top: 10000, Bottom: 0};
+        for (let cell of item.cells) {
+            if (cell.area.Left < area.Left) {
+                area.Left = cell.area.Left;
+            }
+            if (cell.area.Right > area.Right) {
+                area.Right = cell.area.Right;
+            }
+            if (cell.area.Top < area.Top) {
+                area.Top = cell.area.Top;
+            }
+            if (cell.area.Bottom > area.Bottom) {
+                area.Bottom = cell.area.Bottom;
+            }
+        }
+        rst.push(area);
+    }
+    return rst;
+}
+function closing() {
+    //
+}

+ 3 - 2
web/building_saas/report/js/rpt_print.js

@@ -127,8 +127,9 @@ function buildCellSvg(cell, fonts, styles, controls, pageMergeBorder, rptMergeBo
     ;
     let HtoVStr = "";
     if (isHtoV) {
-        //HtoVStr = ` transform="translate(`+ pixelSize[1] + `,0) rotate(90)"`;
-        HtoVStr = ` transform="translate(`+ (actArea.Bottom - actArea.Top + 5) + `,0) rotate(90)"`;
+        // HtoVStr = ` transform="translate(`+ (actArea.Bottom - actArea.Top + 5) + `,0) rotate(90)"`;
+        //引用了padding后,top坐标不用考虑offset了
+        HtoVStr = ` transform="translate(${(actArea.Bottom - actArea.Top + 2)},0) rotate(90)"`;
     }
     if (style) {
         let leftBS = getActualBorderStyle(cell, styles, mergeBandStyle, (pageMergeBorder)?pageMergeBorder:rptMergeBorder[JV.PROP_AREA], JV.PROP_LEFT);

+ 2 - 0
web/common/html/header.html

@@ -80,6 +80,8 @@
                     <!--<a class="dropdown-item" href="/web/common/html/pdfViewer.html?type=userGuide" target="_blank">用户手册</a>
                     <a class="dropdown-item" href="/web/common/html/pdfViewer.html?type=upgradeGuide" target="_blank">升级说明</a>-->
                     <a class="dropdown-item" href="http://doc.zhzdwd.com/docs/dsk_yhsc" target="_blank">用户手册</a>
+                    <a class="dropdown-item" href="http://doc.zhzdwd.com/docs/dhjc" target="_blank">动画教程</a>
+                    <a class="dropdown-item" href="http://yun.zhzdwd.com/docs" target="_blank">常见问题解答</a>
                     <a class="dropdown-item" href="http://doc.zhzdwd.com/docs/dasikongupdate" target="_blank">升级说明</a>
                     <a class="dropdown-item" href="http://zhzdwk.com/special/detail/36" target="_blank">计价依据</a>
                     <a class="dropdown-item" href="https://smartcost.com.cn/" target="_blank">纵横官网</a>

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

@@ -10,6 +10,9 @@ if(typeof projectGljObject !== 'undefined'){
         {ID:'MAIN_MATERIAL',text:'主材'}
     ];
     $('#menu_index_info').show();
+  projectGljObject.addCommonInfoPriceID = function (condition) { 
+    if(condition.areaID != projectGljObject.commonInfoPriceID) condition.commonInfoPriceID = projectGljObject.commonInfoPriceID;
+  }
 }
 if(typeof gljUtil !== 'undefined'){
     gljUtil.hasCompMachine = [301,304];//有组成物的机械

+ 4 - 0
web/over_write/js/guangdong_2018.js

@@ -475,6 +475,10 @@ if (typeof commonConstants !== 'undefined') {
     };
 }
 
+if(typeof gljCol !== 'undefined'){
+  gljCol.hideInfoPrice = false;
+};
+
 if(typeof module !== 'undefined'){
     module.exports = {
         getBillsCalcMode: getBillsCalcMode,