jeecgboot / JeecgBoot

🔥「企业级低代码平台」前后端分离架构SpringBoot 2.x/3.x,SpringCloud,Ant Design&Vue3,Mybatis,Shiro,JWT。强大的代码生成器让前后端代码一键生成,无需写任何代码! 引领新的开发模式OnlineCoding->代码生成->手工MERGE,帮助Java项目解决70%重复工作,让开发更关注业务,既能快速提高效率,帮助公司节省成本,同时又不失灵活性。
http://www.jeecg.com
Apache License 2.0
38.51k stars 14.43k forks source link

列表数据勾选禁用后仍能勾选问题,显示选的数据条数也是错误的 #6506

Closed jhaso1988 closed 8 months ago

jhaso1988 commented 9 months ago
版本号:V3.5.5
问题描述:

列表数据勾选禁用后,单点勾选是不能勾选的,如果点击全部勾选,禁用的也将被勾选,勾选后显示选的数据条数没有排除禁用的

截图&代码:
image image image

image const [registerTable, { reload }, { selectedRowKeys, selectedRows }] = tableContext;

const rowSelection = { type: 'checkbox', columnWidth: 50, selectedRowKeys: selectedRowKeys, selectedRows: selectedRows, getCheckboxProps(record: Recordable) { //判断条件可随意 if (2 == record.izShow) { return { disabled: true }; } else { return { disabled: false }; } }, onChange: onSelectChange, };

/**

友情提示(为了提高issue处理效率):

jhaso1988 commented 9 months ago
image
jhaso1988 commented 9 months ago

这个是批量删除后的页面展示

image
zhangdaiscott commented 8 months ago

zy

liaozhiyang commented 8 months ago

1.禁用勾选功能已修复,下一版本发布。 你本地可按如下更改 src/components/Table/src/hooks/useCustomSelection.tsx const flattedData = computed(() => { const data = flattenData(tableData.value, childrenColumnName.value); const rowSelection = propsRef.value.rowSelection; if (rowSelection?.type === 'checkbox' && rowSelection.getCheckboxProps) { for (let i = 0, len = data.length; i < len; i++) { const record = data[i]; const result = rowSelection.getCheckboxProps(record); if (result.disabled) { data.splice(i, 1); i--; len--; } } } return data; });

image image

src/components/Table/src/components/CustomSelectHeader.vue

image

2.显示选的数据条数错误问题,你是删除了dataSource里面的数据吧?这个需要从selectedRowKeys中剔除勾选的数据。等禁用勾选修复之后点击删除直接设置selectedRowKeys=[]即可

jhaso1988 commented 8 months ago

更改后验证没问题