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