baidu / amis

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

6.4.1版本编辑器中使用表格2.0组件,渲染出来的页面上点击查看和编辑未弹框出来,其余新增、删除以及批量删除都弹框正确 #10352

Open BobsLi opened 3 months ago

BobsLi commented 3 months ago

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

  1. 你是如何使用 amis 的? npm

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

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

    {
    "type": "page",
    "id": "u:f54a44454448",
    "body": [
    {
      "id": "u:5e5eef565c08",
      "type": "flex",
      "items": [
        {
          "type": "container",
          "body": [
            {
              "id": "u:245b202bb73e",
              "type": "form",
              "title": "",
              "mode": "normal",
              "dsType": "api",
              "feat": "Insert",
              "body": [
                {
                  "type": "input-tree",
                  "label": "",
                  "name": "tree",
                  "options": [
                    {
                      "label": "选项A",
                      "value": "A",
                      "children": [
                        {
                          "label": "选项C",
                          "value": "C"
                        },
                        {
                          "label": "选项D",
                          "value": "D"
                        }
                      ]
                    },
                    {
                      "label": "选项B",
                      "value": "B"
                    }
                  ],
                  "id": "u:52044dfebd45",
                  "multiple": false,
                  "enableNodePath": false,
                  "hideRoot": true,
                  "showIcon": true,
                  "initiallyOpen": true,
                  "searchable": true,
                  "showOutline": true
                }
              ],
              "actions": [],
              "resetAfterSubmit": true
            }
          ],
          "size": "none",
          "style": {
            "position": "static",
            "display": "block",
            "flex": "1 1 auto",
            "flexGrow": 4,
            "flexBasis": "0px"
          },
          "wrapperBody": false,
          "isFixedHeight": false,
          "isFixedWidth": false,
          "id": "u:7ff616428a94"
        },
        {
          "type": "container",
          "body": [
            {
              "id": "u:7c1b2784fe0a",
              "type": "crud2",
              "mode": "table2",
              "dsType": "api",
              "syncLocation": true,
              "selectable": true,
              "multiple": true,
              "primaryField": "id",
              "loadType": "pagination",
              "api": {
                "url": "https://aisuda.bce.baidu.com/amis/api/mock2/sample",
                "method": "get"
              },
              "filter": {
                "type": "form",
                "title": "条件查询",
                "mode": "inline",
                "columnCount": 3,
                "clearValueOnHidden": true,
                "behavior": [
                  "SimpleQuery"
                ],
                "body": [
                  {
                    "name": "engine",
                    "label": "engine",
                    "type": "input-text",
                    "size": "full",
                    "required": false,
                    "behavior": "SimpleQuery",
                    "id": "u:3840c54700cb"
                  },
                  {
                    "name": "browser",
                    "label": "browser",
                    "type": "input-text",
                    "size": "full",
                    "required": false,
                    "behavior": "SimpleQuery",
                    "id": "u:eb64d580d08e"
                  },
                  {
                    "name": "platform",
                    "label": "platform",
                    "type": "input-text",
                    "size": "full",
                    "required": false,
                    "behavior": "SimpleQuery",
                    "id": "u:a8cc7cc7b571"
                  },
                  {
                    "name": "version",
                    "label": "version",
                    "type": "input-text",
                    "size": "full",
                    "required": false,
                    "behavior": "SimpleQuery",
                    "id": "u:09c97c8f5ec4"
                  },
                  {
                    "name": "grade",
                    "label": "grade",
                    "type": "input-text",
                    "size": "full",
                    "required": false,
                    "behavior": "SimpleQuery",
                    "id": "u:038aa7223e44"
                  },
                  {
                    "name": "badgeText",
                    "label": "badgeText",
                    "type": "input-text",
                    "size": "full",
                    "required": false,
                    "behavior": "SimpleQuery",
                    "id": "u:1a7c02d477eb"
                  },
                  {
                    "name": "id",
                    "label": "id",
                    "type": "input-number",
                    "size": "full",
                    "required": false,
                    "behavior": "SimpleQuery",
                    "id": "u:04cf53b28c29"
                  }
                ],
                "actions": [
                  {
                    "type": "reset",
                    "label": "重置",
                    "id": "u:6c1b295a4f4f"
                  },
                  {
                    "type": "submit",
                    "label": "查询",
                    "level": "primary",
                    "id": "u:76940a990d67"
                  }
                ],
                "id": "u:ffd830ed99b8",
                "feat": "Insert"
              },
              "headerToolbar": [
                {
                  "type": "flex",
                  "direction": "row",
                  "justify": "flex-start",
                  "alignItems": "stretch",
                  "style": {
                    "position": "static"
                  },
                  "items": [
                    {
                      "type": "container",
                      "align": "left",
                      "behavior": [
                        "Insert",
                        "BulkEdit",
                        "BulkDelete"
                      ],
                      "body": [
                        {
                          "type": "button",
                          "label": "新增",
                          "level": "primary",
                          "className": "m-r-xs",
                          "behavior": "Insert",
                          "onEvent": {
                            "click": {
                              "actions": [
                                {
                                  "actionType": "dialog",
                                  "dialog": {
                                    "body": {
                                      "id": "u:5cf73aa04ddd",
                                      "type": "form",
                                      "title": "新增数据",
                                      "mode": "horizontal",
                                      "dsType": "api",
                                      "feat": "Insert",
                                      "body": [
                                        {
                                          "name": "engine",
                                          "label": "engine",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "browser",
                                          "label": "browser",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "platform",
                                          "label": "platform",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "version",
                                          "label": "version",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "grade",
                                          "label": "grade",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "badgeText",
                                          "label": "badgeText",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "id",
                                          "label": "id",
                                          "type": "input-number"
                                        }
                                      ],
                                      "resetAfterSubmit": true,
                                      "actions": [
                                        {
                                          "type": "button",
                                          "actionType": "cancel",
                                          "label": "取消"
                                        },
                                        {
                                          "type": "button",
                                          "actionType": "submit",
                                          "label": "提交",
                                          "level": "primary"
                                        }
                                      ],
                                      "onEvent": {
                                        "submitSucc": {
                                          "actions": [
                                            {
                                              "actionType": "search",
                                              "groupType": "component",
                                              "componentId": "u:7c1b2784fe0a"
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "title": "新增数据",
                                    "size": "md",
                                    "actions": [
                                      {
                                        "type": "button",
                                        "actionType": "cancel",
                                        "label": "取消"
                                      },
                                      {
                                        "type": "button",
                                        "actionType": "submit",
                                        "label": "提交",
                                        "level": "primary"
                                      }
                                    ]
                                  }
                                }
                              ]
                            }
                          },
                          "id": "u:cfe2241c093b"
                        },
                        {
                          "type": "button",
                          "label": "批量编辑",
                          "className": "m-r-xs",
                          "disabledOn": "${selectedItems != null && selectedItems.length < 1}",
                          "behavior": "BulkEdit",
                          "onEvent": {
                            "click": {
                              "actions": [
                                {
                                  "actionType": "dialog",
                                  "dialog": {
                                    "body": {
                                      "id": "u:0637eee621a3",
                                      "type": "form",
                                      "title": "批量编辑",
                                      "mode": "horizontal",
                                      "dsType": "api",
                                      "feat": "BulkEdit",
                                      "body": [
                                        {
                                          "name": "engine",
                                          "label": "engine",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "browser",
                                          "label": "browser",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "platform",
                                          "label": "platform",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "version",
                                          "label": "version",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "grade",
                                          "label": "grade",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "badgeText",
                                          "label": "badgeText",
                                          "type": "input-text"
                                        },
                                        {
                                          "name": "id",
                                          "label": "id",
                                          "type": "input-number"
                                        }
                                      ],
                                      "resetAfterSubmit": true,
                                      "actions": [
                                        {
                                          "type": "button",
                                          "actionType": "cancel",
                                          "label": "取消"
                                        },
                                        {
                                          "type": "button",
                                          "actionType": "submit",
                                          "label": "提交",
                                          "level": "primary"
                                        }
                                      ],
                                      "onEvent": {
                                        "submitSucc": {
                                          "actions": [
                                            {
                                              "actionType": "search",
                                              "groupType": "component",
                                              "componentId": "u:7c1b2784fe0a"
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "title": "批量编辑",
                                    "size": "md",
                                    "actions": [
                                      {
                                        "type": "button",
                                        "actionType": "cancel",
                                        "label": "取消"
                                      },
                                      {
                                        "type": "button",
                                        "actionType": "submit",
                                        "label": "提交",
                                        "level": "primary"
                                      }
                                    ]
                                  }
                                }
                              ]
                            }
                          },
                          "id": "u:9b6f67949764"
                        },
                        {
                          "type": "button",
                          "label": "批量删除",
                          "behavior": "BulkDelete",
                          "level": "danger",
                          "className": "m-r-xs",
                          "confirmText": "确认要批量删除数据「${JOIN(ARRAYMAP(selectedItems, item => item.id), ',')}」",
                          "disabledOn": "${selectedItems != null && selectedItems.length < 1}",
                          "onEvent": {
                            "click": {
                              "actions": [
                                {
                                  "actionType": "ajax"
                                },
                                {
                                  "actionType": "search",
                                  "groupType": "component",
                                  "componentId": "u:7c1b2784fe0a"
                                }
                              ]
                            }
                          },
                          "id": "u:97bbdf549f99"
                        }
                      ],
                      "wrapperBody": false,
                      "style": {
                        "flexGrow": 1,
                        "flex": "1 1 auto",
                        "position": "static",
                        "display": "flex",
                        "flexBasis": "auto",
                        "flexDirection": "row",
                        "flexWrap": "nowrap",
                        "alignItems": "stretch",
                        "justifyContent": "flex-start"
                      },
                      "id": "u:52dfe30d6cfd"
                    },
                    {
                      "type": "container",
                      "align": "right",
                      "behavior": [
                        "FuzzyQuery"
                      ],
                      "body": [],
                      "wrapperBody": false,
                      "style": {
                        "flexGrow": 1,
                        "flex": "1 1 auto",
                        "position": "static",
                        "display": "flex",
                        "flexBasis": "auto",
                        "flexDirection": "row",
                        "flexWrap": "nowrap",
                        "alignItems": "stretch",
                        "justifyContent": "flex-end"
                      },
                      "id": "u:f29500aba97f"
                    }
                  ],
                  "id": "u:e565c95f5e9b"
                }
              ],
              "footerToolbar": [
                {
                  "type": "flex",
                  "direction": "row",
                  "justify": "flex-start",
                  "alignItems": "stretch",
                  "style": {
                    "position": "static"
                  },
                  "items": [
                    {
                      "type": "container",
                      "align": "left",
                      "body": [],
                      "wrapperBody": false,
                      "style": {
                        "flexGrow": 1,
                        "flex": "1 1 auto",
                        "position": "static",
                        "display": "flex",
                        "flexBasis": "auto",
                        "flexDirection": "row",
                        "flexWrap": "nowrap",
                        "alignItems": "stretch",
                        "justifyContent": "flex-start"
                      },
                      "id": "u:2e4f28698b82"
                    },
                    {
                      "type": "container",
                      "align": "right",
                      "body": [
                        {
                          "type": "pagination",
                          "behavior": "Pagination",
                          "layout": [
                            "total",
                            "perPage",
                            "pager"
                          ],
                          "perPage": 10,
                          "perPageAvailable": [
                            10,
                            20,
                            50,
                            100
                          ],
                          "align": "right",
                          "id": "u:80c55e28ef7b"
                        }
                      ],
                      "wrapperBody": false,
                      "style": {
                        "flexGrow": 1,
                        "flex": "1 1 auto",
                        "position": "static",
                        "display": "flex",
                        "flexBasis": "auto",
                        "flexDirection": "row",
                        "flexWrap": "nowrap",
                        "alignItems": "stretch",
                        "justifyContent": "flex-end"
                      },
                      "id": "u:40d68e518092"
                    }
                  ],
                  "id": "u:a6255b254cb8"
                }
              ],
              "columns": [
                {
                  "type": "tpl",
                  "title": "engine",
                  "name": "engine",
                  "id": "u:6b9eb8e54433"
                },
                {
                  "type": "tpl",
                  "title": "browser",
                  "name": "browser",
                  "id": "u:0519609ede57"
                },
                {
                  "type": "tpl",
                  "title": "platform",
                  "name": "platform",
                  "id": "u:5629aa911afe"
                },
                {
                  "type": "tpl",
                  "title": "version",
                  "name": "version",
                  "id": "u:058e5acafb2b"
                },
                {
                  "type": "tpl",
                  "title": "grade",
                  "name": "grade",
                  "id": "u:35a0d3803061"
                },
                {
                  "type": "tpl",
                  "title": "badgeText",
                  "name": "badgeText",
                  "id": "u:6daa082c5082"
                },
                {
                  "type": "tpl",
                  "title": "id",
                  "name": "id",
                  "id": "u:0adb1400a288"
                },
                {
                  "type": "operation",
                  "title": "操作",
                  "buttons": [
                    {
                      "type": "button",
                      "label": "查看",
                      "level": "link",
                      "behavior": "View",
                      "onEvent": {
                        "click": {
                          "actions": [
                            {
                              "actionType": "dialog",
                              "dialog": {
                                "body": {
                                  "id": "u:798e9db60b93",
                                  "type": "form",
                                  "title": "查看数据",
                                  "mode": "horizontal",
                                  "dsType": "api",
                                  "feat": "View",
                                  "body": [
                                    {
                                      "name": "engine",
                                      "label": "engine",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "browser",
                                      "label": "browser",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "platform",
                                      "label": "platform",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "version",
                                      "label": "version",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "grade",
                                      "label": "grade",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "badgeText",
                                      "label": "badgeText",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "id",
                                      "label": "id",
                                      "type": "input-number"
                                    }
                                  ],
                                  "static": true,
                                  "actions": [
                                    {
                                      "type": "button",
                                      "actionType": "cancel",
                                      "label": "关闭"
                                    }
                                  ],
                                  "onEvent": {
                                    "submitSucc": {
                                      "actions": [
                                        {
                                          "actionType": "search",
                                          "groupType": "component",
                                          "componentId": "u:7c1b2784fe0a"
                                        }
                                      ]
                                    }
                                  }
                                },
                                "title": "查看数据",
                                "size": "md",
                                "actions": [
                                  {
                                    "type": "button",
                                    "actionType": "cancel",
                                    "label": "关闭"
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      },
                      "id": "u:c2a3179a9053"
                    },
                    {
                      "type": "button",
                      "label": "编辑",
                      "level": "link",
                      "behavior": "Edit",
                      "onEvent": {
                        "click": {
                          "actions": [
                            {
                              "actionType": "dialog",
                              "dialog": {
                                "body": {
                                  "id": "u:f90fc484bdcb",
                                  "type": "form",
                                  "title": "编辑数据",
                                  "mode": "horizontal",
                                  "dsType": "api",
                                  "feat": "Edit",
                                  "body": [
                                    {
                                      "name": "engine",
                                      "label": "engine",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "browser",
                                      "label": "browser",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "platform",
                                      "label": "platform",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "version",
                                      "label": "version",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "grade",
                                      "label": "grade",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "badgeText",
                                      "label": "badgeText",
                                      "type": "input-text"
                                    },
                                    {
                                      "name": "id",
                                      "label": "id",
                                      "type": "input-number"
                                    }
                                  ],
                                  "resetAfterSubmit": true,
                                  "actions": [
                                    {
                                      "type": "button",
                                      "actionType": "cancel",
                                      "label": "取消"
                                    },
                                    {
                                      "type": "button",
                                      "actionType": "submit",
                                      "label": "提交",
                                      "level": "primary"
                                    }
                                  ],
                                  "onEvent": {
                                    "submitSucc": {
                                      "actions": [
                                        {
                                          "actionType": "search",
                                          "groupType": "component",
                                          "componentId": "u:7c1b2784fe0a"
                                        }
                                      ]
                                    }
                                  }
                                },
                                "title": "编辑数据",
                                "size": "md",
                                "actions": [
                                  {
                                    "type": "button",
                                    "actionType": "cancel",
                                    "label": "取消"
                                  },
                                  {
                                    "type": "button",
                                    "actionType": "submit",
                                    "label": "提交",
                                    "level": "primary"
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      },
                      "id": "u:03601441eed7"
                    },
                    {
                      "type": "button",
                      "label": "删除",
                      "behavior": "Delete",
                      "className": "m-r-xs text-danger",
                      "level": "link",
                      "confirmText": "确认要删除数据",
                      "onEvent": {
                        "click": {
                          "actions": [
                            {
                              "actionType": "ajax",
                              "data": {
                                "&": "$$"
                              }
                            },
                            {
                              "actionType": "search",
                              "groupType": "component",
                              "componentId": "u:7c1b2784fe0a"
                            }
                          ]
                        }
                      },
                      "id": "u:ec55da58a035"
                    }
                  ],
                  "id": "u:8c394716cce2"
                }
              ]
            }
          ],
          "size": "none",
          "style": {
            "position": "static",
            "display": "block",
            "flex": "1 1 auto",
            "flexGrow": 8,
            "flexBasis": "0px"
          },
          "wrapperBody": false,
          "isFixedHeight": false,
          "isFixedWidth": false,
          "id": "u:32b47143608b"
        }
      ],
      "style": {
        "position": "relative",
        "rowGap": "10px",
        "columnGap": "10px",
        "flexWrap": "nowrap",
        "inset": "auto"
      },
      "isFixedHeight": false,
      "isFixedWidth": false
    }
    ],
    "asideResizor": false,
    "pullRefresh": {
    "disabled": true
    },
    "toolbar": [],
    "regions": [
    "body"
    ]
    }
  4. 操作步骤 拖入表格2.0组件,然后按照弹框正常配置,所有按钮全选,然后预览,点击查看和编辑没有弹框,控制台也没有报错

github-actions[bot] commented 3 months ago

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.