$(document).ready(function () {
    initialize();
    bindEvent();
});
function initialize(){
    UICtrl.layout("#layout", {leftWidth: 3});
    $('#fileList').fileList({bizId:$("#id").val()});
}

function bindEvent(){
    // $("#result").combox({onChange:function(data){
    //         var handleOpinion = $("#handleOpinion").val();
    //         $("#handleOpinion").val(data.text + "-" + handleOpinion)
    //     }
    // })
}

function getExtendedData(processAction) {
    var handleResult = getHandleResult();
    //回退、打回、转交时，不需要验证必填项是否已经填写；
    if (processAction == ProcessAction.BACK
        || processAction == ProcessAction.REPLENISH
        || processAction == ProcessAction.TRANSMIT || "2" == handleResult) {
        //不验证
        $('#submitForm').attr('check', false);
    }
    return true;
}

function checkConstraints(){
    var handleOpinion = $("#handleOpinion").val();
    $("#handleOpinion").val($("#result_text").val() + "-" + handleOpinion)
    return true;
}

/**
 * 流程引擎回调设置打样的id
 * @param value
 */
function setId(id) {
    $("#id").val(id);
}

/**
 * 流程引擎获取打样申请id的回掉方法。
 * @return
 */
function getId() {
    return $("#id").val() || "";
}

//UICtrl中校验是否允许编辑
function businessJudgmentUnit() {
    var isApply = isApplyProcUnit();
    let approveProcUnit = isApproveProcUnit();
    if (isApply) {
        UICtrl.setElHideOrShow("#result",true)
        return true;
    }else {
        UICtrl.setDisable($("#submitForm"));
    }
    if (approveProcUnit){
        UICtrl.enable($("#result"));
        UICtrl.setElRequiredFlag("#result",true);
    }
    return true;
}

function print(){
    if ($("#statusId").val() != 3){
        Public.tip("请审批完成再打印!");
        return;
    }
    var url='/epChangeForm/print.load';
    Public.openPostWindow(web_app.name+url,{id :$("#id").val()});
}
