跳转至

.widget / .widgetgroup 文件 Schema

位置:/{软件名}.application/widget/{分组名}.widgetgroup/{组件名}.widget | XML 根:widget 资源元素(PageWidget) | 与技能对齐:generate-widget-file 机制背景见 [[design/table-schema/overview]]。

1. 用途与落盘

首页小组件(Widget):摘要/视图/图表/脚本 HTML/轮播/签到等首页卡片。新写一律走有分组路径(与 API 分组同构);历史无分组文件散落但靠后缀递归仍可读。

/{软件名}.application/widget/{分组名}.widgetgroup/{分组名}.widgetgroup   # 分组元数据(可选)
/{软件名}.application/widget/{分组名}.widgetgroup/{组件名}.widget

published=false → 首页聚合直接跳过(不论授权)。

2. 属性表

属性 XML 形态 类型 默认 说明
id 根属性 string 须生成 __ + 短 UUID
name 子元素 string — 必填;文件名;应用内不重名
parentId 子元素 string — 有分组=分组 id;无分组=软件 id
widgetGroupId 子元素 string — 设计态必填;= 分组 id
type 子元素 string — 必填;见 §3
actionContent CDATA string 内容指针,语义随 type(id / iScript / 配置 id)
moduleid 子元素 string view/chart/customizeReport 时=模块 id
published 子元素 bool false 前台显示须 true
authMode 子元素 int 0 0 全角色 / 1 选定角色(authRolesId)/ 2 选定用户(userScript)
authRolesId / authRolesName 子元素 string authMode=1 时角色 id/名串
userScript CDATA string authMode=2 时返回用户 id/UserVO 集合
icon + icontype 子元素 string icon 为 JSON 串:{"icon":"...","icontype":"img|font","iconFontColor":"..."}
iconShow 子元素 bool false true=快速入口(直接 return actionContent)
widgetType 子元素 int 0 0 通用(PC+手机)/ 1 仅网页 / 2 仅手机
wgtWidth / wgtHeight 子元素 string 流式宽 1X–3X / 高 1X–8X
width / height 子元素 string 传统宽高(流式布局优先 wgt*)
tabTags CDATA string [] iscript 类型页签切换 JSON 数组
carouselImg 子元素 string carousel:图片 URL JSON 数组串
frequency 子元素 int 1 carousel 轮播秒数
helpPath 子元素 string help 类型文件路径
countType 子元素 string none checkin 统计:none/month/quarter/year
showAll 子元素 bool false system_workflow:跨全部软件待办
orderno 子元素 int 排序(越小越前)
isRefresh / setup bool 可刷新 / 曾被自定义布局使用标记

3. type × actionContent(核心)

type 含义 moduleid actionContent
summary 摘要(待办/分享/抄送) 空 摘要配置 id(SummaryCfg)
view 挂接视图 模块 id 视图 id
chart 统计图 模块 id 图表 id
customizeReport 自定义报表 模块 id 报表 id
page 链接内容 空 iScript,return URL
iscript 脚本 HTML 空 iScript,必须 return String HTML(有 WebUser 上下文)
system_workflow 流程处理 空 可空(配 showAll)
carboncopy 抄送数据 空 可空
carousel 轮播图 空 可空(配 carouselImg + frequency)
checkin 签到 空 可空(配 countType)
help 帮助 空 可空(配 helpPath)

page 返回 URL;iscript 返回 HTML 片段(返回非字符串 → 后端抛「脚本运算结果不合法」)。

4. XML 骨架(视图 Widget)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="__wgtLeaveList000001">
  <name>我的请假</name>
  <parentId>分组id</parentId>
  <widgetGroupId>分组id</widgetGroupId>
  <type>view</type>
  <moduleid>模块id</moduleid>
  <actionContent><![CDATA[视图id]]></actionContent>
  <published>true</published>
  <authMode>0</authMode>
  <widgetType>0</widgetType>
  <icon>{"icon":"/uploads/lib/icon_menu_default.png","icontype":"img"}</icon>
  <icontype>img</icontype>
  <iconShow>false</iconShow>
  <orderno>0</orderno>
  <wgtWidth>2X</wgtWidth>
  <wgtHeight>2X</wgtHeight>
</widget>

(分组 .widgetgroup 极简:id 根属性 + name + parentId=软件 id。)

5. 相关

资源 文档
挂接视图/图表 [[view-file]] / [[chart-file]]
菜单授权角色 [[role-file]]
生成操作指南 agent-skills-usage/skills/generate-widget-file/SKILL.md(含流程处理/轮播/签到骨架、历史类型附录)