amis icon indicating copy to clipboard operation
amis copied to clipboard

pickerSchema中mode为table,headerToolbar设置重置按钮点击无效果

Open zsfish opened this issue 5 years ago • 2 comments

描述问题:

pickerShema,mode为table,在headerToolbar中设置重置按钮,点击重置按钮不起作用

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

amis版本: ^1.0.20-beta.15

  1. 粘贴有问题的完整 amis schema 代码:
{
  "type": "page",
  "body": {
    "type": "form",
    "api": "https://houtai.baidu.com/api/mock2/form/saveForm",
    "controls": [
      {
        "type": "picker",
        "name": "type4",
        "joinValues": true,
        "valueField": "id",
        "labelField": "engine",
        "label": "Picker",
        "embed": true,
        "source": "https://houtai.baidu.com/api/sample",
        "size": "lg",
        "value": "4,5",
        "multiple": false,
        "pickerSchema": {
          "mode": "table",
          "name": "thelist",
          "quickSaveApi": "https://houtai.baidu.com/api/sample/bulkUpdate",
          "quickSaveItemApi": "https://houtai.baidu.com/api/sample/$id",
          "draggable": true,
          "headerToolbar": {
            "wrapWithPanel": false,
            "type": "form",
            "className": "text-right",
            "target": "thelist",
            "mode": "inline",
            "controls": [
              {
                "type": "text",
                "name": "keywords"
              },
              {
                "type": "submit",
                "label": "搜索",
                "level": "primary",
                "icon": "fa fa-search pull-left"
              },
              {
                "type": "reset",
                "label": "重置"
              }
            ]
          },
          "columns": [
            {
              "name": "engine",
              "label": "Rendering engine",
              "sortable": true,
              "searchable": true,
              "type": "text",
              "toggled": true
            },
            {
              "name": "browser",
              "label": "Browser",
              "sortable": true,
              "type": "text",
              "toggled": true
            },
            {
              "name": "platform",
              "label": "Platform(s)",
              "sortable": true,
              "type": "text",
              "toggled": true
            },
            {
              "name": "version",
              "label": "Engine version",
              "quickEdit": true,
              "type": "text",
              "toggled": true
            },
            {
              "name": "grade",
              "label": "CSS grade",
              "quickEdit": {
                "mode": "inline",
                "type": "select",
                "options": [
                  "A",
                  "B",
                  "C",
                  "D",
                  "X"
                ],
                "saveImmediately": true
              },
              "type": "text",
              "toggled": true
            },
            {
              "type": "operation",
              "label": "操作",
              "width": 100,
              "buttons": [
                {
                  "type": "button",
                  "icon": "fa fa-eye",
                  "actionType": "dialog",
                  "dialog": {
                    "title": "查看",
                    "body": {
                      "type": "form",
                      "controls": [
                        {
                          "type": "static",
                          "name": "engine",
                          "label": "Engine"
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "static",
                          "name": "browser",
                          "label": "Browser"
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "static",
                          "name": "platform",
                          "label": "Platform(s)"
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "static",
                          "name": "version",
                          "label": "Engine version"
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "static",
                          "name": "grade",
                          "label": "CSS grade"
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "html",
                          "html": "<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>"
                        }
                      ]
                    }
                  }
                },
                {
                  "type": "button",
                  "icon": "fa fa-pencil",
                  "actionType": "dialog",
                  "dialog": {
                    "position": "left",
                    "size": "lg",
                    "title": "编辑",
                    "body": {
                      "type": "form",
                      "name": "sample-edit-form",
                      "api": "https://houtai.baidu.com/api/sample/$id",
                      "controls": [
                        {
                          "type": "text",
                          "name": "engine",
                          "label": "Engine",
                          "required": true
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "text",
                          "name": "browser",
                          "label": "Browser",
                          "required": true
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "text",
                          "name": "platform",
                          "label": "Platform(s)",
                          "required": true
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "text",
                          "name": "version",
                          "label": "Engine version"
                        },
                        {
                          "type": "divider"
                        },
                        {
                          "type": "select",
                          "name": "grade",
                          "label": "CSS grade",
                          "options": [
                            "A",
                            "B",
                            "C",
                            "D",
                            "X"
                          ]
                        }
                      ]
                    }
                  }
                },
                {
                  "type": "button",
                  "icon": "fa fa-times text-danger",
                  "actionType": "ajax",
                  "confirmText": "您确认要删除?",
                  "api": "delete:https://houtai.baidu.com/api/sample/$id"
                }
              ],
              "toggled": true
            }
          ]
        }
      }
    ]
  }
}
  1. 操作步骤 上述代码是拿官方示例-picker内嵌模式改造的,可直接查看效果

zsfish avatar Dec 29 '20 03:12 zsfish

明天的版本可以用这个实现

{
  type: 'page',
  body: {
    type: 'form',
    api: 'https://houtai.baidu.com/api/mock2/form/saveForm',
    controls: [
      {
        type: 'picker',
        name: 'type4',
        joinValues: true,
        valueField: 'id',
        labelField: 'engine',
        label: 'Picker',
        embed: true,
        source: 'https://houtai.baidu.com/api/sample',
        size: 'lg',
        value: '4,5',
        multiple: false,
        pickerSchema: {
          mode: 'table',
          name: 'thelist',
          quickSaveApi: 'https://houtai.baidu.com/api/sample/bulkUpdate',
          quickSaveItemApi: 'https://houtai.baidu.com/api/sample/$id',
          draggable: true,
          headerToolbar: {
            wrapWithPanel: false,
            type: 'form',
            className: 'text-right',
            target: 'thelist',
            mode: 'inline',
            controls: [
              {
                type: 'text',
                name: 'keywords',
                value: ''
              },
              {
                type: 'submit',
                label: '搜索',
                level: 'primary',
                icon: 'fa fa-search pull-left'
              },
              {
                type: 'reset',
                actionType: 'reset-and-submit',
                label: '重置'
              }
            ]
          },
          columns: [
            {
              name: 'engine',
              label: 'Rendering engine',
              sortable: true,
              searchable: true,
              type: 'text',
              toggled: true
            },
            {
              name: 'browser',
              label: 'Browser',
              sortable: true,
              type: 'text',
              toggled: true
            },
            {
              name: 'platform',
              label: 'Platform(s)',
              sortable: true,
              type: 'text',
              toggled: true
            },
            {
              name: 'version',
              label: 'Engine version',
              quickEdit: true,
              type: 'text',
              toggled: true
            },
            {
              name: 'grade',
              label: 'CSS grade',
              quickEdit: {
                mode: 'inline',
                type: 'select',
                options: ['A', 'B', 'C', 'D', 'X'],
                saveImmediately: true
              },
              type: 'text',
              toggled: true
            },
            {
              type: 'operation',
              label: '操作',
              width: 100,
              buttons: [
                {
                  type: 'button',
                  icon: 'fa fa-eye',
                  actionType: 'dialog',
                  dialog: {
                    title: '查看',
                    body: {
                      type: 'form',
                      controls: [
                        {
                          type: 'static',
                          name: 'engine',
                          label: 'Engine'
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'static',
                          name: 'browser',
                          label: 'Browser'
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'static',
                          name: 'platform',
                          label: 'Platform(s)'
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'static',
                          name: 'version',
                          label: 'Engine version'
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'static',
                          name: 'grade',
                          label: 'CSS grade'
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'html',
                          html:
                            '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
                        }
                      ]
                    }
                  }
                },
                {
                  type: 'button',
                  icon: 'fa fa-pencil',
                  actionType: 'dialog',
                  dialog: {
                    position: 'left',
                    size: 'lg',
                    title: '编辑',
                    body: {
                      type: 'form',
                      name: 'sample-edit-form',
                      api: 'https://houtai.baidu.com/api/sample/$id',
                      controls: [
                        {
                          type: 'text',
                          name: 'engine',
                          label: 'Engine',
                          required: true
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'text',
                          name: 'browser',
                          label: 'Browser',
                          required: true
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'text',
                          name: 'platform',
                          label: 'Platform(s)',
                          required: true
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'text',
                          name: 'version',
                          label: 'Engine version'
                        },
                        {
                          type: 'divider'
                        },
                        {
                          type: 'select',
                          name: 'grade',
                          label: 'CSS grade',
                          options: ['A', 'B', 'C', 'D', 'X']
                        }
                      ]
                    }
                  }
                },
                {
                  type: 'button',
                  icon: 'fa fa-times text-danger',
                  actionType: 'ajax',
                  confirmText: '您确认要删除?',
                  api: 'delete:https://houtai.baidu.com/api/sample/$id'
                }
              ],
              toggled: true
            }
          ]
        }
      }
    ]
  }
}

2betop avatar Dec 30 '20 14:12 2betop

最新版已发布:https://github.com/baidu/amis/releases/tag/1.1.0

RickCole21 avatar Dec 31 '20 08:12 RickCole21