Commit b84a20c6 authored by 仇晓婷's avatar 仇晓婷

工艺拖拽

parent 8d9b0190
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
ref="selection" ref="selection"
:columns="columns" :columns="columns"
:data="data1" :data="data1"
:draggable="true"
@on-drag-drop="onDragDrop"
@on-selection-change="selectInfo" @on-selection-change="selectInfo"
></Table> ></Table>
</Content> </Content>
...@@ -190,6 +192,28 @@ export default { ...@@ -190,6 +192,28 @@ export default {
this.getData(); this.getData();
}, },
methods: { methods: {
onDragDrop(first, end) {
//转成int型,方便后续使用
first = parseInt(first);
end = parseInt(end);
let tmp = this.data1[first];
if (first < end) {
for (var i = first + 1; i <= end; i++) {
this.data1.splice(i - 1, 1, this.data1[i]);
}
this.data1.splice(end, 1, tmp);
}
if (first > end) {
for (var i = first; i > end; i--) {
this.data1.splice(i, 1, this.data1[i - 1]);
}
this.data1.splice(end, 1, tmp);
}
},
getData() { getData() {
let conditions = [ let conditions = [
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment