25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
"""新增组件动作"""
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import Field
|
|
|
|
from app.schemas.actions.base import ActionModel
|
|
from app.schemas.screen import ScreenNode
|
|
|
|
|
|
class AddAction(ActionModel):
|
|
"""按物料新增组件"""
|
|
|
|
type: Literal["add"] = "add"
|
|
node: ScreenNode = Field(
|
|
description="新组件。id、type、layout 必填,其余只写需要覆盖物料默认配置的字段;"
|
|
"后端按 type 找到物料,用默认配置补全:对象逐层覆盖,数组整体替换,null 明确覆盖。"
|
|
"id 不能与现有组件重复,同一批里先 delete 的 ID 可以再用;type 用 list_components 返回的 type"
|
|
)
|
|
sample_data: bool = Field(
|
|
default=False,
|
|
description="true 表示组件显示的不是真实业务数据(物料示例数据,或自己编写的数据)。不写时按物料设置;"
|
|
"只有展示的数据全部来自大屏上已有的组件时写 false,例如更换类型时迁移了原组件的数据",
|
|
)
|