[update 拆分编辑] 左侧树节点可拖拽

(cherry picked from commit 077babed84)
This commit is contained in:
danshihao
2024-08-16 15:05:45 +08:00
parent 98da0e2709
commit c4e92992f5
2 changed files with 45 additions and 2 deletions
+3
View File
@@ -52,6 +52,8 @@ const copyClause = (params) => getAction('/laws/DocumentTool/documentSplit/copyD
const getInterpretationArticlesList = (params) => getAction('/laws/DocumentTool/documentSplit/queryInterpretationArticlesList', params) const getInterpretationArticlesList = (params) => getAction('/laws/DocumentTool/documentSplit/queryInterpretationArticlesList', params)
// 标准对应的解读信息 // 标准对应的解读信息
const getStandardInterpretation = (params) => postAction('/laws/DocumentTool/documentSplit/queryDocumentSplitDetailList', params) const getStandardInterpretation = (params) => postAction('/laws/DocumentTool/documentSplit/queryDocumentSplitDetailList', params)
// 文档拆分-编辑-拖拽节点
const dragClauseTreeNode = (params) => getAction('/split/sarFileSplitMenu/updateMenuLevel', params)
// 文档对比-发布/撤回 // 文档对比-发布/撤回
const withdrawPublication = (params) => postAction('/compare/sarFileCompareInfo/changeState', params) const withdrawPublication = (params) => postAction('/compare/sarFileCompareInfo/changeState', params)
@@ -135,6 +137,7 @@ export {
copyClause, copyClause,
getInterpretationArticlesList, getInterpretationArticlesList,
getStandardInterpretation, getStandardInterpretation,
dragClauseTreeNode,
// 文档比对 // 文档比对
withdrawPublication, withdrawPublication,
@@ -11,7 +11,10 @@
:tree-data="treeData" :tree-data="treeData"
:selected-keys="selectedKeys" :selected-keys="selectedKeys"
:expanded-keys.sync="expandedKeys" :expanded-keys.sync="expandedKeys"
:replaceFields="{key: 'id'}"> :replaceFields="{key: 'id'}"
class="draggable-tree"
draggable
@drop="onDrop">
<template #title="record"> <template #title="record">
<div class="tree-operate-node" <div class="tree-operate-node"
@mouseenter="handleTreeMouseover(record.id)" @mouseenter="handleTreeMouseover(record.id)"
@@ -211,7 +214,7 @@ import {
batchCopyClause, batchCopyClause,
merageClause, merageClause,
getClauseTreeData, getClauseTreeData,
copyClause copyClause, dragClauseTreeNode
} from '../../../api/documentToolApi.js' } from '../../../api/documentToolApi.js'
import Search from '../../../components/customField/Search.vue' import Search from '../../../components/customField/Search.vue'
import { isHasPermission } from '../../../utils/hasPermission.js' import { isHasPermission } from '../../../utils/hasPermission.js'
@@ -338,6 +341,31 @@ export default {
this.loadMenuData() this.loadMenuData()
}, },
methods: { methods: {
// 拖拽事件
onDrop (info) {
// 拖到节点间隙就不做处理,只能拖到节点上
if (info.dropToGap) {
return
}
// console.log('拖拽全部参数', info)
console.log('拖拽的节点', info.node.eventKey, info.node.dataRef.name, info.node.dataRef.itemName)
console.log('拖拽到节点', info.dragNode.eventKey, info.dragNode.dataRef.name, info.dragNode.dataRef.itemName)
const sourceId = info.node.eventKey
const targetId = info.dragNode.eventKey
this.loading = true
dragClauseTreeNode({ targetId, sourceId }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.onClearSelected()
this.loadMenuData()
this.loadData()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 查看文件 // 查看文件
handleViewFile (_, record) { handleViewFile (_, record) {
this.$refs.uploadFile.open(record.technical_specification_design_guide) this.$refs.uploadFile.open(record.technical_specification_design_guide)
@@ -691,4 +719,16 @@ export default {
font-size: 16px; font-size: 16px;
margin-right: 10px; margin-right: 10px;
} }
// 不显示拖拽到节点间隙的样式,只能拖拽到节点上
.draggable-tree {
/deep/ li {
&.drag-over-gap-top,
&.drag-over-gap-bottom {
& > span[draggable] {
border-color: transparent !important;
}
}
}
}
</style> </style>