Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicTable 的几个bug #593

Closed
zuihou opened this issue May 12, 2021 · 6 comments
Closed

BasicTable 的几个bug #593

zuihou opened this issue May 12, 2021 · 6 comments
Assignees

Comments

@zuihou
Copy link

zuihou commented May 12, 2021

  • 最新版2.3.0代码

问题1: BasicTable 列设置太多后,表格变形

  • 代码:
const [registerTable, { reload, getSelectRowKeys, getForm }] = useTable({
        title: t('lamp.user.table.title'),
        api: page,
        columns,
        formConfig: {
          labelWidth: 120,
          schemas: searchFormSchema,
        },
        handleSearchInfoFn: handleSearchInfoByCreateTime,
        useSearchForm: true,
        showTableSetting: true,
        bordered: true,
        rowKey: 'id',
        rowSelection: {
          type: 'checkbox',
        },
        actionColumn: {
          width: 160,
          title: t('common.column.action'),
          dataIndex: 'action',
          slots: { customRender: 'action' },
        },
      });

export const columns: BasicColumn[] = [
  {
    title: t('lamp.user.account'),
    dataIndex: 'account',
    // width: 180,
  },
  {
    title: t('lamp.user.name'),
    dataIndex: 'name',
    // width: 180,
  },
  {
    title: t('lamp.user.orgId'),
    dataIndex: 'orgId',
    // width: 180,
  },
  {
    title: t('lamp.user.stationId'),
    dataIndex: 'stationId',
    // width: 180,
  },
  {
    title: t('lamp.user.readonly'),
    dataIndex: 'readonly',
    // width: 180,
  },
  {
    title: t('lamp.user.email'),
    dataIndex: 'email',
    // width: 180,
  },
  {
    title: t('lamp.user.mobile'),
    dataIndex: 'mobile',
    // width: 180,
  },
  {
    title: t('lamp.user.sex'),
    dataIndex: 'sex',
    // width: 180,
  },
  {
    title: t('lamp.user.state'),
    dataIndex: 'state',
    // width: 180,
  },
  {
    title: t('lamp.user.avatar'),
    dataIndex: 'avatar',
    // width: 180,
  },
  {
    title: t('lamp.user.nation'),
    dataIndex: 'nation',
    // width: 180,
  },
  {
    title: t('lamp.user.education'),
    dataIndex: 'education',
    // width: 180,
  },
  {
    title: t('lamp.user.positionStatus'),
    dataIndex: 'positionStatus',
    // width: 180,
  },
  {
    title: t('lamp.user.workDescribe'),
    dataIndex: 'workDescribe',
    // width: 180,
  },
  {
    title: t('lamp.user.passwordErrorLastTime'),
    dataIndex: 'passwordErrorLastTime',
    // width: 180,
  },
  {
    title: t('lamp.user.passwordErrorNum'),
    dataIndex: 'passwordErrorNum',
    // width: 180,
  },
  {
    title: t('lamp.user.passwordExpireTime'),
    dataIndex: 'passwordExpireTime',
    // width: 180,
  },
  {
    title: t('lamp.user.password'),
    dataIndex: 'password',
    // width: 180,
  },
  {
    title: t('lamp.user.salt'),
    dataIndex: 'salt',
    // width: 180,
  },
  {
    title: t('lamp.user.lastLoginTime'),
    dataIndex: 'lastLoginTime',
    // width: 180,
  },
  {
    title: t('lamp.common.createTime'),
    dataIndex: 'createTime',
    sorter: true,
// 只设置了一个宽度
    width: 180,
  },
];

正常情况:
image

异常情况:
点击行勾选时,表格宽度变宽

image

@zuihou
Copy link
Author

zuihou commented May 12, 2021

问题2: 有了复选框或者单选框后, 点击最后一列操作列的 编辑 或者 删除按钮 也会触发选中行的事件。

场景: 本想我只想 点编辑, 却触发了选中当前行 和 编辑 事件!

@zuihou zuihou self-assigned this May 12, 2021
@mynetfan
Copy link
Collaborator

问题2不是BUG,参考 #570

@zuihou
Copy link
Author

zuihou commented May 13, 2021

问题2不是BUG,参考 #570

感谢回复,问题2 已解决。

@zuihou
Copy link
Author

zuihou commented May 21, 2021

  • 最新版2.3.0代码

问题1: BasicTable 列设置太多后,表格变形

  • 代码:
const [registerTable, { reload, getSelectRowKeys, getForm }] = useTable({
        title: t('lamp.user.table.title'),
        api: page,
        columns,
        formConfig: {
          labelWidth: 120,
          schemas: searchFormSchema,
        },
        handleSearchInfoFn: handleSearchInfoByCreateTime,
        useSearchForm: true,
        showTableSetting: true,
        bordered: true,
        rowKey: 'id',
        rowSelection: {
          type: 'checkbox',
        },
        actionColumn: {
          width: 160,
          title: t('common.column.action'),
          dataIndex: 'action',
          slots: { customRender: 'action' },
        },
      });

export const columns: BasicColumn[] = [
  {
    title: t('lamp.user.account'),
    dataIndex: 'account',
    // width: 180,
  },
  {
    title: t('lamp.user.name'),
    dataIndex: 'name',
    // width: 180,
  },
  {
    title: t('lamp.user.orgId'),
    dataIndex: 'orgId',
    // width: 180,
  },
  {
    title: t('lamp.user.stationId'),
    dataIndex: 'stationId',
    // width: 180,
  },
  {
    title: t('lamp.user.readonly'),
    dataIndex: 'readonly',
    // width: 180,
  },
  {
    title: t('lamp.user.email'),
    dataIndex: 'email',
    // width: 180,
  },
  {
    title: t('lamp.user.mobile'),
    dataIndex: 'mobile',
    // width: 180,
  },
  {
    title: t('lamp.user.sex'),
    dataIndex: 'sex',
    // width: 180,
  },
  {
    title: t('lamp.user.state'),
    dataIndex: 'state',
    // width: 180,
  },
  {
    title: t('lamp.user.avatar'),
    dataIndex: 'avatar',
    // width: 180,
  },
  {
    title: t('lamp.user.nation'),
    dataIndex: 'nation',
    // width: 180,
  },
  {
    title: t('lamp.user.education'),
    dataIndex: 'education',
    // width: 180,
  },
  {
    title: t('lamp.user.positionStatus'),
    dataIndex: 'positionStatus',
    // width: 180,
  },
  {
    title: t('lamp.user.workDescribe'),
    dataIndex: 'workDescribe',
    // width: 180,
  },
  {
    title: t('lamp.user.passwordErrorLastTime'),
    dataIndex: 'passwordErrorLastTime',
    // width: 180,
  },
  {
    title: t('lamp.user.passwordErrorNum'),
    dataIndex: 'passwordErrorNum',
    // width: 180,
  },
  {
    title: t('lamp.user.passwordExpireTime'),
    dataIndex: 'passwordExpireTime',
    // width: 180,
  },
  {
    title: t('lamp.user.password'),
    dataIndex: 'password',
    // width: 180,
  },
  {
    title: t('lamp.user.salt'),
    dataIndex: 'salt',
    // width: 180,
  },
  {
    title: t('lamp.user.lastLoginTime'),
    dataIndex: 'lastLoginTime',
    // width: 180,
  },
  {
    title: t('lamp.common.createTime'),
    dataIndex: 'createTime',
    sorter: true,
// 只设置了一个宽度
    width: 180,
  },
];

正常情况:
image

异常情况:
点击行勾选时,表格宽度变宽

image

研究了半天,发现问题1是因为一个样式导致的:

<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
....
</PageWrapper>

加了 contentClass="flex" (代码是从src/views/demo/system/account/index.vue 复制的)就会导致选中行时变形, 请问这个contentClass="flex" 是什么意思?

@zuihou
Copy link
Author

zuihou commented May 21, 2021

image

可以将 src/views/demo/system/account/index.vue 代码,按照上图调整后,可以复现问题1

@renjf1
Copy link

renjf1 commented May 22, 2021

这个得看下antd

@anncwb anncwb closed this as completed in d73d43e Jun 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants