文件自动备份
This commit is contained in:
parent
a86bd18f4f
commit
69f7479006
@ -7,6 +7,22 @@ export function listLocalAndBackup(params:any) {
|
||||
params:params,
|
||||
});
|
||||
}
|
||||
//查询本地结构树
|
||||
export function listLocalTree(params:any) {
|
||||
return request({
|
||||
url: '/experimentalData/ts-files/listLocalTree',
|
||||
method: 'post',
|
||||
params:params,
|
||||
});
|
||||
}
|
||||
//查询工作空间结构树
|
||||
export function listBackupTree(params:any) {
|
||||
return request({
|
||||
url: '/experimentalData/ts-files/listBackupTree',
|
||||
method: 'post',
|
||||
params:params,
|
||||
});
|
||||
}
|
||||
//对比两个目录的文件差异
|
||||
export function compare(params:any) {
|
||||
return request({
|
||||
@ -39,3 +55,11 @@ export function deleteTsFilesById(params:any) {
|
||||
params:params,
|
||||
});
|
||||
}
|
||||
//所有文件备份到备份空间
|
||||
export function automaticFileBackup(params:any) {
|
||||
return request({
|
||||
url: '/experimentalData/ts-files/automaticFileBackup',
|
||||
method: 'post',
|
||||
params:params,
|
||||
});
|
||||
}
|
110
web/src/views/testdata/fileSynchronization/index.vue
vendored
110
web/src/views/testdata/fileSynchronization/index.vue
vendored
@ -5,11 +5,12 @@ export default {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, nextTick, defineAsyncComponent } from "vue";
|
||||
import { ref, onMounted, nextTick, defineAsyncComponent, onBeforeUnmount } from "vue";
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import { tstaskList, getTsNodesTree, tsFilesPage, deleteTsFilesByIds } from "@/api/datamanagement";
|
||||
import { listLocalAndBackup, compare, uploadToBackup, downloadToLocal, deleteTsFilesById } from "@/api/fileSynchronization";
|
||||
import { listLocalAndBackup, compare, uploadToBackup, downloadToLocal, deleteTsFilesById,automaticFileBackup } from "@/api/fileSynchronization";
|
||||
import { debounce } from 'lodash-es';
|
||||
//text文件编辑功能
|
||||
import textEdit from '@/components/textEditing/index.vue'
|
||||
import txtexl from '@/components/textEditing/txtexl.vue'
|
||||
@ -71,6 +72,27 @@ function diffFile() {
|
||||
differential.value = true
|
||||
getchayi()
|
||||
}
|
||||
function backups(){
|
||||
ElMessageBox.confirm(
|
||||
'您确定要将文件/文件夹自动备份到备份空间吗?',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
worktree.value = true
|
||||
automaticFileBackup({ nodeId: pathid.value, taskId: projectId.value }).then((res: any) => {
|
||||
if(res.code == 0){
|
||||
ElMessage.success(res.msg)
|
||||
getWorkData()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
//文件差异性对比结果
|
||||
const comparearr: any = ref([])
|
||||
const localOnlyFiles: any = ref([])
|
||||
@ -168,19 +190,19 @@ function handleNodeClick(data: any, node: any) {
|
||||
getWorkData()
|
||||
}
|
||||
//工作空间树点击
|
||||
const handleCheckChange = (
|
||||
const handleCheckChange = debounce((
|
||||
data: any,
|
||||
checked: boolean,
|
||||
indeterminate: boolean
|
||||
) => {
|
||||
if (checked == true && indeterminate == false) {
|
||||
if (checked === true && indeterminate === false) {
|
||||
workall.value.push(data)
|
||||
} else {
|
||||
workall.value = workall.value.filter(item => item.id !== data.id);
|
||||
}
|
||||
comparearr.value = getclickdata(workall.value)
|
||||
beifentree.value!.setCheckedNodes(comparearr.value, false)
|
||||
}
|
||||
}, 300)
|
||||
//递归整理点击参数
|
||||
function getclickdata(data: any) {
|
||||
data.forEach((item: any) => {
|
||||
@ -225,11 +247,11 @@ function assignment(data: any, difference: any) {
|
||||
}
|
||||
//备份空间
|
||||
const beifentree = ref()
|
||||
function backupsChange(
|
||||
const backupsChange = debounce((
|
||||
data: any,
|
||||
checked: boolean,
|
||||
indeterminate: boolean
|
||||
) {
|
||||
) => {
|
||||
if (checked == true && indeterminate == false) {
|
||||
workall.value.push(data)
|
||||
} else {
|
||||
@ -237,7 +259,7 @@ function backupsChange(
|
||||
}
|
||||
comparearr.value = getclickdata(workall.value)
|
||||
workref.value!.setCheckedNodes(comparearr.value, false)
|
||||
}
|
||||
}, 300)
|
||||
//右键菜单
|
||||
const handleRightClick = (event: Event, data: any, node: any) => {
|
||||
if (data.station != '0') {
|
||||
@ -547,6 +569,10 @@ function bfclick(type: any) {
|
||||
onMounted(() => {
|
||||
getProject()
|
||||
});
|
||||
// 组件卸载时取消防抖(可选)
|
||||
onBeforeUnmount(() => {
|
||||
handleCheckChange.cancel()
|
||||
})
|
||||
//拖动条
|
||||
const vMove = {
|
||||
mounted(el: any) {
|
||||
@ -683,6 +709,8 @@ function getFileSuffix(name: any) {
|
||||
function CloseView() {
|
||||
isViewfile.value = false
|
||||
}
|
||||
//tabbas
|
||||
const tabs = ref(1)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -712,6 +740,7 @@ function CloseView() {
|
||||
</aside>
|
||||
<section class="silderRight">
|
||||
<div class="tree_button">
|
||||
<el-button type="primary" :disabled="worktree" @click="backups()">文件自动备份</el-button>
|
||||
<el-button type="primary" :disabled="worktree" @click="diffFile()">文件差异性对比</el-button>
|
||||
<el-button type="primary" :disabled="worktree" @click="differential = true">查看本次差异性对比</el-button>
|
||||
</div>
|
||||
@ -743,7 +772,8 @@ function CloseView() {
|
||||
}">
|
||||
<div class="menu-item" @click="handleMenuClick('backups', 'local')">备份</div>
|
||||
<div class="menu-item" @click="handleMenuClick('delete', 'local')">删除</div>
|
||||
<div v-if="currentNode && currentNode.isFile == 'FILE'" class="menu-item" @click="handleMenuClick('preview', 'local')">预览</div>
|
||||
<div v-if="currentNode && currentNode.isFile == 'FILE'" class="menu-item"
|
||||
@click="handleMenuClick('preview', 'local')">预览</div>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
|
||||
@ -776,7 +806,8 @@ function CloseView() {
|
||||
}">
|
||||
<div class="menu-item" @click="handleMenuClick('restore', 'minio')">恢复</div>
|
||||
<div class="menu-item" @click="handleMenuClick('delete', 'minio')">删除</div>
|
||||
<div v-if="currentNode && currentNode.isFile == 'FILE'" class="menu-item" @click="handleMenuClick('preview', 'minio')">预览</div>
|
||||
<div v-if="currentNode && currentNode.isFile == 'FILE'" class="menu-item"
|
||||
@click="handleMenuClick('preview', 'minio')">预览</div>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
|
||||
@ -785,16 +816,21 @@ function CloseView() {
|
||||
<!-- 文件差异性对比 -->
|
||||
<el-dialog title="文件差异性对比" v-model="differential" width="50%" :before-close="diffClose" top="30px"
|
||||
draggable destroy-on-close>
|
||||
<div class="tabbs_all">
|
||||
<div @click="tabs = 1" :class="tabs == 1?'tabbs_box1':'tabbs_box'">新增内容</div>
|
||||
<div @click="tabs = 2" :class="tabs == 2?'tabbs_box1':'tabbs_box'">变更内容</div>
|
||||
<div @click="tabs = 3" :class="tabs == 3?'tabbs_box1':'tabbs_box'">缺失内容</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-scrollbar height="400px">
|
||||
<div class="newContent">
|
||||
<div class="newContent_title"><span class="newContent_title_text">新增内容:</span>
|
||||
<!-- <el-scrollbar height="400px"> -->
|
||||
<div class="newContent" v-if="tabs == 1">
|
||||
<div class="newContent_title">
|
||||
<el-button type="primary" :disabled="beifenArr.length == 0"
|
||||
@click="moretableBeifen()">备份</el-button>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="localOnlyFiles" @selection-change="bifenChange"
|
||||
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }"
|
||||
style="width: 100%; height: calc(30vh);margin-bottom: 20px;" border>
|
||||
style="width: 100%; height: calc(60vh);margin-bottom: 20px;" border>
|
||||
<el-table-column type="selection" width="40" />
|
||||
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
||||
<el-table-column prop="name" label="文件名称"></el-table-column>
|
||||
@ -821,8 +857,8 @@ function CloseView() {
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="newContent">
|
||||
<div class="newContent_title"><span class="newContent_title_text">变更内容:</span>
|
||||
<div class="newContent" v-if="tabs == 2">
|
||||
<div class="newContent_title">
|
||||
<div>
|
||||
<el-button type="primary" :disabled="changeclick.length == 0"
|
||||
@click="bfclick('bei')">备份</el-button>
|
||||
@ -833,7 +869,7 @@ function CloseView() {
|
||||
<el-table v-loading="loading" :data="md5MismatchedFiles"
|
||||
@selection-change="handleChange"
|
||||
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }"
|
||||
style="width: 100%; height: calc(30vh);margin-bottom: 20px;" border>
|
||||
style="width: 100%; height: calc(60vh);margin-bottom: 20px;" border>
|
||||
<el-table-column type="selection" width="40" />
|
||||
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
||||
<el-table-column prop="name" label="文件名称"></el-table-column>
|
||||
@ -862,8 +898,8 @@ function CloseView() {
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="newContent">
|
||||
<div class="newContent_title"><span class="newContent_title_text">缺失内容:</span>
|
||||
<div class="newContent" v-if="tabs == 3">
|
||||
<div class="newContent_title">
|
||||
<div>
|
||||
<el-button type="primary" :disabled="restoreArr.length == 0"
|
||||
@click="moretablerestore()">恢复</el-button>
|
||||
@ -874,7 +910,7 @@ function CloseView() {
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="minioOnlyFiles" @selection-change="restoreChange"
|
||||
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }"
|
||||
style="width: 100%; height: calc(30vh);margin-bottom: 20px;" border>
|
||||
style="width: 100%; height: calc(60vh);margin-bottom: 20px;" border>
|
||||
<el-table-column type="selection" width="40" />
|
||||
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
||||
<el-table-column prop="name" label="文件名称"></el-table-column>
|
||||
@ -901,7 +937,7 @@ function CloseView() {
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<!-- </el-scrollbar> -->
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
@ -1150,7 +1186,7 @@ function CloseView() {
|
||||
|
||||
.newContent_title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
|
||||
@ -1161,4 +1197,34 @@ function CloseView() {
|
||||
}
|
||||
|
||||
}
|
||||
//tab
|
||||
.tabbs_all{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
margin-bottom: 5px;
|
||||
.tabbs_box{
|
||||
padding: 3px 5px 6px 5px;
|
||||
cursor: pointer;
|
||||
// color: #;
|
||||
box-sizing: border-box;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
|
||||
}
|
||||
.tabbs_box:hover{
|
||||
color: #409eff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tabbs_box1{
|
||||
padding: 3px 5px;
|
||||
cursor: pointer;
|
||||
color: #409eff;
|
||||
box-sizing: border-box;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
border-bottom: 3px solid #409eff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user