1. 右键菜单通用组件封装
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled

2. 文件管理优化功能(后续需要新增分组、个人收藏)
3. 优化订单页面、诊所管理页面的布局,更加集中,减少表长度
4. 新增诊所的时候业务员支持气泡卡片点击选择,不用再输入业务码
5. 接口日志筛选优化
This commit is contained in:
李琦
2026-06-18 16:42:51 +08:00
parent 073f7f882b
commit 75dd690188
16 changed files with 1282 additions and 46 deletions

View File

@@ -36,7 +36,7 @@ function onSelect(urls: string[]) {
<template>
<div class="gallery-pick-link-wrap">
<a class="gallery-pick-link" :class="{ disabled }" @click.prevent="openGallery">库选择</a>
<a class="gallery-pick-link" :class="{ disabled }" @click.prevent="openGallery">文件库选择</a>
<ImageGalleryPicker
v-model:open="galleryOpen"
:multiple="multiple"

View File

@@ -1,8 +1,11 @@
<script setup lang="ts">
import { ref, watch } from 'vue';
import { Empty, Modal, Pagination, Spin } from 'ant-design-vue';
import { Empty, Input, Modal, Pagination, Spin, Tabs } from 'ant-design-vue';
import MIcon from '#/components/icon/icon.vue';
import { useFileGalleryFilter } from '#/composables/use-file-gallery-filter';
import { resolveTypeIcon } from '#/composables/use-file-type-icon';
import type { FileGalleryItem } from '#/api/core/file-gallery';
import { getFileGalleryList } from '#/api/core/file-gallery';
@@ -28,17 +31,25 @@ const items = ref<FileGalleryItem[]>([]);
const total = ref(0);
const page = ref(1);
const pageSize = ref(24);
const pageSizeOptions = ['12', '24', '48'];
const selected = ref<string[]>([]);
const {
activeType,
keyword,
tabs,
setActiveType,
buildListParams,
fileTypes,
typesLoading,
} = useFileGalleryFilter('file-picker-active-type');
let searchTimer: ReturnType<typeof setTimeout> | null = null;
async function load() {
loading.value = true;
try {
const res = await getFileGalleryList({
page: page.value,
page_size: pageSize.value,
pid: 0,
type: 0,
});
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;
@@ -53,11 +64,19 @@ watch(
if (val) {
selected.value = [];
page.value = 1;
load();
if (!typesLoading.value) {
void load();
}
}
},
);
watch(typesLoading, (val) => {
if (!val && props.open) {
void load();
}
});
function toggleSelect(url: string) {
if (props.multiple) {
const idx = selected.value.indexOf(url);
@@ -90,21 +109,73 @@ function handleCancel() {
emit('update:open', false);
}
function onPageChange(p: number) {
function onPageChange(p: number, size?: number) {
page.value = p;
load();
if (size) {
pageSize.value = size;
}
void load();
}
function onShowSizeChange(_current: number, size: number) {
page.value = 1;
pageSize.value = size;
void load();
}
function onTabChange(key: string | number) {
setActiveType(Number(key));
page.value = 1;
void load();
}
function onSearch(value: string) {
keyword.value = value;
page.value = 1;
if (searchTimer) {
clearTimeout(searchTimer);
}
searchTimer = setTimeout(() => {
void load();
}, 300);
}
function itemIcon(item: FileGalleryItem) {
return item.type_icon || resolveTypeIcon(item.type, fileTypes.value);
}
</script>
<template>
<Modal
:open="open"
title="从库选择"
title="从文件库选择"
width="820px"
:ok-button-props="{ disabled: !selected.length }"
@ok="handleOk"
@cancel="handleCancel"
>
<Tabs :active-key="String(activeType)" size="small" @change="onTabChange">
<Tabs.TabPane v-for="tab in tabs" :key="String(tab.value)">
<template #tab>
<span class="tab-label">
<MIcon v-if="tab.icon" :icon="tab.icon" size="12" />
{{ tab.label }}
</span>
</template>
</Tabs.TabPane>
</Tabs>
<div class="picker-toolbar">
<Input.Search
v-model:value="keyword"
allow-clear
placeholder="按文件名搜索"
size="small"
@search="onSearch"
@change="(e) => onSearch(e.target.value ?? '')"
/>
</div>
<Spin :spinning="loading">
<div v-if="items.length" class="gallery-grid">
<div
@@ -114,22 +185,33 @@ function onPageChange(p: number) {
:class="{ active: isSelected(item.url) }"
@click="toggleSelect(item.url)"
>
<img :src="item.url" alt="" class="gallery-thumb" />
<img v-if="item.type === 0" :src="item.url" alt="" class="gallery-thumb" />
<div v-else class="gallery-file-icon">
<MIcon :icon="itemIcon(item)" size="28" />
<span class="file-name">{{ item.file_name || item.original_name || '未命名' }}</span>
</div>
<div class="gallery-meta">
<div class="file-title">
<MIcon :icon="itemIcon(item)" size="11" class="meta-icon" />
{{ item.file_name || item.original_name || '-' }}
</div>
<div>{{ item.file_size_text || '-' }}</div>
<div>{{ item.created_at || '-' }}</div>
</div>
</div>
</div>
<Empty v-else description="图库暂无图片" />
<div v-if="total > pageSize" class="gallery-pagination">
<Empty v-else description="暂无文件" />
<div v-if="total > 0" class="gallery-pagination">
<Pagination
:current="page"
:page-size="pageSize"
:page-size-options="pageSizeOptions"
:total="total"
size="small"
show-less-items
show-size-changer
:show-total="(t) => `${t}`"
@change="onPageChange"
@show-size-change="onShowSizeChange"
/>
</div>
</Spin>
@@ -139,6 +221,16 @@ function onPageChange(p: number) {
<style scoped lang="scss">
@use './picker-card-theme.scss' as picker;
.tab-label {
display: inline-flex;
align-items: center;
gap: 4px;
}
.picker-toolbar {
margin-bottom: 12px;
}
.gallery-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
@@ -167,9 +259,42 @@ function onPageChange(p: number) {
background: #f5f5f5;
}
.gallery-file-icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
height: 88px;
border-radius: 6px;
background: #f5f5f5;
color: #4e5969;
padding: 6px;
.file-name {
font-size: 11px;
text-align: center;
word-break: break-all;
line-height: 1.2;
max-height: 28px;
overflow: hidden;
}
}
.gallery-meta {
font-size: 11px;
color: #86909c;
.file-title {
display: inline-flex;
align-items: center;
gap: 4px;
color: #1d2129;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.gallery-pagination {
@@ -189,12 +314,17 @@ function onPageChange(p: number) {
}
}
.gallery-thumb {
.gallery-thumb,
.gallery-file-icon {
background: #374151;
}
.gallery-meta {
@include picker.picker-text-secondary-dark;
.file-title {
color: #e5e7eb;
}
}
}
</style>