当前位置: 首页 > 工具软件 > amis > 使用案例 >

amis框架对应格式

冉永宁
2023-12-01
{
  "type": "page",
  "id": "${appModelPageId}",
  "body": [
    {
      "type": "crud",
      "syncLocation": false,
      "api": {
        "method": "get",
        "url": "${initApi}"
      },
      "autoGenerateFilter": true,
      "perPage": ${perPage},
      "inputName": "rows",
      "outputName": "rows",
      "source": "${rows}",
      "position":"bottom",
      "footerToolbar": [
        "statistics",
        "switch-per-page",
        "pagination"
      ],
      "columns": ${columnList},
      "features": [
        "create",
        "filter",
        "update",
        "view",
        "delete"
      ],
      "filterColumnCount": ${filterColumnCounts},
      "headerToolbar": [
        ${headerToolbars},
        "bulkActions"
      ],
      "id": "${appFormId}"
    }
  ],
  "regions": [
    "body"
  ],
  "asideResizor": false
}

 

 "autoGenerateFilter": true   开启查询区域,会根据列元素的 searchable 属性值,自动生成查询条件表单,只有 searchable 属性值为合法的组件 Schema 时才会生成查询条件。注意这个属性和 filter 冲突,开启 filter 后 autoGenerateFilter 将会失效

"filterColumnCount": 5 设置查询后默认返回前多少条

"position":"bottom":分页的位置(bottom:底部 top:顶部)

"columnlist":  列表内的属性(字段)和按钮

... : http://127.0.0.1:8099

"columns": [
        {
          "clearable": false,
          "showCounter": false,
          "multiple": false,
          "name": "introduce",
          "disabled": false,
          "id": "u:20230411022352861",
          "label": "超长文本",
          "type": "text",
          "required": false,
          "searchable": {
            "clearable": true,
            "showCounter": true,
            "name": "introduce",
            "style": {
            },
            "label": "超长文本",
            "placeholder": "请输入超长文本",
            "type": "textarea",
            "maxLength": 9999,
            "required": false,
            "id": "u:de6dedabd3a5"
          }
        },
        {
          "name": "操作",
          "id": "u:20230411022352275",
          "label": "操作",
          "type": "operation",
          "required": false,
          "clearable": false,
          "showCounter": false,
          "multiple": false,
          "disabled": false,
          "buttons": [
            {
              "actionType": "dialog",
              "dialog": {
                "title": "编辑",
                "body": {
                  "type": "form",
                  "api": {
                    "method": "put",
                    "url": ".../common/20230410040656181665/studentTest/275/edit/${id}"
                  },
                  "body": [
                    {
                      "clearable": true,
                      "showCounter": true,
                      "multiple": false,
                      "name": "introduce",
                      "disabled": false,
                      "style": {
                      },
                      "id": "u:20230411022352861",
                      "label": "超长文本",
                      "type": "textarea",
                      "value": "${introduce}",
                      "maxLength": 9999,
                      "required": false
                    }
                  ]
                }
              },
              "level": "link",
              "id": "u:20230411022352609",
              "label": "编辑",
              "type": "button"
            },
            {
              "actionType": "ajax",
              "id": "u:20230411022352610",
              "label": "删除",
              "type": "button",
              "level": "danger",
              "className": "text-danger",
              "confirmText": "确定删除当前记录吗?",
              "api": {
                "method": "delete",
                "url": ".../common/20230410040656181665/studentTest/275/delete/${id}"
              }
            },
            {
              "level": "link",
              "id": "u:20230411022352611",
              "label": "查看详情",
              "type": "button"
              "actionType": "dialog",
              "dialog": {
                "title": "查看详情",
                "body": {
                  "type": "form",
                  "api": {
                    "method": "get",
                    "url": ".../common/20230410040656181665/studentTest/275/detail/${id}"
                  },
                  "body": [
                  ]
                }
              }
            }
          ]
        }
      ],

 表之外的按钮(不包括自动生成的搜索框)----新增按钮:

"headerToolbar": [
    {
      "level": "primary",
      "id": "u:20230411022352608",
      "label": "新增",
      "type": "button",
      "actionType": "dialog",
      "dialog": {
        "title": "新增"
        "body": {
          "type": "form",
          "api": {
            "method": "post",
            "url": ".../common/20230410040656181665/studentTest/275/add"
          },
          "body": [
            {
              "clearable": true,
              "showCounter": true,
              "multiple": false,
              "name": "introduce",
              "disabled": false,
              "style": {
              },
              "id": "u:20230411022352861",
              "label": "超长文本",
              "type": "textarea",
              "value": "${introduce}",
              "maxLength": 9999,
              "required": false
            }
          ]      
        }
      }
    },
    "bulkActions"
  ]

 类似资料: