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() { mounted() {
this.getLeftTree() this.getLeftTree(null)
}, },
methods: { methods: {
// //
@ -93,7 +93,7 @@ export default {
}, },
// //
async getLeftTree() { async getLeftTree(selectedNode) {
console.log('获取左侧树形结构') console.log('获取左侧树形结构')
const res = await getDocCenterLeftTreeAPI() const res = await getDocCenterLeftTreeAPI()
@ -102,13 +102,25 @@ export default {
if (res.data.length > 0) { if (res.data.length > 0) {
// DOM // DOM
this.$nextTick(() => { 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) { if (!this.treeData || this.treeData.length === 0) {
return return
} }

View File

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

View File

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

View File

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

View File

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