From 4224130ad47a9cfc2d5168f40c1081af7b8df086 Mon Sep 17 00:00:00 2001 From: lq Date: Tue, 21 Jul 2026 14:01:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=92=89=E9=92=89=E3=80=81=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1webbook=E3=80=81=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=BA=94=E7=94=A8api=EF=BC=8C=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9A=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/components/image-gallery-picker.vue | 96 ++- .../form/components/upload-image.vue | 6 + .../form/components/upload-oss-file.vue | 68 ++- .../composables/use-file-gallery-filter.ts | 21 +- .../_shared/components/oa-account-modal.vue | 2 + .../src/views/system/oa-chat/api/index.ts | 14 + .../src/views/system/oa-chat/config/form.ts | 25 +- .../src/views/system/oa-chat/config/table.ts | 11 +- .../src/views/system/oa-chat/index.vue | 224 ++++--- .../src/views/system/oa-platform/api/index.ts | 20 + .../src/views/system/oa-robot/api/index.ts | 73 ++- .../system/oa-robot/components/modal.vue | 264 +++++++-- .../oa-robot/components/test-result-modal.vue | 24 +- .../oa-robot/components/test-send-modal.vue | 342 ++++++++--- .../src/views/system/oa-robot/config/form.ts | 205 +++++-- .../src/views/system/oa-robot/config/table.ts | 8 +- .../src/views/system/oa-robot/index.vue | 65 ++- .../src/views/system/oa-scene/api/index.ts | 22 + .../system/oa-scene/components/modal.vue | 550 +++++++++++++++--- .../src/views/system/oa-scene/index.vue | 180 +++--- .../components/oa-notify-config-panel.vue | 208 +++++-- 21 files changed, 1915 insertions(+), 513 deletions(-) diff --git a/apps/web-antd/src/components/form/components/image-gallery-picker.vue b/apps/web-antd/src/components/form/components/image-gallery-picker.vue index 25e254e7..a30a2f85 100644 --- a/apps/web-antd/src/components/form/components/image-gallery-picker.vue +++ b/apps/web-antd/src/components/form/components/image-gallery-picker.vue @@ -42,6 +42,14 @@ const pageSize = ref(24); const pageSizeOptions = ['12', '24', '48']; const selected = ref([]); +/** 按 acceptTypes 隔离 localStorage,避免图片/视频选择器互相污染 */ +const storageKey = computed( + () => + `file-picker-type-${ + props.acceptTypes?.length ? props.acceptTypes.join('-') : 'all' + }`, +); + const { activeType, keyword, @@ -50,12 +58,10 @@ const { buildListParams, fileTypes, typesLoading, -} = useFileGalleryFilter('file-picker-active-type'); +} = useFileGalleryFilter(() => storageKey.value); /** * 实际渲染的 tabs(按 acceptTypes 过滤) - * - acceptTypes 为空:返回 tabs 原始值(含「全部」+ 所有类型) - * - acceptTypes 非空:只保留匹配的类型 tab(不含「全部」,强制选具体类型) */ const visibleTabs = computed(() => { if (!props.acceptTypes || props.acceptTypes.length === 0) { @@ -67,30 +73,40 @@ const visibleTabs = computed(() => { }); /** - * acceptTypes 变化时锁定到第一个匹配的类型(避免停留在「全部」导致看到非目标类型文件) + * 强制锁定到 acceptTypes 首项(打开弹窗 / 类型字典就绪时调用) */ -watch( - () => props.acceptTypes, - (arr) => { - if (!arr || arr.length === 0) { - return; - } - if (arr.includes(activeType.value)) { - return; - } +function lockAcceptType() { + const arr = props.acceptTypes; + if (!arr || arr.length === 0) { + return; + } + if (activeType.value !== arr[0]) { setActiveType(arr[0]!); - page.value = 1; - void load(); - }, - { immediate: true }, -); + } +} -let searchTimer: ReturnType | null = null; +/** + * 是否允许拉列表:有 acceptTypes 时需等类型字典加载完且 visibleTabs 非空 + */ +function canLoadList() { + if (typesLoading.value) { + return false; + } + if (props.acceptTypes && props.acceptTypes.length > 0) { + return visibleTabs.value.length > 0; + } + return true; +} async function load() { + if (!canLoadList()) { + return; + } loading.value = true; try { - const res = await getFileGalleryList(buildListParams(page.value, pageSize.value)); + const res = await getFileGalleryList( + buildListParams(page.value, pageSize.value), + ); const data = (res as any)?.data ?? res; items.value = data?.items ?? []; total.value = data?.total ?? 0; @@ -99,21 +115,37 @@ async function load() { } } +watch( + () => props.acceptTypes, + (arr) => { + if (!arr || arr.length === 0) { + return; + } + lockAcceptType(); + page.value = 1; + void load(); + }, + { immediate: true }, +); + +let searchTimer: ReturnType | null = null; + watch( () => props.open, (val) => { if (val) { selected.value = []; page.value = 1; - if (!typesLoading.value) { - void load(); - } + // 打开时再次按 acceptTypes 重锁,避免沿用其它选择器的视频 tab + lockAcceptType(); + void load(); } }, ); watch(typesLoading, (val) => { if (!val && props.open) { + lockAcceptType(); void load(); } }); @@ -184,6 +216,11 @@ function onSearch(value: string) { function itemIcon(item: FileGalleryItem) { return item.type_icon || resolveTypeIcon(item.type, fileTypes.value); } + +/** 图片类型展示缩略图(xk_file_type:1=图片) */ +function isImageItem(item: FileGalleryItem) { + return Number(item.type) === 1 || Number(item.type) === 0; +}