Files
erp/crates/erp-plugin-crm/plugin.toml
iven 08252c10f1
Some checks are pending
CI / rust-check (push) Waiting to run
CI / rust-test (push) Waiting to run
CI / frontend-build (push) Waiting to run
CI / security-audit (push) Waiting to run
feat(crm,inventory): P1 验证 — 插件 manifest 跨插件引用声明
- CRM: customer 实体新增 is_public = true,允许其他插件引用
- 进销存: sales_order.customer_id 新增 ref_plugin/ref_entity/ref_label_field/ref_fallback_label
- 进销存: metadata 版本升至 0.2.0,dependencies 添加 erp-crm
2026-04-19 00:56:32 +08:00

531 lines
12 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[metadata]
id = "erp-crm"
name = "CRM"
version = "0.1.0"
description = "客户关系管理插件 — ERP 平台第一个行业插件"
author = "ERP Team"
min_platform_version = "0.1.0"
# ── 权限声明 ──
[[permissions]]
code = "customer.list"
name = "查看客户"
description = "查看客户列表和详情"
data_scope_levels = ["self", "department", "department_tree", "all"]
[[permissions]]
code = "customer.manage"
name = "管理客户"
description = "创建、编辑、删除客户"
data_scope_levels = ["self", "department", "department_tree", "all"]
[[permissions]]
code = "contact.list"
name = "查看联系人"
[[permissions]]
code = "contact.manage"
name = "管理联系人"
[[permissions]]
code = "communication.list"
name = "查看沟通记录"
[[permissions]]
code = "communication.manage"
name = "管理沟通记录"
[[permissions]]
code = "customer_tag.list"
name = "查看客户标签"
description = "查看客户标签列表"
[[permissions]]
code = "customer_tag.manage"
name = "管理客户标签"
description = "创建、编辑、删除客户标签"
[[permissions]]
code = "customer_relationship.list"
name = "查看客户关系"
description = "查看客户关系列表"
[[permissions]]
code = "customer_relationship.manage"
name = "管理客户关系"
description = "创建、编辑、删除客户关系"
# ── 实体定义 ──
[[schema.entities]]
name = "customer"
display_name = "客户"
data_scope = true
is_public = true
[[schema.entities.fields]]
name = "code"
field_type = "string"
required = true
display_name = "客户编码"
unique = true
searchable = true
[[schema.entities.fields]]
name = "name"
field_type = "string"
required = true
display_name = "客户名称"
searchable = true
[[schema.entities.fields]]
name = "customer_type"
field_type = "string"
required = true
display_name = "客户类型"
ui_widget = "select"
filterable = true
options = [
{ label = "企业", value = "enterprise" },
{ label = "个人", value = "personal" }
]
[[schema.entities.fields]]
name = "industry"
field_type = "string"
display_name = "行业"
filterable = true
[[schema.entities.fields]]
name = "region"
field_type = "string"
display_name = "地区"
filterable = true
[[schema.entities.fields]]
name = "source"
field_type = "string"
display_name = "来源"
ui_widget = "select"
options = [
{ label = "推荐", value = "referral" },
{ label = "广告", value = "ad" },
{ label = "展会", value = "exhibition" },
{ label = "主动联系", value = "outreach" },
{ label = "其他", value = "other" }
]
[[schema.entities.fields]]
name = "level"
field_type = "string"
display_name = "等级"
ui_widget = "select"
filterable = true
options = [
{ label = "潜在客户", value = "potential" },
{ label = "普通客户", value = "normal" },
{ label = "VIP", value = "vip" },
{ label = "SVIP", value = "svip" }
]
[[schema.entities.fields]]
name = "status"
field_type = "string"
required = true
display_name = "状态"
ui_widget = "select"
filterable = true
options = [
{ label = "活跃", value = "active" },
{ label = "停用", value = "inactive" },
{ label = "黑名单", value = "blacklist" }
]
[[schema.entities.fields]]
name = "credit_code"
field_type = "string"
display_name = "统一社会信用代码"
visible_when = "customer_type == 'enterprise'"
[schema.entities.fields.validation]
pattern = "^[0-9A-HJ-NP-RTUW-Y]{2}\\d{6}[0-9A-HJ-NP-RTUW-Y]{10}$"
message = "请输入有效的统一社会信用代码18位"
[[schema.entities.fields]]
name = "id_number"
field_type = "string"
display_name = "身份证号"
visible_when = "customer_type == 'personal'"
[schema.entities.fields.validation]
pattern = "^\\d{17}[\\dXx]$"
message = "请输入有效的身份证号18位"
[[schema.entities.fields]]
name = "parent_id"
field_type = "uuid"
display_name = "上级客户"
ref_entity = "customer"
[[schema.entities.fields]]
name = "website"
field_type = "string"
display_name = "网站"
[schema.entities.fields.validation]
pattern = "^https?://[\\w.-]+(?:\\.[\\w.-]+)+[/#?]?.*$"
message = "请输入有效的网址,以 http:// 或 https:// 开头"
[[schema.entities.fields]]
name = "address"
field_type = "string"
display_name = "地址"
[[schema.entities.fields]]
name = "remark"
field_type = "string"
display_name = "备注"
ui_widget = "textarea"
[[schema.entities.fields]]
name = "owner_id"
field_type = "uuid"
display_name = "负责人"
scope_role = "owner"
[[schema.entities.relations]]
entity = "contact"
foreign_key = "customer_id"
on_delete = "cascade"
name = "contacts"
type = "one_to_many"
display_field = "name"
[[schema.entities.relations]]
entity = "communication"
foreign_key = "customer_id"
on_delete = "cascade"
name = "communications"
type = "one_to_many"
display_field = "subject"
[[schema.entities.relations]]
entity = "customer_tag"
foreign_key = "customer_id"
on_delete = "cascade"
name = "tags"
type = "one_to_many"
display_field = "tag_name"
[[schema.entities.relations]]
entity = "customer"
foreign_key = "parent_id"
on_delete = "nullify"
name = "parent"
type = "many_to_one"
display_field = "name"
[[schema.entities]]
name = "contact"
display_name = "联系人"
[[schema.entities.fields]]
name = "customer_id"
field_type = "uuid"
required = true
display_name = "所属客户"
ui_widget = "entity_select"
ref_entity = "customer"
ref_label_field = "name"
ref_search_fields = ["name", "code"]
[[schema.entities.fields]]
name = "name"
field_type = "string"
required = true
display_name = "姓名"
searchable = true
[[schema.entities.fields]]
name = "position"
field_type = "string"
display_name = "职务"
[[schema.entities.fields]]
name = "department"
field_type = "string"
display_name = "部门"
[[schema.entities.fields]]
name = "phone"
field_type = "string"
display_name = "手机号"
[schema.entities.fields.validation]
pattern = "^1[3-9]\\d{9}$"
message = "请输入有效的手机号码"
[[schema.entities.fields]]
name = "email"
field_type = "string"
display_name = "邮箱"
[schema.entities.fields.validation]
pattern = "^[\\w.+-]+@[\\w.-]+\\.[a-zA-Z]{2,}$"
message = "请输入有效的邮箱地址"
[[schema.entities.fields]]
name = "wechat"
field_type = "string"
display_name = "微信号"
[[schema.entities.fields]]
name = "is_primary"
field_type = "boolean"
display_name = "主联系人"
[[schema.entities.fields]]
name = "remark"
field_type = "string"
display_name = "备注"
[[schema.entities.relations]]
entity = "communication"
foreign_key = "contact_id"
on_delete = "cascade"
name = "communications"
type = "one_to_many"
display_field = "subject"
[[schema.entities]]
name = "communication"
display_name = "沟通记录"
[[schema.entities.fields]]
name = "customer_id"
field_type = "uuid"
required = true
display_name = "关联客户"
ref_entity = "customer"
[[schema.entities.fields]]
name = "contact_id"
field_type = "uuid"
display_name = "关联联系人"
ui_widget = "entity_select"
ref_entity = "contact"
ref_label_field = "name"
ref_search_fields = ["name"]
cascade_from = "customer_id"
cascade_filter = "customer_id"
[[schema.entities.fields]]
name = "type"
field_type = "string"
required = true
display_name = "类型"
ui_widget = "select"
filterable = true
options = [
{ label = "电话", value = "phone" },
{ label = "邮件", value = "email" },
{ label = "会议", value = "meeting" },
{ label = "拜访", value = "visit" },
{ label = "其他", value = "other" }
]
[[schema.entities.fields]]
name = "subject"
field_type = "string"
required = true
display_name = "主题"
searchable = true
[[schema.entities.fields]]
name = "content"
field_type = "string"
required = true
display_name = "内容"
ui_widget = "textarea"
[[schema.entities.fields]]
name = "occurred_at"
field_type = "date_time"
required = true
display_name = "沟通时间"
sortable = true
[[schema.entities.fields]]
name = "next_follow_up"
field_type = "date"
display_name = "下次跟进日期"
[[schema.entities]]
name = "customer_tag"
display_name = "客户标签"
[[schema.entities.fields]]
name = "customer_id"
field_type = "uuid"
required = true
display_name = "关联客户"
ref_entity = "customer"
[[schema.entities.fields]]
name = "tag_name"
field_type = "string"
required = true
display_name = "标签名称"
searchable = true
[[schema.entities.fields]]
name = "tag_category"
field_type = "string"
display_name = "标签分类"
ui_widget = "select"
options = [
{ label = "行业", value = "industry" },
{ label = "地区", value = "region" },
{ label = "来源", value = "source" },
{ label = "自定义", value = "custom" }
]
[[schema.entities]]
name = "customer_relationship"
display_name = "客户关系"
[[schema.entities.fields]]
name = "from_customer_id"
field_type = "uuid"
required = true
display_name = "源客户"
ref_entity = "customer"
[[schema.entities.fields]]
name = "to_customer_id"
field_type = "uuid"
required = true
display_name = "目标客户"
ref_entity = "customer"
[[schema.entities.fields]]
name = "relationship_type"
field_type = "string"
required = true
display_name = "关系类型"
ui_widget = "select"
filterable = true
options = [
{ label = "母子公司", value = "parent_child" },
{ label = "兄弟公司", value = "sibling" },
{ label = "合作伙伴", value = "partner" },
{ label = "供应商", value = "supplier" },
{ label = "竞争对手", value = "competitor" }
]
[[schema.entities.fields]]
name = "description"
field_type = "string"
display_name = "关系描述"
# ── 页面声明 ──
[[ui.pages]]
type = "tabs"
label = "客户管理"
icon = "team"
[[ui.pages.tabs]]
label = "客户列表"
type = "crud"
entity = "customer"
enable_search = true
enable_views = ["table"]
[[ui.pages.tabs]]
label = "客户层级"
type = "tree"
entity = "customer"
id_field = "id"
parent_field = "parent_id"
label_field = "name"
[[ui.pages]]
type = "detail"
entity = "customer"
label = "客户详情"
[[ui.pages.sections]]
type = "fields"
label = "基本信息"
fields = ["code", "name", "customer_type", "industry", "region", "level", "status", "credit_code", "id_number", "website", "address", "remark"]
[[ui.pages.sections]]
type = "crud"
label = "联系人"
entity = "contact"
filter_field = "customer_id"
[[ui.pages.sections]]
type = "crud"
label = "沟通记录"
entity = "communication"
filter_field = "customer_id"
enable_views = ["table", "timeline"]
[[ui.pages]]
type = "crud"
entity = "contact"
label = "联系人"
icon = "user"
enable_search = true
[[ui.pages]]
type = "crud"
entity = "communication"
label = "沟通记录"
icon = "message"
enable_search = true
enable_views = ["table", "timeline"]
[[ui.pages]]
type = "crud"
entity = "customer_tag"
label = "标签管理"
icon = "tags"
[[ui.pages]]
type = "crud"
entity = "customer_relationship"
label = "客户关系"
icon = "apartment"
[[ui.pages]]
type = "graph"
entity = "customer"
label = "关系图谱"
icon = "apartment"
relationship_entity = "customer_relationship"
source_field = "from_customer_id"
target_field = "to_customer_id"
edge_label_field = "relationship_type"
node_label_field = "name"
[[ui.pages]]
type = "dashboard"
label = "统计概览"
icon = "DashboardOutlined"
[[ui.pages]]
type = "kanban"
entity = "customer"
label = "销售漏斗"
icon = "swap"
lane_field = "level"
lane_order = ["potential", "normal", "vip", "svip"]
card_title_field = "name"
card_subtitle_field = "code"
card_fields = ["region", "status"]
enable_drag = true