泛微实施记录(一)明细行数据联动更新

时间联动

修改结束时间时,自动修改下一个议程的开始时间

jQuery(function () {
    //排除三行标题
    var _start_row_index_ = 3;

    //新增会议主题
    jQuery("#addbutton0").live("click", function () {
        console.log("_____________________追加监听事件-监听会议主题新建_____________________")
        jQuery("[data-fieldname='ytjssj']").each(function () {
            var field_ytjssj_id = jQuery(this).attr("data-fieldmark");
            console.log("data-fieldmark is ", field_ytjssj_id)
            //判断是否已经存在绑定事件
            if (typeof (WfForm.__propertyChangeFnObj[field_ytjssj_id]) === 'undefined') {
                console.log("data-fieldmark is ", field_ytjssj_id, " 增加字段值变化监听事件")
                WfForm.bindFieldChangeEvent(field_ytjssj_id, function (obj, id, value) {
                    console.log('触发属性值改变监听事件, data-fieldmark', id)

                    var nextRow=jQuery(obj).parents("tr:eq(0)").next()
                    if(nextRow.length==0){
                        //不存在下一行数据
                        var rowIndex = jQuery(obj).parents("tr:eq(0)").prevAll().length - 3
                        var colIndex = jQuery(obj).parents("td:eq(0)").prevAll().length + 1;
                        console.log("已经是最后一行,[row,col]=[" + rowIndex + "," + colIndex + "]");
                    }else{
                        //修改下一行的议题开始时间
                        //修改议题开始时间-ytkssj
                        console.log(jQuery(nextRow[0]).children("td:eq(4)").html())
                        var field_ytkssj_id = jQuery(nextRow[0]).find("div[data-fieldname='ytkssj']").attr("data-fieldmark")
                        console.log("改变值 ",field_ytkssj_id,"--- value = ",value,)
                        WfForm.changeFieldValue(field_ytkssj_id,{value:value});
                    }
                    //console.log("第" + rowIndex + "行" + "  " + "第" + colIndex + "列");
                })
            } else {
                console.log("data-fieldmark is ", field_ytjssj_id, " 已经存在绑定事件")
            }

        });
        //立即生效
        //$(this).trigger('click')
    })
});

实例:会议议程

你可能感兴趣的:(泛微实施记录(一)明细行数据联动更新)