Browse Source

[Fix][UI] Support only one file upload on the file manage page. (#10007)

3.1.0-release
Amy0104 3 years ago committed by GitHub
parent
commit
18bfe6399d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      dolphinscheduler-ui/src/views/resource/file/upload/index.tsx
  2. 1
      dolphinscheduler-ui/src/views/resource/file/upload/use-form.ts

16
dolphinscheduler-ui/src/views/resource/file/upload/index.tsx

@ -44,16 +44,24 @@ export default defineComponent({
const customRequest = ({ file }: any) => {
state.uploadForm.name = file.name
state.uploadForm.file = file.file
state.uploadFormNameRef.validate({
trigger: 'input'
})
}
const handleFile = () => {
handleUploadFile(ctx.emit, hideModal, resetForm)
}
const removeFile = () => {
state.uploadForm.name = ''
}
return {
hideModal,
customRequest,
handleFile,
removeFile,
...toRefs(state)
}
},
@ -70,7 +78,11 @@ export default defineComponent({
confirmLoading={this.saving}
>
<NForm rules={this.rules} ref='uploadFormRef'>
<NFormItem label={t('resource.file.file_name')} path='name'>
<NFormItem
label={t('resource.file.file_name')}
path='name'
ref='uploadFormNameRef'
>
<NInput
v-model={[this.uploadForm.name, 'value']}
placeholder={t('resource.file.enter_name_tips')}
@ -90,6 +102,8 @@ export default defineComponent({
v-model={[this.uploadForm.file, 'value']}
customRequest={this.customRequest}
class='btn-upload'
max={1}
onRemove={this.removeFile}
>
<NButton>{t('resource.file.upload_files')}</NButton>
</NUpload>

1
dolphinscheduler-ui/src/views/resource/file/upload/use-form.ts

@ -36,6 +36,7 @@ export function useForm() {
const state = reactive({
uploadFormRef: ref(),
uploadFormNameRef: ref(),
uploadForm: defaultValue(),
saving: false,
rules: {

Loading…
Cancel
Save