Browse Source

1. 批量插入,上限扩至100
2. 批量插入清单计量单元。复制粘贴后,调整行列表头

MaiXinRong 5 years ago
parent
commit
d52ec16c78
1 changed files with 13 additions and 1 deletions
  1. 13 1
      app/public/js/ledger.js

+ 13 - 1
app/public/js/ledger.js

@@ -967,7 +967,7 @@ $(document).ready(function() {
             }
         }
         this.addClass(item._icon);
-        const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="20" min="1" value="' + item.value + '" style="width: 30px; height: 18px; padding-right: 4px;">行</div>')
+        const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="100" min="1" value="' + item.value + '" style="width: 30px; height: 18px; padding-right: 4px;">行</div>')
             .appendTo(this);
         const $input = $obj.find('input');
         const event = () => {
@@ -2139,6 +2139,17 @@ $(document).ready(function() {
                 }
                 qdSheet.setSelection(sel.row + 1, sel.col, 1, 1);
             });
+            this.qdSpread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {
+                const billsCount = info.sheet.getRowCount(), posSheet = self.posSpread.getActiveSheet();
+                const count = posSheet.getColumnCount() - 2;
+                if (billsCount > count) {
+                    posSheet.setColumnCount(billsCount + 2);
+                    for (let i = count + 1; i <= billsCount; i++) {
+                        info.sheet.getCell(i - 1, 0, spreadNS.SheetArea.rowHeader).text('清单' + i);
+                        posSheet.getCell(0, i + 2 - 1, spreadNS.SheetArea.colHeader).text('清单' + i);
+                    }
+                }
+            });
 
             this.obj.bind('shown.bs.modal', function () {
                 self.qdSpread.refresh();
@@ -2175,6 +2186,7 @@ $(document).ready(function() {
         initView () {
             // 初始化 清单编号
             const qdSheet = this.qdSpread.getActiveSheet();
+            qdSheet.setColumnWidth(0, 45, spreadNS.SheetArea.rowHeader);
             SpreadJsObj.initSheet(qdSheet, this.qdSpreadSetting);
             SpreadJsObj.refreshColumnAlign(qdSheet);
             // 清理原有数据