vxe-table 树表格单元格挑选复制粘贴
vxe-table 树表格单元格挑选复制张贴,树结构默许是平级张贴,能够经过 clip-config.isDeepPaste 启用深层数据结构的张贴;需求留意只支撑 tree-config.transform 形式
<template>
<div>
<vxe-table
border
show-overflow
keep-source
height="500"
:column-config="columnConfig"
:tree-config="treeConfig"
:mouse-config="mouseConfig"
:area-config="areaConfig"
:edit-config="editConfig"
:clip-config="clipConfig"
:keyboard-config="keyboardConfig"
:data="tableData">
<vxe-column type="seq" width="80"></vxe-column>
<vxe-column field="name" title="称号" min-width="300" tree-node :edit-render="{ name: 'input' }"></vxe-column>
<vxe-column field="size" title="巨细" width="140" :edit-render="{ name: 'input' }"></vxe-column>
<vxe-column field="type" title="类型" width="140" :edit-render="{ name: 'input' }"></vxe-column>
<vxe-column field="createBy" title="创立人" width="200" :edit-render="{ name: 'input' }"></vxe-column>
<vxe-column field="updateDate" title="修正时刻" width="200" :edit-render="{ name: 'input' }"></vxe-column>
<vxe-column field="createDate" title="创立时刻" width="200" :edit-render="{ name: 'input' }"></vxe-column>
</vxe-table>
</div>
</template>
<script>
export default {
data () {
const tableData = [
{ id: 10000, parentId: null, name: '文件1.xlsx', type: 'xlsx', size: 3200, createBy: '王五', updateDate: '2020-09-11', createDate: '2020-08-01' },
{ id: 10050, parentId: null, name: '布置目录', type: '', size: null, createBy: '老六', updateDate: '2020-08-01', createDate: '2021-04-01' },
{ id: 24300, parentId: 10050, name: '菜单装备.avi', type: 'avi', size: 1024, createBy: '小芳', updateDate: '2020-10-24', createDate: '2020-03-01' },
{ id: 20045, parentId: 24300, name: '人物阐明.html', type: 'html', size: 600, createBy: '老徐', updateDate: '2020-08-01', createDate: '2021-04-01' },
{ id: 10053, parentId: 24300, name: '权限装备.avi', type: 'avi', size: 0, createBy: '老胡', updateDate: '', createDate: '2021-04-01' },
{ id: 24330, parentId: 10053, name: '布置秘钥.txt', type: 'txt', size: 25, createBy: '张三', updateDate: '2020-09-11', createDate: '2021-10-01' },
{ id: 21011, parentId: 10053, name: '流程文档。pdf', type: 'pdf', size: 512, createBy: '老张', updateDate: '2021-08-01', createDate: '201-01-01' },
{ id: 22200, parentId: 10053, name: '处理 bug 文件.js', type: 'js', size: 1024, createBy: '小刘', updateDate: '2020-10-24', createDate: '2021-06-01' },
{ id: 23666, parentId: null, name: '发版目录', type: '', size: null, createBy: '老刘', updateDate: '2020-02-18', createDate: '2020-11-01' },
{ id: 23677, parentId: 23666, name: '替换问题文件.js', type: 'js', size: 1024, createBy: '老冯', updateDate: '2019-09-11', createDate: '2021-06-01' },
{ id: 23671, parentId: 23677, name: '发布流程.avi', type: 'avi', size: 1024, createBy: '小牛', updateDate: '2020-08-01', createDate: '2021-06-01' },
{ id: 23672, parentId: 23677, name: '装备流程.mp4', type: 'mp4', size: 1024, createBy: '李四', updateDate: '2020-02-09', createDate: '2021-06-01' },
{ id: 23688, parentId: 23666, name: '测验流程.mp4', type: 'mp4', size: 1024, createBy: '小三', updateDate: '2019-10-24', createDate: '2021-06-01' },
{ id: 23681, parentId: 23688, name: '问题记载.txt', type: 'txt', size: 1024, createBy: '小李', updateDate: '2020-08-01', createDate: '2021-06-01' },
{ id: 23682, parentId: 23688, name: '发布阐明.html', type: 'html', size: 1024, createBy: '小徐', updateDate: '2021-02-18', createDate: '2021-06-01' },
{ id: 24555, parentId: null, name: '资源目录', type: '', size: null, createBy: '小小', updateDate: '2020-08-01', createDate: '2020-10-01' },
{ id: 24566, parentId: 24555, name: '铃声文件.mp3', type: 'mp3', size: 1024, createBy: '老八', updateDate: '2020-02-29', createDate: '2021-06-01' },
{ id: 24577, parentId: 24555, name: '上线人员列表.xlsx', type: 'xlsx', size: 1024, createBy: '小红', updateDate: '2020-08-01', createDate: '2021-06-01' },
{ id: 30000, parentId: null, name: '评定目录', type: '', size: null, createBy: '小何', updateDate: '2020-01-26', createDate: '2020-09-05' },
{ id: 30001, parentId: 30000, name: '评定文件.xlsx', type: 'xlsx', size: 36522, createBy: '张三', updateDate: '2021-02-22', createDate: '2020-08-09' },
{ id: 30010, parentId: 30000, name: '更多文件', type: '', size: null, createBy: '小徐', updateDate: '2021-02-22', createDate: '2020-08-09' },
{ id: 30011, parentId: 30010, name: '评定文件.xlsx', type: 'xlsx', size: 36522, createBy: '李四', updateDate: '2021-02-22', createDate: '2020-08-09' },
{ id: 30012, parentId: 30010, name: '其他目录', type: '', size: null, createBy: '老刘', updateDate: '2021-02-22', createDate: '2020-08-09' },
{ id: 30102, parentId: 30012, name: '评定文件.xlsx', type: 'xlsx', size: 36522, createBy: '小康', updateDate: '2021-02-22', createDate: '2020-08-09' },
{ id: 40000, parentId: null, name: '文件4.xlsx', type: 'ppt', size: 2048, createBy: '王五', updateDate: '2020-10-04', createDate: '2020-11-07' },
{ id: 50000, parentId: null, name: '文件5.xlsx', type: 'pdf', size: 3652, createBy: '小张', updateDate: '2020-12-08', createDate: '2020-04-08' }
]
const columnConfig = {
resizable: true
}
const treeConfig = {
transform: true,
rowField: 'id',
parentField: 'parentId'
}
const mouseConfig = {
area: true // 是否敞开区域选取
}
const areaConfig = {
multiple: true // 是否启用多区域选取功用
}
const editConfig = {
mode: 'cell',
trigger: 'dblclick',
showStatus: true
}
const clipConfig = {
isDeepPaste: true // 是否深层张贴,用于树结构,启用后张贴时会掩盖到子级数据进行张贴
}
const keyboardConfig = {
isClip: true,
isArrow: true,
isShift: true,
isTab: true,
isEnter: true,
isEdit: true,
isBack: true,
isDel: true,
isEsc: true,
isFNR: true // 是否敞开查找与替换
}
return {
tableData,
columnConfig,
treeConfig,
mouseConfig,
areaConfig,
editConfig,
clipConfig,
keyboardConfig
}
}
}
</script>