Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
877109c9
authored
2023-09-14 14:11:44 +0800
by
xiaomiao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
_
1 parent
443bf236
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
src/views/system/qtjfjmb/components/djbdispositions.vue
src/views/system/qtjfjmb/components/djbdispositions.vue
View file @
877109c
...
...
@@ -30,9 +30,8 @@
class=
"tablelist"
:data=
"datalist"
ref=
"listTable"
:key=
"key"
row-key=
"
bsmMb
"
row-key=
"
name
"
:pagination=
"false"
:header-cell-style=
"
{ 'text-align': 'center' }"
:heightNumSetting="true"
...
...
@@ -108,19 +107,19 @@
array
[
index1
]
=
array
.
splice
(
index2
,
1
,
array
[
index1
])[
0
];
},
initSort
()
{
const
el
=
this
.
$refs
.
listTable
.
$el
.
querySelectorAll
(
".el-table__body-wrapper > table > tbody"
)[
0
];
this
.
sortable
=
new
Sortable
(
el
,
{
ghostClass
:
"sortable-ghost"
,
setData
:
function
(
dataTransfer
)
{
dataTransfer
.
setData
(
"Text"
,
""
);
},
onEnd
:
(
evt
)
=>
{
// 其他排序逻辑
// const target
Row = this.datalist.splice(evt.oldIndex, 1)[0]
// this.datalist.splice(evt.newIndex, 0, targetRow);
const
el
=
this
.
$refs
.
listTable
.
$el
.
querySelectorAll
(
'.el-table__body-wrapper > table > tbody'
)[
0
]
// const sortable = new Sortable(el, options);
// 根据具体需求配置options配置项
const
sortable
=
new
Sortable
(
el
,
{
onEnd
:
(
evt
)
=>
{
// 监听拖动结束事件
console
.
log
(
this
)
// this是当前vue上下文
console
.
log
(
evt
.
oldIndex
)
// 当前行的被拖拽前的顺序
console
.
log
(
evt
.
newIndex
)
// 当前行的被拖拽后的顺序
// 这里就可以写我们需要传给后台的逻辑代码
// 我们有了 evt.oldIndex 和 evt.newIndex 这两个参数做索引,我们可以根据绑定在表格上面的 data 这个 Array 找到两个相应的记录。就可以针对数据进行操作啦。
// 下面将拖拽后的顺序进行修改
const
curr
Row
=
this
.
datalist
.
splice
(
evt
.
oldIndex
,
1
)[
0
]
this
.
datalist
.
splice
(
evt
.
newIndex
,
0
,
currRow
)
}
})
},
...
...
@@ -178,8 +177,7 @@
});
});
this
.
checkedCities
=
orlist
this
.
tablelist
=
lists
;
this
.
datalist
=
this
.
tablelist
this
.
datalist
=
lists
;
// 其他排序逻辑
this
.
initSort
()
},
...
...
@@ -198,8 +196,7 @@
}
});
});
this
.
tablelist
=
lists
;
this
.
datalist
=
this
.
tablelist
this
.
datalist
=
lists
;
// 其他排序逻辑
this
.
initSort
()
},
...
...
Please
register
or
sign in
to post a comment