baidu / amis

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

【边栏数据联动】边栏setValue无效 #7655

Closed gyp8735abc closed 1 year ago

gyp8735abc commented 1 year ago

描述问题:

1、边栏使用input-tree点击事件对page设置变量,curd获取page变量联动无效。 2、amis-editor边栏内容置顶显示,但使用sdk呈现后,内容不置顶。

截图或视频:

image

image

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

  1. 使用amis-sdk-3.2

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

    {
    "type": "page",
    "id": "u:1f648f01e8c3",
    "asideResizor": true,
    "pullRefresh": {
    "disabled": true
    },
    "title": "模块管理",
    "body": [
    {
      "type": "crud",
      "syncLocation": false,
      "api": {
        "method": "post",
        "url": "/lowcode-api/module-system/query",
        "requestAdaptor": "",
        "adaptor": "",
        "messages": {
        },
        "dataType": "json",
        "data": {
          "systemNo": "${systemNo}"
        }
      },
      "columns": [
        {
          "name": "id",
          "label": "ID",
          "type": "text",
          "id": "u:07f2ce2a857f"
        },
        {
          "name": "systemNo",
          "label": "编号",
          "type": "text",
          "id": "u:174c2528cdec"
        },
        {
          "type": "text",
          "label": "名称",
          "name": "systemName",
          "id": "u:fce9822f88e7"
        },
        {
          "type": "text",
          "label": "描述",
          "name": "systemDesc",
          "id": "u:47ec80f181fc"
        },
        {
          "type": "operation",
          "label": "操作",
          "buttons": [
            {
              "label": "编辑",
              "type": "button",
              "actionType": "dialog",
              "level": "primary",
              "dialog": {
                "type": "dialog",
                "title": "编辑",
                "body": [
                  {
                    "type": "form",
                    "api": {
                      "method": "post",
                      "url": "/lowcode-api/module-system/save",
                      "requestAdaptor": "",
                      "adaptor": "",
                      "messages": {
                      },
                      "dataType": "json"
                    },
                    "body": [
                      {
                        "name": "id",
                        "label": "ID",
                        "type": "input-text",
                        "id": "u:4a1be890dca2",
                        "hidden": true
                      },
                      {
                        "name": "systemNo",
                        "label": "编号",
                        "type": "input-text",
                        "id": "u:d594fe6dd0d4",
                        "static": true
                      },
                      {
                        "label": "名称",
                        "name": "systemName",
                        "type": "input-text",
                        "id": "u:5bbe80c81ae5"
                      },
                      {
                        "label": "描述",
                        "name": "systemDesc",
                        "type": "input-text",
                        "id": "u:a0b70f40bcb4"
                      }
                    ],
                    "id": "u:019bfe8878f9"
                  }
                ],
                "id": "u:eb6925c74b00"
              },
              "id": "u:d9579736b320"
            },
            {
              "type": "button",
              "label": "删除",
              "actionType": "ajax",
              "level": "warning",
              "className": "text-danger",
              "confirmText": "确定要删除?",
              "api": {
                "method": "post",
                "url": "/lowcode-api/module-system/del",
                "requestAdaptor": "",
                "adaptor": "",
                "messages": {
                },
                "dataType": "form",
                "data": {
                  "systemId": "${id}"
                }
              },
              "id": "u:a5ab255294f7"
            }
          ],
          "id": "u:af9c10a9694c"
        }
      ],
      "bulkActions": [
      ],
      "itemActions": [
      ],
      "features": [
        "create",
        "filter",
        "update",
        "delete"
      ],
      "filterColumnCount": 3,
      "headerToolbar": [
        {
          "type": "filter-toggler"
        },
        {
          "type": "button",
          "label": "新增",
          "actionType": "dialog",
          "level": "primary",
          "dialog": {
            "type": "dialog",
            "title": "新增",
            "body": [
              {
                "type": "form",
                "api": {
                  "method": "post",
                  "url": "/lowcode-api/module-system/save",
                  "requestAdaptor": "",
                  "adaptor": "",
                  "messages": {
                  },
                  "dataType": "json"
                },
                "body": [
                  {
                    "type": "input-text",
                    "name": "id",
                    "label": "ID",
                    "id": "u:6936b1d97b77",
                    "hidden": true
                  },
                  {
                    "type": "input-text",
                    "name": "systemNo",
                    "label": "编号",
                    "id": "u:f4333afb8e55"
                  },
                  {
                    "type": "input-text",
                    "name": "systemName",
                    "label": "名称",
                    "id": "u:d88dc74dfb71"
                  },
                  {
                    "type": "textarea",
                    "label": "多行文本",
                    "name": "systemDesc",
                    "id": "u:c0fbbe28fa49"
                  }
                ],
                "id": "u:7991c43a15ec"
              }
            ],
            "id": "u:ac8502ad098a"
          },
          "id": "u:09ec8f429369"
        }
      ],
      "id": "u:b23afae96d02",
      "perPageAvailable": [
        10
      ],
      "messages": {
      },
      "perPageField": "limit",
      "alwaysShowPagination": false,
      "filter": {
        "title": "条件搜索",
        "body": [
          {
            "type": "input-text",
            "name": "systemName",
            "placeholder": "通过关键字搜索",
            "id": "u:40da5e763310",
            "label": "名称",
            "clearable": true
          },
          {
            "type": "input-text",
            "label": "系统",
            "name": "systemNo",
            "id": "u:a75d2a9db11e",
            "hidden": false,
            "value": "${systemNo}"
          }
        ],
        "id": "u:906b992ac15c",
        "wrapWithPanel": true
      },
      "filterTogglable": true,
      "defaultParams": {
      }
    }
    ],
    "aside": [
    {
      "type": "input-tree",
      "id": "u:a02fd5e2e1b8",
      "label": "",
      "name": "tree",
      "multiple": false,
      "enableNodePath": false,
      "hideRoot": true,
      "showIcon": true,
      "initiallyOpen": true,
      "source": {
        "url": "/lowcode-api/module-info/queryAllSystem",
        "method": "post",
        "requestAdaptor": "",
        "adaptor": "",
        "messages": {
        },
        "dataType": "json"
      },
      "labelField": "systemName",
      "valueField": "systemNo",
      "showRadio": false,
      "showOutline": false,
      "treeContainerClassName": "m-none p-none",
      "onEvent": {
        "change": {
          "weight": 0,
          "actions": [
            {
              "componentId": "u:1f648f01e8c3",
              "actionType": "setValue",
              "args": {
                "value": {
                  "systemNo": "${event.data.value}"
                }
              }
            },
            {
              "componentId": "u:b23afae96d02",
              "actionType": "reload",
              "args": {
                "resetPage": true
              },
              "dataMergeMode": "merge"
            }
          ]
        }
      }
    }
    ],
    "style": {
    },
    "data": {
    "systemNo": "11"
    }
    }
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

默认只会监控 query 部分,具体看这块的文档 https://aisuda.bce.baidu.com/amis/zh-CN/docs/types/api#%E8%B7%9F%E8%B8%AA%E6%95%B0%E6%8D%AE%E8%87%AA%E5%8A%A8%E5%88%B7%E6%96%B0