diff --git a/web/src/api/storage/index.ts b/web/src/api/storage/index.ts index 745a1c7..deff74a 100644 --- a/web/src/api/storage/index.ts +++ b/web/src/api/storage/index.ts @@ -36,4 +36,12 @@ export function storagesBytype(params:any) { method: 'get', params:params }); +} +//查询存储元内容 +export function storagesType(params:any) { + return request({ + url: '/admin/storagesType', + method: 'get', + params:params + }); } \ No newline at end of file diff --git a/web/src/components/file/file/useFileUpload.js b/web/src/components/file/file/useFileUpload.js index 5f0fa7a..e11d1bc 100644 --- a/web/src/components/file/file/useFileUpload.js +++ b/web/src/components/file/file/useFileUpload.js @@ -3,6 +3,7 @@ import { ElMessageBox, ElMessage } from "element-plus"; import { ref,reactive,computed,nextTick,watch} from "vue"; import {uploadFileReq} from "@/api/file-operator"; import axios from "axios"; +import { storagesType } from "@/api/storage"; import common from "@/components/file/common"; import {removeDuplicateSlashes} from "fast-glob/out/managers/patterns"; import { useEventBus } from '@vueuse/core'; @@ -444,20 +445,25 @@ export default function useFileUpload() { let s3UploadType = common.storageType.s3Type; let onedriveUploadType = common.storageType.micrsoftType; let storagea - if( param.storageKey === 'local'||param.storageKey === 'sdlocal' ){ - storagea = 'local' - }else if( param.storageKey === 'minio'){ - storagea = 'minio' - } - if (proxyUploadType.includes( storagea)) { - fileProxyUpload(file, res.data, fileIndex); - } else if (s3UploadType.includes( storagea)) { - s3FileUpload(file, res.data, fileIndex); - } else if (onedriveUploadType.includes( storagea)) { - onedriveUpload(file, res.data, fileIndex); - } else if ( storagea === 'upyun') { - upyunFileUpload(file, res.data, fileIndex); - } + storagesType({key:param.storageKey}).then((name)=>{ + console.log(name.data.type) + storagea = name.data.type + if (proxyUploadType.includes( storagea)) { + fileProxyUpload(file, res.data, fileIndex); + } else if (s3UploadType.includes( storagea)) { + s3FileUpload(file, res.data, fileIndex); + } else if (onedriveUploadType.includes( storagea)) { + onedriveUpload(file, res.data, fileIndex); + } else if ( storagea === 'upyun') { + upyunFileUpload(file, res.data, fileIndex); + } + }) + // if( param.storageKey === 'local' ){ + // storagea = 'local' + // }else if( param.storageKey === 'minio'){ + // storagea = 'minio' + // } + }).catch((err) => { baseOnUploadError(fileIndex, err) }); diff --git a/web/src/components/textEditing/index.vue b/web/src/components/textEditing/index.vue index 318b1ad..db093fe 100644 --- a/web/src/components/textEditing/index.vue +++ b/web/src/components/textEditing/index.vue @@ -35,6 +35,10 @@ const props = defineProps({ type: String, required: true }, + taskId: { + type: String, + required: true + }, }); const statusMessage = ref('') onMounted(() => { @@ -88,7 +92,7 @@ function convertParagraphsToNewlines(html) { // 保存文件内容 const saveCcontent = () => { const content = convertParagraphsToNewlines(editor.value.getHTML()) - saveContent({ id: props.rowId, content: content }).then((res) => { + saveContent({ id: props.rowId, content: content,taskId:props.taskId}).then((res) => { loadContent() ElMessage.success('保存成功') }) diff --git a/web/src/components/textEditing/txtexl.vue b/web/src/components/textEditing/txtexl.vue index 3487044..835c651 100644 --- a/web/src/components/textEditing/txtexl.vue +++ b/web/src/components/textEditing/txtexl.vue @@ -43,6 +43,10 @@ const props = defineProps({ type: String, default: false }, + taskId: { + type: String, + required: true + }, }); // 配置项 @@ -199,7 +203,7 @@ const handleEdit = (rowIndex, colIndex, event) => { const saveChanges = () => { // 构造表格数据(示例使用\t分隔) // const csvData = rawData.map(row => row.join('\t')).join('\n'); - batchModify({ id: props.rowId, modifications: tabledata.value }).then((res) => { + batchModify({ id: props.rowId, modifications: tabledata.value,taskId:props.taskId }).then((res) => { ElMessage.success('保存成功') if (props.fileUrl) { abortLoading(); diff --git a/web/src/views/special/document/index.vue b/web/src/views/special/document/index.vue index 284bd56..78b6a59 100644 --- a/web/src/views/special/document/index.vue +++ b/web/src/views/special/document/index.vue @@ -51,6 +51,7 @@ onBeforeUnmount(() => { } }) const projectId = ref() +const storageKey:any = ref() //websocket let ws1 function setupWebSocket() { @@ -99,11 +100,14 @@ const vMove = { const projectArr = ref([]) const projectName = ref('') +const localStorageId = ref('') //获取所有项目 function getProject() { projectList().then((res: any) => { projectArr.value = res.data projectId.value = projectArr.value[0].id + storageKey.value = projectArr.value[0].key + localStorageId.value = projectArr.value[0].localStorageId projectName.value = projectArr.value[0].projectName ws1 = new WebSocket(userStore.WebSocketUrl + '/websocket/' + 'projectId_' + projectId.value) setupWebSocket() @@ -146,6 +150,8 @@ const filePath = ref('') function gettreedata() { treeloading.value = true treeForm.value.projectId = projectId.value + let keyar = projectArr.value.find(item => item.localStorageId === localStorageId.value); + storageKey.value = keyar.key getNodesTree(treeForm.value).then((res: any) => { treedata.value = res.data treeloading.value = false @@ -361,7 +367,7 @@ function openFile() { titleon.value = false title.value = "上传文件" localStorage.setItem('filepath', '/filestemporary/'); - localStorage.setItem('storageKey', JSON.stringify(['sdlocal'])); + localStorage.setItem('storageKey', JSON.stringify([storageKey.value])); upfile.value = true fileObj.value = { projectId: '', //所属项目ID @@ -386,7 +392,7 @@ function upfileZip() { // ElMessage.warning("请保持压缩包内第一个文件夹与项目名称一致!!!") title.value = "上传项目包并扫描" localStorage.setItem('filepath', '/temporary'); - localStorage.setItem('storageKey', JSON.stringify(['sdlocal'])); + localStorage.setItem('storageKey', JSON.stringify([storageKey.value])); upfile.value = true fileObj.value = { projectId: '', //所属项目ID @@ -443,7 +449,7 @@ function delfileOne(row: any) { type: "FILE" } ], - storageKey: "sdlocal" + storageKey: storageKey.value } batchDeleteReq(JSON.stringify(parmas)).then((res) => { }) diff --git a/web/src/views/system/storage/index.vue b/web/src/views/system/storage/index.vue index 99e9e69..e87dd4f 100644 --- a/web/src/views/system/storage/index.vue +++ b/web/src/views/system/storage/index.vue @@ -84,7 +84,7 @@ function editproject(row: any) { //删除项目弹框 function delproject(row: any) { ElMessageBox.confirm( - '您确定要删除该项目及其中的节点和文件吗?', + '您确定要删除该存储空间吗?', '警告', { confirmButtonText: '确定', @@ -93,6 +93,10 @@ function delproject(row: any) { } ) .then(() => { + if(row.storeContent){ + ElMessage.warning('已有项目绑定该存储空间,请先解除关联!') + return + } loading.value = true storagestorageId(row.id).then((res: any) => { if (res.code == 0) { @@ -286,10 +290,10 @@ function handleClose1() { - + - + diff --git a/web/src/views/testdata/datamanagement/index.vue b/web/src/views/testdata/datamanagement/index.vue index 85568d3..abef814 100644 --- a/web/src/views/testdata/datamanagement/index.vue +++ b/web/src/views/testdata/datamanagement/index.vue @@ -13,7 +13,7 @@ import { ElMessageBox, ElMessage, ElMain } from "element-plus"; import Page from '@/components/Pagination/page.vue'; import AudioPlayer from '@/components/file/preview/AudioPlayer.vue'; import { batchDeleteReq } from "@/api/file-operator"; -import { tstaskList, obtaintestData, getTsNodesTree, confirmDeleteNodes,addTsNodes, selectTsNodesByTskeId, updateTsNodes, deleteTsNodesById, tsFilesPage, addTsFiles, testDataScanById, updateTsFiles, deleteTsFilesById, listTsFiles, deleteTsFilesByIds, compress, Decompression, compare, downloadToLocal, uploadToBackup, addTsFile, list, moveFileFolder, copyFileFolder, startSimpleNavi, stopSimpleNavi } from "@/api/datamanagement"; +import { tstaskList, obtaintestData, getTsNodesTree, confirmDeleteNodes, addTsNodes, selectTsNodesByTskeId, updateTsNodes, deleteTsNodesById, tsFilesPage, addTsFiles, testDataScanById, updateTsFiles, deleteTsFilesById, listTsFiles, deleteTsFilesByIds, compress, Decompression, compare, downloadToLocal, uploadToBackup, addTsFile, list, moveFileFolder, copyFileFolder, startSimpleNavi, stopSimpleNavi } from "@/api/datamanagement"; import ZUpload from '@/components/file/ZUpload.vue' import useFileUpload from "@/components/file/file/useFileUpload"; import useHeaderStorageList from "@/components/header/useHeaderStorageList"; @@ -106,11 +106,15 @@ watch(() => projectId.value, (newVal) => { const projectArr = ref([]) const taskName = ref('') +const localStorageId = ref('') +const storageKey:any = ref() //获取所有项目 function getProject() { tstaskList().then((res: any) => { projectArr.value = res.data projectId.value = projectArr.value[0].id + storageKey.value = projectArr.value[0].key + localStorageId.value = projectArr.value[0].localStorageId taskName.value = projectArr.value[0].taskName ws1 = new WebSocket(userStore.WebSocketUrl + '/websocket/' + 'taskId_' + projectId.value) setupWebSocket() @@ -120,17 +124,9 @@ function getProject() { } //扫描 function scan() { - selectTsNodesByTskeId({ taskId: projectId.value }).then((res: any) => { - if (res.msg == "该项目已经初始化完成,局部更新请选择节点上传文件!") { - ElMessage.warning(res.msg) - return - - } else { - testDataScanById({ id: projectId.value }).then((res: any) => { - tonstatus() - }) - } + testDataScanById({ id: projectId.value }).then((res: any) => { + tonstatus() }) } @@ -167,6 +163,8 @@ const filepath = ref('') function gettreedata() { treeloading.value = true treeForm.value.taskId = projectId.value + let keyar = projectArr.value.find(item => item.localStorageId === localStorageId.value); + storageKey.value = keyar.key getTsNodesTree(treeForm.value).then((res: any) => { treedata.value = res.data treeloading.value = false @@ -229,15 +227,23 @@ function addSubItem(row: any) { } //修改子项目 function editSubItem(row: any) { - title.value = "修改子节点" - frame.value = true - if (row.subRegions) { - delete row.subRegions - } - if (row.createTime) { - delete row.createTime - } - projectForme.value = JSON.parse(JSON.stringify(row)) + confirmDeleteNodes({ id: row.nodeId }).then((res: any) => { + if (res.data.data.status == 1) { + title.value = "修改子节点" + frame.value = true + if (row.subRegions) { + delete row.subRegions + } + if (row.createTime) { + delete row.createTime + } + projectForme.value = JSON.parse(JSON.stringify(row)) + } else { + ElMessage.warning("该节点中含有已备份的文件,无法修改") + return + } + }) + } //表单确定 async function submitForm(formEl: any) { @@ -286,7 +292,7 @@ function delSubItem(row: any) { } ) .then(() => { - confirmDeleteNodes({id:row.nodeId}).then((res: any) => { + confirmDeleteNodes({ id: row.nodeId }).then((res: any) => { if (res.data.data.status == 1) { loading.value = true deleteTsNodesById({ id: row.nodeId, path: row.path }).then((res: any) => { @@ -364,7 +370,7 @@ const upfile = ref(false) function openFile() { title.value = "上传文件" localStorage.setItem('filepath', creatform.value.workPath ? creatform.value.workPath : filepath.value); - localStorage.setItem('storageKey', JSON.stringify(['local'])); + localStorage.setItem('storageKey', JSON.stringify([storageKey.value])); upfile.value = true fileObj.value = { taskId: '', //所属项目ID @@ -410,7 +416,7 @@ function delfileOne(row: any) { type: "FILE" } ], - storageKey: "minio" + storageKey: "storageKey.value" } batchDeleteReq(JSON.stringify(parmas)).then((res) => { }) @@ -492,7 +498,7 @@ function delfile(row: any) { ) .then(() => { loading.value = true - deleteTsFilesById({ id: row.id, type: 'local' }).then((res: any) => { + deleteTsFilesById({ id: row.id, type: 'local',taskId:projectId.value }).then((res: any) => { if (res.code == 0) { getdata() ElMessage({ @@ -528,7 +534,7 @@ function delprojectArr() { ) .then(() => { loading.value = true - deleteTsFilesByIds({ ids: ids.join(','), type: 'local' }).then((res: any) => { + deleteTsFilesByIds({ ids: ids.join(','), type: 'local',taskId:projectId.value }).then((res: any) => { if (res.code == 0) { ElMessage({ type: 'success', @@ -871,6 +877,7 @@ function paste() { newFileName: [], rename: '', type: '', + taskId:projectId.value } repeatObj.newPath = creatform.value.workPath ? creatform.value.workPath : filepath.value repeatObj.parentId = creatform.value.parentId ? creatform.value.parentId : '00' @@ -894,6 +901,7 @@ function paste() { repeatObj.newFileName.push(items.fileName) }) repeatObj.newFileName = repeatObj.newFileName.join(',') + if (copytype.value == 'move') { moveFileFolder(repeatObj).then((res: any) => { if (res.code == 0) { @@ -984,6 +992,7 @@ function copycover(row: any) { newFileName: [], rename: '', type: '', + taskId:projectId.value } repeatObj.newPath = creatform.value.workPath ? creatform.value.workPath : filepath.value repeatObj.parentId = creatform.value.parentId ? creatform.value.parentId : '00' @@ -1059,6 +1068,7 @@ function copysomefile() { newFileName: [], rename: '', type: '', + taskId:projectId.value } repeatObj.newPath = creatform.value.workPath ? creatform.value.workPath : filepath.value repeatObj.parentId = creatform.value.parentId ? creatform.value.parentId : '00' @@ -1123,6 +1133,7 @@ async function submitrename(formEl: any) { newFileName: [], rename: '', type: '', + taskId:projectId.value } repeatObj.newPath = creatform.value.workPath ? creatform.value.workPath : filepath.value repeatObj.parentId = creatform.value.parentId ? creatform.value.parentId : '00' @@ -1288,6 +1299,7 @@ async function submitzip(formEl: any) { zipObj.value.compressedPath = zipObj.value.compressedPath } zipObj.value.path = filepath.value + zipObj.value.taskId = projectId.value compress(zipObj.value).then((res: any) => { if (res.code == 0) { zipfiles.value = false @@ -1299,7 +1311,7 @@ async function submitzip(formEl: any) { }) } else { - Decompression({ id: jiezip.value.id, parentId: zipParentid.value, decompressionPath: zipObj.value.compressedPath, path: filepath.value }).then((res: any) => { + Decompression({ id: jiezip.value.id, parentId: zipParentid.value, decompressionPath: zipObj.value.compressedPath, path: filepath.value,taskId:projectId.value }).then((res: any) => { if (res.code == 0) { ElMessage.success('解压成功') getdata() @@ -1525,7 +1537,8 @@ const maptime: any = ref(1) const qvehuan: any = ref(false) const qvehuan1: any = ref(false) function frequency(row: any) { - startSimpleNavi({ samTimes: maptime.value, id: fredid.value, token: userStore.userId }).then((res: any) => { + startSimpleNavi({ samTimes: maptime.value, id: fredid.value, token: userStore.userId,taskId:projectId.value + }).then((res: any) => { if (res.code == '0' && row) { ElMessage.success("切换成功") getSSELink() @@ -1640,7 +1653,7 @@ function repstring(row: any) { {{ data.nodeName }} - + @@ -1696,7 +1709,8 @@ function repstring(row: any) { @@ -2057,13 +2071,13 @@ function repstring(row: any) { @update="CloseView" /> - + - + @@ -2157,7 +2171,7 @@ function repstring(row: any) { .img_tree { display: flex; - width: 13%; + width: 20%; align-items: center; justify-content: space-between; @@ -2180,7 +2194,8 @@ function repstring(row: any) { background: #dbf500; cursor: pointer; } -.tableweight:hover{ + +.tableweight:hover { color: #409eff; } diff --git a/web/src/views/testdata/fileSynchronization/index.vue b/web/src/views/testdata/fileSynchronization/index.vue index de5b88e..beae864 100644 --- a/web/src/views/testdata/fileSynchronization/index.vue +++ b/web/src/views/testdata/fileSynchronization/index.vue @@ -653,7 +653,7 @@ const handleMenuClick = (action: string, type: any) => { size: currentNode.value.fileSize, type: currentNode.value.isFile }] - uploadToBackup({ parameterLists: params }).then((res: any) => { + uploadToBackup({ parameterLists: params,taskId:projectId.value }).then((res: any) => { if (res.code == '0') { ElMessage.success("上传成功") localOnlyFiles.value = localOnlyFiles.value.filter((item: any) => item.id !== currentNode.value.id) @@ -667,7 +667,7 @@ const handleMenuClick = (action: string, type: any) => { break case 'delete': // 处理删除逻辑 - deleteTsFilesById({ id: currentNode.value.id, type: type }).then((res: any) => { + deleteTsFilesById({ id: currentNode.value.id, type: type,taskId:projectId.value }).then((res: any) => { if (res.code == '0') { ElMessage.success("删除成功") getlocaltree() @@ -708,7 +708,7 @@ function tableBeifen(row: any) { }] loading1.value = true loading2.value = true - uploadToBackup({ parameterLists: params }).then((res: any) => { + uploadToBackup({ parameterLists: params,taskId:projectId.value }).then((res: any) => { if (res.code == '0') { ElMessage.success("上传成功") diffSure(false) @@ -740,7 +740,7 @@ function moretableBeifen() { }) loading1.value = true loading2.value = true - uploadToBackup({ parameterLists: beifenArr3 }).then((res: any) => { + uploadToBackup({ parameterLists: beifenArr3,taskId:projectId.value }).then((res: any) => { if (res.code == '0') { diffSure(false) diffChange(false) @@ -829,7 +829,7 @@ function delhuifu() { ids.value.push(item.id) }) loading3.value = true - deleteTsFilesByIds({ ids: ids.value.join(','), type: 'minio' }).then((res: any) => { + deleteTsFilesByIds({ ids: ids.value.join(','), type: 'minio',taskId:projectId.value }).then((res: any) => { if (res.code == '0') { ElMessage.success("删除成功") diffMiss(false) @@ -868,7 +868,7 @@ function bfclick(type: any) { beifenArr2.forEach((items: any) => { beifenArr3.push({ path: items.workPath, name: items.fileName, size: items.fileSize, type: items.isFile }) }) - uploadToBackup({ parameterLists: beifenArr3 }).then((res: any) => { + uploadToBackup({ parameterLists: beifenArr3,taskId:projectId.value }).then((res: any) => { if (res.code == '0') { ElMessage.success("上传成功") diffChange(false) @@ -966,7 +966,7 @@ function openPreview(row: any, type: any) { } } function geturl(row: any, type1: any, pan: any) { - obtainUrl({ id: row.id, type: type1 }).then((res: any) => { + obtainUrl({ id: row.id, type: type1,taskId:projectId.value }).then((res: any) => { if (pan) { ViewfileUrl.value = res.data.url isViewfile.value = true