fix(@vben/web-antdv-next): clean AI template refs and index typing

- remove unused AI template refs

- normalize document split and upload indexes
pull/369/head
XuZhiqiang 2026-06-20 23:55:39 +08:00
parent 22ba329ad3
commit 5a21adf5bf
5 changed files with 9 additions and 18 deletions

View File

@ -22,8 +22,6 @@ const document = ref<null | {
}[];
title: string;
}>(null); //
const dialogVisible = ref(false); //
const documentRef = ref<HTMLElement>(); // Ref
/** 按照 document 聚合 segments */
const documentList = computed(() => {
@ -49,7 +47,6 @@ const documentList = computed(() => {
/** 点击 document 处理 */
function handleClick(doc: any) {
document.value = doc;
dialogVisible.value = true;
}
</script>
@ -79,7 +76,7 @@ function handleClick(doc: any) {
</div>
</div>
<Tooltip placement="topLeft" :trigger="['click']">
<div ref="documentRef"></div>
<div></div>
<template #title>
<div class="mb-3 text-base font-bold">{{ document?.title }}</div>
<div class="max-h-[60vh] overflow-y-auto">

View File

@ -19,8 +19,6 @@ const props = defineProps({
});
const emits = defineEmits(['onBtnClick', 'onMjBtnClick']);
const cardImageRef = ref<any>(); // image ref
/** 处理点击事件 */
async function handleButtonClick(type: string, detail: AiImageApi.Image) {
emits('onBtnClick', type, detail);
@ -110,7 +108,7 @@ onMounted(async () => {
</div>
<!-- 图片展示区域 -->
<div class="mt-5 h-72 flex-1 overflow-hidden" ref="cardImageRef">
<div class="mt-5 h-72 flex-1 overflow-hidden">
<Image class="w-full rounded-lg" :src="detail?.picUrl" />
<div v-if="detail?.status === AiImageStatusEnum.FAIL">
{{ detail?.errorMessage }}

View File

@ -33,7 +33,6 @@ const queryParams = reactive({
}); //
const pageTotal = ref<number>(0); // page size
const imageList = ref<AiImageApi.Image[]>([]); // image
const imageListRef = ref<any>(); // ref
const inProgressImageMap = ref<{}>({}); // image key image value image
const inProgressTimer = ref<any>(); // image
@ -192,7 +191,6 @@ onUnmounted(async () => {
<div
class="flex flex-1 flex-wrap content-start overflow-y-auto p-3 pb-28 pt-5"
ref="imageListRef"
>
<ImageCard
v-for="image in imageList"

View File

@ -44,8 +44,8 @@ const currentFile = ref<any>(null); // 当前选中的文件
const submitLoading = ref(false); //
/** 选择文件 */
async function selectFile(index: number) {
currentFile.value = modelData.value.list[index];
async function selectFile(index: number | string) {
currentFile.value = modelData.value.list[Number(index)];
await splitContentFile(currentFile.value);
}
@ -258,7 +258,8 @@ onMounted(async () => {
class="mb-2.5"
>
<div class="mb-1 text-sm text-gray-500">
分片-{{ index + 1 }} · {{ segment.contentLength || 0 }} 字符数 ·
分片-{{ Number(index) + 1 }} ·
{{ segment.contentLength || 0 }} 字符数 ·
{{ segment.tokens || 0 }} Token
</div>
<div class="rounded-md bg-card p-2">

View File

@ -22,8 +22,6 @@ const props = defineProps({
});
const emit = defineEmits(['update:modelValue']);
const formRef = ref(); //
const uploadRef = ref(); //
const parent = inject('parent', null); //
const { uploadUrl, httpRequest } = useUpload(); // 使
const fileList = ref<UploadProps['fileList']>([]); //
@ -147,10 +145,10 @@ async function customRequest(info: UploadRequestOption) {
*
* @param index 要移除的文件索引
*/
function removeFile(index: number) {
function removeFile(index: number | string) {
//
const newList = [...props.modelValue.list];
newList.splice(index, 1);
newList.splice(Number(index), 1);
//
emit('update:modelValue', {
...props.modelValue,
@ -185,14 +183,13 @@ onMounted(() => {
</script>
<template>
<Form ref="formRef" :model="modelData" label-width="0" class="mt-5">
<Form :model="modelData" label-width="0" class="mt-5">
<FormItem class="mb-5">
<div class="w-full">
<div
class="w-full rounded-md border-2 border-dashed border-gray-200 p-5 text-center hover:border-blue-500"
>
<UploadDragger
ref="uploadRef"
class="upload-demo"
:action="uploadUrl"
v-model:file-list="fileList"