amis icon indicating copy to clipboard operation
amis copied to clipboard

InputTable的输入框校验,能否和其他字段有联动校验

Open zbl400 opened this issue 10 months ago • 0 comments

实现场景:

inputTable 内,每行的一个输入框,想要根据同一行其他字段的内容,进行校验。 比如同一行内有个字段叫校验类型,内容为 必要, 则该行的输入框需要 required 校验; 如果校验类型字段内容为数据,则入框需要校验数字

存在的问题:

目前文档中没有找到相关的内容,不知道能否实现上述功能

当前方案:

没有方案,下面只是一个InputTable的示例,想要在这上面实现联动校验的功能。

{
  "type": "page",
  "title": "inputTableValidator",
  "body": [
    {
      "type": "tpl",
      "tpl": "这是你刚刚新增的页面。",
      "wrapperComponent": "",
      "inline": false,
      "id": "u:29fc42aac30c"
    },
    {
      "type": "service",
      "body": [
        {
          "type": "input-table",
          "name": "table",
          "label": "表格表单",
          "columns": [
            {
              "label": "检查",
              "name": "type",
              "quickEdit": false,
              "type": "text",
              "id": "u:f6a32a6ffc0f"
            },
            {
              "label": "内容",
              "name": "value",
              "quickEdit": {
                "type": "input-text",
                "name": "value",
                "id": "u:8f9e8f650cc6",
                "required": true
              },
              "type": "text",
              "id": "u:97a0778b1ad6"
            }
          ],
          "addable": false,
          "footerAddBtn": {
            "label": "新增",
            "icon": "fa fa-plus",
            "id": "u:b66c41179e2c"
          },
          "strictMode": true,
          "id": "u:39c1ed4127b9",
          "minLength": 0,
          "editable": false,
          "needConfirm": false
        }
      ],
      "label": "服务Service",
      "id": "u:4d9110a3b311",
      "dsType": "api",
      "data": {
        "table": [
          {
            "type": "必要",
            "value": "b"
          },
          {
            "type": "数字",
            "value": 2
          }
        ]
      }
    }
  ],
  "id": "u:82985959fe66"
}

zbl400 avatar Apr 15 '24 23:04 zbl400