|
@@ -1,6 +1,6 @@
|
|
|
const copyBlockTag = 'zh.calc.copyBlock';
|
|
|
-const ckBillsSpread = '/contract/' + window.location.pathname.split('/')[2] + '/detail/contract-billsSelect';
|
|
|
$(document).ready(function() {
|
|
|
+ const ckBillsSpread = '/contract/' + window.location.pathname.split('/')[2] + '/' + contractConst.typeMap[contract_type] + '/detail/contract-billsSelect';
|
|
|
autoFlashHeight();
|
|
|
const contractSpreadSetting = {
|
|
|
cols: [
|
|
@@ -352,8 +352,9 @@ $(document).ready(function() {
|
|
|
}
|
|
|
return {...pay, showEdit}
|
|
|
})
|
|
|
+ console.log(pays);
|
|
|
newPays.forEach((pay, idx) => {
|
|
|
- paysHtml += `<tr class="text-center">
|
|
|
+ paysHtml += `<tr class="text-center" data-cpid="${pay.id}">
|
|
|
<td>${idx + 1}</td>
|
|
|
<td>${moment(pay.pay_time).format('YYYY-MM-DD')}</td>
|
|
|
<td>${pay.pay_price}</td>
|
|
@@ -364,7 +365,7 @@ $(document).ready(function() {
|
|
|
<td>${pay.username}</td>
|
|
|
<td>${moment(pay.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>
|
|
|
<td>${pay.remark}</td>
|
|
|
- <td><a href="javascript:void(0);" class="text-primary open-pay-files" data-cpid="${pay.id}"><i class="fa fa-paperclip fa-rotate-90"></i></a></td>
|
|
|
+ <td><a href="javascript:void(0);" class="text-primary open-pay-files" data-cpid="${pay.id}"><i class="fa fa-paperclip fa-rotate-90"></i></a> <span class="files-num">${pay.files.length > 0 ? pay.files.length : ''}</span></td>
|
|
|
<td><a href="javascript:void(0);" class="text-primary pay-edit" data-id="${pay.id}" ${ !pay.showEdit ? `style="display:none"` : ''}>编辑</a> <a href="javascript:void(0);" class="text-danger pay-del" data-id="${pay.id}" ${ !pay.showEdit ? `style="display:none"` : ''}>删除</a></td>
|
|
|
</tr>`;
|
|
|
});
|
|
@@ -427,6 +428,7 @@ $(document).ready(function() {
|
|
|
if (!info.oldSelections || info.newSelections[0].row !== info.oldSelections[0].row || info.newSelections[0].rowCount !== info.oldSelections[0].rowCount) {
|
|
|
contractTreeSpreadObj.refreshOperationValid(info.sheet);
|
|
|
contractTreeSpreadObj.setContract(info.sheet);
|
|
|
+ SpreadJsObj.saveTopAndSelect(info.sheet, ckBillsSpread);
|
|
|
}
|
|
|
} else {
|
|
|
$('#add-cons-btn').hide();
|
|
@@ -1344,6 +1346,7 @@ $(document).ready(function() {
|
|
|
postDataWithFile('/contract/' + stid + '/detail/' + contractConst.typeMap[contract_type] + '/' + node.id + '/pay/' + cpInfo.id + '/file/upload', formData, function (result) {
|
|
|
cpInfo.files = result;
|
|
|
contractTreeSpreadObj.openContractPayFiles(cpInfo);
|
|
|
+ $('#htpay-table tbody').find('tr[data-cpid="' + cpInfo.id + '"]').find('.files-num').text(result.length || '');
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -1363,6 +1366,7 @@ $(document).ready(function() {
|
|
|
postData('/contract/' + stid + '/detail/' + contractConst.typeMap[contract_type] + '/' + node.id + '/pay/' + cpInfo.id + '/file/delete', { id: fid }, function (result) {
|
|
|
cpInfo.files = result;
|
|
|
contractTreeSpreadObj.openContractPayFiles(cpInfo);
|
|
|
+ $('#htpay-table tbody').find('tr[data-cpid="' + cpInfo.id + '"]').find('.files-num').text(result.length || '');
|
|
|
});
|
|
|
}, '确认删除该文件?');
|
|
|
});
|
|
@@ -1380,6 +1384,7 @@ $(document).ready(function() {
|
|
|
// SpreadJsObj.initSpreadSettingEvents(changeSpreadSetting, changeCol);
|
|
|
SpreadJsObj.loadSheetData(contractSheet, SpreadJsObj.DataType.Tree, contractTree);
|
|
|
SpreadJsObj.loadTopAndSelect(contractSheet, ckBillsSpread);
|
|
|
+ contractTreeSpreadObj.setContract(contractSheet);
|
|
|
checkShowLast(result.contractTree.length);
|
|
|
contractTreeSpreadObj.refreshOperationValid(contractSheet);
|
|
|
// contractTreeSpreadObj.setAllForeColor(contractSheet);
|
|
@@ -1790,21 +1795,6 @@ $(document).ready(function() {
|
|
|
toastr.error(name + '款金额只能输入数字');
|
|
|
return false;
|
|
|
}
|
|
|
- // if (cpInfo) {
|
|
|
- // const newNodePayPrice = ZhCalc.add(ZhCalc.sub(node.pay_price, cpInfo.pay_price), parseFloat(data.pay_price));
|
|
|
- // const newNodeDebitPrice = ZhCalc.add(ZhCalc.sub(node.debit_price, cpInfo.debit_price), parseFloat(data.debit_price));
|
|
|
- // const newNodeYfPrice = ZhCalc.sub(newNodePayPrice, newNodeDebitPrice);
|
|
|
- // const newNodeSfPrice = ZhCalc.add(ZhCalc.sub(node.sf_price, cpInfo.sf_price), parseFloat(data.sf_price));
|
|
|
- // // if (parseFloat(data.pay_price) > ZhCalc.sub(newNodeYfPrice, newNodeSfPrice)) {
|
|
|
- // // toastr.error(name + '款金额不能大于待支付金额 ' + ZhCalc.sub(newNodeYfPrice, newNodeSfPrice) + '元');
|
|
|
- // // return false;
|
|
|
- // // }
|
|
|
- // } else {
|
|
|
- // if (parseFloat(data.pay_price) > ZhCalc.sub(node.yf_price, node.sf_price)) {
|
|
|
- // toastr.error(name + '款金额不能大于待支付金额 ' + ZhCalc.sub(node.yf_price, node.sf_price) + '元');
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // }
|
|
|
if (data.debit_price && !/^\d+(\.\d+)?$/.test(data.debit_price)) {
|
|
|
toastr.error('扣款金额只能输入数字');
|
|
|
return false;
|
|
@@ -1817,10 +1807,33 @@ $(document).ready(function() {
|
|
|
toastr.error('实'+ name +'金额只能输入数字');
|
|
|
return false;
|
|
|
}
|
|
|
- if (parseFloat(data.sf_price) > parseFloat(data.yf_price)) {
|
|
|
- toastr.error('实'+ name +'金额不能大于应'+ name +'金额');
|
|
|
- return false;
|
|
|
+ if (cpInfo) {
|
|
|
+ const newNodePayPrice = ZhCalc.add(ZhCalc.sub(node.pay_price, cpInfo.pay_price), parseFloat(data.pay_price));
|
|
|
+ const newNodeDebitPrice = ZhCalc.add(ZhCalc.sub(node.debit_price, cpInfo.debit_price), parseFloat(data.debit_price));
|
|
|
+ const newNodeYfPrice = ZhCalc.sub(newNodePayPrice, newNodeDebitPrice);
|
|
|
+ const newNodeSfPrice = ZhCalc.add(ZhCalc.sub(node.sf_price, cpInfo.sf_price), parseFloat(data.sf_price));
|
|
|
+ if (newNodeYfPrice > node.total_price) {
|
|
|
+ toastr.error('累计应'+ name +'金额不能大于合同金额');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (newNodeSfPrice > newNodeYfPrice) {
|
|
|
+ toastr.error('累计实'+ name +'金额不能大于累计应'+ name +'金额');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (ZhCalc.add(parseFloat(data.yf_price), node.yf_price) > node.total_price) {
|
|
|
+ toastr.error('累计应'+ name +'金额不能大于合同金额');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (ZhCalc.add(parseFloat(data.sf_price), node.sf_price) > ZhCalc.add(parseFloat(data.yf_price), node.yf_price)) {
|
|
|
+ toastr.error('累计实'+ name +'金额不能大于累计应'+ name +'金额');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
+ // if (parseFloat(data.sf_price) > parseFloat(data.yf_price)) {
|
|
|
+ // toastr.error('实'+ name +'金额不能大于应'+ name +'金额');
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
if (!data.pay_type) {
|
|
|
toastr.error('请选择' + contractConst.typeName[contract_type] + '方式');
|
|
|
return false;
|