1
0

fix(web): 修复文件无法移除

This commit is contained in:
2024-11-27 11:11:00 +08:00
parent d72ebfd1d1
commit 70d5a4549f
6 changed files with 91 additions and 96 deletions

View File

@@ -211,11 +211,11 @@ export const formInputClearable = {
clearValueOnEmpty: true,
}
export function formInputFileStatic(field) {
export function formInputFileStatic(field, label) {
return {
visibleOn: '${detail}',
type: 'input-table',
label: '相关材料',
label: label,
name: field,
required: true,
resizable: false,

View File

@@ -43,7 +43,7 @@ function detailForm() {
name: 'description',
...formInputClearable,
},
formInputFileStatic('evidenceIds'),
formInputFileStatic('evidenceIds', '相关材料'),
{
visibleOn: '${!detail}',
type: 'input-file',

View File

@@ -3,35 +3,16 @@ import {
apiGet,
apiPost,
formInputClearable,
formInputFileStatic,
horizontalFormOptions,
inputFileFormItemCommonOptions,
size1GB,
size500MB
} from "../constants.js";
function inputFileFormItemUpdateFieldOptions(target) {
let value = {}
value[target] = '${event.data.value}'
return {
onEvent: {
success: {
actions: [
{
actionType: 'setValue',
componentId: 'resource_data_form',
args: {
value: value
}
}
]
}
}
}
}
function detailForm() {
return {
id: 'resource_data_form',
debug: true,
type: 'form',
...horizontalFormOptions(),
horizontal: {
@@ -106,22 +87,19 @@ function detailForm() {
visibleOn: "${resourceType === 'FILE'}",
type: 'fieldSet',
body: [
formInputFileStatic('file', '数据文件'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: '数据文件',
description: '只适合小于1GB的资源文件使用大文件请使用其他资源类型',
name: 'filename',
name: 'file',
multiple: false,
required: true,
...inputFileFormItemCommonOptions('.zip', size1GB),
...inputFileFormItemUpdateFieldOptions('fileId'),
},
{
visibleOn: "${detail}",
type: 'input-text',
label: '文件名称',
name: 'filename',
autoFill: {
fileId: '${value}'
}
},
]
},
@@ -165,35 +143,29 @@ function detailForm() {
visibleOn: "${resourceType === 'HDFS'}",
type: 'fieldSet',
body: [
formInputFileStatic('coreSiteFile', 'core-site.xml'),
{
visibleOn: "${!static}",
visibleOn: "${!detail}",
type: 'input-file',
label: 'core-site.xml',
name: 'coreSiteFilename',
name: 'coreSiteFile',
required: true,
...inputFileFormItemCommonOptions('.xml'),
...inputFileFormItemUpdateFieldOptions('coreSiteFileId'),
autoFill: {
coreSiteFileId: '${value}'
}
},
formInputFileStatic('hdfsSiteFile', 'hdfs-site.xml'),
{
visibleOn: "${detail}",
type: 'input-text',
label: '文件名称',
name: 'coreSiteFilename',
},
{
visibleOn: "${!static}",
visibleOn: "${!detail}",
type: 'input-file',
label: 'hdfs-site.xml',
name: 'hdfsSiteFilename',
name: 'hdfsSiteFile',
required: true,
...inputFileFormItemCommonOptions('.xml'),
...inputFileFormItemUpdateFieldOptions('hdfsSiteFileId'),
},
{
visibleOn: "${detail}",
type: 'input-text',
label: '文件名称',
name: 'hdfsSiteFilename',
autoFill: {
hdfsSiteFileId: '${value}'
}
},
]
},
@@ -313,20 +285,17 @@ function detailForm() {
label: 'JSON格式',
language: 'json',
},
{
visibleOn: "${detail}",
type: 'input-text',
label: '资源示例',
name: 'exampleFilename',
},
formInputFileStatic('exampleFile', '资源示例'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: '资源示例',
name: 'exampleFilename',
name: 'exampleFile',
description: '可以上传用于作为格式示范的样例数据',
...inputFileFormItemCommonOptions(undefined, size500MB),
...inputFileFormItemUpdateFieldOptions('exampleFileId'),
autoFill: {
exampleFileId: '${value}'
}
},
]
}