浏览代码

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

TonyKang 6 年之前
父节点
当前提交
fe2a81acb5

+ 1 - 2
modules/complementary_ration_lib/models/searchModel.js

@@ -22,8 +22,7 @@ class SearchDao{
             if(isDef(stdRation)){
                 ration = stdRation._doc;
                 ration.type = 'std';
-            }
-            else{
+            } else{
                 let compleQuery = {userId: userId, rationRepId: {$in: rationRepIds}, code: code, deleteInfo: null};
                 if(ID){
                     compleQuery = {ID: ID, deleteInfo: null};

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

@@ -32,6 +32,11 @@ let controller = {
         }
         data = JSON.parse(data);
         return await ration_facade.addMultiRation(data.newDatas,req.session.sessionCompilation);
+    },
+    getSameSectionRations:async function(req){//取同个章节相邻的定额
+        let data = req.body.data;
+        data = JSON.parse(data);
+        return await ration_facade.getSameSectionRations(data,req.session.sessionUser.id);
     }
 };
 

+ 30 - 1
modules/main/facade/ration_facade.js

@@ -16,6 +16,9 @@ let rationInstallationModel = mongoose.model('ration_installation');
 const uuidV1 = require('uuid/v1');
 let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
 let complementary_glj_model =  mongoose.model('complementary_glj_lib');
+let rationItemModel = mongoose.model("std_ration_lib_ration_items");
+let complementaryGljModel = mongoose.model('complementary_glj_lib');
+
 let coeMolde = mongoose.model('std_ration_lib_coe_list');
 let _= require('lodash');
 const projectDao = require('../../pm/models/project_model').project;
@@ -25,7 +28,8 @@ const fs = require('fs');
 module.exports = {
     replaceRations: replaceRations,
     addNewRation:addNewRation,
-    addMultiRation: addMultiRation
+    addMultiRation: addMultiRation,
+    getSameSectionRations:getSameSectionRations
 };
 async function addNewRation(data,compilation) {
     let query = data.itemQuery;
@@ -60,6 +64,31 @@ async function addMultiRation(datas,compilation) {
     return rst;
 }
 
+async function getSameSectionRations(data,userId){
+    //let userId
+    //要先根据定额获取所属章节的ID
+    let from = data.from;    //定额类型,是标准的还是用户定义的
+    let code = data.code;
+    let libID = data.libID;
+    let sectionId,rations=[];
+    if(from == 'std'){
+        let ration = await rationItemModel.findOne({rationRepId:libID,code:code},['sectionId']);
+        sectionId = ration.sectionId
+    }else {
+        let ration = await complementaryGljModel.findOne({userId:userId,code:code},['sectionId']);
+        sectionId = ration.sectionId
+    }
+    if(sectionId){
+        //{
+        let stdRations = await rationItemModel.find({sectionId: sectionId});
+        let comRations = await complementaryGljModel.find({userId: userId, sectionId: sectionId});
+        rations = stdRations.concat(comRations);
+        rations = _.sortBy(rations,'code');
+    }
+    return rations
+}
+
+
 async function  updateSerialNo(serialNoUpdate){
     let tasks=[];
     for(let data of serialNoUpdate){

+ 1 - 1
modules/main/routes/ration_route.js

@@ -13,6 +13,6 @@ module.exports = function (app) {
     rationRouter.post('/replaceRations', rationController.action);
     rationRouter.post('/addNewRation', rationController.action);
     rationRouter.post('/addMultiRation', rationController.action);
-
+    rationRouter.post('/getSameSectionRations', rationController.action);
     app.use('/ration', rationRouter);
 };

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

@@ -304,7 +304,7 @@ var sheetCommonObj = {
                 $editor.css("background", "white");
                 $editor.css("width", cellRect.width);
                 $editor.attr("gcUIElement", "gcEditingInput");
-                if(htmlGenerator) $editor.html(htmlGenerator(context,cellRect));
+                if(htmlGenerator) htmlGenerator(context,cellRect,$editor);
             }
         }
         CustomerCoeCellType.prototype.deactivateEditor = function (editorContext, context) {
@@ -823,6 +823,16 @@ var sheetCommonObj = {
         ctx.stroke();
         ctx.restore();
     },
+    drowTriangle:function(ctx,x,y){//画向下三角形
+        ctx.save();
+        ctx.fillStyle = "black";
+        ctx.beginPath();
+        ctx.moveTo(x, y);
+        ctx.lineTo(x-3, y -6);
+        ctx.lineTo(x+3, y -6);
+        ctx.fill();
+        ctx.restore();
+    },
     drowSubItem: function (ctx, x, y, w, h, offset, hasNext,step) {
         let t_step = step?step:6;
         offset += t_step;

+ 21 - 7
public/web/sheet/sheet_data_helper.js

@@ -146,9 +146,6 @@ var SheetDataHelper = {
         TipCellType.prototype.processMouseEnter = function (hitinfo) {
             let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
             let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
-       /*     let hintHeight = datas[hitinfo.row] ?
-                                datas[hitinfo.row].hintHeight ? datas[hitinfo.row].hintHeight : null
-                            : null; //定额库定额悬浮提示位置相关*/
             if(tag !== undefined && tag){
                 text = tag;
             }
@@ -201,14 +198,31 @@ var SheetDataHelper = {
                             divWidth = 590;
                            $(this._toolTipElement).width(divWidth);
                         }
-                        let top = setting.pos.y  + hitinfo.y - divHeight < 0 ? 0 : setting.pos.y  + hitinfo.y - divHeight;
-                        $(this._toolTipElement).css("top", top).css("left", setting.pos.x - divWidth);
+                        let top = setting.pos.y  + hitinfo.y - divHeight < 0 ? 0 :  setting.pos.y + hitinfo.cellRect.y - divHeight;
+                        if(hitinfo.col === 0){
+                            $(this._toolTipElement).css("top", top).css("left", setting.pos.x + hitinfo.cellRect.x - divWidth - 10);
+                        } else{
+                            $(this._toolTipElement).css("top", setting.pos.y + hitinfo.cellRect.y - divHeight - 10).css("left", setting.pos.x + hitinfo.cellRect.x - divWidth);
+                        }
                     }
                     else{
                         $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
                     }
-                    $(this._toolTipElement).show("fast");
-                    TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+                    if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdSectionRations' &&
+                        hitinfo.col === 1){
+                        let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
+                        let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
+                            zoom = hitinfo.sheet.zoom();
+                        let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
+                        let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
+                        if(textLength > cellWidth){
+                            $(this._toolTipElement).show("fast");
+                            TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+                        }
+                    } else {
+                        $(this._toolTipElement).show("fast");
+                        TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+                    }
                 }
             }
         };

+ 156 - 71
public/web/tree_sheet/tree_sheet_helper.js

@@ -189,6 +189,8 @@ var TREE_SHEET_HELPER = {
                 if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
                     cell.cellType(colSetting.data.cellType(node,setting));
                 }
+                //树节点显示列
+                if(iCol == setting.treeCol) cell.cellType(TREE_SHEET_HELPER.getTreeNodeCellType(setting, sheet, node.tree,node));
                 if(colSetting.data.autoHeight == true){
                     colSetting.setAutoHeight(cell,node);
                 }
@@ -225,14 +227,94 @@ var TREE_SHEET_HELPER = {
        sheet.invalidateLayout();
     },
     showTreeData: function (setting, sheet, tree) {
+        let TipCellType = function () {};
+        TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
+        TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
+            return {
+                x: x,
+                y: y,
+                row: context.row,
+                col: context.col,
+                cellStyle: cellStyle,
+                cellRect: cellRect,
+                sheet: context.sheet,
+                sheetArea: context.sheetArea
+            };
+        };
+        TipCellType.prototype.processMouseEnter = function (hitinfo) {
+            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
+            let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+            let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
+                zoom = hitinfo.sheet.zoom();
+            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
+            let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
+            let dataField = setting.cols[hitinfo.col].data.field;
+
+            if((tag==undefined||tag=='')&&hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){//显示其它列的标记为空并且设置了自动换行
+                return;
+            }
+            if(dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'||dataField=="name"){
+                if((hitinfo.sheet.getParent() === projectObj.mainSpread||hitinfo.sheet.getParent() === tender_obj.tenderSpread) && textLength <= cellWidth)
+                 return;
+            }
+
+            if(hitinfo.sheet.name()=="mainSheet"){
+                if(dataField=="quantity"){//显示工程量明细
+                    text = tag;
+                }/*if(dataField=="name"){//项目特征及内容隐藏时,显示特征及内容
+                 if(projectObj.ifItemCharHiden(setting)&&tag!=''){
+                 text = tag;
+                 }else if(textLength <= cellWidth){
+                 return;
+                 }
+                 }*/
+                else if(tag !== undefined && tag) {
+                    text = tag;
+                }
+            }
+
+            TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
+        };
+        TipCellType.prototype.processMouseLeave = function (hitinfo) {
+            TREE_SHEET_HELPER.hideTipsDiv();
+        }
+
+        TREE_SHEET_HELPER.protectdSheet(sheet);
+        TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
+            sheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.backward);
+            sheet.showRowOutline(false);
+            if (setting.defaultRowHeight) {
+                sheet.defaults.rowHeight = setting.defaultRowHeight;
+            }
+            sheet.setRowCount(tree.count() + setting.emptyRows, GC.Spread.Sheets.SheetArea.viewport);
+            sheet.getRange(tree.count(), -1, setting.emptyRows, -1).locked(true);
+            setting.cols.forEach(function (colSetting, iCol) {
+                sheet.setStyle(-1, iCol, TREE_SHEET_HELPER.getSheetCellStyle(colSetting));
+                if (colSetting.showHint) {
+                    sheet.getRange(-1, iCol, -1, 1).cellType(new TipCellType());
+                }
+                if(colSetting.formatter){
+                    sheet.setFormatter(-1, iCol, colSetting.formatter, GC.Spread.Sheets.SheetArea.viewport);
+                }
+            });
+            //sheet.getRange(-1, setting.treeCol, -1, 1).cellType(new TreeNodeCellType());
+            TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, tree.roots, true);
+            TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
+        });
+    },
+    getTreeNodeCellType:function(setting, sheet,tree,initNode){
         let indent = 20;
         let levelIndent = -5;
         let halfBoxLength = 5;
         let halfExpandLength = 3;
+        let isRationNode = sheet.name()=="mainSheet" && initNode.sourceType == ModuleNames.ration;
+
 
         let TreeNodeCellType = function () {
+            this.clickDropDown = false; //如果是点击下拉框的三角形的时候,默认展开下拉框
         };
-        TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
+        TreeNodeCellType.prototype =isRationNode? new GC.Spread.Sheets.CellTypes.Base(): new GC.Spread.Sheets.CellTypes.Text();//new GC.Spread.Sheets.CellTypes.Text();
         TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
             if (style.backColor) {
                 ctx.save();
@@ -332,10 +414,17 @@ var TREE_SHEET_HELPER = {
                     parentCenterX -= (indent + levelIndent);
                 }
             };
+
             // Draw Text
             x = x + (node.depth() + 1) * indent +  node.depth() * levelIndent;
             w = w - (node.depth() + 1) * indent - node.depth() * levelIndent;
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
+            //画下拉框三角形
+            let sheet = options.sheet;
+            if (isRationNode&& options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()) {
+                sheetCommonObj.drowTriangle(ctx,x+w-12,y+h/2+2);
+            }
+
         };
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
@@ -352,6 +441,13 @@ var TREE_SHEET_HELPER = {
             let offset = -1;
             let node = tree.items[hitinfo.row];
             tree.selected = node;
+            if(isRationNode &&hitinfo.row === hitinfo.sheet.getActiveRowIndex() && hitinfo.col === hitinfo.sheet.getActiveColumnIndex()){
+                if( hitinfo.x > hitinfo.cellRect.x + hitinfo.cellRect.width - 17){
+                    this.clickDropDown = true;
+                    setTimeout(function () {hitinfo.sheet.startEdit();},10);
+                    return;
+                }
+            }
             if (!node || node.children.length === 0) { return; }
             let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
             let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
@@ -378,10 +474,10 @@ var TREE_SHEET_HELPER = {
                 });
                 hitinfo.sheet.repaint();
             }
+
         };
         TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
             if(hitinfo.sheet.name() === 'stdBillsGuidance_bills'){
-
                 TREE_SHEET_HELPER.delayShowTips(hitinfo,setting);
             }
         };
@@ -399,81 +495,70 @@ var TREE_SHEET_HELPER = {
             TREE_SHEET_HELPER.hideTipsDiv();
         };
 
-        let TipCellType = function () {};
-        TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
-        TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
-            return {
-                x: x,
-                y: y,
-                row: context.row,
-                col: context.col,
-                cellStyle: cellStyle,
-                cellRect: cellRect,
-                sheet: context.sheet,
-                sheetArea: context.sheetArea
+        if(isRationNode){
+            TreeNodeCellType.prototype.createEditorElement = function (context) {
+                return document.createElement("div");
             };
-        };
-        TipCellType.prototype.processMouseEnter = function (hitinfo) {
-            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
-            let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
-            let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
-            let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
-                zoom = hitinfo.sheet.zoom();
-            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-            let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
-            let dataField = setting.cols[hitinfo.col].data.field;
 
-            if((tag==undefined||tag=='')&&hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){//显示其它列的标记为空并且设置了自动换行
-                return;
-            }
-            if(dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'||dataField=="name"){
-                if((hitinfo.sheet.getParent() === projectObj.mainSpread||hitinfo.sheet.getParent() === tender_obj.tenderSpread) && textLength <= cellWidth)
-                 return;
-            }
+            TreeNodeCellType.prototype.activateEditor = function (editorContext, cellStyle, cellRect, context) {
+                $editor = $(editorContext);
+                $editor.css("position", "fixed");
+                $editor.css("background", 'white');
+                $editor.css("width", cellRect.width);
+                $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}">
+                                <div class="">                           
+                                    <div class="triangle-border_dropdown tb-border_dropdown" id="esBtn" style="left: ${cellRect.width - 15+"px"}"></div>
+                                </div>
+                            </div>
+                `);
+                // <div class = "input-group-append"><button class="btn btn-outline-secondary dropdown-toggle" id="esBtn"  type="button"  aria-haspopup="true" aria-expanded="false"></button></div>
+                $editor.children('div').height(cellRect.height+2);
+                return $editor;
+            };
 
-            if(hitinfo.sheet.name()=="mainSheet"){
-                if(dataField=="quantity"){//显示工程量明细
-                    text = tag;
-                }/*if(dataField=="name"){//项目特征及内容隐藏时,显示特征及内容
-                 if(projectObj.ifItemCharHiden(setting)&&tag!=''){
-                 text = tag;
-                 }else if(textLength <= cellWidth){
-                 return;
-                 }
-                 }*/
-                else if(tag !== undefined && tag) {
-                    text = tag;
-                }
-            }
+            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>
+                $('#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>`;//定额编码+空格+定额名称+空格+定额单位。
+                        }
+                        $(".es-list").html(li_html);
+                        $(".es-list").css("min-width",cellRect.width);
+                    }
+                    if(me.clickDropDown == false) $(".es-list").hide();
 
-            TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
-        };
-        TipCellType.prototype.processMouseLeave = function (hitinfo) {
-            TREE_SHEET_HELPER.hideTipsDiv();
+                    $(".es-list").children(".es_li").bind('click',function (e) {
+                        $('#esInput').val(this.dataset.value);
+                        $(".es-list").hide();
+                        context.sheet.endEdit();
+                    })
+                    $("#esBtn").bind('click',function(e){
+                        $(".es-list").toggle();
+                    });
+                    if( $('#esInput').val()) setCursor( $("#esInput")[0], $('#esInput').val().length)
+                });
+            };
+            TreeNodeCellType.prototype.setEditorValue = function (editor, value, context) {
+
+                 $('#esInput').val(value);
+            };
+            TreeNodeCellType.prototype.getEditorValue = function (editor, context) {
+                this.isEscKey = false;
+                console.log($('#esInput').val());
+                return  $('#esInput').val()!==''? $('#esInput').val():null;
+            };
         }
+        return new TreeNodeCellType();
 
-        TREE_SHEET_HELPER.protectdSheet(sheet);
-        TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
-            sheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.backward);
-            sheet.showRowOutline(false);
-            if (setting.defaultRowHeight) {
-                sheet.defaults.rowHeight = setting.defaultRowHeight;
-            }
-            sheet.setRowCount(tree.count() + setting.emptyRows, GC.Spread.Sheets.SheetArea.viewport);
-            sheet.getRange(tree.count(), -1, setting.emptyRows, -1).locked(true);
-            setting.cols.forEach(function (colSetting, iCol) {
-                sheet.setStyle(-1, iCol, TREE_SHEET_HELPER.getSheetCellStyle(colSetting));
-                if (colSetting.showHint) {
-                    sheet.getRange(-1, iCol, -1, 1).cellType(new TipCellType());
-                }
-                if(colSetting.formatter){
-                    sheet.setFormatter(-1, iCol, colSetting.formatter, GC.Spread.Sheets.SheetArea.viewport);
-                }
-            });
-            sheet.getRange(-1, setting.treeCol, -1, 1).cellType(new TreeNodeCellType());
-            TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, tree.roots, true);
-            TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
-        });
     },
     showTipsDiv:function (text,setting,hitinfo) {
         if (setting.pos && text && text !== '') {

+ 44 - 1
web/building_saas/css/custom.css

@@ -81,6 +81,26 @@ legend.legend{
     border-width:6px;
     border-style:solid dashed dashed dashed;
 }
+.triangle-border_dropdown {
+    position:absolute;
+    left:0px;
+    overflow:hidden;
+    width:0;
+    height:0;
+    border-width:4px;
+    z-index: 10;
+    border-style:solid dashed dashed dashed;
+}
+.tb-border_dropdown {
+    top:7px;
+    border-color:#000 transparent transparent transparent;
+}
+
+.tb-background_dropdown {
+    bottom:-11px;
+    border-color:#000 transparent transparent transparent;
+}
+
 .tb-border {
     bottom:-12px;
     border-color:#000 transparent transparent transparent;
@@ -205,4 +225,27 @@ legend.legend{
 
 #toolToastBtn:active{
     color:#354ea1
-}
+}
+
+.select_input{
+    border:none;
+}
+
+.es-list>li:hover{
+    background: lightgrey;
+}
+.es-list>li{
+    font-size:13px;
+}
+.es-list{
+    white-space:nowrap;
+}
+
+.dropdown-toggle::after{
+    vertical-align:.5em
+}
+#esInput{
+    font-size:13px;
+    color: black;
+}
+

+ 10 - 4
web/building_saas/css/main.css

@@ -47,10 +47,13 @@ a{
 }
 .top-msg{
     position: fixed;
-    top:0;
-    width:100%;
-    z-index: 999
+    top:10px;
+    width:900px;
+    z-index: 9999;
+    left:50%;
+    margin-left:-450px;
 }
+
 .main {
     position: relative;
     background: #f7f7f9;
@@ -408,6 +411,9 @@ a{
     padding: 0;
     height:26px;
 }
+.custom-file-input {
+    cursor: pointer;
+}
 .custom-file-input:lang(zh) ~ .custom-file-label::after {
     content: "浏览";
 }
@@ -478,4 +484,4 @@ a{
     background:#F1F1F1;
     bottom:30px;
     left:2px;
-}
+}

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

@@ -42,7 +42,7 @@
 </div>-->
     <div class="header">
          <div class="top-msg clearfix">
-            <div class="alert alert-warning mb-0 py-0" role="alert" id="notify" style="display: none">
+            <div class="alert alert-warning alert-dismissible" role="alert" id="notify" style="display: none">
                 <button type="button" class="close" aria-label="Close" onclick="$('#notify').hide();">
                   <span aria-hidden="true">&times;</span>
                 </button>

+ 9 - 0
web/building_saas/main/js/models/ration.js

@@ -747,6 +747,15 @@ var Ration = {
             }else {
                 me.doContainUpdate(value,node);
             }
+        };
+        ration.prototype.getNearRations = function (ration,callback) {
+            if(ration&&ration.code && ration.code !=""){
+                CommonAjax.post("/ration/getSameSectionRations",{from:ration.from,code:ration.code,libID:ration.libID},function(rations){
+                    callback(rations);
+                })
+            }else {
+                callback([]);
+            }
 
         };
         ration.prototype.doContainUpdate = function (value,node) {

+ 10 - 9
web/building_saas/main/js/views/glj_col.js

@@ -5,20 +5,21 @@ let gljCol = {
     ration_glj_setting: {
         header: [
             {headerName: "编码", headerWidth: 130, dataCode: "code", dataType: "String", formatter: "@"},
-            {headerName: "名称", headerWidth: 240, dataCode: "name", dataType: "String",cellType:'tipsCell'},
-            {headerName: "规格型号", headerWidth: 160, dataCode: "specs", dataType: "String", hAlign: "left",cellType:'tipsCell'},
+            {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String",cellType:'tipsCell'},
+            {headerName: "规格型号", headerWidth: 190, dataCode: "specs", dataType: "String", hAlign: "left",cellType:'tipsCell'},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
-            {headerName: "市场价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
-            {headerName: "调整价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
-            {headerName: "定额价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
-            {headerName: "定额消耗", headerWidth: 80, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},   // dataType: "Number", formatter: "0.00"
-            {headerName: "自定消耗", headerWidth: 80, dataCode: "customQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
-            {headerName: "消耗量", headerWidth: 80, dataCode: "quantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
+            {headerName: "市场价", headerWidth: 65, dataCode: "marketPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
+            {headerName: "调整价", headerWidth: 65, dataCode: "adjustPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
+            {headerName: "定额价", headerWidth: 65, dataCode: "basePrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
+            {headerName: "定额消耗", headerWidth: 65, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},   // dataType: "Number", formatter: "0.00"
+            {headerName: "自定消耗", headerWidth: 65, dataCode: "customQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
+            {headerName: "消耗量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
             {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
             {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"}
         ],
         view: {
-            lockColumns: [ 5, 7, 9, 10, 11]//这里以后改成dataCode好一点
+            lockColumns: [ 5, 7, 9, 10, 11],//这里以后改成dataCode好一点
+            rowHeaderWidth:25
         },
         getStyle:function (data) {
             if(data.type == gljType.MAIN_MATERIAL){//是主材的话字体蓝色显示

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

@@ -26,7 +26,8 @@ var gljOprObj = {
             {headerName: "累加", headerWidth: 120, dataCode: "isSummation", dataType: "String", cellType: "checkBox"}
         ],
         view: {
-            lockColumns: [2, 3]
+            lockColumns: [2, 3],
+            rowHeaderWidth:25
         }
     },
     gljTreeSetting: {

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

@@ -2161,8 +2161,22 @@ $('#recColSetting').click(function () {
 $('#property_default').click(function () {
     let project = projectObj.project,
         projectID = project.ID();
-    //todo 清除窗口拖动比例缓存
-
+    //清单精灵/指引窗口比例
+    removeLocalCache('farwidth:stdBillsGuidanceTab');
+    removeLocalCache('nearwidth:stdBillsGuidanceTab');
+    removeLocalCache('farheight:#zy');
+    removeLocalCache('nearheight:#zy');
+    //定额库窗口比例
+    removeLocalCache('farwidth:stdRationTab');
+    removeLocalCache('nearwidth:stdRationTab');
+    removeLocalCache('farheight:#de');
+    removeLocalCache('nearheight:#de');
+    //主界面窗口比例
+    removeLocalCache('farheight:#main');
+    removeLocalCache('nearheight:#main');
+    //人材机汇总窗口比例
+    removeLocalCache('farheight:#project-glj-main');
+    removeLocalCache('nearheight:#project-glj-main');
     CommonAjax.post('/pm/api/defaultSettings', {user_id: userID, projectID: projectID}, function (rstData) {
         window.location.href = `/main?project=${projectID}`;
     });

+ 10 - 44
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -98,6 +98,7 @@ const billsGuidance = (function () {
             {name: '项目名称', dataCode: 'name', width: 190, vAlign: 'center', hAlign: 'left', formatter: '@'},
             {name: '单位', dataCode: 'unit', width: 45, vAlign: 'center', hAlign: 'center', formatter: '@'},
         ],
+        rowHeaderWidth:25,
         events: {
             SelectionChanging: function (sender, info) {
                 billsInitSel(info.newSelections[0].row);
@@ -111,49 +112,7 @@ const billsGuidance = (function () {
                     return;
                 }
                 if(node.children.length === 0){
-                    //插入清单
-                    if (/\//.test(node.data.unit)) {
-                        let canAdd = true;
-                        $.bootstrapLoading.start();
-                        let existB = projectObj.project.Bills.sameStdCodeBillsData(node.data.code);
-                        if (existB) {
-                            let std = JSON.parse(JSON.stringify(node.data));
-                            std.unit = existB.unit;
-                            canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
-                            if(canAdd !== null || canAdd !== false){
-                                //插入选中的定额
-                                let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
-                                insertRations(addRationDatas);
-                            }
-                            if(canAdd === false && $.bootstrapLoading.isLoading()){
-                                $.bootstrapLoading.end();
-                            }
-                        } else {
-                            ConfirmModal.stdBillsUnit.check(node.data, function (std) {
-                                canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
-                               /* if(canAdd !== null || canAdd !== false){
-                                    //插入选中的定额
-                                    let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
-                                    insertRations(addRationDatas);
-                                }*/
-                                if(canAdd === false && $.bootstrapLoading.isLoading()){
-                                    $.bootstrapLoading.end();
-                                }
-                            }, function () {
-                                if($.bootstrapLoading.isLoading()){
-                                    $.bootstrapLoading.end();
-                                }
-                            });
-                        }
-                    }
-                    else {
-                        let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
-                        /*if(insert){
-                            //插入选中的定额
-                            let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
-                            insertRations(addRationDatas);
-                        }*/
-                    }
+                    billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
                 }
                 else {
                     node.setExpanded(!node.expanded);
@@ -231,6 +190,7 @@ const billsGuidance = (function () {
             {name: '选择', dataCode: 'select', width: 35, vAlign: 'center', hAlign: 'center', formatter: '@'},
             {name: '项目指引', dataCode: 'name', width: 300, vAlign: 'center', hAlign: 'left', formatter: '@'},
         ],
+        rowHeaderWidth:25,
         events: {
             EditStarting: function (sender, args) {
                 if(!bills.tree || guideItem.headers[args.col]['dataCode'] === 'name'){
@@ -325,6 +285,7 @@ const billsGuidance = (function () {
             {name: '施工工序', dataCode: 'name', width: 250, rateWidth: 0.5, vAlign: 'center', hAlign: 'center', formatter: '@'},
             {name: '选项', dataCode: 'options', width: 250, rateWidth: 0.5,  vAlign: 'center', hAlign: 'left', formatter: '@'},
         ],
+        rowHeaderWidth:25,
         events: {
             CellClick: function (sender, args) {
                 if(elfItem.headers[args.col]['dataCode'] === 'options' && args.sheetArea === 3){
@@ -379,7 +340,11 @@ const billsGuidance = (function () {
     function buildHeader(sheet, headers) {
         let fuc = function () {
             sheet.setColumnCount(headers.length);
-            sheet.setRowHeight(0, 40, GC.Spread.Sheets.SheetArea.colHeader);
+            sheet.setRowHeight(0, 30, GC.Spread.Sheets.SheetArea.colHeader);
+            sheet.setColumnWidth(0, sheet.getParent() === bills.workBook ? 15 : 25, GC.Spread.Sheets.SheetArea.rowHeader);
+            if(sheet.getParent() === elfItem.workBook || sheet.getParent() === guideItem.workBook){
+                sheet.setRowHeight(0, 25, GC.Spread.Sheets.SheetArea.colHeader);
+            }
             for(let i = 0, len = headers.length; i < len; i++){
                 sheet.setValue(0, i, headers[i].name, GC.Spread.Sheets.SheetArea.colHeader);
                 sheet.setColumnWidth(i, headers[i].width, GC.Spread.Sheets.SheetArea.colHeader);
@@ -453,6 +418,7 @@ const billsGuidance = (function () {
                 sheet.getRange(-1, 0, -1, 1).locked(true);
                 sheet.getRange(-1, 1, -1, 1).locked(false);
             }
+            if(module.rowHeaderWidth)  sheet.setColumnWidth(0, module.rowHeaderWidth, GC.Spread.Sheets.SheetArea.rowHeader);
             setOptions(module.workBook, options);
             buildHeader(module.workBook.getActiveSheet(), module.headers);
             if(module === elfItem){

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

@@ -314,6 +314,7 @@ var rationLibObj = {
         }, {
             "width":220,
             "readOnly": true,
+            "showHint": true,
             "head":{
                 "titleNames":["名称"],
                 "spanCols":[1],

+ 17 - 11
web/building_saas/main/js/views/zmhs_view.js

@@ -8,12 +8,13 @@ let zmhs_obj = {
     coeSheetData:[],
     coeSetting: {
         header: [
-            {headerName: "调整", headerWidth: 45, dataCode: "isAdjust", dataType: "String", cellType: "checkBox"},
-            {headerName: "条件", headerWidth: 150, dataCode: "name", dataType: "String", cellType: "button"},
-            {headerName: "内容", headerWidth: 350, dataCode: "content", dataType: "String", hAlign: "left"}
+            {headerName: "调整", headerWidth: 35, dataCode: "isAdjust", dataType: "String", cellType: "checkBox"},
+            {headerName: "条件", headerWidth: 250, dataCode: "name", dataType: "String", cellType: "button"},
+            {headerName: "内容", headerWidth: 160, dataCode: "content", dataType: "String", hAlign: "left"}
         ],
         view: {
-            lockColumns:[0,1,2]
+            lockColumns:[0,1,2],
+            rowHeaderWidth:25
         }
     },
     assSpread:null,
@@ -22,11 +23,12 @@ let zmhs_obj = {
     assSetting: {
         header: [
             {headerName: "调整名称", headerWidth: 100, dataCode: "name", dataType: "String"},
-            {headerName: "定额值", headerWidth: 120, dataCode: "stdValue", hAlign: "right", dataType: "String"},
-            {headerName: "实际值", headerWidth: 120, dataCode: "actualValue", hAlign: "right", dataType: "String"}
+            {headerName: "定额值", headerWidth: 80, dataCode: "stdValue", hAlign: "right", dataType: "String"},
+            {headerName: "实际值", headerWidth: 80, dataCode: "actualValue", hAlign: "right", dataType: "String"}
         ],
         view: {
-            lockColumns: [0, 1]
+            lockColumns: [0, 1],
+            rowHeaderWidth:25
         }
     },
     initSpread:function () {
@@ -215,17 +217,21 @@ let zmhs_obj = {
         let recode = me.coeSheetData[args.row];
         projectObj.project.ration_coe.adjustCoeClick(recode, newval);
     },
-    generateHtmlString: function (context,cellRect) {//这里要改成动态的了,根据自定义系数内容生成对应的输入框
+    generateHtmlString: function (context,cellRect,$editor) {//这里要改成动态的了,根据自定义系数内容生成对应的输入框
         let me = zmhs_obj;
         let height = cellRect.height;
-        let newString = "<div style='height:"+ height+"px'><div onclick='zmhs_obj.coeSheet.endEdit()' style='margin:-1px 1px 0px'>自定义系数</div></div><form style='margin-top:1px' ><table  width='100%'  cellpadding='0'  border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;font-size: 10px;'>";
+        let offect = 0;
+        let newString = "<form style='margin-top:1px' ><table  width='100%'  cellpadding='0'  border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;font-size: 10px;'>";
         let cus_coe =  me.coeSheetData[context.row];
         if(cus_coe){
             for(let i =0;i< cus_coe.coes.length;i++){
-                newString += me.getOneRow(cus_coe.coes[i].coeType, i, cus_coe.coes[i].coeType,height)
+                newString += me.getOneRow(cus_coe.coes[i].coeType, i, cus_coe.coes[i].coeType,height);
+                offect += height +1
             }
         }
-        newString += "</table></form>";
+        newString += "</table></form><div style='height:"+ height+"px'><div onclick='zmhs_obj.coeSheet.endEdit()' style='margin:-1px 1px 0px'>自定义系数</div></div>";
+        $editor.html(newString);
+        $editor.css("margin-top",-(offect+2));
         return newString;
     },
     getOneRow: function (text, name, id,inputHeight) {