|
@@ -352,8 +352,13 @@ $(document).ready(() => {
|
|
|
if (data) {
|
|
|
const cInfo = _.find(changeList, { gcl_id: data.id, mx_id: '' });
|
|
|
if (!cInfo) {
|
|
|
- $('#bills-expr').val('').attr('readOnly', true);
|
|
|
- $('#bills-expr').removeAttr('data-row');
|
|
|
+ if (billsCol.readOnly.isChangeList(data)) {
|
|
|
+ $('#bills-expr').val('').attr('readOnly', true);
|
|
|
+ $('#bills-expr').removeAttr('data-row');
|
|
|
+ } else {
|
|
|
+ $('#bills-expr').val('').attr('field', col.field).attr('org', '')
|
|
|
+ .attr('readOnly', false).attr('data-row', sel.row);
|
|
|
+ }
|
|
|
} else {
|
|
|
const value = cInfo.camount_expr ? cInfo.camount_expr : ZhCalc.round(cInfo.camount, findDecimal(cInfo.unit));
|
|
|
$('#bills-expr').val(value).attr('field', col.field).attr('org', ZhCalc.round(cInfo.camount, findDecimal(cInfo.unit)))
|
|
@@ -841,6 +846,11 @@ $(document).ready(() => {
|
|
|
}
|
|
|
let cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
|
|
|
if (!cInfo) {
|
|
|
+ if (billsCol.readOnly.isSettle(node)) {
|
|
|
+ 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 });
|
|
@@ -1881,10 +1891,49 @@ $(document).ready(() => {
|
|
|
if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
|
|
|
|
|
|
if (field === 'camount') {
|
|
|
- const cInfo = _.find(changeList, { gcl_id: select.id, mx_id: '' });
|
|
|
+ let cInfo = _.find(changeList, { gcl_id: select.id, mx_id: '' });
|
|
|
if (!cInfo) {
|
|
|
- toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
- return;
|
|
|
+ if (billsCol.readOnly.isChangeList(select)) {
|
|
|
+ toastr.error('清单数据未完善,无法编辑申请数量');
|
|
|
+ SpreadJsObj.reLoadRowData(billsSheet, row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ makeGclGatherData();
|
|
|
+ const gclInfo = _.find(gclGatherData, function (item) {
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: select.id });
|
|
|
+ });
|
|
|
+ const xmjInfo = gclInfo.leafXmjs.find(function (item) {
|
|
|
+ return item.gcl_id === select.id;
|
|
|
+ });
|
|
|
+ const oldCInfo = _.find(oldChangeList, { gcl_id: select.id, mx_id: '' });
|
|
|
+ const data = {
|
|
|
+ lid: gclInfo.leafXmjs[0].gcl_id || select.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: select.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('未勾选变更清单,无法编辑申请数量');
|
|
|
+ // return;
|
|
|
}
|
|
|
const exprQuantity = {
|
|
|
expr: '',
|
|
@@ -1900,33 +1949,54 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
const camount = parseFloat(exprQuantity.quantity);
|
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
- const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
- if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
- toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
- return;
|
|
|
- } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
- toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
- return;
|
|
|
+ if (cInfo.id) {
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
+ const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
+ if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
+ toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
+ return;
|
|
|
+ } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
+ toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
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) {
|
|
|
- SpreadJsObj.reLoadRowData(billsSheet, row);
|
|
|
- billsTreeSpreadObj.reCalcCamount(select);
|
|
|
- const loadResult = { update: [select] };
|
|
|
- const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
- billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
- billsTreeSpreadObj.loadExprToInput(billsSheet);
|
|
|
- }, function () {
|
|
|
- cInfo.camount = orgValue;
|
|
|
- cInfo.spamount = orgValue;
|
|
|
- select.camount = orgValue;
|
|
|
- SpreadJsObj.reLoadRowData(billsSheet, 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(billsSheet, row);
|
|
|
+ billsTreeSpreadObj.reCalcCamount(select);
|
|
|
+ const loadResult = { update: [select] };
|
|
|
+ const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ billsTreeSpreadObj.loadExprToInput(billsSheet);
|
|
|
+ }, function () {
|
|
|
+ cInfo.camount = orgValue;
|
|
|
+ cInfo.spamount = orgValue;
|
|
|
+ select.camount = orgValue;
|
|
|
+ SpreadJsObj.reLoadRowData(billsSheet, 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;
|
|
|
+ select.is_change = 1;
|
|
|
+ select.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
|
|
|
+ select.camount = cInfo.camount !== undefined ? cInfo.camount : null;
|
|
|
+ billsTreeSpreadObj.reCalcCamount(select);
|
|
|
+ const refreshNode = billsTree.loadPostData({ update: [select] });
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ SpreadJsObj.reLoadRowData(billsSheet, row);
|
|
|
+ }, function () {
|
|
|
+ cInfo[col.field] = orgValue;
|
|
|
+ cInfo.spamount = orgValue;
|
|
|
+ node[col.field] = orgValue;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ });
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -2309,8 +2379,13 @@ $(document).ready(() => {
|
|
|
if (data) {
|
|
|
const cInfo = _.find(changeList, { gcl_id: data.lid, mx_id: data.id });
|
|
|
if (!cInfo) {
|
|
|
- $('#pos-expr').val('').attr('readOnly', true);
|
|
|
- $('#pos-expr').removeAttr('data-row');
|
|
|
+ if (posCol.readOnly.isChangeList(data)) {
|
|
|
+ $('#pos-expr').val('').attr('readOnly', true);
|
|
|
+ $('#pos-expr').removeAttr('data-row');
|
|
|
+ } else {
|
|
|
+ $('#pos-expr').val('').attr('field', col.field).attr('org', '')
|
|
|
+ .attr('readOnly', false).attr('data-row', sel.row);
|
|
|
+ }
|
|
|
} else {
|
|
|
const value = cInfo.camount_expr ? cInfo.camount_expr : cInfo.camount;
|
|
|
$('#pos-expr').val(value).attr('field', col.field).attr('org', cInfo.camount)
|
|
@@ -3295,10 +3370,47 @@ $(document).ready(() => {
|
|
|
if (orgValue === newValue || (!orgValue && newValue == '')) return;
|
|
|
|
|
|
if (field === 'camount') {
|
|
|
- const cInfo = _.find(changeList, { gcl_id: select.lid, mx_id: select.id });
|
|
|
+ let cInfo = _.find(changeList, { gcl_id: select.lid, mx_id: select.id });
|
|
|
if (!cInfo) {
|
|
|
- toastr.error('未勾选变更清单,无法编辑申请数量');
|
|
|
- return;
|
|
|
+ if (posCol.readOnly.isSettle(select)) {
|
|
|
+ toastr.error('清单数据未完善,无法编辑申请数量');
|
|
|
+ SpreadJsObj.reLoadRowData(posSheet, row);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ makeGclGatherData();
|
|
|
+ const gclInfo = _.find(gclGatherData, function (item) {
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: select.lid, mx_id: select.id });
|
|
|
+ });
|
|
|
+ const xmjInfo = _.find(gclInfo.leafXmjs, { mx_id: select.id });
|
|
|
+ const oldCInfo = _.find(oldChangeList, { gcl_id: select.lid, mx_id: select.id });
|
|
|
+ const data = {
|
|
|
+ lid: select.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: select.lid,
|
|
|
+ mx_id: select.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('未勾选变更清单,无法编辑申请数量');
|
|
|
+ // return;
|
|
|
}
|
|
|
const exprQuantity = {
|
|
|
expr: '',
|
|
@@ -3314,31 +3426,55 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
const camount = parseFloat(exprQuantity.quantity);
|
|
|
- // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
- const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
- if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
- toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
- return;
|
|
|
- } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
- toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
- return;
|
|
|
+ if (cInfo.id) {
|
|
|
+ // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
|
|
|
+ const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
|
|
|
+ if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
|
|
|
+ toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
|
|
|
+ return;
|
|
|
+ } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
|
|
|
+ toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
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);
|
|
|
- billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
- const loadResult = { update: [billsNode] };
|
|
|
- const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
- billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
- posSpreadObj.loadExprToInput(posSheet);
|
|
|
- }, function () {
|
|
|
- cInfo.camount = orgValue;
|
|
|
- cInfo.spamount = orgValue;
|
|
|
- SpreadJsObj.reLoadRowData(posSheet, 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(posSheet, row);
|
|
|
+ billsTreeSpreadObj.reCalcCamount(billsNode);
|
|
|
+ const loadResult = { update: [billsNode] };
|
|
|
+ const refreshNode = billsTree.loadPostData(loadResult);
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
|
|
|
+ posSpreadObj.loadExprToInput(posSheet);
|
|
|
+ }, function () {
|
|
|
+ cInfo.camount = orgValue;
|
|
|
+ cInfo.spamount = orgValue;
|
|
|
+ SpreadJsObj.reLoadRowData(posSheet, 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;
|
|
|
+ select.is_change = 1;
|
|
|
+ select.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
|
|
|
+ select.camount = cInfo.camount !== undefined ? cInfo.camount : null;
|
|
|
+ select.ca_tp = cInfo.camount !== undefined ? ZhCalc.mul(cInfo.camount, cInfo.unit_price, decimal.tp) : null;
|
|
|
+ SpreadJsObj.reLoadRowData(posSheet, 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: select.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;
|
|
|
}
|
|
|
|