|
@@ -118,7 +118,7 @@ $(document).ready(() => {
|
|
},
|
|
},
|
|
isSettle: function (data) {
|
|
isSettle: function (data) {
|
|
if (!data) return true;
|
|
if (!data) return true;
|
|
- return !readOnly && !(data && data.name && _.findIndex(changeList, { gcl_id: data.id, mx_id: '' }) !== -1 && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
|
|
|
|
|
|
+ return !readOnly && !(!billsCol.readOnly.isChangeList(data) && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -158,7 +158,7 @@ $(document).ready(() => {
|
|
},
|
|
},
|
|
isSettle: function (data) {
|
|
isSettle: function (data) {
|
|
if (!data) return true;
|
|
if (!data) return true;
|
|
- return !readOnly && !(data && data.name && _.findIndex(changeList, { gcl_id: data.lid, mx_id: data.id }) !== -1 && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
|
|
|
|
|
|
+ return !readOnly && !(!posCol.readOnly.isChangeList(data) && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -839,11 +839,45 @@ $(document).ready(() => {
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
|
|
|
|
|
|
+ let cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
|
|
if (!cInfo) {
|
|
if (!cInfo) {
|
|
- toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
- return;
|
|
|
|
|
|
+ makeGclGatherData();
|
|
|
|
+ const gclInfo = _.find(gclGatherData, function (item) {
|
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: node.id });
|
|
|
|
+ });
|
|
|
|
+ const xmjInfo = gclInfo.leafXmjs.find(function (item) {
|
|
|
|
+ return item.gcl_id === node.id;
|
|
|
|
+ });
|
|
|
|
+ const oldCInfo = _.find(oldChangeList, { gcl_id: node.id, mx_id: '' });
|
|
|
|
+ const data = {
|
|
|
|
+ lid: gclInfo.leafXmjs[0].gcl_id || node.id,
|
|
|
|
+ code: gclInfo.b_code,
|
|
|
|
+ name: gclInfo.name || '',
|
|
|
|
+ unit: gclInfo.unit || '',
|
|
|
|
+ unit_price: gclInfo.unit_price,
|
|
|
|
+ oamount: xmjInfo.quantity,
|
|
|
|
+ oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
|
|
|
|
+ bwmx: xmjInfo.bwmx || xmjInfo.jldy,
|
|
|
|
+ xmj_code: xmjInfo.code || '',
|
|
|
|
+ xmj_jldy: xmjInfo.jldy || '',
|
|
|
|
+ xmj_dwgc: xmjInfo.dwgc || '',
|
|
|
|
+ xmj_fbgc: xmjInfo.fbgc || '',
|
|
|
|
+ xmj_fxgc: xmjInfo.fxgc || '',
|
|
|
|
+ gcl_id: node.id,
|
|
|
|
+ mx_id: '',
|
|
|
|
+ };
|
|
|
|
+ if (oldCInfo) {
|
|
|
|
+ data.detail = oldCInfo.detail;
|
|
|
|
+ data.camount = oldCInfo.camount;
|
|
|
|
+ data.camount_expr = oldCInfo.camount_expr;
|
|
|
|
+ data.spamount = oldCInfo.spamount;
|
|
|
|
+ data.is_valuation = oldCInfo.is_valuation;
|
|
|
|
+ data.delimit = oldCInfo.delimit;
|
|
|
|
+ }
|
|
|
|
+ cInfo = data;
|
|
|
|
+ // toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
|
+ // SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ // return;
|
|
}
|
|
}
|
|
let validText = info.editingText ? trimInvalidChar(info.editingText) : '';
|
|
let validText = info.editingText ? trimInvalidChar(info.editingText) : '';
|
|
const orgValue = validText && validText !== ''
|
|
const orgValue = validText && validText !== ''
|
|
@@ -869,35 +903,59 @@ $(document).ready(() => {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
- const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
|
- if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
- toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
- return;
|
|
|
|
- } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
- toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
- return;
|
|
|
|
|
|
+ if (cInfo.id) {
|
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
+ const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
|
|
|
|
+ if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
+ toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
+ toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
node[col.field] = cInfo[col.field];
|
|
node[col.field] = cInfo[col.field];
|
|
delete cInfo.waitingLoading;
|
|
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);
|
|
|
|
- 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.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);
|
|
|
|
+ });
|
|
|
|
+ } 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;
|
|
|
|
+ node.is_change = 1;
|
|
|
|
+ node.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
|
|
|
|
+ node.camount = cInfo.camount !== undefined ? cInfo.camount : null;
|
|
|
|
+ billsTreeSpreadObj.reCalcCamount(node);
|
|
|
|
+ const refreshNode = billsTree.loadPostData({ update: [node] });
|
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ }, function () {
|
|
|
|
+ cInfo[col.field] = orgValue;
|
|
|
|
+ cInfo.spamount = orgValue;
|
|
|
|
+ node[col.field] = orgValue;
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1031,9 +1089,10 @@ $(document).ready(() => {
|
|
// sameParent: {type: 'warning', msg: '仅可粘贴同层节点'},
|
|
// sameParent: {type: 'warning', msg: '仅可粘贴同层节点'},
|
|
settle: {type: 'warning', msg: '已结算节点,不可修改数量、单价、金额'},
|
|
settle: {type: 'warning', msg: '已结算节点,不可修改数量、单价、金额'},
|
|
};
|
|
};
|
|
- const datas = [], filterNodes = [], camountData = [];
|
|
|
|
|
|
+ const datas = [], filterNodes = [], camountData = [], insertCamountData = [];
|
|
|
|
|
|
let pid, level, filterRow = 0;
|
|
let pid, level, filterRow = 0;
|
|
|
|
+ makeGclGatherData();
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
|
|
const curRow = info.cellRange.row + iRow;
|
|
const curRow = info.cellRange.row + iRow;
|
|
const node = tree.nodes[curRow];
|
|
const node = tree.nodes[curRow];
|
|
@@ -1096,10 +1155,43 @@ $(document).ready(() => {
|
|
if (colSetting.field === 'camount') {
|
|
if (colSetting.field === 'camount') {
|
|
bPaste = true;
|
|
bPaste = true;
|
|
let validText = value;
|
|
let validText = value;
|
|
- const cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
|
|
|
|
|
|
+ let cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
|
|
if (!cInfo) {
|
|
if (!cInfo) {
|
|
- bPaste = false;
|
|
|
|
- continue;
|
|
|
|
|
|
+ const gclInfo = _.find(gclGatherData, function (item) {
|
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: node.id });
|
|
|
|
+ });
|
|
|
|
+ const xmjInfo = gclInfo.leafXmjs.find(function (item) {
|
|
|
|
+ return item.gcl_id === node.id;
|
|
|
|
+ });
|
|
|
|
+ const oldCInfo = _.find(oldChangeList, { gcl_id: node.id, mx_id: '' });
|
|
|
|
+ const data = {
|
|
|
|
+ lid: gclInfo.leafXmjs[0].gcl_id || node.id,
|
|
|
|
+ code: gclInfo.b_code,
|
|
|
|
+ name: gclInfo.name || '',
|
|
|
|
+ unit: gclInfo.unit || '',
|
|
|
|
+ unit_price: gclInfo.unit_price,
|
|
|
|
+ oamount: xmjInfo.quantity,
|
|
|
|
+ oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
|
|
|
|
+ bwmx: xmjInfo.bwmx || xmjInfo.jldy,
|
|
|
|
+ xmj_code: xmjInfo.code || '',
|
|
|
|
+ xmj_jldy: xmjInfo.jldy || '',
|
|
|
|
+ xmj_dwgc: xmjInfo.dwgc || '',
|
|
|
|
+ xmj_fbgc: xmjInfo.fbgc || '',
|
|
|
|
+ xmj_fxgc: xmjInfo.fxgc || '',
|
|
|
|
+ gcl_id: node.id,
|
|
|
|
+ mx_id: '',
|
|
|
|
+ };
|
|
|
|
+ if (oldCInfo) {
|
|
|
|
+ data.detail = oldCInfo.detail;
|
|
|
|
+ data.camount = oldCInfo.camount;
|
|
|
|
+ data.camount_expr = oldCInfo.camount_expr;
|
|
|
|
+ data.spamount = oldCInfo.spamount;
|
|
|
|
+ data.is_valuation = oldCInfo.is_valuation;
|
|
|
|
+ data.delimit = oldCInfo.delimit;
|
|
|
|
+ }
|
|
|
|
+ cInfo = data;
|
|
|
|
+ // bPaste = false;
|
|
|
|
+ // continue;
|
|
}
|
|
}
|
|
const exprQuantity = {
|
|
const exprQuantity = {
|
|
expr: '',
|
|
expr: '',
|
|
@@ -1117,21 +1209,30 @@ $(document).ready(() => {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
- const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
|
- if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
- toastr.error(curRow ? '台账第' + (curRow+1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- bPaste = false;
|
|
|
|
- continue;
|
|
|
|
- } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
- toastr.error(curRow ? '台账第' + (curRow+1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- bPaste = false;
|
|
|
|
- continue;
|
|
|
|
|
|
+ if (cInfo.id) {
|
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
+ const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
|
|
|
|
+ if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
+ toastr.error(curRow ? '台账第' + (curRow + 1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ bPaste = false;
|
|
|
|
+ continue;
|
|
|
|
+ } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
+ toastr.error(curRow ? '台账第' + (curRow + 1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ bPaste = false;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (bPaste) {
|
|
if (bPaste) {
|
|
node.camount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
node.camount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
filterNodes.push(node);
|
|
filterNodes.push(node);
|
|
- camountData.push({id: cInfo.id, camount: node.camount, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
|
|
|
|
|
|
+ if (cInfo.id) {
|
|
|
|
+ camountData.push({id: cInfo.id, camount: node.camount, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
|
|
|
|
+ } else {
|
|
|
|
+ cInfo.camount = node.camount;
|
|
|
|
+ cInfo.camount_expr = exprQuantity.expr;
|
|
|
|
+ cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
|
+ insertCamountData.push(cInfo);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
filterNodes.push(node);
|
|
filterNodes.push(node);
|
|
SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
@@ -1183,9 +1284,13 @@ $(document).ready(() => {
|
|
filterNodes.push(node);
|
|
filterNodes.push(node);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (camountData.length > 0) {
|
|
|
|
- postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountData }, function (result) {
|
|
|
|
|
|
+ if (camountData.length > 0 || insertCamountData.length > 0) {
|
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', insertData: insertCamountData, updateData: camountData }, function (result) {
|
|
changeList = result;
|
|
changeList = result;
|
|
|
|
+ // 给所有filterNodes 加上is_change=1
|
|
|
|
+ filterNodes.forEach(function (item) {
|
|
|
|
+ item.is_change = 1;
|
|
|
|
+ });
|
|
const loadResult = { update: filterNodes };
|
|
const loadResult = { update: filterNodes };
|
|
const refreshNode = billsTree.loadPostData(loadResult);
|
|
const refreshNode = billsTree.loadPostData(loadResult);
|
|
billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
@@ -1474,8 +1579,11 @@ $(document).ready(() => {
|
|
if (col.field === 'camount') {
|
|
if (col.field === 'camount') {
|
|
const cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
|
|
const cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
|
|
if (!cInfo) {
|
|
if (!cInfo) {
|
|
- toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
|
|
+ if (billsCol.readOnly.isSettle(node)) {
|
|
|
|
+ toastr.error('清单数据未完善,无法编辑申请数量');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (cInfo.camount_expr && cInfo.camount_expr !== '') {
|
|
if (cInfo.camount_expr && cInfo.camount_expr !== '') {
|
|
@@ -2353,9 +2461,12 @@ $(document).ready(() => {
|
|
if (col.field === 'camount') {
|
|
if (col.field === 'camount') {
|
|
const cInfo = _.find(changeList, { gcl_id: node.lid, mx_id: node.id });
|
|
const cInfo = _.find(changeList, { gcl_id: node.lid, mx_id: node.id });
|
|
if (!cInfo) {
|
|
if (!cInfo) {
|
|
- toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
- return;
|
|
|
|
|
|
+ if (posCol.readOnly.isSettle(node)) {
|
|
|
|
+ toastr.error('清单数据未完善,无法编辑申请数量');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return
|
|
}
|
|
}
|
|
if (cInfo.camount_expr && cInfo.camount_expr !== '') {
|
|
if (cInfo.camount_expr && cInfo.camount_expr !== '') {
|
|
info.sheet.getCell(info.row, info.col).text(cInfo.camount_expr);
|
|
info.sheet.getCell(info.row, info.col).text(cInfo.camount_expr);
|
|
@@ -2524,11 +2635,48 @@ $(document).ready(() => {
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
|
|
|
|
|
|
+ let cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
|
|
if (!cInfo) {
|
|
if (!cInfo) {
|
|
- toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
- return;
|
|
|
|
|
|
+ if (posCol.readOnly.isSettle(posData)) {
|
|
|
|
+ toastr.error('清单数据未完善,无法编辑申请数量');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ makeGclGatherData();
|
|
|
|
+ const gclInfo = _.find(gclGatherData, function (item) {
|
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: posData.lid, mx_id: posData.id });
|
|
|
|
+ });
|
|
|
|
+ const xmjInfo = _.find(gclInfo.leafXmjs, { mx_id: posData.id });
|
|
|
|
+ const oldCInfo = _.find(oldChangeList, { gcl_id: posData.lid, mx_id: posData.id });
|
|
|
|
+ const data = {
|
|
|
|
+ lid: posData.lid,
|
|
|
|
+ code: gclInfo.b_code,
|
|
|
|
+ name: gclInfo.name || '',
|
|
|
|
+ unit: gclInfo.unit || '',
|
|
|
|
+ unit_price: gclInfo.unit_price,
|
|
|
|
+ oamount: xmjInfo.quantity,
|
|
|
|
+ oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
|
|
|
|
+ bwmx: xmjInfo.bwmx || xmjInfo.jldy || '',
|
|
|
|
+ xmj_code: xmjInfo.code || '',
|
|
|
|
+ xmj_jldy: xmjInfo.jldy || '',
|
|
|
|
+ xmj_dwgc: xmjInfo.dwgc || '',
|
|
|
|
+ xmj_fbgc: xmjInfo.fbgc || '',
|
|
|
|
+ xmj_fxgc: xmjInfo.fxgc || '',
|
|
|
|
+ gcl_id: posData.lid,
|
|
|
|
+ mx_id: posData.id,
|
|
|
|
+ }
|
|
|
|
+ if (oldCInfo) {
|
|
|
|
+ data.detail = oldCInfo.detail;
|
|
|
|
+ data.camount = oldCInfo.camount;
|
|
|
|
+ data.camount_expr = oldCInfo.camount_expr;
|
|
|
|
+ data.spamount = oldCInfo.spamount;
|
|
|
|
+ data.is_valuation = oldCInfo.is_valuation;
|
|
|
|
+ data.delimit = oldCInfo.delimit;
|
|
|
|
+ }
|
|
|
|
+ cInfo = data;
|
|
|
|
+ // toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
|
+ // SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ // return;
|
|
}
|
|
}
|
|
let validText = info.editingText ? trimInvalidChar(info.editingText) : '';
|
|
let validText = info.editingText ? trimInvalidChar(info.editingText) : '';
|
|
const orgValue = validText && validText !== ''
|
|
const orgValue = validText && validText !== ''
|
|
@@ -2554,33 +2702,57 @@ $(document).ready(() => {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
- const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
|
- if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
- toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
- return;
|
|
|
|
- } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
- toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
- return;
|
|
|
|
|
|
+ if (cInfo.id) {
|
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
+ const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
|
|
|
|
+ if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
+ toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
+ toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
cInfo.camount_expr = exprQuantity.expr;
|
|
delete cInfo.waitingLoading;
|
|
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);
|
|
|
|
- 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.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);
|
|
|
|
+ });
|
|
|
|
+ } 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;
|
|
|
|
+ posData.is_change = 1;
|
|
|
|
+ posData.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
|
|
|
|
+ posData.camount = cInfo.camount !== undefined ? cInfo.camount : null;
|
|
|
|
+ posData.ca_tp = cInfo.camount !== undefined ? ZhCalc.mul(cInfo.camount, cInfo.unit_price, decimal.tp) : null;
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
|
+ // info.sheet.setValue(info.row, valutaionCol, data.is_valuation !== undefined ? data.is_valuation : 1);
|
|
|
|
+ if (_.findIndex(changeList, { gcl_id: posData.lid }) !== -1) {
|
|
|
|
+ billsNode.is_change = 1;
|
|
|
|
+ }
|
|
|
|
+ billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
|
+ const loadResult = { update: [billsNode] };
|
|
|
|
+ const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
|
+ }, function () {
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2881,7 +3053,7 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
|
|
|
|
const data = [];
|
|
const data = [];
|
|
- const camountData = [];
|
|
|
|
|
|
+ const camountData = [], insertCamountData = [];
|
|
const sortData = info.sheet.zh_data || [];
|
|
const sortData = info.sheet.zh_data || [];
|
|
const hint = {
|
|
const hint = {
|
|
expr: {type: 'warning', msg: '粘贴了表达式非法,已过滤'},
|
|
expr: {type: 'warning', msg: '粘贴了表达式非法,已过滤'},
|
|
@@ -2897,6 +3069,7 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
let bHint = false;
|
|
let bHint = false;
|
|
const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
|
|
const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
|
|
|
|
+ makeGclGatherData();
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
|
|
let bPaste = true;
|
|
let bPaste = true;
|
|
const curRow = info.cellRange.row + iRow;
|
|
const curRow = info.cellRange.row + iRow;
|
|
@@ -2915,10 +3088,41 @@ $(document).ready(() => {
|
|
if (colSetting.field === 'camount') {
|
|
if (colSetting.field === 'camount') {
|
|
bPaste = true;
|
|
bPaste = true;
|
|
let validText = posData[colSetting.field];
|
|
let validText = posData[colSetting.field];
|
|
- const cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
|
|
|
|
|
|
+ let cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
|
|
if (!cInfo) {
|
|
if (!cInfo) {
|
|
- bPaste = false;
|
|
|
|
- continue;
|
|
|
|
|
|
+ const gclInfo = _.find(gclGatherData, function (item) {
|
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: posData.lid, mx_id: posData.id });
|
|
|
|
+ });
|
|
|
|
+ const xmjInfo = _.find(gclInfo.leafXmjs, { mx_id: posData.id });
|
|
|
|
+ const oldCInfo = _.find(oldChangeList, { gcl_id: posData.lid, mx_id: posData.id });
|
|
|
|
+ const data = {
|
|
|
|
+ lid: posData.lid,
|
|
|
|
+ code: gclInfo.b_code,
|
|
|
|
+ name: gclInfo.name || '',
|
|
|
|
+ unit: gclInfo.unit || '',
|
|
|
|
+ unit_price: gclInfo.unit_price,
|
|
|
|
+ oamount: xmjInfo.quantity,
|
|
|
|
+ oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
|
|
|
|
+ bwmx: xmjInfo.bwmx || xmjInfo.jldy || '',
|
|
|
|
+ xmj_code: xmjInfo.code || '',
|
|
|
|
+ xmj_jldy: xmjInfo.jldy || '',
|
|
|
|
+ xmj_dwgc: xmjInfo.dwgc || '',
|
|
|
|
+ xmj_fbgc: xmjInfo.fbgc || '',
|
|
|
|
+ xmj_fxgc: xmjInfo.fxgc || '',
|
|
|
|
+ gcl_id: posData.lid,
|
|
|
|
+ mx_id: posData.id,
|
|
|
|
+ }
|
|
|
|
+ if (oldCInfo) {
|
|
|
|
+ data.detail = oldCInfo.detail;
|
|
|
|
+ data.camount = oldCInfo.camount;
|
|
|
|
+ data.camount_expr = oldCInfo.camount_expr;
|
|
|
|
+ data.spamount = oldCInfo.spamount;
|
|
|
|
+ data.is_valuation = oldCInfo.is_valuation;
|
|
|
|
+ data.delimit = oldCInfo.delimit;
|
|
|
|
+ }
|
|
|
|
+ cInfo = data;
|
|
|
|
+ // bPaste = false;
|
|
|
|
+ // continue;
|
|
}
|
|
}
|
|
const exprQuantity = {
|
|
const exprQuantity = {
|
|
expr: '',
|
|
expr: '',
|
|
@@ -2936,19 +3140,28 @@ $(document).ready(() => {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
validText = parseFloat(exprQuantity.quantity);
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
- const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
|
- if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
- toastr.error(curRow ? '计量单元第' + (curRow+1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- bPaste = false;
|
|
|
|
- continue;
|
|
|
|
- } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
- toastr.error(curRow ? '计量单元第' + (curRow+1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
- bPaste = false;
|
|
|
|
- continue;
|
|
|
|
|
|
+ if (cInfo.id) {
|
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
|
+ const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
|
|
|
|
+ if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
|
+ toastr.error(curRow ? '计量单元第' + (curRow + 1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ bPaste = false;
|
|
|
|
+ continue;
|
|
|
|
+ } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
|
+ toastr.error(curRow ? '计量单元第' + (curRow + 1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
|
+ bPaste = false;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (bPaste) {
|
|
if (bPaste) {
|
|
- 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 });
|
|
|
|
|
|
+ if (cInfo.id) {
|
|
|
|
+ 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 {
|
|
|
|
+ cInfo.camount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
|
+ cInfo.camount_expr = exprQuantity.expr;
|
|
|
|
+ cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
|
|
|
|
+ insertCamountData.push(cInfo);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
}
|
|
}
|
|
@@ -2992,8 +3205,8 @@ $(document).ready(() => {
|
|
data.push(posData);
|
|
data.push(posData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (camountData.length > 0) {
|
|
|
|
- postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountData }, function (result) {
|
|
|
|
|
|
+ if (camountData.length > 0 || insertCamountData.length > 0) {
|
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', insertData: insertCamountData, updateData: camountData }, function (result) {
|
|
changeList = result;
|
|
changeList = result;
|
|
const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
const billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
billsTreeSpreadObj.reCalcCamount(billsNode);
|