baidu / baidu/amis

input-table内公式列initSet计算后不更新data域,造成显示值和实际值不一致

Open
#4,068 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

need confirm
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

描述问题:

input-table内假如有公式列,设置initSet:true计算后显示的列值变了,但是开了form的debug看,没有更新data域,造成显示值和实际值不一致

截图或视频:

image
image

如何复现(请务必完整填写下面内容):
  1. 你是如何使用 amis 的?
    sdknpm其他...
    sdk
  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    v1.8.0
  3. 粘贴有问题的完整 amis schema 代码:
const schema = {
    type: 'page',
    title: '表单页面',
    data: {
      aclPermissions: aclStore.getPermission,
    },
    body: [
      {
        type: 'form',
        mode: 'horizontal',
        api: 'post:/test/mock',
        debug: true,
        data: {
          items: [
            { a: 1, b: 1, c: 0 },
            { a: 2, b: 2, c: 0 },
            { a: 3, b: 3, c: 0 },
          ],
        },
        body: [
          {
            label: 'Name',
            type: 'input-text',
            name: 'name',
            visibleOn: 'this.aclPermissions.includes("delete:system")',
          },
          {
            label: 'Email',
            type: 'input-email',
            name: 'email',
          },
          {
            type: 'input-table',
            name: 'items',
            label: '订单明细',
            columns: [
              {
                type: 'input-number',
                name: 'a',
                label: '单价',
              },
              {
                type: 'input-number',
                name: 'b',
                label: '数量',
              },
              {
                type: 'input-number',
                name: 'c',
                label: '总价',
              },
              {
                type: 'formula',
                formula: '${a*b}',
                name: 'c',
                initSet: true,
                autoSet: true,
              },
            ],
          },
        ],
      },
    ],
  }
  1. 操作步骤
    请简单描述一下复现的操作步骤...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided amis SDK schema with the input-table formula column, initSet enabled, and form debug enabled. Compare the formula column's displayed value with the form data after initialization; done means both values remain consistent for the sample items.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.