|
|
@ -102,74 +102,69 @@ |
|
|
|
close() { |
|
|
|
this.$emit('closeRowDrop') |
|
|
|
}, |
|
|
|
// save () { |
|
|
|
// this.$emit('closeRowDrop') |
|
|
|
// this.$emit('radio',this.dataList) |
|
|
|
// // 本地缓存 当前用户名 + 路由名称 |
|
|
|
// localStorage.setItem(this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList)) |
|
|
|
// }, |
|
|
|
// 格式化表头数据 |
|
|
|
formatData (val) { |
|
|
|
this.dataList = JSON.parse(JSON.stringify(val)) |
|
|
|
this.dataList.forEach(item => { |
|
|
|
if (item.isture == undefined) { |
|
|
|
item.isture = true |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 拖拽事件 |
|
|
|
handleEdit(index, row) { |
|
|
|
console.log(index, row); |
|
|
|
}, |
|
|
|
handleDelete(index, row) { |
|
|
|
console.log(index, row); |
|
|
|
}, |
|
|
|
dragstart(value) { |
|
|
|
this.oldData = value |
|
|
|
}, |
|
|
|
// 记录移动过程中信息 |
|
|
|
dragenter(value, e) { |
|
|
|
this.newData = value |
|
|
|
e.preventDefault() |
|
|
|
}, |
|
|
|
// 拖拽最终操作 |
|
|
|
dragend(value, e) { |
|
|
|
if (this.oldData !== this.newData) { |
|
|
|
let oldIndex = this.dataList.indexOf(this.oldData) |
|
|
|
let newIndex = this.dataList.indexOf(this.newData) |
|
|
|
let newItems = [...this.dataList] |
|
|
|
// 删除老的节点 |
|
|
|
newItems.splice(oldIndex, 1) |
|
|
|
// 在列表中目标位置增加新的节点 |
|
|
|
newItems.splice(newIndex, 0, this.oldData) |
|
|
|
this.dataList = [...newItems] |
|
|
|
this.$emit('radio',this.dataList) |
|
|
|
save () { |
|
|
|
this.$forceUpdate() |
|
|
|
this.$emit('radio',this.dataList) |
|
|
|
// 本地缓存 当前用户名 + 路由名称 |
|
|
|
localStorage.setItem(this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList)) |
|
|
|
}, |
|
|
|
// 格式化表头数据 |
|
|
|
formatData (val) { |
|
|
|
this.dataList = JSON.parse(JSON.stringify(val)) |
|
|
|
this.dataList.forEach(item => { |
|
|
|
if (item.isture == undefined) { |
|
|
|
item.isture = true |
|
|
|
} |
|
|
|
}, |
|
|
|
// 拖动事件(主要是为了拖动时鼠标光标不变为禁止) |
|
|
|
dragover(e) { |
|
|
|
e.preventDefault() |
|
|
|
}, |
|
|
|
// 拖拽事件结束 |
|
|
|
// 点击展开拖拽框 |
|
|
|
visclose(){ |
|
|
|
this.visibleclose = false |
|
|
|
this.visibleon = true |
|
|
|
}, |
|
|
|
// 点击关闭拖拽框 |
|
|
|
vison(){ |
|
|
|
this.visibleclose = true |
|
|
|
this.visibleon = false |
|
|
|
}, |
|
|
|
rediochange(index){ |
|
|
|
this.dataList[index].isture = !this.dataList[index].isture |
|
|
|
this.$forceUpdate() |
|
|
|
// this.checked = !this.checked |
|
|
|
this.$emit('radio',this.dataList) |
|
|
|
// 本地缓存 当前用户名 + 路由名称 |
|
|
|
localStorage.setItem(this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList)) |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
// 拖拽事件 |
|
|
|
handleEdit(index, row) { |
|
|
|
console.log(index, row); |
|
|
|
}, |
|
|
|
handleDelete(index, row) { |
|
|
|
console.log(index, row); |
|
|
|
}, |
|
|
|
dragstart(value) { |
|
|
|
this.oldData = value |
|
|
|
}, |
|
|
|
// 记录移动过程中信息 |
|
|
|
dragenter(value, e) { |
|
|
|
this.newData = value |
|
|
|
e.preventDefault() |
|
|
|
}, |
|
|
|
// 拖拽最终操作 |
|
|
|
dragend(value, e) { |
|
|
|
if (this.oldData !== this.newData) { |
|
|
|
let oldIndex = this.dataList.indexOf(this.oldData) |
|
|
|
let newIndex = this.dataList.indexOf(this.newData) |
|
|
|
let newItems = [...this.dataList] |
|
|
|
// 删除老的节点 |
|
|
|
newItems.splice(oldIndex, 1) |
|
|
|
// 在列表中目标位置增加新的节点 |
|
|
|
newItems.splice(newIndex, 0, this.oldData) |
|
|
|
this.dataList = [...newItems] |
|
|
|
this.save() |
|
|
|
} |
|
|
|
}, |
|
|
|
// 拖动事件(主要是为了拖动时鼠标光标不变为禁止) |
|
|
|
dragover(e) { |
|
|
|
e.preventDefault() |
|
|
|
}, |
|
|
|
// 拖拽事件结束 |
|
|
|
// 点击展开拖拽框 |
|
|
|
visclose(){ |
|
|
|
this.visibleclose = false |
|
|
|
this.visibleon = true |
|
|
|
}, |
|
|
|
// 点击关闭拖拽框 |
|
|
|
vison(){ |
|
|
|
this.visibleclose = true |
|
|
|
this.visibleon = false |
|
|
|
}, |
|
|
|
rediochange(index){ |
|
|
|
this.dataList[index].isture = !this.dataList[index].isture |
|
|
|
this.save() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|