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
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
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
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
This commit is contained in:
@@ -4,7 +4,7 @@ import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { Modal, Upload } from 'ant-design-vue';
|
||||
import type { UploadFile } from 'ant-design-vue';
|
||||
|
||||
// 导入上传相关API和工具函数
|
||||
import GalleryPickLink from '#/components/form/components/gallery-pick-link.vue';
|
||||
import { uploadFile } from '#/api/core/upload';
|
||||
import { uploadToOss } from '#/utils/oss-upload';
|
||||
import {
|
||||
@@ -279,6 +279,29 @@ const handlePreview = async (file: UploadFile) => {
|
||||
previewTitle.value = file.name || file.url?.split('/').pop() || '';
|
||||
};
|
||||
|
||||
function onGallerySelect(urls: string[]) {
|
||||
const remain = props.maxCount - fileList.value.length;
|
||||
const picked = props.multiple ? urls.slice(0, remain) : urls.slice(0, 1);
|
||||
for (const url of picked) {
|
||||
if (fileList.value.some((f) => f.url === url)) {
|
||||
continue;
|
||||
}
|
||||
fileList.value = [
|
||||
...fileList.value,
|
||||
{
|
||||
uid: `gallery-${url}`,
|
||||
name: url.split('/').pop() || 'file',
|
||||
status: 'done' as const,
|
||||
url,
|
||||
},
|
||||
];
|
||||
}
|
||||
updateModelValue();
|
||||
nextTick(() => {
|
||||
initSortable();
|
||||
});
|
||||
}
|
||||
|
||||
// 计算是否显示上传按钮(与upload-image.vue保持一致)
|
||||
const showUploadButton = computed(() =>
|
||||
props.multiple
|
||||
@@ -286,6 +309,8 @@ const showUploadButton = computed(() =>
|
||||
: fileList.value.length === 0,
|
||||
);
|
||||
|
||||
const galleryRemainCount = computed(() => Math.max(props.maxCount - fileList.value.length, 0));
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
initSortable();
|
||||
@@ -294,7 +319,7 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="uploadListRef">
|
||||
<div ref="uploadListRef" class="upload-image-wrap">
|
||||
<Upload
|
||||
:file-list="fileList"
|
||||
:before-upload="beforeImageUpload"
|
||||
@@ -316,13 +341,20 @@ onMounted(() => {
|
||||
</div>
|
||||
</Upload>
|
||||
|
||||
<GalleryPickLink
|
||||
v-if="showUploadButton"
|
||||
:multiple="multiple"
|
||||
:max-count="galleryRemainCount"
|
||||
@select="onGallerySelect"
|
||||
/>
|
||||
|
||||
<Modal
|
||||
v-model:visible="previewVisible"
|
||||
:title="previewTitle"
|
||||
footer=""
|
||||
width="60%"
|
||||
>
|
||||
|
||||
<img alt="预览图片" style="width: 100%" :src="previewImage" />
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user