diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index 64cff0f49..023bd334a 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -273,7 +273,7 @@ } } - const formActionType: Partial = { + const formActionType = { getFieldsValue, setFieldsValue, resetFields, diff --git a/src/components/Form/src/components/ApiCascader.vue b/src/components/Form/src/components/ApiCascader.vue index f740b8e81..1842e5a89 100644 --- a/src/components/Form/src/components/ApiCascader.vue +++ b/src/components/Form/src/components/ApiCascader.vue @@ -22,6 +22,7 @@ import { type Recordable } from '@vben/types'; import { PropType, ref, unref, watch, watchEffect } from 'vue'; import { Cascader } from 'ant-design-vue'; + import type { CascaderProps } from 'ant-design-vue'; import { propTypes } from '@/utils/propTypes'; import { isFunction } from '@/utils/is'; import { get, omit } from 'lodash-es'; @@ -131,7 +132,7 @@ } } - async function loadData(selectedOptions: Option[]) { + const loadData: CascaderProps['loadData'] = async (selectedOptions) => { const targetOption = selectedOptions[selectedOptions.length - 1]; targetOption.loading = true; @@ -155,7 +156,7 @@ } finally { targetOption.loading = false; } - } + }; watchEffect(() => { props.immediate && initialFetch(); @@ -174,13 +175,13 @@ emit('defaultChange', keys, args); } - function handleRenderDisplay({ labels, selectedOptions }) { - if (unref(emitData).length === selectedOptions.length) { + const handleRenderDisplay: CascaderProps['displayRender'] = ({ labels, selectedOptions }) => { + if (unref(emitData).length === selectedOptions?.length) { return labels.join(' / '); } if (props.displayRenderArray) { return props.displayRenderArray.join(' / '); } return ''; - } + }; diff --git a/src/components/Upload/src/components/ImageUpload.vue b/src/components/Upload/src/components/ImageUpload.vue index f5a39268f..7326b7095 100644 --- a/src/components/Upload/src/components/ImageUpload.vue +++ b/src/components/Upload/src/components/ImageUpload.vue @@ -27,7 +27,7 @@ import { ref, toRefs, watch } from 'vue'; import { PlusOutlined } from '@ant-design/icons-vue'; import { Upload, Modal } from 'ant-design-vue'; - import type { UploadProps } from 'ant-design-vue'; + import type { UploadProps, UploadFile } from 'ant-design-vue'; import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface'; import { useMessage } from '@/hooks/web/useMessage'; import { isArray, isFunction, isObject, isString } from '@/utils/is'; @@ -77,32 +77,35 @@ } else { return; } - }) as UploadProps['fileList'][number]; + }) as UploadProps['fileList']; } }, ); - function getBase64(file: File) { - return new Promise((resolve, reject) => { + function getBase64(file: File) { + return new Promise((resolve, reject) => { const reader = new FileReader(); reader.readAsDataURL(file); - reader.onload = () => resolve(reader.result); + reader.onload = () => { + resolve(reader.result as T); + }; reader.onerror = (error) => reject(error); }); } - const handlePreview = async (file: UploadProps['fileList'][number]) => { + const handlePreview = async (file: UploadFile) => { if (!file.url && !file.preview) { - file.preview = (await getBase64(file.originFileObj)) as string; + file.preview = await getBase64(file.originFileObj!); } - previewImage.value = file.url || file.preview; + previewImage.value = file.url || file.preview || ''; previewOpen.value = true; - previewTitle.value = file.name || file.url.substring(file.url.lastIndexOf('/') + 1); + previewTitle.value = + file.name || previewImage.value.substring(previewImage.value.lastIndexOf('/') + 1); }; - const handleRemove = async (file: UploadProps['fileList'][number]) => { + const handleRemove = async (file: UploadFile) => { if (fileList.value) { - const index = fileList.value.findIndex((item: any) => item.uuid === file.uuid); + const index = fileList.value.findIndex((item) => item.uid === file.uid); index !== -1 && fileList.value.splice(index, 1); emit('change', fileList.value); emit('delete', file); diff --git a/src/views/sys/error-log/index.vue b/src/views/sys/error-log/index.vue index f0b354999..81c0b17ae 100644 --- a/src/views/sys/error-log/index.vue +++ b/src/views/sys/error-log/index.vue @@ -22,7 +22,7 @@ :actions="[ { label: t('sys.errorLog.tableActionDesc'), - onClick: handleDetail.bind(null, record), + onClick: handleDetail.bind(null, record as ErrorLogInfo), }, ]" />