Browse Source

台账修订,批量插入清单计量单元调整

MaiXinRong 5 years ago
parent
commit
f38b40214f
1 changed files with 24 additions and 1 deletions
  1. 24 1
      app/public/js/revise.js

+ 24 - 1
app/public/js/revise.js

@@ -1614,11 +1614,34 @@ $(document).ready(() => {
 
                     const colCount = posSheet.getColumnCount() + 1;
                     posSheet.setColumnCount(colCount);
-                    posSheet.getCell(0, colCount - 1, GC.Spread.Sheets.SheetArea.colHeader).text('数量' + count);
+                    posSheet.getCell(0, colCount - 1, GC.Spread.Sheets.SheetArea.colHeader).text('清单' + count);
                 }
                 qdSheet.setSelection(sel.row + 1, sel.col, 1, 1);
                 qdSheet.getParent().focus();
             });
+            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.qdSpread.bind(spreadNS.Events.EditEnded, function (e, info) {
+                if (info.col === 0) {
+                    const dealBills = self.dealSpread.getActiveSheet().zh_data;
+                    if (dealBills && dealBills.length > 0) {
+                        const bills = _.find(dealBills, {code: info.editingText});
+                        if (bills) {
+                            info.sheet.getCell(info.row, 1).value(bills.name);
+                            info.sheet.getCell(info.row, 2).value(bills.unit);
+                        }
+                    }
+                }
+            });
 
             this.obj.bind('shown.bs.modal', function () {
                 self.qdSpread.refresh();