文件自动备份
This commit is contained in:
parent
a86bd18f4f
commit
69f7479006
@ -7,6 +7,22 @@ export function listLocalAndBackup(params:any) {
|
|||||||
params:params,
|
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) {
|
export function compare(params:any) {
|
||||||
return request({
|
return request({
|
||||||
@ -38,4 +54,12 @@ export function deleteTsFilesById(params:any) {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
params:params,
|
params:params,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
//所有文件备份到备份空间
|
||||||
|
export function automaticFileBackup(params:any) {
|
||||||
|
return request({
|
||||||
|
url: '/experimentalData/ts-files/automaticFileBackup',
|
||||||
|
method: 'post',
|
||||||
|
params:params,
|
||||||
|
});
|
||||||
}
|
}
|
112
web/src/views/testdata/fileSynchronization/index.vue
vendored
112
web/src/views/testdata/fileSynchronization/index.vue
vendored
@ -5,11 +5,12 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 { Search } from '@element-plus/icons-vue'
|
||||||
import { ElMessageBox, ElMessage } from "element-plus";
|
import { ElMessageBox, ElMessage } from "element-plus";
|
||||||
import { tstaskList, getTsNodesTree, tsFilesPage, deleteTsFilesByIds } from "@/api/datamanagement";
|
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文件编辑功能
|
//text文件编辑功能
|
||||||
import textEdit from '@/components/textEditing/index.vue'
|
import textEdit from '@/components/textEditing/index.vue'
|
||||||
import txtexl from '@/components/textEditing/txtexl.vue'
|
import txtexl from '@/components/textEditing/txtexl.vue'
|
||||||
@ -71,6 +72,27 @@ function diffFile() {
|
|||||||
differential.value = true
|
differential.value = true
|
||||||
getchayi()
|
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 comparearr: any = ref([])
|
||||||
const localOnlyFiles: any = ref([])
|
const localOnlyFiles: any = ref([])
|
||||||
@ -168,19 +190,19 @@ function handleNodeClick(data: any, node: any) {
|
|||||||
getWorkData()
|
getWorkData()
|
||||||
}
|
}
|
||||||
//工作空间树点击
|
//工作空间树点击
|
||||||
const handleCheckChange = (
|
const handleCheckChange = debounce((
|
||||||
data: any,
|
data: any,
|
||||||
checked: boolean,
|
checked: boolean,
|
||||||
indeterminate: boolean
|
indeterminate: boolean
|
||||||
) => {
|
) => {
|
||||||
if (checked == true && indeterminate == false) {
|
if (checked === true && indeterminate === false) {
|
||||||
workall.value.push(data)
|
workall.value.push(data)
|
||||||
} else {
|
} else {
|
||||||
workall.value = workall.value.filter(item => item.id !== data.id);
|
workall.value = workall.value.filter(item => item.id !== data.id);
|
||||||
}
|
}
|
||||||
comparearr.value = getclickdata(workall.value)
|
comparearr.value = getclickdata(workall.value)
|
||||||
beifentree.value!.setCheckedNodes(comparearr.value, false)
|
beifentree.value!.setCheckedNodes(comparearr.value, false)
|
||||||
}
|
}, 300)
|
||||||
//递归整理点击参数
|
//递归整理点击参数
|
||||||
function getclickdata(data: any) {
|
function getclickdata(data: any) {
|
||||||
data.forEach((item: any) => {
|
data.forEach((item: any) => {
|
||||||
@ -225,11 +247,11 @@ function assignment(data: any, difference: any) {
|
|||||||
}
|
}
|
||||||
//备份空间
|
//备份空间
|
||||||
const beifentree = ref()
|
const beifentree = ref()
|
||||||
function backupsChange(
|
const backupsChange = debounce((
|
||||||
data: any,
|
data: any,
|
||||||
checked: boolean,
|
checked: boolean,
|
||||||
indeterminate: boolean
|
indeterminate: boolean
|
||||||
) {
|
) => {
|
||||||
if (checked == true && indeterminate == false) {
|
if (checked == true && indeterminate == false) {
|
||||||
workall.value.push(data)
|
workall.value.push(data)
|
||||||
} else {
|
} else {
|
||||||
@ -237,7 +259,7 @@ function backupsChange(
|
|||||||
}
|
}
|
||||||
comparearr.value = getclickdata(workall.value)
|
comparearr.value = getclickdata(workall.value)
|
||||||
workref.value!.setCheckedNodes(comparearr.value, false)
|
workref.value!.setCheckedNodes(comparearr.value, false)
|
||||||
}
|
}, 300)
|
||||||
//右键菜单
|
//右键菜单
|
||||||
const handleRightClick = (event: Event, data: any, node: any) => {
|
const handleRightClick = (event: Event, data: any, node: any) => {
|
||||||
if (data.station != '0') {
|
if (data.station != '0') {
|
||||||
@ -547,6 +569,10 @@ function bfclick(type: any) {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getProject()
|
getProject()
|
||||||
});
|
});
|
||||||
|
// 组件卸载时取消防抖(可选)
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
handleCheckChange.cancel()
|
||||||
|
})
|
||||||
//拖动条
|
//拖动条
|
||||||
const vMove = {
|
const vMove = {
|
||||||
mounted(el: any) {
|
mounted(el: any) {
|
||||||
@ -683,6 +709,8 @@ function getFileSuffix(name: any) {
|
|||||||
function CloseView() {
|
function CloseView() {
|
||||||
isViewfile.value = false
|
isViewfile.value = false
|
||||||
}
|
}
|
||||||
|
//tabbas
|
||||||
|
const tabs = ref(1)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -712,6 +740,7 @@ function CloseView() {
|
|||||||
</aside>
|
</aside>
|
||||||
<section class="silderRight">
|
<section class="silderRight">
|
||||||
<div class="tree_button">
|
<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="diffFile()">文件差异性对比</el-button>
|
||||||
<el-button type="primary" :disabled="worktree" @click="differential = true">查看本次差异性对比</el-button>
|
<el-button type="primary" :disabled="worktree" @click="differential = true">查看本次差异性对比</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -720,7 +749,7 @@ function CloseView() {
|
|||||||
<div class="tree_title">工作空间:</div>
|
<div class="tree_title">工作空间:</div>
|
||||||
<div class="tree_content">
|
<div class="tree_content">
|
||||||
<el-scrollbar height="73vh">
|
<el-scrollbar height="73vh">
|
||||||
<el-tree ref="workref" style="max-width: 600px" :props="props" :data="workdata"
|
<el-tree ref="workref" style="max-width: 600px" :props="props" :data="workdata"
|
||||||
@node-click="workclick" @node-contextmenu="handleRightClick" default-expand-all
|
@node-click="workclick" @node-contextmenu="handleRightClick" default-expand-all
|
||||||
:expand-on-click-node="false" show-checkbox node-key="id" v-loading="worktree"
|
:expand-on-click-node="false" show-checkbox node-key="id" v-loading="worktree"
|
||||||
@check-change="handleCheckChange">
|
@check-change="handleCheckChange">
|
||||||
@ -743,7 +772,8 @@ function CloseView() {
|
|||||||
}">
|
}">
|
||||||
<div class="menu-item" @click="handleMenuClick('backups', 'local')">备份</div>
|
<div class="menu-item" @click="handleMenuClick('backups', 'local')">备份</div>
|
||||||
<div class="menu-item" @click="handleMenuClick('delete', '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>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
@ -776,7 +806,8 @@ function CloseView() {
|
|||||||
}">
|
}">
|
||||||
<div class="menu-item" @click="handleMenuClick('restore', 'minio')">恢复</div>
|
<div class="menu-item" @click="handleMenuClick('restore', 'minio')">恢复</div>
|
||||||
<div class="menu-item" @click="handleMenuClick('delete', '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>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
@ -785,16 +816,21 @@ function CloseView() {
|
|||||||
<!-- 文件差异性对比 -->
|
<!-- 文件差异性对比 -->
|
||||||
<el-dialog title="文件差异性对比" v-model="differential" width="50%" :before-close="diffClose" top="30px"
|
<el-dialog title="文件差异性对比" v-model="differential" width="50%" :before-close="diffClose" top="30px"
|
||||||
draggable destroy-on-close>
|
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>
|
<div>
|
||||||
<el-scrollbar height="400px">
|
<!-- <el-scrollbar height="400px"> -->
|
||||||
<div class="newContent">
|
<div class="newContent" v-if="tabs == 1">
|
||||||
<div class="newContent_title"><span class="newContent_title_text">新增内容:</span>
|
<div class="newContent_title">
|
||||||
<el-button type="primary" :disabled="beifenArr.length == 0"
|
<el-button type="primary" :disabled="beifenArr.length == 0"
|
||||||
@click="moretableBeifen()">备份</el-button>
|
@click="moretableBeifen()">备份</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table v-loading="loading" :data="localOnlyFiles" @selection-change="bifenChange"
|
<el-table v-loading="loading" :data="localOnlyFiles" @selection-change="bifenChange"
|
||||||
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }"
|
: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="selection" width="40" />
|
||||||
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
||||||
<el-table-column prop="name" label="文件名称"></el-table-column>
|
<el-table-column prop="name" label="文件名称"></el-table-column>
|
||||||
@ -821,8 +857,8 @@ function CloseView() {
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="newContent">
|
<div class="newContent" v-if="tabs == 2">
|
||||||
<div class="newContent_title"><span class="newContent_title_text">变更内容:</span>
|
<div class="newContent_title">
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" :disabled="changeclick.length == 0"
|
<el-button type="primary" :disabled="changeclick.length == 0"
|
||||||
@click="bfclick('bei')">备份</el-button>
|
@click="bfclick('bei')">备份</el-button>
|
||||||
@ -833,7 +869,7 @@ function CloseView() {
|
|||||||
<el-table v-loading="loading" :data="md5MismatchedFiles"
|
<el-table v-loading="loading" :data="md5MismatchedFiles"
|
||||||
@selection-change="handleChange"
|
@selection-change="handleChange"
|
||||||
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }"
|
: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="selection" width="40" />
|
||||||
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
||||||
<el-table-column prop="name" label="文件名称"></el-table-column>
|
<el-table-column prop="name" label="文件名称"></el-table-column>
|
||||||
@ -862,8 +898,8 @@ function CloseView() {
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="newContent">
|
<div class="newContent" v-if="tabs == 3">
|
||||||
<div class="newContent_title"><span class="newContent_title_text">缺失内容:</span>
|
<div class="newContent_title">
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" :disabled="restoreArr.length == 0"
|
<el-button type="primary" :disabled="restoreArr.length == 0"
|
||||||
@click="moretablerestore()">恢复</el-button>
|
@click="moretablerestore()">恢复</el-button>
|
||||||
@ -874,7 +910,7 @@ function CloseView() {
|
|||||||
</div>
|
</div>
|
||||||
<el-table v-loading="loading" :data="minioOnlyFiles" @selection-change="restoreChange"
|
<el-table v-loading="loading" :data="minioOnlyFiles" @selection-change="restoreChange"
|
||||||
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }"
|
: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="selection" width="40" />
|
||||||
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
|
||||||
<el-table-column prop="name" label="文件名称"></el-table-column>
|
<el-table-column prop="name" label="文件名称"></el-table-column>
|
||||||
@ -901,7 +937,7 @@ function CloseView() {
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
<!-- </el-scrollbar> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -1150,7 +1186,7 @@ function CloseView() {
|
|||||||
|
|
||||||
.newContent_title {
|
.newContent_title {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 10px;
|
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>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user