/**
 * 数据管理-税率管理新增编辑页面JS
 *
 * Created by li.kui on 20203/17.
 */
'use strict';
var el = {
    form: '#form',
    id: '#id',
    purchaseGroupCode: '#purchaseGroupCode',
    purchaseGroupName: '#purchaseGroupName',
    orgCode: '#orgCode',
    orgName: '#orgName'
};

$(function () {

});



/**
 * 数据提交
 *
 * @param callback 回调函数
 */
    function saveOrUpdate(call) {
        if($(el.form).form('validate')){
            var formData = $(el.form).serializeJson();
            var loading = top.layer.msg('处理中', {icon: 16, shade: [0.1, '#000'], time: false});
            $.ajax({
                url: g.ctx + 'pc/sys/tax/rest/saveOrUpdate',
                method: 'post',
                data: formData,
                success: function (data) {
                    call();
                },
                complete: function(data) {
                    top.layer.close(loading);
                },
                error: function (data) {
                    layer.alert(JSON.parse(data.responseText).message);
                }
            });
        }else{
            layer.msg("红色框为必输项，请填写！");
        }
    }
