Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

curd2 无法获取 page 页面 data #11161

Open
PhilRandWu opened this issue Nov 6, 2024 · 1 comment
Open

curd2 无法获取 page 页面 data #11161

PhilRandWu opened this issue Nov 6, 2024 · 1 comment
Labels
feat need confirm style Bug or PR related to component's style

Comments

@PhilRandWu
Copy link

描述问题:

请用一段清晰简洁的文字描述问题是什么...

截图或视频:

我想在 page 中的 data 配置一个 is_admin 用于在 curd2 中控制显示操作列的按钮,但无法控制,疑似无法获取上层数据,配置"canAccessSuperData": true 同时配置 "strictMode": false 依然无法控制

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

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

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

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

{
  "type": "page",
  "body": [
    {
      "id": "u:955893304447",
      "type": "crud2",
      "mode": "table2",
      "dsType": "api",
      "syncLocation": true,
      "primaryField": "id",
      "loadType": "pagination",
      "api": {
        "url": "initApi",
        "method": "get"
      },
      "headerToolbar": [
        {
          "type": "flex",
          "direction": "row",
          "justify": "flex-start",
          "alignItems": "stretch",
          "style": {
            "position": "static"
          },
          "items": [
            {
              "type": "container",
              "align": "left",
              "behavior": [
                "Insert",
                "BulkEdit",
                "BulkDelete"
              ],
              "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:7b0c4e5c5092"
            },
            {
              "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:7ac86ee42c36"
            }
          ],
          "id": "u:ccabead2cd0f"
        }
      ],
      "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:66f51a80fee4"
            },
            {
              "type": "container",
              "align": "right",
              "body": [
                {
                  "type": "pagination",
                  "behavior": "Pagination",
                  "layout": [
                    "total",
                    "perPage",
                    "pager"
                  ],
                  "perPage": 10,
                  "perPageAvailable": [
                    10,
                    20,
                    50,
                    100
                  ],
                  "align": "right",
                  "id": "u:6250001c305a"
                }
              ],
              "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:4f1672ca88f7"
            }
          ],
          "id": "u:54ab57c045a4"
        }
      ],
      "columns": [
        {
          "type": "tpl",
          "title": "ces",
          "name": "ces",
          "id": "u:3650999f1a4f"
        },
        {
          "type": "operation",
          "title": "操作",
          "buttons": [
            {
              "type": "button",
              "label": "查看",
              "level": "link",
              "behavior": "View",
              "onEvent": {
                "click": {
                  "actions": [
                    {
                      "actionType": "dialog",
                      "dialog": {
                        "body": {
                          "id": "u:158be6e2bd1a",
                          "type": "form",
                          "title": "查看数据",
                          "mode": "flex",
                          "labelAlign": "top",
                          "dsType": "api",
                          "feat": "View",
                          "body": [
                            {
                              "name": "ces",
                              "label": "ces",
                              "row": 0,
                              "type": "input-text"
                            }
                          ],
                          "static": true,
                          "actions": [
                            {
                              "type": "button",
                              "actionType": "cancel",
                              "label": "关闭"
                            }
                          ],
                          "onEvent": {
                            "submitSucc": {
                              "actions": [
                                {
                                  "actionType": "search",
                                  "groupType": "component",
                                  "componentId": "u:955893304447"
                                }
                              ]
                            }
                          }
                        },
                        "title": "查看数据",
                        "size": "md",
                        "actions": [
                          {
                            "type": "button",
                            "actionType": "cancel",
                            "label": "关闭"
                          }
                        ]
                      }
                    }
                  ]
                }
              },
              "id": "u:15ca95c2d20d",
              "visibleOn": "${is_admin}"
            },
            {
              "type": "button",
              "label": "编辑",
              "level": "link",
              "behavior": "Edit",
              "onEvent": {
                "click": {
                  "actions": [
                    {
                      "actionType": "dialog",
                      "dialog": {
                        "body": {
                          "id": "u:97a2322067ed",
                          "type": "form",
                          "title": "编辑数据",
                          "mode": "flex",
                          "labelAlign": "top",
                          "dsType": "api",
                          "feat": "Edit",
                          "body": [
                            {
                              "name": "ces",
                              "label": "ces",
                              "row": 0,
                              "type": "input-text"
                            }
                          ],
                          "resetAfterSubmit": true,
                          "actions": [
                            {
                              "type": "button",
                              "actionType": "cancel",
                              "label": "取消"
                            },
                            {
                              "type": "button",
                              "actionType": "submit",
                              "label": "提交",
                              "level": "primary"
                            }
                          ],
                          "onEvent": {
                            "submitSucc": {
                              "actions": [
                                {
                                  "actionType": "search",
                                  "groupType": "component",
                                  "componentId": "u:955893304447"
                                }
                              ]
                            }
                          }
                        },
                        "title": "编辑数据",
                        "size": "md",
                        "actions": [
                          {
                            "type": "button",
                            "actionType": "cancel",
                            "label": "取消"
                          },
                          {
                            "type": "button",
                            "actionType": "submit",
                            "label": "提交",
                            "level": "primary"
                          }
                        ]
                      }
                    }
                  ]
                }
              },
              "id": "u:d7fe20f32d69",
              "visibleOn": "${is_admin}"
            },
            {
              "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:955893304447"
                    }
                  ]
                }
              },
              "id": "u:d6865ec2d88f",
              "visibleOn": "${is_admin}"
            }
          ],
          "id": "u:bfb788d96cdb"
        }
      ]
    }
  ],
  "asideResizor": false,
  "pullRefresh": {
    "disabled": true
  },
  "data": {
    "is_admin": false
  }
}
  1. 操作步骤
    请简单描述一下复现的操作步骤...
Copy link

github-actions bot commented Nov 6, 2024

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

Please review the labels and make any necessary changes.

@github-actions github-actions bot added feat style Bug or PR related to component's style labels Nov 6, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feat need confirm style Bug or PR related to component's style
Projects
None yet
Development

No branches or pull requests

1 participant