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;
use App\Models\User;
use Encore\Admin\Actions\Response;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use PhpOffice\PhpWord\Exception\CopyFileException;
@@ -19,11 +20,11 @@ class DestroyData extends RowAction
$this->confirm('确定要销毁数据么,一旦操作不可恢复?');
}
public function handle(Model $model)
public function handle(Model $model): Response
{
try {
if ($model->archives) {
// return $this->response()->error('数据销毁失败')->refresh();
// return $this->response()->error('数据销毁失败')->refresh();
}
// 先做存档
$archives = [];
@@ -64,7 +65,7 @@ class DestroyData extends RowAction
* @throws CopyFileException
* @throws CreateTemporaryFileException
*/
public function exportEqual($vote)
public function exportEqual($vote): string
{
$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 Encore\Admin\Actions\Action;
use Encore\Admin\Actions\Response;
use Illuminate\Http\Request;
use PhpOffice\PhpWord\TemplateProcessor;
@@ -16,7 +17,7 @@ class ExportCha extends Action
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'));
@@ -39,7 +40,7 @@ class ExportCha extends Action
return $this->response()->success('倒出成功')->download('/storage/' . $save);
}
public function html()
public function html(): string
{
return <<<HTML
<a class="btn btn-sm btn-warning export-cha"><i class="fa fa-upload"></i> 差额数据倒出</a>