amis icon indicating copy to clipboard operation
amis copied to clipboard

intputTable表单实时验证功能

Open qianxiaofendou opened this issue 2 years ago • 2 comments

描述问题:

使用inputTable的过程中,因为产品提出需求需要表单实时验证,当开启needConfirm为false时,是可以实时触发校验的,但是这时表单c由Switch变成了input,麻烦看下这个问题;如果开启needConfirm为true时,表单type类型的表单都显示正常,但是实时触发校验没有了,在保存表单数据的时候会有个toast弹窗提示,如下面图一(提示比较模糊,不确定是哪个表单的),另外当select开启搜索后,会在table的head上多一个搜索按钮,如图二

期待改善: 1、在needConfirm为true时也能做到实时验证 2、望在needConfirm为false,不同的type的表单类型能正确渲染

截图或视频:

image

image

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的? sdk1.9.0和SDK2.2.0都有

  2. 粘贴有问题的完整 amis schema 代码:

{
  "type": "page",
  "body": {
    "type": "form",
    "data": {
      "table": [
        {
          "a": "a1",
          "b": "b1",
          "c": true
        },
        {
          "a": "a2",
          "b": "b2",
          "c": false
        },
        {
          "a": "a3",
          "b": "b3",
          "c": true
        }
      ]
    },
    "api": "/amis/api/mock2/form/saveForm",
    "body": [
      {
        "type": "input-table",
        "name": "table",
        "label": "Table",
        "needConfirm": true,
        "columns": [
          {
            "label": "A",
            "name": "a",
            "type": "input-text",
            "validations": {
              "maxLength": 200,
              "minLength": 2
            },
            "validateOnChange": true
          },
          {
            "label": "B",
            "name": "b",
            "type": "select",
            "searchable": true,
            "options": [
              "b1",
              "b2",
              "b3"
            ]
          },
          {
            "label": "C",
            "name": "c",
            "type": "switch"
          }
        ]
      }
    ]
  }
}

@2betop @nwind @lurunze1226

qianxiaofendou avatar Sep 14 '22 05:09 qianxiaofendou

补充:当开启needConfirm为false时,会丢失不匹配type类型的表单的值,推测应该是needConfirm为false时,只有部分type类型表单可以正确渲染,其它类型的都渲染成了input-text

@2betop @nwind @lurunze1226

qianxiaofendou avatar Sep 15 '22 03:09 qianxiaofendou

@2betop @nwind @lurunze1226 这里有个问题需要修复的额,辛苦~~

qianxiaofendou avatar Sep 21 '22 08:09 qianxiaofendou