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