[update] 解决标准表格调整列宽会触发排序的问题

This commit is contained in:
lideqin
2024-02-22 13:38:43 +08:00
parent eb0d945a28
commit b36195eac0
5 changed files with 21 additions and 1 deletions
+6 -1
View File
@@ -256,7 +256,8 @@ export default {
cell: this.initDrag(this.columns)
}
},
selfScroll: {}
selfScroll: {},
resizing: false
}
},
watch: {
@@ -457,6 +458,7 @@ export default {
}
// 开始拖拽监听
const onDragging = (x) => {
this.resizing = true
const beforeWidth = col.width
const scroll = cloneDeep(this.scroll) || {}
draggingState[key] = 0
@@ -484,6 +486,9 @@ export default {
// 停止拖拽监听
const onDragstop = () => {
draggingState[key] = thDom.getBoundingClientRect().width
setTimeout(() => {
this.resizing = false
}, 200)
}
// 控制最小拖拽宽度
const onDrag = (x) => {
+12
View File
@@ -225,6 +225,18 @@ export const ConfigurableTableMixin = {
})
},
tableOnChange (pagination, filters, sorter) {
// debugger;
console.log(this.$refs.tableRef.resizing)
if (this.$refs.tableRef.resizing) {
const classNameOne = window.event.target.parentNode.children[0].children[0].children[1].children[0].children[0].className
const classNameTwo = window.event.target.parentNode.children[0].children[0].children[1].children[0].children[1].className
const target = window.event.target
this.$nextTick(() => {
target.parentNode.children[0].children[0].children[1].children[0].children[0].className = classNameOne
target.parentNode.children[0].children[0].children[1].children[0].children[1].className = classNameTwo
})
return
}
console.log(sorter)
if (Object.keys(sorter).length > 0) {
if (sorter.field.split('_')[sorter.field.split('_').length - 1] === 'dictText') {
@@ -88,6 +88,7 @@
<div>
<j-table
v-if="columns && columns.length > 0"
ref="tableRef"
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
@@ -123,6 +123,7 @@
<div>
<j-table
v-if="columns && columns.length > 0"
ref="tableRef"
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
@@ -124,6 +124,7 @@
<div>
<j-table
v-if="columns && columns.length > 0"
ref="tableRef"
:columns="columns"
:dataSource="dataSource"
:can-drag="true"