Table

属性

  • name: 表格名称

  • layout.primary: 主键

  • layout.header?: Header

  • layout.filter?: Filter

  • layout.table.props?: Antd TableProps(非必填)

  • layout.table.columns: 字段描述(Array<BaseColumn>

  • layout.table.operation: 数据项操作

    • width?: 操作栏宽度

    • hide?: 是否隐藏

    • fold?: 是否折叠

    • actions: Actions

  • fields.filter: Fields

  • fields.table: Fields

Header

页面顶部的一些设置。

interface Header {
preset: {
batch?: {
columns: Array<Common.WideColumn>
deletable: boolean
}
import?: {
api: {
setting: string
mapping: string
preview: string
import: string
mapping_setting_model: string
preview_setting_model: string
}
operation: Array<any>
}
}
actions?: Array<{
title: string
icon: string
props: {
type: string
payload: any
}
}>
}

Filter

表格的过滤器设置以及表格整体的相关的一些操作(仅支持Common.historyPushCommon.openModal)。

interface Filter {
columns: Array<Common.WideColumn>
actions?: Actions
}
interface WideColumn {
name: string
width: number
}

Section

interface BaseColumn {
name: string
width?: number
}

tabs 会被渲染成支持切换 Tab 栏。

示例

{
"name": "::Pet Admin",
"action": {
"bind": { "model": "pet", "option": { "withs": { "doctor": {} } } },
"before:search": "scripts.pet.BeforeSearch",
"search": { "process": "scripts.pet.Search", "default": [null, 1, 15] },
"after:search": "scripts.pet.AfterSearch",
"find": { "guard": "-" },
"get": { "guard": "bearer-jwt,scripts.pet.Guard" },
"save": {},
"delete": {}
},
"layout": {
"primary": "id",
"header": {
"preset": {
"batch": {
"columns": [
{ "name": "名称", "width": 12 },
{ "name": "消费金额", "width": 12 },
{ "name": "入院状态", "width": 12 }
],
"deletable": true
},
"import": {
"name": "pet",
"operation": [{ "title": "跳转", "link": "https://baidu.com" }]
}
}
},
"filter": {
"columns": [
{ "name": "名称", "width": 4 },
{ "name": "状态", "width": 4 }
],
"actions": [
{
"title": "添加宠物",
"icon": "icon-plus",
"width": 3,
"action": {
"Common.openModal": {
"width": 640,
"Form": { "type": "edit", "model": "pet" }
}
}
}
]
},
"table": {
"columns": [{ "name": "名称" }, { "name": "消费金额" }, { "name": "入院状态" }],
"operation": {
"fold": false,
"width": 255,
"actions": [
{
"title": "查看",
"icon": "icon-eye",
"action": {
"Common.openModal": {
"width": 640,
"Form": { "type": "view", "model": "pet" }
}
}
},
{
"title": "编辑",
"icon": "icon-edit-2",
"action": {
"Common.openModal": {
"Form": { "type": "edit", "model": "pet" }
}
}
},
{
"title": "治愈",
"icon": "icon-check",
"action": {
"Table.save": { "id": ":id", "status": "cured" }
},
"style": "success",
"confirm": { "title": "提示", "desc": "确认变更为治愈状态?" }
},
{
"title": "查看详情",
"icon": "icon-book-open",
"action": {
"Common.historyPush": {
"pathname": "/x/Form/pet/:id/edit"
}
}
},
{
"title": "返回上一页",
"icon": "icon-arrow-left",
"action": { "Common.historyBack": {} }
},
{
"title": "删除",
"icon": "icon-trash-2",
"action": { "Table.delete": {} },
"style": "danger",
"confirm": {
"title": "提示",
"desc": "确认删除,删除后数据无法恢复?"
}
}
]
}
}
},
"fields": {
"filter": {
"名称": {
"bind": "where.name.like",
"edit": {
"type": "Input",
"props": { "placeholder": "请输入宠物名称" }
}
},
"状态": {
"bind": "where.status.in",
"edit": {
"type": "Select",
"props": {
"xProps": {
"$remote": {
"process": "models.pet.Get",
"query": { "select": ["id", "name"] }
}
}
}
}
}
},
"table": {
"名称": {
"bind": "name",
"view": { "bind": "cost", "type": "Text", "props": {} },
"edit": {
"type": "Input",
"bind": "cost",
"props": { "placeholder": "请输入宠物名称 {{id}}" }
}
},
"入院状态": {
"bind": "status",
"view": {
"type": "Tag",
"props": {
"xProps": {
"$remote": {
"process": "models.pet.Get",
"query": { "select": ["id", "name"] }
}
},
"pure": true
}
},
"edit": {
"type": "Select",
"props": {
"xProps": {
"$remote": {
"process": "models.pet.Get",
"query": { "select": ["id", "name"] }
}
}
}
}
},
"状态": {
"bind": "mode",
"view": {
"type": "Switch",
"props": {
"checkedValue": "enabled",
"unCheckedValue": "disabled",
"checkedChildren": "开启",
"unCheckedChildren": "关闭"
}
}
},
"消费金额": {
"bind": "cost",
"view": { "type": "Text", "props": {} },
"edit": { "type": "Input", "props": {} }
}
}
}
}

Table

属性

  • name: 表格名称

  • layout.primary: 主键

  • layout.header?: Header

  • layout.filter?: Filter

  • layout.table.props?: Antd TableProps(非必填)

  • layout.table.columns: 字段描述(Array<BaseColumn>

  • layout.table.operation: 数据项操作

    • width?: 操作栏宽度

    • hide?: 是否隐藏

    • fold?: 是否折叠

    • actions: Actions

  • fields.filter: Fields

  • fields.table: Fields

Header

页面顶部的一些设置。

interface Header {
preset: {
batch?: {
columns: Array<Common.WideColumn>
deletable: boolean
}
import?: {
api: {
setting: string
mapping: string
preview: string
import: string
mapping_setting_model: string
preview_setting_model: string
}
operation: Array<any>
}
}
actions?: Array<{
title: string
icon: string
props: {
type: string
payload: any
}
}>
}

Filter

表格的过滤器设置以及表格整体的相关的一些操作(仅支持Common.historyPushCommon.openModal)。

interface Filter {
columns: Array<Common.WideColumn>
actions?: Actions
}
interface WideColumn {
name: string
width: number
}

Section

interface BaseColumn {
name: string
width?: number
}

tabs 会被渲染成支持切换 Tab 栏。

示例

{
"name": "::Pet Admin",
"action": {
"bind": { "model": "pet", "option": { "withs": { "doctor": {} } } },
"before:search": "scripts.pet.BeforeSearch",
"search": { "process": "scripts.pet.Search", "default": [null, 1, 15] },
"after:search": "scripts.pet.AfterSearch",
"find": { "guard": "-" },
"get": { "guard": "bearer-jwt,scripts.pet.Guard" },
"save": {},
"delete": {}
},
"layout": {
"primary": "id",
"header": {
"preset": {
"batch": {
"columns": [
{ "name": "名称", "width": 12 },
{ "name": "消费金额", "width": 12 },
{ "name": "入院状态", "width": 12 }
],
"deletable": true
},
"import": {
"name": "pet",
"operation": [{ "title": "跳转", "link": "https://baidu.com" }]
}
}
},
"filter": {
"columns": [
{ "name": "名称", "width": 4 },
{ "name": "状态", "width": 4 }
],
"actions": [
{
"title": "添加宠物",
"icon": "icon-plus",
"width": 3,
"action": {
"Common.openModal": {
"width": 640,
"Form": { "type": "edit", "model": "pet" }
}
}
}
]
},
"table": {
"columns": [{ "name": "名称" }, { "name": "消费金额" }, { "name": "入院状态" }],
"operation": {
"fold": false,
"width": 255,
"actions": [
{
"title": "查看",
"icon": "icon-eye",
"action": {
"Common.openModal": {
"width": 640,
"Form": { "type": "view", "model": "pet" }
}
}
},
{
"title": "编辑",
"icon": "icon-edit-2",
"action": {
"Common.openModal": {
"Form": { "type": "edit", "model": "pet" }
}
}
},
{
"title": "治愈",
"icon": "icon-check",
"action": {
"Table.save": { "id": ":id", "status": "cured" }
},
"style": "success",
"confirm": { "title": "提示", "desc": "确认变更为治愈状态?" }
},
{
"title": "查看详情",
"icon": "icon-book-open",
"action": {
"Common.historyPush": {
"pathname": "/x/Form/pet/:id/edit"
}
}
},
{
"title": "返回上一页",
"icon": "icon-arrow-left",
"action": { "Common.historyBack": {} }
},
{
"title": "删除",
"icon": "icon-trash-2",
"action": { "Table.delete": {} },
"style": "danger",
"confirm": {
"title": "提示",
"desc": "确认删除,删除后数据无法恢复?"
}
}
]
}
}
},
"fields": {
"filter": {
"名称": {
"bind": "where.name.like",
"edit": {
"type": "Input",
"props": { "placeholder": "请输入宠物名称" }
}
},
"状态": {
"bind": "where.status.in",
"edit": {
"type": "Select",
"props": {
"xProps": {
"$remote": {
"process": "models.pet.Get",
"query": { "select": ["id", "name"] }
}
}
}
}
}
},
"table": {
"名称": {
"bind": "name",
"view": { "bind": "cost", "type": "Text", "props": {} },
"edit": {
"type": "Input",
"bind": "cost",
"props": { "placeholder": "请输入宠物名称 {{id}}" }
}
},
"入院状态": {
"bind": "status",
"view": {
"type": "Tag",
"props": {
"xProps": {
"$remote": {
"process": "models.pet.Get",
"query": { "select": ["id", "name"] }
}
},
"pure": true
}
},
"edit": {
"type": "Select",
"props": {
"xProps": {
"$remote": {
"process": "models.pet.Get",
"query": { "select": ["id", "name"] }
}
}
}
}
},
"状态": {
"bind": "mode",
"view": {
"type": "Switch",
"props": {
"checkedValue": "enabled",
"unCheckedValue": "disabled",
"checkedChildren": "开启",
"unCheckedChildren": "关闭"
}
}
},
"消费金额": {
"bind": "cost",
"view": { "type": "Text", "props": {} },
"edit": { "type": "Input", "props": {} }
}
}
}
}