|
@@ -516,16 +516,14 @@ $(document).ready(() => {
|
|
|
};
|
|
|
|
|
|
changeSpreadObj.updateOamount = function () {
|
|
|
- const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
|
- console.log(changeSpreadSheet);
|
|
|
- const index = changeList.indexOf(select);
|
|
|
- if (index > -1) {
|
|
|
- const dataSource = listRule.source === 1 ? gclGatherData : dealBillList;
|
|
|
+ const dataSource = listRule.source === 1 ? gclGatherData : dealBillList;
|
|
|
+ const updateList = [];
|
|
|
+ for (const c of changeList) {
|
|
|
const source = _.find(dataSource, function (item) {
|
|
|
- if (((item.b_code && item.b_code === select.code) || (item.code && item.code === select.code)) && item.name === select.name) {
|
|
|
+ if (((item.b_code && item.b_code === c.code) || (item.code && item.code === c.code)) && item.name === c.name) {
|
|
|
if (listRule.rule.length > 0) {
|
|
|
for(const r of listRule.rule) {
|
|
|
- if (item[r] !== select[r]) {
|
|
|
+ if (item[r] !== c[r]) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -534,20 +532,18 @@ $(document).ready(() => {
|
|
|
}
|
|
|
return false;
|
|
|
});
|
|
|
- if (source && source.quantity !== select.oamount) {
|
|
|
- select.oamount = source.quantity;
|
|
|
- delete select.waitingLoading;
|
|
|
- console.log(select);
|
|
|
- // 更新至服务器
|
|
|
- postData(preUrl + '/list/save', { type:'update', updateData: select }, function (result) {
|
|
|
- changeList.splice(index, 1, select);
|
|
|
- SpreadJsObj.reLoadRowData(changeSpreadSheet, index);
|
|
|
- changeSpreadObj.countSum();
|
|
|
- }, function () {
|
|
|
- SpreadJsObj.reLoadRowData(changeSpreadSheet, index);
|
|
|
- });
|
|
|
+ if (source && source.quantity !== c.oamount) {
|
|
|
+ updateList.push({ id: c.id, oamount: source.quantity });
|
|
|
}
|
|
|
}
|
|
|
+ console.log(updateList);
|
|
|
+ if(updateList.length > 0) {
|
|
|
+ postData(preUrl + '/list/save', { type:'paste', updateData: updateList }, function (result) {
|
|
|
+ changeList = result;
|
|
|
+ SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
|
|
|
+ changeSpreadObj.makeSjsFooter();
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
// changeSpread.bind(spreadNS.Events.CellChanged, changeSpreadObj.cellChanged);
|
|
|
changeSpread.bind(spreadNS.Events.EditEnded, changeSpreadObj.editEnded);
|
|
@@ -597,14 +593,14 @@ $(document).ready(() => {
|
|
|
changeSpreadObj.updateOamount(changeSpreadSheet);
|
|
|
},
|
|
|
disabled: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
|
- const sel = changeSpreadSheet.getSelections()[0];
|
|
|
- // console.log(select, sel);
|
|
|
- if (!readOnly && select && sel.row !== changeSpreadSheet.getRowCount() - 1) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
+ // const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
|
+ // const sel = changeSpreadSheet.getSelections()[0];
|
|
|
+ // // console.log(select, sel);
|
|
|
+ // if (!readOnly && select && sel.row !== changeSpreadSheet.getRowCount() - 1) {
|
|
|
+ // return false;
|
|
|
+ // } else {
|
|
|
+ // return true;
|
|
|
+ // }
|
|
|
}
|
|
|
},
|
|
|
sprDel: '------------',
|