feat(web): 增加文件上传接口
This commit is contained in:
@@ -83,6 +83,14 @@ export function paginationTemplate(perPage = 20, maxButtons = 5) {
|
||||
}
|
||||
}
|
||||
|
||||
export function inputFileFormItemCommonOptions(accept = '*', maxSize = 5242880) {
|
||||
return {
|
||||
accept: accept,
|
||||
maxSize: maxSize,
|
||||
autoUpload: false,
|
||||
}
|
||||
}
|
||||
|
||||
export function copyField(field, tips = '复制', ignoreLength = 0, extra = undefined) {
|
||||
let tpl = ignoreLength === 0 ? `\${${field}}` : `\${TRUNCATE(${field}, ${ignoreLength})}`
|
||||
let content = extra
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import './dialog-resource.css'
|
||||
import {apiPost, horizontalFormOptions} from "../constants.js";
|
||||
import {apiPost, horizontalFormOptions, inputFileFormItemCommonOptions} from "../constants.js";
|
||||
|
||||
const clearable = {
|
||||
clearable: true,
|
||||
@@ -99,8 +99,8 @@ export function resourceAddDialog() {
|
||||
{
|
||||
type: 'input-file',
|
||||
name: 'filePath',
|
||||
accept: '.zip',
|
||||
description: '只适合小于2M的资源文件使用,大文件请使用其他资源类型',
|
||||
...inputFileFormItemCommonOptions('.zip', 2097152),
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -148,13 +148,13 @@ export function resourceAddDialog() {
|
||||
type: 'input-file',
|
||||
description: 'core-site.xml',
|
||||
name: 'coreSiteFile',
|
||||
accept: '.xml',
|
||||
...inputFileFormItemCommonOptions('.xml', 1048576),
|
||||
},
|
||||
{
|
||||
type: 'input-file',
|
||||
description: 'hdfs-site.xml',
|
||||
name: 'hdfsSiteFile',
|
||||
accept: '.xml',
|
||||
...inputFileFormItemCommonOptions('.xml', 1048576),
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -257,7 +257,7 @@ export function resourceAddDialog() {
|
||||
label: '资源示例',
|
||||
description: '可以上传用于作为格式示范的样例数据',
|
||||
name: 'example',
|
||||
accept: '*',
|
||||
...inputFileFormItemCommonOptions(),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user