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

combo里面input-table使用弹窗修改,第二个或以上的combo里弹窗修改的数据会赋值到第一个combo里面 #6996

Closed
yshujun opened this issue May 25, 2023 · 3 comments · Fixed by #7029
Assignees
Labels

Comments

@yshujun
Copy link

yshujun commented May 25, 2023

实现场景:

需求需要有可以增加整个模块,并且模块内需要有可编辑表格, 可编辑表格还要可以弹窗修改,弹窗里面会显示更多数据。

存在的问题:

使用combo组合来完成增加整个模块的功能, 但是在可编辑表格弹窗修改时遇到,第二个模块新增的数据会赋值到第一个模块的表格中
示例

当前方案:

请粘贴你当前方案的完整 amis schema 代码...

{
  "type": "page",
  "body": {
    "type": "form",
    "debug": true,
    "data": {
      "combo": [
        {
          "table": [{}]
        }
      ]
    },
    "mode": "horizontal",
    "api": "/amis/api/mock2/form/saveForm",
    "body": [
      {
        "type": "combo",
        "name": "combo",
        "id": "comboId",
        "label": false,
        "strictMode": false,
        "multiple": true,
        "addBtn": {
          "type": "button",
          "label": "增加",
          "level": "default",
          "block": true
        },
        "items": [
          {
            "type": "input-table",
            "name": "table",
            "id": "tableId",
            "strictMode": false,
            "label": false,
            "needConfirm": false,
            "addable": true,
            "removable": true,
            "columns": [
              {
                "label": "A",
                "name": "a",
                "quickEdit": false
              },
              {
                "label": "B",
                "name": "b"
              },
              {
                "type": "operation",
                "label": "操作",
                "quickEdit": false,
                "buttons": [
                  {
                    "type": "button",
                    "level": "link",
                    "onEvent": {
                      "click": {
                        "weight": 0,
                        "actions": [
                          {
                            "dialog": {
                              "data": {
                                "&": "$$",
                                "index": "$index"
                              },
                              "closeOnEsc": false,
                              "className": "app-popover",
                              "body": [
                                {
                                  "data": {
                                    "bindingBrokerLists": [
                                      {}
                                    ]
                                  },
                                  "onEvent": {
                                    "validateSucc": {
                                      "weight": 0,
                                      "actions": [
                                        {
                                          "args": {},
                                          "actionType": "closeDialog"
                                        },
                                        {
                                          "args": {
                                            "index": "$index",
                                            "value": {
                                              "a": "$a",
                                              "b": "$b",
                                              "bindingBrokerLists": "$bindingBrokerLists"
                                            }
                                          },
                                          "actionType": "setValue",
                                          "componentId": "tableId"
                                          // "target": "tqble"
                                        }
                                      ]
                                    }
                                  },
                                  "id": "u:c6f5190b3e79",
                                  "body": [
                                    {
                                      "label": "A",
                                      "name": "a",
                                      "type": "input-text",
                                      "required": true
                                    },
                                    {
                                      "label": "B",
                                      "name": "b",
                                      "type": "input-text",
                                      "required": true
                                    }
                                  ],
                                  "type": "form",
                                  "title": "表单"
                                }
                              ],
                              "type": "dialog",
                              "title": "再保人经纪人信息",
                              "showLoading": true,
                              "withDefaultData": true,
                              "dataMapSwitch": true,
                              "size": "lg",
                              "dataMap": {
                                "index": "$index",
                                "items.bindingBrokerLists": "$bindingBrokerLists",
                                "items": "$items"
                              },
                              "showErrorMsg": true,
                              "showCloseButton": true,
                              "id": "u:c02c4a3a9896",
                              "actions": [
                                {
                                  "level": "primary",
                                  "onEvent": {
                                    "click": {
                                      "actions": [
                                        {
                                          "actionType": "validate",
                                          "groupType": "component",
                                          "componentId": "u:c6f5190b3e79"
                                        }
                                      ]
                                    }
                                  },
                                  "id": "u:93f0098bcda0",
                                  "label": "提交",
                                  "type": "button"
                                },
                                {
                                  "onEvent": {
                                    "click": {
                                      "actions": [
                                        {
                                          "args": {},
                                          "actionType": "closeDialog"
                                        }
                                      ]
                                    }
                                  },
                                  "id": "u:ca36246070b5",
                                  "label": "关闭",
                                  "type": "button"
                                }
                              ]
                            },
                            "actionType": "dialog"
                          }
                        ]
                      }
                    },
                    "id": "u:fe240f4c3aa8",
                    "label": "修改"
                  }
                ]
              }
            ]
          }
          
        ],
        "value": [
          {
            "text": ""
          }
        ]
      },
      {
        "type": "button",
        "label": "add",
        "onEvent": {
          "click": {
            "actions": [
              {
                "actionType": "addItem",
                "componentId": "comboId"
              }
            ]
          }
        }
      }
    ]
  }
}
@ziBLan
Copy link

ziBLan commented May 25, 2023

mark

@2betop 2betop assigned 2betop and hsm-lv and unassigned 2betop May 29, 2023
@2betop
Copy link
Collaborator

2betop commented May 29, 2023

事件动作指定目标有问题,目前不支持循环中场景,带内部改造 @hsm-lv

@shooop
Copy link

shooop commented May 29, 2023

遇到了类似这样的问题

@hsm-lv hsm-lv added the feat label May 29, 2023
hsm-lv added a commit that referenced this issue May 30, 2023
feat:动作的componentId支持表达式&动作增加componentName属性 Close #6907&#6996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants