mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 18:40:22 +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,
|
getFieldsValue,
|
||||||
setFieldsValue,
|
setFieldsValue,
|
||||||
resetFields,
|
resetFields,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
import { type Recordable } from '@vben/types';
|
import { type Recordable } from '@vben/types';
|
||||||
import { PropType, ref, unref, watch, watchEffect } from 'vue';
|
import { PropType, ref, unref, watch, watchEffect } from 'vue';
|
||||||
import { Cascader } from 'ant-design-vue';
|
import { Cascader } from 'ant-design-vue';
|
||||||
|
import type { CascaderProps } from 'ant-design-vue';
|
||||||
import { propTypes } from '@/utils/propTypes';
|
import { propTypes } from '@/utils/propTypes';
|
||||||
import { isFunction } from '@/utils/is';
|
import { isFunction } from '@/utils/is';
|
||||||
import { get, omit } from 'lodash-es';
|
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];
|
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||||
targetOption.loading = true;
|
targetOption.loading = true;
|
||||||
|
|
||||||
@ -155,7 +156,7 @@
|
|||||||
} finally {
|
} finally {
|
||||||
targetOption.loading = false;
|
targetOption.loading = false;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
props.immediate && initialFetch();
|
props.immediate && initialFetch();
|
||||||
@ -174,13 +175,13 @@
|
|||||||
emit('defaultChange', keys, args);
|
emit('defaultChange', keys, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRenderDisplay({ labels, selectedOptions }) {
|
const handleRenderDisplay: CascaderProps['displayRender'] = ({ labels, selectedOptions }) => {
|
||||||
if (unref(emitData).length === selectedOptions.length) {
|
if (unref(emitData).length === selectedOptions?.length) {
|
||||||
return labels.join(' / ');
|
return labels.join(' / ');
|
||||||
}
|
}
|
||||||
if (props.displayRenderArray) {
|
if (props.displayRenderArray) {
|
||||||
return props.displayRenderArray.join(' / ');
|
return props.displayRenderArray.join(' / ');
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
import { ref, toRefs, watch } from 'vue';
|
import { ref, toRefs, watch } from 'vue';
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
import { Upload, Modal } from 'ant-design-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 { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||||
import { useMessage } from '@/hooks/web/useMessage';
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
import { isArray, isFunction, isObject, isString } from '@/utils/is';
|
import { isArray, isFunction, isObject, isString } from '@/utils/is';
|
||||||
@ -77,32 +77,35 @@
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}) as UploadProps['fileList'][number];
|
}) as UploadProps['fileList'];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
function getBase64(file: File) {
|
function getBase64<T extends string | ArrayBuffer | null>(file: File) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise<T>((resolve, reject) => {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
reader.onload = () => resolve(reader.result);
|
reader.onload = () => {
|
||||||
|
resolve(reader.result as T);
|
||||||
|
};
|
||||||
reader.onerror = (error) => reject(error);
|
reader.onerror = (error) => reject(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePreview = async (file: UploadProps['fileList'][number]) => {
|
const handlePreview = async (file: UploadFile) => {
|
||||||
if (!file.url && !file.preview) {
|
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;
|
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) {
|
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);
|
index !== -1 && fileList.value.splice(index, 1);
|
||||||
emit('change', fileList.value);
|
emit('change', fileList.value);
|
||||||
emit('delete', file);
|
emit('delete', file);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
:actions="[
|
:actions="[
|
||||||
{
|
{
|
||||||
label: t('sys.errorLog.tableActionDesc'),
|
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