From 731e49d7b6fe37258b7c0d5894ce129b5a192c9c Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 6 Dec 2022 23:45:35 +0800 Subject: [PATCH] feat: add upload component --- .../resources/codegen/vue3/views/data.ts.vm | 11 ++ .../src/components/Form/src/componentMap.ts | 5 +- .../src/components/UploadFile/index.ts | 3 +- .../components/UploadFile/src/UploadFile.vue | 167 ++++++++++++++++++ .../components/UploadFile/src/UploadImg.vue | 70 ++++---- yudao-ui-admin-vue3/src/types/components.d.ts | 2 + .../views/system/oauth2/client/client.data.ts | 6 + .../src/views/system/oauth2/client/index.vue | 13 +- 8 files changed, 234 insertions(+), 43 deletions(-) create mode 100644 yudao-ui-admin-vue3/src/components/UploadFile/src/UploadFile.vue diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm index f01f73d74..623345830 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm @@ -77,6 +77,17 @@ const crudSchemas = reactive({ component: 'InputNumber', value: 0 }, + #elseif($column.htmlType == "imageUpload")## 图片上传 + form: { + component: 'UploadImg', + componentProps: { + limit: 1 + } + }, + #elseif($column.htmlType == "fileUpload")## 图片上传 + form: { + component: 'UploadFile' + }, #end #end #if ($column.listOperation) diff --git a/yudao-ui-admin-vue3/src/components/Form/src/componentMap.ts b/yudao-ui-admin-vue3/src/components/Form/src/componentMap.ts index 150a3cd95..44e940503 100644 --- a/yudao-ui-admin-vue3/src/components/Form/src/componentMap.ts +++ b/yudao-ui-admin-vue3/src/components/Form/src/componentMap.ts @@ -21,6 +21,7 @@ import { } from 'element-plus' import { InputPassword } from '@/components/InputPassword' import { Editor } from '@/components/Editor' +import { UploadImg, UploadFile } from '@/components/UploadFile' import { ComponentName } from '@/types/components' const componentMap: Recordable = { @@ -45,7 +46,9 @@ const componentMap: Recordable = { TreeSelect: ElTreeSelect, RadioButton: ElRadioGroup, InputPassword: InputPassword, - Editor: Editor + Editor: Editor, + UploadImg: UploadImg, + UploadFile: UploadFile } export { componentMap } diff --git a/yudao-ui-admin-vue3/src/components/UploadFile/index.ts b/yudao-ui-admin-vue3/src/components/UploadFile/index.ts index d851bdde1..d94aaa574 100644 --- a/yudao-ui-admin-vue3/src/components/UploadFile/index.ts +++ b/yudao-ui-admin-vue3/src/components/UploadFile/index.ts @@ -1,3 +1,4 @@ import UploadImg from './src/UploadImg.vue' +import UploadFile from './src/UploadFile.vue' -export { UploadImg } +export { UploadImg, UploadFile } diff --git a/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadFile.vue b/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadFile.vue new file mode 100644 index 000000000..4719b5aea --- /dev/null +++ b/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadFile.vue @@ -0,0 +1,167 @@ + + + diff --git a/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImg.vue b/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImg.vue index fd85b7198..72408f40b 100644 --- a/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImg.vue +++ b/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImg.vue @@ -1,24 +1,27 @@