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 18c58cfd7..33e204a46 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 @@ -78,10 +78,7 @@ const crudSchemas = reactive({ }, #elseif($column.htmlType == "imageUpload")## 图片上传 form: { - component: 'UploadImg', - componentProps: { - limit: 1 - } + component: 'UploadImg' // 单图上传,多图为UploadImgs }, #elseif($column.htmlType == "fileUpload")## 图片上传 form: { 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 44e940503..5af9b40da 100644 --- a/yudao-ui-admin-vue3/src/components/Form/src/componentMap.ts +++ b/yudao-ui-admin-vue3/src/components/Form/src/componentMap.ts @@ -21,7 +21,7 @@ import { } from 'element-plus' import { InputPassword } from '@/components/InputPassword' import { Editor } from '@/components/Editor' -import { UploadImg, UploadFile } from '@/components/UploadFile' +import { UploadImg, UploadImgs, UploadFile } from '@/components/UploadFile' import { ComponentName } from '@/types/components' const componentMap: Recordable = { @@ -48,6 +48,7 @@ const componentMap: Recordable = { InputPassword: InputPassword, Editor: Editor, UploadImg: UploadImg, + UploadImgs: UploadImgs, UploadFile: UploadFile } diff --git a/yudao-ui-admin-vue3/src/components/UploadFile/index.ts b/yudao-ui-admin-vue3/src/components/UploadFile/index.ts index d94aaa574..97c1d6655 100644 --- a/yudao-ui-admin-vue3/src/components/UploadFile/index.ts +++ b/yudao-ui-admin-vue3/src/components/UploadFile/index.ts @@ -1,4 +1,5 @@ import UploadImg from './src/UploadImg.vue' +import UploadImgs from './src/UploadImgs.vue' import UploadFile from './src/UploadFile.vue' -export { UploadImg, UploadFile } +export { UploadImg, UploadImgs, 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 index 3c0110d92..ac97a7e30 100644 --- a/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadFile.vue +++ b/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadFile.vue @@ -32,8 +32,8 @@ - diff --git a/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImgs.vue b/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImgs.vue new file mode 100644 index 000000000..22444c6f7 --- /dev/null +++ b/yudao-ui-admin-vue3/src/components/UploadFile/src/UploadImgs.vue @@ -0,0 +1,277 @@ + + + + diff --git a/yudao-ui-admin-vue3/src/types/components.d.ts b/yudao-ui-admin-vue3/src/types/components.d.ts index 65c4ad1b7..8de1f3352 100644 --- a/yudao-ui-admin-vue3/src/types/components.d.ts +++ b/yudao-ui-admin-vue3/src/types/components.d.ts @@ -22,6 +22,7 @@ export type ComponentName = | 'InputPassword' | 'Editor' | 'UploadImg' + | 'UploadImgs' | 'UploadFile' export type ColProps = { diff --git a/yudao-ui-admin-vue3/src/utils/index.ts b/yudao-ui-admin-vue3/src/utils/index.ts index 246de698b..b413a2b5a 100644 --- a/yudao-ui-admin-vue3/src/utils/index.ts +++ b/yudao-ui-admin-vue3/src/utils/index.ts @@ -69,7 +69,7 @@ export const trim = (str: string) => { * @param {Date | number | string} time 需要转换的时间 * @param {String} fmt 需要转换的格式 如 yyyy-MM-dd、yyyy-MM-dd HH:mm:ss */ -export function formatTime(time: Date | number | string, fmt: string) { +export const formatTime = (time: Date | number | string, fmt: string) => { if (!time) return '' else { const date = new Date(time) @@ -100,7 +100,7 @@ export function formatTime(time: Date | number | string, fmt: string) { /** * 生成随机字符串 */ -export function toAnyString() { +export const toAnyString = () => { const str: string = 'xxxxx-xxxxx-4xxxx-yxxxx-xxxxx'.replace(/[xy]/g, (c: string) => { const r: number = (Math.random() * 16) | 0 const v: number = c === 'x' ? r : (r & 0x3) | 0x8 @@ -108,3 +108,34 @@ export function toAnyString() { }) return str } + +export const generateUUID = () => { + if (typeof crypto === 'object') { + if (typeof crypto.randomUUID === 'function') { + return crypto.randomUUID() + } + if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') { + const callback = (c: any) => { + const num = Number(c) + return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString( + 16 + ) + } + return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, callback) + } + } + let timestamp = new Date().getTime() + let performanceNow = + (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0 + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + let random = Math.random() * 16 + if (timestamp > 0) { + random = (timestamp + random) % 16 | 0 + timestamp = Math.floor(timestamp / 16) + } else { + random = (performanceNow + random) % 16 | 0 + performanceNow = Math.floor(performanceNow / 16) + } + return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16) + }) +} diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts b/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts index fd2e15102..87ecd9f90 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts @@ -43,10 +43,7 @@ const crudSchemas = reactive({ } }, form: { - component: 'UploadImg', - componentProps: { - limit: 1 - } + component: 'UploadImg' } }, {