@@ -188,13 +188,29 @@
@php
+ $cleanSectionLabel = static function (?string $value): string {
+ return trim((string) preg_replace(
+ '/^\s*(?:\d+|[一二三四五六七八九十百]+)\s*[、..::)]\s*/u',
+ '',
+ (string) $value,
+ ));
+ };
+ $sectionLabels = $items
+ ->map(static fn ($groupItem): string => $cleanSectionLabel($groupItem->section))
+ ->all();
+ $groupValues = [
+ 'category' => $items->map(static fn ($groupItem): string => trim((string) ($groupItem->category ?? '')))->all(),
+ 'section' => $items->map(static fn ($groupItem, int $index): string => trim((string) ($groupItem->category ?? ''))
+ . "\0"
+ . ($sectionLabels[$index] ?? ''))->all(),
+ ];
$groupRowspans = ['category' => [], 'section' => []];
foreach (['category', 'section'] as $groupField) {
$start = 0;
$previous = null;
$count = 0;
foreach ($items as $index => $groupItem) {
- $current = trim((string) ($groupItem->{$groupField} ?? ''));
+ $current = (string) ($groupValues[$groupField][$index] ?? '');
if ($index === 0) {
$start = 0;
$previous = $current;
@@ -221,13 +237,14 @@
}
}
$lastItem = $items->last();
+ $lastSectionLabel = $items->isNotEmpty() ? ($sectionLabels[$items->count() - 1] ?? '') : '';
@endphp
- | 序号 | 类型 | 内容 | 待办事项 | 总负责人 | 责任人 |
+ 类型 | 内容 | 序号 | 待办事项 | 总负责人 | 责任人 |
开始时间 | 完成时间 | 状态 | 完成情况 | 完成截图 | 备注 | 操作 |
@@ -246,7 +263,7 @@
$todoPayload = [
'id' => $item->id,
'category' => $item->category ?? '',
- 'section' => $item->section ?? '',
+ 'section' => $sectionLabels[$loop->index] ?? '',
'title' => $item->title,
'owner' => $item->owner ?? '',
'assignee' => $item->assignee ?? '',
@@ -270,15 +287,15 @@
$sectionSpan = $groupRowspans['section'][$loop->index] ?? 1;
@endphp
- | {{ $items->firstItem() + $loop->index }} |
@if ($categorySpan !== 0)
1) rowspan="{{ $categorySpan }}" @endif>{{ $item->category ?: '—' }} |
@endif
@if ($sectionSpan !== 0)
1) rowspan="{{ $sectionSpan }}" @endif>
- {{ $item->section ?: '—' }}
+ {{ $sectionLabels[$loop->index] ?: '—' }}
|
@endif
+ {{ $items->firstItem() + $loop->index }} |
{{ $item->title }} |
{{ $item->owner ?: '—' }} |
{{ $item->assignee ?: '—' }} |
@@ -329,10 +346,10 @@
- 点击表内任意事项可直接编辑;表格在框内滚动,表头、序号和操作列保持可见。
+ 点击表内任意事项可直接编辑;表格在框内滚动,表头和操作列保持可见。
@@ -407,7 +424,7 @@
-
+