在线表单》数据库属性模块,对字段跨多字段进行拖拽排序时,无法成功。 #191
This commit is contained in:
parent
166f7e1888
commit
e581f7f7eb
|
@ -39,6 +39,11 @@ export function useDragSort(props: JVxeTableProps, methods: JVxeTableMethods) {
|
||||||
if (oldIndex === newIndex) {
|
if (oldIndex === newIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 【VUEN-2505】获取当前行数据
|
||||||
|
let rowNode = xTable.getRowNode(e.item);
|
||||||
|
if (!rowNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let from = e.from;
|
let from = e.from;
|
||||||
let element = startChildren[oldIndex];
|
let element = startChildren[oldIndex];
|
||||||
let target = null;
|
let target = null;
|
||||||
|
@ -54,6 +59,12 @@ export function useDragSort(props: JVxeTableProps, methods: JVxeTableMethods) {
|
||||||
from.removeChild(element);
|
from.removeChild(element);
|
||||||
from.insertBefore(element, target);
|
from.insertBefore(element, target);
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
// 【VUEN-2505】算出因虚拟滚动导致的偏移量
|
||||||
|
let diffIndex = rowNode!.index - oldIndex;
|
||||||
|
if (diffIndex > 0) {
|
||||||
|
oldIndex = oldIndex + diffIndex;
|
||||||
|
newIndex = newIndex + diffIndex;
|
||||||
|
}
|
||||||
methods.doSort(oldIndex, newIndex);
|
methods.doSort(oldIndex, newIndex);
|
||||||
methods.trigger('dragged', { oldIndex, newIndex });
|
methods.trigger('dragged', { oldIndex, newIndex });
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,8 +28,8 @@ export function useJVxeComponent(props: JVxeComponent.Props) {
|
||||||
const column = computed(() => props.params.column);
|
const column = computed(() => props.params.column);
|
||||||
// 用户配置的原始 column
|
// 用户配置的原始 column
|
||||||
const originColumn = computed(() => column.value.params);
|
const originColumn = computed(() => column.value.params);
|
||||||
const rowIndex = computed(() => props.params.$rowIndex);
|
const rowIndex = computed(() => props.params._rowIndex);
|
||||||
const columnIndex = computed(() => props.params.columnIndex);
|
const columnIndex = computed(() => props.params._columnIndex);
|
||||||
// 表格数据长度
|
// 表格数据长度
|
||||||
const fullDataLength = computed(() => props.params.$table.internalData.tableFullData.length);
|
const fullDataLength = computed(() => props.params.$table.internalData.tableFullData.length);
|
||||||
// 是否正在滚动中
|
// 是否正在滚动中
|
||||||
|
|
Loading…
Reference in New Issue