Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周远喜
mes-ui
Commits
05765173
Commit
05765173
authored
Oct 25, 2020
by
周远喜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
树形数据修改成功
parent
94a6169b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
29 deletions
+25
-29
EditGrid.vue
components/page/treeGrid/EditGrid.vue
+25
-29
No files found.
components/page/treeGrid/EditGrid.vue
View file @
05765173
...
...
@@ -43,7 +43,7 @@
v-show=
"show(item)"
class=
"treetr"
:id=
"'tr' + index"
:draggable=
"drag"
:draggable=
"drag
&& !item._drag
"
@
dragstart=
"dragstart($event, index, item)"
@
drop=
"dragdrop($event, index, item)"
@
dragenter=
"dragenter($event, index, item)"
...
...
@@ -250,23 +250,21 @@ export default {
},
},
mounted
()
{
if
(
this
.
items
&&
this
.
items
.
length
>
0
)
{
this
.
dataLength
=
this
.
Length
(
this
.
items
);
this
.
initData
(
this
.
deepCopy
(
this
.
items
),
1
,
null
);
this
.
cloneColumns
=
this
.
makeColumns
();
this
.
checkGroup
=
this
.
renderCheck
(
this
.
items
);
if
(
this
.
checkGroup
.
length
==
this
.
dataLength
)
{
this
.
checks
=
true
;
}
else
{
this
.
checks
=
false
;
}
if
(
this
.
items
&&
this
.
items
.
length
>
0
)
{
this
.
dataLength
=
this
.
Length
(
this
.
items
);
this
.
initData
(
this
.
deepCopy
(
this
.
items
),
1
,
null
);
this
.
cloneColumns
=
this
.
makeColumns
();
this
.
checkGroup
=
this
.
renderCheck
(
this
.
items
);
if
(
this
.
checkGroup
.
length
==
this
.
dataLength
)
{
this
.
checks
=
true
;
}
else
{
this
.
checks
=
false
;
}
}
//this.initData();
},
methods
:
{
initData
()
{
},
initData
()
{},
slots
()
{
return
this
.
$scopedSlots
;
},
...
...
@@ -278,7 +276,12 @@ export default {
//进入
dragenter
(
e
,
index
,
row
)
{
var
tr
=
document
.
getElementById
(
"tr"
+
index
);
tr
.
className
+=
" move"
;
if
(
this
.
dragIndex
>
index
)
{
tr
.
className
+=
" move"
;
}
else
if
(
this
.
dragIndex
<
index
)
{
tr
.
className
+=
" sort"
;
}
// console.warn("进入",e, e.clientY,tr.clientTop, tr.className);
},
// 悬浮
...
...
@@ -286,27 +289,20 @@ export default {
// console.warn("悬浮",e)
e
.
preventDefault
();
// 鼠标Y
var
my
=
e
.
clientY
;
var
ty
=
e
.
toElement
.
offsetTop
;
var
my
=
e
.
offsetY
;
var
h
=
e
.
toElement
.
clientHeight
;
var
tr
=
document
.
getElementById
(
"tr"
+
index
);
if
(
t
r
.
className
.
indexOf
(
" sort"
)
==
-
1
&&
2.5
*
h
<
my
-
ty
)
{
if
(
t
his
.
dragIndex
>
index
&&
my
/
h
<
0.5
)
{
tr
.
className
=
tr
.
className
.
replace
(
" move"
,
" sort"
);
}
// console.warn("在上边",my,ty,my-ty,h, tr.className);
this
.
logs
.
push
({
index
,
ty
,
my
,
h
});
if
(
this
.
dragIndex
<
index
&&
my
/
h
>
0.5
)
{
tr
.
className
=
tr
.
className
.
replace
(
" sort"
,
" move"
);
}
},
// 离开
dragleave
(
e
,
index
,
row
)
{
var
tr
=
document
.
getElementById
(
"tr"
+
index
);
tr
.
className
=
tr
.
className
.
replace
(
" move"
,
""
).
replace
(
" sort"
,
""
);
console
.
warn
(
"离开"
,
e
.
clientY
,
e
.
toElement
.
offsetTop
,
e
.
toElement
.
clientHeight
,
tr
.
className
);
},
//放下
dragdrop
(
e
,
index
,
row
)
{
...
...
@@ -314,9 +310,9 @@ export default {
var
tr
=
document
.
getElementById
(
"tr"
+
index
);
tr
.
className
=
tr
.
className
.
replace
(
" move"
,
""
).
replace
(
" sort"
,
""
);
if
(
index
!=
this
.
dragIndex
)
{
this
.
$emit
(
"on-drag-drop"
,
this
.
dragIndex
,
index
,
this
.
trs
);
this
.
$emit
(
"on-drag-drop"
,
this
.
dragIndex
,
index
,
this
.
trs
,
e
);
}
console
.
log
(
JSON
.
stringify
(
this
.
logs
)
);
console
.
log
(
e
.
offsetY
/
e
.
toElement
.
clientHeight
);
},
/**
* @dragover="dragover($event, index, item)"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment