parent
378cf52fa7
commit
91a35330fc
@ -3,7 +3,6 @@
|
||||
namespace Modules\EcommerceFinance\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Routing\Controller;
|
||||
@ -103,17 +102,8 @@ class ProcessDetails extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function export(Request $request): StreamedResponse|RedirectResponse
|
||||
public function export(Request $request): StreamedResponse
|
||||
{
|
||||
if (! $this->repository->ready()) {
|
||||
return redirect()
|
||||
->route('business.pages.show', [
|
||||
'section' => 'process-data',
|
||||
'page' => 'oa-process',
|
||||
])
|
||||
->withErrors(['export' => 'OA流程镜像尚未完成导入,暂时不能导出。']);
|
||||
}
|
||||
|
||||
$filters = ProcessDetailsPageData::normalizeFilters($request);
|
||||
|
||||
return response()->streamDownload(function () use ($filters): void {
|
||||
|
||||
@ -995,6 +995,13 @@
|
||||
<div class="process-details-alert" role="alert">{{ $error }}</div>
|
||||
@endif
|
||||
|
||||
@if ($errors->has('export'))
|
||||
<div class="process-details-alert" role="alert">
|
||||
<span class="material-icons-outlined" aria-hidden="true">error_outline</span>
|
||||
<span>{{ $errors->first('export') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($mirrorStale)
|
||||
<div class="process-details-alert is-warning" role="status">
|
||||
<span class="material-icons-outlined" aria-hidden="true">schedule</span>
|
||||
|
||||
@ -159,6 +159,16 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
->assertSee('value="50"', false)
|
||||
->assertSee('value="100" selected', false)
|
||||
->assertSee('value="200"', false)
|
||||
->assertSee(
|
||||
'href="'
|
||||
. e(route('business.process-details.export', [
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
'waiting_bucket' => '1_2d',
|
||||
]))
|
||||
. '"',
|
||||
false,
|
||||
)
|
||||
->assertSee('导出');
|
||||
}
|
||||
|
||||
@ -308,7 +318,7 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
$repository = Mockery::mock(DingProcessDetailMirrorRepository::class);
|
||||
$repository->shouldReceive('ready')->once()->andReturn(true);
|
||||
$repository->shouldNotReceive('ready');
|
||||
$repository->shouldReceive('exportRows')->once()->andReturnUsing(function (): \Generator {
|
||||
yield [
|
||||
'business_id' => '202601011200000000001',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user