|
|
@@ -55,6 +55,9 @@ class _ExpenseCreatePageState extends ConsumerState<ExpenseCreatePage> {
|
|
|
bool _refDataLoading = true;
|
|
|
bool _addingDetail = false;
|
|
|
|
|
|
+ // ── 已导入申请单号集合,用于申请事由去重拼接 ──
|
|
|
+ final _importedAeNos = <String>{};
|
|
|
+
|
|
|
// ── 报销部门 ──
|
|
|
String _selectedDeptId = '';
|
|
|
String _selectedDeptName = '';
|
|
|
@@ -434,6 +437,26 @@ class _ExpenseCreatePageState extends ConsumerState<ExpenseCreatePage> {
|
|
|
for (final aeNo in aeNos) {
|
|
|
controller.removeDetailsByAeNo(aeNo);
|
|
|
}
|
|
|
+ // 拼接申请事由到报销单头 purpose(同张单多次转入只拼一次)
|
|
|
+ final newReasons = <String>[];
|
|
|
+ for (final aeNo in aeNos) {
|
|
|
+ if (!_importedAeNos.contains(aeNo)) {
|
|
|
+ final item = result.firstWhere((e) => e.aeNo == aeNo);
|
|
|
+ if (item.reason.isNotEmpty) {
|
|
|
+ newReasons.add(item.reason);
|
|
|
+ _importedAeNos.add(aeNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (newReasons.isNotEmpty) {
|
|
|
+ final currentPurpose = controller.currentState.expense.purpose;
|
|
|
+ final joined = newReasons.join(';');
|
|
|
+ final newPurpose = currentPurpose.isNotEmpty
|
|
|
+ ? '$currentPurpose;$joined'
|
|
|
+ : joined;
|
|
|
+ controller.updatePurpose(newPurpose);
|
|
|
+ _purposeController.text = newPurpose;
|
|
|
+ }
|
|
|
final now = DateTime.now();
|
|
|
for (final item in result) {
|
|
|
controller.addDetail(
|
|
|
@@ -1292,8 +1315,7 @@ class _ExpenseCreatePageState extends ConsumerState<ExpenseCreatePage> {
|
|
|
state.expense.currencyCode.isNotEmpty ||
|
|
|
_remarkController.text.isNotEmpty ||
|
|
|
state.expense.details.isNotEmpty ||
|
|
|
- _attachmentController.files.isNotEmpty ||
|
|
|
- _selectedDeptId.isNotEmpty;
|
|
|
+ _attachmentController.files.isNotEmpty;
|
|
|
|
|
|
void _doPop() {
|
|
|
final l10n = AppLocalizations.of(context);
|