跳到主要内容

4-UI 布局

概览

目录:doc/product/financial/uilayout

该模块通过 UiSchema DSL 描述了发票及相关实体在管理后台中的:

  • 列表列配置(columns、filters、默认排序)
  • 创建/编辑表单分组与字段
  • 详情页布局与关联列表

初始化脚本 init/init.py 中的 init_uischemas 会将这些 UiSchema 文件包装为 ui-schema-overlays,并通过 /metadata/ui-schema-overlays/upsert 落地到元数据服务。

发票管理页面:fin_invoices_uischema.json

文件:uilayout/fin_invoices_uischema.json

该配置定义了发票主实体 fin_invoices 的列表、表单与详情展示,是整个发票风控方案的主要操作入口。

完整 JSON:

{
"version": "1.0",
"resource": "fin_invoices",
"menuLabel": "发票管理",
"group": "发票",
"defaults": {
"perPage": 25,
"rowClick": "show"
},
"list": {
"columns": [
{ "source": "id", "label": "ID", "sortable": true },
{ "source": "invoice_code", "label": "发票代码", "sortable": true },
{ "source": "invoice_no", "label": "发票号码", "sortable": true },
{ "source": "invoice_date", "label": "开票日期", "sortable": true },
{ "source": "buyer_name", "label": "购方名称", "sortable": true },
{ "source": "seller_name", "label": "销方名称", "sortable": true },
{ "source": "amount_excl_tax", "label": "不含税金额", "sortable": true },
{ "source": "tax_amount", "label": "税额", "sortable": true },
{ "source": "tax_rate", "label": "税率", "sortable": true },
{ "source": "currency", "label": "币种", "sortable": true },
{ "source": "risk_level", "label": "风险等级", "sortable": true },
{ "source": "file", "label": "文件", "component": "FileField",
"props": {
"src": "src",
"title": "title"
}
}
],
"filters": [
{ "source": "invoice_no_ilike", "label": "发票号搜索", "component": "search", "alwaysOn": true },
{ "source": "buyer_name_ilike", "label": "购方名称搜索", "component": "search" },
{ "source": "invoice_date_gte", "label": "开票日期起", "component": "DateTimeInput" },
{ "source": "invoice_date_lte", "label": "开票日期止", "component": "DateTimeInput" },
{ "source": "risk_level", "label": "风险等级", "component": "TextInput" }
],
"defaultSort": {
"field": "invoice_date",
"order": "DESC"
}
},
"form": {
"create": {
"layout": [
{
"title": "基本信息",
"fields": [
{ "source": "invoice_code", "label": "发票代码", "component": "TextInput" },
{ "source": "invoice_no", "label": "发票号码", "component": "TextInput" },
{ "source": "invoice_date", "label": "开票日期", "component": "DateTimeInput" },
{ "source": "invoice_type", "label": "发票类型", "component": "TextInput" },
{ "source": "currency", "label": "币种", "component": "TextInput" }
]
},
{
"title": "购方与销方",
"fields": [
{ "source": "buyer_name", "label": "购方名称", "component": "TextInput" },
{ "source": "buyer_tax_id", "label": "购方税号", "component": "TextInput" },
{ "source": "seller_name", "label": "销方名称", "component": "TextInput" },
{ "source": "seller_tax_id", "label": "销方税号", "component": "TextInput" }
]
},
{
"title": "金额与风险",
"fields": [
{ "source": "amount_excl_tax", "label": "不含税金额", "component": "NumberInput" },
{ "source": "tax_amount", "label": "税额", "component": "NumberInput" },
{ "source": "tax_rate", "label": "税率", "component": "NumberInput" },
{ "source": "risk_level", "label": "风险等级", "component": "TextInput" },
{ "source": "risk_codes", "label": "命中规则编码列表", "component": "TextInput" }
]
}
]
},
"edit": {
"layout": [
{
"title": "基本信息",
"fields": [
{ "source": "invoice_code", "label": "发票代码", "component": "TextInput" },
{ "source": "invoice_no", "label": "发票号码", "component": "TextInput" },
{ "source": "invoice_date", "label": "开票日期", "component": "DateTimeInput" },
{ "source": "invoice_type", "label": "发票类型", "component": "TextInput" },
{ "source": "currency", "label": "币种", "component": "TextInput" }
]
},
{
"title": "购方与销方",
"fields": [
{ "source": "buyer_name", "label": "购方名称", "component": "TextInput" },
{ "source": "buyer_tax_id", "label": "购方税号", "component": "TextInput" },
{ "source": "seller_name", "label": "销方名称", "component": "TextInput" },
{ "source": "seller_tax_id", "label": "销方税号", "component": "TextInput" }
]
},
{
"title": "金额与风险",
"fields": [
{ "source": "amount_excl_tax", "label": "不含税金额", "component": "NumberInput" },
{ "source": "tax_amount", "label": "税额", "component": "NumberInput" },
{ "source": "tax_rate", "label": "税率", "component": "NumberInput" },
{ "source": "risk_level", "label": "风险等级", "component": "TextInput" },
{ "source": "risk_codes", "label": "命中规则编码列表", "component": "TextInput" }
]
}
]
}
},
"show": {
"layout": [
{
"title": "详情",
"fields": [
{ "source": "id", "label": "ID" },
{ "source": "invoice_code", "label": "发票代码" },
{ "source": "invoice_no", "label": "发票号码" },
{ "source": "invoice_date", "label": "开票日期" },
{ "source": "invoice_type", "label": "发票类型" },
{ "source": "buyer_name", "label": "购方名称" },
{ "source": "buyer_tax_id", "label": "购方税号" },
{ "source": "seller_name", "label": "销方名称" },
{ "source": "seller_tax_id", "label": "销方税号" },
{ "source": "currency", "label": "币种" },
{ "source": "amount_excl_tax", "label": "不含税金额" },
{ "source": "tax_amount", "label": "税额" },
{ "source": "tax_rate", "label": "税率" },
{ "source": "goods_name", "label": "商品名称汇总" },
{ "source": "dedup_key", "label": "去重键" },
{ "source": "risk_level", "label": "风险等级" },
{ "source": "risk_codes", "label": "命中规则编码列表" },
{ "source": "attributes", "label": "扩展字段(JSON)" },
{ "source": "file", "label": "文件", "component": "FileField",
"props": {
"src": "src",
"title": "title"
}
}
]
}
],
"related": [
{
"title": "发票明细",
"resource": "fin_invoice_details",
"target": "invoice_id",
"perPage": 10,
"columns": [
{ "source": "id", "label": "ID" },
{ "source": "line_no", "label": "行号" },
{ "source": "goods_name", "label": "商品名称" },
{ "source": "spec", "label": "规格型号" },
{ "source": "unit", "label": "单位" },
{ "source": "quantity", "label": "数量" },
{ "source": "unit_price", "label": "单价" },
{ "source": "amount_excl_tax", "label": "不含税金额" },
{ "source": "tax_rate", "label": "税率" },
{ "source": "tax_amount", "label": "税额" }
]
}
]
}
}

其他 UiSchema 文件(如 fin_invoice_files_uischema.jsonfin_invoice_details_uischema.jsonfin_expenses_uischema.json 等)遵循相同的结构,可根据需要在目录中查看与修改。