给单据列表增加左右拖拽的功能

This commit is contained in:
季圣华
2023-02-24 18:52:00 +08:00
parent 668f0653da
commit 89c152647a
23 changed files with 92 additions and 6 deletions

View File

@@ -66,4 +66,20 @@
.ant-modal-mask {
background-color: rgba(0, 0, 0, 0.1) !important;
}
/* 拖拽 */
.table-draggable-handle {
/* width: 10px !important; */
height: 100% !important;
left: auto !important;
right: -5px;
cursor: col-resize;
touch-action: none;
border: none;
position: absolute;
transform: none !important;
bottom: 0;
}
.resize-table-th {
position: relative;
}

View File

@@ -6,11 +6,15 @@
import { filterObj,getNowFormatStr } from '@/utils/util';
import { deleteAction, getAction, postAction, downFile, getFileAccessHttpUrl } from '@/api/manage'
import Vue from 'vue'
import VueDraggableResizable from 'vue-draggable-resizable'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import {mixinDevice} from '@/utils/mixin.js'
export const JeecgListMixin = {
mixins: [mixinDevice],
components: {
VueDraggableResizable
},
data(){
return {
//token header
@@ -393,6 +397,44 @@ export const JeecgListMixin = {
this.scroll.y = document.documentElement.clientHeight-searchWrapperDomLen-operatorDomLen-basicLength
}
},
//拖拽组件
handleDrag(column){
return {
header: {
cell: (h, props, children) => {
const { key, ...restProps } = props
const col = column.find((col) => {
const k = col.dataIndex || col.key
return k === key
})
if (!col || !col.width) {
return h('th', { ...restProps }, [...children])
}
const dragProps = {
key: col.dataIndex || col.key,
class: 'table-draggable-handle',
attrs: {
w: 10,
x: col.width,
z: 1,
axis: 'x',
draggable: true,
resizable: false,
},
on: {
dragging: (x, y) => {
col.width = Math.max(x, 1)
},
},
}
const drag = h(VueDraggableResizable, { ...dragProps })
return h('th', { ...restProps, class: 'resize-table-th' }, [...children, drag])
},
}
}
},
/** 表格增加合计行 */
tableAddTotalRow(columns, dataSource) {
if(dataSource.length>0 && this.ipagination.pageSize%10===1) {

View File

@@ -101,6 +101,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -101,6 +101,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -101,6 +101,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -115,6 +115,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -115,6 +115,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -124,6 +124,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -134,6 +134,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -104,6 +104,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -124,6 +124,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -119,6 +119,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -125,6 +125,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -105,6 +105,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -135,6 +135,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -106,6 +106,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -106,6 +106,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -115,6 +115,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -115,6 +115,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -121,6 +121,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"

View File

@@ -121,6 +121,7 @@
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:components="handleDrag(columns)"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"