瀏覽代碼

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

TonyKang 6 年之前
父節點
當前提交
4d3d97a712

+ 14 - 2
modules/glj/models/unit_price_model.js

@@ -128,13 +128,25 @@ class UnitPriceModel extends BaseModel {
         }
 
         if (unitPriceData&&unitPriceData.length>0&&operation!='add') {// 如果原始编码能找到,但不存在一样的编号,名称,单位.型号等,更改code和添加新增标记,新增的时候除外。新增的情况下能到这一步说明有存在编码一致但其它属性不一致的情况,所以不用更改编码
-            insertData.code = data.original_code+"-"+unitPriceData.length;
+            //insertData.code = data.original_code+"-"+unitPriceData.length;
+            insertData.code = data.original_code+"-"+this.getLastNumber(data.original_code,unitPriceData);
             insertData.is_add=1;
         }
         let addPriceResult = await this.add(insertData);
         return [addPriceResult, true];
     }
-
+     getLastNumber(original_code,unitPriceData){
+        let codeArray = _.map(unitPriceData,'code');
+        let last = 1;
+        while (true){
+            if(_.includes(codeArray,original_code+"-"+last)){
+                last +=1
+            }else {
+                break;
+            }
+        }
+        return last;
+     }
     /**
      * 新增记录
      *

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

@@ -23,6 +23,7 @@ const userModel = mongoose.model('user');
 let config = require("../../../config/config.js");
 const optionModel = mongoose.model('options');
 const stdBillsGuidanceLibModel = mongoose.model('std_billsGuidance_lib');
+const fs = require('fs');
 
 //统一回调函数
 let callback = function(req, res, err, message, data){
@@ -262,10 +263,13 @@ module.exports = {
         let rationValuation = sessionCompilation.ration_valuation !== undefined ?
             sessionCompilation.ration_valuation : [];
         rationValuation = await engineeringLibModel.getLib(rationValuation);
+        let absoluteUrl = compilationData.overWriteUrl ? request.app.locals.rootDir + compilationData.overWriteUrl : request.app.locals.rootDir;
+        let overWriteUrl = fs.existsSync(absoluteUrl) && fs.statSync(absoluteUrl).isFile()? compilationData.overWriteUrl : null;
         let renderData = {
             userAccount: request.session.userAccount,
             userID: request.session.sessionUser.id,
             compilationData: JSON.stringify(sessionCompilation),
+            overWriteUrl: overWriteUrl,
             billValuation: JSON.stringify(billValuation),
             rationValuation: JSON.stringify(rationValuation),
             engineeringList: JSON.stringify(engineering.List),

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

@@ -713,11 +713,11 @@ async function getFullPath(projectID) {
     }
 }
 
-async function getProjectFeature(libID,engineerName){
+async function getProjectFeature(libID,feeStandardName){
     let lib = await featureLibModel.findOne({'ID':libID})
     if(lib){
         let eng = _.find(lib.feature,{'key':'engineering'})
-        if(eng) eng.value = engineerName;
+        if(eng) eng.value = feeStandardName;
         return lib.feature;
     }else {
         return [];

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

@@ -170,7 +170,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     //工程特征
                     if(data.updateData.property.featureLibID){
                         //工程专业显示费用定额的名称
-                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, compilationName);
+                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, data.updateData.property.feeStandardName);
                     }
                     /*projectFeature[0]['value'] = data.updateData.property.engineeringName || '';
                     data.updateData.property.projectFeature = projectFeature;*/

+ 17 - 11
public/web/tree_sheet/tree_sheet_helper.js

@@ -164,21 +164,19 @@ var TREE_SHEET_HELPER = {
                         sheet.setTag(iRow, iCol,tag);
                     }*/
                     if(colSetting.data.field=="code"){
-                        let tag ="";
+                        let tag =null;
                         if(node.sourceType == ModuleNames.ration){//定额的时候换算子目
                             tag = node.data.adjustState?node.data.adjustState:'';
                         }/*else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示  这里改成在 计量单位那里提示
                             tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
                         }*/
-                        sheet.setTag(iRow, iCol,tag);
+                        if(tag!=null&&tag!="") sheet.setTag(iRow, iCol,tag);
                     }
                     /*if(colSetting.data.field=="name"){ 2018-08-06 改成在编号列悬浮提示
                         let tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
                         sheet.setTag(iRow, iCol,tag);
                     }*/
-
                 }
-
                 if(colSetting.visible == false) return;//隐藏列不做其它操作
                 var cell = sheet.getCell(iRow, iCol, GC.Spread.Sheets.SheetArea.viewport);
                 if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
@@ -211,7 +209,7 @@ var TREE_SHEET_HELPER = {
                 }
             });
             if(setting.setAutoFitRow){
-                setting.setAutoFitRow(sheet,node)
+                setting.setAutoFitRow(sheet,node)//自动行高功能比较费时,400行,启用和不启用相差2秒左右
             }
             if (recursive) {
                 TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, node.children, recursive);
@@ -508,9 +506,9 @@ var TREE_SHEET_HELPER = {
                 $editor.css("height", cellRect.height);
                 $editor.attr("gcUIElement", "gcEditingInput");//padding:0  //value="${context.sheet.getValue(context.row,context.col)}"
                 $editor.html(` <div class="input-group input-group-sm">
-                                <input type="text" id="esInput" class="form-control" aria-label="Text input with dropdown button" autocomplete="off"   style="background-color:${cellStyle.backColor}">
+                                <input type="text" id="esInput" class="form-control" aria-label="Text input with dropdown button" autocomplete="off"   style=" background-color:${cellStyle.backColor}">
                                 <div class="">                           
-                                    <div class="triangle-border_dropdown tb-border_dropdown" id="esBtn" style="left: ${cellRect.width - 15+"px"}"></div>
+                                    <div class="triangle-border_dropdown tb-border_dropdown" id="esBtn" style="z-index:10; left: ${cellRect.width - 15+"px"};top:${cellRect.height/2-2+"px"}"></div>
                                 </div>
                             </div>
                 `);
@@ -521,15 +519,16 @@ var TREE_SHEET_HELPER = {
 
             TreeNodeCellType.prototype.updateEditor = function (editorContext, cellStyle, cellRect, context) {
                 let me = this;
-                $(editorContext).append(`<div><ul class="es-list" style="display: block;background-color:${cellStyle.backColor}"></ul></div>`);//<li class="" data-value="" style=""> <br></li>
+                $(editorContext).append(`<div><ul class="es-list" style="display: block;"></ul></div>`);//<li class="" data-value="" style=""> <br></li> //background-color:${cellStyle.backColor}
                 $('#esInput').val(context.sheet.getValue(context.row,context.col));
                 $('#esInput').select();
                 projectObj.project.Ration.getNearRations(initNode.data,function(rations){
                     if(rations.length > 0){
                         let li_html = "";
                         for(let r of rations){
-                            if(r.code==initNode.data.code) continue; //排除自已
-                            li_html += `<li class="es_li" data-value="${r.code}" >${r.code} ${r.name} ${r.unit}</li>`;//定额编码+空格+定额名称+空格+定额单位。
+                            let selfstyle = ""
+                            if(r.code==initNode.data.code) selfstyle="es-list-selected" //continue; //改为不排除,标记本身
+                            li_html += `<li class="es_li ${selfstyle}" data-value="${r.code}" >${r.code} ${r.name} ${r.unit}</li>`;//定额编码+空格+定额名称+空格+定额单位。
                         }
                         $(".es-list").html(li_html);
                         $(".es-list").css("min-width",cellRect.width);
@@ -541,6 +540,13 @@ var TREE_SHEET_HELPER = {
                         $(".es-list").hide();
                         context.sheet.endEdit();
                     })
+                    $(".es-list").children(".es_li").hover(function(){
+                        $(this).css("background-color",cellStyle.backColor);
+                    },function(){
+                        $(this).css("background-color","");
+                    });
+
+
                     $("#esBtn").bind('click',function(e){
                         $(".es-list").toggle();
                     });
@@ -610,7 +616,7 @@ var TREE_SHEET_HELPER = {
                     let left =  setting.pos.x + hitinfo.cellRect.x;
                     $(this._toolTipElement).css("top", top).css("left", left);*/
                     //显示在下方,三角形指
-                    let top = setting.pos.y  + hitinfo.cellRect.y+26;
+                    let top = setting.pos.y  +hitinfo.cellRect.y+ hitinfo.cellRect.height+10;
                     let left =  setting.pos.x + hitinfo.cellRect.x;
                     $(this._toolTipElement).css("top", top).css("left", left);
 

+ 1 - 0
server.js

@@ -26,6 +26,7 @@ cfgCacheUtil.setupDftCache();
 
 let app = express();
 let _rootDir = __dirname;
+app.locals.rootDir = _rootDir;
 log.use(app);
 app.use(express.static(_rootDir));
 

+ 7 - 2
web/building_saas/css/custom.css

@@ -231,9 +231,14 @@ legend.legend{
     border:none;
 }
 
-.es-list>li:hover{
+/*.es-list>li:hover{
+    background: lightgrey;
+}*/
+
+.es-list-selected{
     background: lightgrey;
 }
+
 .es-list>li{
     font-size:13px;
 }
@@ -256,4 +261,4 @@ legend.legend{
 .item_spread{
     width: 30%;
     float: left;
-}
+}

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

@@ -659,7 +659,7 @@ var gljOprObj = {
             if( codeMap[preCode]) options = codeMap[preCode];
             if(options.length>0) _.remove(options,{'value':gljOprObj.getIndex(recode, gljKeyArray)})//去掉本身
         }
-        return options;
+        return _.sortBy(options,'text');
     },
     filterGljByRation: function (ration, datas) {
         var gljList = [];

+ 10 - 0
web/building_saas/pm/html/project-management.html

@@ -440,6 +440,13 @@
                         </div>
                     </div>
                     <span class="form-text text-danger" id="valuation-info" style="display: none;">请选择计价规则</span>
+                    <div class="form-group row" id="regionDiv" style="display: none;">
+                        <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区</label>
+                        <div class="col">
+                            <select class="form-control  form-control-sm" id="regionSels">
+                            </select>
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">工程专业</label>
                         <div class="col">
@@ -684,6 +691,9 @@
 <script type="text/javascript" src="/lib/ztree/jquery.ztree.excheck.js"></script>
 <script src="/lib/jquery-contextmenu/jquery.contextMenu.min.js"></script>
 <!-- endinject -->
+<% if (overWriteUrl != undefined) { %>
+    <script type="text/javascript" src="<%= overWriteUrl%>"></script>
+<% } %>
 
 </body>
 <script type="text/javascript">

+ 25 - 2
web/building_saas/pm/js/pm_newMain.js

@@ -5,7 +5,6 @@
  * @date 2017/8/22
  * @version
  */
-//todo: 全部、分享、回收站树统一
 let Tree = null;//
 let movetoZTree = null;
 let copytoZTree = null;
@@ -30,6 +29,12 @@ let taxTypeMap = {
     2:"简易计税"
 };
 
+/*
+* 地区,同一费用定额下不同地区有不同单价,则新建单位工程时需要选择地区项
+* 地区项为空的时候,前端不显示该下拉项,地区的赋值覆盖在over_write相关文件中
+* */
+let regions = [];
+
 function isDef(v) {
     return typeof v !== 'undefined' && v !== null;
 }
@@ -1308,6 +1313,15 @@ $(document).ready(function() {
         return rst;
     }
 
+    //设置地区选项
+    function setRegionOpts (regions) {
+        $('#regionDiv').find('select').empty();
+        for(let region of regions){
+            let $opt = $(`<option value = "${region}">${region}</option>`);
+            $('#regionDiv').find('select').append($opt);
+        }
+    }
+
     // 新增单位工程弹层改变
     $('#add-tender-dialog').on('show.bs.modal', function() {
         //clear info
@@ -1324,6 +1338,11 @@ $(document).ready(function() {
         let projs = getProjs(selected);
         setProjOptions(projs, selected);
         $($("input[name='valuation_type']")[0]).click();
+        //设置地区选项
+        if(regions.length > 0){
+            setRegionOpts(regions);
+            $('#regionDiv').show();
+        }
         setTimeout(function () {
             $('#tender-name')[0].focus();
         }, 300);
@@ -2431,6 +2450,8 @@ function AddTender() {
 
         };
         let selectedItem = projTreeObj.tree.selected;
+        //地区
+        let region = $('#regionDiv').find('select').val() || '';
         let tenderInfo = {
             valuation: valuation,
             valuationType: valuationType,
@@ -2440,13 +2461,15 @@ function AddTender() {
             projectEngineering:libs.projectEngineering,//单位工程默认取费专业(造价书中插入量价、工料机时用)
             engineering_id: libs._id,
             engineeringName: engineeringName,
+            feeStandardName: feeName,
             unitPriceFile: {name: unitPriceFileObj.name, id: unitPriceFileObj.id},
             feeFile: {name: feeFileObj.name, id: feeFileObj.id},
             calcProgram: {name: calcProgramName, id: calcProgram},
             taxType:taxType,
             templateLibID:templateLibID,
             colLibID:colLibID,
-            featureLibID:featureLibID
+            featureLibID:featureLibID,
+            region: region
         };
         AddTenderItems(selectedItem, projName, engName, tenderName, tenderInfo, callback);
 

+ 21 - 1
web/over_write/js/chongqing_2018.js

@@ -289,7 +289,27 @@ if(typeof figureClassTemplate !== 'undefined'){
 if(typeof $ !== 'undefined' && $('#cbClassList')){
     $('#cbClassList').find('li:eq(5)').remove();
 }
-
+//测试地区============
+/*if(typeof regions !== 'undefined') {
+    regions = [
+        '兰州',
+        '定西',
+        '天水',
+        '平凉',
+        '庆阳',
+        '武威',
+        '金昌',
+        '张掖',
+        '酒泉',
+        '甘矿',
+        '嘉峪关',
+        '临夏',
+        '合作',
+        '武都',
+        '白银',
+    ];
+}*/
+//==============
 
 
 

+ 30 - 0
web/over_write/js/gansu_2013.js

@@ -0,0 +1,30 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2018/10/11
+ * @version
+ */
+
+if(typeof region !== 'undefined') {
+    region = [
+        '兰州',
+        '定西',
+        '天水',
+        '平凉',
+        '庆阳',
+        '武威',
+        '金昌',
+        '张掖',
+        '酒泉',
+        '甘矿',
+        '嘉峪关',
+        '临夏',
+        '合作',
+        '武都',
+        '白银',
+    ];
+    console.log(region);
+}