<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>





<script>
    //补打卡人变更  获取补打卡日期
    jQuery(document).ready(function(){
        WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("bdkr", "detail_1"),function(id,rowIndex,value){
            WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkrq", "detail_1")+"_"+rowIndex)
            //alert(WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkrq", "detail_1")+"_"+rowIndex));
        });
    });
    //补打卡日期变更 获取补打卡人
    jQuery(document).ready(function(){
        WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("bdkrq", "detail_1"),function(id,rowIndex,value){
            WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkr", "detail_1")+"_"+rowIndex)
            //alert(WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkr", "detail_1")+"_"+rowIndex));
        });
    });

    //添加行记录后 对部分栏位进行二次调整
    WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){
        //取主表的流程提交人为补打卡人
        var bdkr= mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdkry")).specialobj);
        var bdklx;//补打卡类型
        var bdkrq;//补打卡日期
        if (WfForm.getDetailRowCount("detail_1") > 1){
            //明细超过一行，添加第二行时，取第一行对应的补打卡人
            bdkr = mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdkr","detail_1")+"_"+(index-1)).specialobj);
            //取上一行的补打卡日期
            bdkrq = wfform.getFieldValue(WfForm.convertFieldNameToId("bdkrq","detail_1")+"_"+(index-1));
            //新行默认上一行补打卡日期
            WfForm.changeSingleField(WfForm.convertFieldNameToId("bdkrq","detail_1")+"_"+index, {value: bdkrq});
            //取第一行对应的补打卡类型
            bdklx = mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdklx","detail_1")+"_"+(index-1)).specialobj);
            if (bdklx !== null){
                //新行默认上一行的补打卡类型
                WfForm.changeSingleField(WfForm.convertFieldNameToId("bdklx","detail_1")+"_"+index, {value:bdklx[0].id,specialobj:[{id:bdklx[0].id,name:bdklx[0].mc}]});
            }
        }
        WfForm.changeSingleField(WfForm.convertFieldNameToId("bdkr","detail_1")+"_"+index, {value:bdkr[0].id,specialobj:[{id:bdkr[0].id,name:bdkr[0].name}]});
    });
</script>


