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

🐛[BUG] 当编辑用:action?.startEditable?.(record.uuid) 不传第二个参数时,取消行动点会删除整行 #8951

Open
LovePlayCode opened this issue Dec 31, 2024 · 0 comments

Comments

@LovePlayCode
Copy link

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

  使用EditableProTable配合 ProForm 使用时,出现取消行动点删除整行的情况。 经排查, action?.startEditable?.(record.uuid, record); 这个需要使用第二个参数,不然就会出现我上诉提到的问题。 

📷 复现步骤

  1. EditableProTable配合 ProForm 使用。如官方例子。
  2. 编辑的时候这样写:action?.startEditable?.(record.id);
  3. 进入编辑态点击取消,整行随之取消。
image image 可以看到已经删掉了。

🏞 期望结果

取消不用删整行

💻 复现代码

<ProForm initialValues={{ table: [ { uuid: '624748504', title: '活动名称一', decs: '这个活动真好玩', state: 'open', created_at: 1590486176000, update_at: 1590486176000, }, { uuid: '624691229', title: '活动名称二', decs: '这个活动真好玩', state: 'closed', created_at: 1590481162000, update_at: 1590481162000, }, ], }} validateTrigger="onBlur" > <EditableProTable rowKey="uuid" scroll={{ x: 960, }} headerTitle="可编辑表格" maxLength={5} name="table" columns={[ { title: '活动名称', dataIndex: 'title', formItemProps: () => { return { rules: [{ required: true, message: '此项为必填项' }], }; }, width: '30%', }, { title: '状态', key: 'state', dataIndex: 'state', valueType: 'select', valueEnum: { all: { text: '全部', status: 'Default' }, open: { text: '未解决', status: 'Error', }, closed: { text: '已解决', status: 'Success', }, }, }, { title: '描述', dataIndex: 'decs', }, { title: '活动时间', dataIndex: 'created_at', valueType: 'date', }, { title: '操作', valueType: 'option', width: 200, render: (text, record, _, action) => [ <a key="editable" onClick={() => { action?.startEditable?.(record.uuid); }} > 编辑 </a>, ], }, ]} editable={{ type: 'multiple', editableKeys, onChange: setEditableRowKeys, actionRender: (row, config, defaultDom) => { return [defaultDom.save, defaultDom.delete, defaultDom.cancel]; }, }} /> <ProForm.Item> <ProCard title="表格数据" headerBordered collapsible defaultCollapsed > <ProFormDependency name={['table']}> {({ table }) => { return ( <ProFormField ignoreFormItem fieldProps={{ style: { width: '100%', }, }} mode="read" valueType="jsonCode" text={JSON.stringify(table)} /> ); }} </ProFormDependency> </ProCard> </ProForm.Item> </ProForm>

© 版本信息

  • ProComponents 版本: 2.31.2
  • umi 版本: 4
  • 浏览器环境: 谷歌浏览器
  • 开发环境:mac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant