更新 Web/src/views/system/file/index.vue
文件管理功能添加是否公开附件功能
This commit is contained in:
parent
3fb475c882
commit
62eee58b5a
@ -45,6 +45,10 @@
|
|||||||
<template #row_suffix="{ row }">
|
<template #row_suffix="{ row }">
|
||||||
<el-tag round>{{ row.suffix }}</el-tag>
|
<el-tag round>{{ row.suffix }}</el-tag>
|
||||||
</template>
|
</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 }">
|
<template #row_url="{ row }">
|
||||||
<el-image
|
<el-image
|
||||||
style="width: 60px; height: 60px"
|
style="width: 60px; height: 60px"
|
||||||
@ -87,6 +91,12 @@
|
|||||||
<el-option label="相关文件" value="相关文件" />
|
<el-option label="相关文件" value="相关文件" />
|
||||||
<el-option label="归档文件" value="归档文件" />
|
<el-option label="归档文件" value="归档文件" />
|
||||||
</el-select>
|
</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-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">
|
<el-icon class="el-icon--upload">
|
||||||
@ -166,6 +176,7 @@ const state = reactive({
|
|||||||
pdfUrl: '',
|
pdfUrl: '',
|
||||||
fileName: '',
|
fileName: '',
|
||||||
fileType: '',
|
fileType: '',
|
||||||
|
isPublic:false,
|
||||||
previewList: [] as string[],
|
previewList: [] as string[],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -185,6 +196,7 @@ const options = useVxeTable<SysFile>(
|
|||||||
{ field: 'url', title: '预览', minWidth: 100, slots: { default: 'row_url' } },
|
{ field: 'url', title: '预览', minWidth: 100, slots: { default: 'row_url' } },
|
||||||
{ field: 'bucketName', title: '存储位置', minWidth: 180, showOverflow: 'tooltip' },
|
{ field: 'bucketName', title: '存储位置', minWidth: 180, showOverflow: 'tooltip' },
|
||||||
{ field: 'id', title: '存储标识', minWidth: 120, 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: 'fileType', title: '文件类型', minWidth: 140, showOverflow: 'tooltip' },
|
||||||
{ field: 'relationName', title: '关联对象名称', minWidth: 150, showOverflow: 'tooltip' },
|
{ field: 'relationName', title: '关联对象名称', minWidth: 150, showOverflow: 'tooltip' },
|
||||||
{ field: 'relationId', title: '关联对象ID', minWidth: 150, showOverflow: 'tooltip' },
|
{ field: 'relationId', title: '关联对象ID', minWidth: 150, showOverflow: 'tooltip' },
|
||||||
@ -238,6 +250,7 @@ const resetQuery = async () => {
|
|||||||
const showUpload = () => {
|
const showUpload = () => {
|
||||||
state.fileList = [];
|
state.fileList = [];
|
||||||
state.visible = true;
|
state.visible = true;
|
||||||
|
state.isPublic=false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 通过onChanne方法获得文件列表
|
// 通过onChanne方法获得文件列表
|
||||||
@ -248,7 +261,7 @@ const handleChange = (file: any, fileList: []) => {
|
|||||||
// 上传
|
// 上传
|
||||||
const handleUpload = async () => {
|
const handleUpload = async () => {
|
||||||
if (state.fileList.length < 1) return;
|
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();
|
handleQuery();
|
||||||
ElMessage.success('上传成功');
|
ElMessage.success('上传成功');
|
||||||
state.visible = false;
|
state.visible = false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user