接口项更改

This commit is contained in:
wangxk 2025-06-19 09:02:15 +08:00
parent f722ecea6e
commit f7a3023629
8 changed files with 109 additions and 62 deletions

View File

@ -37,3 +37,11 @@ export function storagesBytype(params:any) {
params:params
});
}
//查询存储元内容
export function storagesType(params:any) {
return request({
url: '/admin/storagesType',
method: 'get',
params:params
});
}

View File

@ -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,11 +445,9 @@ 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'
}
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)) {
@ -458,6 +457,13 @@ export default function useFileUpload() {
} 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)
});

View File

@ -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('保存成功')
})

View File

@ -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();

View File

@ -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) => {
})

View File

@ -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() {
<el-form-item label=" 存储源名称" prop="name">
<el-input v-model="projectForme.name" />
</el-form-item>
<el-form-item label=" 存储源别名">
<el-form-item label=" 存储源别名" prop="key">
<el-input v-model="projectForme.key" />
</el-form-item>
<el-form-item label=" 存储源备注">
<el-form-item label=" 存储源备注" prop="remark">
<el-input v-model="projectForme.remark" />
</el-form-item>
<el-form-item label=" 存储策略" prop="type">

View File

@ -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,18 +124,10 @@ 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()
})
}
})
}
const tonloading = ref(false)
@ -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,6 +227,8 @@ function addSubItem(row: any) {
}
//
function editSubItem(row: any) {
confirmDeleteNodes({ id: row.nodeId }).then((res: any) => {
if (res.data.data.status == 1) {
title.value = "修改子节点"
frame.value = true
if (row.subRegions) {
@ -238,6 +238,12 @@ function editSubItem(row: any) {
delete row.createTime
}
projectForme.value = JSON.parse(JSON.stringify(row))
} else {
ElMessage.warning("该节点中含有已备份的文件,无法修改")
return
}
})
}
//
async function submitForm(formEl: 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) {
<span class="custom-tree-node">
<span class="text">{{ data.nodeName }}</span>
<span class="img_tree">
<!-- <img src="@/assets/project/xiu.png" alt="" title="编辑" @click="editSubItem(data)"> -->
<img src="@/assets/project/xiu.png" alt="" title="编辑" @click="editSubItem(data)">
<img src="@/assets/project/del.png" alt="" title="删除" @click="delSubItem(data)">
<!-- <img src="@/assets/images/chayi.png" alt="" title="差异性对比" @click="opendifference(data)"> -->
<img src="@/assets/project/jia.png" alt="" title="添加子项目" @click="addSubItem(data)">
@ -1696,7 +1709,8 @@ function repstring(row: any) {
<!-- <el-table-column type="index" label="序号" width="70" align="center"></el-table-column> -->
<el-table-column prop="fileName" label="文件名称" width="200">
<template #default="scope">
<div class="tableweight" v-if="scope.row.isFile == 'FOLDER'" @click="openNode(scope.row)" >{{ scope.row.fileName }} </div>
<div class="tableweight" v-if="scope.row.isFile == 'FOLDER'" @click="openNode(scope.row)">{{
scope.row.fileName }} </div>
<div v-else-if="scope.row.isFile == 'FILE'">{{ scope.row.fileName }} </div>
</template>
</el-table-column>
@ -2057,13 +2071,13 @@ function repstring(row: any) {
@update="CloseView" />
<el-dialog :close-on-click-modal="false" :title="title" v-model="textedit" :before-close="textClose" top="30px"
draggable width="60%" destroy-on-close>
<textEdit :rowId="rowId" :fileUrl="fileUrl1" />
<textEdit :rowId="rowId" :fileUrl="fileUrl1" :taskId="projectId" />
<!-- <txtexl :file-url="fileUrl" /> -->
</el-dialog>
<el-dialog :close-on-click-modal="false" :title="title" v-model="textedit1" :before-close="texexceltClose"
top="30px" draggable width="60%" destroy-on-close>
<txtexl :file-url="fileUrl" :rowId="rowId" />
<txtexl :file-url="fileUrl" :rowId="rowId" :taskId="projectId" />
</el-dialog>
</div>
@ -2157,7 +2171,7 @@ function repstring(row: any) {
.img_tree {
display: flex;
width: 13%;
width: 20%;
align-items: center;
justify-content: space-between;
@ -2180,6 +2194,7 @@ function repstring(row: any) {
background: #dbf500;
cursor: pointer;
}
.tableweight:hover {
color: #409eff;
}

View File

@ -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