|
@@ -25,6 +25,8 @@ $(document).ready(() => {
|
|
|
readOnly: readOnly,
|
|
|
};
|
|
|
const detailSpread = SpreadJsObj.createNewSpread($('#detail-spread')[0]);
|
|
|
+ detailSpread.options.allowUserDragFill = true;
|
|
|
+ detailSpread.options.defaultDragFillType = spreadNS.Fill.AutoFillType.fillSeries;
|
|
|
|
|
|
$.subMenu({
|
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
@@ -220,11 +222,50 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ dragFillBlock: function (e, info) {
|
|
|
+ console.log(info);
|
|
|
+ if (info.fromCol !== info.toCol) {
|
|
|
+ info.cancel = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dragFillBlockCompleted: function (e, info) {
|
|
|
+ if (info.sheet.zh_setting && info.sheet.zh_data) {
|
|
|
+ const datas = [];
|
|
|
+ for (let iRow = 0; iRow < info.fillRange.rowCount; iRow++) {
|
|
|
+ const curRow = info.fillRange.row + iRow;
|
|
|
+ const data = info.sheet.zh_data[curRow];
|
|
|
+ if (data) {
|
|
|
+ const updateData = {lid: data.lid};
|
|
|
+ if (data.uuid) {
|
|
|
+ updateData.uuid = data.uuid;
|
|
|
+ } else {
|
|
|
+ updateData.code = data.code;
|
|
|
+ updateData.name = data.name;
|
|
|
+ updateData.unit = data.unit;
|
|
|
+ updateData.unit_price = data.unit_price;
|
|
|
+ }
|
|
|
+ updateData.doc_code = info.sheet.getText(curRow, info.fillRange.col).replace('\n', '');
|
|
|
+ datas.push(updateData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (datas.length > 0) {
|
|
|
+ postData(window.location.pathname + '/save', datas, function (result) {
|
|
|
+ stageIm.loadUpdateDetailData(result);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.fillRange.row, info.fillRange.rowCount);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.fillRange.row, info.fillRange.rowCount);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(info);
|
|
|
+ },
|
|
|
};
|
|
|
detailSpread.bind(spreadNS.Events.SelectionChanged, detailOperationObj.selectionChanged);
|
|
|
if (!readOnly) {
|
|
|
detailSpread.bind(spreadNS.Events.EditEnded, detailOperationObj.editEnded);
|
|
|
detailSpread.bind(spreadNS.Events.ClipboardPasted, detailOperationObj.clipboardPasted);
|
|
|
+ detailSpread.bind(spreadNS.Events.DragFillBlock, detailOperationObj.dragFillBlock);
|
|
|
+ detailSpread.bind(spreadNS.Events.DragFillBlockCompleted, detailOperationObj.dragFillBlockCompleted);
|
|
|
SpreadJsObj.addDeleteBind(detailSpread, detailOperationObj.deletePress);
|
|
|
}
|
|
|
|