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

function initializateUI() {
    UICtrl.layout("#layout", {leftWidth: 3});
}

function getCostCenterDetail(CostCenterAction) {
    //采购订单保存时数据不进行必填验证，提交时数据才进行必填验证
    var op = {};
    var check = true;
    if (CostCenterAction == "save") {
        check = false;
    }
    op = {check: check};
    var costCenter = $('#submitForm').formToJSON(op);
    if (!costCenter) {
        return false;
    }
    return costCenter;
}

function saveData(action) {
    debugger
    var CostCenterDetail = getCostCenterDetail("submit");
    if (!CostCenterDetail) {
        return;
    }
    Public.ajax(web_app.name + '/sapCostCenter/saveCostCenter.ajax?code=' + action,CostCenterDetail,
        function (data) {
            setId(data.id);
            Public.successTip("数据保存成功");
            // processGridManager.setParm('id', data.id);
            // processGridManager.loadData();
        }
    );
}

function closeDispatchTabItem() {
    UICtrl.closeCurrentTab();
}

function setId(value) {
    $('#id').val(value);
}

function getId() {
    return $("#id").val();
}


