|
@@ -135,7 +135,7 @@ $(document).ready(() => {
|
|
|
if (!data) return '';
|
|
|
if (!data.name) return '';
|
|
|
const cInfo = _.find(changeList, { gcl_id: data.lid, mx_id: data.id });
|
|
|
- return cInfo ? cInfo.camount : '';
|
|
|
+ return cInfo ? ZhCalc.round(cInfo.camount, findDecimal(cInfo.unit)) : '';
|
|
|
}
|
|
|
},
|
|
|
readOnly: {
|
|
@@ -296,7 +296,7 @@ $(document).ready(() => {
|
|
|
treeSetting.calcFun = function (node) {
|
|
|
if (node && node.b_code) {
|
|
|
const posData = pos.getLedgerPos(node.id) || [];
|
|
|
- let camount = node.camount || 0;
|
|
|
+ let camount = ZhCalc.round(node.camount, findDecimal(node.unit)) || 0;
|
|
|
if (posData.length > 0) {
|
|
|
let sgfh_qty = 0;
|
|
|
let sjcl_qty = 0;
|
|
@@ -307,7 +307,7 @@ $(document).ready(() => {
|
|
|
sjcl_qty = ZhCalc.add(sjcl_qty, np.sjcl_qty);
|
|
|
qtcl_qty = ZhCalc.add(qtcl_qty, np.qtcl_qty);
|
|
|
const cInfo = _.find(changeList, { gcl_id: np.lid, mx_id: np.id });
|
|
|
- camount = cInfo ? ZhCalc.add(camount, cInfo.camount) : camount;
|
|
|
+ camount = cInfo ? ZhCalc.add(camount, ZhCalc.round(cInfo.camount, findDecimal(node.unit))) : camount;
|
|
|
}
|
|
|
if (!_.isEqual(node.sgfh_qty, sgfh_qty) || !_.isEqual(node.sjcl_qty, sjcl_qty) || !_.isEqual(node.qtcl_qty, qtcl_qty)) {
|
|
|
node.sgfh_qty = sgfh_qty;
|
|
@@ -869,10 +869,10 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
- cInfo[col.field] = validText;
|
|
|
- cInfo.spamount = ZhCalc.round(validText, findDecimal(cInfo.unit)) || 0;
|
|
|
+ cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
+ cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
|
- node[col.field] = validText;
|
|
|
+ node[col.field] = cInfo[col.field];
|
|
|
delete cInfo.waitingLoading;
|
|
|
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);
|
|
@@ -982,10 +982,30 @@ $(document).ready(() => {
|
|
|
changeList = result.changeList;
|
|
|
const refreshNode = billsTree.loadPostData(result);
|
|
|
for (const u of refreshNode.update) {
|
|
|
+ if (col.field === 'unit') {
|
|
|
+ const cInfo = _.find(changeList, { gcl_id: u.id, mx_id: '' });
|
|
|
+ if (cInfo && cInfo.camount_expr) {
|
|
|
+ const exprQuantity = {
|
|
|
+ expr: '',
|
|
|
+ quantity: 0,
|
|
|
+ };
|
|
|
+ const [valid, msg] = billsTreeSpreadObj._checkExpr(cInfo.camount_expr, exprQuantity);
|
|
|
+ if (!valid) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (isNaN(exprQuantity.quantity)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ u.camount = ZhCalc.round(parseFloat(exprQuantity.quantity), findDecimal(newValue)) || 0;
|
|
|
+ cInfo.unit = newValue;
|
|
|
+ } else {
|
|
|
+ u.camount = ZhCalc.round(u.camount, findDecimal(newValue)) || 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
billsTreeSpreadObj.reCalcCamount(u);
|
|
|
}
|
|
|
- console.log(refreshNode, result);
|
|
|
billsTreeSpreadObj.refreshTree(info.sheet, refreshNode);
|
|
|
+ billsTreeSpreadObj.refreshPosData();
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -1116,9 +1136,9 @@ $(document).ready(() => {
|
|
|
continue;
|
|
|
}
|
|
|
if (bPaste) {
|
|
|
- node.camount = validText;
|
|
|
+ node.camount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
filterNodes.push(node);
|
|
|
- camountData.push({id: cInfo.id, camount: validText, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(cInfo.unit)) || 0 });
|
|
|
+ camountData.push({id: cInfo.id, camount: node.camount, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
|
|
|
} else {
|
|
|
filterNodes.push(node);
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
@@ -1277,9 +1297,9 @@ $(document).ready(() => {
|
|
|
continue;
|
|
|
}
|
|
|
if (bPaste) {
|
|
|
- node.camount = validText;
|
|
|
+ node.camount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
filterNodes.push(node);
|
|
|
- camountData.push({id: cInfo.id, camount: validText, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(cInfo.unit)) || 0 });
|
|
|
+ camountData.push({id: cInfo.id, camount: node.camount, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
|
|
|
} else {
|
|
|
filterNodes.push(node);
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
@@ -1590,7 +1610,7 @@ $(document).ready(() => {
|
|
|
camount = 0;
|
|
|
for (const np of posData) {
|
|
|
const cInfo = _.find(changeList, { gcl_id: np.lid, mx_id: np.id });
|
|
|
- camount = cInfo ? ZhCalc.add(camount, cInfo.camount) : camount;
|
|
|
+ camount = cInfo ? ZhCalc.add(camount, ZhCalc.round(cInfo.camount, findDecimal(cInfo.unit))) : camount;
|
|
|
}
|
|
|
}
|
|
|
node.camount = camount;
|
|
@@ -1779,9 +1799,9 @@ $(document).ready(() => {
|
|
|
toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
return;
|
|
|
}
|
|
|
- cInfo.camount = camount;
|
|
|
- select.camount = camount;
|
|
|
- cInfo.spamount = ZhCalc.round(camount, findDecimal(cInfo.unit)) || 0;
|
|
|
+ cInfo.camount = ZhCalc.round(camount, findDecimal(select.unit)) || 0;
|
|
|
+ select.camount = ZhCalc.round(camount, findDecimal(select.unit)) || 0;
|
|
|
+ cInfo.spamount = ZhCalc.round(camount, findDecimal(select.unit)) || 0;
|
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
|
delete cInfo.waitingLoading;
|
|
|
postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
|
|
@@ -2227,7 +2247,7 @@ $(document).ready(() => {
|
|
|
if (posSheet.zh_setting) {
|
|
|
posSheet.zh_setting.cols.forEach(function (col, i) {
|
|
|
for (let iRow = 0; iRow < posSheet.getRowCount(); iRow++) {
|
|
|
- if (i !== 0 && col.field !== 'camount') {
|
|
|
+ if (i !== 0 && col.field !== 'camount' && col.field !== 'is_valuation') {
|
|
|
posSheet.getCell(iRow, i).locked((posSheet.zh_data[iRow] && !posSheet.zh_data[iRow].formc) || posSheet.zh_setting.readOnly || false);
|
|
|
} else {
|
|
|
let lock = false;
|
|
@@ -2461,7 +2481,7 @@ $(document).ready(() => {
|
|
|
info.sheet.setValue(info.row, info.col, cInfo.is_valuation);
|
|
|
return;
|
|
|
}
|
|
|
- const is_valuation = select.is_valuation !== undefined ? (info.sheet.getValue(info.row, info.col) ? 1 : 0) : (info.sheet.getValue(info.row, info.col) ? 0 : 1);
|
|
|
+ const is_valuation = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
// select.is_valuation = is_valuation;
|
|
|
cInfo.is_valuation = is_valuation;
|
|
|
delete cInfo.waitingLoading;
|
|
@@ -2540,8 +2560,8 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
- cInfo[col.field] = validText;
|
|
|
- cInfo.spamount = ZhCalc.round(validText, findDecimal(cInfo.unit)) || 0;
|
|
|
+ cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
+ cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
|
delete cInfo.waitingLoading;
|
|
|
postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
|
|
@@ -2923,7 +2943,7 @@ $(document).ready(() => {
|
|
|
continue;
|
|
|
}
|
|
|
if (bPaste) {
|
|
|
- camountData.push({id: cInfo.id, camount: validText, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(cInfo.unit)) || 0 });
|
|
|
+ camountData.push({id: cInfo.id, camount: ZhCalc.round(validText, findDecimal(node.unit)) || 0, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
|
|
|
} else {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
|
}
|
|
@@ -3051,6 +3071,7 @@ $(document).ready(() => {
|
|
|
const row = expr.attr('data-row') ? _.toInteger(expr.attr('data-row')) : -1;
|
|
|
const select = posSheet.zh_data ? posSheet.zh_data[row] : null;
|
|
|
if (!select) return;
|
|
|
+ const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
|
|
|
const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = trimInvalidChar(expr.val());
|
|
|
if (orgValue === newValue || (!orgValue && newValue == '')) return;
|
|
@@ -3084,13 +3105,12 @@ $(document).ready(() => {
|
|
|
toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
return;
|
|
|
}
|
|
|
- cInfo.camount = camount;
|
|
|
- cInfo.spamount = ZhCalc.round(camount, findDecimal(cInfo.unit)) || 0;
|
|
|
+ cInfo.camount = ZhCalc.round(camount, findDecimal(billsNode.unit)) || 0;
|
|
|
+ cInfo.spamount = ZhCalc.round(camount, findDecimal(billsNode.unit)) || 0;
|
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
|
delete cInfo.waitingLoading;
|
|
|
postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
|
|
|
SpreadJsObj.reLoadRowData(posSheet, row);
|
|
|
- const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
const loadResult = { update: [billsNode] };
|
|
|
const refreshNode = billsTree.loadPostData(loadResult);
|