fix(client): 财务汇总下拉候选改全量往来单位并修占位叠词与表头垂直居中(验收反馈)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-07-14 13:10:11 +08:00
parent 4bd083f2eb
commit 94a5f437a5
7 changed files with 174 additions and 139 deletions
+40 -12
View File
@@ -77,6 +77,9 @@ class _FakeFinanceRepository extends FinanceRepository {
Future<List<TrendPoint>> trend({int months = 6}) async => const [];
}
/// 第 4 条「未挂账供应商」故意不出现在 partnerSummary() 里,用于验证下拉
/// 候选=全量往来单位(而非只列汇总行里出现的单位):选中它后汇总应展示
/// 既有「没有匹配的往来单位」空态。
class _FakeAllPartners extends PartnerListNotifier {
@override
Future<PageResult<Partner>> build() async => const PageResult(
@@ -84,8 +87,9 @@ class _FakeAllPartners extends PartnerListNotifier {
Partner(id: 1, name: '华东酒类批发', type: 'customer'),
Partner(id: 2, name: '金樽商贸', type: 'customer'),
Partner(id: 3, name: '茅台华南经销', type: 'supplier'),
Partner(id: 4, name: '未挂账供应商', type: 'supplier'),
],
total: 3,
total: 4,
page: 1,
pageSize: 1000,
);
@@ -94,10 +98,10 @@ class _FakeAllPartners extends PartnerListNotifier {
List<Override> _overrides() => [
financeRepositoryProvider.overrideWith((ref) => _FakeFinanceRepository()),
allPartnersProvider.overrideWith(() => _FakeAllPartners()),
stockOutSummaryProvider.overrideWith(
(ref) async => const StockSummary(monthAmount: 0, lastMonthAmount: 0)),
stockInSummaryProvider.overrideWith(
(ref) async => const StockSummary(monthAmount: 0, lastMonthAmount: 0)),
stockOutSummaryProvider.overrideWith((ref) async =>
const StockSummary(monthAmount: 0, lastMonthAmount: 0)),
stockInSummaryProvider.overrideWith((ref) async =>
const StockSummary(monthAmount: 0, lastMonthAmount: 0)),
isReadonlyProvider.overrideWithValue(false),
];
@@ -134,13 +138,13 @@ void main() {
expect(find.text('金樽商贸'), findsOneWidget);
expect(find.text('茅台华南经销'), findsOneWidget);
// 定位表头内嵌的 ComboSearchField(按构造参数 hint 匹配,避免
// _flowTable toolbar 的往来单位 ComboSearchField(hint:'往来单位')
// 混淆;选中后触发器文案会变成往来单位名,故不能用显示文字定位)。
final combo = find.byWidgetPredicate(
(w) => w is ComboSearchField && w.hint == '搜索往来单位',
);
expect(combo, findsOneWidget);
// 定位表头内嵌的 ComboSearchField:验收反馈后候选/占位文案
// _flowTable toolbar 的往来单位 ComboSearchField 完全同款(同为
// hint:'往来单位'),不能再靠 hint/显示文字区分;改用构建顺序——
// 汇总表(_summaryTable)先于流水表(_flowTable)出现在页面里,
// 故 ComboSearchField 的第一个即汇总表头这个。
final combo = find.byType(ComboSearchField).first;
expect(find.byType(ComboSearchField), findsNWidgets(2));
await tester.ensureVisible(combo);
await tester.pumpAndSettle();
@@ -168,6 +172,30 @@ void main() {
expect(find.text('金樽商贸'), findsOneWidget);
expect(find.text('茅台华南经销'), findsOneWidget);
});
testWidgets('候选=全量往来单位;选中汇总里没有行的单位显示空态', (tester) async {
await _pumpFinance(tester, size: const Size(1280, 900));
final combo = find.byType(ComboSearchField).first;
await tester.ensureVisible(combo);
await tester.pumpAndSettle();
await tester.tap(combo);
await tester.pumpAndSettle();
// 候选来自全量往来单位(4 条,含汇总里没有余额行的「未挂账供应商」),
// 而不再是「共 3 条结果」(旧口径=当前汇总行往来单位)。
expect(find.text('共 4 条结果'), findsOneWidget);
expect(find.widgetWithText(InkWell, '未挂账供应商'), findsOneWidget);
await tester.tap(find.widgetWithText(InkWell, '未挂账供应商'));
await tester.pumpAndSettle();
// 该单位在汇总里没有余额行 → 走既有「没有匹配的往来单位」空态。
expect(find.text('没有匹配的往来单位'), findsOneWidget);
expect(find.text('华东酒类批发'), findsNothing);
expect(find.text('金樽商贸'), findsNothing);
expect(find.text('茅台华南经销'), findsNothing);
});
});
group('移动应收/应付分段往来单位搜索', () {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 KiB

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 KiB

After

Width:  |  Height:  |  Size: 283 KiB