|
@@ -932,22 +932,49 @@ $(document).ready(() => {
|
|
|
node[col.field] = cInfo[col.field];
|
|
|
delete cInfo.waitingLoading;
|
|
|
if (cInfo.id) {
|
|
|
- postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
|
|
|
- type: 'update',
|
|
|
- updateData: cInfo
|
|
|
- }, function (result) {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- const billsNode = node;
|
|
|
- billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
- const loadResult = {update: [billsNode]};
|
|
|
- const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
- billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
- }, function () {
|
|
|
- cInfo[col.field] = orgValue;
|
|
|
- cInfo.spamount = orgValue;
|
|
|
- node[col.field] = orgValue;
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- });
|
|
|
+ if (cInfo.camount === 0 && cInfo.camount_expr === '') {
|
|
|
+ if (changeOrder && _.findIndex(oldChangeList, {id: cInfo.id}) !== -1) {
|
|
|
+ toastr.warning('插入台账清单功能下无法从这移除已勾选清单');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (_.find(changeUsedData, {cbid: cInfo.id})) {
|
|
|
+ toastr.warning('清单计量单元已被使用,无法取消勾选');
|
|
|
+ return
|
|
|
+ } else if (checkIsSettle(cInfo)) {
|
|
|
+ toastr.warning('清单计量单元已结算,无法取消勾选');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: [cInfo.id] }, function (result) {
|
|
|
+ changeList = result.changeList;
|
|
|
+ node.is_change = 0;
|
|
|
+ node.is_valuation = 0;
|
|
|
+ node.camount = null;
|
|
|
+ const billsNode = node;
|
|
|
+ billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
+ const loadResult = { update: [billsNode] };
|
|
|
+ const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ billsTreeSpreadObj.loadExprToInput(billsSheet);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
|
|
|
+ type: 'update',
|
|
|
+ updateData: cInfo
|
|
|
+ }, function (result) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ const billsNode = node;
|
|
|
+ billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
+ const loadResult = {update: [billsNode]};
|
|
|
+ const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ }, function () {
|
|
|
+ cInfo[col.field] = orgValue;
|
|
|
+ cInfo.spamount = orgValue;
|
|
|
+ node[col.field] = orgValue;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
// 更新至服务器
|
|
|
postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'add-change-list', postData: [cInfo]}, function (result) {
|
|
@@ -1524,9 +1551,24 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
if (camountDatas.length > 0) {
|
|
|
- postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountDatas }, function (result) {
|
|
|
- changeList = result;
|
|
|
+ for (const cInfo of camountDatas) {
|
|
|
+ if (changeOrder && _.findIndex(oldChangeList, {id: cInfo.id}) !== -1) {
|
|
|
+ toastr.warning('插入台账清单功能下无法从这移除已勾选清单');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (_.find(changeUsedData, {cbid: cInfo.id})) {
|
|
|
+ toastr.warning('清单计量单元已被使用,无法取消勾选');
|
|
|
+ return
|
|
|
+ } else if (checkIsSettle(cInfo)) {
|
|
|
+ toastr.warning('清单计量单元已结算,无法取消勾选');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: _.map(camountDatas, 'id') }, function (result) {
|
|
|
+ changeList = result.changeList;
|
|
|
for (const d of datas) {
|
|
|
+ d.is_change = 0;
|
|
|
billsTreeSpreadObj.reCalcCamount(d);
|
|
|
}
|
|
|
const loadResult = { update: datas };
|
|
@@ -1534,6 +1576,16 @@ $(document).ready(() => {
|
|
|
billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
billsTreeSpreadObj.loadExprToInput(billsSheet);
|
|
|
});
|
|
|
+ // postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountDatas }, function (result) {
|
|
|
+ // changeList = result;
|
|
|
+ // for (const d of datas) {
|
|
|
+ // billsTreeSpreadObj.reCalcCamount(d);
|
|
|
+ // }
|
|
|
+ // const loadResult = { update: datas };
|
|
|
+ // const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ // billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ // billsTreeSpreadObj.loadExprToInput(billsSheet);
|
|
|
+ // });
|
|
|
return;
|
|
|
}
|
|
|
if (datas.length > 0) {
|
|
@@ -2795,18 +2847,48 @@ $(document).ready(() => {
|
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
|
delete cInfo.waitingLoading;
|
|
|
if (cInfo.id) {
|
|
|
- postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type: 'update', updateData: cInfo }, function (result) {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- const billsNode = node;
|
|
|
- billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
- const loadResult = {update: [billsNode]};
|
|
|
- const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
- billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
- }, function () {
|
|
|
- cInfo[col.field] = orgValue;
|
|
|
- cInfo.spamount = orgValue;
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- });
|
|
|
+ if (cInfo.camount === 0 && cInfo.camount_expr === '') {
|
|
|
+ if (changeOrder && _.findIndex(oldChangeList, {id: cInfo.id}) !== -1) {
|
|
|
+ toastr.warning('插入台账清单功能下无法从这移除已勾选清单');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (_.find(changeUsedData, {cbid: cInfo.id})) {
|
|
|
+ toastr.warning('清单计量单元已被使用,无法取消勾选');
|
|
|
+ return
|
|
|
+ } else if (checkIsSettle(cInfo)) {
|
|
|
+ toastr.warning('清单计量单元已结算,无法取消勾选');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: [cInfo.id] }, function (result) {
|
|
|
+ changeList = result.changeList;
|
|
|
+ node.is_change = 0;
|
|
|
+ node.is_valuation = 0;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
+ billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
+ // 判断是否只剩一个,并同步去勾
|
|
|
+ if (_.findIndex(changeList, { gcl_id: node.lid }) === -1) {
|
|
|
+ billsNode.is_change = 0;
|
|
|
+ }
|
|
|
+ const loadResult = { update: [billsNode] };
|
|
|
+ const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type: 'update', updateData: cInfo }, function (result) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ const billsNode = node;
|
|
|
+ billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
+ const loadResult = {update: [billsNode]};
|
|
|
+ const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ }, function () {
|
|
|
+ cInfo[col.field] = orgValue;
|
|
|
+ cInfo.spamount = orgValue;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'add-change-list', postData: [cInfo]}, function (result) {
|
|
|
changeList = result.changeList;
|
|
@@ -3013,10 +3095,35 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
if (camountDatas.length > 0) {
|
|
|
- postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountDatas }, function (result) {
|
|
|
- changeList = result;
|
|
|
+ for (const cInfo of camountDatas) {
|
|
|
+ if (changeOrder && _.findIndex(oldChangeList, {id: cInfo.id}) !== -1) {
|
|
|
+ toastr.warning('插入台账清单功能下无法从这移除已勾选清单');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (_.find(changeUsedData, {cbid: cInfo.id})) {
|
|
|
+ toastr.warning('该计量单元已被使用,无法取消变更');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ } else if (checkIsSettle(cInfo)) {
|
|
|
+ toastr.warning('该计量单元已结算,无法取消变更');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: _.map(camountDatas, 'id') }, function (result) {
|
|
|
+ changeList = result.changeList;
|
|
|
+ for (const d of datas) {
|
|
|
+ d.is_change = 0;
|
|
|
+ d.is_valuation = 0;
|
|
|
+ }
|
|
|
const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
+ // 判断是否只剩一个,并同步去勾
|
|
|
+ if (_.findIndex(changeList, { gcl_id: posSelects[0].lid }) === -1) {
|
|
|
+ billsNode.is_change = 0;
|
|
|
+ }
|
|
|
const loadResult = { update: [billsNode] };
|
|
|
const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
@@ -3024,6 +3131,17 @@ $(document).ready(() => {
|
|
|
}, function () {
|
|
|
posSpreadObj.loadCurPosData();
|
|
|
});
|
|
|
+ // postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountDatas }, function (result) {
|
|
|
+ // changeList = result;
|
|
|
+ // const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
+ // billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
+ // const loadResult = { update: [billsNode] };
|
|
|
+ // const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ // billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ // posSpreadObj.loadCurPosData();
|
|
|
+ // }, function () {
|
|
|
+ // posSpreadObj.loadCurPosData();
|
|
|
+ // });
|
|
|
return;
|
|
|
}
|
|
|
if (datas.length > 0) {
|