feat(web): 完成数据资源编辑接口
This commit is contained in:
@@ -13,8 +13,29 @@ const clearable = {
|
||||
clearValueOnEmpty: true,
|
||||
}
|
||||
|
||||
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',
|
||||
type: 'form',
|
||||
...horizontalFormOptions(),
|
||||
horizontal: {
|
||||
@@ -90,22 +111,21 @@ function detailForm() {
|
||||
type: 'fieldSet',
|
||||
body: [
|
||||
{
|
||||
visibleOn: "${static}",
|
||||
type: 'input-text',
|
||||
label: '文件名称',
|
||||
name: 'fileId',
|
||||
},
|
||||
{
|
||||
visibleOn: "${!static}",
|
||||
visibleOn: "${!detail}",
|
||||
type: 'input-file',
|
||||
label: '数据文件',
|
||||
description: '只适合小于1GB的资源文件使用,大文件请使用其他资源类型',
|
||||
name: 'filename',
|
||||
multiple: false,
|
||||
required: true,
|
||||
...inputFileFormItemCommonOptions('.zip', size1GB),
|
||||
autoFill: {
|
||||
fileId: '${value|default:undefined}'
|
||||
}
|
||||
...inputFileFormItemUpdateFieldOptions('fileId'),
|
||||
},
|
||||
{
|
||||
visibleOn: "${detail}",
|
||||
type: 'input-text',
|
||||
label: '文件名称',
|
||||
name: 'filename',
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -149,12 +169,6 @@ function detailForm() {
|
||||
visibleOn: "${resourceType === 'HDFS'}",
|
||||
type: 'fieldSet',
|
||||
body: [
|
||||
{
|
||||
visibleOn: "${static}",
|
||||
type: 'input-text',
|
||||
label: '文件名称',
|
||||
name: 'coreSiteFileId',
|
||||
},
|
||||
{
|
||||
visibleOn: "${!static}",
|
||||
type: 'input-file',
|
||||
@@ -162,15 +176,13 @@ function detailForm() {
|
||||
name: 'coreSiteFilename',
|
||||
required: true,
|
||||
...inputFileFormItemCommonOptions('.xml'),
|
||||
autoFill: {
|
||||
coreSiteFileId: '${value|default:undefined}'
|
||||
}
|
||||
...inputFileFormItemUpdateFieldOptions('coreSiteFileId'),
|
||||
},
|
||||
{
|
||||
visibleOn: "${static}",
|
||||
visibleOn: "${detail}",
|
||||
type: 'input-text',
|
||||
label: '文件名称',
|
||||
name: 'hdfsSiteFileId',
|
||||
name: 'coreSiteFilename',
|
||||
},
|
||||
{
|
||||
visibleOn: "${!static}",
|
||||
@@ -179,9 +191,13 @@ function detailForm() {
|
||||
name: 'hdfsSiteFilename',
|
||||
required: true,
|
||||
...inputFileFormItemCommonOptions('.xml'),
|
||||
autoFill: {
|
||||
hdfsSiteFileId: '${value|default:undefined}'
|
||||
}
|
||||
...inputFileFormItemUpdateFieldOptions('hdfsSiteFileId'),
|
||||
},
|
||||
{
|
||||
visibleOn: "${detail}",
|
||||
type: 'input-text',
|
||||
label: '文件名称',
|
||||
name: 'hdfsSiteFilename',
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -246,14 +262,7 @@ function detailForm() {
|
||||
]
|
||||
},
|
||||
{
|
||||
visibleOn: "${formatType === 'JSON' && static}",
|
||||
type: 'editor',
|
||||
name: 'jsonSchemaText',
|
||||
label: 'JSON格式',
|
||||
language: 'json',
|
||||
},
|
||||
{
|
||||
visibleOn: "${formatType === 'JSON' && !static}",
|
||||
visibleOn: "${formatType === 'JSON' && !detail}",
|
||||
type: 'json-schema-editor',
|
||||
name: 'jsonSchema',
|
||||
label: 'JSON格式',
|
||||
@@ -263,14 +272,14 @@ function detailForm() {
|
||||
mini: true,
|
||||
},
|
||||
{
|
||||
visibleOn: "${formatType === 'JSON_LINE' && static}",
|
||||
visibleOn: "${formatType === 'JSON' && detail}",
|
||||
type: 'editor',
|
||||
name: 'jsonLineSchemaText',
|
||||
name: 'jsonSchemaText',
|
||||
label: 'JSON格式',
|
||||
language: 'json',
|
||||
},
|
||||
{
|
||||
visibleOn: "${formatType === 'JSON_LINE' && !static}",
|
||||
visibleOn: "${formatType === 'JSON_LINE' && !detail}",
|
||||
type: 'json-schema-editor',
|
||||
name: 'jsonLineSchema',
|
||||
label: 'JSON格式',
|
||||
@@ -280,14 +289,14 @@ function detailForm() {
|
||||
mini: true,
|
||||
},
|
||||
{
|
||||
visibleOn: "${formatType === 'CSV' && static}",
|
||||
visibleOn: "${formatType === 'JSON_LINE' && detail}",
|
||||
type: 'editor',
|
||||
name: 'csvSchemaText',
|
||||
name: 'jsonLineSchemaText',
|
||||
label: 'JSON格式',
|
||||
language: 'json',
|
||||
},
|
||||
{
|
||||
visibleOn: "${formatType === 'CSV' && !static}",
|
||||
visibleOn: "${formatType === 'CSV' && !detail}",
|
||||
type: 'json-schema-editor',
|
||||
name: 'csvSchema',
|
||||
label: 'CSV格式',
|
||||
@@ -302,21 +311,26 @@ function detailForm() {
|
||||
]
|
||||
},
|
||||
{
|
||||
visibleOn: "${static}",
|
||||
type: 'input-text',
|
||||
label: '资源示例',
|
||||
name: 'exampleFileId',
|
||||
visibleOn: "${formatType === 'CSV' && detail}",
|
||||
type: 'editor',
|
||||
name: 'csvSchemaText',
|
||||
label: 'JSON格式',
|
||||
language: 'json',
|
||||
},
|
||||
{
|
||||
visibleOn: "${!static}",
|
||||
visibleOn: "${detail}",
|
||||
type: 'input-text',
|
||||
label: '资源示例',
|
||||
name: 'exampleFilename',
|
||||
},
|
||||
{
|
||||
visibleOn: "${!detail}",
|
||||
type: 'input-file',
|
||||
label: '资源示例',
|
||||
name: 'exampleFilename',
|
||||
description: '可以上传用于作为格式示范的样例数据',
|
||||
...inputFileFormItemCommonOptions(undefined, size500MB),
|
||||
autoFill: {
|
||||
exampleFileId: '${value|default:undefined}'
|
||||
},
|
||||
...inputFileFormItemUpdateFieldOptions('exampleFileId'),
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -343,8 +357,10 @@ export function resourceAddDialog() {
|
||||
],
|
||||
body: {
|
||||
...detailForm(),
|
||||
debug: true,
|
||||
api: apiPost('${base}/data_resource/create'),
|
||||
api: apiPost('${base}/data_resource/save'),
|
||||
data: {
|
||||
add: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,7 +378,7 @@ export function resourceDetailDialog() {
|
||||
static: true,
|
||||
initApi: apiGet('${base}/data_resource/detail/${id}'),
|
||||
data: {
|
||||
static: true,
|
||||
detail: true,
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -388,9 +404,11 @@ export function resourceEditeDialog() {
|
||||
],
|
||||
body: {
|
||||
...detailForm(),
|
||||
debug: true,
|
||||
api: apiPost('${base}/data_resource/update'),
|
||||
api: apiPost('${base}/data_resource/save'),
|
||||
initApi: apiGet('${base}/data_resource/detail/${id}'),
|
||||
data: {
|
||||
edit: true,
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user