var el = {
    form : '#form',
    useState: '#useState',
}
$(function () {
    //加载公司数据
    $('#companyCode').combobox({
        valueField: 'code',
        textField: 'codeWithDesc',
        url: g.ctx + 'pc/sys/company/rest/listAll',
        editable: false,
        required: true,
        prompt: '--- 请选择 ---',
        panelHeight: 'auto',
        panelWidth: 300,
    });
    // 初始化使用状态下拉框
    $('#sealType').combobox({
        valueField: 'value',
        textField: 'label',
        data: [
            {label: '合同章', value: 1},
            {label: '公章', value: 2},
            {label: '财务章', value: 3}
        ],
        required: true,
        editable: false,
        panelHeight: 'auto',
    });
});
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/digitalSealConfig/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("红色框为必输项，请填写！");
    }
}