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

66 lines
2.4 KiB
JavaScript

/**
* 柏美 采购合同申请js
* @author xuanran.wang
*/
// 明细表
const detailTable = "detail_3";
// 主表订单编号字段
const mainProjectId = WfForm.convertFieldNameToId("ddh1");
// 主表合同签订日期
const contractSignDateId = WfForm.convertFieldNameToId("htqdrq");
// 主表订单申请日期
const mainPOApplyId = WfForm.convertFieldNameToId("rkdsqrq");
// 明细2付款比例字段
const detailPayProportionId = WfForm.convertFieldNameToId("fkbl",detailTable);
// 明细2款项类型
const detailPaymentTypeId = WfForm.convertFieldNameToId("kxlx",detailTable);
// 明细2前后字段
const detailAroundId = WfForm.convertFieldNameToId("qh",detailTable);
// 明细2天数字段
const detailDayId = WfForm.convertFieldNameToId("ts",detailTable);
// 明细2预计付款日期
const detailComPayDateId = WfForm.convertFieldNameToId("yjfkrq",detailTable);
// 对应日期
const detailTempDateField = WfForm.convertFieldNameToId("dyrq", detailTable);
// 需要计算的款项类型集合
const readOnlyArr = ['0'];
const computeDatePayType = ['0','2','4'];
// 款项类型预计对应日期取值
const paymentTypeGetValue = {
0: (index)=>{
WfForm.changeFieldValue(`${detailTempDateField}_${index}`,{value : WfForm.getFieldValue(contractSignDateId)});
},
2: (index)=>{
WfForm.changeFieldValue(`${detailTempDateField}_${index}`,{value : WfForm.getFieldValue(mainPOApplyId)});
},
4: (index)=>{
WfForm.changeFieldValue(`${detailTempDateField}_${index}`,{value : WfForm.getFieldValue(mainPOApplyId)});
}
}
$(()=>{
init();
});
function init(){
let obj = {
'detailPaymentTypeId':detailPaymentTypeId,
'detailTempDateId': detailTempDateField,
'around': detailAroundId,
'detailComPayDateId': detailComPayDateId,
'dayId': detailDayId,
'computeDatePayType': computeDatePayType,
'paymentTypeGetValue': paymentTypeGetValue,
'readOnlyArr': readOnlyArr
}
addRowBack(3, obj);
changeDetailFieldReadOnly(detailTable, detailComPayDateId, detailPaymentTypeId, readOnlyArr)
// 主表字段发生变化
mainFieldChangeDetailCom(`${mainProjectId},${contractSignDateId}`, detailTable, obj);
// 明细的款项类型字段变化绑定
detailFieldChangeDetailCom(`${detailPaymentTypeId},${detailAroundId},${detailDayId}`, obj);
submitCallback(detailTable, detailPayProportionId);
}