|
@@ -63,6 +63,9 @@ $(document).ready(function() {
|
|
|
calc: function (data) {
|
|
calc: function (data) {
|
|
|
return !permission_edit || (data && data.children && data.children.length > 0);
|
|
return !permission_edit || (data && data.children && data.children.length > 0);
|
|
|
},
|
|
},
|
|
|
|
|
+ settlePrice: function (data) {
|
|
|
|
|
+ return !(data && data.c_code && !data.settle_code && (data.uid === user_id || permission_edit_contract));
|
|
|
|
|
+ },
|
|
|
type: function (data) {
|
|
type: function (data) {
|
|
|
return !(data && data.c_code && !data.settle_code && (data.uid === user_id || permission_edit_contract));
|
|
return !(data && data.c_code && !data.settle_code && (data.uid === user_id || permission_edit_contract));
|
|
|
}
|
|
}
|
|
@@ -86,8 +89,17 @@ $(document).ready(function() {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
const gdColField = ['type', 'party_a', 'party_b'];
|
|
const gdColField = ['type', 'party_a', 'party_b'];
|
|
|
|
|
+ const settlePriceEnabled = !!_.find(colSet, { field: 'settle_price', show: 1 });
|
|
|
|
|
+ const getContractPayLimit = function (node) {
|
|
|
|
|
+ const useSettlePrice = settlePriceEnabled && parseFloat(node.settle_price) !== 0;
|
|
|
|
|
+ return {
|
|
|
|
|
+ price: useSettlePrice ? node.settle_price : node.total_price,
|
|
|
|
|
+ name: useSettlePrice ? '结算金额' : '合同金额',
|
|
|
|
|
+ };
|
|
|
|
|
+ };
|
|
|
const colMap = {
|
|
const colMap = {
|
|
|
yf_price: {title: '累计应付', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
yf_price: {title: '累计应付', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
|
|
|
+ settle_price: {title: '结算金额', colSpan: '1', rowSpan: '2', field: 'settle_price', hAlign: 2, width: 120, type: 'Number', readOnly: 'readOnly.settlePrice'},
|
|
|
stackedBar: {title: '应付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true},
|
|
stackedBar: {title: '应付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true},
|
|
|
sf_price: {title: '累计实付', colSpan: '1', rowSpan: '2', field: 'sf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
sf_price: {title: '累计实付', colSpan: '1', rowSpan: '2', field: 'sf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
|
stackedBarSf: {title: '实付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBarSf', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTipSf, hintNum: true},
|
|
stackedBarSf: {title: '实付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBarSf', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTipSf, hintNum: true},
|
|
@@ -99,6 +111,13 @@ $(document).ready(function() {
|
|
|
// 根据 colSet 组装最终显示的列配置
|
|
// 根据 colSet 组装最终显示的列配置
|
|
|
colSet.forEach(col => {
|
|
colSet.forEach(col => {
|
|
|
const colInfo = colMap && colMap[col.field];
|
|
const colInfo = colMap && colMap[col.field];
|
|
|
|
|
+ if (col.field === 'settle_price') {
|
|
|
|
|
+ if (colInfo && col.show) {
|
|
|
|
|
+ const totalPriceIndex = contractSpreadSetting.cols.findIndex(c => c.field === 'total_price');
|
|
|
|
|
+ contractSpreadSetting.cols.splice(totalPriceIndex + 1, 0, Object.assign({}, colInfo, { title: col.name }));
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (colInfo && col.show) {
|
|
if (colInfo && col.show) {
|
|
|
contractSpreadSetting.cols.push(Object.assign({}, colInfo, { title: (col && col.alias) || col.name }));
|
|
contractSpreadSetting.cols.push(Object.assign({}, colInfo, { title: (col && col.alias) || col.name }));
|
|
|
}
|
|
}
|
|
@@ -125,7 +144,7 @@ $(document).ready(function() {
|
|
|
level: 'level',
|
|
level: 'level',
|
|
|
rootId: -1,
|
|
rootId: -1,
|
|
|
keys: ['id', 'tid', 'spid', 'contract_type'],
|
|
keys: ['id', 'tid', 'spid', 'contract_type'],
|
|
|
- calcFields: ['pay_price', 'total_price', 'sf_price', 'debit_price', 'yf_price', 'calc', 'calc2'],
|
|
|
|
|
|
|
+ calcFields: ['pay_price', 'total_price', 'settle_price', 'sf_price', 'debit_price', 'yf_price', 'calc', 'calc2'],
|
|
|
autoExpand: 3,
|
|
autoExpand: 3,
|
|
|
markExpandKey: 'contract-bills-expand' + window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
markExpandKey: 'contract-bills-expand' + window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
|
markExpandSubKey: window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
markExpandSubKey: window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
@@ -2274,8 +2293,11 @@ $(document).ready(function() {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
const newYfPrice = ZhCalc.add(node.yf_price || 0, addYfPrice);
|
|
const newYfPrice = ZhCalc.add(node.yf_price || 0, addYfPrice);
|
|
|
- if (newYfPrice > (node.total_price || 0)) {
|
|
|
|
|
- toastr.warning(`累计应付金额不能大于合同金额(累计应付:${newYfPrice},合同金额:${node.total_price || 0})`);
|
|
|
|
|
|
|
+ const contractPayLimit = getContractPayLimit(node);
|
|
|
|
|
+ const payLimit = contractPayLimit.price;
|
|
|
|
|
+ const payLimitName = contractPayLimit.name;
|
|
|
|
|
+ if (newYfPrice > (payLimit || 0)) {
|
|
|
|
|
+ toastr.warning(`累计应付金额不能大于${payLimitName}(累计应付:${newYfPrice},${payLimitName}:${payLimit || 0})`);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
postData(window.location.pathname + '/update', { postType: 'add-tender-pays', postData: { select: node.id, pays: pays } }, function (result) {
|
|
postData(window.location.pathname + '/update', { postType: 'add-tender-pays', postData: { select: node.id, pays: pays } }, function (result) {
|
|
@@ -3012,8 +3034,9 @@ $(document).ready(function() {
|
|
|
} else {
|
|
} else {
|
|
|
$('#cons-addpay .sf-tips').text('');
|
|
$('#cons-addpay .sf-tips').text('');
|
|
|
}
|
|
}
|
|
|
- if (parseFloat(yf_price) > ZhCalc.add(cpInfo.yf_price, ZhCalc.sub(node.total_price, node.yf_price))) {
|
|
|
|
|
- $('#cons-addpay .yf-tips').text(' ≤ ' + ZhCalc.add(cpInfo.yf_price, ZhCalc.sub(node.total_price, node.yf_price)));
|
|
|
|
|
|
|
+ const payLimit = getContractPayLimit(node).price;
|
|
|
|
|
+ if (parseFloat(yf_price) > ZhCalc.add(cpInfo.yf_price, ZhCalc.sub(payLimit, node.yf_price))) {
|
|
|
|
|
+ $('#cons-addpay .yf-tips').text(' ≤ ' + ZhCalc.add(cpInfo.yf_price, ZhCalc.sub(payLimit, node.yf_price)));
|
|
|
} else {
|
|
} else {
|
|
|
$('#cons-addpay .yf-tips').text('');
|
|
$('#cons-addpay .yf-tips').text('');
|
|
|
}
|
|
}
|
|
@@ -3031,8 +3054,9 @@ $(document).ready(function() {
|
|
|
} else {
|
|
} else {
|
|
|
$('#cons-addpay .sf-tips').text('');
|
|
$('#cons-addpay .sf-tips').text('');
|
|
|
}
|
|
}
|
|
|
- if (parseFloat(yf_price) > ZhCalc.sub(node.total_price, node.yf_price)) {
|
|
|
|
|
- $('#cons-addpay .yf-tips').text(' ≤ ' + ZhCalc.sub(node.total_price, node.yf_price));
|
|
|
|
|
|
|
+ const payLimit = getContractPayLimit(node).price;
|
|
|
|
|
+ if (parseFloat(yf_price) > ZhCalc.sub(payLimit, node.yf_price)) {
|
|
|
|
|
+ $('#cons-addpay .yf-tips').text(' ≤ ' + ZhCalc.sub(payLimit, node.yf_price));
|
|
|
} else {
|
|
} else {
|
|
|
$('#cons-addpay .yf-tips').text('');
|
|
$('#cons-addpay .yf-tips').text('');
|
|
|
}
|
|
}
|
|
@@ -3146,6 +3170,9 @@ $(document).ready(function() {
|
|
|
|
|
|
|
|
function judgePays(node, data, name, cpInfo = null) {
|
|
function judgePays(node, data, name, cpInfo = null) {
|
|
|
let flag = true;
|
|
let flag = true;
|
|
|
|
|
+ const contractPayLimit = getContractPayLimit(node);
|
|
|
|
|
+ const payLimit = contractPayLimit.price;
|
|
|
|
|
+ const payLimitName = contractPayLimit.name;
|
|
|
if (!data.pay_time) {
|
|
if (!data.pay_time) {
|
|
|
toastr.error('请输入'+ (name === '付' ? '支付' : '回款') +'日期');
|
|
toastr.error('请输入'+ (name === '付' ? '支付' : '回款') +'日期');
|
|
|
return false;
|
|
return false;
|
|
@@ -3176,8 +3203,8 @@ $(document).ready(function() {
|
|
|
const newNodeDebitPrice = ZhCalc.add(ZhCalc.sub(node.debit_price, cpInfo.debit_price), parseFloat(data.debit_price));
|
|
const newNodeDebitPrice = ZhCalc.add(ZhCalc.sub(node.debit_price, cpInfo.debit_price), parseFloat(data.debit_price));
|
|
|
const newNodeYfPrice = ZhCalc.sub(newNodePayPrice, newNodeDebitPrice);
|
|
const newNodeYfPrice = ZhCalc.sub(newNodePayPrice, newNodeDebitPrice);
|
|
|
const newNodeSfPrice = ZhCalc.add(ZhCalc.sub(node.sf_price, cpInfo.sf_price), parseFloat(data.sf_price));
|
|
const newNodeSfPrice = ZhCalc.add(ZhCalc.sub(node.sf_price, cpInfo.sf_price), parseFloat(data.sf_price));
|
|
|
- if (newNodeYfPrice > node.total_price) {
|
|
|
|
|
- toastr.error('累计应'+ name +'金额不能大于合同金额');
|
|
|
|
|
|
|
+ if (newNodeYfPrice > payLimit) {
|
|
|
|
|
+ toastr.error('累计应'+ name +'金额不能大于' + payLimitName);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
if (newNodeSfPrice > newNodeYfPrice) {
|
|
if (newNodeSfPrice > newNodeYfPrice) {
|
|
@@ -3185,8 +3212,8 @@ $(document).ready(function() {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- if (ZhCalc.add(parseFloat(data.yf_price), node.yf_price) > node.total_price) {
|
|
|
|
|
- toastr.error('累计应'+ name +'金额不能大于合同金额');
|
|
|
|
|
|
|
+ if (ZhCalc.add(parseFloat(data.yf_price), node.yf_price) > payLimit) {
|
|
|
|
|
+ toastr.error('累计应'+ name +'金额不能大于' + payLimitName);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
if (ZhCalc.add(parseFloat(data.sf_price), node.sf_price) > ZhCalc.add(parseFloat(data.yf_price), node.yf_price)) {
|
|
if (ZhCalc.add(parseFloat(data.sf_price), node.sf_price) > ZhCalc.add(parseFloat(data.yf_price), node.yf_price)) {
|