From 18b49d772e94629913d57fa8201c0d7cf471eaf7 Mon Sep 17 00:00:00 2001 From: Yuan Date: Wed, 12 Oct 2022 14:43:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=B5=84=E6=BA=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/management/fileManage.js | 9 +++ .../system/frontResourceManage/create.vue | 52 ++++++++++------ src/views/system/frontResourceManage/dirs.js | 17 ++++- src/views/system/frontResourceManage/edit.vue | 62 +++++++++++++++++++ .../system/frontResourceManage/index.vue | 34 ++++++++-- 5 files changed, 147 insertions(+), 27 deletions(-) create mode 100644 src/views/system/frontResourceManage/edit.vue diff --git a/src/api/management/fileManage.js b/src/api/management/fileManage.js index a6bf29d09..9e6ec1fa2 100644 --- a/src/api/management/fileManage.js +++ b/src/api/management/fileManage.js @@ -27,6 +27,15 @@ export function saveFileInfo(data) { }) } +/** 更新文件标题 */ +export function updateFileTitle(data) { + return request({ + url: `/api/minio/file/update`, + method: 'put', + data, + }) +} + /** 删除文件 */ export function deleteFile(id) { return request({ diff --git a/src/views/system/frontResourceManage/create.vue b/src/views/system/frontResourceManage/create.vue index 4e1b281e1..d3f965b5b 100644 --- a/src/views/system/frontResourceManage/create.vue +++ b/src/views/system/frontResourceManage/create.vue @@ -1,15 +1,5 @@ @@ -9,10 +10,11 @@ import { getFileList, deleteFile } from '@/api/management/fileManage' import { getUploadUrl } from '@/api/projectConfig' import CreateFile from './create' +import EditFile from './edit' import { directories } from './dirs' export default { name: 'fileManage', - components: { CreateFile }, + components: { CreateFile, EditFile }, data() { return { pagerConfig: { @@ -20,6 +22,7 @@ export default { pageIndex: 'pageNum', }, queryForm: { + labelWidth: '100px', queryObject: { title: { type: 'text', @@ -27,9 +30,12 @@ export default { }, directory: { type: 'select', - label: '目录:', + label: '类型:', config: { - data: directories.map(dir => ({ value: dir, label: dir })), + data: directories.map(item => { + const { dir: value, label } = item + return { value, label } + }), }, }, }, @@ -42,23 +48,37 @@ export default { prop: 'title', }, { - title: '目录', + title: '类型', prop: 'directory', + formatter(row, col, val, idx) { + return directories.find(_ => _.dir === val).label + }, }, { title: '创建时间', prop: 'createTime', }, + { + title: '文件路径', + formatter(row) { + return `${row.directory}/${row.fileName}` + }, + }, { type: 'button', title: this.$t('global.operate'), - width: '180', + width: '240', buttons: [ { name: '复制路径', handleClick: this.copyPath, type: 'primary', }, + { + name: '编辑', + handleClick: this.openEdit, + type: 'primary', + }, { name: '删除', handleClick: this.deleteFile, @@ -99,9 +119,11 @@ export default { }) }) }, + openEdit(idx, row) { + this.$refs.editFile.doShow(row) + }, copyPath(idx, row) { const path = `${this.$store.state.user.ossUrl}/${row.directory}/${row.fileName}` - console.log(path) navigator.clipboard.writeText(path).then(() => { this.$message.success('文件路径已经复制到粘贴板') })