let el = {
    file: '#file',
    form: '#tenderTargetForm'
};

function importFile() {
    let filebox = $("#file").filebox("files");
    let url = g.ctx + 'pc/finance/receipt/voucher/rest/importRatio';

    let formData = new FormData();
    formData.append("file", filebox[0]);
    let loading = layer.msg(tipsi18n.sjdrz, {icon: 16, time: -1});
    $.ajax({
        url: url,
        data: formData,
        type: 'post',
        contentType: false,
        processData: false,
        success: function (data) {
            layer.close(loading);
            if (data.state) {
                window.parent.importRatioRow();
                closeLayer();
            } else {
                layer.alert(data.msg);
            }
        },
        error: function (xhr, state, errorThrown) {
            layer.close(index);
            layer.msg(xhr.responseJSON, {
                time: 600
            }, function () {
                return false;
            });
        }
    });

}

// 下载导入模板
function downloadTemplate() {
    window.location.href = g.ctx + "static/js/pc/finance/receive/deduction_ratio_list.xls";
}