ebu_ecology_dev1/javascript/xuanran.wang/bme/js/BuildContractApply.js

66 lines
2.3 KiB
JavaScript
Raw Permalink Normal View History

/**
* 柏美 施工合同申请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;
const readOnlyArr = ['0'];
// 款项类型预计对应日期取值
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,
'paymentTypeGetValue': paymentTypeGetValue,
'readOnlyArr': readOnlyArr
}
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}});
}
}
2023-03-15 13:50:48 +08:00
addRowBack(2, configObj);
changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, readOnlyArr)
2023-01-03 09:40:04 +08:00
// 主表字段发生变化
mainFieldChangeDetailCom(contractSignDateId, detailTable, configObj);
// 明细的款项类型字段变化绑定
2023-01-03 09:40:04 +08:00
detailFieldChangeDetailCom(`${detail2PaymentTypeId},${detail2AroundId},${detail2DayId}`, configObj);
submitCallback(detailTable, detail2PayProportionId);
});