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

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

@@ -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) {