@@ -1221,6 +1221,7 @@ window.ComponentCascadeLine = class {
1221
1221
let stackDom = document . createElement ( 'div' ) ;
1222
1222
stackDom . className = 'dot-cascade-stack dlp-scroll' ;
1223
1223
data . forEach ( ( v , k ) => {
1224
+ v . stack = stack ;
1224
1225
if ( Array . isArray ( v . nodes ) && v . nodes . length !== 0 ) {
1225
1226
v . nodes = v . nodes . map ( ( N ) => N . key ) ;
1226
1227
v . expand = false ;
@@ -1720,14 +1721,7 @@ window.ComponentCascadeLine = class {
1720
1721
document . removeEventListener ( 'dragover' , f ) ;
1721
1722
document . removeEventListener ( 'dragleave' , f ) ;
1722
1723
if ( aim instanceof HTMLElement ) {
1723
- aim . style . removeProperty ( 'background' ) ;
1724
- let stack = parseInt ( aim . getAttribute ( 'data-stack' ) ) ;
1725
- let index = parseInt ( aim . getAttribute ( 'data-k' ) ) ;
1726
- let aim_node_data = object . dimensional_data [ stack ] [ index ] ;
1727
- stack = parseInt ( D . getAttribute ( 'data-stack' ) ) ;
1728
- index = parseInt ( D . getAttribute ( 'data-k' ) ) ;
1729
- let node_data = object . dimensional_data [ stack ] [ index ] ;
1730
- object . nodeMigrateConfirm ( node_data , aim_node_data ) ;
1724
+ object . nodeMigrateConfirm ( D , aim ) ;
1731
1725
}
1732
1726
}
1733
1727
dom . addEventListener ( 'mousedown' , ( ) => {
@@ -1750,7 +1744,14 @@ window.ComponentCascadeLine = class {
1750
1744
} ) ;
1751
1745
}
1752
1746
1753
- nodeMigrateConfirm ( node_data , aim_node_data ) {
1747
+ nodeMigrateConfirm ( node , aim_node ) {
1748
+ aim_node . style . removeProperty ( 'background' ) ;
1749
+ let stack = parseInt ( aim_node . getAttribute ( 'data-stack' ) ) ;
1750
+ let index = parseInt ( aim_node . getAttribute ( 'data-k' ) ) ;
1751
+ let aim_node_data = this . dimensional_data [ stack ] [ index ] ;
1752
+ stack = parseInt ( node . getAttribute ( 'data-stack' ) ) ;
1753
+ index = parseInt ( node . getAttribute ( 'data-k' ) ) ;
1754
+ let node_data = this . dimensional_data [ stack ] [ index ] ;
1754
1755
this . dialog ( `<span class="dlp-text title" title="${ node_data . val } ">${ node_data . val } </span> 迁移` , 90 ) ;
1755
1756
let M = document . createElement ( 'div' ) ;
1756
1757
let object = this ;
@@ -1765,7 +1766,7 @@ window.ComponentCascadeLine = class {
1765
1766
this . PLANE_BODY . insertAdjacentHTML ( 'beforeend' , `<div style="font-size: 18px!important;">↑</div>` ) ;
1766
1767
event = 'migrate' ;
1767
1768
}
1768
- M . addEventListener ( 'click' , ( ( ) => {
1769
+ /* M.addEventListener('click', (() => {
1769
1770
if (object.submit_block) return;
1770
1771
object.submit_block = true;
1771
1772
M.querySelector('.right').innerHTML = _component.sub_loading;
@@ -1776,11 +1777,47 @@ window.ComponentCascadeLine = class {
1776
1777
}, function () {
1777
1778
object.submit_block = false;
1778
1779
});
1779
- } ) ) ;
1780
+ }));*/
1781
+ object . nodeMigrateExec ( event , node , node_data , aim_node , aim_node_data ) ;
1780
1782
this . PLANE_BODY . append ( M ) ;
1781
1783
}
1782
1784
1783
- nodeMigrateExec ( ) {
1785
+ nodeMigrateExec ( event , node , node_data , aim_node , aim_node_data ) {
1786
+ if ( event === 'exchange' ) {
1787
+ let tmp_key = node_data . key ;
1788
+ let tmp_val = node_data . val ;
1789
+ node_data . key = aim_node_data . key ;
1790
+ node_data . val = aim_node_data . val ;
1791
+ let index = node_data . nodes . indexOf ( aim_node_data . key ) ;
1792
+ node_data . nodes . splice ( index , 1 , tmp_key ) ;
1793
+
1794
+ index = aim_node_data . parentNodes . indexOf ( tmp_key ) ;
1795
+ aim_node_data . parentNodes . splice ( index , 1 , aim_node_data . key ) ;
1796
+ aim_node_data . key = tmp_key ;
1797
+ aim_node_data . val = tmp_val ;
1798
+ this . resetChildrenParent ( node_data ) ;
1799
+
1800
+ node . querySelector ( 'span' ) . textContent = node_data . val ;
1801
+ node . setAttribute ( 'data-id' , node_data . key ) ;
1802
+ aim_node . querySelector ( 'span' ) . textContent = aim_node_data . val ;
1803
+ aim_node . setAttribute ( 'data-id' , aim_node_data . key ) ;
1804
+ return ;
1805
+ }
1806
+ }
1784
1807
1808
+ resetChildrenParent ( node_data ) {
1809
+ let stack = node_data . stack ;
1810
+ let nodes = node_data . nodes ;
1811
+ let parents = node_data . parentNodes . slice ( 0 ) ;
1812
+ parents . push ( node_data . key ) ;
1813
+ stack ++ ;
1814
+ this . dimensional_data [ stack ] . forEach ( ( d ) => {
1815
+ if ( nodes . indexOf ( d . key ) !== - 1 ) {
1816
+ d . parentNodes = parents ;
1817
+ if ( Array . isArray ( d . nodes ) && d . nodes . length > 0 ) {
1818
+ this . resetChildrenParent ( d ) ;
1819
+ }
1820
+ }
1821
+ } ) ;
1785
1822
}
1786
1823
} ;
0 commit comments