feat: 导出的签到数据和审批数据换成xlsx,因老版本的xls会出现兼容性问题

This commit is contained in:
weifs 2024-03-05 15:19:12 +08:00
parent 494565e131
commit 0e916a2804
2 changed files with 4 additions and 4 deletions

View File

@ -858,7 +858,7 @@ class ApproveController extends AbstractController
BillExport::create()->setTitle($title)->setHeadings($headings)->setData($datas)->setStyles(["A1:Y1" => ["font" => ["bold" => true]]]) BillExport::create()->setTitle($title)->setHeadings($headings)->setData($datas)->setStyles(["A1:Y1" => ["font" => ["bold" => true]]])
]; ];
// //
$fileName = '审批记录_' . Base::time() . '.xls'; $fileName = '审批记录_' . Base::time() . '.xlsx';
$filePath = "temp/approve/export/" . date("Ym", Base::time()); $filePath = "temp/approve/export/" . date("Ym", Base::time());
$export = new BillMultipleExport($sheets); $export = new BillMultipleExport($sheets);
$res = $export->store($filePath . "/" . $fileName); $res = $export->store($filePath . "/" . $fileName);
@ -866,7 +866,7 @@ class ApproveController extends AbstractController
return Base::retError('导出失败,' . $fileName . ''); return Base::retError('导出失败,' . $fileName . '');
} }
$xlsPath = storage_path("app/" . $filePath . "/" . $fileName); $xlsPath = storage_path("app/" . $filePath . "/" . $fileName);
$zipFile = "app/" . $filePath . "/" . Base::rightDelete($fileName, '.xls') . ".zip"; $zipFile = "app/" . $filePath . "/" . Base::rightDelete($fileName, '.xlsx') . ".zip";
$zipPath = storage_path($zipFile); $zipPath = storage_path($zipFile);
if (file_exists($zipPath)) { if (file_exists($zipPath)) {
Base::deleteDirAndFile($zipPath, true); Base::deleteDirAndFile($zipPath, true);

View File

@ -1210,7 +1210,7 @@ class SystemController extends AbstractController
if (count($users) > 1) { if (count($users) > 1) {
$fileName .= "" . count($userid) . "位成员"; $fileName .= "" . count($userid) . "位成员";
} }
$fileName .= '签到记录_' . Base::time() . '.xls'; $fileName .= '签到记录_' . Base::time() . '.xlsx';
$filePath = "temp/checkin/export/" . date("Ym", Base::time()); $filePath = "temp/checkin/export/" . date("Ym", Base::time());
$export = new BillMultipleExport($sheets); $export = new BillMultipleExport($sheets);
$res = $export->store($filePath . "/" . $fileName); $res = $export->store($filePath . "/" . $fileName);
@ -1218,7 +1218,7 @@ class SystemController extends AbstractController
return Base::retError('导出失败,' . $fileName . ''); return Base::retError('导出失败,' . $fileName . '');
} }
$xlsPath = storage_path("app/" . $filePath . "/" . $fileName); $xlsPath = storage_path("app/" . $filePath . "/" . $fileName);
$zipFile = "app/" . $filePath . "/" . Base::rightDelete($fileName, '.xls') . ".zip"; $zipFile = "app/" . $filePath . "/" . Base::rightDelete($fileName, '.xlsx') . ".zip";
$zipPath = storage_path($zipFile); $zipPath = storage_path($zipFile);
if (file_exists($zipPath)) { if (file_exists($zipPath)) {
Base::deleteDirAndFile($zipPath, true); Base::deleteDirAndFile($zipPath, true);