mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
fix(type): type:check error (#3309)
This commit is contained in:
parent
82671d0750
commit
2cd5a40322
@ -273,7 +273,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
const formActionType: Partial<FormActionType> = {
|
||||
const formActionType = {
|
||||
getFieldsValue,
|
||||
setFieldsValue,
|
||||
resetFields,
|
||||
|
@ -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 '';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -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<T extends string | ArrayBuffer | null>(file: File) {
|
||||
return new Promise<T>((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<string>(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);
|
||||
|
@ -22,7 +22,7 @@
|
||||
:actions="[
|
||||
{
|
||||
label: t('sys.errorLog.tableActionDesc'),
|
||||
onClick: handleDetail.bind(null, record),
|
||||
onClick: handleDetail.bind(null, record as ErrorLogInfo),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user