This commit is contained in:
2022-05-04 15:43:47 +08:00
parent c76a1850a1
commit 769b276649
2 changed files with 7 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Admin\Actions; namespace App\Admin\Actions;
use App\Models\User; use App\Models\User;
use Encore\Admin\Actions\Response;
use Encore\Admin\Actions\RowAction; use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use PhpOffice\PhpWord\Exception\CopyFileException; use PhpOffice\PhpWord\Exception\CopyFileException;
@@ -19,7 +20,7 @@ class DestroyData extends RowAction
$this->confirm('确定要销毁数据么,一旦操作不可恢复?'); $this->confirm('确定要销毁数据么,一旦操作不可恢复?');
} }
public function handle(Model $model) public function handle(Model $model): Response
{ {
try { try {
if ($model->archives) { if ($model->archives) {
@@ -64,7 +65,7 @@ class DestroyData extends RowAction
* @throws CopyFileException * @throws CopyFileException
* @throws CreateTemporaryFileException * @throws CreateTemporaryFileException
*/ */
public function exportEqual($vote) public function exportEqual($vote): string
{ {
$templateProcessor = new TemplateProcessor(storage_path('app/public/DENG_FEN.docx')); $templateProcessor = new TemplateProcessor(storage_path('app/public/DENG_FEN.docx'));

View File

@@ -4,6 +4,7 @@ namespace App\Admin\Actions;
use App\Models\Vote; use App\Models\Vote;
use Encore\Admin\Actions\Action; use Encore\Admin\Actions\Action;
use Encore\Admin\Actions\Response;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use PhpOffice\PhpWord\TemplateProcessor; use PhpOffice\PhpWord\TemplateProcessor;
@@ -16,7 +17,7 @@ class ExportCha extends Action
protected $selector = '.export-cha'; protected $selector = '.export-cha';
public function handle(Request $request) public function handle(Request $request): Response
{ {
$templateProcessor = new TemplateProcessor(storage_path('app/public/CHA_E.docx')); $templateProcessor = new TemplateProcessor(storage_path('app/public/CHA_E.docx'));
@@ -39,7 +40,7 @@ class ExportCha extends Action
return $this->response()->success('倒出成功')->download('/storage/' . $save); return $this->response()->success('倒出成功')->download('/storage/' . $save);
} }
public function html() public function html(): string
{ {
return <<<HTML return <<<HTML
<a class="btn btn-sm btn-warning export-cha"><i class="fa fa-upload"></i> 差额数据倒出</a> <a class="btn btn-sm btn-warning export-cha"><i class="fa fa-upload"></i> 差额数据倒出</a>