baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.21k stars 2.5k forks source link

当编辑弹窗中添加多个list-text只能获取到一个的值 #10422

Open 760985933 opened 4 months ago

760985933 commented 4 months ago

描述问题:

当编辑弹窗中添加多个list-text只能获取到一个的值

截图或视频:

image

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

  1. 你是如何使用 amis 的? sdknpm其他... sdk

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在 6.5.0

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

    {
                        "type": "button",
                        "label": "编辑",
                        "id": "u:14b47c338072",
                        "onEvent": {
                          "click": {
                            "weight": 0,
                            "actions": [
                              {
                                "ignoreError": false,
                                "actionType": "dialog",
                                "dialog": {
                                  "type": "dialog",
                                  "title": "编辑脚本内容",
                                  "body": [
                                    {
                                      "type": "input-text",
                                      "label": "脚本名称",
                                      "name": "scripts_name",
                                      "id": "u:1bcf2cd92490",
                                      "clearable": true
                                    },
                                    {
                                      "type": "list-select",
                                      "label": "脚本名称",
                                      "name": "scripts_type",
                                      "options": [
                                        {
                                          "label": "自动化",
                                          "value": "0"
                                        },
                                        {
                                          "label": "巡检",
                                          "value": "1"
                                        },
                                        {
                                          "label": "备份",
                                          "value": "2"
                                        }
                                      ],
                                      "id": "u:12c234efff64",
                                      "multiple": false,
                                      "value": "0"
                                    },
                                    {
                                      "type": "list-select",
                                      "label": "脚本OS",
                                      "name": "scripts_os",
                                      "options": [
                                        {
                                          "label": "Linux",
                                          "value": "0"
                                        },
                                        {
                                          "label": "Windows",
                                          "value": "1"
                                        },
                                        {
                                          "label": "Unix",
                                          "value": "2"
                                        },
                                        {
                                          "label": "跨平台",
                                          "value": "3"
                                        }
                                      ],
                                      "id": "u:3fb82a810166",
                                      "multiple": false,
                                      "value": "0"
                                    },
                                    {
                                      "type": "editor",
                                      "label": "脚本编辑器",
                                      "name": "scripts_cmds",
                                      "id": "u:6fc1150b3930",
                                      "language": "shell"
                                    }
                                  ],
                                  "showCloseButton": true,
                                  "showErrorMsg": true,
                                  "showLoading": true,
                                  "className": "app-popover :AMISCSSWrapper",
                                  "actions": [
                                    {
                                      "type": "button",
                                      "actionType": "cancel",
                                      "label": "取消",
                                      "id": "u:cd2d3532a0b6"
                                    },
                                    {
                                      "type": "button",
                                      "actionType": "confirm",
                                      "label": "确认",
                                      "primary": true,
                                      "id": "u:8c3734fd75f3",
                                      "onEvent": {
                                        "click": {
                                          "weight": 0,
                                          "actions": [
                                            {
                                              "ignoreError": false,
                                              "outputVar": "responseResult",
                                              "actionType": "ajax",
                                              "options": {},
                                              "args": {
                                              "api": {
                                                "url": "/api/op/v1/update_scripts_center_info/${scripts_id}?scripts_name=${scripts_name}&scripts_cmds=${scripts_cmds}&scripts_type=${scripts_type}&scripts_os=${scripts_os}",
                                                "method": "put",
                                                "requestAdaptor": "",
                                            "adaptor": "",
                                            "messages": {}
                                        }
                                    }
                                }
                                          ]
                                        }
                                      }
                                    }
                                  ],
                                  "id": "u:9063c8e77c86"
                                }
                              }
                            ]
                          }
                        }
                      }
  4. 操作步骤 1、v1/update_scripts_center_info/1?scripts_name=111&scripts_cmds=111&scripts_type=&scripts_os=0可以在put中看到scripts_type=为空,但是当只编辑这个list的时候是可以正常获取,当选择两个list中的内容时,只有一个获取到值。

CheshireJCat commented 3 months ago

dialog 下面应该先有一层 form,然后 form里再放表单项吧 示例 https://baidu.github.io/amis/zh-CN/components/dialog?page=1#%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8