|
@@ -1066,7 +1066,7 @@ $(document).ready(() => {
|
|
|
data.postData = {id: posData.id, name: newText};
|
|
|
}
|
|
|
} else if (!posData) {
|
|
|
- toastr.warning('新增部位请先输入名称');
|
|
|
+ toastr.warning('新增计量单元请先输入名称');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
} else {
|
|
@@ -1224,7 +1224,7 @@ $(document).ready(() => {
|
|
|
const sortData = info.sheet.zh_data || [];
|
|
|
if (sortData.length === 0 || info.cellRange.row + info.cellRange.rowCount > sortData.length) {
|
|
|
if (info.cellRange.col !== 0) {
|
|
|
- toastr.warning('新增部位请先输入名称');
|
|
|
+ toastr.warning('新增计量单元请先输入名称');
|
|
|
posSpreadObj.loadCurPosData();
|
|
|
return;
|
|
|
}
|
|
@@ -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();
|
|
@@ -1645,6 +1668,47 @@ $(document).ready(() => {
|
|
|
}, null, true);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '.batch-l-t',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, self.qdSpread);
|
|
|
+ return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ 'create': {
|
|
|
+ name: '新增行',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ const qdSheet = self.qdSpread.getActiveSheet();
|
|
|
+ const posSheet = self.posSpread.getActiveSheet();
|
|
|
+ qdSheet.addRows(qdSheet.getRowCount(), 1);
|
|
|
+ const index = qdSheet.getRowCount();
|
|
|
+ qdSheet.getCell(qdSheet.getRowCount() - 1, 0, spreadNS.SheetArea.rowHeader).text('清单' + index);
|
|
|
+ posSheet.addColumns(posSheet.getColumnCount(), 1);
|
|
|
+ posSheet.getCell(0, index + 2 - 1, spreadNS.SheetArea.colHeader).text('清单' + index);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ 'delete': {
|
|
|
+ name: '删除行',
|
|
|
+ icon: 'fa-remove',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ const qdSheet = self.qdSpread.getActiveSheet();
|
|
|
+ const posSheet = self.posSpread.getActiveSheet();
|
|
|
+ const sel = qdSheet.getSelections()[0];
|
|
|
+ qdSheet.deleteRows(sel.row, sel.rowCount);
|
|
|
+ posSheet.deleteColumns(sel.row + 2, sel.rowCount);
|
|
|
+ for (let iRow = 0, iLen = qdSheet.getRowCount(); iRow < iLen; iRow++) {
|
|
|
+ qdSheet.getCell(iRow, 0, spreadNS.SheetArea.rowHeader).text('清单' + (iRow+1));
|
|
|
+ }
|
|
|
+ for (let iCol = 0, iLen = posSheet.getColumnCount() - 2; iCol < iLen; iCol++) {
|
|
|
+ posSheet.getCell(0, iCol + 2, spreadNS.SheetArea.colHeader).text('清单' + (iCol+1));
|
|
|
+ }
|
|
|
+ qdSheet.setSelection(sel.row, sel.col, 1, 1);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
// 初始化左侧表格
|
|
|
initView () {
|