Selaa lähdekoodia

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionOperation

zhongzewei 7 vuotta sitten
vanhempi
commit
152f6943e0

BIN
img/avatar.png


+ 5 - 1
modules/all_models/bills_template.js

@@ -32,7 +32,11 @@ let BillsTemplateSchema = {
     // 所属计价ID
     valuationId: String,
     // 工程专业
-    engineering: Number
+    engineering: Number,
+    //计算基数
+    calcBase: String,
+    //费率ID
+    feeRateID:Number
 };
 
 mongoose.model(collectionName, new Schema(BillsTemplateSchema, {versionKey: false, collection: collectionName}));

+ 4 - 0
modules/all_models/engineering_lib.js

@@ -55,6 +55,10 @@ let modelSchema = {
     program_lib: {
         type: Schema.Types.Mixed,
         default: []
+    },
+    //设置人材机显示列
+    glj_col:{
+        showAdjustPrice:Boolean//是否显示调整价列
     }
 };
 mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 1 - 0
modules/users/controllers/compilation_controller.js

@@ -253,6 +253,7 @@ class CompilationController extends BaseController {
             feeRateList: JSON.stringify(feeRateList),
             billsTemplateData: JSON.stringify(billsTemplateData),
             mainTreeCol: JSON.stringify(libData.main_tree_col),
+            gljCol:JSON.stringify(libData.glj_col),
             calculationList: JSON.stringify(calculationList),
             billsGuidanceList: JSON.stringify(billsGuidanceList),
             layout: 'users/views/layout/layout'

+ 1 - 1
modules/users/models/bills_template_model.js

@@ -25,7 +25,7 @@ class BillsTemplateModel extends BaseModel {
      */
     async getTemplateData (valuationId, engineering) {
         // 筛选字段
-        let field = {_id: 1, valuationId: 1, ID: 1, ParentID: 1, NextSiblingID: 1, code: 1, name: 1, unit: 1, flags: 1, type: 1};
+        let field = {_id: 1, valuationId: 1, ID: 1, ParentID: 1, NextSiblingID: 1, code: 1, name: 1, unit: 1, flags: 1, type: 1,calcBase:1,feeRateID:1};
         let data = await this.findDataByCondition({valuationId: valuationId, engineering: engineering}, field, false);
         console.log(data);
         return data === null ? [] : data;

+ 3 - 0
modules/users/models/engineering_lib_model.js

@@ -67,6 +67,9 @@ class EngineeringLibModel extends BaseModel {
                 cols:[]
             }
         }
+        if(data.glj_col){
+            data.glj_col =  JSON.parse(data.glj_col);
+        }
 
         let result = false;
         data = this.filterLibData(data);

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

@@ -31,6 +31,7 @@ var TREE_SHEET_HELPER = {
         spread.options.allowCopyPasteExcelStyle = false;
         spread.options.allowUserDragDrop = false;
         spread.options.allowContextMenu = false;
+        spread.options.showDragFillSmartTag = false;
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },

modules/reports/util/pdfkit_test.js → test/unit/reports/pdfkit_test.js


+ 19 - 0
web/users/js/col_setting.js

@@ -320,6 +320,25 @@ $('#set-column').on('shown.bs.modal', function () {
         ColSettingObj.initColSetting(ColSettingObj.colSetting);
     }
 });
+
+$('#set-glj-col').on('show.bs.modal', function () {
+    let glj_col_setting = JSON.parse($("#glj_col").val());
+    if(glj_col_setting.showAdjustPrice){
+        $('#adjustPrice_cb').prop('checked',true);
+    }else {
+        $('#adjustPrice_cb').prop('checked',false);
+    }
+});
+
+$('#set-glj-comf').click(function () {
+
+    let showAdjustPrice =  $('#adjustPrice_cb').prop('checked');
+    let glj_col_setting = {
+        showAdjustPrice :showAdjustPrice
+    };
+    $("#glj_col").val(JSON.stringify(glj_col_setting));
+});
+
 $('#col-count').change(function () {
     ColSettingObj.setColCount(parseInt($(this).val()));
 });

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 12557 - 0
web/users/js/lib/lodash.js


+ 3 - 0
web/users/js/main_tree_col.js

@@ -34,6 +34,9 @@ let MainTreeCol = {
         },
         marketPrice: function (node) {
 
+        },
+        feeRate:function (node) {
+            
         }
 
     },

+ 120 - 27
web/users/js/template.js

@@ -94,6 +94,41 @@ let TEMPLATE_BILLS_SETTING = {
             "font":"Arail",
         }
     }, {
+        "width":250,
+        "readOnly":false,
+        "head":{
+            "titleNames":["计算基数"],
+            "spanCols":[1],
+            "spanRows":[1],
+            "vAlign":[1],
+            "hAlign":[1],
+            "font":["Arial"]
+        },
+        "data":{
+            "field":"calcBase",
+            "vAlign":0,
+            "hAlign":3,
+            "font":"Arail",
+        }
+    }, {
+        "width":50,
+        "readOnly":false,
+        "head":{
+            "titleNames":["费率ID"],
+            "spanCols":[1],
+            "spanRows":[1],
+            "vAlign":[1],
+            "hAlign":[1],
+            "font":["Arial"]
+        },
+        "data":{
+            "field":"feeRateID",
+            "type":'Number',
+            "vAlign":0,
+            "hAlign":1,
+            "font":"Arail"
+        }
+    }, {
         "width":50,
         "readOnly":true,
         "head":{
@@ -161,7 +196,7 @@ $(document).ready(function () {
         showButton(tree.selected && tree.selected.canUpMove(), $('#upMove'));
         showButton(tree.selected && tree.selected.canDownMove(), $('#downMove'));
         showButton(tree.selected ? true : false, $('#delete'));
-    }
+    };
     let RefreshBillsData = function (datas) {
         datas.forEach(function (data) {
             let node = tree.findNode(data.data.ID);
@@ -179,11 +214,19 @@ $(document).ready(function () {
         combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value)
             .items(comboItems);
         return combo;
-    }
+    };
     let getFixedFlagCellType = function () {
         let billsFixedFlagData = JSON.parse(billsFixedFlagList);
         return getNameValueComboCellType(billsFixedFlagData);
     };
+    let getNameToValueMap = function (listString) {
+        let map = {};
+        let datas = JSON.parse(listString);
+        for(let data of datas){
+            map[data.name] = data.value;
+        }
+        return map;
+    };
     let getTypeFlagCellType = function () {
         let billsTypeFlagData = JSON.parse(billsTypeFlagList);
         return getNameValueComboCellType(billsTypeFlagData);
@@ -206,7 +249,30 @@ $(document).ready(function () {
                 valueField = valueField[fields[i]];
             }
         }
-    }
+    };
+    let getRealValue = function (value,map) {//中文到实际值的转换
+        value = value.replace(/[\s\r\n]/g, "");//去掉空格,回车等无用字符
+        if(map[value]!==undefined && map[value]!==null) value = map[value];
+        return value;
+    };
+    let setUpdateData = function (node,data,col,value,setting) {
+        let fieldName = setting.cols[col].data.field;
+        let valueType = setting.cols[col].data.type;
+        if(fieldName == 'type'){
+            value = getRealValue(value,typeMap);
+        }
+        if(fieldName == 'flagsIndex.fixed.flag'){
+            value = getRealValue(value,fixedFlagMap);
+        }
+        if (/flagsIndex/.test(fieldName)) {
+            data.data.flags = [];
+            let flagField = fieldName.split('.');
+            data.data.flags.push({fieldName: flagField[1],flag: value});
+        } else {
+            if(value && valueType == 'Number') value = parseInt(value);
+            setFee(data.data, fieldName, value);
+        }
+    };
 
     billsTemplateData = billsTemplateData.replace(/\n/g, '\\n');
     let templateData = JSON.parse(billsTemplateData);
@@ -230,6 +296,10 @@ $(document).ready(function () {
     let tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
     let billsSpread = TREE_SHEET_HELPER.createNewSpread($('#billsSpread')[0]);
     let controller = TREE_SHEET_CONTROLLER.createNew(tree, billsSpread.getActiveSheet(), TEMPLATE_BILLS_SETTING);
+    let fixedFlagMap = getNameToValueMap(billsFixedFlagList);
+    let typeMap = getNameToValueMap(billsTypeFlagList);
+    console.log(fixedFlagMap);
+    console.log(typeMap);
     //format code
     //billsSpread.getSheet(0).setFormatter(-1, 1, '@');
     controller.bind('refreshBaseActn', RefreshBaseActn);
@@ -237,25 +307,33 @@ $(document).ready(function () {
     billsSpread.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, info) {
         var node = controller.tree.items[info.row];
         var fieldName = controller.setting.cols[info.col].data.field;
-        var data = {type: 'update', data: {ID: node.getID()}};
-       if (/flagsIndex/.test(fieldName)) {
-            data.data.flags = [];
-            let flagField = fieldName.split('.');
-            data.data.flags.push({fieldName: flagField[1], flag: info.editingText});
-        } else {
-            setFee(data.data, fieldName, info.editingText);
+        var valueType = controller.setting.cols[info.col].data.type;
+        let value = info.editingText;
+        if(node){
+            var data = {type: 'update', data: {ID: node.getID()}};
+            if (/flagsIndex/.test(fieldName)) {
+                data.data.flags = [];
+                let flagField = fieldName.split('.');
+                data.data.flags.push({fieldName: flagField[1], flag: info.editingText});
+            } else {
+                if(value && valueType == 'Number') value = parseInt(info.editingText);
+                setFee(data.data, fieldName, value);
+            }
+            var updateData = [data];
+            CommonAjax.post(updateUrl, updateData, function (data) {
+                setFee(node.data, fieldName, value);
+                controller.refreshTreeNode([node], false);
+            }, function () {
+                controller.refreshTreeNode([node], false);
+            });
+        }else {
+           info.sheet.getCell(info.row,info.col).value("");
         }
-        var updateData = [data];
-        CommonAjax.post(updateUrl, updateData, function (data) {
-            setFee(node.data, fieldName, info.editingText);
-            controller.refreshTreeNode([node], false);
-        }, function () {
-            controller.refreshTreeNode([node], false);
-        });
+
     });
     billsSpread.bind(GC.Spread.Sheets.Events.ClipboardPasted, function (e, info) {
         console.log("ClipboardPasted");
-        var node, iRow, iCol, curRow, curCol, datas = [], data, fieldName, updateData;
+        var node, iRow, iCol, curRow, curCol, datas = [], data, fieldName,valueType,value, updateData;
         for (iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
             curRow = info.cellRange.row + iRow;
             node = controller.tree.items[curRow];
@@ -263,15 +341,8 @@ $(document).ready(function () {
                 data = {type: 'update', data: {ID: node.getID()}};
                 for (iCol = 0; iCol < info.cellRange.colCount; iCol++) {
                     curCol = info.cellRange.col + iCol;
-                    fieldName = controller.setting.cols[curCol].data.field;
-
-                    if (/flagsIndex/.test(fieldName)) {
-                        data.data.flags = [];
-                        let flagField = fieldName.split('.');
-                        data.data.flags.push({fieldName: flagField[1],flag: info.sheet.getText(curRow, curCol)});
-                    } else {
-                        setFee(data.data, fieldName, info.sheet.getText(curRow, curCol));
-                    }
+                    value = info.sheet.getText(curRow, curCol);
+                    setUpdateData(node,data,curCol,value,controller.setting);
                 }
                 datas.push(data);
             }
@@ -283,7 +354,29 @@ $(document).ready(function () {
             controller.showTreeData();
         });
     });
+    billsSpread.bind(GC.Spread.Sheets.Events.RangeChanged, function (e,info) {
+        let datas = [];
+        let changGroup = _.groupBy(info.changedCells,'row');
+        for(let row in changGroup){
+            let node = controller.tree.items[row];
+            if (node) {
+                let data = {type: 'update', data: {ID: node.getID()}};
+                for (let cell of changGroup[row]) {
+                    let value = info.sheet.getText(cell.row, cell.col);
+                    if(value=="") value = null;
+                    setUpdateData(node,data,cell.col,value,controller.setting);
+                }
+                datas.push(data);
+            }
+        }
+        CommonAjax.post(updateUrl, datas, function (data) {
+            RefreshBillsData(data);
+            controller.showTreeData();
+        }, function () {
+            controller.showTreeData();
+        });
 
+    });
     tree.loadDatas(templateData);
     controller.showTreeData();
     RefreshBaseActn(tree);

+ 4 - 2
web/users/views/compilation/engineering.html

@@ -144,14 +144,16 @@
                     </div>
                     <div class="col-md-12">
                         <legend>清单模板 / 造价书列</legend>
-                        <a href="javascript:void(0)" data-toggle="modal" data-target="#set-column" class="btn btn-primary btn-sm pull-right">设置</a>
+                        <a data-toggle="modal" data-target="#set-column" class="btn btn-primary btn-sm pull-right">设置</a>
                         <a href="/compilation/template/<%= section %>/<%= valuationId %>/<%= engineeringInfo.id%>"
                                data-toggle="modal" data-target="" class="btn btn-primary btn-sm pull-right"
                                style="margin-right:5px">模板设置</a>
+                        <a data-toggle="modal" data-target="#set-glj-col" class="btn btn-primary btn-sm pull-right" style="margin-right:5px">人材机列</a>
                         <input type="hidden" name="main_tree_col" value="<%= mainTreeCol %>">
                         <div id="main-tree-col" style="height: 400px;"></div>
                     </div>
                 </div>
+                <input type="hidden" name="glj_col" value="<%= gljCol %>" id="glj_col">
                 <input type="hidden" name="engineering" value="<%= engineeringInfo.id %>" id="engineering">
                 <input type="hidden" name="section" value="<%= section %>" id="section">
                 <input type="hidden" name="id" value="<%= valuationId %>">
@@ -169,7 +171,7 @@
     let mainTreeCol = '<%- mainTreeCol %>';
     let billsTemplateData = '<%- billsTemplateData %>';
     let billsGuidanceList = '<%- billsGuidanceList %>';
-    let colSpread = null;
+    let gljCol = '<%- gljCol %>';    let colSpread = null;
     let colEditSpread = null;
 </script>
 <script type="text/javascript" src="/public/web/id_tree.js"></script>

+ 29 - 0
web/users/views/compilation/modal.html

@@ -213,4 +213,33 @@
         </div>
     </div>
 </div>
+
+<!-- 弹窗人材机列设置 -->
+<div class="modal fade" id="set-glj-col" tabindex="-1" role="dialog">
+    <div class="modal-dialog " role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                <h4 class="modal-title" id="glj_tit">人材机列设置</h4>
+            </div>
+            <div class="modal-body">
+                <div class="row">
+                    <div class="col-md-12">
+                        <div class="checkbox">
+                            <label>
+                                <input type="checkbox" id="adjustPrice_cb"> 显示调整价列
+                            </label>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+                <button type="button" class="btn btn-primary" data-dismiss="modal" id = "set-glj-comf">确定</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+
 <script type="text/javascript" src="/web/users/js/col_setting.js"></script>

+ 2 - 2
web/users/views/compilation/template.html

@@ -25,7 +25,7 @@
         <div class="c-body">
             <legend>清单模板设置<a href="/compilation/valuation/<%= section %>/<%= valuationId %>" class="btn btn-default btn-sm pull-right">返回</a><a href="#" class="btn btn-primary btn-sm pull-right" style="margin-right:5px">保存</a></legend>
             <div class="row">
-                <div class="col-md-9">
+                <div class="col-md-11">
                     <div class="tools-btn btn-group align-top">
                         <a href="" class="btn btn-sm"><i class="fa fa-files-o" aria-hidden="true"></i> 复制</a>
                         <a href="" class="btn btn-sm"><i class="fa fa-scissors" aria-hidden="true"></i> 剪切</a>
@@ -40,7 +40,7 @@
                     <div class="mb-qd-height" id="billsSpread" style="height: 500px;">
                     </div>
                 </div>
-                <div class="col-md-3">
+                <div class="col-md-1">
                     <select class="form-control" style="display: none"><option>定额</option></select>
                     <div class="mb-de-height">
                     </div>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
web/users/views/layout/layout.html