2022-12-23 16:07:57 +08:00
|
|
|
/**
|
|
|
|
* 柏美 施工合同申请js
|
|
|
|
* 明细表自动添加5行 不允许增删 并校验付款比例是否等于100% 自动计算付款日期
|
|
|
|
* @author xuanran.wang
|
|
|
|
*/
|
|
|
|
// 明细表
|
|
|
|
const detailTable = "detail_2";
|
|
|
|
// 主表合同签订日期
|
|
|
|
const contractSignDateId = WfForm.convertFieldNameToId("htqdrq");
|
|
|
|
// 明细2付款比例字段
|
|
|
|
const detail2PayProportionId = WfForm.convertFieldNameToId("fkbl",detailTable);
|
|
|
|
// 明细2款项类型
|
|
|
|
const detail2PaymentTypeId = WfForm.convertFieldNameToId("kxlx",detailTable);
|
|
|
|
// 明细2前后字段
|
|
|
|
const detail2AroundId = WfForm.convertFieldNameToId("qh",detailTable);
|
|
|
|
// 明细2天数字段
|
|
|
|
const detail2DayId = WfForm.convertFieldNameToId("ts",detailTable);
|
|
|
|
// 明细2预计付款日期
|
|
|
|
const detail2ComPayDateId = WfForm.convertFieldNameToId("yjfkrq",detailTable);
|
|
|
|
// 对应日期
|
|
|
|
const detail2TempDateField = WfForm.convertFieldNameToId("dyrq", detailTable);
|
|
|
|
// 需要计算的款项类型集合
|
|
|
|
const computeDatePayType = ['0'];
|
2023-01-03 09:40:04 +08:00
|
|
|
const DETAIL_MAX_SIZE = 5;
|
2023-04-09 21:15:39 +08:00
|
|
|
const readOnlyArr = ['0'];
|
2022-12-23 16:07:57 +08:00
|
|
|
// 款项类型预计对应日期取值
|
|
|
|
const paymentTypeGetValue = {
|
|
|
|
0: (index)=>{
|
|
|
|
WfForm.changeFieldValue(`${detail2TempDateField}_${index}`,{value : WfForm.getFieldValue(contractSignDateId)});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jQuery().ready(function(){
|
|
|
|
let configObj = {
|
|
|
|
'detailPaymentTypeId':detail2PaymentTypeId,
|
|
|
|
'detailTempDateId': detail2TempDateField,
|
|
|
|
'around': detail2AroundId,
|
|
|
|
'detailComPayDateId': detail2ComPayDateId,
|
|
|
|
'dayId': detail2DayId,
|
|
|
|
'computeDatePayType': computeDatePayType,
|
2023-04-09 21:15:39 +08:00
|
|
|
'paymentTypeGetValue': paymentTypeGetValue,
|
|
|
|
'readOnlyArr': readOnlyArr
|
2022-12-23 16:07:57 +08:00
|
|
|
}
|
2023-01-03 09:40:04 +08:00
|
|
|
let rowArr = WfForm.getDetailAllRowIndexStr(detailTable).split(",");
|
|
|
|
|
|
|
|
if(rowArr.length !== DETAIL_MAX_SIZE){
|
|
|
|
// 默认增加5条
|
|
|
|
for (let i = 0; i < 5; i++) {
|
|
|
|
WfForm.addDetailRow(detailTable,{ [detail2PaymentTypeId]: {value: i}});
|
|
|
|
}
|
2022-12-23 16:07:57 +08:00
|
|
|
}
|
|
|
|
|
2023-03-15 13:50:48 +08:00
|
|
|
addRowBack(2, configObj);
|
|
|
|
|
2023-04-09 21:15:39 +08:00
|
|
|
changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, readOnlyArr)
|
2023-01-03 09:40:04 +08:00
|
|
|
|
2022-12-23 16:07:57 +08:00
|
|
|
// 主表字段发生变化
|
|
|
|
mainFieldChangeDetailCom(contractSignDateId, detailTable, configObj);
|
|
|
|
|
|
|
|
// 明细的款项类型字段变化绑定
|
2023-01-03 09:40:04 +08:00
|
|
|
detailFieldChangeDetailCom(`${detail2PaymentTypeId},${detail2AroundId},${detail2DayId}`, configObj);
|
2022-12-23 16:07:57 +08:00
|
|
|
|
|
|
|
submitCallback(detailTable, detail2PayProportionId);
|
|
|
|
|
|
|
|
});
|
|
|
|
|