feat(web): 实现任务显示文件列表
This commit is contained in:
@@ -107,7 +107,7 @@ const FlowTask: React.FC = () => {
|
||||
return {
|
||||
...payload,
|
||||
data: {
|
||||
...generateInputForm(payload.data, undefined, false),
|
||||
...generateInputForm(payload.data, undefined, false, true),
|
||||
id: 'db8a4d10-0c47-4e27-b1a4-d0f2e1c15992',
|
||||
initApi: {
|
||||
method: 'get',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type {Schema} from 'amis'
|
||||
import {commonInfo} from '../../../util/amis.tsx'
|
||||
import {commonInfo, formInputFileStaticColumns} from '../../../util/amis.tsx'
|
||||
|
||||
export const typeMap: Record<string, string> = {
|
||||
text: '文本',
|
||||
@@ -13,7 +13,7 @@ export type InputField = {
|
||||
description?: string
|
||||
}
|
||||
|
||||
export const generateInputForm: (inputSchema: Record<string, InputField>, title?: string, border?: boolean, staticView?: boolean) => Schema = (inputSchema, title, border) => {
|
||||
export const generateInputForm: (inputSchema: Record<string, InputField>, title?: string, border?: boolean, staticView?: boolean) => Schema = (inputSchema, title, border, staticView) => {
|
||||
let items: Schema[] = []
|
||||
for (const name of Object.keys(inputSchema)) {
|
||||
let field = inputSchema[name]
|
||||
@@ -34,18 +34,30 @@ export const generateInputForm: (inputSchema: Record<string, InputField>, title?
|
||||
commonMeta.type = 'input-number'
|
||||
break
|
||||
case 'files':
|
||||
items.push({
|
||||
...commonMeta,
|
||||
type: 'input-file',
|
||||
autoUpload: false,
|
||||
drag: true,
|
||||
multiple: true,
|
||||
joinValues: false,
|
||||
extractValue: true,
|
||||
accept: '*',
|
||||
maxSize: 104857600,
|
||||
receiver: `${commonInfo.baseAiUrl}/upload`,
|
||||
})
|
||||
if (staticView) {
|
||||
items.push({
|
||||
...commonMeta,
|
||||
type: 'control',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: `${commonInfo.baseAiUrl}/upload/detail?ids=\${JOIN(inputData.${name}, ',')}`,
|
||||
columns: formInputFileStaticColumns,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
items.push({
|
||||
...commonMeta,
|
||||
type: 'input-file',
|
||||
autoUpload: false,
|
||||
drag: true,
|
||||
multiple: true,
|
||||
joinValues: false,
|
||||
extractValue: true,
|
||||
accept: '*',
|
||||
maxSize: 104857600,
|
||||
receiver: `${commonInfo.baseAiUrl}/upload`,
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2519,7 +2519,7 @@ export function pictureFromIds(field: string) {
|
||||
return `\${ARRAYMAP(${field},id => '${commonInfo.baseAiUrl}/upload/download/' + id)}`
|
||||
}
|
||||
|
||||
const formInputFileStaticColumns = [
|
||||
export const formInputFileStaticColumns = [
|
||||
{
|
||||
name: 'filename',
|
||||
label: '文件名',
|
||||
|
||||
Reference in New Issue
Block a user