$(document).ready(function () {
    bindQueryEvent();
});

//绑定selectC
function bindQueryEvent() {
    $('#productCode').searchbox({
        type: "proofing", name: "proofingMakeCode",
        onChange: function (value, data) {
            $('#submitForm').formSet(data);
        }
    });
}


function saveForm(){
    var _self=this;
    $('#submitForm').ajaxSubmit({
        url : web_app.name + '/workInstructionApply/saveWorkInstructionApply.ajax',
        param:{},
        success : function(data) {
            if (data !== null){
                Public.successTip("保存成功！");
                addTabWorkInstruction(data.workInstructionApplyId);
            }
            _self.close();
        }
    });
}

function addTabWorkInstruction(workInstructionApplyId){
    UICtrl.addTabItem({
        tabid: 'workInstruction'+workInstructionApplyId,
        text: "作业指导申请书",
        url: web_app.name + '/workInstruction/forwardWorkInstruction.do?workInstructionApplyId='+workInstructionApplyId
    });
}


function resetForm(obj) {
    $(obj).formClean();
}