MaiXinRong 1 час назад
Родитель
Сommit
876bd87b6d
2 измененных файлов с 54 добавлено и 7 удалено
  1. 27 5
      app/public/js/ledger.js
  2. 27 2
      app/public/js/revise.js

+ 27 - 5
app/public/js/ledger.js

@@ -3377,17 +3377,17 @@ $(document).ready(function() {
                 });
             }
         },
-        insertPos: function (sheet) {
+        insertPos: function (sheet, count = 1) {
             const selection = sheet.getSelections();
             const sortData = sheet.zh_data;
             const row = selection[0].row;
             const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
             const select = SpreadJsObj.getSelectObject(sheet);
             const porder = select ? select.porder : sortData.length + 1;
-            const data = {
-                updateType: 'insert',
-                updateData: [ { lid: node.id, tid: tender.id, porder } ],
-            };
+            const data = { updateType: 'insert', updateData: [], };
+            for (let i = 0; i < count; i++) {
+                data.updateData.push({ lid: node.id, tid: tender.id, porder: porder + i });
+            }
             postData('/tender/' + getTenderId() + '/pos/update', data, function (result) {
                 const updateRst = pos.updateDatas(result.pos);
                 posOperationObj.loadCurPosData();
@@ -3664,6 +3664,28 @@ $(document).ready(function() {
                     return !readOnly;
                 }
             },
+            'batchInsert': {
+                name: '批量插入',
+                type: 'batchInsert',
+                value: '2',
+                icon: 'fa-plus',
+                disabled: function (key, opt) {
+                    const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
+                    return node && node.children && node.children.length > 0;
+                },
+                batchInsert: function (obj, root) {
+                    if (_.toNumber(obj.value) > _.toNumber(obj.max)) {
+                        obj.value = obj.max;
+                        toastr.warning('批量插入不可多于' + obj.max);
+                    } else if(_.toNumber(obj.value) < _.toNumber(obj.min)) {
+                        obj.value = obj.min;
+                        toastr.warning('批量插入不可少于' + obj.min);
+                    } else {
+                        posOperationObj.insertPos(posSheet,  parseInt(obj.value));
+                        root.$menu.trigger('contextmenu:hide');
+                    }
+                },
+            },
             'delete': {
                 name: '删除',
                 icon: 'fa-remove',

+ 27 - 2
app/public/js/revise.js

@@ -1909,7 +1909,7 @@ $(document).ready(() => {
                 });
             }
         },
-        insertPos: function (sheet) {
+        insertPos: function (sheet, count = 1) {
             const selection = sheet.getSelections();
             const sortData = sheet.zh_data;
             const row = selection[0].row;
@@ -1923,8 +1923,11 @@ $(document).ready(() => {
             const data = {
                 postType: 'pos',
                 posPostType: 'insert',
-                postData: [ { lid: node.id, porder } ],
+                postData: [],
             };
+            for (let i = 0; i < count; i++) {
+                data.postData.push({ lid: node.id, porder: porder + i });
+            }
             postData(window.location.pathname + '/update', data, function (result) {
                 const updateRst = pos.updateDatas(result.pos);
                 posSpreadObj.loadCurPosData();
@@ -2168,6 +2171,28 @@ $(document).ready(() => {
                         posSpreadObj.insertPos(posSheet);
                     }
                 },
+                'batchInsert': {
+                    name: '批量插入',
+                    type: 'batchInsert',
+                    value: '2',
+                    icon: 'fa-plus',
+                    disabled: function (key, opt) {
+                        const node = SpreadJsObj.getSelectObject(billsSheet);
+                        return node && node.children && node.children.length > 0 && node.settle_status !== settleStatus.finish;
+                    },
+                    batchInsert: function (obj, root) {
+                        if (_.toNumber(obj.value) > _.toNumber(obj.max)) {
+                            obj.value = obj.max;
+                            toastr.warning('批量插入不可多于' + obj.max);
+                        } else if(_.toNumber(obj.value) < _.toNumber(obj.min)) {
+                            obj.value = obj.min;
+                            toastr.warning('批量插入不可少于' + obj.min);
+                        } else {
+                            posSpreadObj.insertPos(posSheet, parseInt(obj.value));
+                            root.$menu.trigger('contextmenu:hide');
+                        }
+                    },
+                },
                 'delete': {
                     name: '删除',
                     icon: 'fa-remove',