Jelajahi Sumber

Merge branch '1.0.0_online' of http://192.168.1.41:3000/SmartCost/ConstructionOperation into 1.0.0_online

TonyKang 6 tahun lalu
induk
melakukan
106413da3d

+ 4 - 1
modules/all_models/stdRation_ration.js

@@ -19,7 +19,10 @@ const rationAssItemSchema = new Schema({
     decimal: Number,
     carryBit: String,
     minValue: String,
-    maxValue: String
+    maxValue: String,
+    paramName:String,//参数名称
+    param:String,//参数
+    thirdRationCode:String//第三定额
 }, { _id: false });
 
 //定额安装增加费用

+ 3 - 4
modules/ration_repository/controllers/ration_repository_controller.js

@@ -195,12 +195,11 @@ class RationRepositoryController extends baseController {
                 if (sheet[0] === undefined || sheet[0].data === undefined) {
                     throw 'excel没有对应数据';
                 }
-                const result = type === 'source_file' ?
+                const failGLJList = type === 'source_file' ?
                     await rationItem.batchAddFromExcel(rationRepId, sheet[0].data) :
                     await rationItem.batchUpdateSectionIdFromExcel(sheet[0].data);
-                if (rationItem.failGLJList && rationItem.failGLJList.length > 0) {
-                    responseData.msg = rationItem.failGLJList.join("\r\n");
-                    rationItem.failGLJList = [];
+                if (Array.isArray(failGLJList) && failGLJList.length > 0) {
+                    responseData.msg = failGLJList.join("<br/>");
                 }
                 // 删除文件
                 if(uploadFullName && fs.existsSync(uploadFullName)){

+ 13 - 7
modules/ration_repository/models/ration_item.js

@@ -810,12 +810,14 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
         stdGLJListByID[tmp.ID] = tmp;
     }
     let lastData = {};
+    // 定额xx下提示的次数
+    let lastFailCount = 0;
     const rationData = [];
     // 编码列表,用于查找库中是否有对应数据
     let rationCodeList = [];
     let gljCodeList = [];
     // 插入失败的工料机列表(用于提示)
-    this.failGLJList = [];
+    let failGLJList = [];
     for (const tmp of data) {
         if (tmp.length <= 0) {
             continue;
@@ -824,8 +826,12 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
         if (tmp[0] === undefined && Object.keys(lastData).length > 0) {
             // 如果不存在对应的工料机库数据则跳过
             if (stdGLJList[tmp[1]] === undefined) {
-                const failString = '定额' + lastData.code + '下的' + tmp[1];
-                this.failGLJList.push(failString);
+                if (lastFailCount === 0) {
+                    failGLJList.push('定额' + lastData.code + '下的');
+                    lastFailCount++;
+                }
+                //const failString = '定额' + lastData.code + '下的' + tmp[1];
+                failGLJList.push(tmp[1]);
                 continue;
             }
             const tmpRationGlj = {
@@ -843,7 +849,7 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
         if (tmp[0] === '定额' && Object.keys(lastData).length > 0) {
             rationData.push(lastData);
         }
-
+        lastFailCount = 0;
         // 组装数据
         lastData = {
             code: tmp[1],
@@ -901,7 +907,7 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
     }
     // 如果都已经存在,直接返回
     if (insertData.length <= 0) {
-        return true;
+        return failGLJList;
     }
     //计算价格
     for(let ration of insertData){
@@ -919,8 +925,8 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
         count++;
     }
     // 插入数据库
-    const result = await rationItemModel.create(insertData);
-    return result.length > 0;
+    await rationItemModel.create(insertData);
+    return failGLJList;
 };
 
 /**

+ 12 - 2
public/scHintBox.html

@@ -19,7 +19,7 @@
             </div>
 
             <div class="modal-body">
-                <div id = "hintBox_caption" style="margin:5px 10px 10px 10px;">提示明细</div>
+                <div id = "hintBox_caption" style="margin:5px 10px 10px 10px; max-height:300px; overflow: auto">提示明细</div>
                 <div style="margin:5px 10px 5px 10px;">
                     <input id="hintBox_value" type="text" class="form-control" value="" />
                     <p id="hintBox_error" style="margin-top:7px; color:red; display:none;">“xxx”已存在!</p>
@@ -77,6 +77,12 @@
         font: function(str){
             return `<span style='color:red;font-weight:bold;font-size:15px'> ${str} </span>`;
         },
+        fontRed: function(str){
+            return `<span style='color:red;'> ${str} </span>`;
+        },
+        fontBlue: function(str){
+            return `<span style='color:blue;'> ${str} </span>`;
+        },
         error: function (err) {   // 注意:该方法只能用在valueBox()的doOK回调函数中。
             $('#hintBox_error').text(err);
             $('#hintBox_error').show(200);
@@ -142,7 +148,11 @@
             $("#hintBox_form").modal('show');
 
         },
-        valueBox: function (title, value, doOK) {
+        valueBox: function (title, value, doOK,row) {
+            if(row && row>0){//默认为input,如果有row说明是要多行输入,把input换成textarea.
+                $('#hintBox_value').remove();
+                $("#hintBox_error").before(` <textarea id="hintBox_value" class="form-control" rows="${row}"></textarea>`);
+            }
             this.init();
             $('#hintBox_title').text(title);
             this.value = value;

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

@@ -33,6 +33,7 @@ var sheetCommonObj = {
             allowResizeColumns: true
         };
         sheet.showRowOutline(false);
+        sheet.options.allowCellOverflow = false;
         me.buildHeader(sheet, setting);
         if (rowCount > 0) sheet.setRowCount(rowCount);
         sheet.resumeEvent();

+ 11 - 4
web/maintain/billsGuidance_lib/html/zhiyin.html

@@ -68,18 +68,25 @@
                         <div style="width: 99%; float: left" id="de">
                             <div class="sidebar-tools-bar container-fluid tools-bar-height-q">
                                 <div class="p-1 row">
-                                    <div class="col-5 p-0">
+                                    <div class="col-4 p-0">
                                         <select class="form-control form-control-sm" id="rationLibSel">
                                         </select>
                                     </div>
-                                    <div class=" input-group col-5">
+                                    <div class=" input-group col-5 pl-0">
                                         <input id="searchText" type="text" class="form-control form-control-sm" placeholder="搜索定额">
                                         <span class="input-group-btn">
                                         <button id="searchBtn" class="btn btn-secondary btn-sm" type="button"><i class="fa fa-search" aria-hidden="true"></i></button>
                                     </span>
                                     </div>
-                                    <div class="col-2">
-                                        <button id="insertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
+                                    <div class="col-3">
+                                        <div class="row">
+                                            <div class="col-5 pl-0">
+                                                <button id="insertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
+                                            </div>
+                                            <div class="col-5">
+                                                <button id="insertAll" class="btn btn-primary btn-sm" type="button">插入全部</button>
+                                            </div>
+                                        </div>
                                     </div>
                                 </div>
                                 <!--搜索结果窗体-->

+ 19 - 1
web/maintain/billsGuidance_lib/js/billsGuidance.js

@@ -443,6 +443,7 @@ const billsGuidance = (function () {
         //全部设为无效
         $('.tools-btn').children().addClass('disabled');
         $('#insertRation').addClass('disabled');
+        $('#insertAll').addClass('disabled');
         $('.main-bottom-content').find('textarea').attr('readonly', true);
         //插入
         if(bills.tree.selected && bills.tree.selected.guidance.tree){
@@ -484,6 +485,7 @@ const billsGuidance = (function () {
         //插入定额
         if(node && (node.children.length === 0 || allRationChildren(node))){
             $('#insertRation').removeClass('disabled');
+            $('#insertAll').removeClass('disabled');
         }
         //备注,奇数节点可用
         if(node && (node.depth() + 1) % 2 === 1 && node.data.type !== itemType.ration){
@@ -1135,10 +1137,15 @@ const billsGuidance = (function () {
     }
     //获取选中的定额表行
     //@return {Array}
-    function getCheckedRationRows(){
+    function getCheckedRationRows(all){
         let rst = [];
         let sheet = ration.workBook.getActiveSheet();
         for(let i = 0; i < sheet.getRowCount(); i++){
+            // 全选
+            if (all) {
+                rst.push(i);
+                continue;
+            }
             let checked = sheet.getValue(i, 0);
             if(checked){
                 rst.push(i);
@@ -1367,6 +1374,7 @@ const billsGuidance = (function () {
                     return {
                         callback: function(){},
                         items: {
+
                             "copy": {
                                 name: "复制整块",
                                 disabled: function () {
@@ -1472,6 +1480,7 @@ const billsGuidance = (function () {
                 TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, itemSheet, true);
             });
         });
+        // 插入选中定额
         $('#insertRation').click(function () {
             let checkedRows = getCheckedRationRows();
             let insertDatas = getInsertRations(checkedRows);
@@ -1485,6 +1494,15 @@ const billsGuidance = (function () {
                 clearCheckedRation(checkedRows);
             }
         });
+        // 插入全部定额
+        $('#insertAll').click(function () {
+            let isAll = true;
+            let checkedRows = getCheckedRationRows(isAll);
+            let insertDatas = getInsertRations(checkedRows);
+            if(insertDatas.length > 0){
+                insert(insertDatas, false);
+            }
+        });
         //搜索定额
         $('#searchBtn').click(function () {
             let searchStr = $('#searchText').val();

+ 13 - 10
web/maintain/ration_repository/js/ration_assist.js

@@ -8,16 +8,19 @@ var rationAssistOprObj = {
     setting: {
         header:[
             {headerName:"调整名称",headerWidth:110,dataCode:"name", dataType: "String", hAlign: "left"},
+            {headerName:"参数",headerWidth:60,dataCode:"param", dataType: "String", hAlign: "right"},
             {headerName:"辅助定额号",headerWidth:90,dataCode:"assistCode", dataType: "String", hAlign: "center", formatter: "@"},
+            {headerName:"参数名称",headerWidth:90,dataCode:"paramName", dataType: "String", hAlign: "left"},
             {headerName:"标准值",headerWidth:60,dataCode:"stdValue", dataType: "String", hAlign: "right"},
             {headerName:"步距",headerWidth:60,dataCode:"stepValue", dataType: "String", hAlign: "right"},
             {headerName:"精度",headerWidth:60,dataCode:"decimal",  dataType: "String", hAlign: "right"},
             {headerName:"进位方式",headerWidth:80,dataCode:"carryBit", dataType: "String", hAlign: "center"},
             {headerName:"最小值",headerWidth:70,dataCode:"minValue", dataType: "String", hAlign: "right"},
-            {headerName:"最大值",headerWidth:70,dataCode:"maxValue", dataType: "String", hAlign: "right"}
+            {headerName:"最大值",headerWidth:70,dataCode:"maxValue", dataType: "String", hAlign: "right"},
+            {headerName:"第三定额",headerWidth:90,dataCode:"thirdRationCode", dataType: "String", hAlign: "center", formatter: "@"}
         ],
         view:{},
-        comboItems: ["四舍五入", "进一"]
+        comboItems: ["四舍五入", "进一","舍一"]
     },
 
     buildSheet: function(sheet) {
@@ -41,7 +44,7 @@ var rationAssistOprObj = {
         let cellType = args.sheet.getCellType(args.row, 5);
         if(cellType.typeName !== 'undefined' && cellType.typeName === '1'){
           //  sheetCommonObj.setStaticCombo(args.sheet, 0, 5, 0, me.setting.comboItems, false);
-            sheetCommonObj.setDynamicCombo(args.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+            sheetCommonObj.setDynamicCombo(args.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         }
     },
 
@@ -72,7 +75,7 @@ var rationAssistOprObj = {
         });
         sheetCommonObj.cleanData(me.sheet, me.setting, -1);
         //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, me.ration.rationAssList.length, me.setting.comboItems, false, false);
-        sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+        sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         sheetCommonObj.showData(me.sheet, me.setting, me.ration.rationAssList);
     },
 
@@ -95,13 +98,13 @@ var rationAssistOprObj = {
         var assList = me.ration.rationAssList;
         var assObj = sheetsOprObj.combineRationRowData(me.sheet, me.setting, args.row);
         let dataCode = me.setting.header[args.col].dataCode;
-        if((args.col === 2 || args.col === 3 || args.col === 6 || args.col === 7)
+        if((dataCode === 'stdValue' || dataCode === 'stepValue' || dataCode === 'minValue' || dataCode === 'maxValue')
             && args.editingText && args.editingText.toString().trim().length > 0 && isNaN(args.editingText)){
             args.sheet.setValue(args.row, args.col, args.row < assList.length ? assList[args.row][dataCode] : '');
             alert(me.setting.header[args.col].headerName + '只能为数值!');
             return;
         }
-        else if(args.col === 4 && args.editingText && (args.editingText.toString().trim().length === 0 ||
+        else if(dataCode === 'decimal' && args.editingText && (args.editingText.toString().trim().length === 0 ||
                 isNaN(args.editingText) || args.editingText % 1 !== 0)){
             args.sheet.setValue(args.row, args.col, args.row < assList.length ? assList[args.row][dataCode] : 0);
             alert(me.setting.header[args.col].headerName + '只能为整数!');
@@ -120,7 +123,7 @@ var rationAssistOprObj = {
         });
         sheetCommonObj.cleanData(me.sheet, me.setting, -1);
         //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, assList.length, me.setting.comboItems, false, false);
-        sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+        sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         sheetCommonObj.showData(me.sheet, me.setting, assList);
     },
 
@@ -163,7 +166,7 @@ var rationAssistOprObj = {
                     });
                     sheetCommonObj.cleanData(me.sheet, me.setting, -1);
                     //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, curCahe.length, me.setting.comboItems, false);
-                    sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false);
+                    sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false);
                     sheetCommonObj.showData(me.sheet, me.setting, curCahe);
                 }
             }
@@ -182,12 +185,12 @@ var rationAssistOprObj = {
         if (ration == undefined || ration.rationAssList == undefined ||
             ration.rationAssList.length == 0){
             //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, 0, me.setting.comboItems, false);
-            sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+            sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
             return;
         }
         else {
             //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, ration.rationAssList.length, me.setting.comboItems, false);
-            sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+            sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         }
         sheetCommonObj.showData(me.sheet, me.setting, ration.rationAssList);
     }

+ 1 - 0
web/maintain/ration_repository/main.html

@@ -307,6 +307,7 @@
     <script src="/lib/tether/tether.min.js"></script>
     <script src="/lib/bootstrap/bootstrap.min.js"></script>
     <script src="/public/web/PerfectLoad.js"></script>
+    <script src="/public/web/commonAlert.js"></script>
     <script src="/web/maintain/ration_repository/js/global.js"></script>
     <script src="/public/web/common_ajax.js"></script>
     <!-- zTree -->