From ac5b22e0bf50b7845bad5d1dcbe5a77be723d031 Mon Sep 17 00:00:00 2001 From: yaojn Date: Mon, 29 Sep 2025 15:16:07 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E7=9B=AE=E5=BD=95=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=97=A0=E6=B3=95=E7=A7=BB=E5=8A=A8=E8=87=B3?= =?UTF-8?q?=E7=A9=BA=E7=9B=AE=E5=BD=95=20=20=20-=20[=E5=85=B3=E8=81=94]#[1?= =?UTF-8?q?516720919904256]=E8=8F=9C=E5=8D=95=E7=AE=A1=E7=90=86-=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=8B=E7=9A=84=E8=8F=9C=E5=8D=95=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E8=87=B3=E7=A9=BA=E7=9B=AE=E5=BD=95=20http:/?= =?UTF-8?q?/192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/93?= =?UTF-8?q?9050947543057/1516720919904256?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/extramenu/menu-treeview.vue | 95 ++++--------------- 1 file changed, 19 insertions(+), 76 deletions(-) diff --git a/src/views/pages/framework/extramenu/menu-treeview.vue b/src/views/pages/framework/extramenu/menu-treeview.vue index 15dc4e0d..deec1068 100644 --- a/src/views/pages/framework/extramenu/menu-treeview.vue +++ b/src/views/pages/framework/extramenu/menu-treeview.vue @@ -7,11 +7,10 @@ :list="childrenList" :move="checkMove" handle=".tsfont-drag" - :forceFallback="false" - :data-parentid="parentId" + group="tree" + :empty-insert-threshold="56" @start="moveStart" - @sort="moveEnd" - @remove="moveRemove" + @end="moveEnd" >
    -
  • {{ $t('page.menu') }}
  • -
  • {{ $t('page.edit') }}
  • -
  • {{ $t('page.delete') }}
  • +
  • {{ $t('page.menu') }}
  • +
  • {{ $t('page.edit') }}
  • +
  • {{ $t('page.delete') }}
@@ -83,22 +80,12 @@ export default { required: true, type: Array, default: () => [] - }, - show: { - type: Boolean, - default: true } }, data() { return { - needUpdate: true, currentParentId: null, childrenList: [], - isShow: true, - childrenLoading: [], - parentUuid: '', - moveObject: null, - moveParentUuid: '', currentMenuId: null, isEdit: false, newParentId: null, @@ -107,16 +94,7 @@ export default { }; }, beforeCreate() {}, - created() { - if (!this.search) { - this.childrenList.forEach(item => { - if (item.childCount > 0) { - this.$set(item, 'isShow', false); - this.$set(item, 'isRequest', false); - } - }); - } - }, + created() {}, beforeMount() {}, mounted() {}, beforeUpdate() {}, @@ -126,10 +104,6 @@ export default { beforeDestroy() {}, destroyed() {}, methods: { - moveRemove() { - //如果是新菜单加入,不触发更新,避免重复保存 - this.needUpdate = false; - }, editMenu(id) { this.currentMenuId = id; this.isEdit = true; @@ -167,49 +141,23 @@ export default { checkMove(evt, originalEvent) { const source = evt.draggedContext.element; const target = evt.relatedContext.element; - const targetParentId = evt.to.dataset.parentid; - if (source.type === 1 && target && target.type === 1 && source.parentId === target.parentId) { - //链接选项调整顺序 - //console.log('链接选项调整顺序'); - return true; - } else if (source.type === 1 && target && source.parentId !== target.parentId && target.parentId !== 0) { + if (source.type === 1 && target && source.parentId !== target.parentId && target.parentId !== 0) { //链接调整归属 - //console.log('调整菜单归属'); this.newParentId = target.parentId; - return true; - } else if (source.type === 0 && target && source.parentId === target.parentId) { - //目录调整顺序 - //console.log('链目录调整顺序'); - return true; } else if (source.type === 0 && target && source.parentId !== target.parentId) { //目录调整归属 this.newParentId = target.parentId; - //console.log('目录调整归属'); - return true; } else if (source.type === 1 && target && source.parentId !== target.parentId && target.childCount == 0) { // 链接节点拖到目录下面(目录下为空的节点) this.newParentId = target.id; - return true; } else if (source.type === 1 && target && target.type === 0 && source.parentId == target.parentId) { // 链接节点拖到目录下面(目录下已存在节点) - this.newParentId = target.parentId; - return true; + this.newParentId = target.id; } else if (source.type === 1 && target && source.parentId != target.parentId) { // 链接拖到空白处,最顶层 this.newParentId = 0; - return true; - } else if (!target) { - const parentNode = this.childrenList.find(d => d.id == targetParentId); - if (parentNode && parentNode.type === 0) { - // 只能拖到目录下面 - this.newParentId = parentNode.id; - return true; - } else { - // 链接节点不允许有子节点 - return false; - } - } - return false; + } + return true; }, moveStart(e) { this.currentId = e.item.attributes.id.value; @@ -219,16 +167,12 @@ export default { this.$emit('update', this.childrenList, this.parentId); }, moveEnd(evt) { - if (this.needUpdate) { - if (this.currentNode && this.newParentId !== null) { - this.$set(this.currentNode, 'parentId', this.newParentId); - this.newParentId = null; - this.currentNode = null; - } - this.update(); - } else { - this.needUpdate = true; + if (this.currentNode && this.newParentId !== null) { + this.$set(this.currentNode, 'parentId', this.newParentId); + this.newParentId = null; } + this.update(); + this.currentNode = null; }, isOpen(cd) { this.$set(cd, '_isHidden', !cd._isHidden); @@ -241,8 +185,7 @@ export default { animation: 150, scroll: true, disabled: false, - ghostClass: 'ghost', - group: { name: 'tree', pull: true, put: true } + ghostClass: 'ghost' }; } }, -- Gitee