更新 Web/src/views/system/file/index.vue

文件管理功能添加是否公开附件功能
This commit is contained in:
362270511 2024-08-13 17:09:46 +08:00
parent 3fb475c882
commit 62eee58b5a

View File

@ -45,6 +45,10 @@
<template #row_suffix="{ row }">
<el-tag round>{{ row.suffix }}</el-tag>
</template>
<template #row_isPublic="{ row }">
<el-tag v-if="row.isPublic === true" type="success"></el-tag>
<el-tag v-else type="danger"></el-tag>
</template>
<template #row_url="{ row }">
<el-image
style="width: 60px; height: 60px"
@ -87,6 +91,12 @@
<el-option label="相关文件" value="相关文件" />
<el-option label="归档文件" value="归档文件" />
</el-select>
是否公开
<el-radio-group v-model="state.isPublic">
<el-radio :value="false"></el-radio>
<el-radio :value="true"></el-radio>
</el-radio-group>
<el-upload ref="uploadRef" drag :auto-upload="false" :limit="1" :file-list="state.fileList" action="" :on-change="handleChange" accept=".jpg,.png,.bmp,.gif,.txt,.pdf,.xlsx,.docx">
<el-icon class="el-icon--upload">
@ -166,6 +176,7 @@ const state = reactive({
pdfUrl: '',
fileName: '',
fileType: '',
isPublic:false,
previewList: [] as string[],
});
@ -185,6 +196,7 @@ const options = useVxeTable<SysFile>(
{ field: 'url', title: '预览', minWidth: 100, slots: { default: 'row_url' } },
{ field: 'bucketName', title: '存储位置', minWidth: 180, showOverflow: 'tooltip' },
{ field: 'id', title: '存储标识', minWidth: 120, showOverflow: 'tooltip' },
{ field: 'isPublic', title: '是否公开', minWidth: 140, showOverflow: 'tooltip', slots: { default: 'row_isPublic' } },
{ field: 'fileType', title: '文件类型', minWidth: 140, showOverflow: 'tooltip' },
{ field: 'relationName', title: '关联对象名称', minWidth: 150, showOverflow: 'tooltip' },
{ field: 'relationId', title: '关联对象ID', minWidth: 150, showOverflow: 'tooltip' },
@ -238,6 +250,7 @@ const resetQuery = async () => {
const showUpload = () => {
state.fileList = [];
state.visible = true;
state.isPublic=false;
};
// onChanne
@ -248,7 +261,7 @@ const handleChange = (file: any, fileList: []) => {
//
const handleUpload = async () => {
if (state.fileList.length < 1) return;
await getAPI(SysFileApi).apiSysFileUploadFilePostForm(state.fileList[0].raw, state.fileType, undefined);
await getAPI(SysFileApi).apiSysFileUploadFilePostForm(state.fileList[0].raw, state.fileType, state.isPublic,undefined);
handleQuery();
ElMessage.success('上传成功');
state.visible = false;