协议问题解决
This commit is contained in:
@@ -122,6 +122,44 @@
|
||||
:tip="item.remark || '点击上传图片,支持jpg、png格式'"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 文件上传(协议文档等) -->
|
||||
<el-form-item
|
||||
v-else-if="getRenderType(item) === 'fileupload'"
|
||||
:label="item.configName || item.configKey"
|
||||
:prop="item.configKey"
|
||||
>
|
||||
<div class="file-upload-wrapper">
|
||||
<FileUpload
|
||||
:as-dialog="false"
|
||||
:multiple="false"
|
||||
accept=".pdf,.txt"
|
||||
:max-size="100"
|
||||
module="system"
|
||||
:tip="item.remark || '支持PDF、TXT格式,不超过100MB'"
|
||||
@success="(files) => handleFileUploadSuccess(files, group.groupKey, item.configKey)"
|
||||
/>
|
||||
<div v-if="configData[group.groupKey][item.configKey]" class="uploaded-file-info">
|
||||
<el-tag type="success" size="small">已上传</el-tag>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="previewAgreementFile(configData[group.groupKey][item.configKey])"
|
||||
>
|
||||
预览文件
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
size="small"
|
||||
@click="configData[group.groupKey][item.configKey] = ''"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
@@ -149,7 +187,6 @@ import { ElMessage } from 'element-plus';
|
||||
import { configApi } from '@/apis/system';
|
||||
import type { ConfigItem } from '@/types/system/config';
|
||||
import FileUpload from '@/components/file/FileUpload.vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'SystemConfigView'
|
||||
});
|
||||
@@ -358,6 +395,26 @@ function handleCoverUpdate(url: string, groupKey: string, configKey: string) {
|
||||
configData[groupKey][configKey] = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理文件上传成功(协议文档等)
|
||||
*/
|
||||
function handleFileUploadSuccess(files: any[], groupKey: string, configKey: string) {
|
||||
if (files && files.length > 0) {
|
||||
configData[groupKey][configKey] = files[0].fileID || '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览协议文件(新开tab页)
|
||||
*/
|
||||
function previewAgreementFile(fileId: string) {
|
||||
if (fileId) {
|
||||
// 使用文件下载URL在新标签页打开
|
||||
const url = `${import.meta.env.VITE_API_BASE_URL || ''}/api/file/preview/${fileId}`;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存指定分组的配置
|
||||
*/
|
||||
@@ -440,5 +497,16 @@ async function saveConfig(groupKey: string) {
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.file-upload-wrapper {
|
||||
width: 100%;
|
||||
|
||||
.uploaded-file-info {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user