Example #1
0
def export_asset_info():
    key = request.form['exportData']
    from itdblib.common.xls_utils import writeExcel

    aiu = AssetInfoUtils()
    chlist = aiu.output_phone_excel_ch_list()
    enlist = aiu.output_phone_excel_en_list()
    params = AssetPhoneService().get_export_excel_data(key)
    save_file = writeExcel(params, '电话号码类结果数据.xls', chlist, enlist)
    response = make_response(send_file(save_file,
                                       as_attachment=True
                            ))
    filesize = os.path.getsize(save_file)
    response.headers['Content-Length'] = filesize
    os.remove(save_file)
    return response