baidu / amis

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

amis 编辑器 3.0.0 版本 CURD组件分页参数BUG #7009

Closed atliwen closed 1 year ago

atliwen commented 1 year ago

描述问题:

amis 编辑器 3.0.0 版本 CURD组件分页参数BUG

原本是 json 实际发送的是 字符串

截图或视频:

image

image

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

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

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

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

    {
    "type": "page",
    "title": "页面",
    "body": [
    {
      "type": "crud",
      "id": "u:d85e4de8d3ce43228cde5e8d5292740a",
      "api": {
        "url": "/prod-api/mapi/automatically/a_a3827694/listPage?parentId=${bid}",
        "method": "post",
        "dataType": "json",
        "messages": {
        }
      },
      "filter": {
        "id": "u:88d91a59ee9149bb95c80dd8b77c1d17",
        "body": [
          {
            "id": "u:99f07893619b4561b119ff4ecad2ab25",
            "name": "f67c33b26_s",
            "type": "input-text",
            "label": "tt",
            "style": {
              "margin-bottom": "10px"
            },
            "labelClassName": "font-bold"
          },
          {
            "id": "u:1ca256fb554443e491d1abacbd1023e6",
            "type": "submit",
            "label": "搜索",
            "level": "primary"
          },
          {
            "id": "u:2e6b3a3e0c5c4ce59deefc9270740425",
            "type": "button",
            "label": "高级搜索",
            "level": "primary",
            "onEvent": {
              "click": {
                "weight": 0,
                "actions": [
                  {
                    "args": {
                    },
                    "actionType": "reset",
                    "componentId": "u:88d91a59ee9149bb95c80dd8b77c1d17"
                  },
                  {
                    "dialog": {
                      "id": "u:d86095cfd6fd4a81817e41f612a45292",
                      "body": {
                        "id": "u:51f8b8e236bb4fdd9263233a6ad52881",
                        "name": "conditions",
                        "size": "full",
                        "type": "condition-builder",
                        "fields": [
                          {
                            "id": "u:13b899affae44576a2ccfee0f4d4665b",
                            "name": "createBy",
                            "type": "text",
                            "label": "创建者"
                          },
                          {
                            "id": "u:7d2ea4884bb84f309b428a999f0793ea",
                            "name": "createTime",
                            "type": "input-datetime",
                            "label": "创建时间"
                          },
                          {
                            "id": "u:0a7d6d2407a1430688faf2599619790d",
                            "name": "updateBy",
                            "type": "text",
                            "label": "更新者"
                          },
                          {
                            "id": "u:da3b2f160ce44f21a6da880bdfd24ecf",
                            "name": "updateTime",
                            "type": "input-datetime",
                            "label": "更新时间"
                          },
                          {
                            "id": "u:7a3e6052e10a490e9a8940332f6e281d",
                            "name": "remark",
                            "type": "text",
                            "label": "备注"
                          },
                          {
                            "id": "u:b8b179b300ab495180244dafb4bf3ee7",
                            "name": "f67c33b26",
                            "type": "text",
                            "label": "tt"
                          }
                        ],
                        "inline": false,
                        "showANDOR": true,
                        "builderMode": "simple",
                        "placeholder": "基础查询将不生效",
                        "labelClassName": "font-bold"
                      },
                      "type": "dialog",
                      "level": "primary",
                      "title": "自定义高级搜索",
                      "onEvent": {
                        "confirm": {
                          "weight": 0,
                          "actions": [
                            {
                              "args": {
                                "value": {
                                  "conditions": "${event.data}"
                                }
                              },
                              "actionType": "setValue",
                              "componentId": "u:88d91a59ee9149bb95c80dd8b77c1d17"
                            },
                            {
                              "args": {
                              },
                              "actionType": "submit",
                              "componentId": "u:88d91a59ee9149bb95c80dd8b77c1d17"
                            }
                          ]
                        }
                      },
                      "closeOnEsc": false,
                      "showLoading": true,
                      "showErrorMsg": true,
                      "showCloseButton": true
                    },
                    "actionType": "dialog"
                  }
                ]
              }
            }
          }
        ],
        "mode": "inline",
        "title": "查询条件",
        "wrapWithPanel": false
      },
      "columns": [
        {
          "id": "u:d4fc8b343d3041c79512ca83e0c9aca0",
          "name": "id",
          "type": "text",
          "label": "ID",
          "style": {
            "margin-bottom": "10px"
          },
          "toggled": false,
          "readOnly": true,
          "sortable": true,
          "labelClassName": "font-bold"
        },
        {
          "id": "u:545dc68c2f824dec80cf3ff637ea8498",
          "name": "createBy",
          "type": "text",
          "label": "创建者",
          "style": {
            "margin-bottom": "10px"
          },
          "toggled": false,
          "readOnly": true,
          "sortable": true,
          "labelClassName": "font-bold"
        },
        {
          "id": "u:b411a7a5fd7e47da98208107a83a8817",
          "name": "createTime",
          "type": "text",
          "label": "创建时间",
          "toggled": false,
          "readOnly": true,
          "sortable": true,
          "labelClassName": "font-bold"
        },
        {
          "id": "u:57a44b42e16d4f9cbab36b5448f7f209",
          "name": "updateBy",
          "type": "text",
          "label": "更新者",
          "style": {
            "margin-bottom": "10px"
          },
          "toggled": false,
          "readOnly": true,
          "sortable": true,
          "labelClassName": "font-bold"
        },
        {
          "id": "u:15763ddca1a144699e7a6da81100aed9",
          "name": "updateTime",
          "type": "text",
          "label": "更新时间",
          "toggled": false,
          "readOnly": true,
          "sortable": true,
          "labelClassName": "font-bold"
        },
        {
          "id": "u:33846000de8c439188160eb4743f387f",
          "name": "remark",
          "type": "text",
          "label": "备注",
          "style": {
            "margin-bottom": "10px"
          },
          "toggled": false,
          "readOnly": true,
          "sortable": true,
          "labelClassName": "font-bold"
        },
        {
          "id": "u:c2a5c3cca14e4b35a7241c22cae9d72f",
          "name": "f67c33b26",
          "type": "text",
          "label": "tt",
          "style": {
            "margin-bottom": "10px"
          },
          "readOnly": true,
          "sortable": true,
          "labelClassName": "font-bold"
        }
      ],
      "bulkActions": [
        {
          "id": "u:b74d6f9659174450af0501510fe7fd6f",
          "api": "/prod-api/mapi/automatically/a_a3827694/batch_delete",
          "type": "button",
          "label": "批量删除",
          "level": "danger",
          "actionType": "ajax",
          "confirmText": "确定要删除?"
        }
      ],
      "itemActions": [
        {
          "id": "u5527e289ecf84e1e9cc500c1bfc52993",
          "size": "xs",
          "type": "button",
          "label": "编辑",
          "level": "link",
          "dialog": {
            "id": "uaa9b550a4830426cbfc97cb426c2d100",
            "body": [
              {
                "id": "u7ec0ec079f564ed68163db0e147ddc1b",
                "api": "/prod-api/mapi/automatically/a_a3827694/update",
                "body": [
                  {
                    "id": "u:a1a4bf6fcc8347969549e6e272d013aa",
                    "name": "f67c33b26",
                    "type": "input-text",
                    "label": "tt",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "validations": {
                      "maxLength": 200
                    }
                  },
                  {
                    "id": "u:28b878c9ec524bf58949769525f55f44",
                    "name": "id",
                    "type": "input-text",
                    "label": "ID",
                    "hidden": true
                  },
                  {
                    "id": "u:28b878c9ec524bf58949769525f55f44",
                    "name": "id",
                    "type": "input-text",
                    "label": "ID",
                    "hidden": true
                  },
                  {
                    "id": "u:54d056e06de24cc2b77e37c294ba5f6c",
                    "name": "parentId",
                    "type": "input-text",
                    "label": "父ID",
                    "value": "${bid}",
                    "hidden": true,
                    "themeConfig": {
                    }
                  }
                ],
                "type": "form"
              }
            ],
            "type": "dialog",
            "title": "编辑"
          },
          "actionType": "dialog"
        },
        {
          "id": "u:61b3583654a440e98367ccd992b983ba",
          "size": "xs",
          "type": "button",
          "label": "查看",
          "level": "link",
          "dialog": {
            "id": "u:d04cdaf1b480464eb5563f7cc38b73ce",
            "body": [
              {
                "id": "u:3db48fe3088a4ad5865f76c6de45bbbd",
                "api": "xxx/update",
                "body": [
                  {
                    "id": "u:c307be9583ab4c5188e12e6321f533f6",
                    "name": "createBy",
                    "type": "input-text",
                    "label": "创建者",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "readOnly": true
                  },
                  {
                    "id": "u:f8bbd9e6f11a4270a6985c76641a2e5e",
                    "name": "createTime",
                    "type": "input-text",
                    "label": "创建时间",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "readOnly": true
                  },
                  {
                    "id": "u:950f2da033214716bba50bb190df49b1",
                    "name": "updateBy",
                    "type": "input-text",
                    "label": "更新者",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "readOnly": true
                  },
                  {
                    "id": "u:740c173884b54a3ea5f129725be82fc9",
                    "name": "updateTime",
                    "type": "input-text",
                    "label": "更新时间",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "readOnly": true
                  },
                  {
                    "id": "u:616ac87b75d84451bcbaa23c7ce271ae",
                    "name": "remark",
                    "type": "input-text",
                    "label": "备注",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "readOnly": true
                  },
                  {
                    "id": "u:e397bfed0df14e8d93fa54cb53edd689",
                    "name": "f67c33b26",
                    "type": "input-text",
                    "label": "tt",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "readOnly": true
                  }
                ],
                "type": "form"
              }
            ],
            "type": "dialog",
            "title": "查看详情",
            "actions": [
            ]
          },
          "actionType": "dialog"
        },
        {
          "id": "u:42eebe644ac545b2abfd60113521e568",
          "type": "button",
          "label": "删除",
          "onEvent": {
            "click": {
              "weight": 0,
              "actions": [
                {
                  "dialog": {
                    "id": "u:b8052a48e436458b81c47d0e203da627",
                    "body": [
                      {
                        "id": "u:ed0a88fa4699459ca58a75deec1d7d23",
                        "tpl": "确定要删除?",
                        "type": "tpl",
                        "inline": false,
                        "wrapperComponent": ""
                      }
                    ],
                    "type": "dialog",
                    "onEvent": {
                      "confirm": {
                        "weight": 0,
                        "actions": [
                          {
                            "args": {
                              "api": {
                                "url": "/prod-api/mapi/automatically/a_a3827694/delete?id=$id",
                                "method": "delete"
                              },
                              "options": {
                              }
                            },
                            "outputVar": "responseResult",
                            "actionType": "ajax"
                          },
                          {
                            "args": {
                              "resetPage": true
                            },
                            "data": null,
                            "actionType": "reload",
                            "componentId": "u:d85e4de8d3ce43228cde5e8d5292740a"
                          },
                          {
                            "args": {
                            },
                            "actionType": "closeDialog"
                          }
                        ]
                      }
                    },
                    "closeOnEsc": false,
                    "showLoading": true,
                    "showErrorMsg": true,
                    "showCloseButton": true
                  },
                  "actionType": "dialog"
                }
              ]
            }
          },
          "className": "text-danger"
        }
      ],
      "syncLocation": false,
      "headerToolbar": [
        {
          "type": "columns-toggler",
          "align": "right",
          "label": "设置",
          "overlay": true,
          "draggable": true,
          "footerBtnSize": "sm"
        },
        {
          "id": "u:f27ece23d9944af8b107c235c4909a7e",
          "api": {
            "url": "/prod-api/mapi/automatically/a_a3827694/listPage",
            "data": {
              "&": "$$",
              "page": 1,
              "perPage": 20000
            },
            "method": "post",
            "dataType": "json",
            "messages": {
            }
          },
          "type": "export-excel",
          "align": "right",
          "label": "导出 Excel",
          "tooltip": "最多导出20000条记录",
          "tooltipPlacement": "top"
        },
        {
          "id": "u:9c227cdcfaa44c9dba12c18ad2fe5609",
          "type": "button",
          "label": "新增",
          "level": "primary",
          "dialog": {
            "id": "u:58d3dead5dbb4f63aa8d8172a9e9bba5",
            "body": [
              {
                "id": "u:c6f33f672c3e458b8dfd952b17173c2c",
                "api": {
                  "url": "/prod-api/mapi/automatically/a_a3827694/add",
                  "method": "post"
                },
                "body": [
                  {
                    "id": "u:a1a4bf6fcc8347969549e6e272d013aa",
                    "name": "f67c33b26",
                    "type": "input-text",
                    "label": "tt",
                    "style": {
                      "margin-bottom": "10px"
                    },
                    "validations": {
                      "maxLength": 200
                    }
                  },
                  {
                    "id": "u:28b878c9ec524bf58949769525f55f44",
                    "name": "id",
                    "type": "input-text",
                    "label": "ID",
                    "hidden": true
                  },
                  {
                    "id": "u:28b878c9ec524bf58949769525f55f44",
                    "name": "id",
                    "type": "input-text",
                    "label": "ID",
                    "hidden": true
                  },
                  {
                    "id": "u:54d056e06de24cc2b77e37c294ba5f6c",
                    "name": "parentId",
                    "type": "input-text",
                    "label": "父ID",
                    "value": "${bid}",
                    "hidden": true,
                    "themeConfig": {
                    }
                  }
                ],
                "type": "form"
              }
            ],
            "type": "dialog",
            "title": "新增"
          },
          "actionType": "dialog"
        },
        "bulkActions"
      ],
      "pageField": "page",
      "perPageField": "perPage"
    }
    ],
    "id": "u:4e536b63ffc94ad6ac54b2ff50ade12f",
    "pullRefresh": {
    "disabled": true
    },
    "regions": [
    "body"
    ],
    "style": {
    "boxShadow": " 0px 0px 0px 0px transparent"
    }
    }
  4. 操作步骤

使用的 amis -editor - demo 最近代码 "dependencies": { "@fortawesome/fontawesome-free": "^5.15.3", "amis": "3.0.0", "amis-core": "3.0.0", "amis-formula": "3.0.0", "amis-ui": "3.0.0", "amis-editor": "^5.3.0", "amis-editor-core": "^5.3.0", "axios": "0.21.2", "copy-to-clipboard": "^3.2.0", "mobx": "^4.5.0", "mobx-react": "^6.3.1", "mobx-state-tree": "^3.17.3", "qs": "6.5.3", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hook-form": "^7.39.3", "react-router": "5.0.1", "react-router-dom": "5.0.1" }

github-actions[bot] commented 1 year ago

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

Please review the labels and make any necessary changes.

2betop commented 1 year ago

无法复现,在amis 里面依然是那样发送的,如图。

image

是不是你自己覆写了 fetcher 逻辑导致了问题?

atliwen commented 1 year ago

无法复现,在amis 里面依然是那样发送的,如图。

图像

是不是你自己覆写了 fetcher 逻辑导致了问题?

还真是!!! 谢谢了!