From 487008281c7ba87712a1647d09899383e12fa759 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 29 七月 2026 15:37:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/packages/@core/ui-kit/form-ui/src/form-api.ts | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/src/packages/@core/ui-kit/form-ui/src/form-api.ts b/src/packages/@core/ui-kit/form-ui/src/form-api.ts
index e1f92f4..862d164 100644
--- a/src/packages/@core/ui-kit/form-ui/src/form-api.ts
+++ b/src/packages/@core/ui-kit/form-ui/src/form-api.ts
@@ -7,13 +7,13 @@
import type { ComponentPublicInstance } from 'vue';
-import type { Recordable } from '..\..\..\base\typings\src';
+import type { Recordable } from '../../../base/typings/src';
import type { FormActions, FormSchema, VbenFormProps } from './types';
import { isRef, toRaw } from 'vue';
-import { Store } from '..\..\..\base\shared\src\store';
+import { Store } from '../../../base/shared/src/store';
import {
bindMethods,
cloneDeep,
@@ -27,7 +27,7 @@
mergeWithArrayOverride,
set,
StateHandler,
-} from '..\..\..\base\shared\src\utils';
+} from '../../../base/shared/src/utils';
import { resolveFieldNamePath } from './field-name';
@@ -166,7 +166,54 @@
const values = form.values
? this.handleRangeTimeValue(cloneDeep(toRaw(form.values)))
: {};
- return this.handleValueFormat(values) as T;
+ const result = this.handleValueFormat(values);
+ // 鑷姩鎻愬彇 FileUpload/Upload 瀛楁涓殑鏂囦欢 ID锛岄伩鍏嶆彁浜ゆ椂鎼哄甫瀹屾暣鏂囦欢瀵硅薄
+ const currentSchema = this.state?.schema ?? [];
+ for (const schema of currentSchema) {
+ // 鍏煎瀛楃涓茬被鍨嬪拰宸茶В鏋愮殑 Vue Component 瀵硅薄
+ const compName: string =
+ typeof schema.component === 'string'
+ ? schema.component
+ : (schema.component as any)?.name ?? '';
+ if (compName !== 'FileUpload' && compName !== 'Upload') {
+ continue;
+ }
+ if (schema.valueFormat) continue;
+ const fieldName = schema.fieldName;
+ const rawValue = result[fieldName];
+ if (
+ rawValue == null ||
+ !Array.isArray(rawValue) ||
+ rawValue.length === 0
+ ) {
+ continue;
+ }
+ if (
+ typeof rawValue[0] !== 'object' ||
+ !('status' in rawValue[0])
+ ) {
+ continue;
+ }
+ const props = (schema.componentProps || {}) as Record<string, any>;
+ const valueKey = props.valueKey || 'url';
+ const maxNumber = props.maxNumber ?? 1;
+ const resultField = props.resultField;
+ const valuePrefix = props.valuePrefix || '';
+ const list = rawValue
+ .filter((item: any) => item?.status === 'done')
+ .map((item: any) => {
+ if (resultField && item?.response) return item.response;
+ const v =
+ item?.response?.[valueKey] ??
+ item?.[valueKey] ??
+ item?.url ??
+ item?.response?.url ??
+ item?.response;
+ return valuePrefix ? `${valuePrefix}${v}` : v;
+ });
+ result[fieldName] = maxNumber === 1 ? (list[0] ?? '') : list;
+ }
+ return result as T;
}
async isFieldValid(fieldName: string) {
--
Gitblit v1.9.3