|
@@ -27,7 +27,7 @@ $(document).ready(() => {
|
|
|
{title: '变更部位', colSpan: '1', rowSpan: '2', field: 'bwmx', hAlign: 0, width: 120, formatter: '@', readOnly: true, getValue: 'getValue.bwmx'},
|
|
|
{title: '变更详情', colSpan: '1', rowSpan: '2', field: 'detail', hAlign: 0, width: 120, formatter: '@', readOnly: true},
|
|
|
{title: '计量上限(%)', colSpan: '1', rowSpan: '2', field: 'delimit', hAlign: 2, width: 60, formatter: '@', readOnly: true, visible: openChangeState},
|
|
|
- {title: '原设计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'oamount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.oamount', readOnly: true},
|
|
|
+ {title: '原设计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'oamount2', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.oamount2', readOnly: 'readOnly.isSettle'},
|
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.oa_tp', readOnly: true},
|
|
|
{title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.camount', readOnly: true},
|
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'ca_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.ca_tp', readOnly: true},
|
|
@@ -91,22 +91,22 @@ $(document).ready(() => {
|
|
|
return ZhCalc.round(data.unit_price, unitPriceUnit);
|
|
|
},
|
|
|
oa_tp: function (data) {
|
|
|
- return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.oamount, findDecimal(data.unit))), totalPriceUnit);
|
|
|
+ return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.oamount2, findDecimal(data.unit))), totalPriceUnit);
|
|
|
},
|
|
|
ca_tp: function (data) {
|
|
|
return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.camount, findDecimal(data.unit))), totalPriceUnit);
|
|
|
},
|
|
|
- oamount: function (data) {
|
|
|
- return ZhCalc.round(data.oamount, findDecimal(data.unit));
|
|
|
+ oamount2: function (data) {
|
|
|
+ return ZhCalc.round(data.oamount2, findDecimal(data.unit));
|
|
|
},
|
|
|
camount: function (data) {
|
|
|
return ZhCalc.round(data.camount, findDecimal(data.unit));
|
|
|
},
|
|
|
changed_amount: function (data) {
|
|
|
- return ZhCalc.round(ZhCalc.add(data.oamount, data.spamount), findDecimal(data.unit));
|
|
|
+ return ZhCalc.round(ZhCalc.add(data.oamount2, data.spamount), findDecimal(data.unit));
|
|
|
},
|
|
|
changed_tp: function (data) {
|
|
|
- return ZhCalc.add(ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.oamount, findDecimal(data.unit))), totalPriceUnit),
|
|
|
+ return ZhCalc.add(ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.oamount2, findDecimal(data.unit))), totalPriceUnit),
|
|
|
ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.spamount, findDecimal(data.unit))), totalPriceUnit));
|
|
|
},
|
|
|
bwmx: function (data) {
|
|
@@ -130,6 +130,7 @@ $(document).ready(() => {
|
|
|
changeSpreadObj.countSum();
|
|
|
},
|
|
|
setAuditValue: function () {
|
|
|
+
|
|
|
for (const c of changeList) {
|
|
|
for (const j of aidList) {
|
|
|
c['audit_amount_' + j] = ZhCalc.round(c['audit_amount_' + j], findDecimal(c.unit));
|
|
@@ -171,6 +172,8 @@ $(document).ready(() => {
|
|
|
changeSpreadObj.resetXmjSpread(data);
|
|
|
},
|
|
|
setRowValueAndSum: function (data, row, col) {
|
|
|
+ const oneSum = ZhCalc.round(ZhCalc.mul(data.unit_price, parseFloat(changeSpreadSheet.getValue(row, startLimit - 1))), totalPriceUnit);
|
|
|
+ changeSpreadSheet.setValue(row, startLimit, oneSum !== 0 ? oneSum : null);
|
|
|
for (const j in aidList) {
|
|
|
const sum = ZhCalc.round(ZhCalc.mul(data.unit_price, parseFloat(changeSpreadSheet.getValue(row, startLimit + 3 + parseInt(j)*2))), totalPriceUnit);
|
|
|
changeSpreadSheet.setValue(row, startLimit + 4 + j*2, sum !== 0 ? sum : null);
|
|
@@ -181,13 +184,16 @@ $(document).ready(() => {
|
|
|
// 用户的数据合计
|
|
|
// 变更后数据合计
|
|
|
let audit_sum = 0;
|
|
|
+ let oSum = 0;
|
|
|
let changed_sum = 0;
|
|
|
for(let i = 0; i < rowCount - 1; i++){
|
|
|
audit_sum = ZhCalc.add(audit_sum, changeSpreadSheet.getValue(i, col+1));
|
|
|
+ oSum = ZhCalc.add(oSum, changeSpreadSheet.getValue(i, startLimit));
|
|
|
changed_sum = ZhCalc.add(changed_sum, changeSpreadSheet.getValue(i, (startLimit + 4 + aidList.length*2)));
|
|
|
}
|
|
|
|
|
|
changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, col+1, audit_sum !== 0 ? audit_sum : null);
|
|
|
+ changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, startLimit, oSum !== 0 ? oSum : null);
|
|
|
changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, (startLimit + 4 + aidList.length*2), changed_sum !== 0 ? changed_sum : null);
|
|
|
},
|
|
|
countSum: function() {
|
|
@@ -236,27 +242,33 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
validText = ZhCalc.round(validText, findDecimal(select.unit)) || 0;
|
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
- const usedInfo = _.find(changeUsedData, { cbid: select.id });
|
|
|
- if (usedInfo && validText >= 0 && validText < usedInfo.qty) {
|
|
|
- toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- changeSpreadObj.setRowValueAndSum(select, info.row, info.col);
|
|
|
- return;
|
|
|
- } else if (usedInfo && validText < 0 && validText > usedInfo.qty) {
|
|
|
- toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- changeSpreadObj.setRowValueAndSum(select, info.row, info.col);
|
|
|
- return;
|
|
|
+ if (col.field !== 'oamount2') {
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
+ const usedInfo = _.find(changeUsedData, {cbid: select.id});
|
|
|
+ if (usedInfo && validText >= 0 && validText < usedInfo.qty) {
|
|
|
+ toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ changeSpreadObj.setRowValueAndSum(select, info.row, info.col);
|
|
|
+ return;
|
|
|
+ } else if (usedInfo && validText < 0 && validText > usedInfo.qty) {
|
|
|
+ toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ changeSpreadObj.setRowValueAndSum(select, info.row, info.col);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
select[col.field] = validText;
|
|
|
- select.spamount = ZhCalc.round(validText, findDecimal(select.unit)) || 0;
|
|
|
+ if (col.field !== 'oamount2') select.spamount = ZhCalc.round(validText, findDecimal(select.unit)) || 0;
|
|
|
|
|
|
const data = {
|
|
|
id: select.id,
|
|
|
- spamount: select.spamount,
|
|
|
};
|
|
|
+ if (col.field === 'oamount2') {
|
|
|
+ data[col.field] = select[col.field];
|
|
|
+ } else {
|
|
|
+ data.spamount = select.spamount;
|
|
|
+ }
|
|
|
console.log(data, select);
|
|
|
|
|
|
// 更新至服务器
|
|
@@ -266,7 +278,7 @@ $(document).ready(() => {
|
|
|
changeSpreadObj.setRowValueAndSum(select, info.row, info.col);
|
|
|
}, function () {
|
|
|
select[col.field] = orgValue;
|
|
|
- select.spamount = orgValue;
|
|
|
+ if (col.field !== 'oamount2') select.spamount = orgValue;
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
changeSpreadObj.setRowValueAndSum(select, info.row, info.col);
|
|
|
});
|
|
@@ -329,25 +341,31 @@ $(document).ready(() => {
|
|
|
continue;
|
|
|
}
|
|
|
validText = ZhCalc.round(validText, findDecimal(sortData[curRow].unit)) || 0;
|
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
- const usedInfo = _.find(changeUsedData, { id: sortData[curRow].id });
|
|
|
- if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
- toastr.error(hintRow ? '清单' + (hintRow+1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
|
- changeSpreadObj.setRowValueAndSum(sortData[curRow], curRow, curCol);
|
|
|
- bPaste = false;
|
|
|
- continue;
|
|
|
- } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
- toastr.error(hintRow ? '清单' + (hintRow+1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
|
- changeSpreadObj.setRowValueAndSum(sortData[curRow], curRow, curCol);
|
|
|
- bPaste = false;
|
|
|
- continue;
|
|
|
+ if (colSetting.field !== 'oamount2') {
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
+ const usedInfo = _.find(changeUsedData, {id: sortData[curRow].id});
|
|
|
+ if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
+ toastr.error(hintRow ? '清单' + (hintRow + 1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
|
+ changeSpreadObj.setRowValueAndSum(sortData[curRow], curRow, curCol);
|
|
|
+ bPaste = false;
|
|
|
+ continue;
|
|
|
+ } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
+ toastr.error(hintRow ? '清单' + (hintRow + 1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
|
+ changeSpreadObj.setRowValueAndSum(sortData[curRow], curRow, curCol);
|
|
|
+ bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// cLData[colSetting.field] = validText;
|
|
|
sortData[curRow][colSetting.field] = validText;
|
|
|
- cLData.spamount = validText;
|
|
|
+ if (colSetting.field === 'oamount2') {
|
|
|
+ cLData[colSetting.field] = validText;
|
|
|
+ } else {
|
|
|
+ cLData.spamount = validText;
|
|
|
+ }
|
|
|
}
|
|
|
if (bPaste) {
|
|
|
data.push(cLData);
|
|
@@ -644,16 +662,14 @@ function makePushBwmx(clinfo, listinfo, removeList, updateList) {
|
|
|
oneUpdate[key] = listinfo[key];
|
|
|
clinfo[key] = listinfo[key];
|
|
|
if (key === 'unit') {
|
|
|
- const oamount = ZhCalc.round(clinfo.oamount, findDecimal(listinfo[key]));
|
|
|
- if (oamount !== clinfo.oamount) {
|
|
|
- oneUpdate.oamount = oamount;
|
|
|
- clinfo.oamount = oamount;
|
|
|
- }
|
|
|
- const camount = ZhCalc.round(clinfo.camount, findDecimal(listinfo[key]));
|
|
|
- if (camount !== clinfo.camount) {
|
|
|
- oneUpdate.camount = camount;
|
|
|
- clinfo.camount = camount;
|
|
|
- }
|
|
|
+ const changeKey = ['oamount', 'oamount2', 'camount'];
|
|
|
+ changeKey.forEach(function (key) {
|
|
|
+ const value = ZhCalc.round(clinfo[key], findDecimal(listinfo[key]));
|
|
|
+ if (value !== clinfo[key]) {
|
|
|
+ oneUpdate[key] = value;
|
|
|
+ clinfo[key] = value;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
// else if (key === 'unit_price') {
|
|
|
// // 可能要更新总金额了
|