|
@@ -101,7 +101,7 @@ $(document).ready(() => {
|
|
|
{title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit2', getValue: 'getValue.unit_price'},
|
|
|
{title: '变更部位', colSpan: '1', rowSpan: '2', field: 'bwmx', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit2'},
|
|
|
{title: '变更详情', colSpan: '1', rowSpan: '2', field: 'detail', hAlign: 0, width: 120, formatter: '@', readOnly: false},
|
|
|
- {title: '计量上限(%)', colSpan: '1', rowSpan: '2', field: 'delimit', hAlign: 2, width: 60, formatter: '@', readOnly: false, visible: openChangeState},
|
|
|
+ {title: '计量上限(%)', colSpan: '1', rowSpan: '2', field: 'delimit', hAlign: 2, width: 60, type: 'Number', readOnly: false, visible: openChangeState},
|
|
|
{title: '原设计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'oamount', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.oamount'},
|
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.oa_tp'},
|
|
|
{title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', readOnly: false, getValue: 'getValue.camount'},
|
|
@@ -528,6 +528,25 @@ $(document).ready(() => {
|
|
|
} else {
|
|
|
validText = ZhCalc.round(validText, findDecimal(select.unit)) || 0;
|
|
|
}
|
|
|
+ if (col.field === 'delimit') {
|
|
|
+ const reg = /^(\d{1,2}|100)$/;
|
|
|
+ if (!(_.isNumber(validText) && reg.test(validText))) {
|
|
|
+ toastr.error('计量上限默认值只能输入0-100之间的整数');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 需要判断是否已调用,已调用的则不能低于原有值大小
|
|
|
+ const usedInfo = _.find(changeUsedData, { cbid: select.id });
|
|
|
+ if (usedInfo && usedInfo.qty) {
|
|
|
+ const minLimit = Math.ceil(ZhCalc.div(usedInfo.qty, select.camount) * 100);
|
|
|
+ console.log(usedInfo.qty, minLimit);
|
|
|
+ if (validText < minLimit) {
|
|
|
+ toastr.error('计量上限值至少大于等于 ' + minLimit);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (col.field === 'unit') {
|
|
|
select.camount = ZhCalc.round(select.camount, findDecimal(validText)) || 0;
|
|
@@ -558,7 +577,7 @@ $(document).ready(() => {
|
|
|
};
|
|
|
const range = info.cellRange;
|
|
|
const sortData = info.sheet.zh_data || [];
|
|
|
- if (info.cellRange.row + info.cellRange.rowCount > sortData.length) {
|
|
|
+ if (range.row + range.rowCount > sortData.length) {
|
|
|
toastMessageUniq(hint.cellError);
|
|
|
// SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
|
|
|
SpreadJsObj.reLoadSheetHeader(changeSpreadSheet);
|
|
@@ -566,7 +585,7 @@ $(document).ready(() => {
|
|
|
changeSpreadObj.makeSjsFooter();
|
|
|
return;
|
|
|
}
|
|
|
- if (sortData.length > 0 && range.col + range.colCount > 10) {
|
|
|
+ if (sortData.length > 0 && range.col + range.colCount > 14) {
|
|
|
toastMessageUniq(hint.cellError);
|
|
|
SpreadJsObj.reLoadSheetHeader(changeSpreadSheet);
|
|
|
SpreadJsObj.reLoadSheetData(changeSpreadSheet);
|
|
@@ -582,7 +601,7 @@ $(document).ready(() => {
|
|
|
const curRow = range.row + iRow;
|
|
|
// const materialData = JSON.parse(JSON.stringify(sortData[curRow]));
|
|
|
const cLData = { id: sortData[curRow].id };
|
|
|
- const hintRow = range.rowCount > 1 ? curRow : '';
|
|
|
+ const hintRow = range.rowCount >= 1 ? curRow : '';
|
|
|
let sameCol = 0;
|
|
|
for (let iCol = 0; iCol < range.colCount; iCol++) {
|
|
|
const curCol = range.col + iCol;
|
|
@@ -632,11 +651,11 @@ $(document).ready(() => {
|
|
|
// 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
const usedInfo = _.find(changeUsedData, { cbid: sortData[curRow].id });
|
|
|
if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
- toastr.error(hintRow ? '清单' + (hintRow+1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
+ toastr.error(hintRow ? '清单第' + (hintRow+1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
bPaste = false;
|
|
|
continue;
|
|
|
} else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
- toastr.error(hintRow ? '清单' + (hintRow+1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
+ toastr.error(hintRow ? '清单第' + (hintRow+1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
bPaste = false;
|
|
|
continue;
|
|
|
}
|
|
@@ -654,6 +673,24 @@ $(document).ready(() => {
|
|
|
} else {
|
|
|
validText = ZhCalc.round(validText, findDecimal(sortData[curRow].unit)) || 0;
|
|
|
}
|
|
|
+ if (colSetting.field === 'delimit') {
|
|
|
+ const reg = /^(\d{1,2}|100)$/;
|
|
|
+ if (!(_.isNumber(validText) && reg.test(validText))) {
|
|
|
+ toastr.error('清单第' + (hintRow+1) + '行计量上限默认值只能粘贴0-100之间的整数');
|
|
|
+ bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 需要判断是否已调用,已调用的则不能低于原有值大小
|
|
|
+ const usedInfo = _.find(changeUsedData, { cbid: sortData[curRow].id });
|
|
|
+ if (usedInfo && usedInfo.qty) {
|
|
|
+ const minLimit = Math.ceil(ZhCalc.div(usedInfo.qty, sortData[curRow].camount) * 100);
|
|
|
+ if (validText < minLimit) {
|
|
|
+ toastr.error('清单第' + (hintRow+1) + '行计量上限值至少大于等于 ' + minLimit);
|
|
|
+ bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
let unitdecimal = validText;
|
|
|
if (colSetting.field === 'unit') {
|