feat(财务台账): 完善不保留账户待办处理
This commit is contained in:
parent
b4ce8f32a9
commit
315d5d49f9
@ -24,6 +24,11 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class FinanceLedger extends Controller
|
||||
{
|
||||
private const UNRETAINED_OWNER_OPTIONS = [
|
||||
'玉兔',
|
||||
'山时',
|
||||
];
|
||||
|
||||
public function downloadAccountTemplate(FinanceLedgerAccountTemplate $template): StreamedResponse
|
||||
{
|
||||
return $template->download();
|
||||
@ -212,6 +217,28 @@ class FinanceLedger extends Controller
|
||||
'keep_owner' => trim((string) $request->query('keep_owner', '')),
|
||||
'keep_progress' => trim((string) $request->query('keep_progress', '')),
|
||||
];
|
||||
$headerFilterValue = trim((string) $request->query('keep_filter_value', ''));
|
||||
$headerFilterColumn = trim((string) $request->query('keep_filter_column', ''));
|
||||
$headerFilterColumns = [
|
||||
'company_name',
|
||||
'account_short',
|
||||
'legal_representative',
|
||||
'account_type',
|
||||
'account_status',
|
||||
'account_no',
|
||||
'bank_name',
|
||||
'bank_city_branch',
|
||||
'account_should_keep',
|
||||
'handling_method',
|
||||
'owner_name',
|
||||
'started_at',
|
||||
'completed_at',
|
||||
'current_progress',
|
||||
];
|
||||
if ($headerFilterValue === '' || ! in_array($headerFilterColumn, $headerFilterColumns, true)) {
|
||||
$headerFilterColumn = '';
|
||||
$headerFilterValue = '';
|
||||
}
|
||||
|
||||
$query = $connection->table('fin_accounts as accounts')
|
||||
->leftJoin('fin_account_statuses as account_status', 'account_status.account_short', '=', 'accounts.account_short')
|
||||
@ -287,6 +314,127 @@ class FinanceLedger extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$headerOptionRows = (clone $query)
|
||||
->reorder()
|
||||
->select([
|
||||
'accounts.company_name',
|
||||
'accounts.account_short',
|
||||
'accounts.account_type',
|
||||
'accounts.account_no',
|
||||
'accounts.bank_name',
|
||||
'accounts.bank_city_branch',
|
||||
'account_status.status as effective_account_status',
|
||||
'type_override.id as type_override_id',
|
||||
'type_override.account_type as effective_account_type',
|
||||
'account_todo.handling_method as todo_handling_method',
|
||||
'account_todo.owner_name as todo_owner_name',
|
||||
'account_todo.started_at as todo_started_at',
|
||||
'account_todo.completed_at as todo_completed_at',
|
||||
'account_todo.current_progress as todo_current_progress',
|
||||
])
|
||||
->get();
|
||||
$companyNames = $headerOptionRows
|
||||
->pluck('company_name')
|
||||
->map(static fn ($name): string => trim((string) $name))
|
||||
->filter()
|
||||
->unique()
|
||||
->values()
|
||||
->all();
|
||||
$legalRepresentatives = $this->latestLegalRepresentatives($connection, $companyNames);
|
||||
$effectiveAccountTypes = $headerOptionRows->map(static function ($row): string {
|
||||
$type = $row->type_override_id !== null
|
||||
? $row->effective_account_type
|
||||
: $row->account_type;
|
||||
|
||||
return trim((string) $type);
|
||||
});
|
||||
$typeOptions = FinanceLedgerAccountType::options($effectiveAccountTypes->all());
|
||||
|
||||
if ($headerFilterValue !== '') {
|
||||
$textFilterColumns = [
|
||||
'company_name' => 'accounts.company_name',
|
||||
'account_short' => 'accounts.account_short',
|
||||
'account_no' => 'accounts.account_no',
|
||||
'bank_name' => 'accounts.bank_name',
|
||||
'bank_city_branch' => 'accounts.bank_city_branch',
|
||||
];
|
||||
|
||||
if (isset($textFilterColumns[$headerFilterColumn])) {
|
||||
$query->where($textFilterColumns[$headerFilterColumn], 'like', '%' . $headerFilterValue . '%');
|
||||
} elseif ($headerFilterColumn === 'legal_representative') {
|
||||
$matchingCompanies = collect($legalRepresentatives)
|
||||
->filter(static fn ($name): bool => str_contains((string) $name, $headerFilterValue))
|
||||
->keys()
|
||||
->all();
|
||||
if ($matchingCompanies === []) {
|
||||
$query->whereRaw('1 = 0');
|
||||
} else {
|
||||
$query->whereIn('accounts.company_name', $matchingCompanies);
|
||||
}
|
||||
} elseif ($headerFilterColumn === 'account_type') {
|
||||
$query->where(function ($effectiveType) use ($headerFilterValue): void {
|
||||
$effectiveType->where(function ($baseType) use ($headerFilterValue): void {
|
||||
$baseType->whereNull('type_override.id');
|
||||
if ($headerFilterValue === '__empty__') {
|
||||
$baseType->where(function ($blank): void {
|
||||
$blank->whereNull('accounts.account_type')->orWhere('accounts.account_type', '');
|
||||
});
|
||||
} else {
|
||||
$baseType->where('accounts.account_type', $headerFilterValue);
|
||||
}
|
||||
})->orWhere(function ($overrideType) use ($headerFilterValue): void {
|
||||
$overrideType->whereNotNull('type_override.id');
|
||||
if ($headerFilterValue === '__empty__') {
|
||||
$overrideType->where(function ($blank): void {
|
||||
$blank->whereNull('type_override.account_type')->orWhere('type_override.account_type', '');
|
||||
});
|
||||
} else {
|
||||
$overrideType->where('type_override.account_type', $headerFilterValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
} elseif ($headerFilterColumn === 'account_status') {
|
||||
$status = array_search($headerFilterValue, FinanceLedgerAccountStatus::OPTIONS, true);
|
||||
if ($status === false) {
|
||||
$query->whereRaw('1 = 0');
|
||||
} elseif ($status === FinanceLedgerAccountStatus::NORMAL) {
|
||||
$query->where(function ($normalStatus): void {
|
||||
$normalStatus->whereNull('account_status.status')
|
||||
->orWhere('account_status.status', FinanceLedgerAccountStatus::NORMAL);
|
||||
});
|
||||
} else {
|
||||
$query->where('account_status.status', $status);
|
||||
}
|
||||
} elseif ($headerFilterColumn === 'account_should_keep') {
|
||||
if ($headerFilterValue !== FinanceLedgerAccountShouldKeep::NO) {
|
||||
$query->whereRaw('1 = 0');
|
||||
}
|
||||
} elseif ($headerFilterColumn === 'handling_method') {
|
||||
$method = array_search($headerFilterValue, $handlingMethods, true);
|
||||
if ($method === false) {
|
||||
$query->whereRaw('1 = 0');
|
||||
} else {
|
||||
$query->where('account_todo.handling_method', $method);
|
||||
}
|
||||
} elseif ($headerFilterColumn === 'owner_name') {
|
||||
$query->where('account_todo.owner_name', 'like', '%' . $headerFilterValue . '%');
|
||||
} elseif ($headerFilterColumn === 'started_at' || $headerFilterColumn === 'completed_at') {
|
||||
$query->where('account_todo.' . $headerFilterColumn, 'like', $headerFilterValue . '%');
|
||||
} elseif ($headerFilterColumn === 'current_progress') {
|
||||
$progress = array_search($headerFilterValue, $completionStatuses, true);
|
||||
if ($progress === false) {
|
||||
$query->whereRaw('1 = 0');
|
||||
} elseif ($progress === 'not_started') {
|
||||
$query->where(function ($notStarted): void {
|
||||
$notStarted->whereNull('account_todo.current_progress')
|
||||
->orWhere('account_todo.current_progress', 'not_started');
|
||||
});
|
||||
} else {
|
||||
$query->where('account_todo.current_progress', $progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$summaryQuery = clone $query;
|
||||
$summary = [
|
||||
'count' => (clone $query)->count(),
|
||||
@ -317,27 +465,57 @@ class FinanceLedger extends Controller
|
||||
]))
|
||||
->withQueryString();
|
||||
|
||||
$rows->getCollection()->transform(static function ($row) {
|
||||
$rows->getCollection()->transform(static function ($row) use ($legalRepresentatives) {
|
||||
$row->account_status = FinanceLedgerAccountStatus::normalize($row->effective_account_status ?? null);
|
||||
if ($row->type_override_id !== null) {
|
||||
$row->account_type = (string) ($row->effective_account_type ?? '');
|
||||
}
|
||||
$row->todo_current_progress = $row->todo_current_progress ?: 'not_started';
|
||||
$row->legal_representative = $legalRepresentatives[trim((string) $row->company_name)] ?? null;
|
||||
|
||||
return $row;
|
||||
});
|
||||
|
||||
$typeOptions = FinanceLedgerAccountType::options(
|
||||
$connection->table('fin_accounts')
|
||||
->whereNotNull('account_type')->where('account_type', '<>', '')
|
||||
->distinct()->orderBy('account_type')->pluck('account_type')->all(),
|
||||
$connection->table('fin_account_type_overrides')
|
||||
->whereNotNull('account_type')->where('account_type', '<>', '')
|
||||
->distinct()->orderBy('account_type')->pluck('account_type')->all(),
|
||||
);
|
||||
$ownerOptions = $connection->table('fin_account_keep_todos')
|
||||
->whereNotNull('owner_name')->where('owner_name', '<>', '')
|
||||
->distinct()->orderBy('owner_name')->pluck('owner_name')->all();
|
||||
$ownerOptions = self::UNRETAINED_OWNER_OPTIONS;
|
||||
$headerOptionValues = static function (iterable $values, bool $includeEmpty = false): array {
|
||||
$normalized = collect($values)
|
||||
->map(static fn ($value): string => trim((string) $value))
|
||||
->filter(static fn (string $value): bool => $value !== '')
|
||||
->unique()
|
||||
->sort(SORT_NATURAL | SORT_FLAG_CASE)
|
||||
->values()
|
||||
->all();
|
||||
$options = $normalized;
|
||||
if ($includeEmpty) {
|
||||
$options = array_merge(['__empty__' => '未填写'], $normalized);
|
||||
}
|
||||
|
||||
return $options;
|
||||
};
|
||||
$hasEmpty = static fn (string $column): bool => $headerOptionRows
|
||||
->contains(static fn ($row): bool => trim((string) ($row->{$column} ?? '')) === '');
|
||||
$keepHeaderOptions = [
|
||||
'company_name' => $headerOptionValues($headerOptionRows->pluck('company_name'), $hasEmpty('company_name')),
|
||||
'account_short' => $headerOptionValues($headerOptionRows->pluck('account_short'), $hasEmpty('account_short')),
|
||||
'legal_representative' => $headerOptionValues(array_values($legalRepresentatives), $headerOptionRows->contains(
|
||||
static fn ($row): bool => trim((string) ($legalRepresentatives[trim((string) $row->company_name)] ?? '')) === '',
|
||||
)),
|
||||
'account_type' => $headerOptionValues($typeOptions, true),
|
||||
'account_status' => $headerOptionValues(array_values(FinanceLedgerAccountStatus::OPTIONS)),
|
||||
'account_no' => $headerOptionValues($headerOptionRows->pluck('account_no'), $hasEmpty('account_no')),
|
||||
'bank_name' => $headerOptionValues($headerOptionRows->pluck('bank_name'), $hasEmpty('bank_name')),
|
||||
'bank_city_branch' => $headerOptionValues($headerOptionRows->pluck('bank_city_branch'), $hasEmpty('bank_city_branch')),
|
||||
'account_should_keep' => [FinanceLedgerAccountShouldKeep::NO],
|
||||
'handling_method' => $headerOptionValues(array_values($handlingMethods)),
|
||||
'owner_name' => $headerOptionValues($ownerOptions),
|
||||
'started_at' => [],
|
||||
'completed_at' => [],
|
||||
'current_progress' => $headerOptionValues(array_values($completionStatuses)),
|
||||
];
|
||||
$keepHeaderPreserve = collect($request->query())
|
||||
->except(['page', 'keep_filter_column', 'keep_filter_value'])
|
||||
->filter(static fn ($value): bool => is_scalar($value) || $value === null)
|
||||
->all();
|
||||
|
||||
return view('business.pages.financial-ledger.unretained-account-tasks', [
|
||||
'rows' => $rows,
|
||||
@ -355,6 +533,8 @@ class FinanceLedger extends Controller
|
||||
'accountStatusOptions' => FinanceLedgerAccountStatus::OPTIONS,
|
||||
'accountTypeOptions' => $typeOptions,
|
||||
'ownerOptions' => $ownerOptions,
|
||||
'keepHeaderOptions' => $keepHeaderOptions,
|
||||
'keepHeaderPreserve' => $keepHeaderPreserve,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -365,7 +545,7 @@ class FinanceLedger extends Controller
|
||||
$data = $request->validate([
|
||||
'account_short' => ['required', 'string', 'max:100'],
|
||||
'handling_method' => ['nullable', 'string', Rule::in(['online', 'offline'])],
|
||||
'owner_name' => ['nullable', 'string', 'max:100'],
|
||||
'owner_name' => ['nullable', 'string', Rule::in(self::UNRETAINED_OWNER_OPTIONS)],
|
||||
'started_at' => ['nullable', 'date'],
|
||||
'completed_at' => ['nullable', 'date'],
|
||||
'current_progress' => ['required', 'string', Rule::in(['completed', 'in_progress', 'not_started'])],
|
||||
@ -1074,4 +1254,29 @@ class FinanceLedger extends Controller
|
||||
'missing' => $result['missing'],
|
||||
], 200, ['Cache-Control' => 'private, no-store']);
|
||||
}
|
||||
|
||||
private function latestLegalRepresentatives($connection, array $companyNames): array
|
||||
{
|
||||
if ($companyNames === [] || ! $connection->getSchemaBuilder()->hasTable('ops_fys_company_info')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$latestCompanyIds = $connection->table('ops_fys_company_info')
|
||||
->selectRaw('businessLicenseName, MAX(Id) AS latest_id')
|
||||
->whereIn('businessLicenseName', $companyNames)
|
||||
->groupBy('businessLicenseName')
|
||||
->pluck('latest_id', 'businessLicenseName');
|
||||
|
||||
if ($latestCompanyIds->isEmpty()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $connection->table('ops_fys_company_info')
|
||||
->whereIn('Id', $latestCompanyIds->values()->all())
|
||||
->get(['businessLicenseName', 'legalRepresentative'])
|
||||
->mapWithKeys(static fn ($company): array => [
|
||||
(string) $company->businessLicenseName => trim((string) $company->legalRepresentative),
|
||||
])
|
||||
->all();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,11 +5,14 @@
|
||||
$options = $options ?? [];
|
||||
$preserve = $preserve ?? [];
|
||||
$align = $align ?? 'start';
|
||||
$sortParameter = $tabKey . '_sort';
|
||||
$directionParameter = $tabKey . '_direction';
|
||||
$filterColumnParameter = $tabKey . '_filter_column';
|
||||
$filterValueParameter = $tabKey . '_filter_value';
|
||||
$pageParameter = $tabKey . '_page';
|
||||
$keepColumnKey = $keepColumnKey ?? null;
|
||||
$showSort = $showSort ?? true;
|
||||
$includeTabField = $includeTabField ?? true;
|
||||
$sortParameter = $sortParameter ?? $tabKey . '_sort';
|
||||
$directionParameter = $directionParameter ?? $tabKey . '_direction';
|
||||
$filterColumnParameter = $filterColumnParameter ?? $tabKey . '_filter_column';
|
||||
$filterValueParameter = $filterValueParameter ?? $tabKey . '_filter_value';
|
||||
$pageParameter = $pageParameter ?? $tabKey . '_page';
|
||||
$sortKey = (string) request($sortParameter, '');
|
||||
$direction = strtolower((string) request($directionParameter, 'asc'));
|
||||
$isSorted = $sortKey === $column;
|
||||
@ -18,9 +21,32 @@
|
||||
$isFiltered = $activeFilterColumn === $column && $activeFilterValue !== '';
|
||||
$icon = $isSorted
|
||||
? ($direction === 'desc' ? 'arrow_downward' : 'arrow_upward')
|
||||
: ($isFiltered ? 'filter_alt' : 'unfold_more');
|
||||
: ($isFiltered || ! $showSort ? 'filter_alt' : 'unfold_more');
|
||||
$ariaSort = ! $isSorted ? 'none' : ($direction === 'desc' ? 'descending' : 'ascending');
|
||||
$menuLabel = $showSort ? '排序和筛选' : '筛选';
|
||||
$filterListId = 'ledger-header-options-' . $tabKey . '-' . $column;
|
||||
$clearQuery = [
|
||||
$filterColumnParameter => null,
|
||||
$filterValueParameter => null,
|
||||
$pageParameter => null,
|
||||
];
|
||||
if ($includeTabField) {
|
||||
$clearQuery['tab'] = $tabKey;
|
||||
}
|
||||
$sortAscQuery = [
|
||||
$sortParameter => $column,
|
||||
$directionParameter => 'asc',
|
||||
$pageParameter => null,
|
||||
];
|
||||
$sortDescQuery = [
|
||||
$sortParameter => $column,
|
||||
$directionParameter => 'desc',
|
||||
$pageParameter => null,
|
||||
];
|
||||
if ($includeTabField) {
|
||||
$sortAscQuery['tab'] = $tabKey;
|
||||
$sortDescQuery['tab'] = $tabKey;
|
||||
}
|
||||
$filterPlaceholder = match ($filterType) {
|
||||
'date' => '选择日期',
|
||||
'number' => '输入精确数值',
|
||||
@ -39,12 +65,15 @@
|
||||
'is-filtered' => $isFiltered,
|
||||
])
|
||||
data-ledger-header-field="{{ $column }}"
|
||||
@if ($keepColumnKey)
|
||||
data-keep-column-key="{{ $keepColumnKey }}"
|
||||
@endif
|
||||
aria-sort="{{ $ariaSort }}"
|
||||
>
|
||||
<div class="ledger-header-menu">
|
||||
<span class="ledger-header-label" data-ledger-header-label>{{ $label }}</span>
|
||||
<details data-ledger-header-details>
|
||||
<summary aria-label="{{ $label }}排序和筛选" title="{{ $label }}排序和筛选">
|
||||
<summary aria-label="{{ $label }}{{ $menuLabel }}" title="{{ $label }}{{ $menuLabel }}">
|
||||
<span class="material-icons-outlined ledger-header-sort-icon" aria-hidden="true">{{ $icon }}</span>
|
||||
</summary>
|
||||
<div @class([
|
||||
@ -52,7 +81,9 @@
|
||||
'ledger-header-menu__panel--end' => $align === 'end',
|
||||
])>
|
||||
<form method="GET" action="{{ request()->url() }}" class="ledger-header-filter" aria-label="筛选{{ $label }}">
|
||||
<input type="hidden" name="tab" value="{{ $tabKey }}">
|
||||
@if ($includeTabField)
|
||||
<input type="hidden" name="tab" value="{{ $tabKey }}">
|
||||
@endif
|
||||
<input type="hidden" name="{{ $filterColumnParameter }}" value="{{ $column }}">
|
||||
@foreach ($preserve as $preservedName => $preservedValue)
|
||||
<input
|
||||
@ -78,14 +109,16 @@
|
||||
>
|
||||
<datalist id="{{ $filterListId }}">
|
||||
@foreach ($options as $optionValue => $optionLabel)
|
||||
<option value="{{ $optionValue }}" label="{{ $optionLabel }}">{{ $optionLabel }}</option>
|
||||
@php($resolvedOptionValue = is_int($optionValue) ? $optionLabel : $optionValue)
|
||||
<option value="{{ $resolvedOptionValue }}" label="{{ $optionLabel }}">{{ $optionLabel }}</option>
|
||||
@endforeach
|
||||
</datalist>
|
||||
@elseif ($options !== [])
|
||||
<select name="{{ $filterValueParameter }}" aria-label="{{ $label }}筛选值">
|
||||
<option value="">全部</option>
|
||||
@foreach ($options as $optionValue => $optionLabel)
|
||||
<option value="{{ $optionValue }}" @selected((string) $optionValue === $activeFilterValue)>{{ $optionLabel }}</option>
|
||||
@php($resolvedOptionValue = is_int($optionValue) ? $optionLabel : $optionValue)
|
||||
<option value="{{ $resolvedOptionValue }}" @selected((string) $resolvedOptionValue === $activeFilterValue)>{{ $optionLabel }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
@ -102,36 +135,23 @@
|
||||
<div class="ledger-header-filter__actions">
|
||||
<button type="submit">应用</button>
|
||||
@if ($isFiltered)
|
||||
<a href="{{ request()->fullUrlWithQuery([
|
||||
'tab' => $tabKey,
|
||||
$filterColumnParameter => null,
|
||||
$filterValueParameter => null,
|
||||
$pageParameter => null,
|
||||
]) }}">清除</a>
|
||||
<a href="{{ request()->fullUrlWithQuery($clearQuery) }}">清除</a>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
<div class="ledger-header-sort" aria-label="{{ $label }}排序">
|
||||
<span>排序</span>
|
||||
<a
|
||||
href="{{ request()->fullUrlWithQuery([
|
||||
'tab' => $tabKey,
|
||||
$sortParameter => $column,
|
||||
$directionParameter => 'asc',
|
||||
$pageParameter => null,
|
||||
]) }}"
|
||||
@if ($isSorted && $direction === 'asc') aria-current="true" @endif
|
||||
>升序</a>
|
||||
<a
|
||||
href="{{ request()->fullUrlWithQuery([
|
||||
'tab' => $tabKey,
|
||||
$sortParameter => $column,
|
||||
$directionParameter => 'desc',
|
||||
$pageParameter => null,
|
||||
]) }}"
|
||||
@if ($isSorted && $direction === 'desc') aria-current="true" @endif
|
||||
>降序</a>
|
||||
</div>
|
||||
@if ($showSort)
|
||||
<div class="ledger-header-sort" aria-label="{{ $label }}排序">
|
||||
<span>排序</span>
|
||||
<a
|
||||
href="{{ request()->fullUrlWithQuery($sortAscQuery) }}"
|
||||
@if ($isSorted && $direction === 'asc') aria-current="true" @endif
|
||||
>升序</a>
|
||||
<a
|
||||
href="{{ request()->fullUrlWithQuery($sortDescQuery) }}"
|
||||
@if ($isSorted && $direction === 'desc') aria-current="true" @endif
|
||||
>降序</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
@ -1,7 +1,23 @@
|
||||
@php
|
||||
$dateTimeValue = static fn ($value): string => $value
|
||||
? \Illuminate\Support\Carbon::parse($value)->format('Y-m-d\TH:i')
|
||||
$dateValue = static fn ($value): string => $value
|
||||
? \Illuminate\Support\Carbon::parse($value)->format('Y-m-d')
|
||||
: '';
|
||||
$keepHeaderColumns = [
|
||||
['column' => 'company_name', 'label' => '公司名称', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'account_short', 'label' => '账户简称', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'legal_representative', 'label' => '法人名称', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'account_type', 'label' => '账户类型', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'account_status', 'label' => '账户状态', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'account_no', 'label' => '账号', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'bank_name', 'label' => '开户行', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'bank_city_branch', 'label' => '开户城市/网点', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'account_should_keep', 'label' => '账户是否保留', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'handling_method', 'label' => '办理方式', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'owner_name', 'label' => '责任人员', 'filterType' => 'searchable-enum'],
|
||||
['column' => 'started_at', 'label' => '开始时间', 'filterType' => 'date', 'showSort' => true],
|
||||
['column' => 'completed_at', 'label' => '完成时间', 'filterType' => 'date', 'showSort' => true],
|
||||
['column' => 'current_progress', 'label' => '当前进度', 'filterType' => 'searchable-enum'],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<x-layouts.admin>
|
||||
@ -42,12 +58,53 @@
|
||||
.keep-task-table td:last-child { border-right:0; }
|
||||
.keep-task-table tbody tr:last-child td { border-bottom:0; }
|
||||
.keep-task-table tbody tr:hover td { background:#fcfaf4; }
|
||||
.keep-task-sort { display:inline-flex; align-items:center; justify-content:center; gap:.2rem; color:inherit; text-decoration:none; }
|
||||
.keep-task-sort:hover { color:var(--vip-content-accent-dark, #856632); }
|
||||
.keep-task-sort .material-icons-outlined { font-size:.9rem; }
|
||||
.keep-task-table thead th:has(details[open]) { z-index:20; }
|
||||
.ledger-header-menu { position:relative; display:flex; width:100%; min-width:0; align-items:center; gap:.18rem; }
|
||||
.keep-task-table th .ledger-header-menu { justify-content:center; }
|
||||
.ledger-header-label { min-width:0; overflow:hidden; text-overflow:ellipsis; }
|
||||
.ledger-header-menu > details { position:relative; flex:0 0 auto; }
|
||||
.ledger-header-menu summary { display:inline-flex; width:1rem; height:1rem; align-items:center; justify-content:center; border-radius:.2rem; color:var(--vip-content-muted, #595959); cursor:pointer; list-style:none; }
|
||||
.ledger-header-menu summary::-webkit-details-marker { display:none; }
|
||||
.ledger-header-menu summary:hover,
|
||||
.ledger-header-menu summary:focus-visible { color:var(--vip-content-accent-dark, #856632); outline:none; box-shadow:0 0 0 2px rgba(133,102,50,.16); }
|
||||
.ledger-header-sort-icon { width:1rem; height:1rem; font-size:1rem; line-height:1; }
|
||||
.ledger-header-cell.is-sorted .ledger-header-sort-icon,
|
||||
.ledger-header-cell.is-filtered .ledger-header-sort-icon { color:var(--vip-content-accent-dark, #856632); }
|
||||
.ledger-header-menu__panel { position:absolute; top:calc(100% + .38rem); left:0; z-index:24; display:grid; width:14rem; gap:.55rem; padding:.55rem; border:1px solid var(--vip-border, #D8D2C7); border-radius:.45rem; background:#fff; box-shadow:0 4px 8px rgba(23,23,23,.10); color:var(--vip-content-ink, #171717); font-weight:400; text-align:left; white-space:normal; }
|
||||
.ledger-header-menu__panel--end { left:auto; right:0; }
|
||||
.ledger-header-filter { display:grid; gap:.4rem; }
|
||||
.ledger-header-filter__field { display:grid; gap:.25rem; color:var(--vip-content-muted, #595959); font-size:.68rem; line-height:1.35; }
|
||||
.ledger-header-filter__field input,
|
||||
.ledger-header-filter__field select { width:100%; min-width:0; height:1.9rem; padding:0 .45rem; border:1px solid var(--vip-border, #D8D2C7); border-radius:.35rem; background:#fff; color:var(--vip-content-ink, #171717); font:inherit; font-size:.7rem; }
|
||||
.ledger-header-filter__field input:focus,
|
||||
.ledger-header-filter__field select:focus { border-color:var(--vip-content-accent-dark, #856632); outline:none; box-shadow:0 0 0 2px rgba(133,102,50,.16); }
|
||||
.ledger-header-filter__actions,
|
||||
.ledger-header-sort { display:flex; align-items:center; gap:.35rem; }
|
||||
.ledger-header-filter__actions button,
|
||||
.ledger-header-filter__actions a,
|
||||
.ledger-header-sort a { display:inline-flex; min-height:1.7rem; align-items:center; justify-content:center; padding:0 .48rem; border:1px solid var(--vip-border, #D8D2C7); border-radius:.3rem; background:#fff; color:var(--vip-content-accent-dark, #856632); font:inherit; font-size:.68rem; font-weight:600; text-decoration:none; cursor:pointer; }
|
||||
.ledger-header-filter__actions button { border-color:var(--vip-content-accent-dark, #856632); background:var(--vip-content-accent-dark, #856632); color:#fff; }
|
||||
.ledger-header-filter__actions button:hover,
|
||||
.ledger-header-filter__actions a:hover,
|
||||
.ledger-header-filter__actions a:focus-visible,
|
||||
.ledger-header-sort a:hover,
|
||||
.ledger-header-sort a:focus-visible { border-color:var(--vip-content-accent-dark, #856632); background:var(--vip-content-accent-soft, #F7F0DE); outline:none; }
|
||||
.ledger-header-filter__actions button:hover { background:#6A5129; }
|
||||
.ledger-header-sort { padding-top:.45rem; border-top:1px solid #e8e3da; }
|
||||
.ledger-header-sort > span { margin-right:auto; color:var(--vip-content-muted, #595959); font-size:.68rem; }
|
||||
.ledger-header-sort a[aria-current="true"] { border-color:var(--vip-content-accent-dark, #856632); background:var(--vip-content-accent-soft, #F7F0DE); }
|
||||
.keep-task-input { width:100%; min-width:0; height:1.75rem; padding:0 .42rem; border:1px solid var(--vip-border, #D8D2C7); border-radius:.35rem; background:#fff; color:var(--vip-content-ink, #171717); font:inherit; }
|
||||
.keep-task-input:focus { border-color:var(--vip-content-accent-dark, #856632); outline:none; box-shadow:0 0 0 3px rgba(133,102,50,.14); }
|
||||
.keep-task-input:disabled { background:#f6f4ef; color:var(--vip-content-muted, #595959); cursor:not-allowed; }
|
||||
.keep-task-date-control { position:relative; display:flex; align-items:center; min-width:0; }
|
||||
.keep-task-date-input { padding:0 1.55rem 0 .3rem; text-align:center; }
|
||||
.keep-task-date-input::-webkit-calendar-picker-indicator { opacity:.72; }
|
||||
.keep-task-date-trigger { position:absolute; right:.16rem; display:inline-grid; place-items:center; width:1.35rem; height:1.5rem; padding:0; border:0; border-radius:.25rem; background:transparent; color:var(--vip-content-accent-dark, #856632); cursor:pointer; }
|
||||
.keep-task-date-trigger:hover { background:var(--vip-content-accent-soft, #F7F0DE); }
|
||||
.keep-task-date-trigger:disabled { color:var(--vip-content-muted, #595959); cursor:not-allowed; }
|
||||
.keep-task-date-trigger .material-icons-outlined { font-size:1rem; }
|
||||
.keep-task-date-control.is-empty .keep-task-date-input { position:absolute; inset:0; width:100%; height:100%; opacity:0; pointer-events:none; }
|
||||
.keep-task-date-control.is-empty .keep-task-date-trigger { position:static; margin:auto; }
|
||||
.keep-task-progress { display:flex; align-items:center; gap:.3rem; min-width:0; }
|
||||
.keep-task-save { display:inline-grid; flex:0 0 auto; place-items:center; width:1.75rem; height:1.75rem; padding:0; border:1px solid var(--vip-content-accent-dark, #856632); border-radius:.35rem; background:var(--vip-content-accent-dark, #856632); color:#fff; cursor:pointer; }
|
||||
.keep-task-save:hover { border-color:#6A5129; background:#6A5129; }
|
||||
@ -116,6 +173,10 @@
|
||||
<input type="hidden" name="keep_sort" value="{{ $sortField }}">
|
||||
<input type="hidden" name="keep_direction" value="{{ $sortDirection }}">
|
||||
@endif
|
||||
@if (request('keep_filter_column') && request('keep_filter_value'))
|
||||
<input type="hidden" name="keep_filter_column" value="{{ request('keep_filter_column') }}">
|
||||
<input type="hidden" name="keep_filter_value" value="{{ request('keep_filter_value') }}">
|
||||
@endif
|
||||
<div class="keep-task-filter-grid">
|
||||
<label class="keep-task-field">
|
||||
<span>账户简称</span>
|
||||
@ -180,46 +241,25 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@php
|
||||
$sortQuery = request()->query();
|
||||
unset($sortQuery['page']);
|
||||
$sortUrl = static fn (string $field): string => route(
|
||||
'business.financial-ledger.unretained-accounts',
|
||||
array_merge($sortQuery, [
|
||||
'keep_sort' => $field,
|
||||
'keep_direction' => $sortField === $field && $sortDirection === 'asc' ? 'desc' : 'asc',
|
||||
]),
|
||||
);
|
||||
@endphp
|
||||
|
||||
<p class="keep-task-table-hint">拖动表头右侧边界可调整列宽,双击边界恢复默认</p>
|
||||
<div class="keep-task-table-wrap">
|
||||
<table class="keep-task-table" data-keep-table data-column-storage-key="caiwu.financial-ledger.unretained-columns.v1.{{ auth()->id() }}.{{ company_id() }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-keep-column-key="company_name">公司名称</th>
|
||||
<th data-keep-column-key="account_short">账户简称</th>
|
||||
<th data-keep-column-key="account_type">账户类型</th>
|
||||
<th data-keep-column-key="account_status">账户状态</th>
|
||||
<th data-keep-column-key="account_no">账号</th>
|
||||
<th data-keep-column-key="bank_name">开户行</th>
|
||||
<th data-keep-column-key="bank_city_branch">开户城市/网点</th>
|
||||
<th data-keep-column-key="account_should_keep">账户是否保留</th>
|
||||
<th data-keep-column-key="handling_method">办理方式</th>
|
||||
<th data-keep-column-key="owner_name">责任人员</th>
|
||||
<th data-keep-column-key="started_at" @if ($sortField === 'started_at') aria-sort="{{ $sortDirection === 'asc' ? 'ascending' : 'descending' }}" @endif>
|
||||
<a class="keep-task-sort" href="{{ $sortUrl('started_at') }}" title="按开始时间排序">
|
||||
开始时间
|
||||
<span class="material-icons-outlined" aria-hidden="true">{{ $sortField === 'started_at' ? ($sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward') : 'unfold_more' }}</span>
|
||||
</a>
|
||||
</th>
|
||||
<th data-keep-column-key="completed_at" @if ($sortField === 'completed_at') aria-sort="{{ $sortDirection === 'asc' ? 'ascending' : 'descending' }}" @endif>
|
||||
<a class="keep-task-sort" href="{{ $sortUrl('completed_at') }}" title="按完成时间排序">
|
||||
完成时间
|
||||
<span class="material-icons-outlined" aria-hidden="true">{{ $sortField === 'completed_at' ? ($sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward') : 'unfold_more' }}</span>
|
||||
</a>
|
||||
</th>
|
||||
<th data-keep-column-key="current_progress">当前进度</th>
|
||||
@foreach ($keepHeaderColumns as $header)
|
||||
@include('business.pages.financial-ledger.partials.table-header', [
|
||||
'tabKey' => 'keep',
|
||||
'column' => $header['column'],
|
||||
'label' => $header['label'],
|
||||
'filterType' => $header['filterType'],
|
||||
'showSort' => $header['showSort'] ?? false,
|
||||
'includeTabField' => false,
|
||||
'keepColumnKey' => $header['column'],
|
||||
'pageParameter' => 'page',
|
||||
'options' => $keepHeaderOptions[$header['column']] ?? [],
|
||||
'preserve' => $keepHeaderPreserve,
|
||||
])
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-keep-tbody>
|
||||
@ -233,6 +273,7 @@
|
||||
{{ $row->company_name ?: '未填写' }}
|
||||
</td>
|
||||
<td>{{ $row->account_short ?: '未填写' }}</td>
|
||||
<td>{{ $row->legal_representative ?: '未填写' }}</td>
|
||||
<td>{{ $row->account_type ?: '未填写' }}</td>
|
||||
<td><span class="keep-task-status is-{{ $row->account_status }}">{{ $accountStatusOptions[$row->account_status] ?? '正常' }}</span></td>
|
||||
<td>{{ $row->account_no ?: '未填写' }}</td>
|
||||
@ -247,9 +288,30 @@
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
<td><input class="keep-task-input" form="keep-task-form-{{ $loop->index }}" name="owner_name" value="{{ $row->todo_owner_name }}" placeholder="填写责任人员" @disabled(! $canEdit)></td>
|
||||
<td><input class="keep-task-input" form="keep-task-form-{{ $loop->index }}" type="datetime-local" name="started_at" value="{{ $dateTimeValue($row->todo_started_at) }}" @disabled(! $canEdit)></td>
|
||||
<td><input class="keep-task-input" form="keep-task-form-{{ $loop->index }}" type="datetime-local" name="completed_at" value="{{ $dateTimeValue($row->todo_completed_at) }}" @disabled(! $canEdit)></td>
|
||||
<td>
|
||||
<select class="keep-task-input" form="keep-task-form-{{ $loop->index }}" name="owner_name" aria-label="责任人员" @disabled(! $canEdit)>
|
||||
<option value="">未选择</option>
|
||||
@foreach ($ownerOptions as $owner)
|
||||
<option value="{{ $owner }}" @selected(($row->todo_owner_name ?? '') === $owner)>{{ $owner }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div class="keep-task-date-control{{ $row->todo_started_at ? '' : ' is-empty' }}" data-keep-date-control>
|
||||
<input class="keep-task-input keep-task-date-input" form="keep-task-form-{{ $loop->index }}" type="date" name="started_at" value="{{ $dateValue($row->todo_started_at) }}" aria-label="开始时间" data-keep-date-input @disabled(! $canEdit)>
|
||||
<button class="keep-task-date-trigger" type="button" aria-label="选择开始时间" title="选择开始日期" data-keep-date-trigger @disabled(! $canEdit)>
|
||||
<span class="material-icons-outlined" aria-hidden="true">calendar_today</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="keep-task-date-control{{ $row->todo_completed_at ? '' : ' is-empty' }}" data-keep-date-control>
|
||||
<input class="keep-task-input keep-task-date-input" form="keep-task-form-{{ $loop->index }}" type="date" name="completed_at" value="{{ $dateValue($row->todo_completed_at) }}" aria-label="完成时间" data-keep-date-input @disabled(! $canEdit)>
|
||||
<button class="keep-task-date-trigger" type="button" aria-label="选择完成时间" title="选择完成日期" data-keep-date-trigger @disabled(! $canEdit)>
|
||||
<span class="material-icons-outlined" aria-hidden="true">calendar_today</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="keep-task-progress">
|
||||
<select class="keep-task-input" form="keep-task-form-{{ $loop->index }}" name="current_progress" aria-label="当前进度" @disabled(! $canEdit)>
|
||||
@ -266,7 +328,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="13" class="keep-task-empty">当前没有需要处理的不保留账户</td></tr>
|
||||
<tr><td colspan="14" class="keep-task-empty">当前没有需要处理的不保留账户</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
@ -295,12 +357,34 @@
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<script>
|
||||
(() => {
|
||||
document.querySelectorAll('[data-keep-date-control]').forEach((control) => {
|
||||
const input = control.querySelector('[data-keep-date-input]');
|
||||
const trigger = control.querySelector('[data-keep-date-trigger]');
|
||||
if (!input) return;
|
||||
const syncEmptyState = () => control.classList.toggle('is-empty', !input.value);
|
||||
trigger?.addEventListener('click', () => {
|
||||
try {
|
||||
input.showPicker();
|
||||
} catch {
|
||||
input.focus();
|
||||
}
|
||||
});
|
||||
input.addEventListener('input', syncEmptyState);
|
||||
input.addEventListener('change', syncEmptyState);
|
||||
syncEmptyState();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(() => {
|
||||
const table = document.querySelector('[data-keep-table]');
|
||||
if (!table) return;
|
||||
const headers = [...table.querySelectorAll('thead th[data-keep-column-key]')];
|
||||
const headers = [...table.querySelectorAll('thead th[data-ledger-header-field]')];
|
||||
if (headers.length === 0) return;
|
||||
const columnKey = (header) => header.dataset.keepColumnKey || header.dataset.ledgerHeaderField;
|
||||
|
||||
const storageKey = table.dataset.columnStorageKey || 'caiwu.financial-ledger.unretained-columns';
|
||||
const minimumWidth = 56;
|
||||
@ -309,6 +393,7 @@
|
||||
const keepColumnDefaultWidths = Object.freeze({
|
||||
company_name: 170,
|
||||
account_short: 92,
|
||||
legal_representative: 90,
|
||||
account_type: 72,
|
||||
account_status: 78,
|
||||
account_no: 180,
|
||||
@ -322,7 +407,7 @@
|
||||
current_progress: 130,
|
||||
});
|
||||
const defaults = new Map(headers.map((header) => {
|
||||
const key = header.dataset.keepColumnKey;
|
||||
const key = columnKey(header);
|
||||
return [key, clampWidth(keepColumnDefaultWidths[key] ?? 120)];
|
||||
}));
|
||||
const widths = new Map(defaults);
|
||||
@ -340,7 +425,7 @@
|
||||
group.dataset.keepColumnGroup = 'true';
|
||||
headers.forEach((header) => {
|
||||
const column = document.createElement('col');
|
||||
column.dataset.keepColumnKey = header.dataset.keepColumnKey;
|
||||
column.dataset.keepColumnKey = columnKey(header);
|
||||
group.appendChild(column);
|
||||
});
|
||||
table.insertBefore(group, table.firstChild);
|
||||
@ -348,7 +433,7 @@
|
||||
const applyWidths = () => {
|
||||
let totalWidth = 0;
|
||||
headers.forEach((header) => {
|
||||
const key = header.dataset.keepColumnKey;
|
||||
const key = columnKey(header);
|
||||
const width = clampWidth(widths.get(key) ?? defaults.get(key));
|
||||
const column = group.querySelector('col[data-keep-column-key="' + key + '"]');
|
||||
if (column) column.style.width = width + 'px';
|
||||
@ -370,9 +455,9 @@
|
||||
};
|
||||
|
||||
headers.forEach((header) => {
|
||||
const key = header.dataset.keepColumnKey;
|
||||
const link = header.querySelector('.keep-task-sort');
|
||||
const label = (link?.firstChild?.textContent || header.textContent).trim() || '未命名字段';
|
||||
const key = columnKey(header);
|
||||
const labelNode = header.querySelector('.ledger-header-label');
|
||||
const label = (labelNode?.textContent || header.textContent).trim() || '未命名字段';
|
||||
const resizer = document.createElement('span');
|
||||
resizer.className = 'keep-column-resizer';
|
||||
resizer.dataset.keepColumnResizer = 'true';
|
||||
|
||||
@ -4,7 +4,9 @@ namespace Tests\Feature\Business;
|
||||
|
||||
use App\Models\Auth\Permission;
|
||||
use App\Models\Auth\Role;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Tests\Feature\FeatureTestCase;
|
||||
|
||||
class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
@ -16,6 +18,15 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
$this->user->attachPermission(
|
||||
Permission::where('name', 'read-admin-panel')->firstOrFail()
|
||||
);
|
||||
|
||||
$schema = Schema::connection('business_mirror');
|
||||
if (! $schema->hasTable('ops_fys_company_info')) {
|
||||
$schema->create('ops_fys_company_info', function (Blueprint $table): void {
|
||||
$table->integer('Id')->primary();
|
||||
$table->string('businessLicenseName')->nullable();
|
||||
$table->string('legalRepresentative')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function ledgerUrl(): string
|
||||
@ -130,6 +141,23 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
'status' => 'limited',
|
||||
'updated_by' => 'Test User',
|
||||
]);
|
||||
$connection->table('ops_fys_company_info')->insert([
|
||||
[
|
||||
'Id' => 1,
|
||||
'businessLicenseName' => '展示测试公司甲',
|
||||
'legalRepresentative' => '旧法人甲',
|
||||
],
|
||||
[
|
||||
'Id' => 2,
|
||||
'businessLicenseName' => '展示测试公司甲',
|
||||
'legalRepresentative' => '展示法人甲',
|
||||
],
|
||||
[
|
||||
'Id' => 3,
|
||||
'businessLicenseName' => '展示测试公司乙',
|
||||
'legalRepresentative' => '展示法人乙',
|
||||
],
|
||||
]);
|
||||
|
||||
$response = $this->loginAs()->get($this->keepTasksUrl())->assertOk();
|
||||
$content = $response->getContent();
|
||||
@ -139,6 +167,10 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
->assertSee('不与其他页面的待办事项合并')
|
||||
->assertSee('data-keep-account="显式不保留账户"', false)
|
||||
->assertSee('data-keep-account="规划不保留账户"', false)
|
||||
->assertSee('法人名称')
|
||||
->assertSee('展示法人甲')
|
||||
->assertSee('展示法人乙')
|
||||
->assertDontSee('旧法人甲')
|
||||
->assertDontSee('data-keep-account="明确保留账户"', false)
|
||||
->assertDontSee('data-keep-account="规划保留账户"', false)
|
||||
->assertSee('name="keep_short"', false)
|
||||
@ -147,10 +179,21 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
->assertSee('name="keep_method"', false)
|
||||
->assertSee('name="keep_owner"', false)
|
||||
->assertSee('name="keep_progress"', false)
|
||||
->assertSee('按开始时间排序')
|
||||
->assertSee('按完成时间排序')
|
||||
->assertSee('开始时间排序和筛选')
|
||||
->assertSee('完成时间排序和筛选')
|
||||
->assertSee('线上')
|
||||
->assertSee('线下')
|
||||
->assertSee('玉兔')
|
||||
->assertSee('山时')
|
||||
->assertSee('aria-label="责任人员"', false)
|
||||
->assertSee('aria-label="开始时间"', false)
|
||||
->assertSee('aria-label="完成时间"', false)
|
||||
->assertSee('type="date" name="started_at"', false)
|
||||
->assertSee('type="date" name="completed_at"', false)
|
||||
->assertSee('data-ledger-header-searchable-filter', false)
|
||||
->assertSee('list="ledger-header-options-keep-account_short"', false)
|
||||
->assertSee('name="keep_filter_column"', false)
|
||||
->assertSee('name="keep_filter_value"', false)
|
||||
->assertSee('已完成')
|
||||
->assertSee('进行中')
|
||||
->assertSee('待开始')
|
||||
@ -163,10 +206,11 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
->assertSee('history.replaceState', false)
|
||||
->assertSee('nextWrap.scrollTop = scrollTop', false);
|
||||
|
||||
preg_match_all('/<th data-keep-column-key="([^"]+)"/u', $content, $matches);
|
||||
preg_match_all('/data-ledger-header-field="([^"]+)"/u', $content, $matches);
|
||||
$this->assertSame([
|
||||
'company_name',
|
||||
'account_short',
|
||||
'legal_representative',
|
||||
'account_type',
|
||||
'account_status',
|
||||
'account_no',
|
||||
@ -181,6 +225,85 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
], $matches[1]);
|
||||
}
|
||||
|
||||
public function test_keep_tasks_header_filters_apply_with_typeahead_options(): void
|
||||
{
|
||||
$connection = DB::connection('business_mirror');
|
||||
$connection->table('fin_accounts')->insert([
|
||||
[
|
||||
'company_name' => '表头筛选公司甲',
|
||||
'account_short' => '表头筛选甲',
|
||||
'account_type' => '公户',
|
||||
'company_plan' => '保留',
|
||||
'account_should_keep' => '否',
|
||||
],
|
||||
[
|
||||
'company_name' => '表头筛选公司乙',
|
||||
'account_short' => '表头筛选乙',
|
||||
'account_type' => '个人卡',
|
||||
'company_plan' => '待注销',
|
||||
'account_should_keep' => null,
|
||||
],
|
||||
]);
|
||||
$connection->table('fin_account_statuses')->insert([
|
||||
'account_short' => '表头筛选甲',
|
||||
'status' => 'limited',
|
||||
'updated_by' => 'Test User',
|
||||
]);
|
||||
$connection->table('fin_account_keep_todos')->insert([
|
||||
[
|
||||
'account_short' => '表头筛选甲',
|
||||
'handling_method' => 'online',
|
||||
'owner_name' => '玉兔',
|
||||
'started_at' => '2026-10-21 00:00:00',
|
||||
'current_progress' => 'in_progress',
|
||||
],
|
||||
[
|
||||
'account_short' => '表头筛选乙',
|
||||
'handling_method' => 'offline',
|
||||
'owner_name' => '山时',
|
||||
'started_at' => '2026-10-22 00:00:00',
|
||||
'current_progress' => 'not_started',
|
||||
],
|
||||
]);
|
||||
$connection->table('ops_fys_company_info')->insert([
|
||||
[
|
||||
'Id' => 11,
|
||||
'businessLicenseName' => '表头筛选公司甲',
|
||||
'legalRepresentative' => '表头法人甲',
|
||||
],
|
||||
[
|
||||
'Id' => 12,
|
||||
'businessLicenseName' => '表头筛选公司乙',
|
||||
'legalRepresentative' => '表头法人乙',
|
||||
],
|
||||
]);
|
||||
|
||||
$accountFiltered = $this->loginAs()->get($this->keepTasksUrl([
|
||||
'keep_filter_column' => 'account_short',
|
||||
'keep_filter_value' => '表头筛选甲',
|
||||
]))->assertOk()
|
||||
->assertSee('data-keep-account="表头筛选甲"', false)
|
||||
->assertDontSee('data-keep-account="表头筛选乙"', false)
|
||||
->assertSee('ledger-header-cell', false)
|
||||
->assertSee('is-filtered', false);
|
||||
|
||||
$accountFiltered->assertSee('<option value="表头筛选乙"', false);
|
||||
|
||||
$this->loginAs()->get($this->keepTasksUrl([
|
||||
'keep_filter_column' => 'legal_representative',
|
||||
'keep_filter_value' => '表头法人乙',
|
||||
]))->assertOk()
|
||||
->assertSee('data-keep-account="表头筛选乙"', false)
|
||||
->assertDontSee('data-keep-account="表头筛选甲"', false);
|
||||
|
||||
$this->loginAs()->get($this->keepTasksUrl([
|
||||
'keep_filter_column' => 'started_at',
|
||||
'keep_filter_value' => '2026-10-21',
|
||||
]))->assertOk()
|
||||
->assertSee('data-keep-account="表头筛选甲"', false)
|
||||
->assertDontSee('data-keep-account="表头筛选乙"', false);
|
||||
}
|
||||
|
||||
public function test_keep_tasks_filters_sort_and_ajax_pagination_work(): void
|
||||
{
|
||||
$connection = DB::connection('business_mirror');
|
||||
@ -209,14 +332,14 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
[
|
||||
'account_short' => '筛选账户甲',
|
||||
'handling_method' => 'online',
|
||||
'owner_name' => '甲负责人',
|
||||
'owner_name' => '玉兔',
|
||||
'started_at' => '2026-10-21 09:00:00',
|
||||
'current_progress' => 'in_progress',
|
||||
],
|
||||
[
|
||||
'account_short' => '筛选账户乙',
|
||||
'handling_method' => 'offline',
|
||||
'owner_name' => '乙负责人',
|
||||
'owner_name' => '山时',
|
||||
'started_at' => '2026-10-22 09:00:00',
|
||||
'current_progress' => 'not_started',
|
||||
],
|
||||
@ -227,7 +350,7 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
'keep_type' => '公户',
|
||||
'keep_status' => 'limited',
|
||||
'keep_method' => 'online',
|
||||
'keep_owner' => '甲负责人',
|
||||
'keep_owner' => '玉兔',
|
||||
'keep_progress' => 'in_progress',
|
||||
]))
|
||||
->assertOk()
|
||||
@ -292,7 +415,7 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
$payload = [
|
||||
'account_short' => '待办不保留账户',
|
||||
'handling_method' => 'online',
|
||||
'owner_name' => '待办负责人',
|
||||
'owner_name' => '玉兔',
|
||||
'started_at' => '2026-10-21T09:00',
|
||||
'completed_at' => '2026-10-21T11:30',
|
||||
'current_progress' => 'in_progress',
|
||||
@ -302,7 +425,7 @@ class FinanceLedgerAccountKeepTodoTest extends FeatureTestCase
|
||||
$this->assertDatabaseHas('fin_account_keep_todos', [
|
||||
'account_short' => '待办不保留账户',
|
||||
'handling_method' => 'online',
|
||||
'owner_name' => '待办负责人',
|
||||
'owner_name' => '玉兔',
|
||||
'current_progress' => 'in_progress',
|
||||
'updated_by' => 'Test User',
|
||||
], 'business_mirror');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user