Merge branch 'developer' of ssh://code.cyweb.top:30033/scj/zhxy/v3/cloud-ui into developer

This commit is contained in:
guochunsi
2026-02-03 11:55:52 +08:00
6 changed files with 482 additions and 155 deletions

View File

@@ -22,45 +22,74 @@
</div>
</div>
</div>
<!-- 默认上传组件 -->
<el-upload
ref="fileUpload"
v-if="props.type === 'default' && !props.disabled"
:action="baseUrl + other.adaptationUrl(props.uploadFileUrl)"
:before-upload="handleBeforeUpload"
:file-list="fileList"
:headers="headers"
:limit="limit"
:on-error="handleUploadError"
:on-remove="handleRemove"
:on-preview="handlePreview"
:on-exceed="handleExceed"
:data="formData"
:auto-upload="autoUpload"
:on-success="handleUploadSuccess"
:accept="fileAccept"
class="upload-file-uploader"
drag
multiple
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
{{ $t('excel.operationNotice') }}
<em>{{ $t('excel.clickUpload') }}</em>
</div>
<template #tip>
<div class="el-upload__tip" v-if="props.isShowTip">
{{ $t('excel.pleaseUpload') }}
<template v-if="props.fileSize">
{{ $t('excel.size') }} <b style="color: #f56c6c">{{ props.fileSize }}MB</b></template
<!-- 默认上传组件 - 简洁模式 -->
<div v-if="props.type === 'default' && !props.disabled" class="upload-file-default">
<el-upload
ref="fileUpload"
:action="baseUrl + other.adaptationUrl(props.uploadFileUrl)"
:before-upload="handleBeforeUpload"
:file-list="[]"
:headers="headers"
:limit="limit"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:data="formData"
:auto-upload="autoUpload"
:on-success="handleUploadSuccess"
:accept="fileAccept"
class="upload-file-uploader-simple"
multiple
>
<el-button type="primary" size="small">
<el-icon class="mr-1"><Upload /></el-icon>
{{ $t('excel.clickUpload') }}
</el-button>
<template #tip>
<div class="el-upload__tip" v-if="props.isShowTip" style="margin-top: 8px; font-size: 12px; color: #909399;">
{{ $t('excel.pleaseUpload') }}
<template v-if="props.fileSize">
{{ $t('excel.size') }} <b style="color: #f56c6c">{{ props.fileSize }}MB</b></template
>
<template v-if="props.fileType">
{{ $t('excel.format') }} <b style="color: #f56c6c">{{ props.fileType.join('/') }}</b>
</template>
{{ $t('excel.file') }}
</div>
</template>
</el-upload>
<!-- 已上传文件列表 -->
<div v-if="fileList.length > 0" class="uploaded-files-list" style="margin-top: 12px;">
<div
v-for="(file, index) in fileList"
:key="index"
class="uploaded-file-item"
style="display: flex; align-items: center; padding: 8px 12px; margin-bottom: 8px; background: #f5f7fa; border-radius: 4px;"
>
<el-icon class="mr-2" style="color: #409eff;"><Document /></el-icon>
<span class="file-name" style="flex: 1; font-size: 14px; color: #606266; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
{{ getFileName(file) }}
</span>
<el-button
type="danger"
link
size="small"
@click="handleRemove(file)"
style="margin-left: 8px;"
>
<template v-if="props.fileType">
{{ $t('excel.format') }} <b style="color: #f56c6c">{{ props.fileType.join('/') }}</b>
</template>
{{ $t('excel.file') }}
<el-icon><Delete /></el-icon>
</el-button>
<el-button
type="primary"
link
size="small"
@click="handlePreview(file)"
style="margin-left: 4px;"
>
<el-icon><Download /></el-icon>
</el-button>
</div>
</template>
</el-upload>
</div>
</div>
<!-- 简单上传组件 -->
<el-upload
ref="fileUpload"
@@ -103,7 +132,7 @@ import { Session } from '/@/utils/storage';
import other from '/@/utils/other';
import { useI18n } from 'vue-i18n';
import { ref, computed, watch } from 'vue';
import { Document, Download } from '@element-plus/icons-vue';
import { Document, Download, Upload, Delete } from '@element-plus/icons-vue';
// 定义基础URL
const baseUrl = import.meta.env.VITE_API_URL || '';