|
@@ -2926,7 +2926,7 @@ $(document).ready(function() {
|
|
|
}
|
|
|
qdSheet.setSelection(sel.row, sel.col, 1, 1);
|
|
|
},
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
// 拉取签约清单数据
|
|
@@ -2938,7 +2938,7 @@ $(document).ready(function() {
|
|
|
});
|
|
|
}
|
|
|
// 双击签约清单,自动添加到清单编号窗口
|
|
|
- this.dealSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (e, info) {
|
|
|
+ this.dealSpread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
const deal = info.sheet.zh_data[info.row];
|
|
|
const qdSheet = self.qdSpread.getActiveSheet(), posSheet = self.posSpread.getActiveSheet();
|
|
|
const sel = qdSheet.getSelections()[0];
|
|
@@ -2957,30 +2957,38 @@ $(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);
|
|
|
+ this.qdSpread.bind(spreadNS.Events.ClipboardPasting, function (e, info) {
|
|
|
+ info.cancel = true;
|
|
|
+ const transpose = $('[name=batch-transpose]')[0].checked;
|
|
|
+ const pasteData = SpreadJsObj.analysisPasteText(info.pasteData.text, transpose);
|
|
|
+
|
|
|
+ const billsSheet = info.sheet, posSheet = self.posSpread.getActiveSheet();
|
|
|
+ const billsCount = info.sheet.getRowCount(), finalCount = info.cellRange.row + pasteData.length + 1;
|
|
|
+ SpreadJsObj.beginMassOperation(billsSheet);
|
|
|
+ if (finalCount > billsCount) {
|
|
|
+ billsSheet.setRowCount(finalCount);
|
|
|
+ posSheet.setColumnCount(finalCount + 2);
|
|
|
+ for (let i = billsCount - 1; i <= finalCount; i++) {
|
|
|
+ billsSheet.getCell(i - 1, 0, spreadNS.SheetArea.rowHeader).text('清单' + i);
|
|
|
posSheet.getCell(0, i + 2 - 1, spreadNS.SheetArea.colHeader).text('清单' + i);
|
|
|
}
|
|
|
}
|
|
|
- if (info.cellRange.col === 0 && info.cellRange.colCount === 1) {
|
|
|
- const dealBills = self.dealSpread.getActiveSheet().zh_data;
|
|
|
- if (dealBills && dealBills.length > 0) {
|
|
|
- for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
|
|
|
- const curRow = iRow + info.cellRange.row;
|
|
|
- const bills = _.find(dealBills, {code: info.sheet.getText(curRow, 0)});
|
|
|
- if (bills) {
|
|
|
- info.sheet.getCell(curRow, 1).value(bills.name);
|
|
|
- info.sheet.getCell(curRow, 2).value(bills.unit);
|
|
|
- info.sheet.getCell(curRow, 3).value(bills.unit_price);
|
|
|
- }
|
|
|
+ for (let iRow = 0; iRow < pasteData.length; iRow++) {
|
|
|
+ const curRow = iRow + info.cellRange.row;
|
|
|
+ pasteData[iRow].forEach((value, iCol) => {
|
|
|
+ billsSheet.getCell(curRow, iCol + info.cellRange.col).value(value);
|
|
|
+ });
|
|
|
+ if ([0, 1].indexOf(info.cellRange.col) >= 0) {
|
|
|
+ const dealBills = self.dealSpread.getActiveSheet().zh_data;
|
|
|
+ const bills = _.find(dealBills, {code: billsSheet.getText(curRow, 0)});
|
|
|
+ if (bills) {
|
|
|
+ billsSheet.getCell(curRow, 1).value(bills.name);
|
|
|
+ billsSheet.getCell(curRow, 2).value(bills.unit);
|
|
|
+ billsSheet.getCell(curRow, 3).value(bills.unit_price);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ SpreadJsObj.endMassOperation(billsSheet);
|
|
|
});
|
|
|
this.posSpread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {
|
|
|
const billsCount = info.sheet.getColumnCount() - 2, qdSheet = self.qdSpread.getActiveSheet();
|