This commit is contained in:
BianLzhaoMin 2025-11-20 17:11:56 +08:00
parent 4d7530149e
commit c5600777bc
5 changed files with 93 additions and 41 deletions

View File

@ -34,7 +34,7 @@ export default {
}
},
mounted() {
this.getLeftTree()
this.getLeftTree(null)
},
methods: {
//
@ -93,7 +93,7 @@ export default {
},
//
async getLeftTree() {
async getLeftTree(selectedNode) {
console.log('获取左侧树形结构')
const res = await getDocCenterLeftTreeAPI()
@ -102,13 +102,25 @@ export default {
if (res.data.length > 0) {
// DOM
this.$nextTick(() => {
this.selectFirstNode()
this.selectFirstNode(selectedNode)
})
}
},
//
selectFirstNode() {
selectFirstNode(selectedNode) {
// selectedNodeselectedNode
if (selectedNode) {
this.$refs.tree.setCurrentKey(selectedNode.id)
//
const node = this.$refs.tree.getNode(selectedNode.id)
if (node) {
//
this.handleNodeClick(selectedNode, node)
}
return
}
if (!this.treeData || this.treeData.length === 0) {
return
}

View File

@ -194,6 +194,7 @@
<template #outerContent>
<component
ref="componentRef"
:selectedFiles="selectedFiles"
:selectedNode="selectedNode"
v-bind="dialogConfig.outerComponentProps"
:type="type"
@ -410,28 +411,43 @@ export default {
name: '',
acthType: '',
authType: '',
//
selectedFiles: [],
}
},
watch: {
//
selectedNode: {
handler(newNode) {
if (newNode) {
//
this.queryParams.pageNum = 1
this.queryParams.parentId = newNode.id
this.queryParams.type = newNode.type
this.queryParams.keyWord = ''
this.queryParams.labelIds = ''
this.queryParams.auth = newNode.auth
this.acthType = newNode.auth === null ? 0 : newNode.auth
this.authType = newNode.id
this.acthType = newNode.auth === null ? 0 : newNode.auth
this.authType = newNode.id
console.log(newNode, 'newNode***')
// ID
// ID
this.getTableList()
}
this.queryParams.pageNum = 1
this.queryParams.parentId = newNode.id
this.queryParams.type = newNode.type
this.queryParams.keyWord = ''
this.queryParams.labelIds = ''
this.queryParams.auth = newNode.auth
// console.log(newNode, 'newNode***')
// ID
// ID
this.getTableList()
// if (newNode) {
// //
// // this.queryParams.pageNum = 1
// // this.queryParams.parentId = newNode.id
// // this.queryParams.type = newNode.type
// // this.queryParams.keyWord = ''
// // this.queryParams.labelIds = ''
// // this.queryParams.auth = newNode.auth
// // console.log(newNode, 'newNode***')
// // // ID
// // // ID
// // this.getTableList()
// }
},
deep: true,
immediate: false,
@ -446,6 +462,14 @@ export default {
methods: {
//
async getTableList() {
if (this.selectedNode) {
this.queryParams.parentId = this.selectedNode.id
this.queryParams.type = this.selectedNode.type
this.queryParams.auth = this.selectedNode.auth
this.acthType =
this.selectedNode.auth === null ? 0 : this.selectedNode.auth
this.authType = this.selectedNode.id
}
const res = await getDocCenterRightListAPI(this.queryParams)
this.tableData = res.rows
this.total = res.total
@ -515,9 +539,11 @@ export default {
this.dialogConfig.outerTitle = '移动'
this.dialogConfig.outerVisible = true
this.dialogConfig.outerComponent = 'Move'
this.dialogConfig.outerComponentProps = {
selectedFiles: this.selectedRows,
}
this.selectedFiles = this.selectedRows
// this.dialogConfig.outerComponentProps = {
// selectedFiles: this.selectedRows,
// }
},
//
@ -525,9 +551,10 @@ export default {
this.dialogConfig.outerTitle = '移动'
this.dialogConfig.outerVisible = true
this.dialogConfig.outerComponent = 'Move'
this.dialogConfig.outerComponentProps = {
selectedFiles: [row],
}
this.selectedFiles = [row]
// this.dialogConfig.outerComponentProps = {
// selectedFiles: [row],
// }
},
//
@ -558,6 +585,7 @@ export default {
if (res.code === 200) {
this.$modal.msgSuccess('删除成功')
this.getTableList()
this.$emit('updateLeftTree', this.selectedNode)
} else {
this.$modal.msgError(res.message)
}
@ -589,6 +617,7 @@ export default {
if (res.code === 200) {
this.$modal.msgSuccess('删除成功')
this.getTableList()
this.$emit('updateLeftTree', this.selectedNode)
} else {
this.$modal.msgError(res.message)
}
@ -683,9 +712,10 @@ export default {
this.dialogConfig.outerTitle = '添加副本'
this.dialogConfig.outerVisible = true
this.dialogConfig.outerComponent = 'AddCopy'
this.dialogConfig.outerComponentProps = {
selectedFiles: this.selectedRows,
}
this.selectedFiles = this.selectedRows
// this.dialogConfig.outerComponentProps = {
// selectedFiles: this.selectedRows,
// }
},
//
@ -693,9 +723,10 @@ export default {
this.dialogConfig.outerTitle = '添加副本'
this.dialogConfig.outerVisible = true
this.dialogConfig.outerComponent = 'AddCopy'
this.dialogConfig.outerComponentProps = {
selectedFiles: [row],
}
this.selectedFiles = [row]
// this.dialogConfig.outerComponentProps = {
// selectedFiles: [row],
// }
},
//
@ -751,8 +782,8 @@ export default {
//
this.getTableList()
//
// this.$emit('updateLeftTree')
//
this.$emit('updateLeftTree', this.selectedNode)
} catch (error) {
console.error('操作失败:', error)
// Element UI

View File

@ -121,9 +121,9 @@ export default {
//
async submit() {
//
if (!this.selectedFiles || this.selectedFiles.length === 0) {
return Promise.reject(new Error('请先选择要添加副本的文件'))
}
// if (!this.selectedFiles || this.selectedFiles.length === 0) {
// return Promise.reject(new Error(''))
// }
//
if (!this.selectedFolder || !this.selectedFolder.id) {

View File

@ -81,6 +81,11 @@ export default {
//
handleNodeClick(data) {
// idid
if (this.selectedFiles.some((file) => file.name == data.name)) {
this.$modal.msgWarning('不能移动到自身')
return
}
this.selectedFolder = data
//
this.$nextTick(() => {
@ -121,9 +126,9 @@ export default {
//
async submit() {
//
if (!this.selectedFiles || this.selectedFiles.length === 0) {
return Promise.reject(new Error('请先选择要移动的文件'))
}
// if (!this.selectedFiles || this.selectedFiles.length === 0) {
// return Promise.reject(new Error(''))
// }
//
if (!this.selectedFolder || !this.selectedFolder.id) {

View File

@ -11,6 +11,7 @@
<!-- 右侧表格内容 -->
<div class="right-content">
<RightTable
ref="rightTableRef"
:breadcrumb-data="breadcrumbData"
:selected-node="selectedNode"
@updateLeftTree="updateLeftTree"
@ -42,6 +43,9 @@ export default {
handleNodeClick(data, node, breadcrumbArray) {
this.selectedNode = data
this.breadcrumbData = breadcrumbArray || []
//
// this.$refs.rightTableRef.getTableList()
},
//
@ -55,9 +59,9 @@ export default {
},
//
updateLeftTree() {
updateLeftTree(selectedNode) {
console.log(this.$refs.leftTreeRef, '更新树')
this.$refs.leftTreeRef.getLeftTree()
this.$refs.leftTreeRef.getLeftTree(selectedNode)
},
},
}