amis-saas-6026 整合提交方式和上传方式

Change-Id: I397ba77bab7d3a158f44f9b576643e1d960d57ce
This commit is contained in:
liujintao03 2022-08-18 21:05:08 +08:00
parent 7d3bfa799d
commit 3b88018819

View File

@ -168,54 +168,47 @@ export class FileControlPlugin extends BasePlugin {
}
]
},
{
label: '提交方式',
name: 'submitType',
type: 'select',
tiled: true,
value: 'asUpload',
getSchemaTpl('uploadType', {
options: [
{
label: '随表单提交',
value: 'asForm'
},
{
label: '独立上传',
value: 'asUpload'
label: '文件接收器',
value: 'fileReceptor'
},
{
label: '对象存储',
value: 'bos'
}
],
pipeIn: (value: any, form: any) => value || 'asUpload',
pipeOut: (value: any, form: any) => value || 'asUpload',
pipeIn: (value: any, form: any) => value || 'fileReceptor',
pipeOut: (value: any, form: any) => value || 'fileReceptor',
onChange: (
value: any,
oldValue: boolean,
model: any,
form: any
) => {
if (value === 'asUpload') {
form.setValueByName('asBase64', false);
form.setValueByName('asBlob', false);
} else if (value === 'asForm') {
if (value === 'asForm') {
// 作为表单数据,自动上传开启
form.setValueByName('autoUpload', true);
const formType =
form.getValueByName('formType') || 'asBlob';
form.setValueByName(formType, true);
} else {
form.setValueByName('asBase64', false);
form.setValueByName('asBlob', false);
}
}
},
getSchemaTpl('uploadType', {
visibleOn: 'data.submitType === "asUpload" || !data.submitType',
pipeIn: (value: any, form: any) => value || 'fileReceptor',
pipeOut: (value: any, form: any) => value || 'fileReceptor'
}),
{
name: 'formType',
type: 'select',
tiled: true,
visibleOn: 'data.submitType === "asForm"',
visibleOn: 'data.uploadType === "asForm"',
value: 'asBlob',
label: tipedLabel(
'数据格式',
@ -244,20 +237,19 @@ export class FileControlPlugin extends BasePlugin {
},
getSchemaTpl('bos', {
visibleOn:
'(data.submitType === "asUpload" || !data.submitType) && data.uploadType === "bos"'
visibleOn: 'data.uploadType === "bos"'
}),
getSchemaTpl('proxy', {
value: false,
visibleOn: 'data.submitType === "asUpload" || !data.submitType'
visibleOn: 'data.uploadType !== "asForm" || !data.uploadType'
}),
getSchemaTpl('switch', {
name: 'autoUpload',
label: '自动上传',
value: true,
visibleOn: 'data.submitType === "asUpload"'
visibleOn: 'data.uploadType !== "asForm"'
}),
getSchemaTpl('switch', {
@ -265,14 +257,14 @@ export class FileControlPlugin extends BasePlugin {
label: '开启分块',
value: false,
pipeIn: (value: any, form: any) => !!value, // 兼容auto
visibleOn: 'data.submitType == "asUpload"'
visibleOn: 'data.uploadType !== "asForm"'
}),
{
type: 'container',
className: 'ae-ExtendMore mb-3',
visibleOn:
'data.submitType === "asUpload" && data.useChunk != false',
'data.uploadType !== "asForm" && data.useChunk != false',
body: [
{
type: 'input-group',
@ -293,7 +285,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'Container',
visibleOn:
'data.submitType === "asUpload" && data.uploadType == "fileReceptor" && data.useChunk != false',
'data.uploadType == "fileReceptor" && data.useChunk != false',
body: [
getSchemaTpl('apiControl', {
name: 'startChunkApi',
@ -333,7 +325,7 @@ export class FileControlPlugin extends BasePlugin {
value: '/api/upload/file',
__isUpload: true,
visibleOn:
'data.submitType === "asUpload" && data.uploadType === "fileReceptor" && !data.useChunk'
'data.uploadType === "fileReceptor" && !data.useChunk'
}),
{
type: 'input-text',