mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-10 03:42:49 +08:00
优化导出功能,兼容自定义参数、兼容关联查询用法
This commit is contained in:
@@ -12,11 +12,10 @@ use think\console\Output;
|
||||
class Version extends Command
|
||||
{
|
||||
|
||||
const VERSION = 'v2.0.2';
|
||||
const VERSION = 'v2.0.3';
|
||||
|
||||
const COMMENT = [
|
||||
'新增查看当前版本命令',
|
||||
'简单修改了说明文件'
|
||||
'优化导出功能,兼容自定义参数、兼容关联查询用法',
|
||||
];
|
||||
|
||||
protected function configure()
|
||||
|
||||
@@ -23,8 +23,14 @@ class ExcelTools
|
||||
|
||||
$runtime_file_list = [];
|
||||
|
||||
$model
|
||||
->where($where)->chunk(100, function ($list) use ($sheet, &$write_line, $fields, $image_fields, &$runtime_file_list, $select_fields, $date_fields) {
|
||||
$limit = 1000;
|
||||
|
||||
$page = 0;
|
||||
|
||||
while (true) {
|
||||
$page++;
|
||||
$list = $model
|
||||
->where($where)->page($page, $limit)->select();
|
||||
foreach ($list as $list_index => $item) {
|
||||
$write_line++;
|
||||
$write_col = 1;
|
||||
@@ -82,7 +88,12 @@ class ExcelTools
|
||||
$write_col++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (count($list) < $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
|
||||
|
||||
@@ -92,8 +103,10 @@ class ExcelTools
|
||||
ob_clean();
|
||||
|
||||
foreach ($runtime_file_list as $runtime_file) {
|
||||
if(file_exists($runtime_file)){
|
||||
unlink($runtime_file);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -1270,6 +1270,8 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
toUrl = admin.url(url);
|
||||
if (toUrl.indexOf('?') < 0) {
|
||||
toUrl += '?';
|
||||
}else{
|
||||
toUrl += '&'
|
||||
}
|
||||
toUrl += query;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user