mirror of https://github.com/1Panel-dev/1Panel
feat: 文件复制、粘贴操作支持修改名称 (#2763)
Refs https://github.com/1Panel-dev/1Panel/issues/1570pull/2764/head^2
parent
f6b094039b
commit
c47075beeb
|
@ -346,13 +346,11 @@ func (b *BaseApi) CheckFile(c *gin.Context) {
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if _, err := os.Stat(req.Path); err != nil {
|
||||||
if _, err := os.Stat(req.Path); err != nil && os.IsNotExist(err) {
|
helper.SuccessWithData(c, false)
|
||||||
helper.SuccessWithData(c, true)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
helper.SuccessWithData(c, true)
|
||||||
helper.SuccessWithData(c, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags File
|
// @Tags File
|
||||||
|
|
|
@ -78,6 +78,8 @@ type FileMove struct {
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
OldPaths []string `json:"oldPaths" validate:"required"`
|
OldPaths []string `json:"oldPaths" validate:"required"`
|
||||||
NewPath string `json:"newPath" validate:"required"`
|
NewPath string `json:"newPath" validate:"required"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Cover bool `json:"cover"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileDownload struct {
|
type FileDownload struct {
|
||||||
|
@ -106,3 +108,8 @@ type FileRoleUpdate struct {
|
||||||
Group string `json:"group" validate:"required"`
|
Group string `json:"group" validate:"required"`
|
||||||
Sub bool `json:"sub" validate:"required"`
|
Sub bool `json:"sub" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FileExistReq struct {
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
Dir string `json:"dir" validate:"required"`
|
||||||
|
}
|
||||||
|
|
|
@ -32,3 +32,7 @@ type FileProcessKeys struct {
|
||||||
type FileWgetRes struct {
|
type FileWgetRes struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FileExist struct {
|
||||||
|
Exist bool `json:"exist"`
|
||||||
|
}
|
||||||
|
|
|
@ -193,7 +193,8 @@ func (f *FileService) DeCompress(c request.FileDeCompress) error {
|
||||||
|
|
||||||
func (f *FileService) GetContent(op request.FileContentReq) (response.FileInfo, error) {
|
func (f *FileService) GetContent(op request.FileContentReq) (response.FileInfo, error) {
|
||||||
info, err := files.NewFileInfo(files.FileOption{
|
info, err := files.NewFileInfo(files.FileOption{
|
||||||
Path: op.Path,
|
Path: op.Path,
|
||||||
|
Expand: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response.FileInfo{}, err
|
return response.FileInfo{}, err
|
||||||
|
@ -236,12 +237,12 @@ func (f *FileService) MvFile(m request.FileMove) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.Type == "cut" {
|
if m.Type == "cut" {
|
||||||
return fo.Cut(m.OldPaths, m.NewPath)
|
return fo.Cut(m.OldPaths, m.NewPath, m.Name, m.Cover)
|
||||||
}
|
}
|
||||||
var errs []error
|
var errs []error
|
||||||
if m.Type == "copy" {
|
if m.Type == "copy" {
|
||||||
for _, src := range m.OldPaths {
|
for _, src := range m.OldPaths {
|
||||||
if err := fo.Copy(src, m.NewPath); err != nil {
|
if err := fo.CopyAndReName(src, m.NewPath, m.Name, m.Cover); err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
global.LOG.Errorf("copy file [%s] to [%s] failed, err: %s", src, m.NewPath, err.Error())
|
global.LOG.Errorf("copy file [%s] to [%s] failed, err: %s", src, m.NewPath, err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,11 +280,21 @@ func (f FileOp) DownloadFile(url, dst string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f FileOp) Cut(oldPaths []string, dst string) error {
|
func (f FileOp) Cut(oldPaths []string, dst, name string, cover bool) error {
|
||||||
for _, p := range oldPaths {
|
for _, p := range oldPaths {
|
||||||
base := filepath.Base(p)
|
var dstPath string
|
||||||
dstPath := filepath.Join(dst, base)
|
if name != "" {
|
||||||
if err := cmd.ExecCmd(fmt.Sprintf("mv %s %s", p, dstPath)); err != nil {
|
dstPath = filepath.Join(dst, name)
|
||||||
|
} else {
|
||||||
|
base := filepath.Base(p)
|
||||||
|
dstPath = filepath.Join(dst, base)
|
||||||
|
}
|
||||||
|
coverFlag := ""
|
||||||
|
if cover {
|
||||||
|
coverFlag = "-f"
|
||||||
|
}
|
||||||
|
cmdStr := fmt.Sprintf("mv %s %s %s", coverFlag, p, dstPath)
|
||||||
|
if err := cmd.ExecCmd(cmdStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,6 +324,40 @@ func (f FileOp) Copy(src, dst string) error {
|
||||||
return f.CopyFile(src, dst)
|
return f.CopyFile(src, dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f FileOp) CopyAndReName(src, dst, name string, cover bool) error {
|
||||||
|
if src = path.Clean("/" + src); src == "" {
|
||||||
|
return os.ErrNotExist
|
||||||
|
}
|
||||||
|
if dst = path.Clean("/" + dst); dst == "" {
|
||||||
|
return os.ErrNotExist
|
||||||
|
}
|
||||||
|
if src == "/" || dst == "/" {
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
if dst == src {
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
|
||||||
|
srcInfo, err := f.Fs.Stat(src)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if srcInfo.IsDir() {
|
||||||
|
dstPath := dst
|
||||||
|
if name != "" && !cover {
|
||||||
|
dstPath = filepath.Join(dst, name)
|
||||||
|
}
|
||||||
|
return cmd.ExecCmd(fmt.Sprintf("cp -rf %s %s", src, dstPath))
|
||||||
|
} else {
|
||||||
|
dstPath := filepath.Join(dst, name)
|
||||||
|
if cover {
|
||||||
|
dstPath = dst
|
||||||
|
}
|
||||||
|
return cmd.ExecCmd(fmt.Sprintf("cp -f %s %s", src, dstPath))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (f FileOp) CopyDir(src, dst string) error {
|
func (f FileOp) CopyDir(src, dst string) error {
|
||||||
srcInfo, err := f.Fs.Stat(src)
|
srcInfo, err := f.Fs.Stat(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -14386,12 +14386,18 @@ const docTemplate = `{
|
||||||
"dto.Login": {
|
"dto.Login": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
"authMethod",
|
||||||
|
"language",
|
||||||
"name",
|
"name",
|
||||||
"password"
|
"password"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"authMethod": {
|
"authMethod": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"jwt",
|
||||||
|
"session"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"captcha": {
|
"captcha": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -14403,7 +14409,12 @@ const docTemplate = `{
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"zh",
|
||||||
|
"en",
|
||||||
|
"tw"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -16878,6 +16889,12 @@ const docTemplate = `{
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"cover": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"newPath": {
|
"newPath": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -14379,12 +14379,18 @@
|
||||||
"dto.Login": {
|
"dto.Login": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
"authMethod",
|
||||||
|
"language",
|
||||||
"name",
|
"name",
|
||||||
"password"
|
"password"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"authMethod": {
|
"authMethod": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"jwt",
|
||||||
|
"session"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"captcha": {
|
"captcha": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -14396,7 +14402,12 @@
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"zh",
|
||||||
|
"en",
|
||||||
|
"tw"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -16871,6 +16882,12 @@
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"cover": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"newPath": {
|
"newPath": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1279,6 +1279,9 @@ definitions:
|
||||||
dto.Login:
|
dto.Login:
|
||||||
properties:
|
properties:
|
||||||
authMethod:
|
authMethod:
|
||||||
|
enum:
|
||||||
|
- jwt
|
||||||
|
- session
|
||||||
type: string
|
type: string
|
||||||
captcha:
|
captcha:
|
||||||
type: string
|
type: string
|
||||||
|
@ -1287,12 +1290,18 @@ definitions:
|
||||||
ignoreCaptcha:
|
ignoreCaptcha:
|
||||||
type: boolean
|
type: boolean
|
||||||
language:
|
language:
|
||||||
|
enum:
|
||||||
|
- zh
|
||||||
|
- en
|
||||||
|
- tw
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
password:
|
password:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
- authMethod
|
||||||
|
- language
|
||||||
- name
|
- name
|
||||||
- password
|
- password
|
||||||
type: object
|
type: object
|
||||||
|
@ -2942,6 +2951,10 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
request.FileMove:
|
request.FileMove:
|
||||||
properties:
|
properties:
|
||||||
|
cover:
|
||||||
|
type: boolean
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
newPath:
|
newPath:
|
||||||
type: string
|
type: string
|
||||||
oldPaths:
|
oldPaths:
|
||||||
|
|
|
@ -225,7 +225,7 @@ const onSubmit = async () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const res = await CheckFile(baseDir.value + file.raw.name);
|
const res = await CheckFile(baseDir.value + file.raw.name);
|
||||||
if (!res.data) {
|
if (res.data) {
|
||||||
MsgError(i18n.global.t('commons.msg.fileExist'));
|
MsgError(i18n.global.t('commons.msg.fileExist'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,3 +383,15 @@ html {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 50px;
|
margin-right: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-parent {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-ellipsis {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
|
@ -329,3 +329,20 @@ export function downloadWithContent(content: string, fileName: string) {
|
||||||
const event = new MouseEvent('click');
|
const event = new MouseEvent('click');
|
||||||
a.dispatchEvent(event);
|
a.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDateStr() {
|
||||||
|
let now: Date = new Date();
|
||||||
|
|
||||||
|
let year: number = now.getFullYear();
|
||||||
|
let month: number = now.getMonth() + 1;
|
||||||
|
let date: number = now.getDate();
|
||||||
|
let hours: number = now.getHours();
|
||||||
|
let minutes: number = now.getMinutes();
|
||||||
|
let seconds: number = now.getSeconds();
|
||||||
|
|
||||||
|
let timestamp: string = `${year}-${month < 10 ? '0' + month : month}-${date < 10 ? '0' + date : date}-${
|
||||||
|
hours < 10 ? '0' + hours : hours
|
||||||
|
}-${minutes < 10 ? '0' + minutes : minutes}-${seconds < 10 ? '0' + seconds : seconds}`;
|
||||||
|
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
|
@ -3,20 +3,12 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="20" :offset="2">
|
<el-col :span="20" :offset="2">
|
||||||
<el-alert :title="$t('file.deleteHelper')" show-icon type="error" :closable="false"></el-alert>
|
<el-alert :title="$t('file.deleteHelper')" show-icon type="error" :closable="false"></el-alert>
|
||||||
<div class="resource">
|
<div class="flx-align-center mb-1 mt-1" v-for="(row, index) in files" :key="index">
|
||||||
<table>
|
<div>
|
||||||
<tr v-for="(row, index) in files" :key="index">
|
<svg-icon v-if="row.isDir" className="table-icon mr-1 " iconName="p-file-folder"></svg-icon>
|
||||||
<td>
|
<svg-icon v-else className="table-icon mr-1" :iconName="getIconName(row.extension)"></svg-icon>
|
||||||
<svg-icon v-if="row.isDir" className="table-icon" iconName="p-file-folder"></svg-icon>
|
</div>
|
||||||
<svg-icon
|
<span class="sle">{{ row.name }}</span>
|
||||||
v-else
|
|
||||||
className="table-icon"
|
|
||||||
:iconName="getIconName(row.extension)"
|
|
||||||
></svg-icon>
|
|
||||||
<span>{{ row.name }}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
<el-checkbox v-model="forceDelete">{{ $t('file.forceDeleteHelper') }}</el-checkbox>
|
<el-checkbox v-model="forceDelete">{{ $t('file.forceDeleteHelper') }}</el-checkbox>
|
||||||
|
|
|
@ -371,7 +371,7 @@ const codeReq = reactive({ path: '', expand: false, page: 1, pageSize: 100 });
|
||||||
const fileUpload = reactive({ path: '' });
|
const fileUpload = reactive({ path: '' });
|
||||||
const fileRename = reactive({ path: '', oldName: '' });
|
const fileRename = reactive({ path: '', oldName: '' });
|
||||||
const fileWget = reactive({ path: '' });
|
const fileWget = reactive({ path: '' });
|
||||||
const fileMove = reactive({ oldPaths: [''], type: '', path: '' });
|
const fileMove = reactive({ oldPaths: [''], type: '', path: '', name: '' });
|
||||||
const processPage = reactive({ open: false });
|
const processPage = reactive({ open: false });
|
||||||
|
|
||||||
const createRef = ref();
|
const createRef = ref();
|
||||||
|
@ -690,6 +690,9 @@ const openMove = (type: string) => {
|
||||||
oldpaths.push(s['path']);
|
oldpaths.push(s['path']);
|
||||||
}
|
}
|
||||||
fileMove.oldPaths = oldpaths;
|
fileMove.oldPaths = oldpaths;
|
||||||
|
if (selects.value.length == 1) {
|
||||||
|
fileMove.name = selects.value[0].name;
|
||||||
|
}
|
||||||
moveOpen.value = true;
|
moveOpen.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -697,6 +700,7 @@ const closeMove = () => {
|
||||||
selects.value = [];
|
selects.value = [];
|
||||||
tableRef.value.clearSelects();
|
tableRef.value.clearSelects();
|
||||||
fileMove.oldPaths = [];
|
fileMove.oldPaths = [];
|
||||||
|
fileMove.name = '';
|
||||||
moveOpen.value = false;
|
moveOpen.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -906,19 +910,6 @@ onMounted(() => {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-parent {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
margin-left: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-ellipsis {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.favorite-item {
|
.favorite-item {
|
||||||
max-height: 650px;
|
max-height: 650px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
|
@ -18,6 +18,15 @@
|
||||||
<template #prepend><FileList @choose="getPath" :dir="true"></FileList></template>
|
<template #prepend><FileList @choose="getPath" :dir="true"></FileList></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<div v-if="changeName">
|
||||||
|
<el-form-item :label="$t('commons.table.name')" prop="name">
|
||||||
|
<el-input v-model="addForm.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-radio-group v-model="addForm.cover" @change="changeType">
|
||||||
|
<el-radio :label="true" size="large">{{ $t('file.replace') }}</el-radio>
|
||||||
|
<el-radio :label="false" size="large">{{ $t('file.rename') }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -33,7 +42,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { MoveFile } from '@/api/modules/files';
|
import { CheckFile, MoveFile } from '@/api/modules/files';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules } from '@/global/form-rules';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { FormInstance, FormRules } from 'element-plus';
|
import { FormInstance, FormRules } from 'element-plus';
|
||||||
|
@ -41,17 +50,21 @@ import { ref, reactive, computed } from 'vue';
|
||||||
import FileList from '@/components/file-list/index.vue';
|
import FileList from '@/components/file-list/index.vue';
|
||||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
|
import { getDateStr } from '@/utils/util';
|
||||||
|
|
||||||
interface MoveProps {
|
interface MoveProps {
|
||||||
oldPaths: Array<string>;
|
oldPaths: Array<string>;
|
||||||
type: string;
|
type: string;
|
||||||
path: string;
|
path: string;
|
||||||
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileForm = ref<FormInstance>();
|
const fileForm = ref<FormInstance>();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
let open = ref(false);
|
const open = ref(false);
|
||||||
let type = ref('cut');
|
const type = ref('cut');
|
||||||
|
const changeName = ref(false);
|
||||||
|
const oldName = ref('');
|
||||||
|
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
if (type.value === 'cut') {
|
if (type.value === 'cut') {
|
||||||
|
@ -65,10 +78,13 @@ const addForm = reactive({
|
||||||
oldPaths: [] as string[],
|
oldPaths: [] as string[],
|
||||||
newPath: '',
|
newPath: '',
|
||||||
type: '',
|
type: '',
|
||||||
|
name: '',
|
||||||
|
cover: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const rules = reactive<FormRules>({
|
const rules = reactive<FormRules>({
|
||||||
newPath: [Rules.requiredInput],
|
newPath: [Rules.requiredInput],
|
||||||
|
name: [Rules.requiredInput],
|
||||||
});
|
});
|
||||||
|
|
||||||
const em = defineEmits(['close']);
|
const em = defineEmits(['close']);
|
||||||
|
@ -85,6 +101,14 @@ const getPath = (path: string) => {
|
||||||
addForm.newPath = path;
|
addForm.newPath = path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const changeType = () => {
|
||||||
|
if (addForm.cover) {
|
||||||
|
addForm.name = oldName.value;
|
||||||
|
} else {
|
||||||
|
addForm.name = oldName.value + '-' + getDateStr();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const submit = async (formEl: FormInstance | undefined) => {
|
const submit = async (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
await formEl.validate((valid) => {
|
await formEl.validate((valid) => {
|
||||||
|
@ -107,10 +131,23 @@ const submit = async (formEl: FormInstance | undefined) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const acceptParams = (props: MoveProps) => {
|
const acceptParams = async (props: MoveProps) => {
|
||||||
|
changeName.value = false;
|
||||||
addForm.oldPaths = props.oldPaths;
|
addForm.oldPaths = props.oldPaths;
|
||||||
addForm.type = props.type;
|
addForm.type = props.type;
|
||||||
addForm.newPath = props.path;
|
addForm.newPath = props.path;
|
||||||
|
if (props.name && props.name != '') {
|
||||||
|
oldName.value = props.name;
|
||||||
|
changeName.value = true;
|
||||||
|
const res = await CheckFile(props.path + '/' + props.name);
|
||||||
|
if (res.data) {
|
||||||
|
addForm.cover = false;
|
||||||
|
addForm.name = props.name + '-' + getDateStr();
|
||||||
|
} else {
|
||||||
|
addForm.cover = true;
|
||||||
|
addForm.name = props.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
type.value = props.type;
|
type.value = props.type;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,21 +3,12 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="20" :offset="2">
|
<el-col :span="20" :offset="2">
|
||||||
<el-alert :title="$t('file.deleteRecycleHelper')" show-icon type="error" :closable="false"></el-alert>
|
<el-alert :title="$t('file.deleteRecycleHelper')" show-icon type="error" :closable="false"></el-alert>
|
||||||
<div class="resource">
|
<div class="flx-align-center mb-1 mt-1" v-for="(row, index) in files" :key="index">
|
||||||
<table aria-describedby="deleteTable">
|
<div>
|
||||||
<th></th>
|
<svg-icon v-if="row.isDir" className="table-icon mr-1 " iconName="p-file-folder"></svg-icon>
|
||||||
<tr v-for="(row, index) in files" :key="index">
|
<svg-icon v-else className="table-icon mr-1" :iconName="getIconName(row.extension)"></svg-icon>
|
||||||
<td>
|
</div>
|
||||||
<svg-icon v-if="row.isDir" className="table-icon" iconName="p-file-folder"></svg-icon>
|
<span class="sle">{{ row.name }}</span>
|
||||||
<svg-icon
|
|
||||||
v-else
|
|
||||||
className="table-icon"
|
|
||||||
:iconName="getIconName(row.extension)"
|
|
||||||
></svg-icon>
|
|
||||||
<span>{{ row.name }}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
|
@ -17,13 +17,16 @@
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" fix />
|
<el-table-column type="selection" fix />
|
||||||
<el-table-column
|
<el-table-column prop="name" :label="$t('commons.table.name')" show-overflow-tooltip>
|
||||||
:label="$t('commons.table.name')"
|
<template #default="{ row }">
|
||||||
min-width="100"
|
<span class="text-ellipsis" type="primary">
|
||||||
fix
|
<svg-icon v-if="row.isDir" className="table-icon" iconName="p-file-folder"></svg-icon>
|
||||||
show-overflow-tooltip
|
<svg-icon v-else className="table-icon" iconName="p-file-normal"></svg-icon>
|
||||||
prop="name"
|
{{ row.name }}
|
||||||
></el-table-column>
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column :label="$t('file.sourcePath')" show-overflow-tooltip prop="sourcePath"></el-table-column>
|
<el-table-column :label="$t('file.sourcePath')" show-overflow-tooltip prop="sourcePath"></el-table-column>
|
||||||
<el-table-column :label="$t('file.size')" prop="size" max-width="50">
|
<el-table-column :label="$t('file.size')" prop="size" max-width="50">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
|
Loading…
Reference in New Issue