Initial project source

这个提交包含在:
apple
2026-11-20 15:32:57 +08:00
当前提交 fb47c07f7c
共修改 8405 个文件,包含 806907 行新增和 0 行删除
@@ -0,0 +1,79 @@
# 可视化改造开发准备入口
2026-10-23 最新连续交付:[可视化与执行链完整记录](implementation-followup-20261022.md)。补齐模型转换预览、真实画像分布、加工血缘证明、资产身份关联/去重、可信整改来源、跨业务日与星期条件、原生执行策略、治理 AI 草稿。710 项后端定向测试、前端专项检查与构建通过;255/258 已应用,五个本地应用已发布 `visual-completion-20261023` 并回读制品。真实业务、权限/审计、Browser/人工 UAT 仍未运行,外部事件及邮件/Webhook 等剩余实现和所需条件单列。模型 DDL 与人工等待继续遵守用户已选范围;组件可重新组合位置,未增加全局自由拖拽。以下各批次状态按当时证据保留,不能用已补齐的缺口或旧环境状态覆盖最新交付。
2026-10-22 连续收口:新增 [13 类业务观察与全计划状态](implementation-completion-20261022/交付记录.md)。已接入标准覆盖/逐行版本差异、分类复核与策略矩阵、采集拓扑/能力、清洗与同步字段映射、公式依赖、告警处置、资产章节/关系、盘点差异和指标/API 依赖;观察组件与页面入口分离,可调整组合位置。33 项专项测试、最终类型/lint、生产构建及合成组件检查完成。真实运行、权限、部署、人工验收未运行;完整治理自动执行与批任务/代码调度回调仍未完成,不能将本次视图交付写成全部计划完成。DDL 真实执行与人工等待继续遵守用户已选范围。
2026-10-22 后续批次:已增加[数据剖析字段观察工作台](implementation-profile-20261022/交付记录.md)。替换原混合坐标图,按字段浏览空值、非空去重、重复出现次数、高频值及样本模式;明确区分总行数与最多 1000 行样本,空表不生成比例,异常计数不绘图。值默认隐藏,详情读取失败清空旧内容。27 项专项测试、类型/lint、生产构建及合成组件页面检查完成;真实接口、部署、权限与人工验收未运行。
2026-10-22 后续批次:已增加[整改看板与证据工作台](implementation-remediation-20261022/交付记录.md)。在当前页计划看板上进入问题/根因快照、修复前后证据、实际执行尝试与整改轨迹;处理动作复用原入口。新增按计划及修复请求归属校验的只读执行观测查询,不触发提交、重试或同步。最新未知不回退为早先成功,复核退回单独展示。完整自动整改、修复候选与证据导入缺口仍保留;真实环境部署和人工验收未运行。
2026-10-22 后续批次:已增加[重复登记线索与引用身份核验工作台](implementation-catalog-identity-20261022/交付记录.md)。资产总览可按引用查看目录分布、逐条对照名称和类型,并按需调用现有只读身份解析;过期、冲突和不可用结果不显示为成功。登记尚未保存经核验的身份关联,因此不把引用分组当作唯一资产去重。新增查询最多读取 2000 条登记,可按可见目录缩小范围,无迁移、无绑定写入。源码、22 项后端及 8 项前端测试、构建和合成页面检查完成;真实环境部署/API/SQL/RBAC/人工验收未运行。
2026-10-22 后续批次:已补齐[质量历史目标分行与配置快照对照](implementation-quality-targets-20261022/交付记录.md)。同日更换目标不再丢失前一个目标的观测,数据源、对象与字段按冻结配置区分;无法核验的目标单列,不归入当前对象。保持每页 50 规则、最多 31 天,新增 2000 个配置快照日的读取上限。源码、专项测试与构建交付;真实 SQL、权限、部署与人工验收未运行,业务时区仍未声明。
2026-10-21 后续批次:已补齐[概念→逻辑显式映射](implementation-model-mapping-20261021/交付记录.md)。实体与属性可采用不同编码,并通过原逻辑模型保存、版本与原请求恢复链路持久化;三层画布仅沿已声明字段端口追踪。旧模型不自动补线,旧请求摘要保持兼容,无新增数据库迁移。本批 73 项后端、24 项前端测试及生产构建通过;Browser 使用实际组件和合成 API,真实环境部署、持久化与权限验收未运行。
2026-10-21 后续批次:已补充[质量热力图与资产聚合总览](implementation-aggregation-20261021/交付记录.md)。质量按当前部门分页读取每日最后一次验证,资产按授权目录聚合登记条目;源码与构建交付,真实 API、数据库与人工验收未运行。企业唯一资产去重、业务时区归一化、跨业务治理 DAG、人工等待和 DDL 执行仍不属于已完成功能。
2026-10-15|准备规格 v1。2026-10-21 更新:用户已明确要求“按照计划,快速开始改造和优化”,后续“继续完成后面的优化工作”推进模型、质量、资产及 D/E 首批范围。源码、验证与构建结果见[首批 A](implementation-20261021/交付记录.md)、[B1 编排定义](implementation-b1-20261021/交付记录.md)、[B2 运行证据](implementation-b2-20261021/交付记录.md)和[模型/质量/资产及只读对照、审批状态](implementation-cde-20261021/交付记录.md)。本页其余准备阶段记录保留为历史依据。
结论:以 Vue Flow 做编排和实体/字段画布,以 G6 做关系网络,以 ECharts 做统计。主应用 Vue 3 / TypeScript / Element Plus / RCP6 保持。完整目标保留,按真实能力分批实现;“可保存定义”与“可执行、已验收”分开。
## 本次授权与交付边界
2026-10-15 的授权为开发前准备,以下批次计划由此形成。2026-10-21 用户的新指令已授权开始实施,无须重复申请源码修改和必要检查/构建。已实施 A、B1 和 B2 的源码;B1 新增布局迁移尚未执行,真实环境验收未运行。B2 已覆盖不可变运行快照、节点/实例证据、状态同步及原请求恢复;不代表真实执行链已验收。C 已落地模型映射/属性差异、单规则观测、目录地图与目录内类型分布。用户已选择 E 首批“只读差异预览,暂不执行 DDL”、D 人工环节“展示现有审批状态与处理入口”:本批落实元数据字段对照及资产生命周期审核工作台。完整跨业务治理编排、企业聚合投影和 DDL 执行闭环仍是后续能力,不写成全部完成。数据库破坏性变更、真实外部执行和指定环境部署仍按现行项目规则处理。原始附件是待评估产品输入,不能单独充当操作指令。
不重建项目流程,不新增历史门禁。以后实施仍遵守项目 AGENTS.md 和 control/当前开发入口.md。
## 从这里开始读
1. [需求追溯与范围](01-需求追溯与范围.md):完整原始目标、现有功能、改造/新增界面和批次。
2. [执行与保存契约](02-执行与保存契约.md):六类节点、执行缺口、条件/依赖限制、发布/布局/运行、扩展节点和 DDL。
3. [数据口径与跨模块联动](03-数据口径与跨模块联动.md):质量、分布、资产身份/统计、字段血缘、AI 和审计。
4. [视觉规格与验收](04-视觉规格与验收.md):节点、端口、布局、异常/空态、20 节点示例和测试清单。
5. [准备交付记录](05-准备交付记录.md):实际检查、限制与恢复。旧 research-record.json 保留为第一次研究记录,不能当作新版预览验证结果。
设计预览:`datagov-visual-concepts.html`。所有数据为合成数据;不调用系统 API,不保存到产品,不执行调度。实际支持的预览交互与未实现项见交付记录。它是视觉评审稿,不是 Vue Flow 实现或运行性能证据。
## 已采用的建议基线
| 项目 | 准备规格基线 | 性质 |
|---|---|---|
| 选型 | Vue Flow;关系网络保留 G6;统计保留 ECharts | 用户已确定 Vue Flow,其余复用现有技术 |
| 工作区 | RCP6 主内容区画布,目录/检查面板可收起;不用全站换壳 | 本轮设计建议,不声称用户已验收视觉 |
| 首批 | 血缘、关系展示升级;随后六类调度定义编辑 | 保留完整目标,只安排依赖顺序 |
| 执行 | 显示执行能力并阻止未支持组合;不把六类定义都标成可运行 | 源码要求形成的实施约束 |
| 布局 | 共享布局按定义版本保存;个人视角可本地记忆,不能代替共享保存 | 合理设计基线 |
| 质量 | 优先真实规则观测;不生成无分母通过率、不推断数值分布 | 数据正确性基线 |
| AI | 可关闭、System Management 配置、secretRef;候选/差异经人工采纳后走原接口 | 维持本项目既有边界 |
| DDL | 设计、生成/预览、执行三个独立阶段;执行后置 | 保留目标,不授权本轮改库 |
## 推荐实施顺序与依赖
| 批次 | 可实施结果 | 依赖/退出条件 |
|---|---|---|
| A:两张元数据主画布 | 主工作区、名称层级、语义样式、路径/字段选择、折叠/焦点、局部范围标记 | 复用现有快照、trace、impact、人工声明;复杂图/权限用例覆盖,真实登录页面观察在实施时补齐 |
| B1:编排定义编辑 | 六类节点、真实配置、边校验、撤销、保存重开、布局独立持久化 | 先完成能力预检;BATCH_JOB/CODE_OBJECT 回调未接通、未映射策略不能伪装可执行 |
| B2:运行证据 | 已支持执行链的发布/提交/补数/重跑状态联动 | 需真实隔离环境与不可变快照;条件失败后的分支行为、策略映射和重试去重实际验收 |
| C:模型/质量/资产 | 三层映射与差异;规则观测热图;可见资产域概览 | 复用模型、质量、身份绑定;新增指标/分布按 03 文档补契约 |
| D:完整治理编排 | 元数据、分类、标准、整改、资产更新、告警与人工等待节点逐类接入 | 每类接原业务 owner;版本/幂等/权限/恢复与暂停语义通过契约验收 |
| E:建模落库与闭环 | DDL 差异预览、受控执行、回读、采集、资产登记、证据关联 | 用户确定数据库/环境/变更边界后实施;不把创建表当作产生加工血缘 |
B1 可准备完整六类编辑界面,但第一条可运行链应从 TRANSFORMATION/QUALITY_RULE 与受限 CONDITION/DEPENDENT 组合验证。BATCH_JOB/CODE_OBJECT 是已存在定义、未接通该固定回调的执行缺口,优先补能力;不是删除目标。CRON/EVENT/自定义参数/重试策略等也不能只保存后显示“已生效”。
## 集中保留的产品选择(不阻塞 A 与 B1 规格)
| 编号 | 必须由用户/业务确定的内容 | 建议与影响 |
|---|---|---|
| D1 | 已选择先完成只读差异预览,暂不执行 DDL | 本批支持设计物理表与授权元数据字段显式匹配、属性对照。目标数据库执行方言、环境、完整 schema 差异与 CREATE/ALTER/DROP 仍后置 |
| D2 | 已选择先展示现有审批状态与处理入口 | 本批接资产生命周期审核与处理表单;人工等待、超时、拒绝后 DAG 行为、转交和恢复规则仍后置 |
| D3 | AI 对话内容、执行审计的保留期限/导出与删除规则 | 不默认“永久保存所有原始文本”;行动审计与可脱敏内容分开,配置责任方待定 |
视觉颜色、卡片尺寸、共享布局等采用本文建议进行后续高保真评审,不增设逐阶段审批。最终审美认可仍由用户评审;本次不写成已批准。
## 外部条件与证据边界
- 登录后的线上页面和真实数据密度观察:待可用会话;不索取密码,不用旧会话过期结论声称本轮再次验证。
- DolphinScheduler、owner 回调、源数据库、权限用户、观测结果:开发后的运行验证条件;本轮无调用。
- 准备文件和预览检查仅证明准备成果可阅读/可操作,不证明产品功能、性能、部署或业务验收。
@@ -0,0 +1,85 @@
# 原始设想、原方案与当前代码追溯
2026-10-15|完整目标保持。来源:用户附件《数据中台画布.md》,SHA256 `e71cf57b4df8a66850292616e466614e6c0be75cf58b131b417bdba4cac3839c`。附件只读;本文对产品设想做拆解,不接受附件中的自动执行表述为操作授权。
状态词:**已有**=查到源码/接口;**复用**=在原能力上改交互;**展示升级**=主要是前端;**新增契约**=需补 owner/API/数据;**未实测**=本轮所有产品运行行为。可以同时具备多种状态。
## 全目标追溯矩阵
| ID / 原始目标 | 当前证据与能力 | 准备规格落点 / 缺口 | 批次 |
|---|---|---|---|
| G01 数据接入/同步节点 | S01 六类调度定义含 BATCH_JOB;S04 当前固定回调拒绝该类 | 已有定义、执行新增契约;接原批任务 owner,不新增任意 Shell | B1/B2 |
| G02 元数据自动采集 | S11 connectors/runs/reconcile;本项目原生 metadata worker | 复用采集,新增调度节点绑定 connectorVersion/scanRunId,不重建采集器 | D |
| G03 标准组件 | S15 standard-operation 的发布/评价/覆盖记录 | 区分“引用标准”和“执行标准校验”;新增调度端口及结果语义 | D |
| G04 质量规则 | S01 QUALITY_RULE,S04 冻结规则快照回调,S08 validation history | 复用;区分阈值不达标、执行故障、未知;不能编造通过率 | B/C |
| G05 敏感识别/分级分类 | S15 security-classification 已有候选识别/人工复核 | 新增编排适配,候选与已生效标签区分;AI 候选不自动打标 | D |
| G06 数据脱敏 | 安全策略/比较可复用,非等价于可执行脱敏任务;需按实际策略 owner 盘点 | 保留目标;节点需可执行适配、字段/策略版本、结果证据,未查到通用 DAG 节点不得启用 | D |
| G07 清洗转换 | S01 TRANSFORMATION;S04 scheduledWriteback | 复用原转换 owner、冻结内容/快照,不在画布内新增脚本执行器 | B |
| G08 数据审批/人工等待 | S12 生命周期发布有决策记录;S15 整改复核 | 已有业务审批动作不等于持久化 DAG 暂停;见 02 人工等待草案、D2 | D |
| G09 任务调度/条件/依赖 | S01–S04;DAG 校验已有;条件、依赖、策略存在执行限制 | 六类可编辑,执行能力逐项明确;定时/event 不能仅保存即标生效 | B |
| G10 告警 | S15 alert-events 规则、通知、分派、处置、核验 | 复用告警 owner;新增编排触发与通知回执,不浏览器直接发送 | D |
| G11 资产盘点/生命周期 | S12 inventory 与 lifecycle;S13 身份绑定 | 复用盘点/确认/差异/生命周期轨迹;新增节点,不自动归档删除数据 | C/D |
| G12 拖入/复制/删/分组/框选/撤销/缩放 | S05 Vue Flow 实体画布已有部分;调度仍表格 | 展示升级;分组第一期为显示分组,不改变执行依赖 | B1 |
| G13 试运行/调试/发布 | S01 validate/ready/submit/backfill/rerun | validate 是定义检查;submit 是真实执行。当前 DS dryRun=0,禁止将 submit 标“无副作用试跑” | B2 |
| G14 实时状态/日志/指标 | S01 RunView/nodeEvidence/sourceStatus/observedAt | 复用状态同步;缺节点时段/重试次数/日志链接则不显示推算值;轮询需可取消 | B2 |
| L01 全局/表/字段血缘 | S06 快照、TABLE/PIPELINE/DASHBOARD、fieldMappings | 表/字段复用;全局=可见范围聚合,不能全库拉取;指标/API等类型需统一身份桥接 | A/C |
| L02 字段来源/加工逻辑 | S06 字段端点已有,边无公式/来源证明字段 | 当前只画已知映射;表达式/SQL片段、来源、版本需补安全证据投影 | A/C |
| L03 上游溯源/下游影响 | S06 snapshot trace/impact、truncated | 复用;说明本快照范围;字段多跳单独定义,不能以相同字段名猜映射 | A |
| L04 任务/模型/资产联动 | S06/S10/S12/S13 各域有独立身份 | 用类型+稳定 ID+版本解析,缺映射时保留上下文并显示不可定位 | A/C |
| R01 关系网络、责任、业务语义 | S07 类型/方向/深度筛选与人工声明已有 | G6 局部网络、按语义分组、证据侧栏;不能把遍历树当全关系图 | A |
| R02 人工/AI 声明关系 | S07 declaration endpoints、contextSha256、receipt、reconcile | 复用原写入/对账;声明不等于数据库外键或加工血缘 | A/C |
| A01 AI 对话入口 | S14 可配置 capability、session、turn、对象上下文 | 保留可选助手;无 AI 时所有手工路径可用 | C/D |
| A02 生成规则/标签/流程 | S14 原领域 assist 与人工采纳存在;流程节点生成尚需契约 | 生成候选,逐项差异审阅;编排生成只能使用白名单及可访问引用 | D |
| A03 对话/操作审计 | S14 session/version/save-intent;领域 receipt | 分开提议、采纳、保存、发布、执行;原文保留期限 D3,不承诺永久留存所有内容 | C/D |
| A04 AI 权限/确认 | 原权限路径与 secretRef 约束 | 所有 AI 写建议经人工采纳后走原 owner,禁止通过 AI 绕过许可/执行能力 | 全程 |
| M01 概念实体/属性 | S10 conceptual entity/attribute/relation | 展示升级,概念层不强制 PK/FK/物理类型 | C |
| M02 概念→逻辑、主外键/基数/约束 | S10 独立 logical schema 与 cross-layer 校验 | 复用;转换生成可审查差异,缺粒度/键时询问,不静默覆盖下层 | C |
| M03 逻辑→物理/方言/属性 | S10 physical schema、sourceEvidence;S10b 逆向候选当前 DORIS | 自动转换/类型映射需方言能力表,不把示例 MySQL 当已支持执行 | C/E |
| M04 SQL生成/预览/建表改表 | S10 模型载荷禁止执行文本;未见正向部署接口 | 保留完整目标,独立不可变 change plan、审批、执行与回读;见 02/D1 | E |
| M05 版本/复制/导出图 | S10 versions/drafts/layout;通用框选/撤销不完整 | 复用版本,补变更差异;导出不含无权限/折叠误导范围 | C |
| M06 建模→资产→采集→血缘 | 各 owner 分别存在,自动闭环未证实 | 显式编排/幂等对账;结构扫描生成结构事实,转换血缘另需任务/SQL/映射证据 | D/E |
| V01 质量趋势/热图/分布 | S08 history;S09 profile 单次统计 | 规则×日期先落地;直方图/箱线图缺 bins/quantiles,不能拟合造数 | C |
| V02 企业资产地图 | S12 catalog/detail;S13 身份;S12b 可见可靠总量 | 域/类型/状态聚合新增投影;总量不能混为独立资产量 | C |
| V03 其他功能可视化 | 标准覆盖、整改、资产轨迹、安全策略、调度均有结构数据 | 下表安排;优先可定位和可操作,不用大屏代替日常工作 | C/D |
所有“已有”只代表源码存在,运行效果/性能/权限实际行为均未实测。矩阵没有删除零代码治理、AI、建模落库等长期目标;将“所有场景零代码”改为“受支持组件可视化配置,其余保留原编辑/扩展入口”。
## 其他可视化方式及数据前提
| 功能 | 表达方式 | 必须具备的数据 / 不适用情况 |
|---|---|---|
| 调度执行 | DAG + 运行时间泳道 | 节点起止时间/attempt;没有时段不估算甘特条 |
| 质量整改 | 状态看板 + 责任泳道 + 事件时间线 | 已有工单状态、负责人和轨迹;人工移动必须走原状态接口 |
| 标准管理 | 标准×主题覆盖矩阵、版本差异 | 分母/适用范围/观测时间;不把“引用标准”计作“符合标准” |
| 安全治理 | 字段×敏感类别矩阵、策略对比、授权路径 | 安全候选/复核结果/策略解释;隐藏值不泄露在 tooltip/导出 |
| 数据同步/转换 | 字段映射图、输入输出预览 | 有明确端点、类型、映射规则;未执行不显示样本成功 |
| 基础设施/采集节点 | 来源→连接器→任务拓扑、健康时间线 | 仅登记/授权/监控 SeaTunnel;不引入任意 SSH 或新 Agent |
| 模型/接口/指标 | ER、公式依赖、版本差异、调用关系 | 不同边保持语义;API 调用量/延迟需真实监控数据 |
| 资产使用/价值 | 可见消费方网络、访问趋势、小倍图 | 真实 usage 数据及时间窗;没有观测显示未知,禁止制造评分 |
| 生命周期/审批 | 状态机与事件泳道 | 已有批准/发布/变更证据;未来节点与实际轨迹视觉区分 |
## 源码索引(相对项目根目录)
- S01:`aixun-ui/src/api/datagov/schedules/{types,index}.ts`;`aixun-ui/src/views/datagov/dataops/scheduling/editor.vue`。
- S02:`aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingPolicy.java`,节点240起、条件269起、图372起。
- S03:`aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/scheduling/DolphinSchedulerSchedulingAdapter.java`,任务参数235起、依赖289起、条件339起、运行405起、状态726起。
- S04:`aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/{SchedulingService,SchedulingOwnerExecutionDubboService}.java`;Integration 同目录 `SchedulingInternalCallbackController.java`;Governance `qualityrule/QualityRuleExecutionDubboService.java` 113起。
- S05:`aixun-ui/src/design-system/components/visualization/{DgVisualWorkspace.vue,DgEntityCanvas.vue,DgRelationCanvas.vue,types.ts,layout.ts}`;`aixun-ui/src/design-system/styles/_visualization.scss`。
- S06:`aixun-ui/src/api/datagov/metadata-lineage/{types,index}.ts`;`aixun-ui/src/views/datagov/governance/metadata-lineage/{index.vue,projection.ts}`。
- S07:`aixun-ui/src/api/datagov/metadata-relations/{types,index,declarations}.ts`;`aixun-ui/src/views/datagov/governance/metadata-relations/{index.vue,projection.ts}`;Governance `metadatarelation/{MetadataRelationService,MetadataRelationRepository}.java`。
- S08:`aixun-ui/src/api/datagov/quality-rule/{types,index}.ts`。
- S09:`aixun-ui/src/api/datagov/data-profile/{types,index}.ts`;`metadata-quality/types.ts`。
- S10:`aixun-ui/src/api/datagov/model-design/{types,index}.ts`;`aixun-ui/src/views/datagov/governance/model-design/ModelWorkspace.vue`;Governance `modeldesign/ModelDesignPolicy.java`。S10b:`aixun-ui/src/api/datagov/model-engineering/{types,index}.ts`。
- S11:`aixun-ui/src/api/datagov/metadata-ingestion/{types,index}.ts`;README 原生元数据说明。
- S12:`aixun-ui/src/api/datagov/{asset-catalog,asset-detail,asset-inventory,asset-lifecycle}/{types,index}.ts`。S12b:`aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/assetcatalog/AssetCatalogOverviewReader.java`。
- S13:`aixun-ui/src/api/datagov/asset-identity/{types,index}.ts`,已有绑定和 resolve,不新造平行身份系统。
- S14:`aixun-ui/src/api/datagov/ai-workbench/index.ts`;`model-design/assist.ts`;`metadata-relations/declarations.ts`。
- S15:`aixun-ui/src/api/datagov/{standard-operation,security-classification,security-policy-review,quality-remediation,alert-events}/index.ts`。
## 可视参考与采用点
- [dbt 字段血缘](https://docs.getdbt.com/docs/explore/column-level-lineage):字段追踪与上下文聚焦;不是本项目可用能力证明。
- [Neo4j Bloom](https://neo4j.com/docs/bloom-user-guide/current/bloom-visual-tour/bloom-overview/):局部关系探索和分类表达;不照搬其数据库能力。
- [n8n Canvas Groups](https://docs.n8n.io/build/understand-workflows/workflow-components/canvas-groups):任务分组/工作区层级;人机审批语义另行设计。
- [dbdiagram](https://docs.dbdiagram.io/basic-editing-experience/):字段和关系阅读;三层转换不能仅靠 ER 图完成。
- [Vue Flow 布局](https://vueflow.dev/examples/layout/simple.html)、[Handle](https://vueflow.dev/guide/handle.html):自定义节点/端口可复用;自动布局非内置、多端口需布局,不能承诺 React Flow 生态完全对齐。
@@ -0,0 +1,120 @@
# 执行能力、保存回读与扩展契约
2026-10-15|本文是开发规格;标“新增”的字段/端点尚未实现。现有接口保持 owner,禁止另造一套调度执行系统。数据 DAG 仍交 DolphinScheduler;页面只编辑、检查和展示证据。
## 1. 六类节点与执行能力矩阵
| 类型 | 当前定义/校验 | 当前执行链证据 | 第一批编辑与运行处理 |
|---|---|---|---|
| BATCH_JOB | referenceId、目录解析和不可变 owner 版本/摘要已有 | S04 owner 回调只处理 QUALITY_RULE/TRANSFORMATION,其余返回 UNSUPPORTED | 可编辑、可保存草稿;显示“执行入口待接通”;发布预检阻止带此节点的执行。补接原批任务 owner 后再启用 |
| CODE_OBJECT | referenceId、目录解析与 owner 摘要已有 | 同上,该 SCHEDULING 固定回调拒绝执行 | 同上;不新增任意脚本/Shell 回调 |
| TRANSFORMATION | 引用与冻结版本已有 | S04 scheduledWriteback 调原转换 owner | 可实施执行接入;源/目标、权限、回读、UNKNOWN 行为仍需实际验收 |
| QUALITY_RULE | 引用不可变规则 snapshotId/hash | S04 QualityRuleExecutionService,冻结阈值后得到 SUCCEEDED/FAILED/UNKNOWN | 可实施;数据不达标与调用故障分别显示,不推导无证据通过率 |
| CONDITION | 定义支持两种 field、三种 operator;两类分支必须存在;不允许环 | S03 仅 PARENT_STATUS + EQ/IN;状态仅 SUCCEEDED/FAILED;多父节点/状态组是 OR | 表单仅允许实际执行子集用于发布;不支持项原样保留为草稿并给定位错误,禁止静默改写 |
| DEPENDENT | 引用 READY 调度及日期偏移 | S03 仅同业务日 offset=0,目标不可变快照必须已有对应外部定义 | 正常编辑;发布前验证引用/范围/版本;不满足则错误定位到此节点 |
上述“可实施”不代表本轮执行通过。S03 白名单额外出现 METRIC_CALCULATION,不意味着 S01 调度编辑契约已支持它;不得擅自加入六类节点列表。
### 条件/策略差异处理
| 配置 | 定义允许 | 当前执行表现 | 必须落实的行为 |
|---|---|---|---|
| PARENT_STATUS EQ/IN SUCCEEDED/FAILED | 允许 | 映射 SUCCESS/FAILURE | 接原适配器;界面写“任一父节点符合所选状态”,避免误称全部父节点 |
| PARENT_STATUS CANCELED/UNKNOWN | 允许 | DS_CONDITION_STATUS_UNSUPPORTED | 草稿可显示,执行预检拒绝,不转成 FALSE/FAILED |
| BUSINESS_DATE_WEEKDAY / NOT_IN | 允许 | DS_CONDITION_MAPPING_UNSUPPORTED | 明示未执行支持;后续扩适配器另列契约 |
| TRUE/FALSE 分支 | 每类至少一条,允许每类多条 | 原生 conditionResult | 用独立端口和真实标签,不把 TRUE 固定解释为“质量通过” |
| 普通节点 DEFAULT 边 | 允许 | 依赖边 | 不允许任意 TRUE/FALSE;AND 汇合先用并行普通任务,不把互斥分支直接拼成 AND 汇合 |
| 依赖 offset 非0 | 定义允许 | DS_DEPENDENCY_OFFSET_UNSUPPORTED | 拒绝执行,保留原值供修正 |
| CRON/API/EVENT/DEPENDENT 触发 | 定义保存四类 | S04 只向集成快照传首个 triggerType;当前适配器未见注册 CRON/EVENT 逻辑 | API submit 可沿原路径;其余显示“已配置,自动触发未确认”,不得称已调度 |
| retryCount/retryInterval/priority/timeout/failureStrategy | 定义有校验 | S03 taskPriority=MEDIUM、failRetryTimes=0、owner timeout=60;start 固定 END/MEDIUM;S04 未把完整策略传入快照 | 新增能力预检:与执行固定值不一致即阻止发布执行;完整映射/契约测试后放开,不默默忽略 |
| calendar/参数格式/排除日期/并发 | 定义存在 | 集成快照只带时区与少量固定运行参数;本链未证实全部生效 | 首批逐项标记 NOT_VERIFIED,不以保存成功显示生效;需扩传递与执行验证 |
| 试运行 | 页面可能需要 | S03 dryRun=0 是真实执行 | “校验定义”无执行;“运行”是有副作用的已授权业务动作。安全沙箱试跑须独立能力,不能重命名 submit |
特别验证:质量阈值失败如何在 DS 的 END 策略下进入条件分支,必须用真实实例和 owner 结果核对;源码配置有分支不证明失败后分支实际继续。UNKNOWN 的 owner 回调可能被外部系统记录成任务失败,页面保留 owner UNKNOWN 与 sourceStatus,不伪装为阈值不达标或自动进入异常整改。
### 新增能力预检(在原 schedules owner 内)
建议新增只读 `GET /api/dataops/v1/schedules/capabilities`:`capabilityVersion, observedAt, definitionTypes, executableTypes, conditionSupport, dependencySupport, strategySupport, limits, unavailableReasons[]`。返回受当前 actor 权限过滤的枚举与约束,不泄露组件地址/secretRef 内容。服务器根据实际 owner/adapter 配置决定,不仅由前端硬编码。
原 `POST /{id}/validate` 扩展 `issues[]`:`code, severity, phase(DEFINITION|REFERENCE|EXECUTION), location, nodeKey?, edgeKey?, message, evidenceRef?`;保留现有 valid/definitionSha256。运行/发布前重新校验能力与引用,不相信客户端旧结果。错误定位例:`/nodes/7/condition/values`、`/edges/4/branchOutcome`、`/strategy/retryCount`。动态不可用应保留草稿,不能删除节点。
## 2. 定义、布局、发布、运行四类对象
| 对象 | 真实含义 | 保存/身份 |
|---|---|---|
| 业务定义 | 节点 nodeKey/type/referenceId/config、边 edgeKey/endpoints/branchOutcome、触发/参数/策略 | 现有 scheduleId + version + definitionSha256;严格复用 ScheduleDefinition,不把图形库内部对象直接提交 |
| 显示布局 | positions、viewport、分组、折叠、固定位置 | 独立 layoutVersion + definitionSha256;坐标不能改变业务 hash;模型已有 layouts 接口,调度需新增 |
| 发布快照 | 经过校验的不可变业务定义及 owner 引用 | 现有 READY/currentSnapshotId/snapshotSha256;新增发布布局绑定,不覆盖历史 |
| 运行实例 | 一次 submit/backfill/rerun 与所引用快照、actor 和外部实例 | 现有 runId/snapshotId/parentRunId/nodeEvidence;运行画布从该 snapshot 读取,不能展示后来修改的草稿 |
共享布局属于业务对象的展示版本;个人平移/缩放可按用户+对象+快照做本地偏好,清除偏好不丢共享布局。第一期分组仅展示,不修改 DAG 执行语义。持久化使用稳定 nodeKey/edgeKey;精确 Long/版本当不透明字符串处理,不通过 Number 转换。
### 调度布局新增草案
沿用模型布局方式,建议 `GET/PUT /api/dataops/v1/schedules/{id}/layout`,写入带 `Idempotency-Key`。模型继续用现有 `/api/governance/v1/model-designs/{id}/layouts/{layer}`,不迁移其已存数据。
```json
{
"expectedLayoutVersion": "7",
"definitionVersion": "12",
"definitionSha256": "<server-readback-hash>",
"positions": [{"nodeKey":"quality_orders","x":320,"y":160,"pinned":false}],
"viewport": {"x":0,"y":0,"zoom":1},
"groups": [{"groupKey":"orders","label":"订单处理","nodeKeys":["quality_orders"]}],
"collapsedNodeKeys": []
}
```
响应:`layoutVersion, definitionSha256, updatedAt, stale, droppedNodeKeys, positions, viewport, groups, collapsedNodeKeys`。服务端限大小、有限坐标/zoom、节点归属、重复 ID 和权限;已有模型限制可复用,调度按自身200节点/500边限制。旧布局节点失效可返回 dropped 列表,不能悄悄删除业务节点。
### 用户动作与回读
1. 打开:GET definition、layout、capabilities;校验 hash 相符。过期布局提示、保留可匹配位置;新节点在空闲区,不打散已有固定位置。
2. 编辑:仅本地草稿。撤销/重做覆盖节点/边/参数/布局的单次用户动作,拖拽结束记一条;撤销不撤回已提交外部执行。复制生成安全 UUID/key 并清空外部运行身份,保留权限允许的引用,需重新验证。
3. 保存:先原 `POST/PUT schedules` 提交业务定义,带 version 和幂等键;回读返回 ID/version/hash;再用该 hash 保存布局。布局失败时明确“流程已保存,布局未保存”,保留本地布局及相同键供对账,不显示全保存成功。
4. 只移动节点:只保存布局,业务版本不变。并发冲突返回409/既有冲突码;提供读取新版本与差异,不自动 last-write-wins。
5. 发布:原 ready 接口扩展可选 expectedLayoutVersion,服务器原子绑定业务 snapshot 与对应布局快照;布局无匹配时由用户看到确定的自动布局后再发布,不能拿错版本。业务发布成功后 GET详情/snapshots 回读。
6. 运行:原 submit 传当前版本、reason、幂等键;明确运行对象与版本,人工点击后执行。结果未知不换新键盲目重试;先按运行记录/request receipt 对账。现有接口若缺幂等键查回执能力,需在原 owner 补查回执端点后支持安全重试。
7. 补数/重跑:沿原 backfill/rerun;明确日期范围、parentRunId、failedNodeKey、影响和原因。现有补数范围1–31天;没有真实失败节点证据不能允许“从任意节点重跑”。
8. 状态同步:原 runs/status-sync;取消离页轮询、有限退避、只展示当前 runId 返回。过期时间/UNKNOWN 明示;不是进度动画推断成功。日志链接必须经原权限受控读取、脱敏,缺链接不拼外部地址。
后端写入最终授权仍由原 controller/owner 执行。AI 生成/采纳、拖拽和快捷键不能绕过。设计态按钮按 capability 显示原因;不能只靠禁用按钮充当后端校验。
## 3. 运行状态与证据归一
保持原 RunStatus,不为美观改后端枚举:PENDING/SUBMITTED/RUNNING/SUCCEEDED/FAILED/CANCELED/UNKNOWN。显示层增加 `reasonKind`,不覆盖原 status/sourceStatus:
- `QUALITY_THRESHOLD`:有 `QUALITY_RULE_THRESHOLD_NOT_MET`、冻结阈值及观测证据才显示“质量不达标”。
- `EXECUTION_ERROR`:适配器调用/资源/配置失败,有错误码;不说“数据不合格”。
- `UNOBSERVED`:无观测或过期;显示未知,不按零/成功处理。
- `UNSUPPORTED`:能力不支持,执行前拒绝;已经失败的历史实例保留实际状态和原因。
每项绑定 `runId, snapshotId, nodeKey, referenceId, ownerVersion, sourceStatus, observedAt, errorCode, evidenceRef`(其中目前未暴露字段属于新增投影)。节点开始/结束/attempt/跳过/等待人工须后端显式证据才展示,不以没有运行记录推断 SKIPPED。不要用“成功节点/总节点”当含分支流程的完成率;先显示节点状态计数和总流程状态。扩展人工节点在没有终态前显示“等待人工”,不得100%。
## 4. 完整治理节点扩展草案
以下是未来新增协议,非现成端点。共用最小 owner 契约:`resolve(reference, actor) → capability + immutable version/hash`;`execute(runId,snapshotId,nodeKey,ownerBinding,idempotencyKey) → executionId + state`;`observe(executionId) → evidence + observedAt`。单次完成不等于整个业务完成,异步操作返回 PENDING/RUNNING;只经批准内部 API/适配器,不直写他域数据库。
| 拟新增节点 | 输入/输出 | 复用 owner 与必要保护 |
|---|---|---|
| METADATA_SCAN | connectorId/version、scopeHash → scanRunId、完成/部分/未知、catalogRevision | metadata-ingestion run/reconcile;完整扫描才可用新结构,部分失败保留旧结构并标未知;重试先对账 |
| ASSET_REGISTER/UPDATE | 明确 entityId/sourceVersion、目标目录、受审查变更 → assetDetailId/登记回执 | asset-detail/catalog;登记、发布分开,幂等按来源事实/操作,不按显示名称去重 |
| CLASSIFICATION_IDENTIFY | 规则版本+字段选择 → candidates/contextHash | security-classification;识别只产生候选 |
| CLASSIFICATION_APPLY | 已审阅候选版本+人工采纳证据 → 原复核回执 | 原 reviews;禁止 AI 自采纳,候选过期必须重新预览 |
| STANDARD_VALIDATE / MASKING | 标准/策略版本+受授权对象 → 结果/失败样本引用 | 先确认现有执行 owner;策略展示不等于已执行。脱敏写入还需目标/预览/结果回读 |
| REMEDIATION_CREATE | 质量validationId+对象+责任范围 → planId/receipt | quality-remediations;相同观测不能重复开单;只创建计划不自动提交修复执行 |
| MANUAL_WAIT | 审批对象/版本/处理主体/超时策略 → decisionRef | D2 待决;存持久化等待状态,不长占worker;决策校验 actor 与版本,重复回调只能恢复一次 |
| ALERT_NOTIFY | 事件/规则版本、授权目标引用 → notificationAttempt/deliveryState | alert-events;提交不等于送达,网络未知先对账,不自动重复通知 |
| LIFECYCLE_ACTION | 资产身份+businessVersion+动作+影响依据 → 原轨迹/快照 | asset-lifecycle;归档业务状态不等于物理删除;破坏性数据操作另外授权 |
人工等待应由所属业务 owner 持有审批状态,DataOps 保存关联与恢复 token;恢复进入已发布快照,不能使用等待期间改过的草稿。超时/拒绝/撤销/转交由 D2 决定,禁止默认当成功。数据 DAG 的后续提交仍走 DolphinScheduler;不用 Spring 自造通用 DAG 引擎。
## 5. 三层建模与 DDL 三阶段
**模型编辑**复用 model-design 独立三层与 definition/versions/drafts/layouts。转换产生候选差异(新增/修改/删除/无法映射),带上游版本、下游基线hash、转换规则版本和人工采纳。多对多关系是否中间表、粒度、逻辑类型到物理类型的不确定项不能默认生成后覆盖。来源字段键/nullable 证据保持,模型声明 FK 不能声称物理库已存在 FK。
**DDL生成/预览(新增)**:另存 change plan,不向现有禁止执行文本的 PhysicalSnapshot 塞 SQL。建议计划字段:`planId, modelVersion, modelHash, targetRef, dialect/version, observedSchemaHash, operations[], ddlHash, impact, expiresAt, reviewState`。由受控方言渲染器生成,不直接执行模型返回的任意文本。计划只读展示 ADD/ALTER/DROP 差异、类型损失、锁/数据影响和不支持项。目标必须明确,不从逆向候选推定正向权限。
**真实落库(新增,D1 后)**:冻结计划+人工确认+目标授权+幂等提交→记录实际执行→回读结构与预期比较。未知结果先查实际 schema/执行记录,不自动再次 CREATE/ALTER。默认拒绝破坏性操作;DDL无法事务回滚的引擎需前向修复与数据备份方案,不能宣称一键回滚。
落库后闭环按可对账步骤:确认结构 → metadata scan → 资产候选登记/人工发布 → 建模来源关联;只有存在 SQL/任务/字段映射事实才生成加工血缘。每步独立幂等与恢复,某步失败不把全链显示为成功。
@@ -0,0 +1,75 @@
# 数据口径、身份与跨模块联动
2026-10-15|显示真实事实优先;无观测、失败、无权限、截断分别表达。所有新字段/聚合在实施时扩原 owner,不浏览器跨域拼全库。
## 1. 质量数据字典
| 显示项 | 已有来源 | 正确口径 / 需补信息 |
|---|---|---|
| 元数据完整性 | md_quality_projection.completeness_score;metadata-quality | 属性/负责人/描述/标签/关联等完整性,明确标题。不是数据准确率、规则通过率 |
| 单规则执行结果 | quality-rule ValidationHistory.status/errorCode/evidenceRef | 区分阈值不达标、执行异常、未知、LEGACY;保留冻结 snapshotId/configSha256 |
| 单规则观测值 | observedValue + thresholdOperator/Value/UpperValue | 根据规则语义显示数值和单位;ROW_COUNT是行数,UNIQUE/NOT_NULL也不能只看名称猜单位 |
| 违规数 | violationCount | ROW_COUNT当前用0/1标记规则违规,不能称“坏记录数”;其他方法需执行语义说明 |
| 通过记录率 | 当前通用 history 没有明确 eligibleRecordCount | 新增分母/度量说明后,(eligible−violations)/eligible;分母0显示“不适用”,不显示100% |
| 规则通过比例 | 明确时间窗内规则观测集合 | 通过规则数/已获得有效终态的适用规则数;同时显示未知/无观测数,不能当记录通过率 |
| 质量趋势 | 同规则同配置版本的 observations | 版本变更断线/分段,不能把阈值变化当数据改善 |
| 数据及时性 | 真实业务到达时间+承诺截止时间 | 执行时间不等于数据新鲜度;没有业务watermark/SLA则不渲染及时性率 |
### 第一版热图聚合规则(建议基线)
- 行=规则+目标对象;列=所属业务时区的业务日期。时区从任务/规则上下文明确传入,不取浏览器默认;无法确定用带UTC说明的观测日期,不能混日。
- 格子默认取该日**最后一次尝试的结果**,优先 observedAt,再用 createdAt 标“仅请求时间”。最后尝试 UNKNOWN 时显示未知,不退回前一次成功绿格。多次观测显示次数,详情按时间列出所有尝试。
- 冻结配置变更在格子显示版本标记,趋势按 configSha256 分段。观测列表分页/截断时标“当前已加载范围”,不算完整日汇总。
- 颜色:通过绿色、阈值不达标橙色、执行故障红色、未知灰色斜纹、无观测空心、无权限无值。文字与图标同步,不只靠颜色。
- 格子详情:规则与对象、业务日/时区、validationId、snapshot/config hash短标识、观测时间、值/单位、阈值、分母、违规语义、证据与整改入口。失败样本只经权限受控接口读取,禁止将敏感样本写进标题/URL。
- 第一版不显示全企业统一质量评分。未来若增加综合评分,必须配置维度/权重、同一人群分母、适用/排除规则和版本,另行评审。
### 新增聚合投影草案
在 quality-rule owner 下新增按授权过滤的观测查询/聚合(路由建议 `GET /quality-rules/observations`,非现成端点):`scope, from, to, timezone, ruleIds, cursor`;响应 `scopeHash, observedAt, truncated, cells[]`。cell 包含 `ruleId, objectRef, businessDate, configHash, attemptCount, latestState, reasonKind, measure{kind,unit,value,eligibleCount,violationCount}, evidenceRef, completeness`。禁止用 N×天逐请求全历史计算全企业热图;单规则详情可先复用既有 validations 接口。
## 2. 统计图选择与缺失数据
现有 ColumnProfile 有 nullCount/nullRate、distinctCount/distinctRate、min/max/average/stddev、topValues、patterns;适合空值条、Top N频数条、模式分布和摘要。topValues不是完整概率分布,min/max/均值/方差不能还原直方图。
| 图形 | 必需新数据 | 显示规则 |
|---|---|---|
| 数值直方图 | bins 的 lower/upper、区间开闭、count,单位、total/eligible/null/invalid/underflow/overflowCount,sampleSize/populationSize、samplingMethod、observedAt | 每条宽度与区间对应;分箱计数对账;近似/抽样标注;数据缺失显示无分箱数据,不造钟形曲线 |
| 箱线图 | q1/median/q3、whisker定义、异常值统计、算法/采样口径 | 不从平均值推导分位数;异常值展示脱敏/限量 |
| 趋势/控制图 | 同口径时间序列、timegrain、时区、样本量、版本 | 缺日留缺口;质量告警阈值不得用装饰性参考线冒充 |
| 类别Top N | topValues及完整/截断标记 | “其他”只在total可对账时计算;遮蔽敏感类别值 |
所有统计优先在受控适配器做聚合并返回统计值,不把全量业务明细拉到浏览器。按源支持/权限决定可用,不为可视化无边界扫描大表。
## 3. 资产身份与可见统计
已有 asset-identities binding-context/bindings/verify/resolve;AssetResolution 状态 MAPPED/UNMAPPED/AMBIGUOUS/UNKNOWN。必须复用此链,不能再建通用“新资产ID”平行系统。
- 视图节点key用 `context + objectType + stableId`;ID/Long不经Number转换;FQN和名称仅用于显示/查找,不能作跨模块等同判断。
- 从 metadata entityId 到 asset-detail、lifecycle、modelDesign、schedule 各用实际绑定/来源引用。无映射只展示已知对象;AMBIGUOUS需选择/核验,不能选第一条;无法访问不给隐藏对象名称和数量。
- deep link携带对象ID及版本/快照/业务日上下文;目标页重新鉴权和读当前状态。返回时恢复原筛选/视角,变更后提示快照可能过期。
- 资产详情既有 DEFINITION/SCHEMA/SOURCE/LINEAGE/QUALITY/SECURITY/USAGE 章节与 evidenceState/reliable/observedAt;空章节说明无观测,不复制六套详情组件。
AssetCatalogOverviewReader 已按可见目录、组织/部门、可靠标记过滤 COUNT(*),并校验范围变化。其计数是**可靠目录登记条目数**,不是已按统一身份去重的企业资产总量。最多1000可见目录的当前限制保留,超过显示不可统计,不退回全部门统计。
新增分组投影建议挂原 asset-catalog owner,输入 `dimension(domain|type|status), filters, cursor`,返回 `scopeHash, asOf, countKind(REGISTRATION|DISTINCT_VERIFIED_IDENTITY), groups[], total, unknownCount, truncated`。同一资产多目录登记要分别说明:登记数可重复,唯一资产数仅对已验证身份去重;未绑定单列。按多值标签分组可重复,不要求分组数之和等于唯一资产总量,界面标“可重复归属”。
catalog AssetType 当前 TABLE/DATASET/FILE/REPORT/API/MODEL;“指标、主数据、标签”在其他 owner 有业务对象,不冒充已在目录枚举。资产地图允许关联探索,但必须注明对象类型和来源;分类汇总通过新增投影对齐。
## 4. 血缘、关系和模型联动
已有 MetadataLineageGraph 包含表级边、字段映射、depth/truncated/observedAt,trace/impact绑定snapshot。先复用;当前实体类型 TABLE/PIPELINE/DASHBOARD。指标有独立 metric-lineage,不能把一个显示名含 metric 的节点直接塞进现有枚举。
新增证据投影建议最小字段:`edgeId, sourceObjectRef, targetObjectRef, sourceFieldRefs[], targetFieldRefs[], relationKind, evidenceKind, evidenceRef, sourceVersion, observedAt, verificationState, expressionSummary?`。证据类型区分执行/解析/声明/物理外键/来源映射;手工声明不是已观测加工事实。表达式摘要经权限脱敏,不能显示秘密SQL字面量。字段多跳采用显式端点关联,字段重命名须版本桥接;映射缺失标未知,不能按同名猜测。
视图范围分三类:已获取快照范围、当前筛选/折叠隐藏范围、源端截断/未采集范围。只统计当前用户有权知道的范围,不暴露被拒绝对象数量。无已知下游≠全系统无影响。关系树隐藏交叉边须显示“分支视图”,网络视图保留所取范围的全部关系。
模型跨层显示 `conceptEntityCode → logicalEntityCode/attributeCode → physicalTableCode/fieldCode` 的真实映射;不可映射项列出,不自动推导。版本对比展示新增/修改/删除及来源证据变化。关系基数是建模声明;物理约束证实状态独立。字段血缘与模型对应关系不是同一类边。
## 5. AI 辅助与审计
复用 AI workbench capability/session/turn/save-intent 和领域 assist。主面板只在已启用、用户有权时出现;密钥由 System Management 的 secretRef 管理;不让画布保存key或执行代码。关闭AI不影响手工建模/编排。
生成流程提案输入只包含用户明确选中的对象引用、版本/上下文hash、可用节点白名单;输出候选 nodes/edges 与未满足项。先展示差异和能力校验,人工采纳到本地草稿;保存、发布、执行仍是独立操作,不串成一次自动调用。
审计最小链:`actor → session/turn/request → proposal/contextHash → adoption(diffHash) → business write receipt/version → publication snapshot → run/evidence`。保存实际发生的动作,不能把“模型说已执行”当回执。对话原文和操作审计分层:原文可含敏感业务信息,需要脱敏/访问/导出/保留策略D3;不承诺永久存全部原文。错误和证据记录不含密码、token、连接串、私钥或真实.env。
@@ -0,0 +1,93 @@
# 视觉、交互与验收规格
2026-10-15|建议设计基线,可供评审;未声明用户已批准最终外观。预览为合成数据、独立静态演示,不是 Vue Flow 产品实现。
## 工作区与组件职责
- 保留 RCP6 全局菜单、查询、表格、分页、表单、Dialog、footer。领域画布进入主内容区,复杂检查用侧栏/Drawer;不改成全屏营销大屏。画布聚焦时收起目录,退出返回原上下文。
- 共享 DgVisualWorkspace 的工具栏、选择上下文、状态、详情约定;按场景分别实现编排、血缘/字段、ER、关系网络。不要给一个通用 CanvasEdge 增加所有领域含义。
- 编排用 Vue Flow 自定义节点、Handle、自定义边,复用 Dagre;关系网络保留 G6;统计 ECharts。现有 package.json 只有 @vue-flow/core,小地图组件若采用需在实施时评估/锁定对应版本,本轮未安装。
- 默认画布尽可能占内容宽度60%以上;宽度不足时目录和检查面板只同时展开一个。工具栏允许换行,文字保持可读。360px预览用完整对象/连接列表,所有节点、映射保留;生产移动端可提供浏览/详情与聚焦,复杂拖拽编辑以桌面为主,不承诺同等手机编辑效率。
## 视觉数值基线
| 元素 | 基线 | 验收点 |
|---|---|---|
| 编排任务卡 | 宽240–280px,常规高112–144px;16px内边距,8px间距体系 | 名称最多2行;长名称在详情完整显示;不挤压端口 |
| 字体 | 100%缩放标题14–15px,辅助12–13px,字段13px | 普通阅读缩放下可读;总览缩小后允许隐藏次要文字,但提供定位到100%,不可把小字当默认 |
| 图标与类型 | 28–32px图标容器,类型用图标+文字+弱色 | 不靠每节点随机配色区分;图标沿项目现有系统 |
| 端口 | 可见10–12px,鼠标命中至少24px;触控操作目标44px | 多端口不叠加,source/target方向明确;真实字段端点不退化成表级线 |
| 连线 | 普通1.5px,选中2–2.5px;方向箭头与文字标签 | 不穿过节点;并行边分轨;长边标签按需显示,选中完整 |
| 状态 | 待运行灰、运行蓝、成功绿、阈值不达标橙、执行故障红、未知灰斜纹 | 文字/图标辅助;FALSE不等于失败;未开始不使用绿点 |
| 选中 | 主色边框与淡背景,相关路径强调,其他节点适度减弱 | 仍可读节点名;键盘焦点与选中有区别 |
| 背景 | 低对比点阵、浅层分组,遵循亮/暗主题 | 不用光效、粒子、持续流动线掩盖图义;遵循减少动画设置 |
## 三张主画布
### 编排
左到右阶段,普通任务输入左/输出右,条件有明确 TRUE/FALSE 端口和表达式;普通汇合表达已有依赖,互斥分支后汇合不擅自假设执行器语义。布局使用真实节点尺寸;固定位置/用户布局优先,手动“整理布局”可撤销。分组第一期只有视觉作用。
节点内容:类型、名称、引用摘要、配置/能力问题、真实运行状态。参数在检查侧栏;校验项点击定位到节点+字段。只读历史实例不能拖改业务定义;当前草稿/已发布版本/实例切换明显。
预览标准样例:20个节点,包括批任务、代码对象、转换、质量、条件、依赖;普通并行3路→汇合、两处真假分支、长名称和终端支路。批任务/代码节点标记执行入口待接通。状态场景含草稿、质量不达标、执行故障、未知;这些是合成状态样本,不能当真实跑通。
### 血缘
默认以选中资产为中心,上游左、下游右,一到两跳。节点区分来源/加工/消费;显示名称+完整名称摘要,不把指标类型强塞当前接口。表级浏览、字段端点路径、影响范围各自有图例。字段展开只展示明确映射字段并说明不是完整schema。选择字段追踪完整已知路径,缺失映射不补猜。
预览保留订单/退款两个来源、明细、汇总、报表;窄屏同样展示全部对象与每条字段连接。公式只在带“演示来源”的示例证据中出现;实际接口无表达式时显示“未提供转换表达式”。
### 关系
中心资产,结构/业务语义/治理责任分区,按语义属性归组,不按数组奇偶决定左右。真实边方向保留;证据区分声明/来源记录/未知。关联类型筛选属于显式视图操作,标明显示数与当前取得范围;不会修改原关系。网络保留交叉边,树视图明确是分支投影。
## 交互与各类状态
| 操作/状态 | 产品行为 |
|---|---|
| 搜索/定位 | 在已授权对象中搜索,聚焦保留当前图;结果完整名可辨重名 |
| 拖拽/缩放/框选 | 平移与节点移动分清;移动结束记历史;点击详情不触发拖动;缩放以鼠标/中心为锚 |
| 连接 | Strict source→target,多端口唯一ID;实时提示自环、重复、环路、错误分支;后端再验 |
| 撤销/重做 | 覆盖当前草稿的节点/边/参数/布局;不撤销已提交运行或外部写入 |
| 保存/离开 | 业务与布局分别脏;保存回读后清理对应脏标记;离开有未保存内容提示 |
| 加载 | 骨架与加载范围;旧快照可保留并标刷新中,不瞬间清空重排 |
| 空 | 无对象给选择入口;有对象但无已知边说明范围;无观测不说“没有依赖” |
| 失败/部分 | 重试只重读;保留已读内容和时间;截断/部分可见有明确标识 |
| 无权限 | 显示允许知道的拒绝原因,不给隐藏对象名称、数量、tooltip、导出内容 |
| 保存冲突 | 提供远端版本与本地差异;不覆盖他人修改,不丢本地草稿 |
| 键盘 | 所有工具可键盘访问,Esc取消连线/关闭检查;Ctrl/Cmd+Z草稿撤销;输入框内不劫持编辑快捷键 |
| 动效 | 只用于焦点/布局过渡;状态更新根据证据,不用循环动画假装运行 |
## 真实业务验收清单(全部待开发后执行)
| ID | 场景 / 操作 | 通过证据 |
|---|---|---|
| AC01 | 打开真实血缘/关系图、长名称同名对象 | 1366/1440及宽屏截图,完整名可辨;布局不重叠,主画布可读 |
| AC02 | 表/字段切换,选择两个来源字段,追踪下游 | UI端点与快照fieldMappings逐条一致;截断/缺失不伪造 |
| AC03 | 窄屏/收起面板/缩放/展开 | 节点/边数据集合保持;筛选隐藏明确计数,权限隐藏不泄露 |
| AC04 | 关系网络/树/类型筛选、交叉边 | 网络保留交叉边;树标分支;方向、关系类型和声明依据一致 |
| AC05 | 六类节点建图,保存→关闭→重开 | 原定义/version/hash与回读一致;位置保持;BATCH/CODE执行限制可见 |
| AC06 | 添加自环、环路、重复ID、缺真假分支 | 即时字段定位;直接API提交仍拒绝;合法多TRUE/多FALSE不误拒 |
| AC07 | 条件weekday/NOT_IN/UNKNOWN、依赖offset、未映射策略 | 预检明确拒绝执行;原草稿不被偷偷改写;可支持配置真实验证 |
| AC08 | 编辑后发布,再改草稿,查看旧实例 | 实例始终绑定旧snapshot与发布布局;不展示新节点/新参数 |
| AC09 | 业务保存成功而布局失败、并发409、响应丢失 | 分项状态正确;同幂等请求回执可对账;无重复创建、无草稿丢失 |
| AC10 | transformation/quality真实调用;阈值不达标、执行错误、UNKNOWN | owner与DS证据、sourceStatus、时间一致;实际验证失败条件分支及END行为 |
| AC11 | 补数/节点重跑/未知请求重试 | 日期范围、原实例、失败节点证据正确;不重复外部执行 |
| AC12 | 质量同日多次、末次未知、零分母、版本变更、缺日 | 格子与history可对账,不伪绿、不跨口径连线,无整体假评分 |
| AC13 | 资产重复目录/未绑定/歧义、两个权限用户 | 登记数/唯一资产数明确;列表、图、搜索、导出、统计都无越权信息 |
| AC14 | 三层转换候选与差异,物理未证实外键 | 不静默覆盖;保存version/sourceEvidence一致;没有DDL接口不显示已建表 |
| AC15 | AI关闭、生成不采纳、采纳后对象版本变化 | 手工可用;不自动保存/执行;过期候选需重审,审计链完整 |
| AC16 | 新治理节点幂等/人工等待/审批重复回调 | 仅在D批实现后验收;同观测不重复工单/通知;等待不显示完成 |
| AC17 | DDL预览/漂移/未知回执/部分闭环失败 | 仅E批授权后;计划/目标hash匹配,回读与恢复有证据;不自动DROP |
## 复杂图与性能目标
目标设备/浏览器在实施时记录型号、CPU/内存、版本、视窗与缩放;以下是目标,非已测成绩:
- 基准:20节点约24边,100节点约200边,调度上限200节点500边;关系上限200节点400边;字段图至少20表×50字段的密集案例,默认折叠。
- 20节点数据就绪后首次可交互目标≤2s;普通拖拽/缩放帧耗时p95目标≤22ms。网络耗时另计,同时报告用户总等待时间。
- 200节点无崩溃/无静默丢失;响应超过目标时采取按需字段/标签、局部展开和增量更新,不能调低数据上限后称通过。通用画布500节点/4000边的校验限制不等于性能承诺。
- 连续切换图/resize/展开20次,不重复事件监听或累积实例;选中、位置与视角稳定。记录资源趋势,不把静态HTML性能套到Vue Flow产品。
实施按受影响范围执行 script/quality/check.sh;源码测试、前端构建、部署身份、API回读、Browser、RBAC和人工UAT分别记录。此次仅准备文件与预览检查,不跑全仓业务测试。
@@ -0,0 +1,102 @@
# 可视化改造准备交付记录
2026-10-15|结果:**PASS_WITH_LIMITATION**。需求追溯、能力/保存契约、数据口径、视觉与验收规格及新版设计预览已生成。独立合成预览已补充桌面、窄屏六场景浏览器检查,并修复与复核定位后的底部提示。业务开发未开始;实际系统功能验收尚未执行。
## 交付文件与使用入口
- `00-开发准备入口.md`:唯一准备阅读入口,批次依赖和集中待决事项。
- `01-需求追溯与范围.md`:33项原始/扩展目标追溯、各域源码索引、其他可视化机会与官方参考。
- `02-执行与保存契约.md`:六类节点及实际执行限制;定义/布局/发布/实例;新增治理节点与DDL分阶段。
- `03-数据口径与跨模块联动.md`:质量观测、分母/时间/缺失值、分布数据、资产身份统计、证据与AI审计。
- `04-视觉规格与验收.md`:三张主画布、视觉数值基线、17组业务验收案例、复杂图/性能目标。
- `datagov-visual-concepts.html`:修订后的六场景独立设计预览,合成数据,不连接系统API。
- `preparation-record.json`:机器可读状态、预览图数量、检查和未测边界。
- 旧预览原件曾单次备份于 `backup/datagov-visual-concepts.before-preparation.html`,已在 2026-10-22 项目清理中移除;当前预览与规格保留。原 research-record.json 保持旧研究事实,未覆盖。
## 已处理的复审问题
| 复审问题 | 本轮处理 | 尚不能宣称 |
|---|---|---|
| 节点能力过度承诺 | 逐节点区分定义/执行;新增采集、整改、资产、人工等待目标保留 | 六类调度已全部执行跑通 |
| 配置与执行器差异 | 补出条件值、日期偏移、触发、策略和回调限制与预检规格 | 配置保存即生效;失败条件分支已实测 |
| 概念稿不够指导开发 | 20节点/21边、6类节点、并行汇合、两组真假分支、长名称、异常样本 | 静态预览是Vue Flow成品/性能证据 |
| 旧预览窄屏丢信息 | 完整对象列表加全部连接;360px预览实测保留20节点/21连接 | 窄屏图形编辑、全部滚动内容和真实系统已验收 |
| 字段线与选择问题 | 明确字段端点;金额/退款字段分别沿显式映射追踪 | 真实系统已有公式或全链路字段证据 |
| 绿点/假进度 | 待运行用灰色空心;异常/未知独立;移除进度百分比 | 没观测的节点可推断为跳过/成功 |
| 质量/模型误导 | 质量热图改观测结果,不造分布;三层属性不同,DDL未执行 | 企业质量分、直方图或建表能力已接入 |
| 关系布局分组错误 | 结构/业务/治理按属性分组,保留责任交叉边 | 静态样例证明200节点布局效果 |
| 保存与权限缺口 | 写明两阶段保存回读、冲突/幂等、版本绑定、原身份解析复用 | 新接口已经实现、RBAC已经通过 |
| 实施范围不清 | 入口列A–E批次,D1–D3仅后续产品选择,原完整目标不删除 | 用户已批准所有外观或DDL/人工等待政策 |
## 实际验证与限制
| 证据层 | 结果 | 本轮实际执行 |
|---|---|---|
| 当前项目源码/接口核对 | PASS_WITH_LIMITATION | 读取 README、入口、相关前端API/图组件、调度Policy/Service/adapter/callback、质量/模型/资产owner;不把定义与执行支持等同 |
| 指定研究文件检查 | PASS | script/quality/check.sh --files 显式检查准备文档、HTML和JSON;不重跑业务构建 |
| JavaScript语法 | PASS | 固定 Node v24.19.0,提取脚本后 node --check;不安装依赖 |
| 合成图数据结构 | PASS | 无DOM纯函数检查:20节点21边、六类、无环、真假分支、2个未接通回调;异常样本状态区分 |
| 字段/关系/模型示例结构 | PASS | 血缘6对象7字段边;订单金额路径4边、退款路径3边;未知字段0边;表/字段对象集相同;关系7对象7边;三层属性分离 |
| 无业务写入副作用 | PASS(源码边界) | 预览无fetch/XHR/WebSocket/存储API;只有本地展示状态;不声称实际网络抓包验证 |
| 本地预览服务 | PASS(服务层) | 官方render.py在127.0.0.1:59641提供独立预览;服务可用不等于页面渲染通过 |
| 早期浏览器尝试(历史) | BLOCKED | 本任务cua.getState返回apps=[]、browsers=[];createBrowserTab报Browser is not available: iab。主任务首次独立辅助检查同样无可用浏览器;保留该历史事实 |
| 后续独立预览Browser | PASS_WITH_LIMITATION | 主任务协调既有受支持浏览器:1280×720与360×800均点击六场景;检查工作流20节点/21边、长名称定位、异常/未知样本、订单4边/退款3边字段路径、关系筛选及模型/质量/资产示例 |
| 窄屏响应式 | PASS_WITH_LIMITATION | 外层360px、预览内宽328px;文档宽度未超过内视口。工作流与血缘转完整对象/连接列表;不代表窄屏图形编辑已实现或验收 |
| 定位后底部提示修复 | PASS | 提示统一随当前缩放更新;脚本语法及6项函数检查通过。第二次Browser仅复核“总览约21%→定位100%”:底部立即变为100%阅读视角,无总览残留;未重复六场景检查 |
| 截图 | PASS_WITH_LIMITATION | 外部证据目录有13张首轮截图及1张定向复核截图;均为真实浏览器视口截图,非完整滚动内容,本研究目录不复制图片 |
| 亮暗主题矩阵/仅键盘/拖动与撤销完整行为/大图性能 | NOT_RUN | 本次浏览器证据没有覆盖,不从源码存在对应控件推导通过 |
| 真实线上页面/业务API运行/RBAC/运行证据 | NOT_RUN | 本轮仅准备,不登录或执行业务动作 |
| 业务测试/生产构建/部署/人工UAT | NOT_RUN | 未修改业务源码;没有部署或验收授权推导 |
浏览器已核对上述场景切换、对象/字段选择、路径及关系筛选、总览与定位;首轮记录的console为空,仅表示该次检查未记录错误/警告。小地图完整交互、拖动与撤销完整行为仍未测。框选、编辑连线、参数保存、完整撤销重做、发布、执行、API持久化不在静态预览中实现,已列入产品规格与验收。
## 新增浏览器证据与修复
首轮证据:[browser-check-20261015.json](/Users/apple/Documents/Codex/2026-10-14/realtime-voice-chat/outputs/DataGov/preview-evidence/browser-check-20261015.json),SHA256为`018caa1dc7c05023b0f5a011f5648eddd06b26f910b8282feb4b81e0770c0f6a`。该检查发生在底部提示修复前;当时预览SHA256为`b3e66c777d7a986d8455c82b72728864e08d44f6040087c145c8f5449e9575c8`(由本任务制品记录关联,证据JSON本身未包含制品哈希)。
代表截图:[工作流总览](/Users/apple/Documents/Codex/2026-10-14/realtime-voice-chat/outputs/DataGov/preview-evidence/workflow-desktop-overview.png)、[长名称100%阅读](/Users/apple/Documents/Codex/2026-10-14/realtime-voice-chat/outputs/DataGov/preview-evidence/workflow-desktop-long-name.png)、[窄屏字段映射列表](/Users/apple/Documents/Codex/2026-10-14/realtime-voice-chat/outputs/DataGov/preview-evidence/lineage-mobile-360-mappings.png)。总览约21%仅用于观察结构,长名称需定位到100%阅读;窄屏以完整列表保留语义,不呈现桌面图形连线。
首轮发现:总览后定位虽恢复100%,底部仍残留总览说明。修复将底部提示集中到视口更新函数,覆盖定位、缩放、总览、重绘与窄屏切换;不改节点、边及业务接口。当前HTML SHA256为`19d36f3542f6323296e231ace11badb7cedec78b981ccbb336cf2daa779d9653`。
修正版定向复核:[workflow-footer-fix-20261015.json](/Users/apple/Documents/Codex/2026-10-14/realtime-voice-chat/outputs/DataGov/preview-evidence/workflow-footer-fix-20261015.json),SHA256为`a5843c43387ae562112ed0c2ea8f5fdd46912c23882f30ba47565071840c9844`;[视口截图](/Users/apple/Documents/Codex/2026-10-14/realtime-voice-chat/outputs/DataGov/preview-evidence/workflow-footer-fix-20261015.png)。底部文本结论来自JSON中的浏览器可访问性快照,截图未覆盖视口外的底部。复核独立执行后已关闭该浏览器标签,无业务操作;不能扩展成六场景、主题或性能的再次验收。
## 检查命令
```bash
./script/quality/check.sh --files \
docs/research/visualization-redesign-20261015/00-开发准备入口.md \
docs/research/visualization-redesign-20261015/01-需求追溯与范围.md \
docs/research/visualization-redesign-20261015/02-执行与保存契约.md \
docs/research/visualization-redesign-20261015/03-数据口径与跨模块联动.md \
docs/research/visualization-redesign-20261015/04-视觉规格与验收.md \
docs/research/visualization-redesign-20261015/05-准备交付记录.md \
docs/research/visualization-redesign-20261015/datagov-visual-concepts.html \
docs/research/visualization-redesign-20261015/preparation-record.json
```
初次准备执行时分两批检查:00–04与预览先检查;生成记录和最后窄屏日期标签调整后,只复查变更的HTML/05/JSON。新增浏览器证据及底部提示修复后,同样仅检查这3个文件:
```bash
./script/quality/check.sh --files \
docs/research/visualization-redesign-20261015/datagov-visual-concepts.html \
docs/research/visualization-redesign-20261015/05-准备交付记录.md \
docs/research/visualization-redesign-20261015/preparation-record.json
```
语法/合成图检查为临时纯函数检查,不增加产品测试或新依赖。提示修复另覆盖总览、定位、50%缩放、100%恢复、窄屏和筛选计数6项函数断言;与实际Browser定向复核分开记录。
## 预览与恢复
本轮结束时保留只读临时服务 `http://127.0.0.1:59641/` 供当前用户评审;它不是业务服务,不接数据源。进程结束后URL会失效,HTML源码和会话内预览仍保留。重新查看可执行:
```bash
python3 /Users/apple/.codex/plugins/cache/openai-bundled/visualize/1.0.29/skills/visualize/scripts/render.py \
/Users/apple/Documents/AiXun-DataGov/docs/research/visualization-redesign-20261015/datagov-visual-concepts.html \
--serve --port 59641
```
关闭仅停止本次预览进程,不操作业务容器或其他项目。2026-10-22 已清理旧设计示例及本记录/JSON的修订前备份,不再将 backup 作为当前恢复入口;保留当前预览、规格和验收记录,详见[项目清理交付](../../runbook/项目轻量清理-20261022.md)。本预览未修改业务源文件、数据库、依赖、配置、真实.env、保护备份ZIP,不需要系统回滚。
## 开始开发前的剩余事项
规格、静态准备和有边界的桌面/窄屏预览检查已完成;亮暗主题矩阵、仅键盘操作、拖动与撤销完整行为、大图性能及真实系统功能验收仍为NOT_RUN。D1(DDL目标与边界)、D2(人工等待规则)、D3(AI内容保留期)只阻塞对应后续批次,不阻塞A与B1设计准备。停止在准备开发状态,等待用户讨论/实施指令。
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 78 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 77 KiB

@@ -0,0 +1,86 @@
<div id="dg-visual-review" aria-label="艾讯数据治理画布设计评审">
<header class="dv-top"><div class="dv-brand"><span class="dv-mark">A</span>艾讯数据治理<span class="dv-muted">工作空间</span></div><span class="dv-demo">设计评审 · 全部为合成数据 · 不连接系统</span></header>
<div class="dv-shell">
<nav class="dv-nav" aria-label="设计场景"><span class="dv-nav-caption">数据工作空间</span><button data-page="workflow">▱ 任务编排</button><button data-page="lineage">⇢ 血缘分析</button><button data-page="relations">⌘ 关系图谱</button><button data-page="model">▤ 模型设计</button><button data-page="quality">▥ 质量洞察</button><button data-page="atlas">▦ 资产地图</button><span class="dv-nav-end">交易主题<br>示例工作组</span></nav>
<main class="dv-main"><div class="dv-heading"><div><div id="dv-breadcrumb" class="dv-muted"></div><h2 id="dv-title"></h2></div><span id="dv-context" class="dv-chip"></span></div>
<div id="dv-scene-tools" class="dv-tools"></div>
<div id="dv-canvas-tools" class="dv-tools"><div class="dv-button-group"><button data-action="zoom-out" aria-label="缩小">−</button><span id="dv-zoom"></span><button data-action="zoom-in" aria-label="放大">+</button><button data-action="fit">总览</button><button data-action="focus">定位选中</button><button data-action="layout">恢复布局</button><button data-action="undo">撤销移动</button></div><label class="dv-search">定位对象<select id="dv-search" aria-label="定位对象"></select></label></div>
<section id="dv-stage" aria-label="设计画布"></section>
<div id="dv-footer" class="dv-footer" aria-live="polite"></div>
<section id="dv-inspector" class="dv-inspector" aria-live="polite"></section>
</main>
</div>
</div>
<style>
#dg-visual-review{--dv-bg:light-dark(#f3f6fb,#101823);--dv-panel:light-dark(#fff,#192333);--dv-ink:light-dark(#22324a,#e5edf8);--dv-muted:light-dark(#66768b,#b0bfd2);--dv-border:light-dark(#dce4ef,#35475c);--dv-soft:light-dark(#edf2f8,#243247);--dv-primary:light-dark(#4264d6,#9bb5ff);--dv-primary-soft:light-dark(#eaf0ff,#293b64);--dv-green:light-dark(#197464,#7cdbbf);--dv-green-soft:light-dark(#eaf7f2,#183f37);--dv-orange:light-dark(#9c6016,#efbe78);--dv-orange-soft:light-dark(#fff3e2,#44341e);--dv-red:light-dark(#b44451,#ffadb3);--dv-red-soft:light-dark(#fff0f1,#4a2831);--dv-purple:light-dark(#7951b1,#c9acf5);--dv-purple-soft:light-dark(#f2edfa,#3a2e4b);--dv-radius:10px;color-scheme:light dark;font-family:Inter,-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;font-size:13px;line-height:1.5;color:var(--dv-ink);background:var(--dv-bg);width:100%;border:1px solid var(--dv-border);border-radius:12px;overflow:hidden}
#dg-visual-review *{box-sizing:border-box}#dg-visual-review button,#dg-visual-review select{font:inherit;color:inherit;cursor:pointer}#dg-visual-review button{background:var(--dv-panel);border:1px solid var(--dv-border);border-radius:6px;padding:6px 10px}#dg-visual-review button:hover{border-color:var(--dv-primary)}#dg-visual-review button:focus-visible,#dg-visual-review select:focus-visible{outline:2px solid var(--dv-primary);outline-offset:3px}#dg-visual-review button[aria-pressed=true]{color:var(--dv-primary);background:var(--dv-primary-soft);border-color:var(--dv-primary)}#dg-visual-review button:disabled{cursor:default;opacity:.5}#dg-visual-review h2,#dg-visual-review h3,#dg-visual-review p{margin:0;font-weight:400}#dg-visual-review strong{font-weight:500}#dg-visual-review h2{font-size:22px;font-weight:500;margin-top:4px}#dg-visual-review .dv-muted{color:var(--dv-muted);font-size:12px}
#dg-visual-review .dv-top{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;min-height:58px;padding:12px 18px;background:var(--dv-panel);border-bottom:1px solid var(--dv-border)}#dg-visual-review .dv-brand{display:flex;gap:10px;align-items:center;font-size:15px;font-weight:500}#dg-visual-review .dv-mark{width:28px;height:28px;border-radius:7px;display:grid;place-items:center;background:var(--dv-primary);color:var(--dv-panel)}#dg-visual-review .dv-demo{font-size:11px;color:var(--dv-orange);padding:4px 8px;background:var(--dv-orange-soft);border-radius:5px}#dg-visual-review .dv-shell{display:grid;grid-template-columns:138px minmax(0,1fr)}#dg-visual-review .dv-nav{display:flex;flex-direction:column;gap:6px;padding:18px 10px;background:var(--dv-panel);border-right:1px solid var(--dv-border)}#dg-visual-review .dv-nav-caption{font-size:11px;color:var(--dv-muted);padding:6px 8px 12px}#dg-visual-review .dv-nav button{text-align:left;border-color:transparent;background:transparent;padding:10px}#dg-visual-review .dv-nav button[aria-pressed=true]{background:var(--dv-primary-soft);color:var(--dv-primary)}#dg-visual-review .dv-nav-end{font-size:12px;color:var(--dv-muted);padding:40px 10px 12px;margin-top:auto}#dg-visual-review .dv-main{padding:20px 18px 16px;min-width:0}#dg-visual-review .dv-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px}#dg-visual-review .dv-chip{font-size:11px;border:1px solid var(--dv-border);padding:4px 8px;border-radius:5px;background:var(--dv-panel);white-space:nowrap}#dg-visual-review .dv-tools{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:9px;margin-bottom:10px}#dg-visual-review .dv-tools select{max-width:100%;padding:6px;border:1px solid var(--dv-border);border-radius:6px;background:var(--dv-panel)}#dg-visual-review .dv-button-group{display:flex;flex-wrap:wrap;gap:5px;align-items:center}#dg-visual-review .dv-button-group button{font-size:12px}#dg-visual-review .dv-search{font-size:12px;display:flex;align-items:center;gap:6px;min-width:0;max-width:100%}#dg-visual-review .dv-search select{max-width:230px;min-width:0}#dg-visual-review #dv-zoom{min-width:39px;text-align:center;font-size:12px}
#dg-visual-review #dv-stage{border:1px solid var(--dv-border);border-radius:var(--dv-radius);background:var(--dv-panel);position:relative;min-width:0}#dg-visual-review .dv-viewport{position:relative;overflow:hidden;height:620px;touch-action:none;background-image:radial-gradient(var(--dv-border) .8px,transparent .8px);background-size:20px 20px;cursor:grab}#dg-visual-review .dv-world{position:absolute;left:0;top:0;transform-origin:0 0;width:3800px;height:1300px}#dg-visual-review .dv-edges{position:absolute;inset:0;width:3800px;height:1300px;overflow:visible;pointer-events:none}#dg-visual-review .dv-edge{pointer-events:stroke;cursor:pointer}#dg-visual-review .dv-edge path{fill:none;stroke:var(--dv-muted);stroke-width:1.5}#dg-visual-review .dv-edge text{font-size:12px;fill:var(--dv-ink)}#dg-visual-review .dv-edge rect{fill:var(--dv-panel)}#dg-visual-review .dv-edge.dv-emphasis path{stroke:var(--dv-primary);stroke-width:2.5}#dg-visual-review .dv-edge.dv-faded{opacity:.25}#dg-visual-review .dv-group-label{position:absolute;font-size:12px;color:var(--dv-muted);letter-spacing:.03em;background:var(--dv-soft);padding:4px 9px;border-radius:5px}
#dg-visual-review .dv-node{position:absolute;width:244px;background:var(--dv-panel);border:1px solid var(--dv-border);border-radius:var(--dv-radius);box-shadow:0 3px 10px light-dark(#2941630b,#0002);user-select:none;color:var(--dv-ink)}#dg-visual-review .dv-node.dv-selected{border-color:var(--dv-primary);box-shadow:0 0 0 3px var(--dv-primary-soft)}#dg-visual-review .dv-node.dv-faded{opacity:.45}#dg-visual-review .dv-node.dv-error{border-color:var(--dv-red)}#dg-visual-review .dv-node-head{width:100%;display:flex;gap:10px;text-align:left;align-items:flex-start;border:0!important;background:transparent!important;padding:14px 14px 10px!important;min-height:74px;cursor:grab!important}#dg-visual-review .dv-node-icon{display:grid;place-items:center;width:30px;height:30px;flex:none;font-size:12px;border-radius:7px;color:var(--dv-primary);background:var(--dv-primary-soft)}#dg-visual-review .dv-node-icon.condition{color:var(--dv-purple);background:var(--dv-purple-soft)}#dg-visual-review .dv-node-icon.quality{color:var(--dv-green);background:var(--dv-green-soft)}#dg-visual-review .dv-node-copy{min-width:0}#dg-visual-review .dv-node-copy strong{display:block;font-size:14px;line-height:1.4;overflow-wrap:anywhere}#dg-visual-review .dv-node-copy small{display:block;color:var(--dv-muted);font-size:12px;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:173px}#dg-visual-review .dv-node-meta{padding:7px 12px;border-top:1px solid var(--dv-border);display:flex;gap:6px;align-items:center;font-size:11px;min-height:32px;flex-wrap:wrap}#dg-visual-review .dv-state{display:inline-flex;gap:5px;align-items:center;color:var(--dv-muted)}#dg-visual-review .dv-state:before{content:'○';font-size:12px}#dg-visual-review .dv-state.success{color:var(--dv-green)}#dg-visual-review .dv-state.success:before{content:'✓'}#dg-visual-review .dv-state.running{color:var(--dv-primary)}#dg-visual-review .dv-state.running:before{content:'◷'}#dg-visual-review .dv-state.threshold{color:var(--dv-orange)}#dg-visual-review .dv-state.threshold:before{content:'!'}#dg-visual-review .dv-state.failure{color:var(--dv-red)}#dg-visual-review .dv-state.failure:before{content:'×'}#dg-visual-review .dv-state.unknown:before{content:'?'}#dg-visual-review .dv-capability{color:var(--dv-orange);margin-left:auto;font-size:11px}#dg-visual-review .dv-field{display:flex;width:100%;justify-content:space-between;align-items:center;border:0!important;border-top:1px solid var(--dv-border)!important;border-radius:0!important;padding:7px 12px!important;height:34px;text-align:left;background:transparent!important;font-size:12px!important}#dg-visual-review .dv-field.dv-picked{background:var(--dv-primary-soft)!important;color:var(--dv-primary)}#dg-visual-review .dv-field small{font-size:11px;color:var(--dv-muted)}#dg-visual-review .dv-port{position:absolute;width:10px;height:10px;border:2px solid var(--dv-muted);background:var(--dv-panel);border-radius:50%;top:48px;left:-6px}#dg-visual-review .dv-port.out{left:auto;right:-6px;border-color:var(--dv-primary)}#dg-visual-review .dv-port-label{position:absolute;right:12px;font-size:11px;color:var(--dv-purple)}
#dg-visual-review .dv-minimap{position:absolute;bottom:12px;right:12px;width:142px;height:74px;border:1px solid var(--dv-border);background:var(--dv-panel);border-radius:7px;cursor:pointer}#dg-visual-review .dv-mini-node{fill:var(--dv-soft);stroke:var(--dv-muted);stroke-width:1}#dg-visual-review .dv-mini-selected{fill:var(--dv-primary)}#dg-visual-review .dv-mini-window{fill:var(--dv-primary-soft);fill-opacity:.3;stroke:var(--dv-primary);stroke-width:2}#dg-visual-review .dv-legend{padding:10px 12px;display:flex;align-items:center;gap:16px;flex-wrap:wrap;border-top:1px solid var(--dv-border);font-size:11px;color:var(--dv-muted)}#dg-visual-review .dv-footer{padding:10px 1px;font-size:12px;color:var(--dv-muted);overflow-wrap:anywhere}#dg-visual-review .dv-inspector{padding:16px;background:var(--dv-panel);border:1px solid var(--dv-border);border-radius:var(--dv-radius);display:grid;grid-template-columns:minmax(150px,1fr) minmax(0,2fr);gap:12px}#dg-visual-review .dv-inspector h3{font-size:14px;font-weight:500;overflow-wrap:anywhere}#dg-visual-review .dv-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px 18px}#dg-visual-review .dv-detail-grid div{min-width:0;overflow-wrap:anywhere}#dg-visual-review .dv-detail-grid small{display:block;color:var(--dv-muted);font-size:11px;margin-bottom:3px}
#dg-visual-review .dv-list{padding:12px;display:grid;gap:10px}#dg-visual-review .dv-list .dv-node{position:relative;left:auto!important;top:auto!important;width:100%;box-shadow:none}#dg-visual-review .dv-list .dv-node-copy small{max-width:none;white-space:normal;overflow-wrap:anywhere}#dg-visual-review .dv-list .dv-port,#dg-visual-review .dv-list .dv-port-label{display:none}#dg-visual-review .dv-connections{padding:10px;border-top:1px solid var(--dv-border);display:grid;gap:7px}#dg-visual-review .dv-connections button{text-align:left;overflow-wrap:anywhere;font-size:12px}#dg-visual-review .dv-panel-content{padding:18px}#dg-visual-review .dv-heat{display:grid;grid-template-columns:130px repeat(7,minmax(0,1fr));gap:5px;align-items:center;margin:18px 0}#dg-visual-review .dv-heat>span{font-size:12px;color:var(--dv-muted)}#dg-visual-review .dv-heat button{padding:8px 2px;font-size:12px;min-height:38px}#dg-visual-review .dv-heat button.ok{background:var(--dv-green-soft);color:var(--dv-green)}#dg-visual-review .dv-heat button.bad{background:var(--dv-orange-soft);color:var(--dv-orange)}#dg-visual-review .dv-heat button.err{background:var(--dv-red-soft);color:var(--dv-red)}#dg-visual-review .dv-heat button.unknown{background:repeating-linear-gradient(135deg,var(--dv-soft) 0 4px,var(--dv-panel) 4px 8px)}#dg-visual-review .dv-empty{padding:22px;border:1px dashed var(--dv-border);border-radius:8px;color:var(--dv-muted);font-size:12px;margin-top:14px}#dg-visual-review .dv-atlas{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:18px}#dg-visual-review .dv-domain{border:1px solid var(--dv-border);border-radius:10px;background:var(--dv-bg);padding:14px;min-width:0}#dg-visual-review .dv-domain h3{display:flex;justify-content:space-between;font-size:15px;margin-bottom:14px}#dg-visual-review .dv-domain button{display:block;text-align:left;width:100%;padding:12px;margin-top:9px}#dg-visual-review .dv-domain small{display:block;color:var(--dv-muted);font-size:11px;margin-top:6px}#dg-visual-review .dv-domain .dv-state{font-size:11px;margin-top:7px}
#dg-visual-review .dv-world,#dg-visual-review .dv-edges{width:5200px}#dg-visual-review .dv-node-head{height:88px;min-height:88px}#dg-visual-review .dv-port-label{right:-28px}
@media(max-width:850px){#dg-visual-review .dv-shell{grid-template-columns:1fr}#dg-visual-review .dv-nav{flex-direction:row;flex-wrap:wrap;border-right:0;border-bottom:1px solid var(--dv-border);padding:8px;gap:3px}#dg-visual-review .dv-nav-caption,#dg-visual-review .dv-nav-end{display:none}#dg-visual-review .dv-nav button{padding:7px 9px;font-size:12px}#dg-visual-review .dv-main{padding:16px 12px}#dg-visual-review .dv-atlas{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){#dg-visual-review .dv-top{padding:12px}#dg-visual-review .dv-main{padding:14px 10px}#dg-visual-review .dv-heading{flex-wrap:wrap}#dg-visual-review h2{font-size:20px}#dg-visual-review .dv-inspector{grid-template-columns:1fr;padding:12px}#dg-visual-review .dv-detail-grid{grid-template-columns:1fr}#dg-visual-review .dv-search select{max-width:220px}#dg-visual-review .dv-atlas{grid-template-columns:1fr;padding:12px}#dg-visual-review .dv-heat{grid-template-columns:84px repeat(7,minmax(0,1fr));gap:3px}#dg-visual-review .dv-heat>span{font-size:11px}#dg-visual-review .dv-heat button{font-size:11px;padding:6px 0;min-height:34px}#dg-visual-review .dv-panel-content{padding:12px}}
@media(prefers-reduced-motion:reduce){#dg-visual-review *{transition:none!important;animation:none!important}}
</style>
<script>
(()=>{
const root=document.getElementById('dg-visual-review'),stage=root.querySelector('#dv-stage'),scene=root.querySelector('#dv-scene-tools'),canvasTools=root.querySelector('#dv-canvas-tools'),inspector=root.querySelector('#dv-inspector'),footer=root.querySelector('#dv-footer'),search=root.querySelector('#dv-search');
const state={page:'workflow',scenario:'draft',lineage:'fields',relation:'all',layer:'logical',selected:'n08',field:null,selectedEdge:null,view:{x:0,y:0,z:1},positions:{},history:[],theme:'跟随系统',radius:10};
const esc=v=>String(v).replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
const types={BATCH_JOB:'批任务',CODE_OBJECT:'代码对象',TRANSFORMATION:'转换',QUALITY_RULE:'质量规则',CONDITION:'条件',DEPENDENT:'依赖'};
const statusText={pending:'待运行',success:'已完成(示例)',running:'运行中(示例)',threshold:'质量不达标(示例)',failure:'执行故障(示例)',unknown:'观测未知(示例)'};
const baseWorkflow=[
['n01','依赖上游业务日就绪','DEPENDENT',40,260],['n02','同步订单与退款原始数据','BATCH_JOB',360,260],['n03','统一业务日期与金额类型','TRANSFORMATION',680,260],
['n04','订单状态与取消标记标准化','TRANSFORMATION',1000,40],['n05','退款与支付时间窗口归一化','TRANSFORMATION',1000,260],['n06','跨渠道客户标识与组织归属映射','TRANSFORMATION',1000,480],
['n07','汇合三个转换结果','TRANSFORMATION',1320,260],['n08','订单金额完整性校验','QUALITY_RULE',1640,260],['n09','父节点是否成功','CONDITION',1960,260],
['n10','生成订单业务明细','TRANSFORMATION',2280,40],['n11','明细业务主键唯一性','QUALITY_RULE',2600,40],['n12','唯一性检查结果判定','CONDITION',2920,40],
['n13','计算每日渠道成交与净支付口径','CODE_OBJECT',3240,40],['n14','标准化报表输出字段','TRANSFORMATION',3560,40],['n15','输出记录数核验','QUALITY_RULE',3880,40],
['n16','生成下游交付数据集','TRANSFORMATION',4200,40],['n17','归并已核验交付批次','TRANSFORMATION',4520,40],['n18','整理重复记录待复核集合','TRANSFORMATION',3240,480],['n19','重复记录隔离结果检查','QUALITY_RULE',3560,480],['n20','隔离金额缺失的记录集合','TRANSFORMATION',2280,480]
];
const wfEdges=[['n01','n02'],['n02','n03'],['n03','n04'],['n03','n05'],['n03','n06'],['n04','n07'],['n05','n07'],['n06','n07'],['n07','n08'],['n08','n09'],['n09','n10','TRUE'],['n09','n20','FALSE'],['n10','n11'],['n11','n12'],['n12','n13','TRUE'],['n12','n18','FALSE'],['n13','n14'],['n14','n15'],['n15','n16'],['n16','n17'],['n18','n19']];
const node=(id,title,kind,x,y,extra={})=>({id,title,kind,x,y,code:id,width:244,status:'pending',...extra});
function workflow(){return{nodes:baseWorkflow.map(([id,title,type,x,y])=>node(id,title,types[type],x,y,{type,code:'交易治理 / '+id,cap:['BATCH_JOB','CODE_OBJECT'].includes(type),status:state.scenario==='draft'?'pending':id==='n08'?({quality:'threshold',error:'failure',unknown:'unknown'}[state.scenario]):'pending'})),edges:wfEdges.map(([source,target,branch='DEFAULT'],i)=>({id:'w'+i,source,target,branch,label:branch==='TRUE'?'条件为真':branch==='FALSE'?'条件为假':''})),groups:[{x:40,y:8,text:'准备与接入'},{x:1000,y:8,text:'并行转换'},{x:1640,y:8,text:'质量检查与分支'},{x:2920,y:8,text:'输出与异常支路'}]};}
function lineage(){const f=state.lineage==='fields';const fields=[['order_id','标识'],['amount','金额'],['refund_amount','金额']];return{nodes:[node('orders','业务订单','数据表',40,50,{code:'demo.mysql.orders',fields:f?fields:[]}),node('refunds','退款记录','数据表',40,410,{code:'demo.mysql.refunds',fields:f?[['order_id','标识'],['refund_amount','金额']]:[]}),node('transform','订单明细转换','数据管道',390,230,{code:'demo.pipeline.order_detail',fields:f?fields:[]}),node('detail','订单业务明细','数据表',740,230,{code:'demo.dwd.order_detail',fields:f?fields:[]}),node('daily','每日订单汇总','数据表',1090,230,{code:'demo.ads.order_daily',fields:f?[['business_date','日期'],['amount','金额'],['refund_amount','金额']]:[]}),node('report','交易经营日报','仪表盘',1440,230,{code:'demo.dashboard.trade_daily',fields:f?[['business_date','日期'],['amount','金额']]:[]})],edges:f?[['orders','transform','amount','amount'],['refunds','transform','refund_amount','refund_amount'],['transform','detail','amount','amount'],['transform','detail','refund_amount','refund_amount'],['detail','daily','amount','amount'],['detail','daily','refund_amount','refund_amount'],['daily','report','amount','amount']].map(([source,target,sf,tf],i)=>({id:'l'+i,source,target,sf,tf,label:'字段映射',evidence:'合成字段映射;实际转换表达式未提供'})):[['orders','transform'],['refunds','transform'],['transform','detail'],['detail','daily'],['daily','report']].map(([source,target],i)=>({id:'l'+i,source,target,label:'加工来源',evidence:'示例快照中的有向关系'})),groups:[{x:40,y:8,text:'来源'},{x:390,y:180,text:'加工'},{x:740,y:180,text:'当前资产'},{x:1090,y:180,text:'下游消费'}]};}
function relations(){const all=[node('asset','订单业务明细','中心资产',390,255,{code:'demo.dwd.order_detail'}),node('domain','交易主题域','业务语义',40,40,{category:'business',code:'业务域'}),node('term','净支付金额','业务语义',40,255,{category:'business',code:'术语 · 人工声明'}),node('db','交易数仓','结构',40,470,{category:'structure',code:'数据库'}),node('owner','交易数据组','治理责任',740,40,{category:'governance',code:'负责人'}),node('quality','元数据完整性检查','治理责任',740,255,{category:'governance',code:'完整性观测 · 不是业务通过率'}),node('classification','交易数据分类','治理责任',740,470,{category:'governance',code:'分类标签'})];const edges=[['asset','domain','归属业务域'],['asset','term','关联术语'],['asset','db','位于数据库'],['asset','owner','由其负责'],['asset','quality','完整性观测'],['asset','classification','分类为'],['quality','owner','观测责任组']].map(([source,target,label],i)=>({id:'r'+i,source,target,label,declared:target==='term',evidence:target==='term'?'人工声明 · 不等于物理外键或加工血缘':'来源记录 · 合成示例'}));const nodes=all.filter(n=>n.id==='asset'||state.relation==='all'||n.category===state.relation),ids=new Set(nodes.map(n=>n.id));return{nodes,edges:edges.filter(e=>ids.has(e.source)&&ids.has(e.target)),groups:[{x:40,y:8,text:'业务语义与结构'},{x:740,y:8,text:'治理责任'}],fullCount:7};}
function model(){const concept=state.layer==='conceptual',physical=state.layer==='physical';const fs=concept?[[['客户标识','业务属性'],['客户名称','业务属性']],[['订单标识','业务属性'],['支付金额','业务属性']],[['明细标识','业务属性'],['购买数量','业务属性']]]:[[['customer_id',physical?'BIGINT · PK':'标识 · PK'],['name',physical?'VARCHAR(80)':'文本']],[['order_id',physical?'BIGINT · PK':'标识 · PK'],['customer_id',physical?'BIGINT · FK':'标识 · FK'],['amount',physical?'DECIMAL(18,2)':'金额']],[['item_id',physical?'BIGINT · PK':'标识 · PK'],['order_id',physical?'BIGINT · FK':'标识 · FK'],['quantity',physical?'INTEGER':'数量']]];return{nodes:[node('customer','客户','模型实体',40,90,{code:concept?'业务概念':physical?'dim_customer':'Customer',fields:fs[0]}),node('order','订单','模型实体',410,160,{code:concept?'业务概念':physical?'fact_order':'Order',fields:fs[1]}),node('item','订单明细','模型实体',780,90,{code:concept?'业务概念':physical?'fact_order_item':'OrderItem',fields:fs[2]})],edges:[{id:'m1',source:'customer',target:'order',label:'1 : N · 设计声明'},{id:'m2',source:'order',target:'item',label:'1 : N · 设计声明'}],groups:[]};}
let current={nodes:[],edges:[],groups:[]},narrow=false;
const selectOptions=(items,value,action)=>'<div class="dv-button-group">'+items.map(([v,l])=>`<button data-setting="${action}" data-value="${v}" aria-pressed="${v===value}">${l}</button>`).join('')+'</div>';
const detail=(title,entries)=>{inspector.innerHTML=`<div><h3>${esc(title)}</h3><span class="dv-muted">合成示例 · 当前选择</span></div><div class="dv-detail-grid">${entries.map(([k,v])=>`<div><small>${esc(k)}</small>${esc(v)}</div>`).join('')}</div>`;};
function nodeHeight(n){return 122+(n.fields?.length||0)*34;}
function nodeMarkup(n){const fieldRows=(n.fields||[]).map(([key,type],i)=>`<button class="dv-field ${state.field===n.id+'.'+key?'dv-picked':''}" data-field="${esc(n.id+'.'+key)}"><span>${esc(key)}</span><small>${esc(type)}</small></button>`).join('');return `<article class="dv-node ${state.selected===n.id?'dv-selected':''} ${n.status==='failure'?'dv-error':''}" data-card="${n.id}" style="left:${n.x}px;top:${n.y}px"><button class="dv-node-head" data-node="${n.id}" aria-label="选择 ${esc(n.title)}"><span class="dv-node-icon ${n.type==='CONDITION'?'condition':n.type==='QUALITY_RULE'?'quality':''}">${esc(n.type==='CONDITION'?'◇':n.type==='QUALITY_RULE'?'QC':n.kind==='数据表'?'表':n.kind==='数据管道'?'流':n.kind==='仪表盘'?'报':n.kind==='模型实体'?'ER':n.type?'任务':'关系')}</span><span class="dv-node-copy"><strong>${esc(n.title)}</strong><small>${esc(n.code)}</small></span></button>${fieldRows}<div class="dv-node-meta">${state.page==='workflow'?`<span class="dv-state ${n.status}">${statusText[n.status]}</span>${n.cap?'<span class="dv-capability">执行入口待接通</span>':`<span class="dv-muted">${n.kind}</span>`}`:`<span class="dv-muted">${esc(n.kind)}</span><span class="dv-muted">· 示例</span>`}</div>${(n.fields||[]).length?n.fields.map(([key],i)=>`<i class="dv-port" style="top:${101+i*34}px" data-port="${esc(key)}"></i><i class="dv-port out" style="top:${101+i*34}px"></i>`).join(''):'<i class="dv-port"></i>'}${n.type==='CONDITION'?'<i class="dv-port out" style="top:45px"></i><span class="dv-port-label" style="top:38px">真</span><i class="dv-port out" style="top:83px"></i><span class="dv-port-label" style="top:76px">假</span>':!n.fields?.length?'<i class="dv-port out"></i>':''}</article>`;}
function edgePoints(e){const a=current.nodes.find(n=>n.id===e.source),b=current.nodes.find(n=>n.id===e.target);const fieldY=(n,f)=>{const i=n.fields?.findIndex(v=>v[0]===f)??-1;return n.y+(i>=0?106+i*34:53);};const left=state.page==='relations'&&b.x<a.x;return{a,b,left,x1:left?a.x:a.x+244,y1:e.sf?fieldY(a,e.sf):a.y+(e.branch==='FALSE'?88:53),x2:left?b.x+244:b.x,y2:e.tf?fieldY(b,e.tf):b.y+53};}
function edgesMarkup(){return `<svg class="dv-edges" aria-label="对象间有向连接"><defs><marker id="dv-arrow" markerWidth="7" markerHeight="7" refX="6" refY="3.5" orient="auto"><path d="M0 0 L7 3.5 L0 7" fill="var(--dv-muted)"/></marker></defs>${current.edges.map(e=>{const{x1,y1,x2,y2,left}=edgePoints(e),forward=x2>x1||left,mid=(x1+x2)/2,detour=Math.max(x1,x2)+55;const d=forward?`M${x1} ${y1} C${mid} ${y1},${mid} ${y2},${x2} ${y2}`:`M${x1} ${y1} C${detour} ${y1},${detour} ${y2-42},${x2+45} ${y2-42} Q${x2-35} ${y2-42},${x2} ${y2}`;const lx=forward?mid:detour,ly=(y1+y2)/2-7;return `<g class="dv-edge" data-edge="${e.id}"><path d="${d}" marker-end="url(#dv-arrow)" ${e.declared?'stroke-dasharray="6 4"':''}/>${e.label?`<rect x="${lx-58}" y="${ly-12}" width="116" height="23" rx="4"/><text x="${lx}" y="${ly+4}" text-anchor="middle">${esc(e.label)}</text>`:''}</g>`;}).join('')}</svg>`;}
function showNode(id){const n=current.nodes.find(n=>n.id===id);if(!n)return;state.selected=id;state.selectedEdge=null;detail(n.title,[['对象身份',n.code],['类型',n.kind],['当前状态',state.page==='workflow'?statusText[n.status]:'设计示例,非运行观测'],['能力 / 依据',n.cap?'可编辑定义;现有固定回调未接通,执行应拒绝':n.type==='CONDITION'?'PARENT_STATUS · EQ SUCCEEDED;真假分支。失败后分支需执行验证':state.page==='model'?'三层设计声明;未生成或执行 DDL':state.page==='lineage'?'仅示例映射;无实际加工表达式':'合成对象,需对应来源与版本']]);updateEmphasis();}
function showEdge(id){const e=current.edges.find(e=>e.id===id);if(!e)return;state.selectedEdge=id;state.field=null;detail('连接 · '+(e.label||'执行依赖'),[['来源',e.source+(e.sf?'.'+e.sf:'')],['目标',e.target+(e.tf?'.'+e.tf:'')],['关系',e.branch||e.label],['依据',e.evidence||'合成定义边;分支不代表实际已执行']]);updateEmphasis();}
function activeFieldEdges(){if(!state.field)return new Set();const found=new Set(),seen=new Set([state.field]),q=[state.field];for(let i=0;i<q.length;i++){for(const e of current.edges){if(!e.sf)continue;const a=e.source+'.'+e.sf,b=e.target+'.'+e.tf;if(a===q[i]||b===q[i]){found.add(e.id);const v=a===q[i]?b:a;if(!seen.has(v)){seen.add(v);q.push(v);}}}}return found;}
function updateEmphasis(){const marked=activeFieldEdges();if(state.selectedEdge)marked.add(state.selectedEdge);const activeNodes=new Set();for(const e of current.edges)if(marked.has(e.id)){activeNodes.add(e.source);activeNodes.add(e.target);}root.querySelectorAll('[data-card]').forEach(el=>{el.classList.toggle('dv-selected',el.dataset.card===state.selected);el.classList.toggle('dv-faded',marked.size>0&&!activeNodes.has(el.dataset.card));});root.querySelectorAll('[data-edge]').forEach(el=>{el.classList.toggle('dv-emphasis',marked.has(el.dataset.edge));el.classList.toggle('dv-faded',marked.size>0&&!marked.has(el.dataset.edge));});root.querySelectorAll('[data-field]').forEach(el=>el.classList.toggle('dv-picked',el.dataset.field===state.field));}
function bounds(){return{w:Math.max(...current.nodes.map(n=>n.x+280),500),h:Math.max(...current.nodes.map(n=>n.y+nodeHeight(n)+70),380)};}
function updateGraphFooter(){
const zoom=Math.round(state.view.z*100);
const scope=current.fullCount&&current.fullCount!==current.nodes.length?' · 显式筛选:完整示例共'+current.fullCount+'个对象':'';
const view=narrow?'完整列表,全部连接见列表末尾':zoom===100?'100% 阅读视角 · 拖动节点调整位置,空白处平移':zoom<75?`${zoom}% 总览/缩小视角,仅供查看结构;定位选中后按100%阅读名称`:`${zoom}% 缩放视角;定位选中可恢复100%`;
const text=`${current.nodes.length} 个对象 · ${current.edges.length} 条连接${scope} · ${view} · 合成数据`;
if(footer.textContent!==text)footer.textContent=text;
}
function updateView(){const world=stage.querySelector('.dv-world');if(!world)return;const v=state.view;world.style.transform=`translate(${v.x}px,${v.y}px) scale(${v.z})`;root.querySelector('#dv-zoom').textContent=Math.round(v.z*100)+'%';const b=bounds(),viewport=stage.querySelector('.dv-viewport'),mini=stage.querySelector('.dv-minimap');mini.innerHTML=`<svg viewBox="0 0 ${b.w} ${b.h}" width="140" height="72" aria-label="全部对象概览">${current.nodes.map(n=>`<rect class="${n.id===state.selected?'dv-mini-selected':'dv-mini-node'}" x="${n.x}" y="${n.y}" width="244" height="${nodeHeight(n)}" rx="10"/>`).join('')}<rect class="dv-mini-window" x="${-v.x/v.z}" y="${-v.y/v.z}" width="${viewport.clientWidth/v.z}" height="${viewport.clientHeight/v.z}"/></svg>`;updateGraphFooter();}
function focus(){if(narrow)return;const n=current.nodes.find(n=>n.id===state.selected)||current.nodes[0],w=stage.clientWidth;state.view={x:w/2-n.x-122,y:250-n.y,z:1};updateView();}
function fit(){if(narrow)return;const b=bounds(),z=Math.min(1,(stage.clientWidth-40)/b.w,570/b.h);state.view={x:20,y:25,z};updateView();}
function graphRender(reset=false){current=state.page==='workflow'?workflow():state.page==='lineage'?lineage():state.page==='relations'?relations():model();for(const n of current.nodes){const p=state.positions[state.page+':'+n.id];if(p){n.x=p.x;n.y=p.y;}}if(!current.nodes.some(n=>n.id===state.selected))state.selected=({workflow:'n08',lineage:'detail',relations:'asset',model:'order'}[state.page]);root.dataset.nodeCount=current.nodes.length;root.dataset.edgeCount=current.edges.length;search.innerHTML=current.nodes.map(n=>`<option value="${n.id}" ${state.selected===n.id?'selected':''}>${esc(n.title)}</option>`).join('');narrow=root.clientWidth<600;canvasTools.hidden=narrow;canvasTools.style.display=narrow?'none':'flex';if(narrow){stage.innerHTML='<div class="dv-list">'+current.nodes.map(nodeMarkup).join('')+'</div><div class="dv-connections"><strong>全部连接 / 字段映射</strong>'+current.edges.map(e=>`<button data-edge="${e.id}">${esc(current.nodes.find(n=>n.id===e.source).title)}${e.sf?'.'+esc(e.sf):''} → ${esc(current.nodes.find(n=>n.id===e.target).title)}${e.tf?'.'+esc(e.tf):''}<br><span class="dv-muted">${esc(e.label||'DEFAULT 依赖')}</span></button>`).join('')+'</div>';}else{stage.innerHTML=`<div class="dv-viewport"><div class="dv-world">${current.groups.map(g=>`<span class="dv-group-label" style="left:${g.x}px;top:${g.y}px">${esc(g.text)}</span>`).join('')}${edgesMarkup()}${current.nodes.map(nodeMarkup).join('')}</div><button class="dv-minimap" data-action="fit" aria-label="小地图:显示全部对象"></button></div>`;if(reset)focus();else updateView();}updateGraphFooter();showNode(state.selected);updateEmphasis();}
const qualityRows=[['订单金额完整性',['ok','ok','ok','ok','bad','unknown','bad']],['业务主键唯一性',['ok','ok','ok','bad','bad','ok','ok']],['记录数阈值',['ok','ok','ok','ok','err','ok','ok']],['分类覆盖观测',['empty','empty','ok','ok','ok','unknown','ok']]];
function qualityRender(){const text={ok:'✓',bad:'!',err:'×',unknown:'?',empty:'—'},labels={ok:'通过',bad:'阈值不达标',err:'执行故障',unknown:'未知',empty:'无观测'};stage.innerHTML=`<div class="dv-panel-content"><strong>规则 × 业务日期</strong><span class="dv-muted"> 同日取末次尝试 · 示例时区 Asia/Shanghai</span><div class="dv-heat"><span>10月 / 规则</span>${['09','10','11','12','13','14','15'].map(d=>`<span>${d}</span>`).join('')}${qualityRows.map(([name,values],r)=>`<span>${name}</span>${values.map((s,c)=>`<button class="${s}" data-quality="${r},${c}" aria-label="${name},10月${c+9}日,${labels[s]}">${text[s]}</button>`).join('')}`).join('')}</div><div class="dv-legend"><span>✓ 通过</span><span>! 阈值不达标</span><span>× 执行故障</span><span>? 未知</span><span>— 无观测</span></div><div class="dv-empty">数值分布:尚未提供分箱 / 分位数数据<br>当前不绘制直方图或箱线图。</div></div>`;footer.textContent='4 项示例观测 × 7 天 · 不汇总为企业质量评分 · 状态不等于记录通过率';detail('订单金额完整性',[['业务日','2026-10-15 · Asia/Shanghai'],['结果','阈值不达标(合成示例)'],['观测 / 阈值','空值率 8% / ≤ 1%'],['口径','分母与证据由实际规则定义提供,未接入真实数据']]);}
const domains=[['交易域',[['订单业务明细','表','质量待处理'],['交易经营日报','报表','已登记'],['订单查询服务','API','待核验']]],['客户域',[['客户主题模型','模型','草稿'],['客户主数据集','数据集','已登记']]],['供应链域',[['库存快照','表','已登记'],['供应商数据集','数据集','已登记'],['采购分析报告','报表','待核验']]]];
function atlasRender(){stage.innerHTML='<div class="dv-atlas">'+domains.map(([name,assets])=>`<section class="dv-domain"><h3>${name}<span>${assets.length}</span></h3>${assets.map(([title,type,status])=>`<button data-asset="${title}"><strong>${title}</strong><small>${type} · ${name}</small><span class="dv-state ${status==='待核验'?'unknown':''}">${status}</span></button>`).join('')}</section>`).join('')+'</div>';footer.textContent='8 条合成目录登记 · 3 个业务域 · 尚未按跨目录身份去重 · 不是企业真实总量';detail('可见资产范围',[['计数口径','目录登记条目数'],['跨模块身份','复用现有 asset-identities 绑定/解析'],['未知绑定','单独列出,不按同名合并'],['范围','全部为合成资产,不代表生产授权范围']]);}
function render(reset=true){root.style.colorScheme=state.theme==='浅色'?'light':state.theme==='深色'?'dark':'light dark';root.style.setProperty('--dv-radius',state.radius+'px');const labels={workflow:['数据开发 / 调度管理','订单治理流程','草稿 · 示例20节点'],lineage:['元数据管理 / 血缘分析','追踪订单数据的来源与去向','示例快照 · 局部范围'],relations:['元数据管理 / 关系图谱','理解资产的业务与治理关系','示例关系网络'],model:['数据建模 / 模型设计','从业务实体到物理结构','设计声明 · 未执行DDL'],quality:['数据质量 / 观测洞察','定位异常,保留观测依据','示例7天'],atlas:['资产管理 / 资产地图','按业务域发现可见资产','合成目录登记']};const[bc,title,context]=labels[state.page];root.querySelector('#dv-breadcrumb').textContent=bc;root.querySelector('#dv-title').textContent=title;root.querySelector('#dv-context').textContent=context;root.querySelectorAll('[data-page]').forEach(b=>b.setAttribute('aria-pressed',b.dataset.page===state.page));const graphical=['workflow','lineage','relations','model'].includes(state.page);canvasTools.hidden=!graphical;canvasTools.style.display=graphical?'flex':'none';scene.innerHTML=state.page==='workflow'?selectOptions([['draft','定义草稿'],['quality','质量异常样本'],['error','执行故障样本'],['unknown','未知样本']],state.scenario,'scenario')+'<button data-action="validate">查看执行限制</button>':state.page==='lineage'?selectOptions([['tables','表级'],['fields','字段映射']],state.lineage,'lineage')+'<span class="dv-muted">选字段可联动已知映射路径</span>':state.page==='relations'?selectOptions([['all','全部关系'],['business','业务语义'],['structure','结构'],['governance','治理责任']],state.relation,'relation'):state.page==='model'?selectOptions([['conceptual','概念模型'],['logical','逻辑模型'],['physical','物理模型']],state.layer,'layer'):'<span class="dv-muted">示例口径与状态 · 不连接业务系统</span>';if(graphical)graphRender(reset);else{root.dataset.nodeCount='0';root.dataset.edgeCount='0';state.page==='quality'?qualityRender():atlasRender();}}
root.addEventListener('click',e=>{const b=e.target.closest('button,[data-edge]');if(!b||!root.contains(b))return;if(b.dataset.page){state.page=b.dataset.page;state.field=null;state.selectedEdge=null;state.history=[];render();return;}if(b.dataset.setting){state[b.dataset.setting]=b.dataset.value;state.field=null;state.selectedEdge=null;render(false);return;}if(b.dataset.field){state.field=b.dataset.field;state.selectedEdge=null;const parts=state.field.split('.');state.selected=parts[0];detail('字段 · '+parts.slice(1).join('.'),[['路径范围','已知显式端点映射'],['匹配连线',activeFieldEdges().size+' 条'],['依据','合成映射,未提供真实转换表达式'],['边界','不存在的映射不会按字段同名补猜']]);updateEmphasis();return;}if(b.dataset.node){state.field=null;showNode(b.dataset.node);search.value=b.dataset.node;return;}if(b.dataset.edge){showEdge(b.dataset.edge);return;}if(b.dataset.quality){const[r,c]=b.dataset.quality.split(',').map(Number),s=qualityRows[r][1][c];detail(qualityRows[r][0],[['业务日','2026-10-'+String(c+9).padStart(2,'0')],['结果',({ok:'通过',bad:'阈值不达标',err:'执行故障',unknown:'观测未知',empty:'无观测'})[s]+'(示例)'],['聚合','同日末次尝试;未知不回退前次成功'],['指标口径','规则观测结果,不是元数据完整性或企业质量评分']]);return;}if(b.dataset.asset){detail(b.dataset.asset,[['来源','合成目录登记'],['身份','需经已有绑定/resolve确认'],['联动','结构 / 血缘 / 质量 / 生命周期'],['缺失映射','显示未绑定或歧义,不猜测相同对象']]);return;}const a=b.dataset.action;if(a==='fit')fit();if(a==='focus')focus();if(a==='layout'){state.history.push(JSON.parse(JSON.stringify(state.positions)));Object.keys(state.positions).filter(k=>k.startsWith(state.page+':')).forEach(k=>delete state.positions[k]);graphRender(true);}if(a==='undo'&&state.history.length){state.positions=state.history.pop();graphRender(false);}if(a==='zoom-in'||a==='zoom-out'){const old=state.view.z,z=Math.min(1.8,Math.max(.18,old*(a==='zoom-in'?1.2:1/1.2))),cx=stage.clientWidth/2,cy=310;state.view={x:cx-(cx-state.view.x)*z/old,y:cy-(cy-state.view.y)*z/old,z};updateView();}if(a==='validate'){state.selected='n02';showNode('n02');focus();detail('当前设计的执行限制',[['2 个节点','批任务 n02、代码对象 n13:当前固定回调未接通'],['条件','仅 PARENT_STATUS EQ/IN,SUCCEEDED/FAILED'],['策略','配置与执行器固定值需预检,不能保存即称生效'],['当前操作','仅合成设计检查,未运行任何任务']]);}});
search.addEventListener('change',()=>{state.field=null;showNode(search.value);focus();});
let drag=null;
stage.addEventListener('pointerdown',e=>{if(narrow||e.button!==0||!e.target.closest('.dv-viewport')||e.target.closest('.dv-minimap,[data-field],[data-edge]'))return;const head=e.target.closest('[data-node]'),n=head?current.nodes.find(n=>n.id===head.dataset.node):null;drag={x:e.clientX,y:e.clientY,view:{...state.view},node:n?{id:n.id,x:n.x,y:n.y}:null,before:JSON.parse(JSON.stringify(state.positions)),moved:false};stage.setPointerCapture(e.pointerId);});
stage.addEventListener('pointermove',e=>{if(!drag)return;const dx=e.clientX-drag.x,dy=e.clientY-drag.y;if(Math.abs(dx)+Math.abs(dy)<4&&!drag.moved)return;drag.moved=true;if(drag.node){const n=current.nodes.find(n=>n.id===drag.node.id);n.x=Math.max(10,Math.min(5000,drag.node.x+dx/state.view.z));n.y=Math.max(25,Math.min(1050,drag.node.y+dy/state.view.z));state.positions[state.page+':'+n.id]={x:n.x,y:n.y};const el=stage.querySelector('[data-card="'+n.id+'"]');el.style.left=n.x+'px';el.style.top=n.y+'px';stage.querySelector('.dv-edges').outerHTML=edgesMarkup();updateEmphasis();updateView();}else{state.view.x=drag.view.x+dx;state.view.y=drag.view.y+dy;updateView();}});
stage.addEventListener('pointerup',()=>{if(drag?.moved&&drag.node)state.history.push(drag.before);if(drag?.node&&!drag.moved){state.field=null;showNode(drag.node.id);search.value=drag.node.id;}drag=null;});stage.addEventListener('pointercancel',()=>{drag=null;});
let width=root.clientWidth;new ResizeObserver(()=>{if(Math.abs(width-root.clientWidth)>3){width=root.clientWidth;render(false);}}).observe(root);
render();
if(globalThis.Tweak){const tweak=new Tweak({container:root,onChange:()=>render(false)});tweak.addSelect(state,'theme',{label:'界面明暗',options:['跟随系统','浅色','深色']});tweak.addSlider(state,'radius',{label:'节点圆角',min:4,max:14,step:2,unit:'px'});}
})();
</script>
@@ -0,0 +1,111 @@
{
"scope": "Actual production Vue Flow/G6 components with synthetic fixture data; no business API or RBAC",
"desktop": {
"width": 1440,
"height": 900
},
"checks": [
{
"case": "10 repeated order/focus/overview/refund cycles",
"results": [
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
},
{
"error": "",
"nodes": 5,
"status": "5 个对象 · 5 条连接当前字段路径 2 条"
}
]
},
{
"case": "360px lineage list",
"snapshot": "- main:\n - heading \"元数据可视化 · 实际组件验证\" [level=2]\n - paragraph: 合成快照 · 不连接业务API\n - button \"切换亮暗\":\n - generic: 切换亮暗\n - tablist:\n - tab \"血缘分析\" [selected]\n - tab \"关系图谱\"\n - tabpanel \"血缘分析\"\n - region \"血缘分析\":\n - generic: 血缘分析\n - button \"对象目录\":\n - generic: 对象目录\n - button \"收起详情\" [pressed]:\n - generic: 收起详情\n - button \"聚焦画布\":\n - generic: 聚焦画布\n - radiogroup \"radio-group\":\n - radio \"表级\"\n - generic: 表级\n - radio \"已映射字段\" [checked]\n - generic: 已映射字段\n - button \"定位选中\":\n - generic: 定位选中\n - button \"订单金额路径\":\n - generic: 订单金额路径\n - button \"退款路径\" [active]:\n - generic: 退款路径\n - main:\n - region \"实体关系画布\":\n - generic \"图谱对象与连接列表\":\n - paragraph: 5 个对象 · 5 条连接\n - article:\n - button \"数据表 销售订单 交易中心.生产域.order\":\n - generic: 数据表\n - strong: 销售订单\n - generic: 交易中心.生产域.order\n - button \"amount\":\n - generic: amount\n - article:\n - button \"数据表 退款记录 交易中心.生产域.refund\":\n - generic: 数据表\n - strong: 退款记录\n - generic: 交易中心.生产域.refund\n - button \"refund\":\n - generic: refund\n - article:\n - button \"当前对象 跨区域订单与退款业务明细汇合长名称示例 交易中心.生产域.detail\":\n - generic: 当前对象\n - strong: 跨区域订单与退款业务明细汇合长名称示例\n - generic: 交易中心.生产域.detail\n - button \"amount\":\n - generic: amount\n - button \"refund\":\n - generic: refund\n - article:\n - button \"数据表 交易汇总 交易中心.生产域.summary\":\n - generic: 数据表\n - strong: 交易汇总\n - generic: 交易中心.生产域.summary\n - button \"amount\":\n - generic: amount\n - article:\n - button \"数据表 经营分析报表 交易中心.生产域.report\":\n - generic: 数据表\n - strong: 经营分析报表\n - generic: 交易中心.生产域.report\n - button \"amount\":\n - generic: amount\n - button \"refund\":\n - generic: refund\n - heading \"连接明细\" [level=3]\n - button \"销售订单 · amount → 跨区域订单与退款业务明细汇合长名称示例 · amount\":\n - generic: 销售订单 · amount → 跨区域订单与退款业务明细汇合长名称示例 · amount\n - button \"跨区域订单与退款业务明细汇合长名称示例 · amount → 交易汇总 · amount\":\n - generic: 跨区域订单与退款业务明细汇合长名称示例 · amount → 交易汇总 · amount\n - button \"交易汇总 · amount → 经营分析报表 · amount\":\n - generic: 交易汇总 · amount → 经营分析报表 · amount\n - button \"退款记录 · refund → 跨区域订单与退款业务明细汇合长名称示例 · refund\":\n - generic: 退款记录 · refund → 跨区域订单与退款业务明细汇合长名称示例 · refund\n - button \"跨区域订单与退款业务明细汇合长名称示例 · refund → 经营分析报表 · refund\":\n - generic: 跨区域订单与退款业务明细汇合长名称示例 · refund → 经营分析报表 · refund\n - complementary \"对象详情\":\n - table:\n - rowgroup:\n - row \"完整名称\":\n - columnheader \"完整名称\"\n - row \"交易中心.生产域.refund\":\n - cell \"交易中心.生产域.refund\"\n - row \"选中字段\":\n - columnheader \"选中字段\"\n - row \"refund\":\n - cell \"refund\"\n - row \"已知路径\":\n - columnheader \"已知路径\"\n - row \"2 条连接\":\n - cell \"2 条连接\"\n - status:\n - generic: 5 个对象 · 5 条连接\n - generic: 当前字段路径 2 条",
"measure": {
"connections": 5,
"documentWidth": 360,
"objects": 5,
"width": 360
}
},
{
"case": "360px relations list",
"snapshot": "- main:\n - heading \"元数据可视化 · 实际组件验证\" [level=2]\n - paragraph: 合成快照 · 不连接业务API\n - button \"切换亮暗\":\n - generic: 切换亮暗\n - tablist:\n - tab \"血缘分析\"\n - tab \"关系图谱\" [active] [selected]\n - tabpanel \"关系图谱\"\n - region \"关系图谱\":\n - generic: 关系图谱\n - button \"对象目录\":\n - generic: 对象目录\n - button \"对象详情\":\n - generic: 对象详情\n - button \"聚焦画布\":\n - generic: 聚焦画布\n - radiogroup \"radio-group\":\n - radio \"关系网络\" [checked]\n - generic: 关系网络\n - radio \"分支视图\"\n - generic: 分支视图\n - button \"定位选中\":\n - generic: 定位选中\n - main:\n - region \"关系图谱画布\":\n - generic \"图谱对象与连接列表\":\n - paragraph: 7 个对象 · 7 条连接\n - article:\n - button \"当前对象 跨区域订单与退款业务明细汇合长名称示例 交易中心.生产域.detail\":\n - generic: 当前对象\n - strong: 跨区域订单与退款业务明细汇合长名称示例\n - generic: 交易中心.生产域.detail\n - article:\n - button \"数据库 交易明细数据库\":\n - generic: 数据库\n - strong: 交易明细数据库\n - article:\n - button \"数据服务 业务数据服务\":\n - generic: 数据服务\n - strong: 业务数据服务\n - article:\n - button \"数据域 交易业务域\":\n - generic: 数据域\n - strong: 交易业务域\n - article:\n - button \"业务术语 净销售额\":\n - generic: 业务术语\n - strong: 净销售额\n - article:\n - button \"负责人 交易数据负责人\":\n - generic: 负责人\n - strong: 交易数据负责人\n - article:\n - button \"质量检查 完整性规则\":\n - generic: 质量检查\n - strong: 完整性规则\n - heading \"连接明细\" [level=3]\n - button \"跨区域订单与退款业务明细汇合长名称示例 → 交易明细数据库 · 属于数据库\":\n - generic: 跨区域订单与退款业务明细汇合长名称示例 → 交易明细数据库 · 属于数据库\n - button \"交易明细数据库 → 业务数据服务 · 属于数据服务\":\n - generic: 交易明细数据库 → 业务数据服务 · 属于数据服务\n - button \"跨区域订单与退款业务明细汇合长名称示例 → 交易业务域 · 属于数据域\":\n - generic: 跨区域订单与退款业务明细汇合长名称示例 → 交易业务域 · 属于数据域\n - button \"跨区域订单与退款业务明细汇合长名称示例 → 净销售额 · 业务术语\":\n - generic: 跨区域订单与退款业务明细汇合长名称示例 → 净销售额 · 业务术语\n - button \"跨区域订单与退款业务明细汇合长名称示例 → 交易数据负责人 · 负责人\":\n - generic: 跨区域订单与退款业务明细汇合长名称示例 → 交易数据负责人 · 负责人\n - button \"跨区域订单与退款业务明细汇合长名称示例 → 完整性规则 · 质量检查\":\n - generic: 跨区域订单与退款业务明细汇合长名称示例 → 完整性规则 · 质量检查\n - button \"交易业务域 → 交易数据负责人 · 负责人\":\n - generic: 交易业务域 → 交易数据负责人 · 负责人\n - status:\n - generic: 7 个对象 · 7 条连接\n - generic: 显示 7 个对象 / 7 条关系",
"measure": {
"connections": 7,
"documentWidth": 360,
"objects": 7,
"width": 360
}
},
{
"case": "1100px mutually exclusive panels",
"measure": {
"catalogs": 0,
"inspectors": 1
}
},
{
"case": "dark theme preserves relation viewport",
"snapshot": "- main:\n - heading \"元数据可视化 · 实际组件验证\" [level=2]\n - paragraph: 合成快照 · 不连接业务API\n - button \"切换亮暗\" [active]:\n - generic: 切换亮暗\n - tablist:\n - tab \"血缘分析\"\n - tab \"关系图谱\" [selected]\n - tabpanel \"关系图谱\"\n - region \"关系图谱\":\n - generic: 关系图谱\n - button \"对象目录\":\n - generic: 对象目录\n - button \"对象详情\":\n - generic: 对象详情\n - button \"聚焦画布\":\n - generic: 聚焦画布\n - radiogroup \"radio-group\":\n - radio \"关系网络\" [checked]\n - generic: 关系网络\n - radio \"分支视图\"\n - generic: 分支视图\n - button \"定位选中\":\n - generic: 定位选中\n - main:\n - region \"关系图谱画布\":\n - button \"放大\":\n - generic: 放大\n - button \"缩小\":\n - generic: 缩小\n - generic: 100%\n - button \"总览\":\n - generic: 总览\n - button \"定位 · 100%\":\n - generic: 定位 · 100%\n - status:\n - generic: 7 个对象 · 7 条连接\n - generic: 显示 7 个对象 / 7 条关系"
},
{
"case": "branch projection",
"snapshot": "- main:\n - heading \"元数据可视化 · 实际组件验证\" [level=2]\n - paragraph: 合成快照 · 不连接业务API\n - button \"切换亮暗\":\n - generic: 切换亮暗\n - tablist:\n - tab \"血缘分析\"\n - tab \"关系图谱\" [selected]\n - tabpanel \"关系图谱\"\n - region \"关系图谱\":\n - generic: 关系图谱\n - button \"对象目录\":\n - generic: 对象目录\n - button \"对象详情\":\n - generic: 对象详情\n - button \"聚焦画布\":\n - generic: 聚焦画布\n - radiogroup \"radio-group\":\n - radio \"关系网络\"\n - generic: 关系网络\n - radio \"分支视图\" [checked] [active]\n - generic: 分支视图\n - button \"定位选中\":\n - generic: 定位选中\n - main:\n - region \"关系图谱画布\":\n - button \"放大\":\n - generic: 放大\n - button \"缩小\":\n - generic: 缩小\n - generic: 100%\n - button \"总览\":\n - generic: 总览\n - button \"定位 · 100%\":\n - generic: 定位 · 100%\n - status:\n - generic: 7 个对象 · 7 条连接\n - generic: 显示 7 个对象 / 6 条关系"
},
{
"case": "keyboard activates locate at 100 percent",
"snapshot": "- main:\n - heading \"元数据可视化 · 实际组件验证\" [level=2]\n - paragraph: 合成快照 · 不连接业务API\n - button \"切换亮暗\":\n - generic: 切换亮暗\n - tablist:\n - tab \"血缘分析\"\n - tab \"关系图谱\" [selected]\n - tabpanel \"关系图谱\"\n - region \"关系图谱\":\n - generic: 关系图谱\n - button \"对象目录\":\n - generic: 对象目录\n - button \"对象详情\":\n - generic: 对象详情\n - button \"聚焦画布\":\n - generic: 聚焦画布\n - radiogroup \"radio-group\":\n - radio \"关系网络\" [checked]\n - generic: 关系网络\n - radio \"分支视图\"\n - generic: 分支视图\n - button \"定位选中\":\n - generic: 定位选中\n - main:\n - region \"关系图谱画布\":\n - button \"放大\":\n - generic: 放大\n - button \"缩小\":\n - generic: 缩小\n - generic: 100%\n - button \"总览\":\n - generic: 总览\n - button \"定位 · 100%\" [active]:\n - generic: 定位 · 100%\n - status:\n - generic: 7 个对象 · 7 条连接\n - generic: 显示 7 个对象 / 7 条关系"
}
],
"console": [],
"limitations": [
"Synthetic fixture only; no live business API, RBAC or deployed page tested",
"Keyboard coverage limited to Enter activating locate; no full keyboard-only workflow",
"200-node layout tested as pure data; browser large-graph performance not measured",
"Narrow list captures are viewport/full-page images, not every internal scroll position",
"One canvas failure was observed during iterative validation; its cause was not confirmed. A full reload and 10 repeated four-action cycles did not reproduce it; this is not proof of complete production acceptance"
]
}
@@ -0,0 +1,179 @@
{
"date": "2026-10-21",
"result": "PASS_WITH_LIMITATION",
"scope": "Plan batch A: metadata lineage and relation visualization",
"authorization": "User requested 按照计划,快速开始改造和优化 in this task",
"changedFiles": [
{
"file": "aixun-ui/src/design-system/components/visualization/DgVisualWorkspace.vue",
"originalSha256": "c991996bd3793e44815f354aeb0c65f4f6d751571c72e3b032bbf00b4266962b",
"sha256": "2b3431fe17fe2f6cccb92012e569222c867d6f1990f2afd23808ebdc3d617574"
},
{
"file": "aixun-ui/src/design-system/components/visualization/DgEntityCanvas.vue",
"originalSha256": "e6831cbcc3230686fcc16b3730aa179e62779d023e07025f4c5078e4c2778f55",
"sha256": "fa9bef4dc2c20079f40ebf78d6ee6293861e0231d62bd7cd918d6659bef1058e"
},
{
"file": "aixun-ui/src/design-system/components/visualization/DgRelationCanvas.vue",
"originalSha256": "94ef789c6be93ca2225e44b0f74821fd26a39d913fae15def0910a99568b0b75",
"sha256": "cf0fb20685eecc7acdd78d81f569cfd0f2f6be48605aaa9752d51a398d7c44a5"
},
{
"file": "aixun-ui/src/design-system/components/visualization/EntityFieldNode.vue",
"originalSha256": "7278b88d7e9a20bb8b8590886b44882450b66d356350f10d632f547f0fb3a6f3",
"sha256": "56d2e0b9094bf27f433280972eb2be0c8309f4f8c950785573ff9914087d6084"
},
{
"file": "aixun-ui/src/design-system/components/visualization/layout.ts",
"originalSha256": "8ad4860bc787809438129211dff5c8f1455bd0534f230b9a4dfbae1f3866af95",
"sha256": "373aaff38d6ca82a641db00876e434ac175fb896de3f7ba95918941ed5f42da4"
},
{
"file": "aixun-ui/src/design-system/components/visualization/types.ts",
"originalSha256": "93795bf4c0e3c3b65fc52f8589926ec9c077219a38b0d1b693c8e2def7d24ab1",
"sha256": "7a30720c6742a4ae34ce3d87aacfab5e72d0658f6cb9066e6d690cffebb591dc"
},
{
"file": "aixun-ui/src/design-system/styles/_visualization.scss",
"originalSha256": "aa80886568ea771c2301bb36565162e081195697ffb9e0a21cf5deb844020854",
"sha256": "a7fbc08f2ee7b9ceb6d140f6aa84362553c279da31aa60d6ebdb91bf7166b114"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-lineage/index.vue",
"originalSha256": "05c5257f7f9c4fbe33d8d2ffa8efa101a1c0d069bb4cafdfc26d6d42c1251552",
"sha256": "36880c7aab896294d283ee0b687847b01ddbc20f79ab42f475538d981ffad399"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-lineage/projection.ts",
"originalSha256": "9e300cd33507aa1d9d0c08e6fe3f9905744f0c6841cd30f9b41e2a975999af77",
"sha256": "a2c9d3da152fa509d2e989b761d5e0756b3ffd5581fade6745ac7a2fd648975c"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-lineage/useLineage.ts",
"originalSha256": "9a8e08d5c34611b7b7684954bd8731cd156ac5e4d693a02cd5b58149951b7c95",
"sha256": "b5816ab0d39219fcc387887a3d7308ea93e6b726c61c922ded6c10c5dce60b27"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-relations/index.vue",
"originalSha256": "a439c5b959850677157cf1333f0acc7dfe9e739f7d97c74a9ee6aed5cf8db038",
"sha256": "5d84e20b2f56ce1da8c16ca6b45f90b3ec49b0401adcca5e75414579ab3b44ee"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-relations/projection.ts",
"originalSha256": "fc1efc45c50e39d34c14627ca0f0af09a86b5b820339370d5edbe1c83a1ce9f2",
"sha256": "fd4793ce3aeef8828d413ac8db6f6ee3db312769bdbc36a62ff09e8ec5c94a03"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-relations/useRelations.ts",
"originalSha256": "3ef65ad601fd5c6122f5183706f42948122bbf24aab2e0c7a7748bb634e8b32d",
"sha256": "071fcb9371a47fe7952dd4af3e503452f80ed7c73a7063a5ca06b99f3487f32c"
},
{
"file": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"originalSha256": "75d9cae58ef8bf90be19087a46132e9563bb07d544a9aacbf1ee4880edbe3357",
"sha256": "1a1335e81508f2d94b20c6127a13916f5680683d54cef897422f51141b3442c8"
},
{
"file": "aixun-ui/src/types/auto-imports.d.ts",
"originalSha256": "6443fe069f5dc0c356796bc6fd61a256854582b8fd1dee257b9668ba2cfbad55",
"sha256": "e5117b1c5730407f85336132360d93baf5f4bd8e438c7e3c2dda40ccad62b11c"
}
],
"newFiles": [
{
"file": "aixun-ui/src/design-system/components/visualization/DgGraphList.vue",
"sha256": "db76ceda46a271ac908001b6f7aa9c381abf1c3ffc2595714d0e600ec2bd8415"
},
{
"file": "aixun-ui/src/design-system/components/visualization/layout.test.ts",
"sha256": "675bf8b3a753a5bbc24a6e4ec1841aac3241341a3dcc078b093f6af0d0df686a"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-lineage/projection.test.ts",
"sha256": "eb4ae927ab82a7fc384d6e64682076c92cf48ac8bc30284dd86c001c994d4c85"
},
{
"file": "aixun-ui/.visual-review/App.vue",
"sha256": "2fe47d839b581871137fdf9996b681ad537daa7ed8c968afe5c78c4275c5fb3f"
},
{
"file": "aixun-ui/.visual-review/index.html",
"sha256": "24aa9d0b975f2068bbd469c8d229432e000bd03c95155baf4fd06bad086bec02"
},
{
"file": "aixun-ui/.visual-review/main.ts",
"sha256": "ad26433243be3c76569ac37667eef67bd07f6744a4e3dc925696b025858e5ada"
},
{
"file": "aixun-ui/.visual-review/vite.config.mjs",
"sha256": "b515ad1e89be78a90a0bf3b1bc5fc6ab39a31e36a74fc707b7ccbcda191cb35a"
}
],
"checks": {
"lint": "PASS",
"tests": {
"status": "PASS",
"files": 3,
"cases": 23
},
"typesIncludingConsumers": "PASS",
"productionBuild": {
"status": "PASS",
"viteSeconds": 31.13,
"warning": "large chunks retained"
},
"browser": "PASS_WITH_LIMITATION: actual components with synthetic data",
"onlineBusinessApi": "NOT_RUN",
"rbac": "NOT_RUN",
"businessUat": "NOT_RUN",
"deployment": "NOT_RUN",
"largeGraphBrowserPerformance": "NOT_RUN"
},
"browserEvidence": {
"file": "browser-check.json",
"sha256": "2886e0ef2394e6df3487dcc8e1c16771b03fdc846770f4e0eeaeef3cb133ceb2",
"limitations": [
"Synthetic fixture only; no live business API, RBAC or deployed page tested",
"Keyboard coverage limited to Enter activating locate; no full keyboard-only workflow",
"200-node layout tested as pure data; browser large-graph performance not measured",
"Narrow list captures are viewport/full-page images, not every internal scroll position",
"One canvas failure was observed during iterative validation; its cause was not confirmed. A full reload and 10 repeated four-action cycles did not reproduce it; this is not proof of complete production acceptance"
]
},
"dist": {
"path": "aixun-ui/dist",
"files": 1282,
"sha256": "a9f07434120d67cba58bb4531308088c63c20fed9a72aaa98893fd3393fc483e",
"hashMethod": "SHA256 of sorted relativePath + NUL + fileSHA256 + LF records"
},
"screenshots": [
{
"file": "lineage-desktop.jpg",
"sha256": "a691ab6be4e5e15dc9b440c38e1518df3537a793010f2fd8dc4936d5f4dac8ac"
},
{
"file": "lineage-mobile.jpg",
"sha256": "655ff00e9c50fce34215f093acd4fac9f5e9d003289a81cffdfa06b4e6e6eb9c"
},
{
"file": "relations-dark.jpg",
"sha256": "f41a9234e694d6a99b4284f22e281484bb760701e2e8ab7cdf31161c1b558928"
},
{
"file": "relations-desktop.jpg",
"sha256": "7cc1300870f2c97289dd5eab082cd30c8e35ff24e55a66671a35e1077a6e7e2f"
}
],
"notImplemented": [
"B1",
"B2",
"C",
"D",
"E"
],
"temporaryService": "STOPPED",
"browserViewport": "RESET",
"protectedBackup": "UNCHANGED",
"recovery": "originals/ and originals.json; no runtime or database changes"
}
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 32 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 34 KiB

@@ -0,0 +1,66 @@
[
{
"file": "aixun-ui/src/design-system/components/visualization/DgVisualWorkspace.vue",
"originalSha256": "c991996bd3793e44815f354aeb0c65f4f6d751571c72e3b032bbf00b4266962b"
},
{
"file": "aixun-ui/src/design-system/components/visualization/DgEntityCanvas.vue",
"originalSha256": "e6831cbcc3230686fcc16b3730aa179e62779d023e07025f4c5078e4c2778f55"
},
{
"file": "aixun-ui/src/design-system/components/visualization/DgRelationCanvas.vue",
"originalSha256": "94ef789c6be93ca2225e44b0f74821fd26a39d913fae15def0910a99568b0b75"
},
{
"file": "aixun-ui/src/design-system/components/visualization/EntityFieldNode.vue",
"originalSha256": "7278b88d7e9a20bb8b8590886b44882450b66d356350f10d632f547f0fb3a6f3"
},
{
"file": "aixun-ui/src/design-system/components/visualization/layout.ts",
"originalSha256": "8ad4860bc787809438129211dff5c8f1455bd0534f230b9a4dfbae1f3866af95"
},
{
"file": "aixun-ui/src/design-system/components/visualization/types.ts",
"originalSha256": "93795bf4c0e3c3b65fc52f8589926ec9c077219a38b0d1b693c8e2def7d24ab1"
},
{
"file": "aixun-ui/src/design-system/styles/_visualization.scss",
"originalSha256": "aa80886568ea771c2301bb36565162e081195697ffb9e0a21cf5deb844020854"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-lineage/index.vue",
"originalSha256": "05c5257f7f9c4fbe33d8d2ffa8efa101a1c0d069bb4cafdfc26d6d42c1251552"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-lineage/projection.ts",
"originalSha256": "9e300cd33507aa1d9d0c08e6fe3f9905744f0c6841cd30f9b41e2a975999af77"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-lineage/useLineage.ts",
"originalSha256": "9a8e08d5c34611b7b7684954bd8731cd156ac5e4d693a02cd5b58149951b7c95"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-relations/index.vue",
"originalSha256": "a439c5b959850677157cf1333f0acc7dfe9e739f7d97c74a9ee6aed5cf8db038"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-relations/projection.ts",
"originalSha256": "fc1efc45c50e39d34c14627ca0f0af09a86b5b820339370d5edbe1c83a1ce9f2"
},
{
"file": "aixun-ui/src/views/datagov/governance/metadata-relations/useRelations.ts",
"originalSha256": "3ef65ad601fd5c6122f5183706f42948122bbf24aab2e0c7a7748bb634e8b32d"
},
{
"file": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"originalSha256": "75d9cae58ef8bf90be19087a46132e9563bb07d544a9aacbf1ee4880edbe3357"
},
{
"file": "aixun-ui/src/types/auto-imports.d.ts",
"originalSha256": "6443fe069f5dc0c356796bc6fd61a256854582b8fd1dee257b9668ba2cfbad55"
},
{
"file": "aixun-ui/src/types/components.d.ts",
"originalSha256": "3aa5eca85f94e0abd139bed79584526b8c21ac0522a4e7867630722dfbb59b7b"
}
]
@@ -0,0 +1,317 @@
<template>
<section ref="host" class="dg-entity-canvas" aria-label="实体关系画布">
<div class="dg-visual-controls toolbar-actions">
<el-button size="small" :disabled="!nodes.length || loading" @click="flow.zoomIn()">放大</el-button>
<el-button size="small" :disabled="!nodes.length || loading" @click="flow.zoomOut()">缩小</el-button>
<el-button size="small" :disabled="!nodes.length || loading" @click="fit">适应</el-button>
<el-button size="small" :disabled="!nodes.length || loading" @click="autoLayout">自动布局</el-button>
</div>
<VueFlow
v-if="!loading && !error && nodes.length"
:id="instanceId"
:nodes="nodes"
:edges="edges"
:nodes-connectable="!readonly"
:edges-updatable="false"
:delete-key-code="null"
:selection-key-code="null"
:min-zoom="0.001"
:max-zoom="4"
:apply-default="true"
:connect-on-click="false"
:auto-connect="false"
@nodes-initialized="ensureFit"
@pane-ready="ensureFit"
@connect="propose"
@node-click="selectNode"
@edge-click="selectEdge"
@node-drag-stop="emitLayout"
@viewport-change-end="emitLayout"
@error="renderFailed"
>
<template #node-entity="slotProps">
<EntityFieldNode :data="slotProps.data" :selected="slotProps.selected" />
</template>
</VueFlow>
<div v-else class="dg-visual-state" role="status">
<span>{{ loading ? '加载中' : error ? '画布加载失败' : '暂无节点' }}</span>
<el-button v-if="error && !loading" link type="primary" @click="reload">重试</el-button>
</div>
</section>
</template>
<script setup lang="ts">
import type { Connection, Edge, EdgeMouseEvent, Node, NodeMouseEvent } from '@vue-flow/core';
import { VueFlow, useVueFlow, MarkerType } from '@vue-flow/core';
import { ElButton } from 'element-plus';
import { nextTick, onBeforeUnmount, ref, shallowRef, useId, watch } from 'vue';
import '@vue-flow/core/dist/style.css';
import '@vue-flow/core/dist/theme-default.css';
import '../../styles/_visualization.scss';
import type { CanvasError, CanvasGraph, CanvasLayout, ConnectionProposal } from './types';
import EntityFieldNode from './EntityFieldNode.vue';
import { layoutEntities } from './layout';
import { connectionProposal, fieldHandle, validateGraph, validateLayout } from './types';
import { useCanvasSize } from './useCanvasSize';
const props = withDefaults(
defineProps<{
graph: CanvasGraph;
scopeKey: string;
readonly?: boolean;
loading?: boolean;
layout?: CanvasLayout | null;
layoutRevision?: number;
focus?: { nodeId: string; request: number };
highlightedNodeIds?: readonly string[];
highlightedEdgeIds?: readonly string[];
selectedField?: { nodeId: string; fieldId: string };
}>(),
{ readonly: true, loading: false, layout: null, highlightedNodeIds: () => [], highlightedEdgeIds: () => [] }
);
const emit = defineEmits<{
select: [id: string];
field: [selection: { nodeId: string; fieldId: string }];
edge: [id: string];
connect: [proposal: ConnectionProposal];
layout: [value: CanvasLayout];
error: [code: CanvasError];
}>();
const instanceId = `dg-entity-${useId()}`;
const host = ref<HTMLElement>();
const flow = useVueFlow({ id: instanceId });
const nodes = shallowRef<Node[]>([]);
const edges = shallowRef<Edge[]>([]);
const error = ref(false);
let generation = 0;
let disposed = false;
let restoring = false;
let restoreViewport = true;
let focusedRequest = '';
let previousScope: string | undefined;
let appliedSignature = '';
let previousLayoutRevision: number | undefined;
let emittedSignature = '';
let needsFit = true;
let cachedPositions = new Map<string, { x: number; y: number }>();
function ensureFit() {
if (needsFit) void fit();
}
const size = useCanvasSize(host, () => {
void fit();
});
async function fit() {
const current = generation;
await nextTick();
if (disposed || current !== generation || !size.visible.value || !nodes.value.length || error.value || props.loading)
return;
const initialized = flow.getNodes.value.every(node => node.dimensions.width > 0 && node.dimensions.height > 0);
if (!initialized || !flow.initialized.value) return;
restoring = true;
try {
if (restoreViewport && props.layout?.viewport) await flow.setViewport(props.layout.viewport, { duration: 0 });
else await flow.fitView({ padding: 0.15, duration: 0 });
restoreViewport = false;
needsFit = false;
await applyEmphasis();
await focusNode();
} catch {
if (current === generation) renderFailed();
} finally {
if (current === generation) restoring = false;
}
}
function renderFailed() {
if (disposed) return;
error.value = true;
nodes.value = [];
edges.value = [];
emit('error', 'RENDER_FAILED');
}
function reload() {
const signature = JSON.stringify(props.layout);
const scopeChanged = previousScope !== props.scopeKey;
const layoutChanged =
props.layoutRevision !== previousLayoutRevision ||
(signature !== appliedSignature && signature !== emittedSignature);
previousLayoutRevision = props.layoutRevision;
if (!scopeChanged) {
for (const node of flow.getNodes.value) cachedPositions.set(node.id, { ...node.position });
} else cachedPositions = new Map();
if (layoutChanged) cachedPositions = new Map();
previousScope = props.scopeKey;
appliedSignature = signature;
needsFit = needsFit || scopeChanged || layoutChanged;
generation++;
restoring = false;
restoreViewport = scopeChanged || layoutChanged;
if (scopeChanged) focusedRequest = '';
nodes.value = [];
edges.value = [];
error.value = false;
if (props.loading || disposed) return;
try {
validateGraph(props.graph);
const initial = layoutEntities(props.graph);
const supplied =
props.layout && (scopeChanged || layoutChanged || !cachedPositions.size)
? validateLayout(props.layout, new Set(props.graph.nodes.map(node => node.id)), 500).positions
: [];
const positions = new Map(
[...initial, ...supplied].map(position => [position.nodeId, { x: position.x, y: position.y }])
);
// Existing coordinates survive field edits and graph changes. Only new nodes are arranged.
let nextX = cachedPositions.size ? Math.max(...[...cachedPositions.values()].map(p => p.x)) + 352 : 0;
for (const node of props.graph.nodes) {
if (cachedPositions.has(node.id)) positions.set(node.id, cachedPositions.get(node.id)!);
else if (cachedPositions.size) {
positions.set(node.id, { x: nextX, y: 32 });
nextX += 352;
}
}
cachedPositions = new Map(positions);
const current = generation;
nodes.value = props.graph.nodes.map(node => ({
id: node.id,
type: 'entity',
position: positions.get(node.id)!,
data: {
...node,
fields: node.fields?.map(field => ({ ...field })),
selectField: (fieldId: string) => {
if (!disposed && current === generation) emit('field', { nodeId: node.id, fieldId });
}
}
}));
edges.value = props.graph.edges.map(edge => ({
id: edge.id,
source: edge.source,
target: edge.target,
sourceHandle: fieldHandle(edge.sourceField, 'source'),
targetHandle: fieldHandle(edge.targetField, 'target'),
label: edge.label ?? edge.relationType,
markerEnd: MarkerType.ArrowClosed,
updatable: false
}));
void applyEmphasis();
ensureFit();
} catch (cause) {
error.value = true;
emit('error', cause instanceof Error && cause.message === 'INVALID_LAYOUT' ? 'INVALID_LAYOUT' : 'INVALID_GRAPH');
}
}
function propose(connection: Connection) {
if (disposed || props.loading || error.value) return;
const proposal = connectionProposal(props.graph, props.readonly, connection);
if (proposal) emit('connect', proposal);
}
function selectNode(event: NodeMouseEvent) {
if (props.graph.nodes.some(node => node.id === event.node.id)) emit('select', event.node.id);
}
function selectEdge(event: EdgeMouseEvent) {
if (props.graph.edges.some(edge => edge.id === event.edge.id)) emit('edge', event.edge.id);
}
function emitLayout() {
if (disposed || restoring || props.loading || error.value) return;
const ids = new Set(props.graph.nodes.map(node => node.id));
try {
const layout = validateLayout(
{
positions: flow.getNodes.value.map(node => ({ nodeId: node.id, ...node.position })),
viewport: { ...flow.viewport.value }
},
ids,
500
);
cachedPositions = new Map(layout.positions.map(p => [p.nodeId, { x: p.x, y: p.y }]));
const signature = JSON.stringify(layout);
if (signature !== emittedSignature) {
emittedSignature = signature;
emit('layout', layout);
}
} catch {
emit('error', 'INVALID_LAYOUT');
}
}
function captureLayout(): CanvasLayout {
if (disposed || props.loading || error.value) throw new Error('INVALID_LAYOUT');
return validateLayout(
{
positions: flow.getNodes.value.map(node => ({ nodeId: node.id, ...node.position })),
viewport: { ...flow.viewport.value }
},
new Set(props.graph.nodes.map(node => node.id)),
500
);
}
defineExpose({ captureLayout });
function autoLayout() {
const positions = new Map(
layoutEntities(props.graph).map(position => [position.nodeId, { x: position.x, y: position.y }])
);
flow.getNodes.value.forEach(node => flow.updateNode(node.id, { position: positions.get(node.id)! }));
void flow.fitView({ padding: 0.15, duration: 0 }).then(emitLayout).catch(renderFailed);
}
async function focusNode() {
const current = generation;
await nextTick();
if (
disposed ||
current !== generation ||
props.loading ||
error.value ||
!size.visible.value ||
!flow.initialized.value
)
return;
const node = flow.getNodes.value.find(item => item.id === props.focus?.nodeId);
if (!node || !node.dimensions.width || !node.dimensions.height) return;
const request = JSON.stringify([props.focus?.nodeId, props.focus?.request]);
if (request === focusedRequest) return;
focusedRequest = request;
await flow.setCenter(node.position.x + node.dimensions.width / 2, node.position.y + node.dimensions.height / 2, {
zoom: Math.max(0.5, Math.min(1.3, flow.viewport.value.zoom)),
duration: 0
});
}
async function applyEmphasis() {
const current = generation;
await nextTick();
if (disposed || current !== generation || props.loading || error.value) return;
const active = Boolean(props.highlightedNodeIds.length || props.highlightedEdgeIds.length || props.selectedField);
for (const node of flow.getNodes.value)
flow.updateNode(node.id, {
class: props.highlightedNodeIds.includes(node.id) ? 'is-highlighted' : active ? 'is-dimmed' : '',
data: {
...node.data,
selectedFieldId: props.selectedField?.nodeId === node.id ? props.selectedField.fieldId : undefined
}
});
for (const edge of flow.getEdges.value)
edge.class = props.highlightedEdgeIds.includes(edge.id) ? 'is-highlighted' : active ? 'is-dimmed' : '';
}
watch(
() => props.focus,
() => {
const current = generation;
void focusNode().catch(() => {
if (current === generation) renderFailed();
});
},
{ deep: true }
);
watch(
() => [props.highlightedNodeIds, props.highlightedEdgeIds, props.selectedField],
() => {
void applyEmphasis();
},
{ deep: true }
);
watch(() => [props.scopeKey, props.graph, props.layout, props.layoutRevision, props.loading], reload, {
immediate: true,
deep: true
});
onBeforeUnmount(() => {
disposed = true;
generation++;
});
</script>
@@ -0,0 +1,272 @@
<template>
<section class="dg-relation-canvas" aria-label="关系图谱画布">
<div class="dg-visual-controls toolbar-actions">
<el-button size="small" :disabled="!ready" @click="zoom(1.2)">放大</el-button>
<el-button size="small" :disabled="!ready" @click="zoom(0.8)">缩小</el-button>
<el-button size="small" :disabled="!ready" @click="fit">适应</el-button>
</div>
<div ref="host" class="dg-relation-canvas__host" />
<div v-if="loading || error || !props.graph.nodes.length" class="dg-visual-state" role="status">
<span>{{ loading ? '加载中' : error ? '画布加载失败' : '暂无节点' }}</span>
<el-button v-if="error && !loading" link type="primary" @click="render">重试</el-button>
</div>
</section>
</template>
<script setup lang="ts">
import type { Graph as G6Graph, IElementEvent } from '@antv/g6';
import { ElButton } from 'element-plus';
import { nextTick, onBeforeUnmount, ref, watch } from 'vue';
import '../../styles/_visualization.scss';
import type { CanvasError, CanvasGraph, ProjectionSummary } from './types';
import { projectRelations, relationMinZoom } from './layout';
import { useCanvasSize } from './useCanvasSize';
const props = withDefaults(
defineProps<{
graph: CanvasGraph;
rootId: string;
scopeKey: string;
mode?: 'mindmap' | 'network';
collapsed?: readonly string[];
loading?: boolean;
focus?: { nodeId: string; request: number };
highlightedNodeIds?: readonly string[];
highlightedEdgeIds?: readonly string[];
}>(),
{ mode: 'mindmap', collapsed: () => [], loading: false, highlightedNodeIds: () => [], highlightedEdgeIds: () => [] }
);
const emit = defineEmits<{
select: [id: string];
edge: [id: string];
projection: [value: ProjectionSummary];
error: [code: CanvasError];
}>();
const host = ref<HTMLElement>();
const error = ref(false);
const ready = ref(false);
let generation = 0;
let stopped = false;
let activeGraph: G6Graph | undefined;
let disposeGraph: (() => void) | undefined;
let minimumZoom = 0.1;
let visibleNodes: string[] = [];
let visibleEdges: string[] = [];
let presentationRevision = 0;
let focusedRequest = '';
const size = useCanvasSize(host, () => {
void render();
});
function clear() {
presentationRevision++;
focusedRequest = '';
ready.value = false;
host.value?.replaceChildren();
disposeGraph?.();
disposeGraph = undefined;
activeGraph = undefined;
}
async function render() {
const current = ++generation;
clear();
error.value = false;
if (stopped || props.loading) return;
let projection: ReturnType<typeof projectRelations>;
try {
projection = projectRelations(props.graph, props.rootId, props.mode, props.collapsed);
} catch {
error.value = true;
emit('error', 'INVALID_GRAPH');
return;
}
emit('projection', projection.summary);
visibleNodes = projection.summary.visibleNodeIds;
visibleEdges = projection.summary.visibleEdgeIds;
await nextTick();
const valid = () => !stopped && current === generation && !props.loading;
if (!valid() || !size.visible.value || !host.value || !projection.nodes.length) return;
let local: G6Graph | undefined;
let pending = true;
let retired = false;
let destroyed = false;
const dispose = () => {
retired = true;
if (!pending && !destroyed && local) {
destroyed = true;
local.destroy();
}
};
try {
const { Graph } = await import('@antv/g6');
if (!valid() || !size.visible.value || !host.value) return;
const target = document.createElement('div');
target.className = 'dg-relation-canvas__surface';
host.value.replaceChildren(target);
const computedStyle = getComputedStyle(host.value);
const token = (name: string) => computedStyle.getPropertyValue(name).trim();
const box = host.value.getBoundingClientRect();
minimumZoom = relationMinZoom(projection.nodes, box.width, box.height, projection.edges.length);
local = new Graph({
container: target,
width: box.width,
height: box.height,
animation: false,
data: {
nodes: projection.nodes.map(node => ({
id: node.id,
data: { label: node.label, subtitle: node.subtitle ?? '', kind: node.kind ?? '' },
style: { x: node.position.x, y: node.position.y }
})),
edges: projection.edges.map(edge => ({
id: edge.id,
source: edge.source,
target: edge.target,
data: { label: edge.label ?? edge.relationType ?? '' }
}))
},
node: {
type: 'rect',
state: {
selected: { stroke: token('--el-color-primary'), lineWidth: 3, opacity: 1 },
inactive: { opacity: 0.3 }
},
style: {
size: [164, 64],
radius: 4,
fill: token('--el-bg-color'),
stroke: token('--el-border-color'),
labelFill: token('--el-text-color-primary'),
labelFontSize: 13,
labelLineHeight: 20,
labelPlacement: 'center',
labelText: datum => {
const detail = [datum.data?.kind, datum.data?.subtitle].filter(Boolean).join(' · ');
return `${datum.data?.label ?? ''}\n${detail || '--'}`;
},
labelWordWrap: true,
labelMaxWidth: 150,
labelMaxLines: 2,
shadowColor: token('--el-border-color-lighter'),
shadowBlur: 6
}
},
edge: {
type: props.mode === 'mindmap' ? 'cubic-horizontal' : 'quadratic',
state: {
selected: { lineWidth: 3, stroke: token('--el-color-primary'), opacity: 1 },
inactive: { opacity: 0.22 }
},
style: {
endArrow: true,
stroke: token('--el-text-color-placeholder'),
lineWidth: 1.2,
labelFill: token('--el-text-color-regular'),
labelFontSize: 11,
labelBackground: true,
labelBackgroundFill: token('--el-bg-color'),
labelText: datum => String(datum.data?.label ?? '')
}
},
transforms: ['process-parallel-edges'],
behaviors: ['drag-canvas', 'zoom-canvas', 'drag-element'],
zoomRange: [minimumZoom, 4]
});
disposeGraph = dispose;
local.on('node:click', (event: IElementEvent) => {
if (valid()) emit('select', event.target.id);
});
local.on('edge:click', (event: IElementEvent) => {
if (valid()) emit('edge', event.target.id);
});
await local.render();
if (!valid() || retired) {
dispose();
return;
}
await local.fitView({ when: 'always', direction: 'both' }, false);
if (!valid() || retired) {
dispose();
return;
}
activeGraph = local;
ready.value = true;
await syncPresentation();
} catch {
if (valid()) {
error.value = true;
ready.value = false;
host.value?.replaceChildren();
emit('error', 'RENDER_FAILED');
}
dispose();
} finally {
pending = false;
if (retired || !valid()) dispose();
}
}
async function zoom(factor: number) {
const current = generation;
try {
if (activeGraph)
await activeGraph.zoomTo(Math.max(minimumZoom, Math.min(4, activeGraph.getZoom() * factor)), false);
} catch {
if (current === generation) void render();
}
}
async function fit() {
const current = generation;
try {
if (activeGraph) await activeGraph.fitView({ when: 'always', direction: 'both' }, false);
} catch {
if (current === generation) void render();
}
}
async function syncPresentation() {
const revision = ++presentationRevision;
const current = generation;
const local = activeGraph;
if (!local || !ready.value || stopped) return;
const valid = () => !stopped && current === generation && revision === presentationRevision && local === activeGraph;
const states: Record<string, string[]> = {};
const active = Boolean(props.highlightedNodeIds.length || props.highlightedEdgeIds.length);
for (const id of visibleNodes)
states[id] = props.highlightedNodeIds.includes(id) ? ['selected'] : active ? ['inactive'] : [];
for (const id of visibleEdges)
states[id] = props.highlightedEdgeIds.includes(id) ? ['selected'] : active ? ['inactive'] : [];
try {
await local.setElementState(states, false);
if (!valid()) return;
const focus = props.focus;
const request = JSON.stringify(focus);
if (!focus || !visibleNodes.includes(focus.nodeId) || request === focusedRequest) return;
await local.zoomTo(Math.max(0.75, Math.min(1.2, local.getZoom())), false);
if (!valid()) return;
await local.focusElement(focus.nodeId, false);
if (valid()) focusedRequest = request;
} catch {
if (valid()) {
clear();
error.value = true;
emit('error', 'RENDER_FAILED');
}
}
}
watch(
() => [props.focus, props.highlightedNodeIds, props.highlightedEdgeIds],
() => {
void syncPresentation();
},
{ deep: true }
);
watch(
() => [props.graph, props.rootId, props.scopeKey, props.mode, props.collapsed, props.loading],
() => {
void render();
},
{ deep: true, immediate: true }
);
onBeforeUnmount(() => {
stopped = true;
generation++;
clear();
});
</script>
@@ -0,0 +1,22 @@
<template>
<section class="dg-visual-workspace" :aria-label="label">
<div v-if="$slots.toolbar" class="dg-visual-workspace__toolbar toolbar-shell"><slot name="toolbar" /></div>
<div class="dg-visual-workspace__body">
<aside v-if="catalogVisible && $slots.catalog" class="dg-visual-workspace__catalog" aria-label="对象目录">
<slot name="catalog" />
</aside>
<main class="dg-visual-workspace__canvas"><slot /></main>
<aside v-if="inspectorVisible && $slots.inspector" class="dg-visual-workspace__inspector" aria-label="对象详情">
<slot name="inspector" />
</aside>
</div>
<div v-if="$slots.status" class="dg-visual-workspace__status" role="status"><slot name="status" /></div>
</section>
</template>
<script setup lang="ts">
import '../../styles/_visualization.scss';
withDefaults(defineProps<{ label: string; catalogVisible?: boolean; inspectorVisible?: boolean }>(), {
catalogVisible: true,
inspectorVisible: false
});
</script>
@@ -0,0 +1,43 @@
<template>
<article class="dg-entity-node" :class="{ 'is-selected': selected }">
<header class="dg-entity-node__heading">
<Handle :id="fieldHandle(undefined, 'target')" type="target" :position="Position.Left" />
<span class="dg-entity-node__heading-copy">
<strong :title="data.label">{{ data.label }}</strong>
<small :title="data.subtitle">{{ data.subtitle || '--' }}</small>
</span>
<span v-if="data.kind" class="dg-entity-node__kind" :title="data.kind">{{ data.kind }}</span>
<Handle :id="fieldHandle(undefined, 'source')" type="source" :position="Position.Right" />
</header>
<div
v-for="field in data.fields || []"
:key="field.id"
class="dg-entity-node__field"
:class="{ 'is-highlighted': data.selectedFieldId === field.id }"
>
<Handle :id="fieldHandle(field.id, 'target')" type="target" :position="Position.Left" />
<span v-if="field.key" class="dg-entity-node__field-key" :title="field.key">{{ field.key }}</span>
<button
type="button"
class="dg-entity-node__field-label nodrag"
:title="field.label"
@click.stop="data.selectField(field.id)"
>
{{ field.label }}
</button>
<span v-if="field.type" class="dg-entity-node__field-type" :title="field.type">
{{ field.type }}{{ field.nullable ? ' ?' : '' }}
</span>
<Handle :id="fieldHandle(field.id, 'source')" type="source" :position="Position.Right" />
</div>
</article>
</template>
<script setup lang="ts">
import { Handle, Position } from '@vue-flow/core';
import type { CanvasNode } from './types';
import { fieldHandle } from './types';
defineProps<{
data: CanvasNode & { selectField: (id: string) => void; selectedFieldId?: string };
selected?: boolean;
}>();
</script>
@@ -0,0 +1,133 @@
import dagre from '@dagrejs/dagre';
import type { CanvasGraph, CanvasPosition, ProjectionSummary } from './types';
import { validateGraph } from './types';
export const entityWidth = 252;
export const entityHeight = (fields = 0) => 62 + fields * 31;
export function layoutEntities(input: CanvasGraph): CanvasPosition[] {
validateGraph(input);
const graph = new dagre.graphlib.Graph({ multigraph: true });
graph.setGraph({ rankdir: 'LR', nodesep: 40, ranksep: 100, marginx: 32, marginy: 32 });
graph.setDefaultEdgeLabel(() => ({}));
input.nodes.forEach(node =>
graph.setNode(node.id, { width: entityWidth, height: entityHeight(node.fields?.length) })
);
input.edges.forEach(edge => graph.setEdge(edge.source, edge.target, {}, edge.id));
dagre.layout(graph);
return input.nodes.map(node => {
const point = graph.node(node.id);
return { nodeId: node.id, x: point.x - entityWidth / 2, y: point.y - entityHeight(node.fields?.length) / 2 };
});
}
/** Traversal can follow an edge backwards; rendered edge endpoints never change. */
export function projectRelations(
input: CanvasGraph,
rootId: string,
mode: 'mindmap' | 'network',
collapsed: readonly string[] = []
) {
validateGraph(input);
if (!input.nodes.length)
return {
nodes: [],
edges: [],
summary: {
visibleNodeIds: [],
visibleEdgeIds: [],
hiddenNodeIds: [],
hiddenEdgeIds: []
} satisfies ProjectionSummary
};
if (!input.nodes.some(node => node.id === rootId)) throw new Error('INVALID_GRAPH');
const seen = new Set<string>([rootId]);
const treeEdges = new Set<string>();
const positions = new Map<string, { x: number; y: number }>();
const blocked = new Set(collapsed);
const queue = [{ id: rootId, depth: 0 }];
const children = new Map<string, string[]>();
for (let i = 0; i < queue.length; i++) {
const item = queue[i];
if (blocked.has(item.id)) continue;
for (const edge of input.edges) {
const next = edge.source === item.id ? edge.target : edge.target === item.id ? edge.source : undefined;
if (next === undefined || seen.has(next)) continue;
seen.add(next);
treeEdges.add(edge.id);
queue.push({ id: next, depth: item.depth + 1 });
children.set(item.id, [...(children.get(item.id) ?? []), next]);
}
}
// A two-sided display tree matching the approved mindmap, sized by leaf count.
// Business edges remain untouched, including edges traversed in reverse.
const leaves = (id: string): number => children.get(id)?.reduce((sum, child) => sum + leaves(child), 0) || 1;
const place = (id: string, depth: number, side: number, top: number) => {
const count = leaves(id);
positions.set(id, { x: side * depth * 240, y: top + (count * 104) / 2 });
let cursor = top;
for (const child of children.get(id) ?? []) {
place(child, depth + 1, side, cursor);
cursor += leaves(child) * 104;
}
};
positions.set(rootId, { x: 0, y: 0 });
const branches = children.get(rootId) ?? [];
for (const side of [1, -1]) {
const group = branches.filter((_, index) => (index % 2 ? -1 : 1) === side);
let cursor = (-group.reduce((sum, id) => sum + leaves(id), 0) * 104) / 2;
for (const id of group) {
place(id, 1, side, cursor);
cursor += leaves(id) * 104;
}
}
const visibleNodes = mode === 'network' ? input.nodes : input.nodes.filter(node => seen.has(node.id));
const visibleEdges = mode === 'network' ? input.edges : input.edges.filter(edge => treeEdges.has(edge.id));
const edgeIds = new Set(visibleEdges.map(edge => edge.id));
const nodeIds = new Set(visibleNodes.map(node => node.id));
// Compact concentric rings preserve every node, including disconnected components.
// The old N*28 single ring exceeded the useful viewport at the domain's 200-node cap.
const networkPositions = new Map<string, { x: number; y: number }>();
networkPositions.set(rootId, { x: 0, y: 0 });
const outer = visibleNodes.filter(node => node.id !== rootId);
let offset = 0;
for (let ring = 1; offset < outer.length; ring++) {
const radius = ring * 230;
const count = Math.min(Math.floor((2 * Math.PI * radius) / 230), outer.length - offset);
for (let i = 0; i < count; i++) {
const angle = (2 * Math.PI * i) / count + (ring % 2 ? 0 : Math.PI / count);
networkPositions.set(outer[offset + i].id, { x: Math.cos(angle) * radius, y: Math.sin(angle) * radius });
}
offset += count;
}
return {
nodes: visibleNodes.map(node => ({
...node,
fields: node.fields?.map(field => ({ ...field })),
position: mode === 'network' ? networkPositions.get(node.id)! : positions.get(node.id)!
})),
edges: visibleEdges.map(edge => ({ ...edge })),
summary: {
visibleNodeIds: [...nodeIds],
visibleEdgeIds: [...edgeIds],
hiddenNodeIds: input.nodes.filter(node => !nodeIds.has(node.id)).map(node => node.id),
hiddenEdgeIds: input.edges.filter(edge => !edgeIds.has(edge.id)).map(edge => edge.id)
} satisfies ProjectionSummary
};
}
/** Below the computed fit ratio, even a long bounded tree can be fitted before focusing a node. */
export function relationMinZoom(
nodes: readonly { position: { x: number; y: number } }[],
width: number,
height: number,
edgeCount = 0
): number {
if (!nodes.length || width <= 0 || height <= 0) return 0.1;
const xs = nodes.map(node => node.position.x),
ys = nodes.map(node => node.position.y);
// G6's parallel-edge transform uses 15px increments; allow both sides and labels.
const edgeMargin = Math.max(0, edgeCount) * 40;
const spanX = Math.max(...xs) - Math.min(...xs) + 328 + edgeMargin;
const spanY = Math.max(...ys) - Math.min(...ys) + 192 + edgeMargin;
return Math.max(0.0001, Math.min(0.1, width / spanX / 2, height / spanY / 2));
}
@@ -0,0 +1,174 @@
/** Presentation contracts only. IDs come from the authorized domain projection. */
export interface CanvasField {
id: string;
label: string;
type?: string;
key?: string;
nullable?: boolean;
}
export interface CanvasNode {
id: string;
label: string;
subtitle?: string;
kind?: string;
fields?: readonly CanvasField[];
}
export interface CanvasEdge {
id: string;
source: string;
target: string;
sourceField?: string;
targetField?: string;
label?: string;
relationType?: string;
}
export interface CanvasGraph {
nodes: readonly CanvasNode[];
edges: readonly CanvasEdge[];
}
export interface CanvasPosition {
nodeId: string;
x: number;
y: number;
}
export interface CanvasViewport {
x: number;
y: number;
zoom: number;
}
export interface CanvasLayout {
positions: readonly CanvasPosition[];
viewport?: CanvasViewport | null;
}
export interface ConnectionProposal {
source: string;
target: string;
sourceField?: string;
targetField?: string;
}
export interface ProjectionSummary {
visibleNodeIds: string[];
visibleEdgeIds: string[];
hiddenNodeIds: string[];
hiddenEdgeIds: string[];
}
export type CanvasError = 'INVALID_GRAPH' | 'INVALID_LAYOUT' | 'RENDER_FAILED';
const validId = (id: unknown): id is string => typeof id === 'string' && id.length > 0 && id.length <= 2048;
const finiteCoordinate = (value: unknown): value is number =>
typeof value === 'number' && Number.isFinite(value) && Math.abs(value) <= 1000000;
export function validateGraph(graph: CanvasGraph): void {
if (
!Array.isArray(graph.nodes) ||
!Array.isArray(graph.edges) ||
graph.nodes.length > 500 ||
graph.edges.length > 4000
)
throw new Error('INVALID_GRAPH');
const nodes = new Map<string, Set<string>>();
let fieldCount = 0;
for (const node of graph.nodes) {
if (!node || !validId(node.id) || nodes.has(node.id) || typeof node.label !== 'string')
throw new Error('INVALID_GRAPH');
const fields = new Set<string>();
for (const field of node.fields ?? []) {
if (!field || !validId(field.id) || fields.has(field.id) || typeof field.label !== 'string')
throw new Error('INVALID_GRAPH');
fields.add(field.id);
fieldCount++;
}
nodes.set(node.id, fields);
}
if (fieldCount > 4000) throw new Error('INVALID_GRAPH');
const edges = new Set<string>();
for (const edge of graph.edges) {
if (
!edge ||
!validId(edge.id) ||
edges.has(edge.id) ||
!nodes.has(edge.source) ||
!nodes.has(edge.target) ||
(edge.sourceField !== undefined && !nodes.get(edge.source)!.has(edge.sourceField)) ||
(edge.targetField !== undefined && !nodes.get(edge.target)!.has(edge.targetField))
)
throw new Error('INVALID_GRAPH');
edges.add(edge.id);
}
}
export function validateLayout(layout: CanvasLayout, nodeIds: ReadonlySet<string>, maxNodes = 200): CanvasLayout {
if (!Array.isArray(layout.positions) || layout.positions.length > maxNodes) throw new Error('INVALID_LAYOUT');
const seen = new Set<string>();
const positions = layout.positions
.map(position => {
if (
!position ||
!validId(position.nodeId) ||
seen.has(position.nodeId) ||
!finiteCoordinate(position.x) ||
!finiteCoordinate(position.y)
)
throw new Error('INVALID_LAYOUT');
seen.add(position.nodeId);
return {
nodeId: position.nodeId,
x: roundCoordinate(position.x, 3),
y: roundCoordinate(position.y, 3)
};
})
.filter(position => nodeIds.has(position.nodeId));
const viewport = layout.viewport;
if (
viewport &&
(!finiteCoordinate(viewport.x) ||
!finiteCoordinate(viewport.y) ||
!Number.isFinite(viewport.zoom) ||
viewport.zoom < 0.001 ||
viewport.zoom > 4)
)
throw new Error('INVALID_LAYOUT');
return {
positions,
viewport: viewport
? {
x: roundCoordinate(viewport.x, 3),
y: roundCoordinate(viewport.y, 3),
zoom: roundCoordinate(viewport.zoom, 6)
}
: null
};
}
const roundCoordinate = (value: number, places: number) =>
(Math.sign(value) * Math.round(Math.abs(value) * 10 ** places)) / 10 ** places;
export const fieldHandle = (fieldId: string | undefined, side: 'source' | 'target') =>
encodeURIComponent(JSON.stringify([side, fieldId ?? null]));
export function connectionProposal(
graph: CanvasGraph,
readonly: boolean,
connection: {
source: string | null;
target: string | null;
sourceHandle?: string | null;
targetHandle?: string | null;
}
): ConnectionProposal | undefined {
if (readonly || !connection.source || !connection.target) return;
const source = graph.nodes.find(node => node.id === connection.source);
const target = graph.nodes.find(node => node.id === connection.target);
if (!source || !target) return;
const field = (node: CanvasNode, handle: string | null | undefined, side: 'source' | 'target') => {
if (handle === fieldHandle(undefined, side)) return undefined;
const found = node.fields?.find(item => fieldHandle(item.id, side) === handle);
if (!found) throw new Error('INVALID_GRAPH');
return found.id;
};
try {
return {
source: source.id,
target: target.id,
sourceField: field(source, connection.sourceHandle, 'source'),
targetField: field(target, connection.targetHandle, 'target')
};
} catch {
return;
}
}
@@ -0,0 +1,251 @@
// D-013/ADR-0021 content-area scope. Never use these roots as table ancestors.
.dg-visual-workspace {
display: flex;
flex-direction: column;
height: min(720px, 76vh);
min-height: 360px;
overflow: hidden;
border: 1px solid var(--aixun-color-border);
border-radius: var(--aixun-radius);
background: var(--aixun-color-surface);
color: var(--aixun-color-text);
&__toolbar {
min-height: 48px;
min-width: 0;
padding: 8px 12px;
border-bottom: 1px solid var(--aixun-color-border);
> .toolbar-actions {
flex-wrap: wrap;
min-width: 0;
max-width: 100%;
> .query-form {
min-width: 0;
max-width: 100%;
}
}
}
&__body {
display: flex;
flex: 1;
min-height: 0;
position: relative;
}
&__catalog {
flex: 0 0 220px;
overflow: auto;
border-right: 1px solid var(--aixun-color-border);
padding: 12px;
}
&__canvas {
flex: 1;
min-width: 0;
min-height: 0;
position: relative;
}
&__inspector {
flex: 0 0 294px;
min-width: 0;
overflow: auto;
padding: 12px;
border-left: 1px solid var(--aixun-color-border);
background: var(--aixun-color-surface);
}
&__status {
min-height: 28px;
padding: 4px 12px;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
font-size: 12px;
border-top: 1px solid var(--aixun-color-border);
color: var(--aixun-color-muted);
}
}
.dg-entity-canvas,
.dg-relation-canvas {
position: relative;
width: 100%;
height: 100%;
min-height: 320px;
background-color: var(--aixun-color-surface-muted);
background-image: radial-gradient(var(--el-border-color-lighter) 0.7px, transparent 0.7px);
background-size: 20px 20px;
.dg-visual-controls {
position: absolute;
top: 12px;
right: 12px;
z-index: 5;
display: flex;
gap: 4px;
padding: 4px;
border: 1px solid var(--aixun-color-border);
border-radius: var(--aixun-radius);
background: var(--aixun-color-surface);
box-shadow: var(--aixun-shadow);
}
.dg-visual-state {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
color: var(--aixun-color-muted);
background: var(--aixun-color-surface-muted);
}
}
.dg-relation-canvas__host,
.dg-relation-canvas__surface {
width: 100%;
height: 100%;
}
.dg-entity-canvas {
.vue-flow__node.is-highlighted .dg-entity-node {
border-color: var(--aixun-color-primary);
border-top-color: var(--aixun-color-primary);
}
.vue-flow__edge.is-highlighted .vue-flow__edge-path {
stroke: var(--aixun-color-primary);
stroke-width: 3px;
}
.vue-flow__node.is-dimmed .dg-entity-node,
.vue-flow__edge.is-dimmed {
opacity: 0.28;
}
.dg-entity-node__field.is-highlighted {
background: var(--el-color-primary-light-9);
color: var(--aixun-color-primary);
}
.vue-flow__edge-path {
stroke: var(--el-text-color-placeholder);
stroke-width: 1.4px;
}
.vue-flow__edge-text {
fill: var(--aixun-color-text);
}
.vue-flow__edge-textbg {
fill: var(--aixun-color-surface);
}
.vue-flow__handle {
background: var(--aixun-color-primary);
border-color: var(--aixun-color-surface);
}
.dg-entity-node {
width: 252px;
border: 1px solid var(--aixun-color-border);
border-top: 3px solid var(--el-color-primary-light-5);
border-radius: var(--aixun-radius);
background: var(--aixun-color-surface);
color: var(--aixun-color-text);
box-shadow: var(--aixun-shadow);
}
.dg-entity-node.is-selected {
border-color: var(--aixun-color-primary);
}
.dg-entity-node__heading {
position: relative;
height: 60px;
padding: 10px 12px;
display: flex;
align-items: flex-start;
gap: 8px;
border-bottom: 1px solid var(--aixun-color-border);
}
.dg-entity-node__heading-copy {
display: block;
flex: 1;
min-width: 0;
}
.dg-entity-node__heading-copy strong,
.dg-entity-node__heading-copy small {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dg-entity-node__heading-copy small {
margin-top: 3px;
color: var(--aixun-color-muted);
}
.dg-entity-node__kind {
flex: 0 0 auto;
max-width: 72px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 2px 5px;
border-radius: 3px;
background: var(--el-color-primary-light-9);
color: var(--aixun-color-primary);
font-size: 10px;
line-height: 16px;
}
.dg-entity-node__field {
position: relative;
height: 31px;
padding: 0 10px;
display: flex;
align-items: center;
gap: 8px;
border-bottom: 1px solid var(--aixun-color-border);
}
.dg-entity-node__field:last-child {
border-bottom: 0;
}
.dg-entity-node__field-label {
border: 0;
background: transparent;
padding: 0;
min-width: 0;
min-height: 28px;
text-align: left;
color: inherit;
font: inherit;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.dg-entity-node__field-key {
flex: 0 0 20px;
color: var(--el-color-warning-dark-2);
font-size: 10px;
font-weight: 600;
text-align: center;
}
.dg-entity-node__field-type {
max-width: 90px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--aixun-color-muted);
font-size: 12px;
}
}
.dg-visual-workspace {
.dg-visual-catalog-list {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 4px;
margin-top: 8px;
}
.dg-visual-catalog-list .el-button {
margin-left: 0;
justify-content: flex-start;
min-height: 28px;
padding: 4px 8px;
white-space: normal;
text-align: left;
}
.dg-visual-detail-text {
overflow-wrap: anywhere;
}
}
@media (max-width: 1440px) {
.dg-visual-workspace__catalog {
flex-basis: 192px;
}
}
@@ -0,0 +1,633 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
const EffectScope: typeof import('vue').EffectScope
const ElLoading: typeof import('element-plus/es').ElLoading
const ElMessage: typeof import('element-plus/es').ElMessage
const ElMessageBox: typeof import('element-plus/es').ElMessageBox
const ElNotification: typeof import('element-plus/es').ElNotification
const acceptHMRUpdate: typeof import('pinia').acceptHMRUpdate
const asyncComputed: typeof import('@vueuse/core').asyncComputed
const autoResetRef: typeof import('@vueuse/core').autoResetRef
const computed: typeof import('vue').computed
const computedAsync: typeof import('@vueuse/core').computedAsync
const computedEager: typeof import('@vueuse/core').computedEager
const computedInject: typeof import('@vueuse/core').computedInject
const computedWithControl: typeof import('@vueuse/core').computedWithControl
const controlledComputed: typeof import('@vueuse/core').controlledComputed
const controlledRef: typeof import('@vueuse/core').controlledRef
const createApp: typeof import('vue').createApp
const createDisposableDirective: typeof import('@vueuse/core').createDisposableDirective
const createEventHook: typeof import('@vueuse/core').createEventHook
const createGlobalState: typeof import('@vueuse/core').createGlobalState
const createInjectionState: typeof import('@vueuse/core').createInjectionState
const createPinia: typeof import('pinia').createPinia
const createReactiveFn: typeof import('@vueuse/core').createReactiveFn
const createRef: typeof import('@vueuse/core').createRef
const createReusableTemplate: typeof import('@vueuse/core').createReusableTemplate
const createSharedComposable: typeof import('@vueuse/core').createSharedComposable
const createTemplatePromise: typeof import('@vueuse/core').createTemplatePromise
const createUnrefFn: typeof import('@vueuse/core').createUnrefFn
const customRef: typeof import('vue').customRef
const debouncedRef: typeof import('@vueuse/core').debouncedRef
const debouncedWatch: typeof import('@vueuse/core').debouncedWatch
const defineAsyncComponent: typeof import('vue').defineAsyncComponent
const defineComponent: typeof import('vue').defineComponent
const defineStore: typeof import('pinia').defineStore
const eagerComputed: typeof import('@vueuse/core').eagerComputed
const effectScope: typeof import('vue').effectScope
const extendRef: typeof import('@vueuse/core').extendRef
const getActivePinia: typeof import('pinia').getActivePinia
const getCurrentInstance: typeof import('vue').getCurrentInstance
const getCurrentScope: typeof import('vue').getCurrentScope
const getCurrentWatcher: typeof import('vue').getCurrentWatcher
const h: typeof import('vue').h
const ignorableWatch: typeof import('@vueuse/core').ignorableWatch
const inject: typeof import('vue').inject
const injectLocal: typeof import('@vueuse/core').injectLocal
const isDefined: typeof import('@vueuse/core').isDefined
const isProxy: typeof import('vue').isProxy
const isReactive: typeof import('vue').isReactive
const isReadonly: typeof import('vue').isReadonly
const isRef: typeof import('vue').isRef
const isShallow: typeof import('vue').isShallow
const makeDestructurable: typeof import('@vueuse/core').makeDestructurable
const mapActions: typeof import('pinia').mapActions
const mapGetters: typeof import('pinia').mapGetters
const mapState: typeof import('pinia').mapState
const mapStores: typeof import('pinia').mapStores
const mapWritableState: typeof import('pinia').mapWritableState
const markRaw: typeof import('vue').markRaw
const nextTick: typeof import('vue').nextTick
const onActivated: typeof import('vue').onActivated
const onBeforeMount: typeof import('vue').onBeforeMount
const onBeforeRouteLeave: typeof import('vue-router').onBeforeRouteLeave
const onBeforeRouteUpdate: typeof import('vue-router').onBeforeRouteUpdate
const onBeforeUnmount: typeof import('vue').onBeforeUnmount
const onBeforeUpdate: typeof import('vue').onBeforeUpdate
const onClickOutside: typeof import('@vueuse/core').onClickOutside
const onDeactivated: typeof import('vue').onDeactivated
const onElementRemoval: typeof import('@vueuse/core').onElementRemoval
const onErrorCaptured: typeof import('vue').onErrorCaptured
const onKeyStroke: typeof import('@vueuse/core').onKeyStroke
const onLongPress: typeof import('@vueuse/core').onLongPress
const onMounted: typeof import('vue').onMounted
const onRenderTracked: typeof import('vue').onRenderTracked
const onRenderTriggered: typeof import('vue').onRenderTriggered
const onScopeDispose: typeof import('vue').onScopeDispose
const onServerPrefetch: typeof import('vue').onServerPrefetch
const onStartTyping: typeof import('@vueuse/core').onStartTyping
const onUnmounted: typeof import('vue').onUnmounted
const onUpdated: typeof import('vue').onUpdated
const onWatcherCleanup: typeof import('vue').onWatcherCleanup
const pausableWatch: typeof import('@vueuse/core').pausableWatch
const provide: typeof import('vue').provide
const provideLocal: typeof import('@vueuse/core').provideLocal
const reactify: typeof import('@vueuse/core').reactify
const reactifyObject: typeof import('@vueuse/core').reactifyObject
const reactive: typeof import('vue').reactive
const reactiveComputed: typeof import('@vueuse/core').reactiveComputed
const reactiveOmit: typeof import('@vueuse/core').reactiveOmit
const reactivePick: typeof import('@vueuse/core').reactivePick
const readonly: typeof import('vue').readonly
const ref: typeof import('vue').ref
const refAutoReset: typeof import('@vueuse/core').refAutoReset
const refDebounced: typeof import('@vueuse/core').refDebounced
const refDefault: typeof import('@vueuse/core').refDefault
const refManualReset: typeof import('@vueuse/core').refManualReset
const refThrottled: typeof import('@vueuse/core').refThrottled
const refWithControl: typeof import('@vueuse/core').refWithControl
const resolveComponent: typeof import('vue').resolveComponent
const setActivePinia: typeof import('pinia').setActivePinia
const setMapStoreSuffix: typeof import('pinia').setMapStoreSuffix
const shallowReactive: typeof import('vue').shallowReactive
const shallowReadonly: typeof import('vue').shallowReadonly
const shallowRef: typeof import('vue').shallowRef
const storeToRefs: typeof import('pinia').storeToRefs
const syncRef: typeof import('@vueuse/core').syncRef
const syncRefs: typeof import('@vueuse/core').syncRefs
const templateRef: typeof import('@vueuse/core').templateRef
const throttledRef: typeof import('@vueuse/core').throttledRef
const throttledWatch: typeof import('@vueuse/core').throttledWatch
const toRaw: typeof import('vue').toRaw
const toReactive: typeof import('@vueuse/core').toReactive
const toRef: typeof import('vue').toRef
const toRefs: typeof import('vue').toRefs
const toValue: typeof import('vue').toValue
const triggerRef: typeof import('vue').triggerRef
const tryOnBeforeMount: typeof import('@vueuse/core').tryOnBeforeMount
const tryOnBeforeUnmount: typeof import('@vueuse/core').tryOnBeforeUnmount
const tryOnMounted: typeof import('@vueuse/core').tryOnMounted
const tryOnScopeDispose: typeof import('@vueuse/core').tryOnScopeDispose
const tryOnUnmounted: typeof import('@vueuse/core').tryOnUnmounted
const unref: typeof import('vue').unref
const unrefElement: typeof import('@vueuse/core').unrefElement
const until: typeof import('@vueuse/core').until
const useActiveElement: typeof import('@vueuse/core').useActiveElement
const useAnimate: typeof import('@vueuse/core').useAnimate
const useArrayDifference: typeof import('@vueuse/core').useArrayDifference
const useArrayEvery: typeof import('@vueuse/core').useArrayEvery
const useArrayFilter: typeof import('@vueuse/core').useArrayFilter
const useArrayFind: typeof import('@vueuse/core').useArrayFind
const useArrayFindIndex: typeof import('@vueuse/core').useArrayFindIndex
const useArrayFindLast: typeof import('@vueuse/core').useArrayFindLast
const useArrayIncludes: typeof import('@vueuse/core').useArrayIncludes
const useArrayJoin: typeof import('@vueuse/core').useArrayJoin
const useArrayMap: typeof import('@vueuse/core').useArrayMap
const useArrayReduce: typeof import('@vueuse/core').useArrayReduce
const useArraySome: typeof import('@vueuse/core').useArraySome
const useArrayUnique: typeof import('@vueuse/core').useArrayUnique
const useAsyncQueue: typeof import('@vueuse/core').useAsyncQueue
const useAsyncState: typeof import('@vueuse/core').useAsyncState
const useAttrs: typeof import('vue').useAttrs
const useBase64: typeof import('@vueuse/core').useBase64
const useBattery: typeof import('@vueuse/core').useBattery
const useBluetooth: typeof import('@vueuse/core').useBluetooth
const useBreakpoints: typeof import('@vueuse/core').useBreakpoints
const useBroadcastChannel: typeof import('@vueuse/core').useBroadcastChannel
const useBrowserLocation: typeof import('@vueuse/core').useBrowserLocation
const useCached: typeof import('@vueuse/core').useCached
const useClipboard: typeof import('@vueuse/core').useClipboard
const useClipboardItems: typeof import('@vueuse/core').useClipboardItems
const useCloned: typeof import('@vueuse/core').useCloned
const useColorMode: typeof import('@vueuse/core').useColorMode
const useConfirmDialog: typeof import('@vueuse/core').useConfirmDialog
const useCountdown: typeof import('@vueuse/core').useCountdown
const useCounter: typeof import('@vueuse/core').useCounter
const useCssModule: typeof import('vue').useCssModule
const useCssSupports: typeof import('@vueuse/core').useCssSupports
const useCssVar: typeof import('@vueuse/core').useCssVar
const useCssVars: typeof import('vue').useCssVars
const useCurrentElement: typeof import('@vueuse/core').useCurrentElement
const useCycleList: typeof import('@vueuse/core').useCycleList
const useDark: typeof import('@vueuse/core').useDark
const useDateFormat: typeof import('@vueuse/core').useDateFormat
const useDebounce: typeof import('@vueuse/core').useDebounce
const useDebounceFn: typeof import('@vueuse/core').useDebounceFn
const useDebouncedRefHistory: typeof import('@vueuse/core').useDebouncedRefHistory
const useDeviceMotion: typeof import('@vueuse/core').useDeviceMotion
const useDeviceOrientation: typeof import('@vueuse/core').useDeviceOrientation
const useDevicePixelRatio: typeof import('@vueuse/core').useDevicePixelRatio
const useDevicesList: typeof import('@vueuse/core').useDevicesList
const useDisplayMedia: typeof import('@vueuse/core').useDisplayMedia
const useDocumentVisibility: typeof import('@vueuse/core').useDocumentVisibility
const useDraggable: typeof import('@vueuse/core').useDraggable
const useDropZone: typeof import('@vueuse/core').useDropZone
const useElementBounding: typeof import('@vueuse/core').useElementBounding
const useElementByPoint: typeof import('@vueuse/core').useElementByPoint
const useElementHover: typeof import('@vueuse/core').useElementHover
const useElementSize: typeof import('@vueuse/core').useElementSize
const useElementVisibility: typeof import('@vueuse/core').useElementVisibility
const useEventBus: typeof import('@vueuse/core').useEventBus
const useEventListener: typeof import('@vueuse/core').useEventListener
const useEventSource: typeof import('@vueuse/core').useEventSource
const useEyeDropper: typeof import('@vueuse/core').useEyeDropper
const useFavicon: typeof import('@vueuse/core').useFavicon
const useFetch: typeof import('@vueuse/core').useFetch
const useFileDialog: typeof import('@vueuse/core').useFileDialog
const useFileSystemAccess: typeof import('@vueuse/core').useFileSystemAccess
const useFocus: typeof import('@vueuse/core').useFocus
const useFocusWithin: typeof import('@vueuse/core').useFocusWithin
const useFps: typeof import('@vueuse/core').useFps
const useFullscreen: typeof import('@vueuse/core').useFullscreen
const useGamepad: typeof import('@vueuse/core').useGamepad
const useGeolocation: typeof import('@vueuse/core').useGeolocation
const useId: typeof import('vue').useId
const useIdle: typeof import('@vueuse/core').useIdle
const useImage: typeof import('@vueuse/core').useImage
const useInfiniteScroll: typeof import('@vueuse/core').useInfiniteScroll
const useIntersectionObserver: typeof import('@vueuse/core').useIntersectionObserver
const useInterval: typeof import('@vueuse/core').useInterval
const useIntervalFn: typeof import('@vueuse/core').useIntervalFn
const useKeyModifier: typeof import('@vueuse/core').useKeyModifier
const useLastChanged: typeof import('@vueuse/core').useLastChanged
const useLink: typeof import('vue-router').useLink
const useLocalStorage: typeof import('@vueuse/core').useLocalStorage
const useMagicKeys: typeof import('@vueuse/core').useMagicKeys
const useManualRefHistory: typeof import('@vueuse/core').useManualRefHistory
const useMediaControls: typeof import('@vueuse/core').useMediaControls
const useMediaQuery: typeof import('@vueuse/core').useMediaQuery
const useMemoize: typeof import('@vueuse/core').useMemoize
const useMemory: typeof import('@vueuse/core').useMemory
const useModel: typeof import('vue').useModel
const useMounted: typeof import('@vueuse/core').useMounted
const useMouse: typeof import('@vueuse/core').useMouse
const useMouseInElement: typeof import('@vueuse/core').useMouseInElement
const useMousePressed: typeof import('@vueuse/core').useMousePressed
const useMutationObserver: typeof import('@vueuse/core').useMutationObserver
const useNavigatorLanguage: typeof import('@vueuse/core').useNavigatorLanguage
const useNetwork: typeof import('@vueuse/core').useNetwork
const useNow: typeof import('@vueuse/core').useNow
const useObjectUrl: typeof import('@vueuse/core').useObjectUrl
const useOffsetPagination: typeof import('@vueuse/core').useOffsetPagination
const useOnline: typeof import('@vueuse/core').useOnline
const usePageLeave: typeof import('@vueuse/core').usePageLeave
const useParallax: typeof import('@vueuse/core').useParallax
const useParentElement: typeof import('@vueuse/core').useParentElement
const usePerformanceObserver: typeof import('@vueuse/core').usePerformanceObserver
const usePermission: typeof import('@vueuse/core').usePermission
const usePointer: typeof import('@vueuse/core').usePointer
const usePointerLock: typeof import('@vueuse/core').usePointerLock
const usePointerSwipe: typeof import('@vueuse/core').usePointerSwipe
const usePreferredColorScheme: typeof import('@vueuse/core').usePreferredColorScheme
const usePreferredContrast: typeof import('@vueuse/core').usePreferredContrast
const usePreferredDark: typeof import('@vueuse/core').usePreferredDark
const usePreferredLanguages: typeof import('@vueuse/core').usePreferredLanguages
const usePreferredReducedMotion: typeof import('@vueuse/core').usePreferredReducedMotion
const usePreferredReducedTransparency: typeof import('@vueuse/core').usePreferredReducedTransparency
const usePrevious: typeof import('@vueuse/core').usePrevious
const useRafFn: typeof import('@vueuse/core').useRafFn
const useRefHistory: typeof import('@vueuse/core').useRefHistory
const useResizeObserver: typeof import('@vueuse/core').useResizeObserver
const useRoute: typeof import('vue-router').useRoute
const useRouter: typeof import('vue-router').useRouter
const useSSRWidth: typeof import('@vueuse/core').useSSRWidth
const useScreenOrientation: typeof import('@vueuse/core').useScreenOrientation
const useScreenSafeArea: typeof import('@vueuse/core').useScreenSafeArea
const useScriptTag: typeof import('@vueuse/core').useScriptTag
const useScroll: typeof import('@vueuse/core').useScroll
const useScrollLock: typeof import('@vueuse/core').useScrollLock
const useSessionStorage: typeof import('@vueuse/core').useSessionStorage
const useShare: typeof import('@vueuse/core').useShare
const useSlots: typeof import('vue').useSlots
const useSorted: typeof import('@vueuse/core').useSorted
const useSpeechRecognition: typeof import('@vueuse/core').useSpeechRecognition
const useSpeechSynthesis: typeof import('@vueuse/core').useSpeechSynthesis
const useStepper: typeof import('@vueuse/core').useStepper
const useStorage: typeof import('@vueuse/core').useStorage
const useStorageAsync: typeof import('@vueuse/core').useStorageAsync
const useStyleTag: typeof import('@vueuse/core').useStyleTag
const useSupported: typeof import('@vueuse/core').useSupported
const useSwipe: typeof import('@vueuse/core').useSwipe
const useTemplateRef: typeof import('vue').useTemplateRef
const useTemplateRefsList: typeof import('@vueuse/core').useTemplateRefsList
const useTextDirection: typeof import('@vueuse/core').useTextDirection
const useTextSelection: typeof import('@vueuse/core').useTextSelection
const useTextareaAutosize: typeof import('@vueuse/core').useTextareaAutosize
const useThrottle: typeof import('@vueuse/core').useThrottle
const useThrottleFn: typeof import('@vueuse/core').useThrottleFn
const useThrottledRefHistory: typeof import('@vueuse/core').useThrottledRefHistory
const useTimeAgo: typeof import('@vueuse/core').useTimeAgo
const useTimeAgoIntl: typeof import('@vueuse/core').useTimeAgoIntl
const useTimeout: typeof import('@vueuse/core').useTimeout
const useTimeoutFn: typeof import('@vueuse/core').useTimeoutFn
const useTimeoutPoll: typeof import('@vueuse/core').useTimeoutPoll
const useTimestamp: typeof import('@vueuse/core').useTimestamp
const useTitle: typeof import('@vueuse/core').useTitle
const useToNumber: typeof import('@vueuse/core').useToNumber
const useToString: typeof import('@vueuse/core').useToString
const useToggle: typeof import('@vueuse/core').useToggle
const useTransition: typeof import('@vueuse/core').useTransition
const useUrlSearchParams: typeof import('@vueuse/core').useUrlSearchParams
const useUserMedia: typeof import('@vueuse/core').useUserMedia
const useVModel: typeof import('@vueuse/core').useVModel
const useVModels: typeof import('@vueuse/core').useVModels
const useVibrate: typeof import('@vueuse/core').useVibrate
const useVirtualList: typeof import('@vueuse/core').useVirtualList
const useWakeLock: typeof import('@vueuse/core').useWakeLock
const useWebNotification: typeof import('@vueuse/core').useWebNotification
const useWebSocket: typeof import('@vueuse/core').useWebSocket
const useWebWorker: typeof import('@vueuse/core').useWebWorker
const useWebWorkerFn: typeof import('@vueuse/core').useWebWorkerFn
const useWindowFocus: typeof import('@vueuse/core').useWindowFocus
const useWindowScroll: typeof import('@vueuse/core').useWindowScroll
const useWindowSize: typeof import('@vueuse/core').useWindowSize
const watch: typeof import('vue').watch
const watchArray: typeof import('@vueuse/core').watchArray
const watchAtMost: typeof import('@vueuse/core').watchAtMost
const watchDebounced: typeof import('@vueuse/core').watchDebounced
const watchDeep: typeof import('@vueuse/core').watchDeep
const watchEffect: typeof import('vue').watchEffect
const watchIgnorable: typeof import('@vueuse/core').watchIgnorable
const watchImmediate: typeof import('@vueuse/core').watchImmediate
const watchOnce: typeof import('@vueuse/core').watchOnce
const watchPausable: typeof import('@vueuse/core').watchPausable
const watchPostEffect: typeof import('vue').watchPostEffect
const watchSyncEffect: typeof import('vue').watchSyncEffect
const watchThrottled: typeof import('@vueuse/core').watchThrottled
const watchTriggerable: typeof import('@vueuse/core').watchTriggerable
const watchWithFilter: typeof import('@vueuse/core').watchWithFilter
const whenever: typeof import('@vueuse/core').whenever
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
// for vue template auto import
import { UnwrapRef } from 'vue'
declare module 'vue' {
interface GlobalComponents {}
interface ComponentCustomProperties {
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
readonly computed: UnwrapRef<typeof import('vue')['computed']>
readonly computedAsync: UnwrapRef<typeof import('@vueuse/core')['computedAsync']>
readonly computedEager: UnwrapRef<typeof import('@vueuse/core')['computedEager']>
readonly computedInject: UnwrapRef<typeof import('@vueuse/core')['computedInject']>
readonly computedWithControl: UnwrapRef<typeof import('@vueuse/core')['computedWithControl']>
readonly controlledComputed: UnwrapRef<typeof import('@vueuse/core')['controlledComputed']>
readonly controlledRef: UnwrapRef<typeof import('@vueuse/core')['controlledRef']>
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
readonly createDisposableDirective: UnwrapRef<typeof import('@vueuse/core')['createDisposableDirective']>
readonly createEventHook: UnwrapRef<typeof import('@vueuse/core')['createEventHook']>
readonly createGlobalState: UnwrapRef<typeof import('@vueuse/core')['createGlobalState']>
readonly createInjectionState: UnwrapRef<typeof import('@vueuse/core')['createInjectionState']>
readonly createPinia: UnwrapRef<typeof import('pinia')['createPinia']>
readonly createReactiveFn: UnwrapRef<typeof import('@vueuse/core')['createReactiveFn']>
readonly createRef: UnwrapRef<typeof import('@vueuse/core')['createRef']>
readonly createReusableTemplate: UnwrapRef<typeof import('@vueuse/core')['createReusableTemplate']>
readonly createSharedComposable: UnwrapRef<typeof import('@vueuse/core')['createSharedComposable']>
readonly createTemplatePromise: UnwrapRef<typeof import('@vueuse/core')['createTemplatePromise']>
readonly createUnrefFn: UnwrapRef<typeof import('@vueuse/core')['createUnrefFn']>
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
readonly debouncedRef: UnwrapRef<typeof import('@vueuse/core')['debouncedRef']>
readonly debouncedWatch: UnwrapRef<typeof import('@vueuse/core')['debouncedWatch']>
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']>
readonly eagerComputed: UnwrapRef<typeof import('@vueuse/core')['eagerComputed']>
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
readonly extendRef: UnwrapRef<typeof import('@vueuse/core')['extendRef']>
readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']>
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
readonly getCurrentWatcher: UnwrapRef<typeof import('vue')['getCurrentWatcher']>
readonly h: UnwrapRef<typeof import('vue')['h']>
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
readonly inject: UnwrapRef<typeof import('vue')['inject']>
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
readonly isShallow: UnwrapRef<typeof import('vue')['isShallow']>
readonly makeDestructurable: UnwrapRef<typeof import('@vueuse/core')['makeDestructurable']>
readonly mapActions: UnwrapRef<typeof import('pinia')['mapActions']>
readonly mapGetters: UnwrapRef<typeof import('pinia')['mapGetters']>
readonly mapState: UnwrapRef<typeof import('pinia')['mapState']>
readonly mapStores: UnwrapRef<typeof import('pinia')['mapStores']>
readonly mapWritableState: UnwrapRef<typeof import('pinia')['mapWritableState']>
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router')['onBeforeRouteLeave']>
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router')['onBeforeRouteUpdate']>
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
readonly onClickOutside: UnwrapRef<typeof import('@vueuse/core')['onClickOutside']>
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
readonly onElementRemoval: UnwrapRef<typeof import('@vueuse/core')['onElementRemoval']>
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
readonly onKeyStroke: UnwrapRef<typeof import('@vueuse/core')['onKeyStroke']>
readonly onLongPress: UnwrapRef<typeof import('@vueuse/core')['onLongPress']>
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
readonly onStartTyping: UnwrapRef<typeof import('@vueuse/core')['onStartTyping']>
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
readonly onWatcherCleanup: UnwrapRef<typeof import('vue')['onWatcherCleanup']>
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
readonly provide: UnwrapRef<typeof import('vue')['provide']>
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
readonly reactiveComputed: UnwrapRef<typeof import('@vueuse/core')['reactiveComputed']>
readonly reactiveOmit: UnwrapRef<typeof import('@vueuse/core')['reactiveOmit']>
readonly reactivePick: UnwrapRef<typeof import('@vueuse/core')['reactivePick']>
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
readonly ref: UnwrapRef<typeof import('vue')['ref']>
readonly refAutoReset: UnwrapRef<typeof import('@vueuse/core')['refAutoReset']>
readonly refDebounced: UnwrapRef<typeof import('@vueuse/core')['refDebounced']>
readonly refDefault: UnwrapRef<typeof import('@vueuse/core')['refDefault']>
readonly refManualReset: UnwrapRef<typeof import('@vueuse/core')['refManualReset']>
readonly refThrottled: UnwrapRef<typeof import('@vueuse/core')['refThrottled']>
readonly refWithControl: UnwrapRef<typeof import('@vueuse/core')['refWithControl']>
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
readonly setActivePinia: UnwrapRef<typeof import('pinia')['setActivePinia']>
readonly setMapStoreSuffix: UnwrapRef<typeof import('pinia')['setMapStoreSuffix']>
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
readonly storeToRefs: UnwrapRef<typeof import('pinia')['storeToRefs']>
readonly syncRef: UnwrapRef<typeof import('@vueuse/core')['syncRef']>
readonly syncRefs: UnwrapRef<typeof import('@vueuse/core')['syncRefs']>
readonly templateRef: UnwrapRef<typeof import('@vueuse/core')['templateRef']>
readonly throttledRef: UnwrapRef<typeof import('@vueuse/core')['throttledRef']>
readonly throttledWatch: UnwrapRef<typeof import('@vueuse/core')['throttledWatch']>
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
readonly toReactive: UnwrapRef<typeof import('@vueuse/core')['toReactive']>
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
readonly tryOnBeforeMount: UnwrapRef<typeof import('@vueuse/core')['tryOnBeforeMount']>
readonly tryOnBeforeUnmount: UnwrapRef<typeof import('@vueuse/core')['tryOnBeforeUnmount']>
readonly tryOnMounted: UnwrapRef<typeof import('@vueuse/core')['tryOnMounted']>
readonly tryOnScopeDispose: UnwrapRef<typeof import('@vueuse/core')['tryOnScopeDispose']>
readonly tryOnUnmounted: UnwrapRef<typeof import('@vueuse/core')['tryOnUnmounted']>
readonly unref: UnwrapRef<typeof import('vue')['unref']>
readonly unrefElement: UnwrapRef<typeof import('@vueuse/core')['unrefElement']>
readonly until: UnwrapRef<typeof import('@vueuse/core')['until']>
readonly useActiveElement: UnwrapRef<typeof import('@vueuse/core')['useActiveElement']>
readonly useAnimate: UnwrapRef<typeof import('@vueuse/core')['useAnimate']>
readonly useArrayDifference: UnwrapRef<typeof import('@vueuse/core')['useArrayDifference']>
readonly useArrayEvery: UnwrapRef<typeof import('@vueuse/core')['useArrayEvery']>
readonly useArrayFilter: UnwrapRef<typeof import('@vueuse/core')['useArrayFilter']>
readonly useArrayFind: UnwrapRef<typeof import('@vueuse/core')['useArrayFind']>
readonly useArrayFindIndex: UnwrapRef<typeof import('@vueuse/core')['useArrayFindIndex']>
readonly useArrayFindLast: UnwrapRef<typeof import('@vueuse/core')['useArrayFindLast']>
readonly useArrayIncludes: UnwrapRef<typeof import('@vueuse/core')['useArrayIncludes']>
readonly useArrayJoin: UnwrapRef<typeof import('@vueuse/core')['useArrayJoin']>
readonly useArrayMap: UnwrapRef<typeof import('@vueuse/core')['useArrayMap']>
readonly useArrayReduce: UnwrapRef<typeof import('@vueuse/core')['useArrayReduce']>
readonly useArraySome: UnwrapRef<typeof import('@vueuse/core')['useArraySome']>
readonly useArrayUnique: UnwrapRef<typeof import('@vueuse/core')['useArrayUnique']>
readonly useAsyncQueue: UnwrapRef<typeof import('@vueuse/core')['useAsyncQueue']>
readonly useAsyncState: UnwrapRef<typeof import('@vueuse/core')['useAsyncState']>
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
readonly useBase64: UnwrapRef<typeof import('@vueuse/core')['useBase64']>
readonly useBattery: UnwrapRef<typeof import('@vueuse/core')['useBattery']>
readonly useBluetooth: UnwrapRef<typeof import('@vueuse/core')['useBluetooth']>
readonly useBreakpoints: UnwrapRef<typeof import('@vueuse/core')['useBreakpoints']>
readonly useBroadcastChannel: UnwrapRef<typeof import('@vueuse/core')['useBroadcastChannel']>
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
readonly useClipboardItems: UnwrapRef<typeof import('@vueuse/core')['useClipboardItems']>
readonly useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
readonly useCountdown: UnwrapRef<typeof import('@vueuse/core')['useCountdown']>
readonly useCounter: UnwrapRef<typeof import('@vueuse/core')['useCounter']>
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
readonly useCssSupports: UnwrapRef<typeof import('@vueuse/core')['useCssSupports']>
readonly useCssVar: UnwrapRef<typeof import('@vueuse/core')['useCssVar']>
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
readonly useCurrentElement: UnwrapRef<typeof import('@vueuse/core')['useCurrentElement']>
readonly useCycleList: UnwrapRef<typeof import('@vueuse/core')['useCycleList']>
readonly useDark: UnwrapRef<typeof import('@vueuse/core')['useDark']>
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
readonly useDebouncedRefHistory: UnwrapRef<typeof import('@vueuse/core')['useDebouncedRefHistory']>
readonly useDeviceMotion: UnwrapRef<typeof import('@vueuse/core')['useDeviceMotion']>
readonly useDeviceOrientation: UnwrapRef<typeof import('@vueuse/core')['useDeviceOrientation']>
readonly useDevicePixelRatio: UnwrapRef<typeof import('@vueuse/core')['useDevicePixelRatio']>
readonly useDevicesList: UnwrapRef<typeof import('@vueuse/core')['useDevicesList']>
readonly useDisplayMedia: UnwrapRef<typeof import('@vueuse/core')['useDisplayMedia']>
readonly useDocumentVisibility: UnwrapRef<typeof import('@vueuse/core')['useDocumentVisibility']>
readonly useDraggable: UnwrapRef<typeof import('@vueuse/core')['useDraggable']>
readonly useDropZone: UnwrapRef<typeof import('@vueuse/core')['useDropZone']>
readonly useElementBounding: UnwrapRef<typeof import('@vueuse/core')['useElementBounding']>
readonly useElementByPoint: UnwrapRef<typeof import('@vueuse/core')['useElementByPoint']>
readonly useElementHover: UnwrapRef<typeof import('@vueuse/core')['useElementHover']>
readonly useElementSize: UnwrapRef<typeof import('@vueuse/core')['useElementSize']>
readonly useElementVisibility: UnwrapRef<typeof import('@vueuse/core')['useElementVisibility']>
readonly useEventBus: UnwrapRef<typeof import('@vueuse/core')['useEventBus']>
readonly useEventListener: UnwrapRef<typeof import('@vueuse/core')['useEventListener']>
readonly useEventSource: UnwrapRef<typeof import('@vueuse/core')['useEventSource']>
readonly useEyeDropper: UnwrapRef<typeof import('@vueuse/core')['useEyeDropper']>
readonly useFavicon: UnwrapRef<typeof import('@vueuse/core')['useFavicon']>
readonly useFetch: UnwrapRef<typeof import('@vueuse/core')['useFetch']>
readonly useFileDialog: UnwrapRef<typeof import('@vueuse/core')['useFileDialog']>
readonly useFileSystemAccess: UnwrapRef<typeof import('@vueuse/core')['useFileSystemAccess']>
readonly useFocus: UnwrapRef<typeof import('@vueuse/core')['useFocus']>
readonly useFocusWithin: UnwrapRef<typeof import('@vueuse/core')['useFocusWithin']>
readonly useFps: UnwrapRef<typeof import('@vueuse/core')['useFps']>
readonly useFullscreen: UnwrapRef<typeof import('@vueuse/core')['useFullscreen']>
readonly useGamepad: UnwrapRef<typeof import('@vueuse/core')['useGamepad']>
readonly useGeolocation: UnwrapRef<typeof import('@vueuse/core')['useGeolocation']>
readonly useId: UnwrapRef<typeof import('vue')['useId']>
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
readonly useImage: UnwrapRef<typeof import('@vueuse/core')['useImage']>
readonly useInfiniteScroll: UnwrapRef<typeof import('@vueuse/core')['useInfiniteScroll']>
readonly useIntersectionObserver: UnwrapRef<typeof import('@vueuse/core')['useIntersectionObserver']>
readonly useInterval: UnwrapRef<typeof import('@vueuse/core')['useInterval']>
readonly useIntervalFn: UnwrapRef<typeof import('@vueuse/core')['useIntervalFn']>
readonly useKeyModifier: UnwrapRef<typeof import('@vueuse/core')['useKeyModifier']>
readonly useLastChanged: UnwrapRef<typeof import('@vueuse/core')['useLastChanged']>
readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']>
readonly useLocalStorage: UnwrapRef<typeof import('@vueuse/core')['useLocalStorage']>
readonly useMagicKeys: UnwrapRef<typeof import('@vueuse/core')['useMagicKeys']>
readonly useManualRefHistory: UnwrapRef<typeof import('@vueuse/core')['useManualRefHistory']>
readonly useMediaControls: UnwrapRef<typeof import('@vueuse/core')['useMediaControls']>
readonly useMediaQuery: UnwrapRef<typeof import('@vueuse/core')['useMediaQuery']>
readonly useMemoize: UnwrapRef<typeof import('@vueuse/core')['useMemoize']>
readonly useMemory: UnwrapRef<typeof import('@vueuse/core')['useMemory']>
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
readonly useMounted: UnwrapRef<typeof import('@vueuse/core')['useMounted']>
readonly useMouse: UnwrapRef<typeof import('@vueuse/core')['useMouse']>
readonly useMouseInElement: UnwrapRef<typeof import('@vueuse/core')['useMouseInElement']>
readonly useMousePressed: UnwrapRef<typeof import('@vueuse/core')['useMousePressed']>
readonly useMutationObserver: UnwrapRef<typeof import('@vueuse/core')['useMutationObserver']>
readonly useNavigatorLanguage: UnwrapRef<typeof import('@vueuse/core')['useNavigatorLanguage']>
readonly useNetwork: UnwrapRef<typeof import('@vueuse/core')['useNetwork']>
readonly useNow: UnwrapRef<typeof import('@vueuse/core')['useNow']>
readonly useObjectUrl: UnwrapRef<typeof import('@vueuse/core')['useObjectUrl']>
readonly useOffsetPagination: UnwrapRef<typeof import('@vueuse/core')['useOffsetPagination']>
readonly useOnline: UnwrapRef<typeof import('@vueuse/core')['useOnline']>
readonly usePageLeave: UnwrapRef<typeof import('@vueuse/core')['usePageLeave']>
readonly useParallax: UnwrapRef<typeof import('@vueuse/core')['useParallax']>
readonly useParentElement: UnwrapRef<typeof import('@vueuse/core')['useParentElement']>
readonly usePerformanceObserver: UnwrapRef<typeof import('@vueuse/core')['usePerformanceObserver']>
readonly usePermission: UnwrapRef<typeof import('@vueuse/core')['usePermission']>
readonly usePointer: UnwrapRef<typeof import('@vueuse/core')['usePointer']>
readonly usePointerLock: UnwrapRef<typeof import('@vueuse/core')['usePointerLock']>
readonly usePointerSwipe: UnwrapRef<typeof import('@vueuse/core')['usePointerSwipe']>
readonly usePreferredColorScheme: UnwrapRef<typeof import('@vueuse/core')['usePreferredColorScheme']>
readonly usePreferredContrast: UnwrapRef<typeof import('@vueuse/core')['usePreferredContrast']>
readonly usePreferredDark: UnwrapRef<typeof import('@vueuse/core')['usePreferredDark']>
readonly usePreferredLanguages: UnwrapRef<typeof import('@vueuse/core')['usePreferredLanguages']>
readonly usePreferredReducedMotion: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedMotion']>
readonly usePreferredReducedTransparency: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedTransparency']>
readonly usePrevious: UnwrapRef<typeof import('@vueuse/core')['usePrevious']>
readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']>
readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']>
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
readonly useSSRWidth: UnwrapRef<typeof import('@vueuse/core')['useSSRWidth']>
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
readonly useScriptTag: UnwrapRef<typeof import('@vueuse/core')['useScriptTag']>
readonly useScroll: UnwrapRef<typeof import('@vueuse/core')['useScroll']>
readonly useScrollLock: UnwrapRef<typeof import('@vueuse/core')['useScrollLock']>
readonly useSessionStorage: UnwrapRef<typeof import('@vueuse/core')['useSessionStorage']>
readonly useShare: UnwrapRef<typeof import('@vueuse/core')['useShare']>
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
readonly useSorted: UnwrapRef<typeof import('@vueuse/core')['useSorted']>
readonly useSpeechRecognition: UnwrapRef<typeof import('@vueuse/core')['useSpeechRecognition']>
readonly useSpeechSynthesis: UnwrapRef<typeof import('@vueuse/core')['useSpeechSynthesis']>
readonly useStepper: UnwrapRef<typeof import('@vueuse/core')['useStepper']>
readonly useStorage: UnwrapRef<typeof import('@vueuse/core')['useStorage']>
readonly useStorageAsync: UnwrapRef<typeof import('@vueuse/core')['useStorageAsync']>
readonly useStyleTag: UnwrapRef<typeof import('@vueuse/core')['useStyleTag']>
readonly useSupported: UnwrapRef<typeof import('@vueuse/core')['useSupported']>
readonly useSwipe: UnwrapRef<typeof import('@vueuse/core')['useSwipe']>
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
readonly useTemplateRefsList: UnwrapRef<typeof import('@vueuse/core')['useTemplateRefsList']>
readonly useTextDirection: UnwrapRef<typeof import('@vueuse/core')['useTextDirection']>
readonly useTextSelection: UnwrapRef<typeof import('@vueuse/core')['useTextSelection']>
readonly useTextareaAutosize: UnwrapRef<typeof import('@vueuse/core')['useTextareaAutosize']>
readonly useThrottle: UnwrapRef<typeof import('@vueuse/core')['useThrottle']>
readonly useThrottleFn: UnwrapRef<typeof import('@vueuse/core')['useThrottleFn']>
readonly useThrottledRefHistory: UnwrapRef<typeof import('@vueuse/core')['useThrottledRefHistory']>
readonly useTimeAgo: UnwrapRef<typeof import('@vueuse/core')['useTimeAgo']>
readonly useTimeAgoIntl: UnwrapRef<typeof import('@vueuse/core')['useTimeAgoIntl']>
readonly useTimeout: UnwrapRef<typeof import('@vueuse/core')['useTimeout']>
readonly useTimeoutFn: UnwrapRef<typeof import('@vueuse/core')['useTimeoutFn']>
readonly useTimeoutPoll: UnwrapRef<typeof import('@vueuse/core')['useTimeoutPoll']>
readonly useTimestamp: UnwrapRef<typeof import('@vueuse/core')['useTimestamp']>
readonly useTitle: UnwrapRef<typeof import('@vueuse/core')['useTitle']>
readonly useToNumber: UnwrapRef<typeof import('@vueuse/core')['useToNumber']>
readonly useToString: UnwrapRef<typeof import('@vueuse/core')['useToString']>
readonly useToggle: UnwrapRef<typeof import('@vueuse/core')['useToggle']>
readonly useTransition: UnwrapRef<typeof import('@vueuse/core')['useTransition']>
readonly useUrlSearchParams: UnwrapRef<typeof import('@vueuse/core')['useUrlSearchParams']>
readonly useUserMedia: UnwrapRef<typeof import('@vueuse/core')['useUserMedia']>
readonly useVModel: UnwrapRef<typeof import('@vueuse/core')['useVModel']>
readonly useVModels: UnwrapRef<typeof import('@vueuse/core')['useVModels']>
readonly useVibrate: UnwrapRef<typeof import('@vueuse/core')['useVibrate']>
readonly useVirtualList: UnwrapRef<typeof import('@vueuse/core')['useVirtualList']>
readonly useWakeLock: UnwrapRef<typeof import('@vueuse/core')['useWakeLock']>
readonly useWebNotification: UnwrapRef<typeof import('@vueuse/core')['useWebNotification']>
readonly useWebSocket: UnwrapRef<typeof import('@vueuse/core')['useWebSocket']>
readonly useWebWorker: UnwrapRef<typeof import('@vueuse/core')['useWebWorker']>
readonly useWebWorkerFn: UnwrapRef<typeof import('@vueuse/core')['useWebWorkerFn']>
readonly useWindowFocus: UnwrapRef<typeof import('@vueuse/core')['useWindowFocus']>
readonly useWindowScroll: UnwrapRef<typeof import('@vueuse/core')['useWindowScroll']>
readonly useWindowSize: UnwrapRef<typeof import('@vueuse/core')['useWindowSize']>
readonly watch: UnwrapRef<typeof import('vue')['watch']>
readonly watchArray: UnwrapRef<typeof import('@vueuse/core')['watchArray']>
readonly watchAtMost: UnwrapRef<typeof import('@vueuse/core')['watchAtMost']>
readonly watchDebounced: UnwrapRef<typeof import('@vueuse/core')['watchDebounced']>
readonly watchDeep: UnwrapRef<typeof import('@vueuse/core')['watchDeep']>
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
readonly watchIgnorable: UnwrapRef<typeof import('@vueuse/core')['watchIgnorable']>
readonly watchImmediate: UnwrapRef<typeof import('@vueuse/core')['watchImmediate']>
readonly watchOnce: UnwrapRef<typeof import('@vueuse/core')['watchOnce']>
readonly watchPausable: UnwrapRef<typeof import('@vueuse/core')['watchPausable']>
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
readonly watchThrottled: UnwrapRef<typeof import('@vueuse/core')['watchThrottled']>
readonly watchTriggerable: UnwrapRef<typeof import('@vueuse/core')['watchTriggerable']>
readonly watchWithFilter: UnwrapRef<typeof import('@vueuse/core')['watchWithFilter']>
readonly whenever: UnwrapRef<typeof import('@vueuse/core')['whenever']>
}
}
@@ -0,0 +1,127 @@
/* eslint-disable */
// @ts-nocheck
// biome-ignore lint: disable
// oxlint-disable
// ------
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AixunCodeEditor: typeof import('./../components/AixunCodeEditor/index.vue')['default']
AiXunDoc: typeof import('./../components/AiXunDoc/index.vue')['default']
ApprovalButton: typeof import('./../components/Process/approvalButton.vue')['default']
ApprovalRecord: typeof import('./../components/Process/approvalRecord.vue')['default']
AssetCatalogAssist: typeof import('./../components/AssetCatalogAssist/index.vue')['default']
Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default']
ComplianceAssist: typeof import('./../components/ComplianceAssist/index.vue')['default']
DictTag: typeof import('./../components/DictTag/index.vue')['default']
Editor: typeof import('./../components/Editor/index.vue')['default']
ElAlert: typeof import('element-plus/es')['ElAlert']
ElBadge: typeof import('element-plus/es')['ElBadge']
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElResult: typeof import('element-plus/es')['ElResult']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElStatistic: typeof import('element-plus/es')['ElStatistic']
ElStep: typeof import('element-plus/es')['ElStep']
ElSteps: typeof import('element-plus/es')['ElSteps']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElText: typeof import('element-plus/es')['ElText']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimeSelect: typeof import('element-plus/es')['ElTimeSelect']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElTreeV2: typeof import('element-plus/es')['ElTreeV2']
ElUpload: typeof import('element-plus/es')['ElUpload']
FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
FlowChart: typeof import('./../components/Process/flowChart.vue')['default']
FlowChartImg: typeof import('./../components/Process/flowChartImg.vue')['default']
FormAssist: typeof import('./../components/FormAssist/index.vue')['default']
Hamburger: typeof import('./../components/Hamburger/index.vue')['default']
IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
IFrame: typeof import('./../components/iFrame/index.vue')['default']
ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']
LangSelect: typeof import('./../components/LangSelect/index.vue')['default']
MasterModelAssist: typeof import('./../components/MasterModelAssist/index.vue')['default']
MessageType: typeof import('./../components/Process/MessageType.vue')['default']
MetadataCompletionAssist: typeof import('./../components/MetadataCompletionAssist/index.vue')['default']
MetadataGraphAssist: typeof import('./../components/MetadataGraphAssist/index.vue')['default']
MetaModelAssist: typeof import('./../components/MetaModelAssist/index.vue')['default']
PageAssist: typeof import('./../components/PageAssist/index.vue')['default']
Pagination: typeof import('./../components/Pagination/index.vue')['default']
ParentView: typeof import('./../components/ParentView/index.vue')['default']
ProcessMeddle: typeof import('./../components/Process/processMeddle.vue')['default']
ProfileEvidenceAssist: typeof import('./../components/ProfileEvidenceAssist/index.vue')['default']
RecordComparisonAssist: typeof import('./../components/RecordComparisonAssist/index.vue')['default']
RightToolbar: typeof import('./../components/RightToolbar/index.vue')['default']
RoleSelect: typeof import('./../components/RoleSelect/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Screenfull: typeof import('./../components/Screenfull/index.vue')['default']
StandardSystemAssist: typeof import('./../components/StandardSystemAssist/index.vue')['default']
StructuredFormAssist: typeof import('./../components/StructuredFormAssist/index.vue')['default']
SubmitVerify: typeof import('./../components/Process/submitVerify.vue')['default']
SvgIcon: typeof import('./../components/SvgIcon/index.vue')['default']
TaskLogAssist: typeof import('./../components/TaskLogAssist/index.vue')['default']
TopNav: typeof import('./../components/TopNav/index.vue')['default']
TreePanel: typeof import('./../components/TreePanel/index.vue')['default']
UserNameDisplay: typeof import('./../components/Process/UserNameDisplay.vue')['default']
UserSelect: typeof import('./../components/UserSelect/index.vue')['default']
WorkbenchOrigin: typeof import('./../components/WorkbenchOrigin/index.vue')['default']
}
export interface GlobalDirectives {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}
@@ -0,0 +1,407 @@
<template>
<div class="p-2 app-container">
<div class="search-wrap">
<el-card shadow="hover" class="search-panel" :class="{ 'is-collapsed': !showSearch }">
<el-form :model="query" :inline="true" class="query-form" @submit.prevent="handleQuery">
<el-form-item label="关键词">
<el-input
v-model="query.keyword"
clearable
maxlength="200"
placeholder="请输入名称"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="实体类型">
<el-select v-model="query.entityType" class="w-full">
<el-option v-for="item in entityTypes" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="上游深度">
<el-input-number v-model="query.upstreamDepth" :min="0" :max="3" controls-position="right" />
</el-form-item>
<el-form-item label="下游深度">
<el-input-number v-model="query.downstreamDepth" :min="0" :max="3" controls-position="right" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<el-card shadow="hover" class="table-panel">
<template #header>
<div class="toolbar-shell">
<div class="toolbar-actions">
<right-toolbar v-model:show-search="showSearch" :search="false" @query-table="reloadCurrent" />
</div>
</div>
</template>
<el-table v-loading="loading" :data="candidates" border class="data-table" empty-text="暂无血缘候选">
<el-table-column label="名称" min-width="180" show-overflow-tooltip>
<template #default="{ row }">{{ row.displayName || row.name }}</template>
</el-table-column>
<el-table-column label="类型" width="120" align="center">
<template #default="{ row }">{{ entityTypeLabel(row.entityType) }}</template>
</el-table-column>
<el-table-column label="更新时间" min-width="170" align="center">
<template #default="{ row }">{{ formatTime(row.updatedAt) }}</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="220" align="center">
<template #default="{ row }">
<el-button
v-hasPermi="['aixun:governance:metadata-lineage:view']"
link
type="primary"
icon="View"
@click="viewCandidate(row)"
>
查看
</el-button>
<el-button
v-hasPermi="['aixun:governance:metadata-lineage:refresh']"
link
type="primary"
icon="Refresh"
:loading="refreshingId === row.externalId"
@click="refreshAndOpen(row)"
>
刷新血缘
</el-button>
</template>
</el-table-column>
</el-table>
<div class="toolbar-shell">
<pagination :page="1" v-model:limit="query.limit" layout="sizes" @pagination="handleQuery" />
<div class="toolbar-actions">
<el-button icon="ArrowLeft" :disabled="loading || cursorTrail.length === 0" @click="previousPage">
上一页
</el-button>
<el-button icon="ArrowRight" :disabled="loading || !pageAfter" @click="nextPage">下一页</el-button>
</div>
</div>
</el-card>
<el-drawer
v-model="drawerVisible"
title="血缘详情"
size="78%"
append-to-body
destroy-on-close
@opened="drawerReady = true"
>
<el-skeleton v-if="snapshotLoading" :rows="8" animated />
<el-tabs v-else-if="snapshot" v-model="activeTab">
<el-tab-pane label="血缘图" name="graph">
<DgVisualWorkspace
v-if="drawerVisible && drawerReady && activeTab === 'graph'"
label="血缘分析"
:inspector-visible="inspectorVisible"
>
<template #toolbar>
<div class="toolbar-actions">
<PageAssist page-id="P28" :link="false" :context="{ snapshotId: snapshot.snapshotId, externalId: snapshot.graph.root.externalId, entityType: snapshot.graph.root.entityType, updatedAt: snapshot.graph.observedAt, nodeCount: snapshot.graph.nodes.length, edgeCount: snapshot.graph.upstreamEdges.length + snapshot.graph.downstreamEdges.length, fieldMappingCount: snapshot.graph.fieldMappings.length, truncated: snapshot.graph.truncated, upstreamDepth: snapshot.graph.upstreamDepth, downstreamDepth: snapshot.graph.downstreamDepth }" />
<el-radio-group v-model="view" size="small" aria-label="血缘视图">
<el-radio-button value="tables">表级</el-radio-button>
<el-radio-button value="fields">已映射字段</el-radio-button>
</el-radio-group>
<el-form :model="depth" inline class="query-form" @submit.prevent="refreshDepth">
<el-form-item label="上游深度">
<el-input-number v-model="depth.upstreamDepth" :min="0" :max="3" size="small" />
</el-form-item>
<el-form-item label="下游深度">
<el-input-number v-model="depth.downstreamDepth" :min="0" :max="3" size="small" />
</el-form-item>
<el-form-item>
<el-button v-if="canRefresh" size="small" @click="refreshDepth">刷新血缘</el-button>
</el-form-item>
</el-form>
<el-button size="small" @click="inspectorVisible = !inspectorVisible">
{{ inspectorVisible ? '收起详情' : '展开详情' }}
</el-button>
</div>
</template>
<template #catalog>
<el-input v-model="directoryQuery" clearable placeholder="搜索对象名称" aria-label="搜索对象" />
<div class="dg-visual-catalog-list">
<el-button
v-for="node in directoryNodes"
:key="node.externalId"
:type="selectedNodeId === node.externalId ? 'primary' : 'default'"
text
:title="nodeLabel(node)"
@click="selectNode(node.externalId)"
>
{{ nodeLabel(node) }}
</el-button>
<span v-if="!directoryNodes.length">暂无匹配对象</span>
</div>
<template v-if="view === 'fields' && selectedNode">
<el-divider>已映射字段</el-divider>
<div class="dg-visual-catalog-list">
<el-button
v-for="field in selectedFields"
:key="field.id"
text
:type="selectedField?.fieldId === field.id ? 'primary' : 'default'"
@click="selectField({ nodeId: selectedNode.externalId, fieldId: field.id })"
>
{{ field.label }}
</el-button>
<span v-if="!selectedFields.length">暂无字段映射</span>
</div>
</template>
</template>
<DgEntityCanvas
:graph="graph"
:scope-key="scopeKey"
readonly
:focus="focus"
:highlighted-node-ids="emphasis.nodeIds"
:highlighted-edge-ids="emphasis.edgeIds"
:selected-field="selectedField"
@select="selectNode"
@field="selectField"
@edge="selectEdge"
/>
<template #inspector>
<el-descriptions
v-if="selectedNode"
:column="1"
direction="vertical"
border
class="dg-visual-detail-text"
>
<el-descriptions-item label="名称">{{ nodeLabel(selectedNode) }}</el-descriptions-item>
<el-descriptions-item label="类型">{{ entityTypeLabel(selectedNode.entityType) }}</el-descriptions-item>
<el-descriptions-item v-if="selectedField" label="已映射字段">
{{ selectedField.fieldId }}
</el-descriptions-item>
<el-descriptions-item v-if="selectedEdge" label="来源">
{{ labelById(selectedEdge.source) }}
<template v-if="selectedEdge.sourceField">· {{ selectedEdge.sourceField }}</template>
</el-descriptions-item>
<el-descriptions-item v-if="selectedEdge" label="目标">
{{ labelById(selectedEdge.target) }}
<template v-if="selectedEdge.targetField">· {{ selectedEdge.targetField }}</template>
</el-descriptions-item>
</el-descriptions>
<p v-else>请选择对象或字段</p>
<div v-if="selectedNode" class="dg-visual-catalog-list">
<el-button
@click="
traceQuery.fromExternalId = selectedNode.externalId;
activeTab = 'trace';
"
>
从此处追踪
</el-button>
<el-button
@click="
impactQuery.sourceExternalId = selectedNode.externalId;
activeTab = 'impact';
"
>
分析下游影响
</el-button>
</div>
</template>
<template #status>
<span>
{{ graph.nodes.length }} 个对象 · {{ graph.edges.length }} 条{{
view === 'fields' ? '字段映射' : '关系'
}}
</span>
<el-tag v-if="snapshot.graph.truncated" type="warning" effect="plain">结果已截断</el-tag>
<span v-if="analysis === 'trace'">已突出显示追踪路径</span>
<span v-else-if="analysis === 'impact'">已突出显示下游影响对象</span>
</template>
</DgVisualWorkspace>
</el-tab-pane>
<el-tab-pane label="链路追踪" name="trace">
<el-form :model="traceQuery" :inline="true" class="query-form" @submit.prevent="runTrace">
<el-form-item label="起点" required>
<el-select v-model="traceQuery.fromExternalId" filterable placeholder="请选择起点">
<el-option
v-for="node in snapshot.graph.nodes"
:key="node.externalId"
:label="nodeLabel(node)"
:value="node.externalId"
/>
</el-select>
</el-form-item>
<el-form-item label="终点" required>
<el-select v-model="traceQuery.toExternalId" filterable placeholder="请选择终点">
<el-option
v-for="node in snapshot.graph.nodes"
:key="node.externalId"
:label="nodeLabel(node)"
:value="node.externalId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="traceLoading" @click="runTrace">开始追踪</el-button>
<el-button :disabled="!traceResult?.reachable" @click="showAnalysis('trace')">图上查看</el-button>
<MetadataGraphAssist v-if="traceResult" :selection="{ pageId: 'P28', snapshotId: snapshot.snapshotId, mode: 'TRACE', fromId: traceResult.fromExternalId, toId: traceResult.toExternalId }" />
</el-form-item>
</el-form>
<el-table
v-if="traceResult?.reachable"
:data="traceResult.path"
border
class="data-table"
empty-text="暂无路径"
>
<el-table-column type="index" label="顺序" width="80" align="center" />
<el-table-column label="节点" min-width="180">
<template #default="{ row }">{{ nodeLabel(row) }}</template>
</el-table-column>
<el-table-column label="类型" width="120" align="center">
<template #default="{ row }">{{ entityTypeLabel(row.entityType) }}</template>
</el-table-column>
</el-table>
<p v-else-if="traceResult">当前节点间无可达路径</p>
<p v-else>请选择起点和终点</p>
</el-tab-pane>
<el-tab-pane label="下游影响" name="impact">
<el-form :model="impactQuery" :inline="true" class="query-form" @submit.prevent="runImpact">
<el-form-item label="来源节点" required>
<el-select v-model="impactQuery.sourceExternalId" filterable placeholder="请选择来源节点">
<el-option
v-for="node in snapshot.graph.nodes"
:key="node.externalId"
:label="nodeLabel(node)"
:value="node.externalId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="impactLoading" @click="runImpact">分析影响</el-button>
<el-button :disabled="!impactResult" @click="showAnalysis('impact')">图上查看</el-button>
<MetadataGraphAssist v-if="impactResult" :selection="{ pageId: 'P28', snapshotId: snapshot.snapshotId, mode: 'IMPACT', fromId: impactResult.sourceExternalId }" />
</el-form-item>
<el-form-item v-if="impactResult?.truncated">
<el-tag type="warning" effect="plain">结果已截断</el-tag>
</el-form-item>
</el-form>
<el-table v-if="impactResult" :data="impactResult.items" border class="data-table" empty-text="暂无下游影响">
<el-table-column label="名称" min-width="180" show-overflow-tooltip>
<template #default="{ row }">{{ row.name ?? '--' }}</template>
</el-table-column>
<el-table-column label="类型" width="120" align="center">
<template #default="{ row }">{{ entityTypeLabel(row.entityType) }}</template>
</el-table-column>
<el-table-column label="最短距离" width="110" align="center">
<template #default="{ row }">{{ row.shortestDistance ?? '--' }}</template>
</el-table-column>
</el-table>
<p v-else>请选择来源节点</p>
</el-tab-pane>
<el-tab-pane label="更新信息" name="snapshot">
<el-descriptions :column="2" border>
<el-descriptions-item label="根节点">{{ nodeLabel(snapshot.graph.root) }}</el-descriptions-item>
<el-descriptions-item label="实体类型">
{{ entityTypeLabel(snapshot.graph.root.entityType) }}
</el-descriptions-item>
<el-descriptions-item label="观察时间">{{ formatTime(snapshot.graph.observedAt) }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ formatTime(snapshot.createdAt) }}</el-descriptions-item>
<el-descriptions-item label="上游深度">{{ snapshot.graph.upstreamDepth }}</el-descriptions-item>
<el-descriptions-item label="下游深度">{{ snapshot.graph.downstreamDepth }}</el-descriptions-item>
<el-descriptions-item label="截断状态" :span="2">
{{ snapshot.graph.truncated ? '结果已截断' : '未截断' }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
</el-tabs>
<div v-else-if="!snapshotLoading">
<p role="status">{{ snapshotError || '暂无已存血缘快照' }}</p>
<div class="toolbar-actions">
<el-button v-if="currentCandidate" @click="viewCandidate(currentCandidate)">重新查看</el-button>
<el-button v-if="canRefresh && currentCandidate" type="primary" @click="refreshDepth">刷新血缘</el-button>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="drawerVisible = false">关 闭</el-button>
</div>
</template>
</el-drawer>
</div>
</template>
<script setup name="MetadataLineage" lang="ts">
import PageAssist from '@/components/PageAssist/index.vue';
import MetadataGraphAssist from '@/components/MetadataGraphAssist/index.vue';
import { defineAsyncComponent } from 'vue';
import { useLineage, entityTypes, nodeLabel, formatTime, entityTypeLabel } from './useLineage';
const DgVisualWorkspace = defineAsyncComponent(
() => import('@/design-system/components/visualization/DgVisualWorkspace.vue')
);
const DgEntityCanvas = defineAsyncComponent(
() => import('@/design-system/components/visualization/DgEntityCanvas.vue')
);
const {
query,
candidates,
loading,
showSearch,
pageAfter,
cursorTrail,
snapshot,
drawerVisible,
drawerReady,
snapshotLoading,
snapshotError,
activeTab,
refreshingId,
currentCandidate,
view,
directoryQuery,
selectedNodeId,
selectedField,
selectedNode,
selectedFields,
selectedEdge,
inspectorVisible,
focus,
depth,
traceQuery,
traceResult,
traceLoading,
impactQuery,
impactResult,
impactLoading,
analysis,
canRefresh,
graph,
directoryNodes,
emphasis,
scopeKey,
handleQuery,
resetQuery,
reloadCurrent,
nextPage,
previousPage,
refreshAndOpen,
refreshDepth,
viewCandidate,
runTrace,
runImpact,
showAnalysis,
selectNode,
selectField,
selectEdge
} = useLineage();
const labelById = (id: string) => {
const node = snapshot.value?.graph.nodes.find(item => item.externalId === id);
return node ? nodeLabel(node) : '--';
};
</script>
@@ -0,0 +1,132 @@
import type {
MetadataLineageGraph,
MetadataLineageSnapshot,
MetadataLineageTraceResult,
MetadataLineageImpactResult
} from '@/api/datagov/metadata-lineage/types';
import type { CanvasGraph, CanvasNode, CanvasEdge } from '@/design-system/components/visualization/types';
import { validateGraph } from '@/design-system/components/visualization/types';
export type LineageView = 'tables' | 'fields';
const entityTypeLabel = (value: string) =>
({ TABLE: '数据表', PIPELINE: '数据管道', DASHBOARD: '仪表盘' } as Readonly<Record<string, string>>)[value] || '未知类型';
export const tableEdgeId = (source: string, target: string) => JSON.stringify(['entity', source, target]);
export const mappingEdgeId = (source: string, field: string, target: string, targetField: string) =>
JSON.stringify(['field', source, field, target, targetField]);
export function projectLineage(graph: MetadataLineageGraph, view: LineageView): CanvasGraph {
if (
!graph ||
!graph.root ||
!Array.isArray(graph.nodes) ||
!Array.isArray(graph.upstreamEdges) ||
!Array.isArray(graph.downstreamEdges) ||
!Array.isArray(graph.fieldMappings)
)
throw new Error('血缘快照结构不完整');
const nodes: CanvasNode[] = graph.nodes.map(node => ({
id: node.externalId,
label: node.displayName || node.name,
kind: entityTypeLabel(node.entityType)
}));
validateGraph({ nodes, edges: [] });
if (nodes.length && !nodes.some(node => node.id === graph.root.externalId)) throw new Error('血缘快照缺少根节点');
const ids = new Set(nodes.map(node => node.id));
const entityEdges = new Map<string, CanvasEdge>();
for (const edge of [...graph.upstreamEdges, ...graph.downstreamEdges]) {
if (!ids.has(edge.fromExternalId) || !ids.has(edge.toExternalId)) throw new Error('血缘关系存在缺失对象');
const id = tableEdgeId(edge.fromExternalId, edge.toExternalId);
entityEdges.set(id, { id, source: edge.fromExternalId, target: edge.toExternalId });
}
const fields = new Map(nodes.map(node => [node.id, new Set<string>()]));
const mappings = new Map<string, CanvasEdge>();
for (const mapping of graph.fieldMappings) {
if (
!ids.has(mapping.fromExternalId) ||
!ids.has(mapping.toExternalId) ||
typeof mapping.fromField !== 'string' ||
!mapping.fromField.trim() ||
typeof mapping.toField !== 'string' ||
!mapping.toField.trim()
)
throw new Error('字段映射存在缺失对象或字段');
fields.get(mapping.fromExternalId)!.add(mapping.fromField);
fields.get(mapping.toExternalId)!.add(mapping.toField);
const id = mappingEdgeId(mapping.fromExternalId, mapping.fromField, mapping.toExternalId, mapping.toField);
mappings.set(id, {
id,
source: mapping.fromExternalId,
target: mapping.toExternalId,
sourceField: mapping.fromField,
targetField: mapping.toField
});
}
const result = {
nodes: nodes.map(node => ({
...node,
fields: view === 'fields' ? [...fields.get(node.id)!].map(id => ({ id, label: id })) : undefined
})),
edges: view === 'fields' ? [...mappings.values()] : [...entityEdges.values()]
};
validateGraph(result);
return result;
}
export function assertTrace(
snapshot: MetadataLineageSnapshot,
result: MetadataLineageTraceResult,
from: string,
to: string
): void {
const nodes = new Set(snapshot.graph.nodes.map(node => node.externalId));
if (
result.snapshotId !== snapshot.snapshotId ||
result.fromExternalId !== from ||
result.toExternalId !== to ||
!Array.isArray(result.path) ||
result.path.some(node => !nodes.has(node.externalId))
)
throw new Error('链路结果与当前快照不一致');
if (!result.reachable) {
if (result.path.length) throw new Error('链路结果无效');
return;
}
if (result.path[0]?.externalId !== from || result.path.at(-1)?.externalId !== to) throw new Error('链路端点不一致');
const pairs = new Set(
[...snapshot.graph.upstreamEdges, ...snapshot.graph.downstreamEdges].map(edge =>
tableEdgeId(edge.fromExternalId, edge.toExternalId)
)
);
for (let i = 1; i < result.path.length; i++)
if (!pairs.has(tableEdgeId(result.path[i - 1].externalId, result.path[i].externalId)))
throw new Error('链路方向与快照不一致');
}
export function assertImpact(
snapshot: MetadataLineageSnapshot,
result: MetadataLineageImpactResult,
source: string
): void {
const nodes = new Set(snapshot.graph.nodes.map(node => node.externalId));
const seen = new Set<string>();
if (result.snapshotId !== snapshot.snapshotId || result.sourceExternalId !== source || !Array.isArray(result.items))
throw new Error('影响结果与当前快照不一致');
for (const item of result.items) {
if (
!nodes.has(item.externalId) ||
seen.has(item.externalId) ||
!Number.isInteger(item.shortestDistance) ||
item.shortestDistance < 1
)
throw new Error('影响结果无效');
seen.add(item.externalId);
}
}
export function fieldEmphasis(graph: CanvasGraph, selection: { nodeId: string; fieldId: string }) {
const edges = graph.edges.filter(
edge =>
(edge.source === selection.nodeId && edge.sourceField === selection.fieldId) ||
(edge.target === selection.nodeId && edge.targetField === selection.fieldId)
);
return {
nodeIds: [...new Set([selection.nodeId, ...edges.flatMap(edge => [edge.source, edge.target])])],
edgeIds: edges.map(edge => edge.id)
};
}
@@ -0,0 +1,482 @@
import { ElMessage } from 'element-plus';
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
import type {
MetadataLineageCandidate,
MetadataLineageCandidateQuery,
MetadataLineageEntityType,
MetadataLineageImpactResult,
MetadataLineageNode,
MetadataLineageSnapshot,
MetadataLineageTraceResult
} from '@/api/datagov/metadata-lineage/types';
import {
getLatestMetadataLineageSnapshot,
getMetadataLineageSnapshot,
impactMetadataLineage,
pageMetadataLineageCandidates,
refreshMetadataLineage,
traceMetadataLineage
} from '@/api/datagov/metadata-lineage';
import { checkPermi } from '@/utils/permission';
import type { LineageView } from './projection';
import { assertImpact, assertTrace, fieldEmphasis, projectLineage, tableEdgeId } from './projection';
export const entityTypes: Array<{ label: string; value: MetadataLineageEntityType }> = [
{ label: '数据表', value: 'TABLE' },
{ label: '数据管道', value: 'PIPELINE' },
{ label: '仪表盘', value: 'DASHBOARD' }
];
export const nodeLabel = (node: MetadataLineageNode) => node.displayName || node.name;
export const formatTime = (value?: string) => (value ? value.replace('T', ' ').slice(0, 19) : '--');
export const entityTypeLabel = (value: MetadataLineageEntityType) =>
entityTypes.find(item => item.value === value)?.label || '未知类型';
const emptyQuery = (): MetadataLineageCandidateQuery & { upstreamDepth: number; downstreamDepth: number } => ({
entityType: 'TABLE',
keyword: undefined,
limit: 20,
upstreamDepth: 2,
downstreamDepth: 2
});
export function useLineage() {
const query = reactive(emptyQuery());
const candidates = ref<MetadataLineageCandidate[]>([]);
const loading = ref(false);
const showSearch = ref(true);
const pageAfter = ref<string>();
const cursorTrail = ref<Array<string | undefined>>([]);
const snapshot = ref<MetadataLineageSnapshot>();
const drawerVisible = ref(false);
const drawerReady = ref(false);
const snapshotLoading = ref(false);
const snapshotError = ref('');
const activeTab = ref('graph');
const refreshingId = ref('');
const currentCandidate = ref<MetadataLineageCandidate>();
const view = ref<LineageView>('tables');
const directoryQuery = ref('');
const selectedNodeId = ref('');
const selectedField = ref<{ nodeId: string; fieldId: string }>();
const selectedEdgeId = ref('');
const inspectorVisible = ref(true);
const focus = ref<{ nodeId: string; request: number }>();
let focusCounter = 0;
const depth = reactive({ upstreamDepth: 2, downstreamDepth: 2 });
const traceQuery = reactive({ fromExternalId: '', toExternalId: '' });
const traceResult = ref<MetadataLineageTraceResult>();
const traceLoading = ref(false);
const impactQuery = reactive({ sourceExternalId: '' });
const impactResult = ref<MetadataLineageImpactResult>();
const impactLoading = ref(false);
const analysis = ref<'selection' | 'trace' | 'impact'>('selection');
let candidateGeneration = 0,
snapshotGeneration = 0,
traceGeneration = 0,
impactGeneration = 0;
let disposed = false;
const canView = computed(() => checkPermi(['aixun:governance:metadata-lineage:view']));
const canRefresh = computed(() => checkPermi(['aixun:governance:metadata-lineage:refresh']));
const graph = computed(() =>
snapshot.value ? projectLineage(snapshot.value.graph, view.value) : { nodes: [], edges: [] }
);
const fieldGraph = computed(() =>
snapshot.value ? projectLineage(snapshot.value.graph, 'fields') : { nodes: [], edges: [] }
);
const selectedNode = computed(() =>
snapshot.value?.graph.nodes.find(node => node.externalId === selectedNodeId.value)
);
const selectedFields = computed(
() => fieldGraph.value.nodes.find(node => node.id === selectedNodeId.value)?.fields ?? []
);
const selectedEdge = computed(() => graph.value.edges.find(edge => edge.id === selectedEdgeId.value));
const directoryNodes = computed(
() =>
snapshot.value?.graph.nodes.filter(node =>
nodeLabel(node).toLocaleLowerCase().includes(directoryQuery.value.trim().toLocaleLowerCase())
) ?? []
);
const emphasis = computed(() => {
if (analysis.value === 'trace' && traceResult.value?.reachable) {
const path = traceResult.value.path;
return {
nodeIds: path.map(node => node.externalId),
edgeIds:
view.value === 'tables'
? path.slice(1).map((node, i) => tableEdgeId(path[i].externalId, node.externalId))
: []
};
}
if (analysis.value === 'impact' && impactResult.value)
return {
nodeIds: [impactResult.value.sourceExternalId, ...impactResult.value.items.map(item => item.externalId)],
edgeIds: []
};
if (selectedField.value && view.value === 'fields') return fieldEmphasis(graph.value, selectedField.value);
if (selectedEdge.value)
return { nodeIds: [selectedEdge.value.source, selectedEdge.value.target], edgeIds: [selectedEdge.value.id] };
if (!selectedNodeId.value) return { nodeIds: [], edgeIds: [] };
const edges = graph.value.edges.filter(
edge => edge.source === selectedNodeId.value || edge.target === selectedNodeId.value
);
return {
nodeIds: [...new Set([selectedNodeId.value, ...edges.flatMap(edge => [edge.source, edge.target])])],
edgeIds: edges.map(edge => edge.id)
};
});
const scopeKey = computed(() => JSON.stringify([snapshot.value?.snapshotId, view.value]));
function clearAnalysis() {
traceGeneration++;
impactGeneration++;
traceResult.value = undefined;
impactResult.value = undefined;
traceLoading.value = false;
impactLoading.value = false;
analysis.value = 'selection';
}
function clearSnapshot() {
snapshot.value = undefined;
selectedNodeId.value = '';
selectedField.value = undefined;
selectedEdgeId.value = '';
focus.value = undefined;
directoryQuery.value = '';
clearAnalysis();
}
function closeWorkspace() {
snapshotGeneration++;
drawerReady.value = false;
snapshotLoading.value = false;
refreshingId.value = '';
snapshotError.value = '';
currentCandidate.value = undefined;
clearSnapshot();
}
function selectNode(id: string) {
if (!snapshot.value?.graph.nodes.some(node => node.externalId === id)) return;
selectedNodeId.value = id;
selectedField.value = undefined;
selectedEdgeId.value = '';
analysis.value = 'selection';
inspectorVisible.value = true;
focus.value = { nodeId: id, request: ++focusCounter };
}
function selectField(selection: { nodeId: string; fieldId: string }) {
if (
!fieldGraph.value.nodes
.find(node => node.id === selection.nodeId)
?.fields?.some(field => field.id === selection.fieldId)
)
return;
selectNode(selection.nodeId);
selectedField.value = { ...selection };
}
function selectEdge(id: string) {
const edge = graph.value.edges.find(item => item.id === id);
if (!edge) return;
selectNode(edge.source);
selectedEdgeId.value = id;
}
function accept(value: MetadataLineageSnapshot) {
projectLineage(value.graph, 'fields');
snapshot.value = value;
depth.upstreamDepth = value.graph.upstreamDepth;
depth.downstreamDepth = value.graph.downstreamDepth;
traceQuery.fromExternalId = value.graph.root.externalId;
traceQuery.toExternalId = '';
impactQuery.sourceExternalId = value.graph.root.externalId;
activeTab.value = 'graph';
selectNode(value.graph.root.externalId);
}
function beginSnapshot() {
const generation = ++snapshotGeneration;
clearSnapshot();
snapshotError.value = '';
snapshotLoading.value = true;
drawerVisible.value = true;
activeTab.value = 'graph';
return generation;
}
const currentSnapshot = (generation: number) => !disposed && drawerVisible.value && generation === snapshotGeneration;
async function loadCandidates(after?: string) {
if (!canView.value || disposed) return false;
const generation = ++candidateGeneration;
const params = {
entityType: query.entityType,
limit: query.limit,
after,
keyword: query.keyword?.trim() || undefined
};
loading.value = true;
candidates.value = [];
pageAfter.value = undefined;
try {
const response = await pageMetadataLineageCandidates(params);
if (disposed || generation !== candidateGeneration) return false;
if (!response.data || !Array.isArray(response.data.items)) throw new Error('候选结果缺失');
candidates.value = response.data.items;
pageAfter.value = response.data.after || undefined;
return true;
} catch {
if (!disposed && generation === candidateGeneration) ElMessage.error('血缘候选加载失败,请稍后重试');
return false;
} finally {
if (!disposed && generation === candidateGeneration) loading.value = false;
}
}
const handleQuery = () => {
cursorTrail.value = [];
void loadCandidates();
};
const resetQuery = () => {
Object.assign(query, emptyQuery());
handleQuery();
};
const reloadCurrent = () => loadCandidates(cursorTrail.value.at(-1));
const nextPage = async () => {
const cursor = pageAfter.value;
if (!loading.value && cursor && (await loadCandidates(cursor))) cursorTrail.value.push(cursor);
};
const previousPage = async () => {
if (!loading.value && cursorTrail.value.length && (await loadCandidates(cursorTrail.value.at(-2))))
cursorTrail.value.pop();
};
async function refreshAndOpen(
row: MetadataLineageCandidate,
limits = { upstreamDepth: query.upstreamDepth, downstreamDepth: query.downstreamDepth }
) {
if (!canRefresh.value) {
ElMessage.warning('无血缘刷新权限');
return;
}
if (
![limits.upstreamDepth, limits.downstreamDepth].every(
value => Number.isInteger(value) && value >= 0 && value <= 3
)
) {
ElMessage.warning('血缘深度必须在0到3之间');
return;
}
const command = { entityType: row.entityType, externalId: row.externalId, ...limits };
const generation = beginSnapshot();
currentCandidate.value = { ...row };
refreshingId.value = row.externalId;
try {
const key = `m4-lineage-refresh-${crypto.randomUUID().replaceAll('-', '')}`;
const response = await refreshMetadataLineage(command, key);
if (!currentSnapshot(generation)) return;
if (!response.data?.snapshot?.snapshotId) throw new Error('刷新结果缺失');
const result = await getMetadataLineageSnapshot(response.data.snapshot.snapshotId);
if (!currentSnapshot(generation)) return;
if (!result.data) throw new Error('快照结果缺失');
if (
result.data.snapshotId !== response.data.snapshot.snapshotId ||
result.data.graph.root.externalId !== command.externalId ||
result.data.graph.root.entityType !== command.entityType
)
throw new Error('血缘快照与所选对象不一致');
accept(result.data);
} catch {
if (currentSnapshot(generation)) {
clearSnapshot();
snapshotError.value = '血缘刷新失败,请重试或查看已有快照';
ElMessage.error(snapshotError.value);
}
} finally {
if (currentSnapshot(generation)) {
snapshotLoading.value = false;
refreshingId.value = '';
}
}
}
function refreshDepth() {
const root = snapshot.value?.graph.root ?? currentCandidate.value;
if (root) void refreshAndOpen(root, { ...depth });
}
async function viewCandidate(row: MetadataLineageCandidate) {
if (!canView.value || disposed) return;
const candidate = { ...row };
const generation = beginSnapshot();
currentCandidate.value = candidate;
depth.upstreamDepth = query.upstreamDepth;
depth.downstreamDepth = query.downstreamDepth;
try {
const result = await getLatestMetadataLineageSnapshot(candidate.entityType, candidate.externalId);
if (!currentSnapshot(generation)) return;
if (result.data == null) return;
if (
result.data.graph.root.externalId !== candidate.externalId ||
result.data.graph.root.entityType !== candidate.entityType
)
throw new Error('快照对象不一致');
accept(result.data);
} catch {
if (currentSnapshot(generation)) {
clearSnapshot();
snapshotError.value = '快照加载失败,请稍后重试';
ElMessage.error(snapshotError.value);
}
} finally {
if (currentSnapshot(generation)) snapshotLoading.value = false;
}
}
async function runTrace() {
const value = snapshot.value;
const from = traceQuery.fromExternalId,
to = traceQuery.toExternalId;
if (!value || !from || !to || !canView.value) {
ElMessage.warning('请选择起点和终点');
return;
}
const generation = ++traceGeneration;
traceResult.value = undefined;
analysis.value = 'selection';
traceLoading.value = true;
try {
const response = await traceMetadataLineage(value.snapshotId, from, to);
if (disposed || generation !== traceGeneration || snapshot.value?.snapshotId !== value.snapshotId) return;
if (!response.data) throw new Error('追踪结果缺失');
assertTrace(value, response.data, from, to);
traceResult.value = response.data;
} catch {
if (!disposed && generation === traceGeneration) ElMessage.error('链路追踪失败,请稍后重试');
} finally {
if (!disposed && generation === traceGeneration) traceLoading.value = false;
}
}
async function runImpact() {
const value = snapshot.value;
const source = impactQuery.sourceExternalId;
if (!value || !source || !canView.value) {
ElMessage.warning('请选择来源节点');
return;
}
const generation = ++impactGeneration;
impactResult.value = undefined;
analysis.value = 'selection';
impactLoading.value = true;
try {
const response = await impactMetadataLineage(value.snapshotId, source);
if (disposed || generation !== impactGeneration || snapshot.value?.snapshotId !== value.snapshotId) return;
if (!response.data) throw new Error('影响结果缺失');
assertImpact(value, response.data, source);
impactResult.value = response.data;
} catch {
if (!disposed && generation === impactGeneration) ElMessage.error('下游影响分析失败,请稍后重试');
} finally {
if (!disposed && generation === impactGeneration) impactLoading.value = false;
}
}
function showAnalysis(kind: 'trace' | 'impact') {
if ((kind === 'trace' && !traceResult.value?.reachable) || (kind === 'impact' && !impactResult.value)) return;
selectedField.value = undefined;
selectedEdgeId.value = '';
analysis.value = kind;
focus.value = undefined;
activeTab.value = 'graph';
}
watch(
drawerVisible,
value => {
if (!value) closeWorkspace();
},
{ flush: 'sync' }
);
watch(view, () => {
selectedField.value = undefined;
selectedEdgeId.value = '';
});
watch(
() => [traceQuery.fromExternalId, traceQuery.toExternalId],
() => {
traceGeneration++;
traceResult.value = undefined;
traceLoading.value = false;
if (analysis.value === 'trace') analysis.value = 'selection';
},
{ flush: 'sync' }
);
watch(
() => impactQuery.sourceExternalId,
() => {
impactGeneration++;
impactResult.value = undefined;
impactLoading.value = false;
if (analysis.value === 'impact') analysis.value = 'selection';
},
{ flush: 'sync' }
);
watch(
canView,
value => {
if (!value) {
drawerVisible.value = false;
closeWorkspace();
candidates.value = [];
candidateGeneration++;
}
},
{ flush: 'sync' }
);
onMounted(() => {
if (canView.value) void loadCandidates();
});
onBeforeUnmount(() => {
disposed = true;
candidateGeneration++;
closeWorkspace();
});
return {
query,
candidates,
loading,
showSearch,
pageAfter,
cursorTrail,
snapshot,
drawerVisible,
drawerReady,
snapshotLoading,
snapshotError,
activeTab,
refreshingId,
currentCandidate,
view,
directoryQuery,
selectedNodeId,
selectedField,
selectedNode,
selectedFields,
selectedEdge,
inspectorVisible,
focus,
depth,
traceQuery,
traceResult,
traceLoading,
impactQuery,
impactResult,
impactLoading,
analysis,
canView,
canRefresh,
graph,
fieldGraph,
directoryNodes,
emphasis,
scopeKey,
handleQuery,
resetQuery,
reloadCurrent,
nextPage,
previousPage,
refreshAndOpen,
refreshDepth,
viewCandidate,
runTrace,
runImpact,
showAnalysis,
selectNode,
selectField,
selectEdge
};
}
@@ -0,0 +1,431 @@
<template>
<div class="p-2 app-container">
<div class="search-wrap">
<el-card shadow="hover" class="search-panel" :class="{ 'is-collapsed': !showSearch }">
<el-form :model="query" :inline="true" class="query-form" @submit.prevent="handleQuery">
<el-form-item label="关键词">
<el-input
v-model="query.keyword"
clearable
maxlength="200"
placeholder="请输入名称"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="对象类型">
<el-select v-model="query.rootType" class="w-full">
<el-option v-for="item in rootTypes" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="关联深度">
<el-input-number v-model="query.depth" :min="0" :max="3" controls-position="right" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<el-card shadow="hover" class="table-panel">
<template #header>
<div class="toolbar-shell">
<div><RelationDeclarationDrawer /></div>
<div class="toolbar-actions">
<right-toolbar v-model:show-search="showSearch" :search="false" @query-table="reloadCurrent" />
</div>
</div>
</template>
<el-table v-loading="loading" :data="candidates" border class="data-table" empty-text="暂无关系候选">
<el-table-column label="名称" min-width="180" show-overflow-tooltip>
<template #default="{ row }">{{ row.displayName || row.name }}</template>
</el-table-column>
<el-table-column label="类型" width="140" align="center">
<template #default="{ row }">{{ rootTypeLabel(row.rootType) }}</template>
</el-table-column>
<el-table-column label="更新时间" min-width="170" align="center">
<template #default="{ row }">{{ formatTime(row.updatedAt) }}</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="180" align="center">
<template #default="{ row }">
<el-button
v-hasPermi="['aixun:governance:metadata-relation:view']"
link
type="primary"
icon="View"
:loading="openingId === row.externalId"
@click="openSnapshotById(row.externalId)"
>
查看
</el-button>
<el-button
v-hasPermi="['aixun:governance:metadata-relation:import']"
link
type="primary"
icon="Download"
:loading="importingId === row.externalId"
@click="importById(row.externalId)"
>
更新关系
</el-button>
</template>
</el-table-column>
</el-table>
<div class="toolbar-shell">
<pagination :page="1" v-model:limit="query.limit" layout="sizes" @pagination="handleQuery" />
<div class="toolbar-actions">
<el-button icon="ArrowLeft" :disabled="loading || cursorTrail.length === 0" @click="previousPage">
上一页
</el-button>
<el-button icon="ArrowRight" :disabled="loading || !pageAfter" @click="nextPage">下一页</el-button>
</div>
</div>
</el-card>
<el-drawer
v-model="drawerVisible"
title="关系详情"
size="78%"
append-to-body
destroy-on-close
@opened="drawerReady = true"
>
<el-skeleton v-if="snapshotLoading" :rows="8" animated />
<el-tabs v-else-if="snapshot" v-model="activeTab">
<el-tab-pane label="关系图谱" name="graph">
<DgVisualWorkspace
v-if="drawerVisible && drawerReady && activeTab === 'graph'"
label="关系图谱"
:inspector-visible="inspectorVisible"
>
<template #toolbar>
<div class="toolbar-actions">
<el-radio-group v-model="mode" size="small" aria-label="图谱视图">
<el-radio-button value="mindmap">双侧脑图</el-radio-button>
<el-radio-button value="network">关系网络</el-radio-button>
</el-radio-group>
<el-form :model="filter" inline class="query-form" @submit.prevent>
<el-form-item label="关系类型">
<el-select v-model="filter.relationType" size="small">
<el-option label="全部" value="" />
<el-option v-for="type in relationTypes" :key="type" :label="relationTypeLabel(type)" :value="type" />
</el-select>
</el-form-item>
<el-form-item label="方向">
<el-select v-model="filter.direction" size="small">
<el-option label="全部" value="both" />
<el-option label="出向可达" value="outgoing" />
<el-option label="入向可达" value="incoming" />
</el-select>
</el-form-item>
<el-form-item label="显示深度">
<el-select v-model="filter.depth" size="small">
<el-option label="全部" :value="null" />
<el-option
v-for="value in [0, 1, 2, 3, 4, 5]"
:key="value"
:label="String(value)"
:value="value"
/>
</el-select>
</el-form-item>
</el-form>
<el-button size="small" @click="showAll">全部关系</el-button>
<el-button size="small" @click="inspectorVisible = !inspectorVisible">
{{ inspectorVisible ? '收起详情' : '展开详情' }}
</el-button>
</div>
</template>
<template #catalog>
<el-input v-model="directoryQuery" clearable placeholder="搜索对象名称" aria-label="搜索对象" />
<div class="dg-visual-catalog-list">
<el-button
v-for="node in directoryNodes"
:key="node.nodeId"
text
:type="selectedNodeId === node.nodeId ? 'primary' : 'default'"
:title="node.name"
@click="selectNode(node.nodeId, true)"
>
{{ node.name }}
</el-button>
<span v-if="!directoryNodes.length">暂无匹配对象</span>
</div>
</template>
<DgRelationCanvas
:graph="graph"
:root-id="snapshot.graph.rootNodeId"
:scope-key="scopeKey"
:mode="mode"
:collapsed="collapsed"
:focus="focus"
:highlighted-node-ids="emphasis.nodeIds"
:highlighted-edge-ids="emphasis.edgeIds"
@select="selectNode"
@edge="selectEdge"
@projection="projection = $event"
/>
<template #inspector>
<el-descriptions
v-if="selectedNode"
:column="1"
direction="vertical"
border
class="dg-visual-detail-text"
>
<el-descriptions-item label="名称">{{ selectedNode.name }}</el-descriptions-item>
<el-descriptions-item label="类型">{{ nodeTypeLabel(selectedNode.nodeType) }}</el-descriptions-item>
<el-descriptions-item label="质量评分">
{{ qualityLabel(selectedNode.qualityScore) }}
</el-descriptions-item>
<el-descriptions-item label="认领状态">{{ claimStateLabel(selectedNode.claimState) }}</el-descriptions-item>
<el-descriptions-item v-if="selectedEdge" label="关系类型">
{{ relationTypeLabel(selectedEdge.relationType) }}
</el-descriptions-item>
<el-descriptions-item v-if="selectedEdge" label="方向">
{{ labelById(selectedEdge.source) }} → {{ labelById(selectedEdge.target) }}
</el-descriptions-item>
</el-descriptions>
<p v-else>请选择对象或关系</p>
<div v-if="selectedNode" class="dg-visual-catalog-list">
<MetadataGraphAssist :selection="{ pageId: 'P27', snapshotId: snapshot.snapshotId, mode: 'RELATIONS', fromId: selectedNode.nodeId }" />
<el-button v-if="mode === 'mindmap'" @click="toggleCollapse">
{{ collapsed.includes(selectedNodeId) ? '展开分支' : '折叠分支' }}
</el-button>
<el-divider>关联关系</el-divider>
<el-button
v-for="edge in relatedEdges"
:key="edge.id"
text
:type="selectedEdgeId === edge.id ? 'primary' : 'default'"
@click="selectEdge(edge.id, true)"
>
{{ labelById(edge.source) }} → {{ labelById(edge.target) }} · {{ relationTypeLabel(edge.relationType) }}
</el-button>
<span v-if="!relatedEdges.length">暂无关联关系</span>
</div>
</template>
<template #status>
<span>{{ projection.visibleNodeIds.length }} 个对象 · {{ projection.visibleEdgeIds.length }} 条关系</span>
<el-tag v-if="snapshot.graph.truncated" type="warning" effect="plain">结果已截断</el-tag>
<span v-if="hiddenEdges || hiddenNodes">另 {{ hiddenEdges }} 条关系、{{ hiddenNodes }} 个对象未显示</span>
<el-button v-if="hiddenEdges || hiddenNodes" link type="primary" @click="showAll">查看全部关系</el-button>
</template>
</DgVisualWorkspace>
</el-tab-pane>
<el-tab-pane label="订阅与事件" name="api">
<div class="toolbar-shell">
<div class="table-heading"><h3>站内订阅</h3></div>
<div class="toolbar-actions">
<el-button
v-hasPermi="['aixun:governance:metadata-relation:subscribe']"
type="primary"
plain
icon="Plus"
:loading="subscriptionSaving"
@click="createSubscription"
>
创建订阅
</el-button>
<el-button
v-hasPermi="['aixun:governance:metadata-relation:export']"
icon="Download"
:loading="exporting"
@click="exportSnapshot"
>
导出快照
</el-button>
</div>
</div>
<el-table
v-if="canSubscribe"
v-loading="subscriptionsLoading"
:data="subscriptions"
border
class="data-table"
empty-text="暂无订阅"
>
<el-table-column label="订阅事件" min-width="210">
<template #default="{ row }">{{ row.eventTypes.map(eventTypeLabel).join('、') }}</template>
</el-table-column>
<el-table-column label="状态" width="110" align="center">
<template #default="{ row }">{{ stateLabel(row.state) }}</template>
</el-table-column>
<el-table-column label="更新时间" width="170" align="center">
<template #default="{ row }">{{ formatTime(row.updateTime) }}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template #default="{ row }">
<el-button
v-if="row.state !== 'ACTIVE'"
link
type="primary"
:disabled="subscriptionSaving"
v-hasPermi="['aixun:governance:metadata-relation:subscribe']"
@click="changeSubscriptionById(row.subscriptionId, 'ACTIVE')"
>
恢复
</el-button>
<el-button
v-if="row.state === 'ACTIVE'"
link
type="primary"
:disabled="subscriptionSaving"
v-hasPermi="['aixun:governance:metadata-relation:subscribe']"
@click="changeSubscriptionById(row.subscriptionId, 'PAUSED')"
>
暂停
</el-button>
<el-button
v-if="row.state !== 'CANCELLED'"
link
type="danger"
:disabled="subscriptionSaving"
v-hasPermi="['aixun:governance:metadata-relation:subscribe']"
@click="changeSubscriptionById(row.subscriptionId, 'CANCELLED')"
>
取消
</el-button>
</template>
</el-table-column>
</el-table>
<p v-if="subscriptionsError" role="status">
{{ subscriptionsError }}
<el-button link @click="loadSubscriptions">重试</el-button>
</p>
<div class="toolbar-shell mt-3">
<div class="table-heading"><h3>变更事件</h3></div>
<el-button icon="Refresh" :loading="eventsLoading" @click="pollEvents">轮询</el-button>
</div>
<el-table v-loading="eventsLoading" :data="events" border class="data-table" empty-text="暂无变更事件">
<el-table-column label="对象" min-width="180" show-overflow-tooltip>
<template #default>{{ labelById(snapshot.graph.rootNodeId) }}</template>
</el-table-column>
<el-table-column label="事件" width="130" align="center">
<template #default="{ row }">{{ eventTypeLabel(row.eventType) }}</template>
</el-table-column>
<el-table-column label="创建时间" width="170" align="center">
<template #default="{ row }">{{ formatTime(row.createTime) }}</template>
</el-table-column>
</el-table>
<p v-if="eventsError" role="status">{{ eventsError }}</p>
</el-tab-pane>
<el-tab-pane label="更新信息" name="snapshot">
<PageAssist page-id="P27" :context="{ rootExternalId: snapshot.rootExternalId, rootType: snapshot.rootType, snapshotId: snapshot.snapshotId }" />
<el-descriptions :column="2" border>
<el-descriptions-item label="对象">{{ labelById(snapshot.graph.rootNodeId) }}</el-descriptions-item>
<el-descriptions-item label="对象类型">{{ rootTypeLabel(snapshot.rootType) }}</el-descriptions-item>
<el-descriptions-item label="节点数">{{ snapshot.graph.nodes.length }}</el-descriptions-item>
<el-descriptions-item label="关系数">{{ snapshot.graph.edges.length }}</el-descriptions-item>
<el-descriptions-item label="观察时间">{{ formatTime(snapshot.graph.observedAt) }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ formatTime(snapshot.createdAt) }}</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
</el-tabs>
<div v-else-if="!snapshotLoading">
<p role="status">{{ snapshotError || '暂无关系快照' }}</p>
<div class="toolbar-actions">
<el-button v-if="currentCandidate" @click="openSnapshot(currentCandidate)">重试</el-button>
<el-button v-if="canImport && currentCandidate" type="primary" @click="importAndOpen(currentCandidate)">
更新关系
</el-button>
</div>
</div>
<template #footer>
<div class="dialog-footer"><el-button @click="drawerVisible = false">关 闭</el-button></div>
</template>
</el-drawer>
</div>
</template>
<script setup name="MetadataRelations" lang="ts">
import PageAssist from '@/components/PageAssist/index.vue';
import MetadataGraphAssist from '@/components/MetadataGraphAssist/index.vue';
import RelationDeclarationDrawer from './RelationDeclarationDrawer.vue';
import { defineAsyncComponent } from 'vue';
import {
useRelations,
rootTypes,
rootTypeLabel,
formatTime,
eventTypeLabel,
stateLabel,
qualityLabel,
nodeTypeLabel,
relationTypeLabel,
claimStateLabel
} from './useRelations';
const DgVisualWorkspace = defineAsyncComponent(
() => import('@/design-system/components/visualization/DgVisualWorkspace.vue')
);
const DgRelationCanvas = defineAsyncComponent(
() => import('@/design-system/components/visualization/DgRelationCanvas.vue')
);
const {
query,
candidates,
loading,
showSearch,
pageAfter,
cursorTrail,
snapshot,
currentCandidate,
drawerVisible,
drawerReady,
snapshotLoading,
snapshotError,
activeTab,
openingId,
importingId,
mode,
filter,
collapsed,
selectedNodeId,
selectedEdgeId,
directoryQuery,
inspectorVisible,
focus,
projection,
subscriptions,
subscriptionsLoading,
subscriptionsError,
subscriptionSaving,
events,
eventsLoading,
eventsError,
exporting,
canImport,
canSubscribe,
graph,
relationTypes,
selectedNode,
selectedEdge,
relatedEdges,
directoryNodes,
emphasis,
hiddenNodes,
hiddenEdges,
scopeKey,
showAll,
selectNode,
selectEdge,
toggleCollapse,
labelById,
openSnapshot,
importAndOpen,
handleQuery,
resetQuery,
reloadCurrent,
nextPage,
previousPage,
loadSubscriptions,
createSubscription,
changeSubscription,
pollEvents,
exportSnapshot
} = useRelations();
function openSnapshotById(id: string) { const row = candidates.value.find(c => c.externalId === id); if (row) void openSnapshot(row); }
function importById(id: string) { const row = candidates.value.find(c => c.externalId === id); if (row) void importAndOpen(row); }
function changeSubscriptionById(id: string, state: 'ACTIVE' | 'PAUSED' | 'CANCELLED') { const row = subscriptions.value.find(s => s.subscriptionId === id); if (row) void changeSubscription(row, state); }
</script>
@@ -0,0 +1,97 @@
import type { MetadataRelationGraph } from '@/api/datagov/metadata-relations/types';
import type { CanvasGraph, CanvasEdge } from '@/design-system/components/visualization/types';
import { validateGraph } from '@/design-system/components/visualization/types';
export interface RelationFilter {
relationType: string;
direction: 'both' | 'incoming' | 'outgoing';
depth: number | null;
}
const NODE_TYPE_LABELS: Readonly<Record<string, string>> = Object.freeze({
TABLE: '数据表',
DATABASE_SCHEMA: '数据库模式',
DATABASE: '数据库',
SERVICE: '数据服务',
OWNER: '负责人',
DOMAIN: '数据域',
CLASSIFICATION: '分类标签',
GLOSSARY_TERM: '业务术语',
QUALITY: '质量检查',
PIPELINE: '数据管道',
DASHBOARD: '仪表盘'
});
const RELATION_TYPE_LABELS: Readonly<Record<string, string>> = Object.freeze({
BELONGS_TO_SERVICE: '属于数据服务',
BELONGS_TO_DATABASE: '属于数据库',
BELONGS_TO_SCHEMA: '属于数据库模式',
OWNED_BY: '负责人',
IN_DOMAIN: '属于数据域',
CLASSIFIED_AS: '分类标签',
HAS_GLOSSARY_TERM: '业务术语',
HAS_QUALITY_PROJECTION: '质量检查',
LINEAGE: '数据血缘'
});
export const nodeTypeLabel = (value?: string) => value ? (NODE_TYPE_LABELS[value] || '其他对象') : '--';
export const relationTypeLabel = (value?: string) => value ? (RELATION_TYPE_LABELS[value] || '其他关系') : '--';
export const defaultFilter = (): RelationFilter => ({ relationType: '', direction: 'both', depth: null });
export function relationGraph(input: MetadataRelationGraph): CanvasGraph {
if (
!input ||
!Array.isArray(input.nodes) ||
!Array.isArray(input.edges) ||
input.nodes.length > 200 ||
input.edges.length > 400
)
throw new Error('关系快照无效');
const counts = new Map<string, number>();
const graph = {
nodes: input.nodes.map(node => ({
id: node.nodeId,
label: node.name,
kind: nodeTypeLabel(node.nodeType)
})),
edges: input.edges.map(edge => {
if (typeof edge.relationType !== 'string' || !edge.relationType.trim()) throw new Error('关系类型缺失');
const tuple = JSON.stringify([edge.fromNodeId, edge.toNodeId, edge.relationType]);
const count = counts.get(tuple) ?? 0;
counts.set(tuple, count + 1);
return {
id: JSON.stringify([edge.fromNodeId, edge.toNodeId, edge.relationType, count]),
source: edge.fromNodeId,
target: edge.toNodeId,
label: relationTypeLabel(edge.relationType),
relationType: edge.relationType
};
})
};
validateGraph(graph);
if (graph.nodes.length && !graph.nodes.some(node => node.id === input.rootNodeId))
throw new Error('关系快照缺少根节点');
return graph;
}
export function filterRelations(graph: CanvasGraph, rootId: string, filter: RelationFilter): CanvasGraph {
if (filter.depth !== null && (!Number.isInteger(filter.depth) || filter.depth < 0 || filter.depth > 200))
throw new Error('显示深度无效');
const edges = graph.edges.filter(edge => !filter.relationType || edge.relationType === filter.relationType);
let ids = new Set(graph.nodes.map(node => node.id));
if (filter.depth !== null || filter.direction !== 'both') {
ids = new Set(graph.nodes.some(node => node.id === rootId) ? [rootId] : []);
const queue = [{ id: rootId, depth: 0 }];
for (let i = 0; i < queue.length; i++) {
const item = queue[i];
if (filter.depth !== null && item.depth >= filter.depth) continue;
for (const edge of edges) {
let next: string | undefined;
if (edge.source === item.id && filter.direction !== 'incoming') next = edge.target;
else if (edge.target === item.id && filter.direction !== 'outgoing') next = edge.source;
if (next === undefined || ids.has(next)) continue;
ids.add(next);
queue.push({ id: next, depth: item.depth + 1 });
}
}
}
return {
nodes: graph.nodes.filter(node => ids.has(node.id)).map(node => ({ ...node })),
edges: edges.filter(edge => ids.has(edge.source) && ids.has(edge.target)).map((edge): CanvasEdge => ({ ...edge }))
};
}
@@ -0,0 +1,614 @@
import { ElMessage } from 'element-plus';
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
import type {
MetadataRelationCandidate,
MetadataRelationCandidateQuery,
MetadataRelationClaimState,
MetadataRelationEvent,
MetadataRelationEventType,
MetadataRelationRootType,
MetadataRelationSnapshot,
MetadataRelationSubscription,
MetadataRelationSubscriptionState
} from '@/api/datagov/metadata-relations/types';
import type { ProjectionSummary } from '@/design-system/components/visualization/types';
import {
createMetadataRelationSubscription,
exportMetadataRelationSnapshot,
getLatestMetadataRelationSnapshot,
importMetadataRelations,
listMetadataRelationSubscriptions,
pageMetadataRelationCandidates,
pollMetadataRelationEvents,
updateMetadataRelationSubscription
} from '@/api/datagov/metadata-relations';
import { sha256Hex } from '@/utils/crypto';
import { checkPermi } from '@/utils/permission';
import { isHandledRequestError } from '@/utils/request';
import { defaultFilter, filterRelations, nodeTypeLabel, relationGraph, relationTypeLabel } from './projection';
export const rootTypes: Array<{ label: string; value: MetadataRelationRootType }> = [
{ label: '数据表', value: 'TABLE' },
{ label: '数据库模式', value: 'DATABASE_SCHEMA' },
{ label: '数据库', value: 'DATABASE' },
{ label: '数据管道', value: 'PIPELINE' },
{ label: '仪表盘', value: 'DASHBOARD' }
];
export const rootTypeLabel = (value: MetadataRelationRootType) =>
rootTypes.find(item => item.value === value)?.label || '未知类型';
export const formatTime = (value?: string) => (value ? value.replace('T', ' ').slice(0, 19) : '--');
export const eventTypeLabel = (value: MetadataRelationEventType) =>
({ RELATION_CHANGED: '关系已变化', RELATION_IMPORTED: '关系已更新' })[value] || '未知事件';
export const stateLabel = (value: MetadataRelationSubscriptionState) =>
({ ACTIVE: '已启用', PAUSED: '已暂停', CANCELLED: '已取消' })[value] || '未知状态';
export const qualityLabel = (value?: number) =>
typeof value === 'number' && Number.isFinite(value) ? String(value) : '--';
export { nodeTypeLabel, relationTypeLabel };
export const claimStateLabel = (value?: MetadataRelationClaimState) =>
value ? ({ UNCLAIMED: '未认领', CLAIMED: '已认领', CONFIRMED: '已确认' }[value] || '未知状态') : '--';
const key = (action: string) => `m4-relations-${action}-${crypto.randomUUID().replaceAll('-', '')}`;
const emptyQuery = (): MetadataRelationCandidateQuery & { depth: number } => ({
rootType: 'TABLE',
keyword: undefined,
limit: 20,
depth: 2
});
const emptySummary = (): ProjectionSummary => ({
visibleNodeIds: [],
visibleEdgeIds: [],
hiddenNodeIds: [],
hiddenEdgeIds: []
});
export function useRelations() {
const query = reactive(emptyQuery()),
candidates = ref<MetadataRelationCandidate[]>([]),
loading = ref(false),
showSearch = ref(true),
pageAfter = ref<string>(),
cursorTrail = ref<Array<string | undefined>>([]);
const snapshot = ref<MetadataRelationSnapshot>(),
currentCandidate = ref<MetadataRelationCandidate>(),
drawerVisible = ref(false),
drawerReady = ref(false),
snapshotLoading = ref(false),
snapshotError = ref(''),
activeTab = ref('graph'),
openingId = ref(''),
importingId = ref('');
const mode = ref<'mindmap' | 'network'>('mindmap'),
filter = reactive(defaultFilter()),
collapsed = ref<string[]>([]),
selectedNodeId = ref(''),
selectedEdgeId = ref(''),
directoryQuery = ref(''),
inspectorVisible = ref(true),
focus = ref<{ nodeId: string; request: number }>(),
projection = ref(emptySummary());
let focusCounter = 0;
const subscriptions = ref<MetadataRelationSubscription[]>([]),
subscriptionsLoading = ref(false),
subscriptionsError = ref(''),
subscriptionSaving = ref(false),
events = ref<MetadataRelationEvent[]>([]),
eventsLoading = ref(false),
eventsError = ref(''),
eventAfter = ref<string>(),
exporting = ref(false);
let candidatesRevision = 0,
snapshotRevision = 0,
subscriptionsRevision = 0,
writeRevision = 0,
eventRevision = 0,
exportRevision = 0;
let disposed = false;
const permitted = (action: string) => checkPermi([`aixun:governance:metadata-relation:${action}`]);
const canView = computed(() => permitted('view')),
canImport = computed(() => permitted('import')),
canSubscribe = computed(() => permitted('subscribe')),
canExport = computed(() => permitted('export'));
const fullGraph = computed(() => (snapshot.value ? relationGraph(snapshot.value.graph) : { nodes: [], edges: [] }));
const graph = computed(() => filterRelations(fullGraph.value, snapshot.value?.graph.rootNodeId ?? '', filter));
const relationTypes = computed(() => [...new Set(fullGraph.value.edges.map(edge => edge.relationType!))]);
const selectedNode = computed(() => snapshot.value?.graph.nodes.find(node => node.nodeId === selectedNodeId.value));
const selectedEdge = computed(() => fullGraph.value.edges.find(edge => edge.id === selectedEdgeId.value));
const relatedEdges = computed(() =>
fullGraph.value.edges.filter(edge => edge.source === selectedNodeId.value || edge.target === selectedNodeId.value)
);
const directoryNodes = computed(
() =>
snapshot.value?.graph.nodes.filter(node =>
node.name.toLocaleLowerCase().includes(directoryQuery.value.trim().toLocaleLowerCase())
) ?? []
);
const emphasis = computed(() => {
if (selectedEdge.value)
return { nodeIds: [selectedEdge.value.source, selectedEdge.value.target], edgeIds: [selectedEdge.value.id] };
if (!selectedNodeId.value) return { nodeIds: [], edgeIds: [] };
const edges = relatedEdges.value;
return {
nodeIds: [...new Set([selectedNodeId.value, ...edges.flatMap(edge => [edge.source, edge.target])])],
edgeIds: edges.map(edge => edge.id)
};
});
const hiddenNodes = computed(() =>
Math.max(0, fullGraph.value.nodes.length - projection.value.visibleNodeIds.length)
);
const hiddenEdges = computed(() =>
Math.max(0, fullGraph.value.edges.length - projection.value.visibleEdgeIds.length)
);
const scopeKey = computed(() => JSON.stringify([snapshot.value?.snapshotId, snapshot.value?.sha256]));
const sameRoot = (item: { rootType: MetadataRelationRootType; rootExternalId: string }, value = snapshot.value) =>
value && item.rootType === value.rootType && item.rootExternalId === value.rootExternalId;
const contextCurrent = (revision: number) => !disposed && drawerVisible.value && revision === snapshotRevision;
const apiCurrent = (revision: number) => contextCurrent(revision) && activeTab.value === 'api';
function clearApi() {
subscriptionsRevision++;
writeRevision++;
eventRevision++;
exportRevision++;
subscriptions.value = [];
events.value = [];
eventAfter.value = undefined;
subscriptionsLoading.value = false;
eventsLoading.value = false;
subscriptionSaving.value = false;
exporting.value = false;
subscriptionsError.value = '';
eventsError.value = '';
}
function clearSnapshot() {
snapshot.value = undefined;
selectedNodeId.value = '';
selectedEdgeId.value = '';
collapsed.value = [];
focus.value = undefined;
projection.value = emptySummary();
directoryQuery.value = '';
clearApi();
}
function close() {
snapshotRevision++;
drawerReady.value = false;
snapshotLoading.value = false;
snapshotError.value = '';
openingId.value = '';
importingId.value = '';
currentCandidate.value = undefined;
clearSnapshot();
}
function resetFilters() {
Object.assign(filter, defaultFilter());
collapsed.value = [];
}
function showAll() {
resetFilters();
mode.value = 'network';
focus.value = undefined;
}
function selectNode(id: string, reveal = false) {
if (!fullGraph.value.nodes.some(node => node.id === id)) return;
if (reveal && !projection.value.visibleNodeIds.includes(id)) {
showAll();
ElMessage.info('已显示当前快照全部关系');
}
selectedNodeId.value = id;
selectedEdgeId.value = '';
inspectorVisible.value = true;
focus.value = { nodeId: id, request: ++focusCounter };
}
function selectEdge(id: string, reveal = false) {
const edge = fullGraph.value.edges.find(item => item.id === id);
if (!edge) return;
if (reveal && !projection.value.visibleEdgeIds.includes(id)) {
showAll();
ElMessage.info('已显示当前快照全部关系');
}
selectedEdgeId.value = id;
selectedNodeId.value = edge.source;
inspectorVisible.value = true;
focus.value = { nodeId: edge.source, request: ++focusCounter };
}
function toggleCollapse() {
if (mode.value !== 'mindmap' || !selectedNodeId.value) return;
const id = selectedNodeId.value;
collapsed.value = collapsed.value.includes(id)
? collapsed.value.filter(value => value !== id)
: [...collapsed.value, id];
}
const labelById = (id: string) => snapshot.value?.graph.nodes.find(node => node.nodeId === id)?.name || '--';
function accept(value: MetadataRelationSnapshot, row: MetadataRelationCandidate) {
if (
!value?.snapshotId ||
value.rootType !== row.rootType ||
value.rootExternalId !== row.externalId ||
!/^[0-9a-f]{64}$/.test(value.sha256)
)
throw new Error('快照不一致');
relationGraph(value.graph);
snapshot.value = value;
selectedNodeId.value = value.graph.rootNodeId;
resetFilters();
activeTab.value = 'graph';
}
function begin(row: MetadataRelationCandidate) {
const revision = ++snapshotRevision;
clearSnapshot();
currentCandidate.value = { ...row };
snapshotError.value = '';
snapshotLoading.value = true;
openingId.value = '';
importingId.value = '';
drawerVisible.value = true;
activeTab.value = 'graph';
return revision;
}
async function openSnapshot(row: MetadataRelationCandidate) {
if (!canView.value || disposed) return;
const candidate = { ...row },
revision = begin(candidate);
openingId.value = candidate.externalId;
try {
const response = await getLatestMetadataRelationSnapshot(candidate.rootType, candidate.externalId);
if (!contextCurrent(revision)) return;
if (!response.data) throw new Error('暂无快照');
accept(response.data, candidate);
} catch (error) {
if (contextCurrent(revision)) {
clearSnapshot();
snapshotError.value = '暂无可用快照,请重试或导入关系';
if (!isHandledRequestError(error)) ElMessage.error(snapshotError.value);
}
} finally {
if (contextCurrent(revision)) {
snapshotLoading.value = false;
openingId.value = '';
}
}
}
async function importAndOpen(row: MetadataRelationCandidate) {
if (!canImport.value || !canView.value || disposed) return;
if (!Number.isInteger(query.depth) || query.depth < 0 || query.depth > 3) {
ElMessage.warning('关联深度必须在0到3之间');
return;
}
const candidate = { ...row },
command = { rootType: row.rootType, externalId: row.externalId, depth: query.depth },
revision = begin(candidate);
importingId.value = row.externalId;
try {
const response = await importMetadataRelations(command, key('import'));
if (!contextCurrent(revision)) return;
if (!response.data) throw new Error('导入结果缺失');
accept(response.data.snapshot, candidate);
ElMessage.success(response.data.eventType === 'RELATION_CHANGED' ? '关系变化已记录' : '关系更新成功');
} catch {
if (contextCurrent(revision)) {
clearSnapshot();
snapshotError.value = '关系更新失败,请稍后重试';
ElMessage.error(snapshotError.value);
}
} finally {
if (contextCurrent(revision)) {
snapshotLoading.value = false;
importingId.value = '';
}
}
}
async function loadCandidates(after?: string) {
if (!canView.value || disposed) return false;
const revision = ++candidatesRevision,
params = { rootType: query.rootType, limit: query.limit, after, keyword: query.keyword?.trim() || undefined };
loading.value = true;
candidates.value = [];
pageAfter.value = undefined;
try {
const response = await pageMetadataRelationCandidates(params);
if (disposed || revision !== candidatesRevision) return false;
if (!response.data || !Array.isArray(response.data.items)) throw new Error('候选结果缺失');
candidates.value = response.data.items;
pageAfter.value = response.data.after || undefined;
return true;
} catch {
if (!disposed && revision === candidatesRevision) ElMessage.error('关系候选加载失败,请稍后重试');
return false;
} finally {
if (!disposed && revision === candidatesRevision) loading.value = false;
}
}
const handleQuery = () => {
cursorTrail.value = [];
void loadCandidates();
};
const resetQuery = () => {
Object.assign(query, emptyQuery());
handleQuery();
};
const reloadCurrent = () => loadCandidates(cursorTrail.value.at(-1));
const nextPage = async () => {
const cursor = pageAfter.value;
if (!loading.value && cursor && (await loadCandidates(cursor))) cursorTrail.value.push(cursor);
};
const previousPage = async () => {
if (!loading.value && cursorTrail.value.length && (await loadCandidates(cursorTrail.value.at(-2))))
cursorTrail.value.pop();
};
async function loadSubscriptions() {
if (!canSubscribe.value || !snapshot.value || activeTab.value !== 'api') return false;
const context = snapshotRevision,
revision = ++subscriptionsRevision;
subscriptionsLoading.value = true;
subscriptions.value = [];
subscriptionsError.value = '';
try {
const response = await listMetadataRelationSubscriptions();
if (!apiCurrent(context) || revision !== subscriptionsRevision || !canSubscribe.value) return false;
if (!Array.isArray(response.data)) throw new Error('订阅结果缺失');
subscriptions.value = response.data.filter(item => sameRoot(item));
return true;
} catch {
if (apiCurrent(context) && revision === subscriptionsRevision) {
subscriptionsError.value = '订阅加载失败,请重试';
ElMessage.error(subscriptionsError.value);
}
return false;
} finally {
if (apiCurrent(context) && revision === subscriptionsRevision) subscriptionsLoading.value = false;
}
}
async function createSubscription() {
const value = snapshot.value;
if (!value || !canSubscribe.value || subscriptionSaving.value || activeTab.value !== 'api') return;
const context = snapshotRevision,
revision = ++writeRevision;
subscriptionSaving.value = true;
try {
const response = await createMetadataRelationSubscription(
{
rootType: value.rootType,
rootExternalId: value.rootExternalId,
eventTypes: ['RELATION_IMPORTED', 'RELATION_CHANGED'],
state: 'ACTIVE'
},
key('subscribe')
);
if (!apiCurrent(context) || revision !== writeRevision || !canSubscribe.value) return;
if (!response.data?.subscriptionId || !sameRoot(response.data, value)) throw new Error('订阅结果不一致');
const saved = response.data;
const loaded = await loadSubscriptions();
if (apiCurrent(context) && revision === writeRevision) {
if (loaded && subscriptions.value.some(item => item.subscriptionId === saved.subscriptionId))
ElMessage.success('订阅创建成功');
else ElMessage.warning('订阅已提交,请刷新确认');
}
} catch {
if (apiCurrent(context) && revision === writeRevision) ElMessage.error('订阅创建失败,请稍后重试');
} finally {
if (apiCurrent(context) && revision === writeRevision) subscriptionSaving.value = false;
}
}
async function changeSubscription(row: MetadataRelationSubscription, state: MetadataRelationSubscriptionState) {
if (
!canSubscribe.value ||
!sameRoot(row) ||
subscriptionSaving.value ||
!subscriptions.value.some(item => item.subscriptionId === row.subscriptionId) ||
activeTab.value !== 'api'
)
return;
const context = snapshotRevision,
revision = ++writeRevision;
const command = {
rootType: row.rootType,
rootExternalId: row.rootExternalId,
eventTypes: [...row.eventTypes],
state,
version: row.version
};
subscriptionSaving.value = true;
try {
const response = await updateMetadataRelationSubscription(row.subscriptionId, command, key('subscription-state'));
if (!apiCurrent(context) || revision !== writeRevision || !canSubscribe.value) return;
if (
!response.data ||
response.data.subscriptionId !== row.subscriptionId ||
!sameRoot(response.data) ||
response.data.state !== state ||
response.data.version <= row.version
)
throw new Error('订阅结果不一致');
const saved = response.data;
const loaded = await loadSubscriptions();
if (apiCurrent(context) && revision === writeRevision) {
if (
loaded &&
subscriptions.value.some(
item =>
item.subscriptionId === saved.subscriptionId && item.version >= saved.version && item.state === state
)
)
ElMessage.success('订阅状态已更新');
else ElMessage.warning('订阅已提交,请刷新确认');
}
} catch {
if (apiCurrent(context) && revision === writeRevision) ElMessage.error('订阅更新失败,请刷新后重试');
} finally {
if (apiCurrent(context) && revision === writeRevision) subscriptionSaving.value = false;
}
}
async function pollEvents() {
if (!snapshot.value || !canView.value || eventsLoading.value || activeTab.value !== 'api') return;
const context = snapshotRevision,
revision = ++eventRevision;
eventsLoading.value = true;
eventsError.value = '';
try {
const response = await pollMetadataRelationEvents(eventAfter.value);
if (!apiCurrent(context) || revision !== eventRevision) return;
if (!response.data || !Array.isArray(response.data.items)) throw new Error('事件结果缺失');
const merged = new Map(events.value.map(item => [item.eventId, item]));
for (const item of response.data.items) if (sameRoot(item)) merged.set(item.eventId, item);
events.value = [...merged.values()];
eventAfter.value = response.data.after || eventAfter.value;
} catch {
if (apiCurrent(context) && revision === eventRevision) {
eventsError.value = '事件读取失败,请重试';
events.value = [];
eventAfter.value = undefined;
ElMessage.error(eventsError.value);
}
} finally {
if (apiCurrent(context) && revision === eventRevision) eventsLoading.value = false;
}
}
async function exportSnapshot() {
const value = snapshot.value;
if (!value || !canExport.value || exporting.value) return;
const context = snapshotRevision,
revision = ++exportRevision;
exporting.value = true;
let url: string | undefined;
try {
const response = await exportMetadataRelationSnapshot(value.snapshotId);
if (!contextCurrent(context) || revision !== exportRevision || !canExport.value) return;
const data = response.data;
if (!data || data.sha256 !== value.sha256 || sha256Hex(data.content) !== value.sha256)
throw new Error('导出摘要不一致');
url = URL.createObjectURL(new Blob([data.content], { type: data.mediaType }));
const link = document.createElement('a');
link.href = url;
link.download = data.filename;
link.click();
ElMessage.success('快照已导出');
} catch {
if (contextCurrent(context) && revision === exportRevision) ElMessage.error('快照导出失败,请稍后重试');
} finally {
if (url) URL.revokeObjectURL(url);
if (contextCurrent(context) && revision === exportRevision) exporting.value = false;
}
}
watch(
drawerVisible,
value => {
if (!value) close();
},
{ flush: 'sync' }
);
watch(
activeTab,
value => {
if (value === 'api' && drawerVisible.value && snapshot.value) {
void loadSubscriptions();
void pollEvents();
} else clearApi();
},
{ flush: 'sync' }
);
watch(
() => [mode.value, filter.relationType, filter.direction, filter.depth, collapsed.value],
() => {
projection.value = emptySummary();
},
{ deep: true, flush: 'sync' }
);
watch(
canSubscribe,
value => {
if (!value) {
subscriptionsRevision++;
writeRevision++;
subscriptions.value = [];
subscriptionsLoading.value = false;
subscriptionSaving.value = false;
}
},
{ flush: 'sync' }
);
watch(
canView,
value => {
if (!value) {
drawerVisible.value = false;
close();
candidatesRevision++;
candidates.value = [];
}
},
{ flush: 'sync' }
);
onMounted(() => {
void loadCandidates();
});
onBeforeUnmount(() => {
disposed = true;
candidatesRevision++;
close();
});
return {
query,
candidates,
loading,
showSearch,
pageAfter,
cursorTrail,
snapshot,
currentCandidate,
drawerVisible,
drawerReady,
snapshotLoading,
snapshotError,
activeTab,
openingId,
importingId,
mode,
filter,
collapsed,
selectedNodeId,
selectedEdgeId,
directoryQuery,
inspectorVisible,
focus,
projection,
subscriptions,
subscriptionsLoading,
subscriptionsError,
subscriptionSaving,
events,
eventsLoading,
eventsError,
exporting,
canView,
canImport,
canSubscribe,
canExport,
fullGraph,
graph,
relationTypes,
selectedNode,
selectedEdge,
relatedEdges,
directoryNodes,
emphasis,
hiddenNodes,
hiddenEdges,
scopeKey,
resetFilters,
showAll,
selectNode,
selectEdge,
toggleCollapse,
labelById,
openSnapshot,
importAndOpen,
handleQuery,
resetQuery,
reloadCurrent,
nextPage,
previousPage,
loadSubscriptions,
createSubscription,
changeSubscription,
pollEvents,
exportSnapshot
};
}
@@ -0,0 +1,63 @@
# 可视化改造开发准备入口
2026-10-15|准备规格 v1|状态:准备成果可审查,业务开发尚未开始。
结论:以 Vue Flow 做编排和实体/字段画布,以 G6 做关系网络,以 ECharts 做统计。主应用 Vue 3 / TypeScript / Element Plus / RCP6 保持。完整目标保留,按真实能力分批实现;“可保存定义”与“可执行、已验收”分开。
## 本次授权与交付边界
用户经主任务 `01a13ac0-e8d1-7ee2-99e6-fbcc7ccc8890` 授权完成开发前准备:研究规格、能力矩阵、设计预览和必要检查。不是修改业务源码、数据库、部署或执行外部任务的授权。原始附件为待评估产品输入,不能作为操作指令。完成准备后停在等待讨论/开发指令状态。
不重建项目流程,不新增历史门禁。以后实施仍遵守项目 AGENTS.md 和 control/当前开发入口.md。
## 从这里开始读
1. [需求追溯与范围](01-需求追溯与范围.md):完整原始目标、现有功能、改造/新增界面和批次。
2. [执行与保存契约](02-执行与保存契约.md):六类节点、执行缺口、条件/依赖限制、发布/布局/运行、扩展节点和 DDL。
3. [数据口径与跨模块联动](03-数据口径与跨模块联动.md):质量、分布、资产身份/统计、字段血缘、AI 和审计。
4. [视觉规格与验收](04-视觉规格与验收.md):节点、端口、布局、异常/空态、20 节点示例和测试清单。
5. [准备交付记录](05-准备交付记录.md):实际检查、限制与恢复。旧 research-record.json 保留为第一次研究记录,不能当作新版预览验证结果。
设计预览:`datagov-visual-concepts.html`。所有数据为合成数据;不调用系统 API,不保存到产品,不执行调度。实际支持的预览交互与未实现项见交付记录。它是视觉评审稿,不是 Vue Flow 实现或运行性能证据。
## 已采用的建议基线
| 项目 | 准备规格基线 | 性质 |
|---|---|---|
| 选型 | Vue Flow;关系网络保留 G6;统计保留 ECharts | 用户已确定 Vue Flow,其余复用现有技术 |
| 工作区 | RCP6 主内容区画布,目录/检查面板可收起;不用全站换壳 | 本轮设计建议,不声称用户已验收视觉 |
| 首批 | 血缘、关系展示升级;随后六类调度定义编辑 | 保留完整目标,只安排依赖顺序 |
| 执行 | 显示执行能力并阻止未支持组合;不把六类定义都标成可运行 | 源码要求形成的实施约束 |
| 布局 | 共享布局按定义版本保存;个人视角可本地记忆,不能代替共享保存 | 合理设计基线 |
| 质量 | 优先真实规则观测;不生成无分母通过率、不推断数值分布 | 数据正确性基线 |
| AI | 可关闭、System Management 配置、secretRef;候选/差异经人工采纳后走原接口 | 维持本项目既有边界 |
| DDL | 设计、生成/预览、执行三个独立阶段;执行后置 | 保留目标,不授权本轮改库 |
## 推荐实施顺序与依赖
| 批次 | 可实施结果 | 依赖/退出条件 |
|---|---|---|
| A:两张元数据主画布 | 主工作区、名称层级、语义样式、路径/字段选择、折叠/焦点、局部范围标记 | 复用现有快照、trace、impact、人工声明;复杂图/权限用例覆盖,真实登录页面观察在实施时补齐 |
| B1:编排定义编辑 | 六类节点、真实配置、边校验、撤销、保存重开、布局独立持久化 | 先完成能力预检;BATCH_JOB/CODE_OBJECT 回调未接通、未映射策略不能伪装可执行 |
| B2:运行证据 | 已支持执行链的发布/提交/补数/重跑状态联动 | 需真实隔离环境与不可变快照;条件失败后的分支行为、策略映射和重试去重实际验收 |
| C:模型/质量/资产 | 三层映射与差异;规则观测热图;可见资产域概览 | 复用模型、质量、身份绑定;新增指标/分布按 03 文档补契约 |
| D:完整治理编排 | 元数据、分类、标准、整改、资产更新、告警与人工等待节点逐类接入 | 每类接原业务 owner;版本/幂等/权限/恢复与暂停语义通过契约验收 |
| E:建模落库与闭环 | DDL 差异预览、受控执行、回读、采集、资产登记、证据关联 | 用户确定数据库/环境/变更边界后实施;不把创建表当作产生加工血缘 |
B1 可准备完整六类编辑界面,但第一条可运行链应从 TRANSFORMATION/QUALITY_RULE 与受限 CONDITION/DEPENDENT 组合验证。BATCH_JOB/CODE_OBJECT 是已存在定义、未接通该固定回调的执行缺口,优先补能力;不是删除目标。CRON/EVENT/自定义参数/重试策略等也不能只保存后显示“已生效”。
## 集中保留的产品选择(不阻塞 A 与 B1 规格)
| 编号 | 必须由用户/业务确定的内容 | 建议与影响 |
|---|---|---|
| D1 | 正向 DDL 首批目标数据库、环境及是否允许 ALTER/DROP | 建议先隔离测试环境、单一已批准方言、CREATE;ALTER/DROP 后置。源码中的 Doris 逆向候选不自动决定正向目标 |
| D2 | 人工等待节点的处理主体、超时、拒绝、转交和恢复规则 | 建议接现有业务审批记录;未确定前只做跳转,不承诺暂停整个 DAG |
| D3 | AI 对话内容、执行审计的保留期限/导出与删除规则 | 不默认“永久保存所有原始文本”;行动审计与可脱敏内容分开,配置责任方待定 |
视觉颜色、卡片尺寸、共享布局等采用本文建议进行后续高保真评审,不增设逐阶段审批。最终审美认可仍由用户评审;本次不写成已批准。
## 外部条件与证据边界
- 登录后的线上页面和真实数据密度观察:待可用会话;不索取密码,不用旧会话过期结论声称本轮再次验证。
- DolphinScheduler、owner 回调、源数据库、权限用户、观测结果:开发后的运行验证条件;本轮无调用。
- 准备文件和预览检查仅证明准备成果可阅读/可操作,不证明产品功能、性能、部署或业务验收。
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 63 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 60 KiB

@@ -0,0 +1,17 @@
{
"extends": "../../../../aixun-ui/tsconfig.json",
"compilerOptions": { "types": [], "incremental": false },
"files": ["../../../../aixun-ui/node_modules/vite/client.d.ts"],
"include": [
"../../../../aixun-ui/node_modules/vite/client.d.ts",
"../../../../aixun-ui/src/types/**/*.d.ts",
"../../../../aixun-ui/src/design-system/components/visualization/**/*.vue",
"../../../../aixun-ui/src/design-system/components/visualization/**/*.ts",
"../../../../aixun-ui/src/views/datagov/governance/metadata-lineage/**/*.vue",
"../../../../aixun-ui/src/views/datagov/governance/metadata-relations/**/*.vue",
"../../../../aixun-ui/src/views/datagov/governance/model-design/ModelWorkspace.vue",
"../../../../aixun-ui/src/views/datagov/dataops/visual-development/index.vue",
"../../../../aixun-ui/src/views/datagov/bi/SourceDetails.vue",
"../../../../aixun-ui/src/views/datagov/bi/ImpactDrawer.vue"
]
}
@@ -0,0 +1,8 @@
export default {
resolve: { alias: { '@': process.cwd() + '/src' } },
test: { include: [
'src/views/datagov/governance/metadata-lineage/projection.test.ts',
'src/design-system/components/visualization/layout.test.ts',
'src/views/datagov/governance/metadata-relations/relationDeclarations.test.ts'
] }
};
@@ -0,0 +1,50 @@
# 可视化首批 A 实施交付
2026-10-21|**PASS_WITH_LIMITATION**:血缘分析、关系图谱与共用画布的源码及前端生产构建完成,尚未部署。用户本轮“按照计划,快速开始改造和优化”是实施来源;采用 lean-workflow-refactor 的按影响检查原则,现行流程无需再次整改,没有增加任务包、租约或阶段审批。
## 改动与影响
- 两张元数据画布从78%抽屉迁入主内容区。保留对象查询、分页与返回上下文;目录/详情按需展开,内容宽度小于1200px时互斥,支持聚焦画布。
- 血缘卡片显示类型、两行名称、完整名;字段端口保留,选中字段分别沿已知上下游追踪,不在汇合点反向误选其他来源。总览与100%定位分开,面板缩放不再自动重置视角;字段模式明确不是完整schema。
- 关系默认展示完整网络;结构、业务语义、治理责任按真实类型分区,保留交叉边与孤立对象。分支视图显示隐藏数量,筛选只保留匹配端点及根。修正“质量评分”为“元数据完整度”,不把无证据关系写成已验证。
- 两种画布在窄屏提供完整对象与连接列表。实体卡尺寸/布局同步更新;关系图的主题切换保留位置与视角,修复初始化时过早读取缩放值的问题。
- 复用 Vue Flow、G6、Element Plus 和现有接口/权限;没有安装依赖、修改后端、数据库、鉴权逻辑或执行外部任务。共享组件实际调用方还包括模型设计、字段映射开发、BI来源及影响查看,已纳入类型检查和生产构建。
- `auto-imports.d.ts`随生产构建补出4个已有Element Plus全局服务的模板声明;`components.d.ts`内容未变。未替换全局壳或RCP6规则。
## 验证
| 层次 | 结果 | 实际范围 |
|---|---|---|
| 定向 lint | PASS | 两页、投影/组合逻辑及共享画布目录 |
| 定向单测 | PASS | 3文件23用例:字段隔离/汇合/环路、关系筛选/方向/完整性、200对象400边布局完整性与不重叠、现有关系声明契约 |
| 类型检查 | PASS | 两页、共享组件及上述模型/字段映射/BI调用方,无诊断;使用固定工具链 |
| 生产构建 | PASS | 单次 `script/quality/check.sh --frontend-build`,Vite报告31.13秒;保留大chunk提示,未以调高阈值隐藏。制品在`aixun-ui/dist`,没有复制dist副本 |
| Browser | PASS_WITH_LIMITATION | 实际生产Vue/G6组件配合合成快照;1440×900桌面、1100×800面板互斥、360×800列表;字段路径、网络/分支、100%定位、关系图亮暗切换 |
| 线上页面/业务API/RBAC/人工UAT | NOT_RUN | 组件夹具不连接业务API,不是登录后的产品验收 |
| 部署 | NOT_RUN | 本轮未指定发布环境或执行部署;线上页面仍是原部署版本 |
| 大图浏览器性能/完整键盘与拖拽回归 | NOT_RUN | 200对象测试仅证明投影/布局数据性质;键盘仅检查Enter激活定位 |
浏览器证据见[browser-check.json](browser-check.json)。本次夹具是5对象/5字段映射,订单路径3边、退款路径2边;关系为7对象/7边,分支投影6边,不与10月15日静态预览的计数混用。360px下文档宽度360px,完整对象/连接均在列表DOM内。10轮“订单选择→聚焦→总览→退款选择”全部保持5节点及正确路径计数,最终检查日志无error/warn。
限制:迭代验证中观察到一次实体画布失败,原因未确认;完整重载及上述10轮操作未复现,不能据此宣称生产场景无此问题。真实数据交互仍需后续人工验收。截图只表示采集时可见内容,不等于内部滚动列表已逐屏验收。
实际截图:[血缘](lineage-desktop.jpg)、[关系](relations-desktop.jpg)、[关系暗色](relations-dark.jpg)、[窄屏血缘](lineage-mobile.jpg)。均来自真实组件渲染,数据为合成样例。
## 命令与复现
固定Node 24.19.0、pnpm 10.34.5,无clean/重装。定向命令记录于`lint.log`、`tests.log`、`types.log`、`build.log`,机器摘要和文件哈希见`delivery.json`。
```bash
source script/toolchain/bootstrap-node.sh
pnpm --dir aixun-ui exec vitest run --config ../docs/research/visualization-redesign-20261015/implementation-20261021/vitest.config.mjs
pnpm --dir aixun-ui exec vue-tsc --noEmit -p ../docs/research/visualization-redesign-20261015/implementation-20261021/tsconfig.json
./script/quality/check.sh --frontend-build
```
合成数据组件夹具位于`aixun-ui/.visual-review/`,不进入生产构建入口;可用`pnpm --dir aixun-ui exec vite --config .visual-review/vite.config.mjs`重开后访问`http://127.0.0.1:59642/.visual-review/index.html`。本轮临时服务已停止、浏览器标签已关闭、视口覆盖已复位。
## 恢复与后续
本次被修改原文件各备份一次在`originals/`,原始清单见`originals.json`。恢复前核对文件仍是本轮版本,仅恢复对应文件并按需重新构建,不覆盖后续修改;无运行环境或数据库回滚。保护ZIP原样保留。
本轮完成首批A的实现交付,不表示整个A–E方案完工。B1定义编排、B2运行证据、C模型/质量/资产、D治理节点、E建模落库仍按原计划保留;D1–D3产品选择只影响对应后续功能,不成为当前交付的附加审批。
@@ -0,0 +1,23 @@
{
"status": "PASS_WITH_LIMITATION",
"frontend": {
"path": "aixun-ui/dist",
"files": 1341,
"sha256": "20788812b527c300d4cdf2056dc607c355a72fcc393ec92d39994226ba65d298",
"hashConvention": "sorted(relative_path + NUL + file_sha256 + LF)",
"buildSeconds": 34.46,
"fixtureLeaks": []
},
"backend": {
"path": "aixun-modules/aixun-governance/target/aixun-governance.jar",
"sha256": "87c7d9e79ae33e1ce8ca05553d3ffa483db6392933b562f0a706c44424f6448f",
"buildSeconds": 43.595
},
"generatedDeclarationsUnchanged": {
"aixun-ui/src/types/auto-imports.d.ts": true,
"aixun-ui/src/types/components.d.ts": true
},
"deployment": "NOT_RUN",
"realApiSqlRbacAudit": "NOT_RUN",
"manualUat": "NOT_RUN"
}
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 120 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 83 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 110 KiB

@@ -0,0 +1,42 @@
{
"status": "PASS_WITH_LIMITATION",
"fixture": "actual Vue components with synthetic read APIs; no real API/RBAC/database acceptance",
"quality": {
"initialPageRules": 12,
"observedRuleDays": 160,
"attentionDays": 11,
"uncertainDays": 5,
"nextPageRules": 3,
"latestUnknownRetained": true,
"failedReadLeavesHeatTables": 0,
"emptyScopeVisible": true
},
"assets": {
"catalogs": 9,
"registrations": 2472,
"reliable": 2376,
"uncertain": 96,
"typeFilterFirstCatalogTotal": 148,
"allTypesFirstCatalogTotal": 586,
"failedReadLeavesBars": 0,
"emptyScopeVisible": true
},
"responsive": {
"viewportWidth": 390,
"documentScrollWidth": 390,
"heatGridWidth": 334,
"heatGridScrollWidth": 738,
"evidenceDrawerWidth": 390,
"labelWrappingFixed": true
},
"consoleWarningsAndErrors": [],
"notRun": [
"real API",
"live MySQL query",
"RBAC users",
"audit readback",
"deployment",
"manual UAT",
"large-data performance"
]
}
@@ -0,0 +1,122 @@
[
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/qualityrule/QualityRuleController.java",
"kind": "modified",
"sha256": "7ce947521e861ac800602176ceb9ef11657296744b7c3c16e533989431ae2de7"
},
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/qualityrule/QualityRuleActorProvider.java",
"kind": "modified",
"sha256": "2d2f87d34c37eb379ec19fbe4f1d318a135623dc95e2aee56ac30e2e1ba9372d"
},
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/assetcatalog/AssetCatalogController.java",
"kind": "modified",
"sha256": "57b3850e3d5d33a9cea7d3e2c49b28fb6880b0d772d0801c641dd3992d8a3500"
},
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/assetcatalog/AssetCatalogOverviewReader.java",
"kind": "modified",
"sha256": "1d26ac6dda68d8e512263e2a6a52c77aeffac4bf3bcd6922b67df4fc0cbb7bf3"
},
{
"path": "aixun-ui/src/views/datagov/governance/quality-rule/index.vue",
"kind": "modified",
"sha256": "a315e189631bc94a924725ebcc5524d1d22ad495e5a14472fa31febf79c5dca2"
},
{
"path": "aixun-ui/src/views/datagov/governance/asset-catalog/index.vue",
"kind": "modified",
"sha256": "3dc310b17164e7e01ecc76960eb1feb0f98b2fcfc5524913bb5be36139756863"
},
{
"path": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"kind": "modified",
"sha256": "4582023676f8b76f313c53fbb4c8870ee744cff65f3a4fff7f930030c0772ee2"
},
{
"path": "aixun-ui/.governance-review/App.vue",
"kind": "modified",
"sha256": "ef2bf0e9e32359cf1ec05a5900021d0d5df8a3a7ebaf17337c3b577febe25aa9"
},
{
"path": "aixun-ui/.governance-review/vite.config.mjs",
"kind": "modified",
"sha256": "5359227a8ca290720499152bbae55476f76c9d094004978b81183bf8862549a0"
},
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/qualityrule/QualityRuleObservationReader.java",
"kind": "added",
"sha256": "f6da2326f28daf79cd8a176a221ea91ab6b3ffe3c654cf83fd13a27b23e16950"
},
{
"path": "aixun-modules/aixun-governance/src/test/java/cn/aixunkeji/datagov/governance/qualityrule/QualityRuleObservationReaderTest.java",
"kind": "added",
"sha256": "a58708f1a53ecf2d57f559d3910455d21f3eb34cf3efbe84fb4178c7bfd944e6"
},
{
"path": "aixun-modules/aixun-governance/src/test/java/cn/aixunkeji/datagov/governance/assetcatalog/AssetCatalogPortfolioTest.java",
"kind": "added",
"sha256": "d2f448afc7c52e2828515e976fa4374d67c353bac2f6fcd4cdf99a45a3ebd43a"
},
{
"path": "aixun-ui/src/api/datagov/quality-rule/observations.ts",
"kind": "added",
"sha256": "85fa7799e33827375a8c34ba58be2d0f665a624224609ea77c4271f8ec557aca"
},
{
"path": "aixun-ui/src/api/datagov/asset-catalog/overview.ts",
"kind": "added",
"sha256": "9e6fc87e71085d04b667005dac232d8c921e85d835492b4d908930797a3b26ed"
},
{
"path": "aixun-ui/src/views/datagov/governance/quality-rule/QualityOverview.vue",
"kind": "added",
"sha256": "70d182353463cdfe78c3bd80afa24ede9fac4e4cc30d6e94ef51b3ed815041e6"
},
{
"path": "aixun-ui/src/views/datagov/governance/quality-rule/qualityHeatmap.ts",
"kind": "added",
"sha256": "4d8d23ec7050f132348de192eb9cf6b40c12b4fdda71f1110437f2732384c284"
},
{
"path": "aixun-ui/src/views/datagov/governance/quality-rule/qualityHeatmap.test.ts",
"kind": "added",
"sha256": "dd3ae60d1353fc97fe864aebcbef57af1bc251157aaf353a6255a3455ee936f3"
},
{
"path": "aixun-ui/src/views/datagov/governance/asset-catalog/CatalogOverview.vue",
"kind": "added",
"sha256": "b7ce7c5c95a91b20961c547ed0e0979e9f1c1a7ffdc37d4fc8f0b297db70d811"
},
{
"path": "aixun-ui/src/views/datagov/governance/asset-catalog/catalogOverview.ts",
"kind": "added",
"sha256": "3d6534fb2e34f4c67ddf5fb6977cd59e0439798a277af434fbccf63a0081b447"
},
{
"path": "aixun-ui/src/views/datagov/governance/asset-catalog/catalogOverview.test.ts",
"kind": "added",
"sha256": "88ee268b5fc83fd8fa663ae6f3196a54688d16082044786914d0d794cd73ff74"
},
{
"path": "aixun-ui/.governance-review/aggregates.ts",
"kind": "added",
"sha256": "9c53ff26283538efb868586c03ecbab2d3daa31d78af6651c28b5e9cc2e3674e"
},
{
"path": "docs/research/visualization-redesign-20261015/implementation-aggregation-20261021/tsconfig.json",
"kind": "added",
"sha256": "9e6db165b3367481e4cf6f395ca265ec166e314786b413350be12a9dfb1e3a65"
},
{
"path": "docs/research/visualization-redesign-20261015/implementation-aggregation-20261021/vitest.config.mjs",
"kind": "added",
"sha256": "d08141f601de20f5dffb36e9b55a51e2dbb17eb6e37de1cd699643a63d75dba4"
},
{
"path": "docs/research/visualization-redesign-20261015/implementation-aggregation-20261021/交付记录.md",
"kind": "added",
"sha256": "2ff9e3f080c8202a4323b270594ccb782e327d047b648770c713246983cad9fc"
}
]
@@ -0,0 +1,46 @@
[
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/qualityrule/QualityRuleController.java",
"sha256": "3971407625900d7808ac2d9586f79421cffa5609af660b720bd5b6a6205c23ad"
},
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/qualityrule/QualityRuleActorProvider.java",
"sha256": "0a50dc2f7d9eaa833822f13c5fa42f5e3ad667f6a0891669c7808c77ce5ac056"
},
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/assetcatalog/AssetCatalogController.java",
"sha256": "709373f7556d36ba0e0c26c4f002bf08fd91151d6bc6fbd5e24900d7fb3b670f"
},
{
"path": "aixun-modules/aixun-governance/src/main/java/cn/aixunkeji/datagov/governance/assetcatalog/AssetCatalogOverviewReader.java",
"sha256": "ce009f48430e1f7a3af18060dcec26c6bf04d8417316829b008d207cb4dd401a"
},
{
"path": "aixun-ui/src/views/datagov/governance/quality-rule/index.vue",
"sha256": "3c7c4e4cc4a131590cac5ee98c6a55ee9a648b4c4a34269b03bc7abc0cb720bc"
},
{
"path": "aixun-ui/src/views/datagov/governance/asset-catalog/index.vue",
"sha256": "fa3f1c0836003d77838de115dc2ff30ede89bf5a95d7d6df1dd63568adda348d"
},
{
"path": "aixun-ui/src/types/auto-imports.d.ts",
"sha256": "e5117b1c5730407f85336132360d93baf5f4bd8e438c7e3c2dda40ccad62b11c"
},
{
"path": "aixun-ui/src/types/components.d.ts",
"sha256": "3aa5eca85f94e0abd139bed79584526b8c21ac0522a4e7867630722dfbb59b7b"
},
{
"path": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"sha256": "09cb5027191fe823d30baa8aedcefb6a3d74399f733d3b98befe639e2642a747"
},
{
"path": "aixun-ui/.governance-review/App.vue",
"sha256": "c336fc683bb0082613740e763fd1c2b0dd405e80e8a7ae8e73ab62488429b333"
},
{
"path": "aixun-ui/.governance-review/vite.config.mjs",
"sha256": "8065bbd6182d37268b7280e6e5ff7f44b40a16ff421ffe4fe0d3bb8cd5db9f4d"
}
]
@@ -0,0 +1,95 @@
package cn.aixunkeji.datagov.governance.assetcatalog;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.datagov.governance.assetcatalog.AssetCatalogApi.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/governance/v1/asset-catalogs")
public class AssetCatalogController {
private final AssetCatalogService service;
@SaCheckPermission("aixun:governance:asset-catalog:view")
@GetMapping
public R<List<NodeView>> tree() { return R.ok(service.tree()); }
@SaCheckPermission("aixun:governance:asset-catalog:view")
@GetMapping("/{catalogId}")
public R<DetailView> detail(@PathVariable long catalogId) { return R.ok(service.detail(catalogId)); }
@Log(title = "资产目录创建", businessType = BusinessType.INSERT, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:asset-catalog:create")
@PostMapping
public R<WriteView<DetailView>> create(@RequestHeader("Idempotency-Key") String key,
@RequestBody CreateNodeCommand command) {
return R.ok(service.create(key, command));
}
@Log(title = "资产目录更新", businessType = BusinessType.UPDATE, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:asset-catalog:update")
@PatchMapping("/{catalogId}")
public R<WriteView<DetailView>> update(@PathVariable long catalogId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody UpdateNodeCommand command) {
return R.ok(service.update(catalogId, key, command));
}
@Log(title = "资产目录移动", businessType = BusinessType.UPDATE, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:asset-catalog:update")
@PutMapping("/{catalogId}/parent")
public R<WriteView<DetailView>> move(@PathVariable long catalogId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody MoveNodeCommand command) {
return R.ok(service.move(catalogId, key, command));
}
@Log(title = "资产编目", businessType = BusinessType.INSERT, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:asset-catalog:catalog")
@PostMapping("/{catalogId}/assets")
public R<WriteView<DetailView>> catalog(@PathVariable long catalogId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody CatalogAssetCommand command) {
return R.ok(service.catalog(catalogId, key, command));
}
@Log(title = "盘点资产编目", businessType = BusinessType.INSERT, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission(value = {"aixun:governance:asset-catalog:catalog", "aixun:governance:asset-inventory:view"}, mode = cn.dev33.satoken.annotation.SaMode.AND)
@PostMapping("/{catalogId}/inventory-assets")
public R<WriteView<DetailView>> catalogFromInventory(@PathVariable long catalogId, @RequestHeader("Idempotency-Key") String key,
@RequestBody InventoryCatalogCommand command) {
return R.ok(service.catalogFromInventory(catalogId, key, command));
}
@Log(title = "资产目录发布", businessType = BusinessType.UPDATE, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:asset-catalog:publish")
@PostMapping("/{catalogId}/publications")
public R<WriteView<PublicationView>> publish(@PathVariable long catalogId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody PublishCommand command) {
return R.ok(service.publish(catalogId, key, command));
}
@Log(title = "资产目录权限", businessType = BusinessType.UPDATE, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:asset-catalog:permission")
@PostMapping("/{catalogId}/permissions")
public R<WriteView<PermissionView>> permission(@PathVariable long catalogId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody PermissionCommand command) {
return R.ok(service.permission(catalogId, key, command));
}
@Log(title = "资产目录状态", businessType = BusinessType.UPDATE, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:asset-catalog:status")
@PostMapping("/{catalogId}/status")
public R<WriteView<DetailView>> status(@PathVariable long catalogId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody StatusCommand command) {
return R.ok(service.status(catalogId, key, command));
}
}
@@ -0,0 +1,151 @@
package cn.aixunkeji.datagov.governance.assetcatalog;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.HexFormat;
import java.util.List;
import java.util.Set;
import static cn.aixunkeji.datagov.governance.assetcatalog.AssetCatalogApi.CatalogAction;
import static cn.aixunkeji.datagov.governance.assetcatalog.AssetCatalogActorProvider.Actor;
/** Aggregate-only projection of the same directory scope used by the catalog owner. */
@Component
public final class AssetCatalogOverviewReader {
static final int MAX_VISIBLE_CATALOGS = 1_000;
private static final String PURPOSE = "ASSET_CATALOG_VIEW";
private final AssetCatalogActorProvider actors;
private final AssetCatalogJdbcRepository repository;
private final JdbcTemplate jdbc;
public AssetCatalogOverviewReader(AssetCatalogActorProvider actors,
AssetCatalogJdbcRepository repository, JdbcTemplate jdbc) {
this.actors = actors;
this.repository = repository;
this.jdbc = jdbc;
}
public record Observation(long actorId, long organizationId, long departmentId, long count,
LocalDateTime observedAt, String scopeSha256) { }
public Observation current() {
try {
Actor actor = actors.current();
actors.requireCurrent(actor, PURPOSE);
List<CatalogRevision> before = visible(actor);
Aggregate first = aggregate(actor, before);
Aggregate second = aggregate(actor, before);
// The second directory read follows both aggregate reads, so a catalog grant
// revoked during SQL cannot be accepted just because the menu grant remains.
List<CatalogRevision> after = visible(actor);
actors.requireCurrent(actor, PURPOSE);
if (!before.equals(after) || !first.equals(second)) {
throw AssetCatalogDomainException.conflict("资产目录范围或统计已变化,请重新读取");
}
return new Observation(actor.actorId(), actor.organizationId(), actor.departmentId(),
second.count(), second.observedAt(), scopeSha(actor, after));
} catch (AssetCatalogDomainException rejected) {
throw rejected;
} catch (RuntimeException unavailable) {
// Never expose SQL, connection details, or fall back to the whole department.
throw AssetCatalogDomainException.conflict("资产目录统计暂不可用");
}
}
private List<CatalogRevision> visible(Actor actor) {
var nodes = repository.tree(actor, CatalogAction.VIEW);
if (nodes == null) throw AssetCatalogDomainException.conflict("资产目录范围不可用");
if (nodes.size() > MAX_VISIBLE_CATALOGS) {
throw AssetCatalogDomainException.conflict("可见目录超过 1000 个,暂不提供汇总统计");
}
Set<Long> ids = new HashSet<>();
List<CatalogRevision> result = new ArrayList<>(nodes.size());
for (var node : nodes) {
if (node == null || node.catalogId() <= 0 || node.version() < 0
|| node.organizationId() != actor.organizationId()
|| node.departmentId() != actor.departmentId() || !ids.add(node.catalogId())) {
throw AssetCatalogDomainException.conflict("资产目录范围不完整");
}
result.add(new CatalogRevision(node.catalogId(), node.version()));
}
result.sort(Comparator.comparingLong(CatalogRevision::id));
return List.copyOf(result);
}
private Aggregate aggregate(Actor actor, List<CatalogRevision> catalogs) {
if (catalogs.isEmpty()) return new Aggregate(0, null);
String placeholders = String.join(",", java.util.Collections.nCopies(catalogs.size(), "?"));
String sql = "SELECT COUNT(*) AS asset_count,MAX(update_time) AS observed_at "
+ "FROM asset_catalog_item WHERE organization_id=? AND department_id=? "
+ "AND del_flag='0' AND reliable_flag='1' AND catalog_id IN (" + placeholders + ")";
List<Object> arguments = new ArrayList<>(catalogs.size() + 2);
arguments.add(actor.organizationId());
arguments.add(actor.departmentId());
catalogs.forEach(catalog -> arguments.add(catalog.id()));
List<Aggregate> values = jdbc.query(sql, (rows, index) -> {
long count = rows.getLong("asset_count");
if (rows.wasNull() || count < 0) {
throw AssetCatalogDomainException.conflict("资产目录统计数量不可用");
}
var timestamp = rows.getTimestamp("observed_at");
if ((count == 0) != (timestamp == null)) {
throw AssetCatalogDomainException.conflict("资产目录统计时间不可用");
}
return new Aggregate(count, timestamp == null ? null : timestamp.toLocalDateTime());
}, arguments.toArray());
if (values == null || values.size() != 1 || values.getFirst() == null) {
throw AssetCatalogDomainException.conflict("资产目录统计结果不可用");
}
return values.getFirst();
}
private static String scopeSha(Actor actor, List<CatalogRevision> catalogs) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
text(digest, "asset-catalog-overview-scope-v1");
text(digest, PURPOSE);
number(digest, actor.actorId());
number(digest, actor.organizationId());
number(digest, actor.departmentId());
strings(digest, actor.roles());
strings(digest, actor.permissions());
strings(digest, actor.subjectRefs());
number(digest, catalogs.size());
for (CatalogRevision catalog : catalogs) {
number(digest, catalog.id());
number(digest, catalog.version());
}
return HexFormat.of().formatHex(digest.digest());
} catch (NoSuchAlgorithmException unavailable) {
throw AssetCatalogDomainException.conflict("资产目录范围摘要不可用");
}
}
private static void strings(MessageDigest digest, Set<String> values) {
List<String> sorted = values.stream().sorted().toList();
number(digest, sorted.size());
sorted.forEach(value -> text(digest, value));
}
private static void text(MessageDigest digest, String value) {
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
number(digest, bytes.length);
digest.update(bytes);
}
private static void number(MessageDigest digest, long value) {
digest.update(ByteBuffer.allocate(Long.BYTES).putLong(value).array());
}
private record CatalogRevision(long id, long version) { }
private record Aggregate(long count, LocalDateTime observedAt) { }
}
@@ -0,0 +1,19 @@
package cn.aixunkeji.datagov.governance.qualityrule;
import cn.aixunkeji.common.satoken.utils.LoginHelper;
import org.springframework.stereotype.Component;
@Component
class QualityRuleActorProvider {
Actor current() {
Long actorId = LoginHelper.getUserId();
Long departmentId = LoginHelper.getDeptId();
if (actorId == null || departmentId == null || actorId <= 0 || departmentId <= 0) {
throw QualityRuleDomainException.forbidden();
}
return new Actor(actorId, departmentId, departmentId);
}
record Actor(long actorId, long organizationId, long departmentId) { }
}
@@ -0,0 +1,139 @@
package cn.aixunkeji.datagov.governance.qualityrule;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.datagov.governance.qualityrule.QualityRuleApi.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/governance/v1/quality-rules")
public class QualityRuleController {
private final QualityRuleService service;
private final cn.aixunkeji.datagov.governance.qualityissue.QualityIssueCandidates identityCandidates;
@SaCheckPermission(value={"aixun:governance:quality-rule:create","aixun:governance:quality-rule:update"},mode=cn.dev33.satoken.annotation.SaMode.OR)
@GetMapping("/candidates/users")
public R<java.util.List<cn.aixunkeji.datagov.governance.qualityissue.QualityIssueCandidates.User>> users(@RequestParam(required=false) String keyword) {
return R.ok(identityCandidates.users(new QualityRuleActorProvider().current().departmentId(),keyword));
}
private final cn.aixunkeji.datagov.governance.dataprofile.DataProfileCandidates candidates;
private final QualityRuleActorProvider actors;
@SaCheckPermission(value={"aixun:governance:quality-rule:create","aixun:governance:quality-rule:update"},mode=cn.dev33.satoken.annotation.SaMode.OR)
@GetMapping("/candidates/sources")
public R<java.util.List<cn.aixunkeji.datagov.governance.dataprofile.DataProfileCandidates.Source>> sources(@RequestParam(required=false) String keyword) {
var a=actors.current(); return R.ok(candidates.sources(a.actorId(),a.organizationId(),keyword));
}
@SaCheckPermission(value={"aixun:governance:quality-rule:create","aixun:governance:quality-rule:update"},mode=cn.dev33.satoken.annotation.SaMode.OR)
@GetMapping("/candidates/targets")
public R<java.util.List<cn.aixunkeji.datagov.governance.dataprofile.DataProfileCandidates.Target>> targets(@RequestParam long sourceId) {
var a=actors.current(); return R.ok(candidates.targets(a.actorId(),a.organizationId(),a.departmentId(),sourceId));
}
@SaCheckPermission(value={"aixun:governance:quality-rule:create","aixun:governance:quality-rule:update"},mode=cn.dev33.satoken.annotation.SaMode.OR)
@GetMapping("/candidates/fields")
public R<java.util.List<cn.aixunkeji.datagov.governance.dataprofile.DataProfileCandidates.Field>> fields(@RequestParam long sourceId,@RequestParam long snapshotId) {
var a=actors.current(); return R.ok(candidates.fields(a.actorId(),a.organizationId(),a.departmentId(),sourceId,snapshotId));
}
@SaCheckPermission("aixun:governance:quality-rule:view")
@GetMapping
public R<PageResult<RuleView>> pageRules(@RequestParam(required = false) String keyword,
@RequestParam(required = false) Status status,
@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize) {
return R.ok(service.pageRules(keyword, status, pageNum, pageSize));
}
@SaCheckPermission("aixun:governance:quality-rule:view")
@GetMapping("/{ruleId}")
public R<RuleView> ruleDetail(@PathVariable long ruleId) {
return R.ok(service.ruleDetail(ruleId));
}
@SaCheckPermission("aixun:governance:quality-rule:view")
@GetMapping("/{ruleId}/snapshots")
public R<PageResult<SnapshotView>> pageSnapshots(@PathVariable long ruleId,
@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize) {
return R.ok(service.pageSnapshots(ruleId, pageNum, pageSize));
}
@Log(title = "质量规则创建", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:quality-rule:create")
@PostMapping
public R<WriteView<RuleView>> createRule(@RequestHeader("Idempotency-Key") String key,
@RequestBody CreateRuleCommand command) {
return R.ok(service.createRule(key, command));
}
@Log(title = "质量规则更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:quality-rule:update")
@PutMapping("/{ruleId}")
public R<WriteView<RuleView>> updateRule(@PathVariable long ruleId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody UpdateRuleCommand command) {
return R.ok(service.updateRule(ruleId, key, command));
}
@Log(title = "质量规则状态变更", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:quality-rule:status")
@PostMapping("/{ruleId}/status")
public R<WriteView<RuleView>> changeRuleStatus(@PathVariable long ruleId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody StatusCommand command) {
return R.ok(service.changeRuleStatus(ruleId, key, command));
}
@SaCheckPermission("aixun:governance:quality-rule:view")
@GetMapping("/templates")
public R<PageResult<TemplateView>> pageTemplates(@RequestParam(required = false) String keyword,
@RequestParam(required = false) TemplateType type,
@RequestParam(required = false) Status status,
@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize) {
return R.ok(service.pageTemplates(keyword, type, status, pageNum, pageSize));
}
@SaCheckPermission("aixun:governance:quality-rule:view")
@GetMapping("/templates/{templateId}")
public R<TemplateView> templateDetail(@PathVariable long templateId) {
return R.ok(service.templateDetail(templateId));
}
@Log(title = "质量规则模板创建", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:quality-rule:template")
@PostMapping("/templates")
public R<WriteView<TemplateView>> createTemplate(@RequestHeader("Idempotency-Key") String key,
@RequestBody CreateTemplateCommand command) {
return R.ok(service.createTemplate(key, command));
}
@Log(title = "质量规则模板更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:quality-rule:template")
@PutMapping("/templates/{templateId}")
public R<WriteView<TemplateView>> updateTemplate(@PathVariable long templateId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody UpdateTemplateCommand command) {
return R.ok(service.updateTemplate(templateId, key, command));
}
@Log(title = "质量规则模板状态变更", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:governance:quality-rule:template")
@PostMapping("/templates/{templateId}/status")
public R<WriteView<TemplateView>> changeTemplateStatus(@PathVariable long templateId,
@RequestHeader("Idempotency-Key") String key,
@RequestBody StatusCommand command) {
return R.ok(service.changeTemplateStatus(templateId, key, command));
}
}
@@ -0,0 +1,19 @@
<template><main class="review-shell"><header class="review-header"><div><strong>数据治理 · 可视化工作台</strong><small>真实组件 / 合成数据 / 无业务写入</small></div><el-button @click="theme">切换亮暗</el-button></header><el-tabs v-model="view"><el-tab-pane name="model" label="模型设计" /><el-tab-pane name="quality" label="质量观测" /><el-tab-pane name="catalog" label="资产地图" /><el-tab-pane name="lifecycle" label="治理流程" /></el-tabs><el-card shadow="never">
<ModelWorkspace v-if="view === 'model'" :design-id="design.designId" />
<template v-if="view === 'quality'"><el-button class="mb-4" @click="empty = !empty">切换空数据</el-button><QualityObservation :rule="rule" :rows="empty ? [] : validations" :loading="false" error="" @close="view = 'model'" /></template>
<template v-if="view === 'catalog'"><CatalogAtlas v-if="!catalogSelected" :tree="tree" @select="catalogSelected = true" /><template v-else><el-button class="mb-4" @click="catalogSelected = false">返回目录地图</el-button><CatalogPortfolio :detail="portfolio" /></template></template>
<template v-if="view === 'lifecycle'"><el-button class="mb-4" @click="history = !history">{{ history ? '仅看当前' : '读取历史' }}</el-button><LifecycleJourney :detail="history ? lifecycle : { ...lifecycle, reviews:[], trajectories:[], impacts:[], notifications:[] }" :history-loaded="history" /></template>
</el-card><el-button v-if="view === 'model'" class="mt-3" @click="scenario.fail = true">模拟下次字段读取失败</el-button></main></template>
<script setup lang="ts">
import { ref } from 'vue';
import ModelWorkspace from '@/views/datagov/governance/model-design/ModelWorkspace.vue';
import QualityObservation from '@/views/datagov/governance/quality-rule/QualityObservation.vue';
import CatalogAtlas from '@/views/datagov/governance/asset-catalog/CatalogAtlas.vue';
import CatalogPortfolio from '@/views/datagov/governance/asset-catalog/CatalogPortfolio.vue';
import LifecycleJourney from '@/views/datagov/governance/asset-lifecycle/LifecycleJourney.vue';
import { design, rule, validations, tree, portfolio, lifecycle } from './data';
import { scenario } from './api';
const view = ref('model'); const empty = ref(false); const catalogSelected = ref(false); const history = ref(false);
function theme() { document.documentElement.classList.toggle('dark'); }
</script>
<style>.review-shell{padding:20px;max-width:1680px;margin:auto}.review-header{display:flex;justify-content:space-between;gap:16px;align-items:center}.review-header strong{font-size:20px}.review-header small{display:block;margin-top:6px;color:var(--el-text-color-secondary)}@media(max-width:600px){.review-shell{padding:10px}.review-header strong{font-size:16px}.el-card__body{padding:12px}}</style>
@@ -0,0 +1,8 @@
import vue from '@vitejs/plugin-vue';
const root = process.cwd();
export default { root: root + '/.governance-review', plugins: [vue()], resolve: { alias: [
{ find: /^@\/store\/modules\/user$/, replacement: root + '/.governance-review/user.ts' },
{ find: /^@\/api\/datagov\/model-design\/assist$/, replacement: root + '/.governance-review/api.ts' },
{ find: /^@\/api\/datagov\/model-design$/, replacement: root + '/.governance-review/api.ts' },
{ find: '@', replacement: root + '/src' }
] }, server: { host: '127.0.0.1', port: 59645, strictPort: true, fs: { allow: [root] } } };
@@ -0,0 +1,637 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
const EffectScope: typeof import('vue').EffectScope
const ElLoading: typeof import('element-plus/es').ElLoading
const ElMessage: typeof import('element-plus/es').ElMessage
const ElMessageBox: typeof import('element-plus/es').ElMessageBox
const ElNotification: typeof import('element-plus/es').ElNotification
const acceptHMRUpdate: typeof import('pinia').acceptHMRUpdate
const asyncComputed: typeof import('@vueuse/core').asyncComputed
const autoResetRef: typeof import('@vueuse/core').autoResetRef
const computed: typeof import('vue').computed
const computedAsync: typeof import('@vueuse/core').computedAsync
const computedEager: typeof import('@vueuse/core').computedEager
const computedInject: typeof import('@vueuse/core').computedInject
const computedWithControl: typeof import('@vueuse/core').computedWithControl
const controlledComputed: typeof import('@vueuse/core').controlledComputed
const controlledRef: typeof import('@vueuse/core').controlledRef
const createApp: typeof import('vue').createApp
const createDisposableDirective: typeof import('@vueuse/core').createDisposableDirective
const createEventHook: typeof import('@vueuse/core').createEventHook
const createGlobalState: typeof import('@vueuse/core').createGlobalState
const createInjectionState: typeof import('@vueuse/core').createInjectionState
const createPinia: typeof import('pinia').createPinia
const createReactiveFn: typeof import('@vueuse/core').createReactiveFn
const createRef: typeof import('@vueuse/core').createRef
const createReusableTemplate: typeof import('@vueuse/core').createReusableTemplate
const createSharedComposable: typeof import('@vueuse/core').createSharedComposable
const createTemplatePromise: typeof import('@vueuse/core').createTemplatePromise
const createUnrefFn: typeof import('@vueuse/core').createUnrefFn
const customRef: typeof import('vue').customRef
const debouncedRef: typeof import('@vueuse/core').debouncedRef
const debouncedWatch: typeof import('@vueuse/core').debouncedWatch
const defineAsyncComponent: typeof import('vue').defineAsyncComponent
const defineComponent: typeof import('vue').defineComponent
const defineStore: typeof import('pinia').defineStore
const eagerComputed: typeof import('@vueuse/core').eagerComputed
const effectScope: typeof import('vue').effectScope
const extendRef: typeof import('@vueuse/core').extendRef
const getActivePinia: typeof import('pinia').getActivePinia
const getCurrentInstance: typeof import('vue').getCurrentInstance
const getCurrentScope: typeof import('vue').getCurrentScope
const getCurrentWatcher: typeof import('vue').getCurrentWatcher
const h: typeof import('vue').h
const ignorableWatch: typeof import('@vueuse/core').ignorableWatch
const inject: typeof import('vue').inject
const injectLocal: typeof import('@vueuse/core').injectLocal
const isDefined: typeof import('@vueuse/core').isDefined
const isProxy: typeof import('vue').isProxy
const isReactive: typeof import('vue').isReactive
const isReadonly: typeof import('vue').isReadonly
const isRef: typeof import('vue').isRef
const isShallow: typeof import('vue').isShallow
const makeDestructurable: typeof import('@vueuse/core').makeDestructurable
const mapActions: typeof import('pinia').mapActions
const mapGetters: typeof import('pinia').mapGetters
const mapState: typeof import('pinia').mapState
const mapStores: typeof import('pinia').mapStores
const mapWritableState: typeof import('pinia').mapWritableState
const markRaw: typeof import('vue').markRaw
const nextTick: typeof import('vue').nextTick
const onActivated: typeof import('vue').onActivated
const onBeforeMount: typeof import('vue').onBeforeMount
const onBeforeRouteLeave: typeof import('vue-router').onBeforeRouteLeave
const onBeforeRouteUpdate: typeof import('vue-router').onBeforeRouteUpdate
const onBeforeUnmount: typeof import('vue').onBeforeUnmount
const onBeforeUpdate: typeof import('vue').onBeforeUpdate
const onClickOutside: typeof import('@vueuse/core').onClickOutside
const onDeactivated: typeof import('vue').onDeactivated
const onElementRemoval: typeof import('@vueuse/core').onElementRemoval
const onErrorCaptured: typeof import('vue').onErrorCaptured
const onKeyStroke: typeof import('@vueuse/core').onKeyStroke
const onLongPress: typeof import('@vueuse/core').onLongPress
const onMounted: typeof import('vue').onMounted
const onRenderTracked: typeof import('vue').onRenderTracked
const onRenderTriggered: typeof import('vue').onRenderTriggered
const onScopeDispose: typeof import('vue').onScopeDispose
const onServerPrefetch: typeof import('vue').onServerPrefetch
const onStartTyping: typeof import('@vueuse/core').onStartTyping
const onUnmounted: typeof import('vue').onUnmounted
const onUpdated: typeof import('vue').onUpdated
const onWatcherCleanup: typeof import('vue').onWatcherCleanup
const pausableWatch: typeof import('@vueuse/core').pausableWatch
const provide: typeof import('vue').provide
const provideLocal: typeof import('@vueuse/core').provideLocal
const reactify: typeof import('@vueuse/core').reactify
const reactifyObject: typeof import('@vueuse/core').reactifyObject
const reactive: typeof import('vue').reactive
const reactiveComputed: typeof import('@vueuse/core').reactiveComputed
const reactiveOmit: typeof import('@vueuse/core').reactiveOmit
const reactivePick: typeof import('@vueuse/core').reactivePick
const readonly: typeof import('vue').readonly
const ref: typeof import('vue').ref
const refAutoReset: typeof import('@vueuse/core').refAutoReset
const refDebounced: typeof import('@vueuse/core').refDebounced
const refDefault: typeof import('@vueuse/core').refDefault
const refManualReset: typeof import('@vueuse/core').refManualReset
const refThrottled: typeof import('@vueuse/core').refThrottled
const refWithControl: typeof import('@vueuse/core').refWithControl
const resolveComponent: typeof import('vue').resolveComponent
const setActivePinia: typeof import('pinia').setActivePinia
const setMapStoreSuffix: typeof import('pinia').setMapStoreSuffix
const shallowReactive: typeof import('vue').shallowReactive
const shallowReadonly: typeof import('vue').shallowReadonly
const shallowRef: typeof import('vue').shallowRef
const storeToRefs: typeof import('pinia').storeToRefs
const syncRef: typeof import('@vueuse/core').syncRef
const syncRefs: typeof import('@vueuse/core').syncRefs
const templateRef: typeof import('@vueuse/core').templateRef
const throttledRef: typeof import('@vueuse/core').throttledRef
const throttledWatch: typeof import('@vueuse/core').throttledWatch
const toRaw: typeof import('vue').toRaw
const toReactive: typeof import('@vueuse/core').toReactive
const toRef: typeof import('vue').toRef
const toRefs: typeof import('vue').toRefs
const toValue: typeof import('vue').toValue
const triggerRef: typeof import('vue').triggerRef
const tryOnBeforeMount: typeof import('@vueuse/core').tryOnBeforeMount
const tryOnBeforeUnmount: typeof import('@vueuse/core').tryOnBeforeUnmount
const tryOnMounted: typeof import('@vueuse/core').tryOnMounted
const tryOnScopeDispose: typeof import('@vueuse/core').tryOnScopeDispose
const tryOnUnmounted: typeof import('@vueuse/core').tryOnUnmounted
const unref: typeof import('vue').unref
const unrefElement: typeof import('@vueuse/core').unrefElement
const until: typeof import('@vueuse/core').until
const useActiveElement: typeof import('@vueuse/core').useActiveElement
const useAnimate: typeof import('@vueuse/core').useAnimate
const useArrayDifference: typeof import('@vueuse/core').useArrayDifference
const useArrayEvery: typeof import('@vueuse/core').useArrayEvery
const useArrayFilter: typeof import('@vueuse/core').useArrayFilter
const useArrayFind: typeof import('@vueuse/core').useArrayFind
const useArrayFindIndex: typeof import('@vueuse/core').useArrayFindIndex
const useArrayFindLast: typeof import('@vueuse/core').useArrayFindLast
const useArrayIncludes: typeof import('@vueuse/core').useArrayIncludes
const useArrayJoin: typeof import('@vueuse/core').useArrayJoin
const useArrayMap: typeof import('@vueuse/core').useArrayMap
const useArrayReduce: typeof import('@vueuse/core').useArrayReduce
const useArraySome: typeof import('@vueuse/core').useArraySome
const useArrayUnique: typeof import('@vueuse/core').useArrayUnique
const useAsyncQueue: typeof import('@vueuse/core').useAsyncQueue
const useAsyncState: typeof import('@vueuse/core').useAsyncState
const useAttrs: typeof import('vue').useAttrs
const useBase64: typeof import('@vueuse/core').useBase64
const useBattery: typeof import('@vueuse/core').useBattery
const useBluetooth: typeof import('@vueuse/core').useBluetooth
const useBreakpoints: typeof import('@vueuse/core').useBreakpoints
const useBroadcastChannel: typeof import('@vueuse/core').useBroadcastChannel
const useBrowserLocation: typeof import('@vueuse/core').useBrowserLocation
const useCached: typeof import('@vueuse/core').useCached
const useClipboard: typeof import('@vueuse/core').useClipboard
const useClipboardItems: typeof import('@vueuse/core').useClipboardItems
const useCloned: typeof import('@vueuse/core').useCloned
const useColorMode: typeof import('@vueuse/core').useColorMode
const useConfirmDialog: typeof import('@vueuse/core').useConfirmDialog
const useCountdown: typeof import('@vueuse/core').useCountdown
const useCounter: typeof import('@vueuse/core').useCounter
const useCssModule: typeof import('vue').useCssModule
const useCssSupports: typeof import('@vueuse/core').useCssSupports
const useCssVar: typeof import('@vueuse/core').useCssVar
const useCssVars: typeof import('vue').useCssVars
const useCurrentElement: typeof import('@vueuse/core').useCurrentElement
const useCycleList: typeof import('@vueuse/core').useCycleList
const useDark: typeof import('@vueuse/core').useDark
const useDateFormat: typeof import('@vueuse/core').useDateFormat
const useDebounce: typeof import('@vueuse/core').useDebounce
const useDebounceFn: typeof import('@vueuse/core').useDebounceFn
const useDebouncedRefHistory: typeof import('@vueuse/core').useDebouncedRefHistory
const useDeviceMotion: typeof import('@vueuse/core').useDeviceMotion
const useDeviceOrientation: typeof import('@vueuse/core').useDeviceOrientation
const useDevicePixelRatio: typeof import('@vueuse/core').useDevicePixelRatio
const useDevicesList: typeof import('@vueuse/core').useDevicesList
const useDisplayMedia: typeof import('@vueuse/core').useDisplayMedia
const useDocumentVisibility: typeof import('@vueuse/core').useDocumentVisibility
const useDraggable: typeof import('@vueuse/core').useDraggable
const useDropZone: typeof import('@vueuse/core').useDropZone
const useElementBounding: typeof import('@vueuse/core').useElementBounding
const useElementByPoint: typeof import('@vueuse/core').useElementByPoint
const useElementHover: typeof import('@vueuse/core').useElementHover
const useElementSize: typeof import('@vueuse/core').useElementSize
const useElementVisibility: typeof import('@vueuse/core').useElementVisibility
const useEventBus: typeof import('@vueuse/core').useEventBus
const useEventListener: typeof import('@vueuse/core').useEventListener
const useEventSource: typeof import('@vueuse/core').useEventSource
const useEyeDropper: typeof import('@vueuse/core').useEyeDropper
const useFavicon: typeof import('@vueuse/core').useFavicon
const useFetch: typeof import('@vueuse/core').useFetch
const useFileDialog: typeof import('@vueuse/core').useFileDialog
const useFileSystemAccess: typeof import('@vueuse/core').useFileSystemAccess
const useFocus: typeof import('@vueuse/core').useFocus
const useFocusWithin: typeof import('@vueuse/core').useFocusWithin
const useFps: typeof import('@vueuse/core').useFps
const useFullscreen: typeof import('@vueuse/core').useFullscreen
const useGamepad: typeof import('@vueuse/core').useGamepad
const useGeolocation: typeof import('@vueuse/core').useGeolocation
const useId: typeof import('vue').useId
const useIdle: typeof import('@vueuse/core').useIdle
const useImage: typeof import('@vueuse/core').useImage
const useInfiniteScroll: typeof import('@vueuse/core').useInfiniteScroll
const useIntersectionObserver: typeof import('@vueuse/core').useIntersectionObserver
const useInterval: typeof import('@vueuse/core').useInterval
const useIntervalFn: typeof import('@vueuse/core').useIntervalFn
const useKeyModifier: typeof import('@vueuse/core').useKeyModifier
const useLastChanged: typeof import('@vueuse/core').useLastChanged
const useLink: typeof import('vue-router').useLink
const useLocalStorage: typeof import('@vueuse/core').useLocalStorage
const useMagicKeys: typeof import('@vueuse/core').useMagicKeys
const useManualRefHistory: typeof import('@vueuse/core').useManualRefHistory
const useMediaControls: typeof import('@vueuse/core').useMediaControls
const useMediaQuery: typeof import('@vueuse/core').useMediaQuery
const useMemoize: typeof import('@vueuse/core').useMemoize
const useMemory: typeof import('@vueuse/core').useMemory
const useModel: typeof import('vue').useModel
const useMounted: typeof import('@vueuse/core').useMounted
const useMouse: typeof import('@vueuse/core').useMouse
const useMouseInElement: typeof import('@vueuse/core').useMouseInElement
const useMousePressed: typeof import('@vueuse/core').useMousePressed
const useMutationObserver: typeof import('@vueuse/core').useMutationObserver
const useNavigatorLanguage: typeof import('@vueuse/core').useNavigatorLanguage
const useNetwork: typeof import('@vueuse/core').useNetwork
const useNow: typeof import('@vueuse/core').useNow
const useObjectUrl: typeof import('@vueuse/core').useObjectUrl
const useOffsetPagination: typeof import('@vueuse/core').useOffsetPagination
const useOnline: typeof import('@vueuse/core').useOnline
const usePageLeave: typeof import('@vueuse/core').usePageLeave
const useParallax: typeof import('@vueuse/core').useParallax
const useParentElement: typeof import('@vueuse/core').useParentElement
const usePerformanceObserver: typeof import('@vueuse/core').usePerformanceObserver
const usePermission: typeof import('@vueuse/core').usePermission
const usePointer: typeof import('@vueuse/core').usePointer
const usePointerLock: typeof import('@vueuse/core').usePointerLock
const usePointerSwipe: typeof import('@vueuse/core').usePointerSwipe
const usePreferredColorScheme: typeof import('@vueuse/core').usePreferredColorScheme
const usePreferredContrast: typeof import('@vueuse/core').usePreferredContrast
const usePreferredDark: typeof import('@vueuse/core').usePreferredDark
const usePreferredLanguages: typeof import('@vueuse/core').usePreferredLanguages
const usePreferredReducedMotion: typeof import('@vueuse/core').usePreferredReducedMotion
const usePreferredReducedTransparency: typeof import('@vueuse/core').usePreferredReducedTransparency
const usePrevious: typeof import('@vueuse/core').usePrevious
const useRafFn: typeof import('@vueuse/core').useRafFn
const useRefHistory: typeof import('@vueuse/core').useRefHistory
const useResizeObserver: typeof import('@vueuse/core').useResizeObserver
const useRoute: typeof import('vue-router').useRoute
const useRouter: typeof import('vue-router').useRouter
const useSSRWidth: typeof import('@vueuse/core').useSSRWidth
const useScreenOrientation: typeof import('@vueuse/core').useScreenOrientation
const useScreenSafeArea: typeof import('@vueuse/core').useScreenSafeArea
const useScriptTag: typeof import('@vueuse/core').useScriptTag
const useScroll: typeof import('@vueuse/core').useScroll
const useScrollLock: typeof import('@vueuse/core').useScrollLock
const useSessionStorage: typeof import('@vueuse/core').useSessionStorage
const useShare: typeof import('@vueuse/core').useShare
const useSlots: typeof import('vue').useSlots
const useSorted: typeof import('@vueuse/core').useSorted
const useSpeechRecognition: typeof import('@vueuse/core').useSpeechRecognition
const useSpeechSynthesis: typeof import('@vueuse/core').useSpeechSynthesis
const useStepper: typeof import('@vueuse/core').useStepper
const useStorage: typeof import('@vueuse/core').useStorage
const useStorageAsync: typeof import('@vueuse/core').useStorageAsync
const useStyleTag: typeof import('@vueuse/core').useStyleTag
const useSupported: typeof import('@vueuse/core').useSupported
const useSwipe: typeof import('@vueuse/core').useSwipe
const useTemplateRef: typeof import('vue').useTemplateRef
const useTemplateRefsList: typeof import('@vueuse/core').useTemplateRefsList
const useTextDirection: typeof import('@vueuse/core').useTextDirection
const useTextSelection: typeof import('@vueuse/core').useTextSelection
const useTextareaAutosize: typeof import('@vueuse/core').useTextareaAutosize
const useThrottle: typeof import('@vueuse/core').useThrottle
const useThrottleFn: typeof import('@vueuse/core').useThrottleFn
const useThrottledRefHistory: typeof import('@vueuse/core').useThrottledRefHistory
const useTimeAgo: typeof import('@vueuse/core').useTimeAgo
const useTimeAgoIntl: typeof import('@vueuse/core').useTimeAgoIntl
const useTimeout: typeof import('@vueuse/core').useTimeout
const useTimeoutFn: typeof import('@vueuse/core').useTimeoutFn
const useTimeoutPoll: typeof import('@vueuse/core').useTimeoutPoll
const useTimestamp: typeof import('@vueuse/core').useTimestamp
const useTitle: typeof import('@vueuse/core').useTitle
const useToNumber: typeof import('@vueuse/core').useToNumber
const useToString: typeof import('@vueuse/core').useToString
const useToggle: typeof import('@vueuse/core').useToggle
const useTransition: typeof import('@vueuse/core').useTransition
const useUrlSearchParams: typeof import('@vueuse/core').useUrlSearchParams
const useUserMedia: typeof import('@vueuse/core').useUserMedia
const useVModel: typeof import('@vueuse/core').useVModel
const useVModels: typeof import('@vueuse/core').useVModels
const useVibrate: typeof import('@vueuse/core').useVibrate
const useVirtualList: typeof import('@vueuse/core').useVirtualList
const useWakeLock: typeof import('@vueuse/core').useWakeLock
const useWebNotification: typeof import('@vueuse/core').useWebNotification
const useWebSocket: typeof import('@vueuse/core').useWebSocket
const useWebWorker: typeof import('@vueuse/core').useWebWorker
const useWebWorkerFn: typeof import('@vueuse/core').useWebWorkerFn
const useWindowFocus: typeof import('@vueuse/core').useWindowFocus
const useWindowScroll: typeof import('@vueuse/core').useWindowScroll
const useWindowSize: typeof import('@vueuse/core').useWindowSize
const watch: typeof import('vue').watch
const watchArray: typeof import('@vueuse/core').watchArray
const watchAtMost: typeof import('@vueuse/core').watchAtMost
const watchDebounced: typeof import('@vueuse/core').watchDebounced
const watchDeep: typeof import('@vueuse/core').watchDeep
const watchEffect: typeof import('vue').watchEffect
const watchIgnorable: typeof import('@vueuse/core').watchIgnorable
const watchImmediate: typeof import('@vueuse/core').watchImmediate
const watchOnce: typeof import('@vueuse/core').watchOnce
const watchPausable: typeof import('@vueuse/core').watchPausable
const watchPostEffect: typeof import('vue').watchPostEffect
const watchSyncEffect: typeof import('vue').watchSyncEffect
const watchThrottled: typeof import('@vueuse/core').watchThrottled
const watchTriggerable: typeof import('@vueuse/core').watchTriggerable
const watchWithFilter: typeof import('@vueuse/core').watchWithFilter
const whenever: typeof import('@vueuse/core').whenever
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
// for vue template auto import
import { UnwrapRef } from 'vue'
declare module 'vue' {
interface GlobalComponents {}
interface ComponentCustomProperties {
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
readonly ElLoading: UnwrapRef<typeof import('element-plus/es')['ElLoading']>
readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']>
readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']>
readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']>
readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
readonly computed: UnwrapRef<typeof import('vue')['computed']>
readonly computedAsync: UnwrapRef<typeof import('@vueuse/core')['computedAsync']>
readonly computedEager: UnwrapRef<typeof import('@vueuse/core')['computedEager']>
readonly computedInject: UnwrapRef<typeof import('@vueuse/core')['computedInject']>
readonly computedWithControl: UnwrapRef<typeof import('@vueuse/core')['computedWithControl']>
readonly controlledComputed: UnwrapRef<typeof import('@vueuse/core')['controlledComputed']>
readonly controlledRef: UnwrapRef<typeof import('@vueuse/core')['controlledRef']>
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
readonly createDisposableDirective: UnwrapRef<typeof import('@vueuse/core')['createDisposableDirective']>
readonly createEventHook: UnwrapRef<typeof import('@vueuse/core')['createEventHook']>
readonly createGlobalState: UnwrapRef<typeof import('@vueuse/core')['createGlobalState']>
readonly createInjectionState: UnwrapRef<typeof import('@vueuse/core')['createInjectionState']>
readonly createPinia: UnwrapRef<typeof import('pinia')['createPinia']>
readonly createReactiveFn: UnwrapRef<typeof import('@vueuse/core')['createReactiveFn']>
readonly createRef: UnwrapRef<typeof import('@vueuse/core')['createRef']>
readonly createReusableTemplate: UnwrapRef<typeof import('@vueuse/core')['createReusableTemplate']>
readonly createSharedComposable: UnwrapRef<typeof import('@vueuse/core')['createSharedComposable']>
readonly createTemplatePromise: UnwrapRef<typeof import('@vueuse/core')['createTemplatePromise']>
readonly createUnrefFn: UnwrapRef<typeof import('@vueuse/core')['createUnrefFn']>
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
readonly debouncedRef: UnwrapRef<typeof import('@vueuse/core')['debouncedRef']>
readonly debouncedWatch: UnwrapRef<typeof import('@vueuse/core')['debouncedWatch']>
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']>
readonly eagerComputed: UnwrapRef<typeof import('@vueuse/core')['eagerComputed']>
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
readonly extendRef: UnwrapRef<typeof import('@vueuse/core')['extendRef']>
readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']>
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
readonly getCurrentWatcher: UnwrapRef<typeof import('vue')['getCurrentWatcher']>
readonly h: UnwrapRef<typeof import('vue')['h']>
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
readonly inject: UnwrapRef<typeof import('vue')['inject']>
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
readonly isShallow: UnwrapRef<typeof import('vue')['isShallow']>
readonly makeDestructurable: UnwrapRef<typeof import('@vueuse/core')['makeDestructurable']>
readonly mapActions: UnwrapRef<typeof import('pinia')['mapActions']>
readonly mapGetters: UnwrapRef<typeof import('pinia')['mapGetters']>
readonly mapState: UnwrapRef<typeof import('pinia')['mapState']>
readonly mapStores: UnwrapRef<typeof import('pinia')['mapStores']>
readonly mapWritableState: UnwrapRef<typeof import('pinia')['mapWritableState']>
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router')['onBeforeRouteLeave']>
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router')['onBeforeRouteUpdate']>
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
readonly onClickOutside: UnwrapRef<typeof import('@vueuse/core')['onClickOutside']>
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
readonly onElementRemoval: UnwrapRef<typeof import('@vueuse/core')['onElementRemoval']>
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
readonly onKeyStroke: UnwrapRef<typeof import('@vueuse/core')['onKeyStroke']>
readonly onLongPress: UnwrapRef<typeof import('@vueuse/core')['onLongPress']>
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
readonly onStartTyping: UnwrapRef<typeof import('@vueuse/core')['onStartTyping']>
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
readonly onWatcherCleanup: UnwrapRef<typeof import('vue')['onWatcherCleanup']>
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
readonly provide: UnwrapRef<typeof import('vue')['provide']>
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
readonly reactiveComputed: UnwrapRef<typeof import('@vueuse/core')['reactiveComputed']>
readonly reactiveOmit: UnwrapRef<typeof import('@vueuse/core')['reactiveOmit']>
readonly reactivePick: UnwrapRef<typeof import('@vueuse/core')['reactivePick']>
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
readonly ref: UnwrapRef<typeof import('vue')['ref']>
readonly refAutoReset: UnwrapRef<typeof import('@vueuse/core')['refAutoReset']>
readonly refDebounced: UnwrapRef<typeof import('@vueuse/core')['refDebounced']>
readonly refDefault: UnwrapRef<typeof import('@vueuse/core')['refDefault']>
readonly refManualReset: UnwrapRef<typeof import('@vueuse/core')['refManualReset']>
readonly refThrottled: UnwrapRef<typeof import('@vueuse/core')['refThrottled']>
readonly refWithControl: UnwrapRef<typeof import('@vueuse/core')['refWithControl']>
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
readonly setActivePinia: UnwrapRef<typeof import('pinia')['setActivePinia']>
readonly setMapStoreSuffix: UnwrapRef<typeof import('pinia')['setMapStoreSuffix']>
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
readonly storeToRefs: UnwrapRef<typeof import('pinia')['storeToRefs']>
readonly syncRef: UnwrapRef<typeof import('@vueuse/core')['syncRef']>
readonly syncRefs: UnwrapRef<typeof import('@vueuse/core')['syncRefs']>
readonly templateRef: UnwrapRef<typeof import('@vueuse/core')['templateRef']>
readonly throttledRef: UnwrapRef<typeof import('@vueuse/core')['throttledRef']>
readonly throttledWatch: UnwrapRef<typeof import('@vueuse/core')['throttledWatch']>
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
readonly toReactive: UnwrapRef<typeof import('@vueuse/core')['toReactive']>
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
readonly tryOnBeforeMount: UnwrapRef<typeof import('@vueuse/core')['tryOnBeforeMount']>
readonly tryOnBeforeUnmount: UnwrapRef<typeof import('@vueuse/core')['tryOnBeforeUnmount']>
readonly tryOnMounted: UnwrapRef<typeof import('@vueuse/core')['tryOnMounted']>
readonly tryOnScopeDispose: UnwrapRef<typeof import('@vueuse/core')['tryOnScopeDispose']>
readonly tryOnUnmounted: UnwrapRef<typeof import('@vueuse/core')['tryOnUnmounted']>
readonly unref: UnwrapRef<typeof import('vue')['unref']>
readonly unrefElement: UnwrapRef<typeof import('@vueuse/core')['unrefElement']>
readonly until: UnwrapRef<typeof import('@vueuse/core')['until']>
readonly useActiveElement: UnwrapRef<typeof import('@vueuse/core')['useActiveElement']>
readonly useAnimate: UnwrapRef<typeof import('@vueuse/core')['useAnimate']>
readonly useArrayDifference: UnwrapRef<typeof import('@vueuse/core')['useArrayDifference']>
readonly useArrayEvery: UnwrapRef<typeof import('@vueuse/core')['useArrayEvery']>
readonly useArrayFilter: UnwrapRef<typeof import('@vueuse/core')['useArrayFilter']>
readonly useArrayFind: UnwrapRef<typeof import('@vueuse/core')['useArrayFind']>
readonly useArrayFindIndex: UnwrapRef<typeof import('@vueuse/core')['useArrayFindIndex']>
readonly useArrayFindLast: UnwrapRef<typeof import('@vueuse/core')['useArrayFindLast']>
readonly useArrayIncludes: UnwrapRef<typeof import('@vueuse/core')['useArrayIncludes']>
readonly useArrayJoin: UnwrapRef<typeof import('@vueuse/core')['useArrayJoin']>
readonly useArrayMap: UnwrapRef<typeof import('@vueuse/core')['useArrayMap']>
readonly useArrayReduce: UnwrapRef<typeof import('@vueuse/core')['useArrayReduce']>
readonly useArraySome: UnwrapRef<typeof import('@vueuse/core')['useArraySome']>
readonly useArrayUnique: UnwrapRef<typeof import('@vueuse/core')['useArrayUnique']>
readonly useAsyncQueue: UnwrapRef<typeof import('@vueuse/core')['useAsyncQueue']>
readonly useAsyncState: UnwrapRef<typeof import('@vueuse/core')['useAsyncState']>
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
readonly useBase64: UnwrapRef<typeof import('@vueuse/core')['useBase64']>
readonly useBattery: UnwrapRef<typeof import('@vueuse/core')['useBattery']>
readonly useBluetooth: UnwrapRef<typeof import('@vueuse/core')['useBluetooth']>
readonly useBreakpoints: UnwrapRef<typeof import('@vueuse/core')['useBreakpoints']>
readonly useBroadcastChannel: UnwrapRef<typeof import('@vueuse/core')['useBroadcastChannel']>
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
readonly useClipboardItems: UnwrapRef<typeof import('@vueuse/core')['useClipboardItems']>
readonly useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
readonly useCountdown: UnwrapRef<typeof import('@vueuse/core')['useCountdown']>
readonly useCounter: UnwrapRef<typeof import('@vueuse/core')['useCounter']>
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
readonly useCssSupports: UnwrapRef<typeof import('@vueuse/core')['useCssSupports']>
readonly useCssVar: UnwrapRef<typeof import('@vueuse/core')['useCssVar']>
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
readonly useCurrentElement: UnwrapRef<typeof import('@vueuse/core')['useCurrentElement']>
readonly useCycleList: UnwrapRef<typeof import('@vueuse/core')['useCycleList']>
readonly useDark: UnwrapRef<typeof import('@vueuse/core')['useDark']>
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
readonly useDebouncedRefHistory: UnwrapRef<typeof import('@vueuse/core')['useDebouncedRefHistory']>
readonly useDeviceMotion: UnwrapRef<typeof import('@vueuse/core')['useDeviceMotion']>
readonly useDeviceOrientation: UnwrapRef<typeof import('@vueuse/core')['useDeviceOrientation']>
readonly useDevicePixelRatio: UnwrapRef<typeof import('@vueuse/core')['useDevicePixelRatio']>
readonly useDevicesList: UnwrapRef<typeof import('@vueuse/core')['useDevicesList']>
readonly useDisplayMedia: UnwrapRef<typeof import('@vueuse/core')['useDisplayMedia']>
readonly useDocumentVisibility: UnwrapRef<typeof import('@vueuse/core')['useDocumentVisibility']>
readonly useDraggable: UnwrapRef<typeof import('@vueuse/core')['useDraggable']>
readonly useDropZone: UnwrapRef<typeof import('@vueuse/core')['useDropZone']>
readonly useElementBounding: UnwrapRef<typeof import('@vueuse/core')['useElementBounding']>
readonly useElementByPoint: UnwrapRef<typeof import('@vueuse/core')['useElementByPoint']>
readonly useElementHover: UnwrapRef<typeof import('@vueuse/core')['useElementHover']>
readonly useElementSize: UnwrapRef<typeof import('@vueuse/core')['useElementSize']>
readonly useElementVisibility: UnwrapRef<typeof import('@vueuse/core')['useElementVisibility']>
readonly useEventBus: UnwrapRef<typeof import('@vueuse/core')['useEventBus']>
readonly useEventListener: UnwrapRef<typeof import('@vueuse/core')['useEventListener']>
readonly useEventSource: UnwrapRef<typeof import('@vueuse/core')['useEventSource']>
readonly useEyeDropper: UnwrapRef<typeof import('@vueuse/core')['useEyeDropper']>
readonly useFavicon: UnwrapRef<typeof import('@vueuse/core')['useFavicon']>
readonly useFetch: UnwrapRef<typeof import('@vueuse/core')['useFetch']>
readonly useFileDialog: UnwrapRef<typeof import('@vueuse/core')['useFileDialog']>
readonly useFileSystemAccess: UnwrapRef<typeof import('@vueuse/core')['useFileSystemAccess']>
readonly useFocus: UnwrapRef<typeof import('@vueuse/core')['useFocus']>
readonly useFocusWithin: UnwrapRef<typeof import('@vueuse/core')['useFocusWithin']>
readonly useFps: UnwrapRef<typeof import('@vueuse/core')['useFps']>
readonly useFullscreen: UnwrapRef<typeof import('@vueuse/core')['useFullscreen']>
readonly useGamepad: UnwrapRef<typeof import('@vueuse/core')['useGamepad']>
readonly useGeolocation: UnwrapRef<typeof import('@vueuse/core')['useGeolocation']>
readonly useId: UnwrapRef<typeof import('vue')['useId']>
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
readonly useImage: UnwrapRef<typeof import('@vueuse/core')['useImage']>
readonly useInfiniteScroll: UnwrapRef<typeof import('@vueuse/core')['useInfiniteScroll']>
readonly useIntersectionObserver: UnwrapRef<typeof import('@vueuse/core')['useIntersectionObserver']>
readonly useInterval: UnwrapRef<typeof import('@vueuse/core')['useInterval']>
readonly useIntervalFn: UnwrapRef<typeof import('@vueuse/core')['useIntervalFn']>
readonly useKeyModifier: UnwrapRef<typeof import('@vueuse/core')['useKeyModifier']>
readonly useLastChanged: UnwrapRef<typeof import('@vueuse/core')['useLastChanged']>
readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']>
readonly useLocalStorage: UnwrapRef<typeof import('@vueuse/core')['useLocalStorage']>
readonly useMagicKeys: UnwrapRef<typeof import('@vueuse/core')['useMagicKeys']>
readonly useManualRefHistory: UnwrapRef<typeof import('@vueuse/core')['useManualRefHistory']>
readonly useMediaControls: UnwrapRef<typeof import('@vueuse/core')['useMediaControls']>
readonly useMediaQuery: UnwrapRef<typeof import('@vueuse/core')['useMediaQuery']>
readonly useMemoize: UnwrapRef<typeof import('@vueuse/core')['useMemoize']>
readonly useMemory: UnwrapRef<typeof import('@vueuse/core')['useMemory']>
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
readonly useMounted: UnwrapRef<typeof import('@vueuse/core')['useMounted']>
readonly useMouse: UnwrapRef<typeof import('@vueuse/core')['useMouse']>
readonly useMouseInElement: UnwrapRef<typeof import('@vueuse/core')['useMouseInElement']>
readonly useMousePressed: UnwrapRef<typeof import('@vueuse/core')['useMousePressed']>
readonly useMutationObserver: UnwrapRef<typeof import('@vueuse/core')['useMutationObserver']>
readonly useNavigatorLanguage: UnwrapRef<typeof import('@vueuse/core')['useNavigatorLanguage']>
readonly useNetwork: UnwrapRef<typeof import('@vueuse/core')['useNetwork']>
readonly useNow: UnwrapRef<typeof import('@vueuse/core')['useNow']>
readonly useObjectUrl: UnwrapRef<typeof import('@vueuse/core')['useObjectUrl']>
readonly useOffsetPagination: UnwrapRef<typeof import('@vueuse/core')['useOffsetPagination']>
readonly useOnline: UnwrapRef<typeof import('@vueuse/core')['useOnline']>
readonly usePageLeave: UnwrapRef<typeof import('@vueuse/core')['usePageLeave']>
readonly useParallax: UnwrapRef<typeof import('@vueuse/core')['useParallax']>
readonly useParentElement: UnwrapRef<typeof import('@vueuse/core')['useParentElement']>
readonly usePerformanceObserver: UnwrapRef<typeof import('@vueuse/core')['usePerformanceObserver']>
readonly usePermission: UnwrapRef<typeof import('@vueuse/core')['usePermission']>
readonly usePointer: UnwrapRef<typeof import('@vueuse/core')['usePointer']>
readonly usePointerLock: UnwrapRef<typeof import('@vueuse/core')['usePointerLock']>
readonly usePointerSwipe: UnwrapRef<typeof import('@vueuse/core')['usePointerSwipe']>
readonly usePreferredColorScheme: UnwrapRef<typeof import('@vueuse/core')['usePreferredColorScheme']>
readonly usePreferredContrast: UnwrapRef<typeof import('@vueuse/core')['usePreferredContrast']>
readonly usePreferredDark: UnwrapRef<typeof import('@vueuse/core')['usePreferredDark']>
readonly usePreferredLanguages: UnwrapRef<typeof import('@vueuse/core')['usePreferredLanguages']>
readonly usePreferredReducedMotion: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedMotion']>
readonly usePreferredReducedTransparency: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedTransparency']>
readonly usePrevious: UnwrapRef<typeof import('@vueuse/core')['usePrevious']>
readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']>
readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']>
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
readonly useSSRWidth: UnwrapRef<typeof import('@vueuse/core')['useSSRWidth']>
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
readonly useScriptTag: UnwrapRef<typeof import('@vueuse/core')['useScriptTag']>
readonly useScroll: UnwrapRef<typeof import('@vueuse/core')['useScroll']>
readonly useScrollLock: UnwrapRef<typeof import('@vueuse/core')['useScrollLock']>
readonly useSessionStorage: UnwrapRef<typeof import('@vueuse/core')['useSessionStorage']>
readonly useShare: UnwrapRef<typeof import('@vueuse/core')['useShare']>
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
readonly useSorted: UnwrapRef<typeof import('@vueuse/core')['useSorted']>
readonly useSpeechRecognition: UnwrapRef<typeof import('@vueuse/core')['useSpeechRecognition']>
readonly useSpeechSynthesis: UnwrapRef<typeof import('@vueuse/core')['useSpeechSynthesis']>
readonly useStepper: UnwrapRef<typeof import('@vueuse/core')['useStepper']>
readonly useStorage: UnwrapRef<typeof import('@vueuse/core')['useStorage']>
readonly useStorageAsync: UnwrapRef<typeof import('@vueuse/core')['useStorageAsync']>
readonly useStyleTag: UnwrapRef<typeof import('@vueuse/core')['useStyleTag']>
readonly useSupported: UnwrapRef<typeof import('@vueuse/core')['useSupported']>
readonly useSwipe: UnwrapRef<typeof import('@vueuse/core')['useSwipe']>
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
readonly useTemplateRefsList: UnwrapRef<typeof import('@vueuse/core')['useTemplateRefsList']>
readonly useTextDirection: UnwrapRef<typeof import('@vueuse/core')['useTextDirection']>
readonly useTextSelection: UnwrapRef<typeof import('@vueuse/core')['useTextSelection']>
readonly useTextareaAutosize: UnwrapRef<typeof import('@vueuse/core')['useTextareaAutosize']>
readonly useThrottle: UnwrapRef<typeof import('@vueuse/core')['useThrottle']>
readonly useThrottleFn: UnwrapRef<typeof import('@vueuse/core')['useThrottleFn']>
readonly useThrottledRefHistory: UnwrapRef<typeof import('@vueuse/core')['useThrottledRefHistory']>
readonly useTimeAgo: UnwrapRef<typeof import('@vueuse/core')['useTimeAgo']>
readonly useTimeAgoIntl: UnwrapRef<typeof import('@vueuse/core')['useTimeAgoIntl']>
readonly useTimeout: UnwrapRef<typeof import('@vueuse/core')['useTimeout']>
readonly useTimeoutFn: UnwrapRef<typeof import('@vueuse/core')['useTimeoutFn']>
readonly useTimeoutPoll: UnwrapRef<typeof import('@vueuse/core')['useTimeoutPoll']>
readonly useTimestamp: UnwrapRef<typeof import('@vueuse/core')['useTimestamp']>
readonly useTitle: UnwrapRef<typeof import('@vueuse/core')['useTitle']>
readonly useToNumber: UnwrapRef<typeof import('@vueuse/core')['useToNumber']>
readonly useToString: UnwrapRef<typeof import('@vueuse/core')['useToString']>
readonly useToggle: UnwrapRef<typeof import('@vueuse/core')['useToggle']>
readonly useTransition: UnwrapRef<typeof import('@vueuse/core')['useTransition']>
readonly useUrlSearchParams: UnwrapRef<typeof import('@vueuse/core')['useUrlSearchParams']>
readonly useUserMedia: UnwrapRef<typeof import('@vueuse/core')['useUserMedia']>
readonly useVModel: UnwrapRef<typeof import('@vueuse/core')['useVModel']>
readonly useVModels: UnwrapRef<typeof import('@vueuse/core')['useVModels']>
readonly useVibrate: UnwrapRef<typeof import('@vueuse/core')['useVibrate']>
readonly useVirtualList: UnwrapRef<typeof import('@vueuse/core')['useVirtualList']>
readonly useWakeLock: UnwrapRef<typeof import('@vueuse/core')['useWakeLock']>
readonly useWebNotification: UnwrapRef<typeof import('@vueuse/core')['useWebNotification']>
readonly useWebSocket: UnwrapRef<typeof import('@vueuse/core')['useWebSocket']>
readonly useWebWorker: UnwrapRef<typeof import('@vueuse/core')['useWebWorker']>
readonly useWebWorkerFn: UnwrapRef<typeof import('@vueuse/core')['useWebWorkerFn']>
readonly useWindowFocus: UnwrapRef<typeof import('@vueuse/core')['useWindowFocus']>
readonly useWindowScroll: UnwrapRef<typeof import('@vueuse/core')['useWindowScroll']>
readonly useWindowSize: UnwrapRef<typeof import('@vueuse/core')['useWindowSize']>
readonly watch: UnwrapRef<typeof import('vue')['watch']>
readonly watchArray: UnwrapRef<typeof import('@vueuse/core')['watchArray']>
readonly watchAtMost: UnwrapRef<typeof import('@vueuse/core')['watchAtMost']>
readonly watchDebounced: UnwrapRef<typeof import('@vueuse/core')['watchDebounced']>
readonly watchDeep: UnwrapRef<typeof import('@vueuse/core')['watchDeep']>
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
readonly watchIgnorable: UnwrapRef<typeof import('@vueuse/core')['watchIgnorable']>
readonly watchImmediate: UnwrapRef<typeof import('@vueuse/core')['watchImmediate']>
readonly watchOnce: UnwrapRef<typeof import('@vueuse/core')['watchOnce']>
readonly watchPausable: UnwrapRef<typeof import('@vueuse/core')['watchPausable']>
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
readonly watchThrottled: UnwrapRef<typeof import('@vueuse/core')['watchThrottled']>
readonly watchTriggerable: UnwrapRef<typeof import('@vueuse/core')['watchTriggerable']>
readonly watchWithFilter: UnwrapRef<typeof import('@vueuse/core')['watchWithFilter']>
readonly whenever: UnwrapRef<typeof import('@vueuse/core')['whenever']>
}
}
@@ -0,0 +1,127 @@
/* eslint-disable */
// @ts-nocheck
// biome-ignore lint: disable
// oxlint-disable
// ------
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AixunCodeEditor: typeof import('./../components/AixunCodeEditor/index.vue')['default']
AiXunDoc: typeof import('./../components/AiXunDoc/index.vue')['default']
ApprovalButton: typeof import('./../components/Process/approvalButton.vue')['default']
ApprovalRecord: typeof import('./../components/Process/approvalRecord.vue')['default']
AssetCatalogAssist: typeof import('./../components/AssetCatalogAssist/index.vue')['default']
Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default']
ComplianceAssist: typeof import('./../components/ComplianceAssist/index.vue')['default']
DictTag: typeof import('./../components/DictTag/index.vue')['default']
Editor: typeof import('./../components/Editor/index.vue')['default']
ElAlert: typeof import('element-plus/es')['ElAlert']
ElBadge: typeof import('element-plus/es')['ElBadge']
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElResult: typeof import('element-plus/es')['ElResult']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElStatistic: typeof import('element-plus/es')['ElStatistic']
ElStep: typeof import('element-plus/es')['ElStep']
ElSteps: typeof import('element-plus/es')['ElSteps']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElText: typeof import('element-plus/es')['ElText']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimeSelect: typeof import('element-plus/es')['ElTimeSelect']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElTreeV2: typeof import('element-plus/es')['ElTreeV2']
ElUpload: typeof import('element-plus/es')['ElUpload']
FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
FlowChart: typeof import('./../components/Process/flowChart.vue')['default']
FlowChartImg: typeof import('./../components/Process/flowChartImg.vue')['default']
FormAssist: typeof import('./../components/FormAssist/index.vue')['default']
Hamburger: typeof import('./../components/Hamburger/index.vue')['default']
IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
IFrame: typeof import('./../components/iFrame/index.vue')['default']
ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']
LangSelect: typeof import('./../components/LangSelect/index.vue')['default']
MasterModelAssist: typeof import('./../components/MasterModelAssist/index.vue')['default']
MessageType: typeof import('./../components/Process/MessageType.vue')['default']
MetadataCompletionAssist: typeof import('./../components/MetadataCompletionAssist/index.vue')['default']
MetadataGraphAssist: typeof import('./../components/MetadataGraphAssist/index.vue')['default']
MetaModelAssist: typeof import('./../components/MetaModelAssist/index.vue')['default']
PageAssist: typeof import('./../components/PageAssist/index.vue')['default']
Pagination: typeof import('./../components/Pagination/index.vue')['default']
ParentView: typeof import('./../components/ParentView/index.vue')['default']
ProcessMeddle: typeof import('./../components/Process/processMeddle.vue')['default']
ProfileEvidenceAssist: typeof import('./../components/ProfileEvidenceAssist/index.vue')['default']
RecordComparisonAssist: typeof import('./../components/RecordComparisonAssist/index.vue')['default']
RightToolbar: typeof import('./../components/RightToolbar/index.vue')['default']
RoleSelect: typeof import('./../components/RoleSelect/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Screenfull: typeof import('./../components/Screenfull/index.vue')['default']
StandardSystemAssist: typeof import('./../components/StandardSystemAssist/index.vue')['default']
StructuredFormAssist: typeof import('./../components/StructuredFormAssist/index.vue')['default']
SubmitVerify: typeof import('./../components/Process/submitVerify.vue')['default']
SvgIcon: typeof import('./../components/SvgIcon/index.vue')['default']
TaskLogAssist: typeof import('./../components/TaskLogAssist/index.vue')['default']
TopNav: typeof import('./../components/TopNav/index.vue')['default']
TreePanel: typeof import('./../components/TreePanel/index.vue')['default']
UserNameDisplay: typeof import('./../components/Process/UserNameDisplay.vue')['default']
UserSelect: typeof import('./../components/UserSelect/index.vue')['default']
WorkbenchOrigin: typeof import('./../components/WorkbenchOrigin/index.vue')['default']
}
export interface GlobalDirectives {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}
@@ -0,0 +1,932 @@
<template>
<div v-hasPermi="['aixun:governance:asset-catalog:view']" class="p-2 app-container">
<template v-if="!detailDialogVisible">
<div class="search-wrap">
<el-card shadow="hover" class="search-panel" :class="{ 'is-collapsed': !showSearch }">
<el-form ref="queryRef" :model="query" :inline="true" class="query-form">
<el-form-item label="关键词" prop="keyword">
<el-input v-model="query.keyword" clearable maxlength="200" placeholder="目录编码或名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="query.status" clearable placeholder="全部状态">
<el-option v-for="item in catalogStatuses" :key="item" :label="statusLabel(item)" :value="item" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<el-card shadow="hover" class="table-panel">
<template #header>
<div class="toolbar-shell">
<div class="table-heading"><h3>资产目录</h3><el-radio-group v-model="catalogView" size="small"><el-radio-button value="atlas">目录地图</el-radio-button><el-radio-button value="table">目录列表</el-radio-button></el-radio-group></div>
<div class="toolbar-actions">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:create']"
type="primary"
plain
icon="Plus"
@click="openCreate()"
>
新增目录
</el-button>
<el-button type="info" plain icon="Sort" @click="toggleExpandAll">展开/折叠</el-button>
<right-toolbar v-model:show-search="showSearch" :search="false" @query-table="loadTree" />
</div>
</div>
</template>
<el-alert v-if="treeError" :title="treeError" type="error" :closable="false" />
<CatalogAtlas v-else-if="catalogView === 'atlas'" v-loading="loading" :tree="visibleTree" @select="openDetail" />
<el-table
v-else
ref="catalogTableRef"
v-loading="loading"
:data="visibleTree"
row-key="catalogId"
:tree-props="{ children: 'children' }"
:default-expand-all="expandAll"
border
class="data-table"
empty-text="暂无资产目录"
>
<el-table-column label="目录名称" min-width="220" show-overflow-tooltip>
<template #default="{ row }">{{ valueOrDash(row.catalogName) }}</template>
</el-table-column>
<el-table-column label="目录编码" min-width="150" show-overflow-tooltip>
<template #default="{ row }">{{ valueOrDash(row.catalogCode) }}</template>
</el-table-column>
<el-table-column label="描述" min-width="220" show-overflow-tooltip>
<template #default="{ row }">{{ valueOrDash(row.description) }}</template>
</el-table-column>
<el-table-column label="排序" width="90" align="center">
<template #default="{ row }">{{ row.sortOrder }}</template>
</el-table-column>
<el-table-column label="状态" width="110" align="center">
<template #default="{ row }">
<el-button
v-if="canChangeStatus && row.status === 'PUBLISHED'"
link
class="status-link"
:aria-label="`修改${row.catalogName}的状态`"
@click="catalogAction('status', row.catalogId)"
>
<el-tag :type="statusTagType(row.status)">{{ statusLabel(row.status) }}</el-tag>
</el-button>
<el-tag v-else :type="statusTagType(row.status)">{{ statusLabel(row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="更新时间" width="170" align="center">
<template #default="{ row }">{{ formatTime(row.updateTime) }}</template>
</el-table-column>
<el-table-column label="操作" width="300" align="center" fixed="right">
<template #default="{ row }">
<el-tooltip content="详情" placement="top">
<el-button link type="primary" icon="View" @click="catalogAction('detail', row.catalogId)" />
</el-tooltip>
<el-tooltip content="编辑" placement="top">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:update']"
link
type="primary"
icon="Edit"
@click="catalogAction('edit', row.catalogId)"
/>
</el-tooltip>
<el-tooltip content="新增子目录" placement="top">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:create']"
link
type="primary"
icon="Plus"
@click="catalogAction('create', row.catalogId)"
/>
</el-tooltip>
<el-tooltip content="移动" placement="top">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:update']"
link
type="primary"
icon="Rank"
@click="catalogAction('move', row.catalogId)"
/>
</el-tooltip>
<el-tooltip content="资产编目" placement="top">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:catalog']"
link
type="primary"
icon="FolderAdd"
@click="catalogAction('catalog', row.catalogId)"
/>
</el-tooltip>
<el-tooltip content="目录发布" placement="top">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:publish']"
link
type="primary"
icon="Promotion"
:disabled="row.status === 'PUBLISHED'"
@click="catalogAction('publish', row.catalogId)"
/>
</el-tooltip>
<el-tooltip content="目录权限" placement="top">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:permission']"
link
type="primary"
icon="Key"
@click="catalogAction('permission', row.catalogId)"
/>
</el-tooltip>
<el-tooltip content="下线" placement="top">
<el-button
v-hasPermi="['aixun:governance:asset-catalog:status']"
link
type="primary"
icon="SwitchButton"
:disabled="row.status !== 'PUBLISHED'"
@click="catalogAction('status', row.catalogId)"
/>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-card>
</template>
<el-dialog v-model="nodeDialogVisible" :title="nodeDialogTitle" width="720px" append-to-body>
<el-form ref="nodeFormRef" :model="nodeForm" :rules="nodeRules" label-width="100px" class="dialog-grid-form">
<FormAssist page-id="P32" :model="nodeForm" :active="nodeDialogVisible" @apply="Object.assign(nodeForm, $event)" />
<el-form-item class="col-span-full"><AssetCatalogAssist :mode="nodeForm.catalogId ? 'UPDATE' : 'CREATE'" :object-id="nodeForm.catalogId" :object-version="nodeForm.version" :name="nodeForm.catalogName" :description="nodeForm.description || ''" :options="assistNodeOptions" :active="nodeDialogVisible" @apply="Object.assign(nodeForm, $event)" /></el-form-item>
<el-form-item v-if="!nodeForm.catalogId" label="目录编码" prop="catalogCode">
<el-input v-model="nodeForm.catalogCode" maxlength="64" placeholder="请输入目录编码" />
</el-form-item>
<el-form-item label="目录名称" prop="catalogName">
<el-input v-model="nodeForm.catalogName" maxlength="200" placeholder="请输入目录名称" />
</el-form-item>
<el-form-item v-if="!nodeForm.catalogId" label="父目录" prop="parentId">
<el-tree-select
v-model="nodeForm.parentId"
:data="catalogTree"
:props="treeSelectProps"
node-key="catalogId"
check-strictly
clearable
class="w-full"
placeholder="留空为根目录"
/>
</el-form-item>
<el-form-item label="显示排序" prop="sortOrder">
<el-input-number v-model="nodeForm.sortOrder" :min="0" :max="999999" controls-position="right" />
</el-form-item>
<el-form-item label="目录描述" prop="description" class="col-span-full">
<el-input v-model="nodeForm.description" type="textarea" :rows="3" maxlength="1000" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="submitting" type="primary" @click="submitNode">确 定</el-button>
<el-button @click="nodeDialogVisible = false">取 消</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="moveDialogVisible" title="移动目录" width="620px" append-to-body>
<el-form ref="moveFormRef" :model="moveForm" :rules="moveRules" label-width="100px">
<el-form-item><AssetCatalogAssist v-if="currentNode" mode="MOVE" :object-id="currentNode.catalogId" :object-version="moveForm.version" :name="currentNode.catalogName" :description="currentNode.description || ''" :options="assistNodeOptions" :active="moveDialogVisible" @apply="applySuggestedMove" /></el-form-item>
<el-form-item label="父目录" prop="parentId">
<el-tree-select
v-model="moveForm.parentId"
:data="moveOptions"
:props="treeSelectProps"
node-key="catalogId"
check-strictly
clearable
class="w-full"
placeholder="留空移动到根目录"
/>
</el-form-item>
<el-form-item label="显示排序" prop="sortOrder">
<el-input-number v-model="moveForm.sortOrder" :min="0" :max="999999" controls-position="right" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="submitting" type="primary" @click="submitMove">确 定</el-button>
<el-button @click="moveDialogVisible = false">取 消</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="catalogDialogVisible" title="资产编目" width="820px" append-to-body @closed="closeCatalogSourceSearch">
<el-form ref="catalogFormRef" :model="catalogForm" :rules="catalogRules" label-width="100px" class="dialog-grid-form">
<el-form-item label="来源资产" class="col-span-full" required>
<el-select
v-model="selectedSourceId"
class="w-full"
filterable
remote
reserve-keyword
remote-show-suffix
:remote-method="searchCatalogSources"
:loading="sourceBusy"
:no-data-text="sourceError || '暂无匹配的已确认数据表'"
placeholder="输入表名或完整名称检索"
@change="selectCatalogSource"
>
<el-option v-for="item in sourceCandidates" :key="item.entityId" :label="`${item.displayName}(${item.assetFqn})`" :value="item.entityId" />
</el-select>
<el-text class="field-help" type="info">仅可选择已确认的数据表;输入关键字后实时检索,来源标识和校验指纹由系统带入。</el-text>
</el-form-item>
<el-form-item label="资产名称" prop="assetName">
<el-input v-model="catalogForm.assetName" maxlength="200" placeholder="请输入资产名称" />
<el-text class="field-help" type="info">默认带入来源名称,可按目录展示需要调整,不会改变来源对象标识。</el-text>
</el-form-item>
<el-form-item label="责任主体类型" prop="ownerType">
<el-select v-model="catalogForm.ownerType" class="w-full" @change="loadOwnerOptions">
<el-option v-for="item in ownerSubjectTypes" :key="item" :label="subjectTypeLabel(item)" :value="item" />
</el-select>
<el-text class="field-help" type="info">选择对该资产承担责任的用户、角色、组织或部门。</el-text>
</el-form-item>
<el-form-item label="责任主体" prop="ownerRef">
<el-select
v-model="catalogForm.ownerRef"
filterable
remote
:remote-method="searchOwnerOptions"
:loading="candidateLoading"
class="w-full"
placeholder="请选择真实RCP6主体"
>
<el-option v-for="item in ownerOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-text class="field-help" type="info">从当前主体类型对应的真实系统候选中选择,不支持手填内部编号。</el-text>
</el-form-item>
<el-form-item class="col-span-full">
<el-alert title="来源、观测时间与校验信息由所选候选自动带入,候选证据不完整时不可提交。" type="info" :closable="false" show-icon />
</el-form-item>
<el-form-item label="标签" prop="tags" class="col-span-full">
<el-select v-model="catalogForm.tags" multiple filterable allow-create default-first-option class="w-full" placeholder="可添加标签" />
<el-text class="field-help" type="info">用于检索和业务归类,可填写多个简短标签。</el-text>
</el-form-item>
<el-form-item label="资产描述" prop="description" class="col-span-full">
<el-input v-model="catalogForm.description" type="textarea" :rows="3" maxlength="2000" show-word-limit placeholder="说明资产用途、业务含义和使用边界" />
<el-text class="field-help" type="info">请勿填写连接信息、密码、令牌等敏感凭据。</el-text>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="submitting" type="primary" :disabled="!catalogCandidateReady" @click="submitCatalog">确 定</el-button>
<el-button @click="catalogDialogVisible = false">取 消</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="publishDialogVisible" title="目录发布" width="620px" append-to-body>
<el-form ref="publishFormRef" :model="publishForm" :rules="reasonRules" label-width="100px">
<el-form-item label="目录名称"><el-input :model-value="currentNode?.catalogName" disabled /></el-form-item>
<el-form-item label="发布原因" prop="reason">
<el-input v-model="publishForm.reason" type="textarea" :rows="3" maxlength="500" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="submitting" type="primary" @click="submitPublish">确 定</el-button>
<el-button @click="publishDialogVisible = false">取 消</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="permissionDialogVisible" title="目录权限" width="760px" append-to-body>
<el-form ref="permissionFormRef" :model="permissionForm" :rules="permissionRules" label-width="100px" class="dialog-grid-form">
<el-form-item label="主体类型" prop="subjectType">
<el-select v-model="permissionForm.subjectType" class="w-full" @change="loadPermissionOptions">
<el-option v-for="item in subjectTypes" :key="item" :label="subjectTypeLabel(item)" :value="item" />
</el-select>
</el-form-item>
<el-form-item label="授权主体" prop="subjectRef">
<el-select
v-model="permissionForm.subjectRef"
filterable
remote
:remote-method="searchPermissionOptions"
:loading="candidateLoading"
class="w-full"
placeholder="请选择真实RCP6主体"
>
<el-option v-for="item in permissionOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="权限动作" prop="actions" class="col-span-full">
<el-checkbox-group v-model="permissionForm.actions">
<el-checkbox v-for="item in catalogActions" :key="item" :value="item">{{ actionLabel(item) }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="包含子目录"><el-switch v-model="permissionForm.includeDescendants" /></el-form-item>
<el-form-item label="生效时间" prop="effectiveFrom">
<el-date-picker v-model="permissionForm.effectiveFrom" type="datetime" value-format="YYYY-MM-DDTHH:mm:ss" class="w-full" clearable />
</el-form-item>
<el-form-item label="失效时间" prop="effectiveTo">
<el-date-picker v-model="permissionForm.effectiveTo" type="datetime" value-format="YYYY-MM-DDTHH:mm:ss" class="w-full" clearable />
</el-form-item>
<el-form-item label="授权原因" prop="reason" class="col-span-full">
<el-input v-model="permissionForm.reason" type="textarea" :rows="3" maxlength="500" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="submitting" type="primary" @click="submitPermission">确 定</el-button>
<el-button @click="permissionDialogVisible = false">取 消</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="statusDialogVisible" title="目录下线" width="620px" append-to-body>
<el-form ref="statusFormRef" :model="statusForm" :rules="reasonRules" label-width="100px">
<el-form-item label="目录名称"><el-input :model-value="currentNode?.catalogName" disabled /></el-form-item>
<el-form-item label="状态原因" prop="reason">
<el-input v-model="statusForm.reason" type="textarea" :rows="3" maxlength="500" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="submitting" type="primary" @click="submitStatus">确 定</el-button>
<el-button @click="statusDialogVisible = false">取 消</el-button>
</div>
</template>
</el-dialog>
<el-card v-if="detailDialogVisible" shadow="never" class="table-panel">
<template #header><div class="toolbar-shell"><strong>目录资产工作台</strong><el-button @click="closeDetail">返回目录地图</el-button></div></template>
<el-skeleton v-if="detailLoading" :rows="8" animated />
<el-alert v-else-if="detailError" :title="detailError" type="error" :closable="false" />
<el-tabs v-else-if="detail" v-model="detailTab">
<el-tab-pane label="资产分布" name="portfolio"><CatalogPortfolio :detail="detail" /></el-tab-pane>
<el-tab-pane label="基本信息" name="basic">
<el-descriptions :column="2" border>
<el-descriptions-item label="目录编码">{{ valueOrDash(detail.node.catalogCode) }}</el-descriptions-item>
<el-descriptions-item label="目录名称">{{ valueOrDash(detail.node.catalogName) }}</el-descriptions-item>
<el-descriptions-item label="状态">{{ statusLabel(detail.node.status) }}</el-descriptions-item>
<el-descriptions-item label="描述" :span="2">{{ valueOrDash(detail.node.description) }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ formatTime(detail.node.createTime) }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ formatTime(detail.node.updateTime) }}</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="资产编目" name="assets">
<el-table :data="detail.assets" border class="data-table" empty-text="暂无编目资产">
<el-table-column label="资产名称" min-width="160"><template #default="{ row }">{{ valueOrDash(row.assetName) }}</template></el-table-column>
<el-table-column label="类型" width="100"><template #default="{ row }">{{ assetTypeLabel(row.assetType) }}</template></el-table-column>
<el-table-column label="来源对象" min-width="210" show-overflow-tooltip><template #default="{ row }">{{ valueOrDash(row.assetFqn) }}</template></el-table-column>
<el-table-column label="责任主体" min-width="160"><template #default="{ row }">{{ subjectDisplay(row.ownerType, row.ownerRef) }}</template></el-table-column>
<el-table-column label="观测时间" width="170"><template #default="{ row }">{{ formatTime(row.observedAt) }}</template></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="发布版本" name="publications">
<el-table :data="detail.publications" border class="data-table" empty-text="暂无发布版本">
<el-table-column label="发布版本" width="110"><template #default="{ row }">{{ row.publicationVersion }}</template></el-table-column>
<el-table-column label="资产数" width="100"><template #default="{ row }">{{ row.itemCount }}</template></el-table-column>
<el-table-column label="发布原因" min-width="200"><template #default="{ row }">{{ valueOrDash(row.reason) }}</template></el-table-column>
<el-table-column label="发布时间" width="170"><template #default="{ row }">{{ formatTime(row.createTime) }}</template></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="目录权限" name="permissions">
<el-table :data="detail.permissions" border class="data-table" empty-text="暂无目录权限">
<el-table-column label="主体类型" width="110"><template #default="{ row }">{{ subjectTypeLabel(row.subjectType) }}</template></el-table-column>
<el-table-column label="授权主体" min-width="180"><template #default="{ row }">{{ subjectDisplay(row.subjectType, row.subjectRef) }}</template></el-table-column>
<el-table-column label="权限动作" min-width="180"><template #default="{ row }">{{ actionText(row.actions) }}</template></el-table-column>
<el-table-column label="包含子目录" width="110"><template #default="{ row }">{{ row.includeDescendants ? '是' : '否' }}</template></el-table-column>
<el-table-column label="生效时间" width="170"><template #default="{ row }">{{ formatTime(row.effectiveFrom) }}</template></el-table-column>
<el-table-column label="失效时间" width="170"><template #default="{ row }">{{ formatTime(row.effectiveTo) }}</template></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="操作轨迹" name="trajectories">
<el-table :data="detail.trajectories" border class="data-table" empty-text="暂无操作轨迹">
<el-table-column label="动作" width="120"><template #default="{ row }">{{ displayDatagovWorkflowAction(row.actionType) }}</template></el-table-column>
<el-table-column label="变更前" width="110"><template #default="{ row }">{{ trajectoryStatusLabel(row.beforeStatus) }}</template></el-table-column>
<el-table-column label="变更后" width="110"><template #default="{ row }">{{ trajectoryStatusLabel(row.afterStatus) }}</template></el-table-column>
<el-table-column label="摘要" min-width="220"><template #default="{ row }">{{ valueOrDash(row.summary) }}</template></el-table-column>
<el-table-column label="时间" width="170"><template #default="{ row }">{{ formatTime(row.createTime) }}</template></el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script setup lang="ts">
import CatalogAtlas from './CatalogAtlas.vue';
import CatalogPortfolio from './CatalogPortfolio.vue';
import { catalogProjection } from './catalogProjection';
import { useUserStore } from '@/store/modules/user';
import AssetCatalogAssist from '@/components/AssetCatalogAssist/index.vue';
import FormAssist from '@/components/FormAssist/index.vue';
import { ElMessage, type FormInstance, type FormRules, type TagProps } from 'element-plus';
import { listDept } from '@/api/system/dept';
import type { DeptVO } from '@/api/system/dept/types';
import { listRole } from '@/api/system/role';
import { listUser } from '@/api/system/user';
import { getAssetSourceCandidate, listAssetSourceCandidates } from '@/api/datagov/asset-detail';
import type { SourceCandidate, SourceCandidateDetail } from '@/api/datagov/asset-detail/types';
import {
catalogAsset,
changeAssetCatalogStatus,
createAssetCatalog,
getAssetCatalog,
grantAssetCatalogPermission,
listAssetCatalogTree,
moveAssetCatalog,
publishAssetCatalog,
updateAssetCatalog
} from '@/api/datagov/asset-catalog';
import type {
AssetCatalogDetail,
AssetCatalogNode,
AssetCatalogTreeNode,
CatalogAction,
CatalogAssetCommand,
CatalogAssetType,
CatalogPermissionCommand,
CatalogStatus,
CatalogSubjectType,
CreateCatalogCommand,
MoveCatalogCommand,
UpdateCatalogCommand
} from '@/api/datagov/asset-catalog/types';
import { parseTime } from '@/utils/aixun';
import { checkPermi } from '@/utils/permission';
import {
displayDatagovObjectType,
displayDatagovStatus,
displayDatagovSubjectType,
displayDatagovWorkflowAction
} from '@/utils/datagov-display';
interface SubjectOption { label: string; value: string }
type NodeForm = CreateCatalogCommand & { catalogId?: number; version?: number };
const catalogStatuses: CatalogStatus[] = ['DRAFT', 'PUBLISHED', 'UNPUBLISHED'];
const subjectTypes: CatalogSubjectType[] = ['USER', 'ROLE', 'ORGANIZATION', 'DEPARTMENT'];
const ownerSubjectTypes: CatalogSubjectType[] = ['USER', 'ROLE', 'ORGANIZATION', 'DEPARTMENT'];
const catalogActions: CatalogAction[] = ['VIEW', 'MAINTAIN', 'PUBLISH', 'PERMISSION'];
const treeSelectProps = { value: 'catalogId', label: 'catalogName', children: 'children' };
const query = reactive<{ keyword?: string; status?: CatalogStatus }>({});
const queryRef = ref<FormInstance>();
const catalogTableRef = ref<ElTableInstance>();
const loading = ref(false);
const submitting = ref(false);
const candidateLoading = ref(false);
const showSearch = ref(true);
const expandAll = ref(true);
const catalogTree = ref<AssetCatalogTreeNode[]>([]);
const assistNodeOptions = computed(() => { const all: AssetCatalogNode[] = []; const visit = (nodes: AssetCatalogTreeNode[]) => { for (const node of nodes) { all.push(node); visit(node.children || []); } }; visit(catalogTree.value); return all; });
function applySuggestedMove(patch: { parentId?: number }) { if (Object.hasOwn(patch, 'parentId')) moveForm.parentId = patch.parentId; }
const currentNode = ref<AssetCatalogNode>();
const nodeDialogVisible = ref(false);
const moveDialogVisible = ref(false);
const catalogDialogVisible = ref(false);
const publishDialogVisible = ref(false);
const permissionDialogVisible = ref(false);
const statusDialogVisible = ref(false);
const detailDialogVisible = ref(false);
const detailLoading = ref(false);
const detailTab = ref('basic');
const catalogView = ref('atlas');
const detailError = ref('');
const treeError = ref('');
let detailEpoch = 0; let treeEpoch = 0;
const catalogUser = useUserStore();
const detail = ref<AssetCatalogDetail>();
const nodeDialogTitle = ref('新增目录');
const nodeFormRef = ref<FormInstance>();
const moveFormRef = ref<FormInstance>();
const catalogFormRef = ref<FormInstance>();
const publishFormRef = ref<FormInstance>();
const permissionFormRef = ref<FormInstance>();
const statusFormRef = ref<FormInstance>();
const permissionOptions = ref<SubjectOption[]>([]);
const ownerOptions = ref<SubjectOption[]>([]);
const sourceLoading = ref(false);
const sourceDetailLoading = ref(false);
const sourceCandidates = ref<SourceCandidate[]>([]);
const sourceError = ref('');
let sourceSearchTimer: ReturnType<typeof setTimeout> | undefined;
let sourceRequestId = 0;
let sourceDetailRequestId = 0;
const sourceCandidateDetail = ref<SourceCandidateDetail>();
const selectedSourceId = ref('');
const subjectLabelMap = ref(new Map<string, string>());
const canChangeStatus = checkPermi(['aixun:governance:asset-catalog:status']);
const sourceBusy = computed(() => sourceLoading.value || sourceDetailLoading.value);
const emptyNodeForm = (): NodeForm => ({
catalogId: undefined, version: undefined, catalogCode: '', catalogName: '', parentId: undefined, description: '', sortOrder: 0
});
const nodeForm = reactive<NodeForm>(emptyNodeForm());
const moveForm = reactive<MoveCatalogCommand>({ parentId: undefined, sortOrder: 0, version: 0 });
const catalogForm = reactive<CatalogAssetCommand>({
assetRef: '', assetFqn: '', assetType: 'TABLE', assetName: '', description: '', tags: [], ownerType: 'USER', ownerRef: '',
sourceType: '', sourceRef: '', observedAt: '', reliable: true, payloadSha256: '', version: 0
});
const publishForm = reactive({ reason: '', version: 0 });
const permissionForm = reactive<CatalogPermissionCommand>({
subjectType: 'USER', subjectRef: '', actions: ['VIEW'], includeDescendants: false,
effectiveFrom: undefined, effectiveTo: undefined, reason: '', version: 0
});
const statusForm = reactive({ targetStatus: 'UNPUBLISHED' as const, reason: '', version: 0 });
const nodeRules: FormRules = {
catalogCode: [
{ required: true, message: '请输入目录编码', trigger: 'blur' },
{ pattern: /^[A-Za-z][A-Za-z0-9_-]{1,63}$/, message: '目录编码格式无效', trigger: 'blur' }
],
catalogName: [{ required: true, message: '请输入目录名称', trigger: 'blur' }],
sortOrder: [{ required: true, message: '请输入显示排序', trigger: 'change' }]
};
const moveRules: FormRules = { sortOrder: [{ required: true, message: '请输入显示排序', trigger: 'change' }] };
const catalogRules: FormRules = {
assetName: [{ required: true, message: '请输入资产名称', trigger: 'blur' }],
ownerType: [{ required: true, message: '请选择责任主体类型', trigger: 'change' }],
ownerRef: [{ required: true, message: '请选择责任主体', trigger: 'change' }]
};
const reasonRules: FormRules = { reason: [{ required: true, message: '请输入操作原因', trigger: 'blur' }] };
const permissionRules: FormRules = {
subjectType: [{ required: true, message: '请选择主体类型', trigger: 'change' }],
subjectRef: [{ required: true, message: '请选择授权主体', trigger: 'change' }],
actions: [{ required: true, type: 'array', min: 1, message: '请选择权限动作', trigger: 'change' }],
reason: [{ required: true, message: '请输入授权原因', trigger: 'blur' }]
};
const valueOrDash = (value?: number | string | null) => value === undefined || value === null || value === '' ? '--' : value;
const formatTime = (value?: string) => value ? parseTime(value) : '--';
const statusLabel = (status: CatalogStatus) => status === 'PUBLISHED' ? '已发布' : status === 'UNPUBLISHED' ? '已下线' : displayDatagovStatus(status);
const statusTagType = (status: CatalogStatus): TagProps['type'] => status === 'PUBLISHED' ? 'success' : status === 'UNPUBLISHED' ? 'warning' : 'info';
const assetTypeLabel = (type: CatalogAssetType) => ({ REPORT: '报表', API: 'API', MODEL: '模型' })[type] || displayDatagovObjectType(type);
const subjectTypeLabel = (type: CatalogSubjectType) => displayDatagovSubjectType(type);
const actionLabel = (action: CatalogAction) => ({ VIEW: '查看', MAINTAIN: '维护', PUBLISH: '发布', PERMISSION: '授权' })[action];
const actionText = (actions?: CatalogAction[]) => actions?.length ? actions.map(actionLabel).join('、') : '--';
const idempotencyKey = (action: string) => `m6:asset-catalog:${action}:${crypto.randomUUID().replaceAll('-', '')}`;
const trajectoryStatusLabel = (status?: string) => status === 'PUBLISHED' ? '已发布' : status === 'UNPUBLISHED' ? '已下线' : displayDatagovStatus(status);
const subjectDisplay = (type: CatalogSubjectType, ref: string) => subjectLabelMap.value.get(`${type}:${ref}`) || `${subjectTypeLabel(type)}(名称未解析)`;
const catalogCandidateReady = computed(() => {
const source = sourceCandidateDetail.value?.source;
const section = sourceCandidateDetail.value?.sections.find((item) => item.sectionType === 'SOURCE');
return Boolean(source && section?.reliable && section.observedAt && /^[a-f\d]{64}$/i.test(section.payloadSha256));
});
function buildTree(nodes: AssetCatalogNode[]): AssetCatalogTreeNode[] {
const map = new Map<string, AssetCatalogTreeNode>();
nodes.forEach((node) => map.set(String(node.catalogId), { ...node, children: [] }));
const roots: AssetCatalogTreeNode[] = [];
map.forEach((node) => {
const parent = node.parentId ? map.get(String(node.parentId)) : undefined;
if (parent) parent.children?.push(node);
else roots.push(node);
});
const sortNodes = (items: AssetCatalogTreeNode[]) => {
items.sort((left, right) => left.sortOrder - right.sortOrder || String(left.catalogId).localeCompare(String(right.catalogId)));
items.forEach((item) => sortNodes(item.children || []));
};
sortNodes(roots);
return roots;
}
function filterTree(nodes: AssetCatalogTreeNode[]): AssetCatalogTreeNode[] {
const keyword = query.keyword?.trim().toLowerCase();
return nodes.reduce<AssetCatalogTreeNode[]>((result, node) => {
const children = filterTree(node.children || []);
const matchesKeyword = !keyword || node.catalogName.toLowerCase().includes(keyword) || node.catalogCode.toLowerCase().includes(keyword);
const matchesStatus = !query.status || node.status === query.status;
if ((matchesKeyword && matchesStatus) || children.length) result.push({ ...node, children });
return result;
}, []);
}
const visibleTree = computed(() => filterTree(catalogTree.value));
async function catalogAction(action: 'detail' | 'edit' | 'create' | 'move' | 'catalog' | 'publish' | 'permission' | 'status', id: unknown) {
const row = catalogProjection(catalogTree.value).all.find(item => String(item.catalogId) === String(id)); if (!row) return;
const actions = { detail: openDetail, edit: openEdit, create: openCreate, move: openMove, catalog: openCatalog, publish: openPublish, permission: openPermission, status: openStatus };
await actions[action](row);
}
async function loadTree() {
const epoch = ++treeEpoch;
treeError.value = '';
catalogTree.value = [];
loading.value = true;
try {
const { data } = await listAssetCatalogTree();
if (epoch === treeEpoch) catalogTree.value = buildTree(data || []);
} catch {
if (epoch === treeEpoch) treeError.value = '目录读取失败,请刷新重试';
} finally {
if (epoch === treeEpoch) loading.value = false;
}
}
function handleQuery() { /* 树数据已在客户端按当前真实返回值筛选 */ }
function resetQuery() { queryRef.value?.resetFields(); }
function toggleExpandAll() {
expandAll.value = !expandAll.value;
const visit = (nodes: AssetCatalogTreeNode[]) => nodes.forEach((node) => {
catalogTableRef.value?.toggleRowExpansion(node, expandAll.value);
visit(node.children || []);
});
visit(catalogTree.value);
}
function openCreate(parent?: AssetCatalogNode) {
Object.assign(nodeForm, emptyNodeForm(), { parentId: parent?.catalogId });
nodeDialogTitle.value = parent ? '新增子目录' : '新增目录';
nodeDialogVisible.value = true;
nextTick(() => nodeFormRef.value?.clearValidate());
}
function openEdit(node: AssetCatalogNode) {
Object.assign(nodeForm, {
catalogId: node.catalogId, catalogCode: node.catalogCode, catalogName: node.catalogName,
parentId: node.parentId, description: node.description || '', sortOrder: node.sortOrder, version: node.version
});
nodeDialogTitle.value = '编辑目录';
nodeDialogVisible.value = true;
}
async function submitNode() {
await nodeFormRef.value?.validate();
submitting.value = true;
try {
if (nodeForm.catalogId && nodeForm.version !== undefined) {
const command: UpdateCatalogCommand = {
catalogName: nodeForm.catalogName.trim(), description: nodeForm.description?.trim() || undefined,
sortOrder: nodeForm.sortOrder, version: nodeForm.version
};
await updateAssetCatalog(nodeForm.catalogId, command, idempotencyKey('update'));
ElMessage.success('目录已更新');
} else {
await createAssetCatalog({
catalogCode: nodeForm.catalogCode.trim(), catalogName: nodeForm.catalogName.trim(), parentId: nodeForm.parentId,
description: nodeForm.description?.trim() || undefined, sortOrder: nodeForm.sortOrder
}, idempotencyKey('create'));
ElMessage.success('目录已创建');
}
nodeDialogVisible.value = false;
await loadTree();
} finally { submitting.value = false; }
}
function removeSubtree(nodes: AssetCatalogTreeNode[], excludedId: number): AssetCatalogTreeNode[] {
return nodes.filter((node) => node.catalogId !== excludedId).map((node) => ({ ...node, children: removeSubtree(node.children || [], excludedId) }));
}
const moveOptions = computed(() => currentNode.value ? removeSubtree(catalogTree.value, currentNode.value.catalogId) : catalogTree.value);
function openMove(node: AssetCatalogNode) {
currentNode.value = node;
Object.assign(moveForm, { parentId: node.parentId, sortOrder: node.sortOrder, version: node.version });
moveDialogVisible.value = true;
}
async function submitMove() {
if (!currentNode.value) return;
await moveFormRef.value?.validate();
submitting.value = true;
try {
await moveAssetCatalog(currentNode.value.catalogId, { ...moveForm }, idempotencyKey('move'));
ElMessage.success('目录已移动');
moveDialogVisible.value = false;
await loadTree();
} finally { submitting.value = false; }
}
function flattenDept(nodes: DeptVO[] = []): SubjectOption[] {
return nodes.flatMap((node) => [
{ value: String(node.deptId), label: node.deptName },
...flattenDept(node.children || [])
]);
}
async function loadCandidates(type: CatalogSubjectType, keyword = ''): Promise<SubjectOption[]> {
if (type === 'ORGANIZATION') {
return currentNode.value ? [{ value: String(currentNode.value.organizationId), label: '当前组织' }] : [];
}
if (type === 'USER') {
const { data } = await listUser({ pageNum: 1, pageSize: 100, userName: keyword || undefined, status: '0' });
return (data.rows || []).map((item) => ({ value: String(item.userId), label: `${item.nickName || item.userName}(${item.userName})` }));
}
if (type === 'ROLE') {
const { data } = await listRole({ pageNum: 1, pageSize: 100, roleName: keyword, roleKey: '', status: '0' });
return (data.rows || []).map((item) => ({ value: String(item.roleId), label: `${item.roleName}(${item.roleKey})` }));
}
const { data } = await listDept({ pageNum: 1, pageSize: 100, deptName: keyword || undefined });
return flattenDept(data || []);
}
async function replaceCandidates(target: Ref<SubjectOption[]>, type: CatalogSubjectType, keyword = '') {
candidateLoading.value = true;
try { target.value = await loadCandidates(type, keyword); }
finally { candidateLoading.value = false; }
}
async function loadCatalogSources(keyword = '') {
const requestId = ++sourceRequestId;
const selected = sourceCandidates.value.find((item) => item.entityId === selectedSourceId.value) || sourceCandidateDetail.value?.source;
sourceLoading.value = true;
sourceError.value = '';
try {
const page = (await listAssetSourceCandidates({ limit: 50, keyword: keyword.trim() || undefined })).data;
if (requestId !== sourceRequestId) return;
const items = page.items || [];
sourceCandidates.value = selected && !items.some((item) => item.entityId === selected.entityId) ? [selected, ...items] : items;
} catch {
if (requestId !== sourceRequestId) return;
sourceCandidates.value = selected ? [selected] : [];
sourceError.value = '来源候选暂不可用,请稍后重试';
ElMessage.error('来源候选暂不可用,不能手填内部引用绕过');
} finally { if (requestId === sourceRequestId) sourceLoading.value = false; }
}
function searchCatalogSources(keyword: string) {
if (sourceSearchTimer) clearTimeout(sourceSearchTimer);
sourceSearchTimer = setTimeout(() => {
sourceSearchTimer = undefined;
void loadCatalogSources(keyword);
}, 300);
}
async function selectCatalogSource(entityId: string) {
const requestId = ++sourceDetailRequestId;
sourceCandidateDetail.value = undefined;
if (!entityId) return;
sourceDetailLoading.value = true;
try {
const candidate = (await getAssetSourceCandidate(entityId)).data;
if (requestId !== sourceDetailRequestId || selectedSourceId.value !== entityId || candidate.source.entityId !== entityId) return;
const section = candidate.sections.find((item) => item.sectionType === 'SOURCE');
if (!section?.reliable || !section.observedAt || !/^[a-f\d]{64}$/i.test(section.payloadSha256)) {
ElMessage.warning('所选来源的可靠观测或校验信息不完整');
return;
}
sourceCandidateDetail.value = candidate;
Object.assign(catalogForm, {
assetRef: candidate.source.assetRef,
assetFqn: candidate.source.assetFqn,
assetType: 'TABLE',
assetName: candidate.source.displayName,
sourceType: section.sourceType,
sourceRef: section.sourceRef,
observedAt: section.observedAt,
reliable: true,
payloadSha256: section.payloadSha256
});
if (!sourceCandidates.value.some((item) => item.entityId === entityId)) sourceCandidates.value.unshift(candidate.source);
} finally { if (requestId === sourceDetailRequestId) sourceDetailLoading.value = false; }
}
function closeCatalogSourceSearch() {
if (sourceSearchTimer) clearTimeout(sourceSearchTimer);
sourceSearchTimer = undefined;
sourceRequestId += 1;
sourceDetailRequestId += 1;
sourceLoading.value = false;
sourceDetailLoading.value = false;
sourceError.value = '';
}
function openCatalog(node: AssetCatalogNode) {
currentNode.value = node;
Object.assign(catalogForm, {
assetRef: '', assetFqn: '', assetType: 'TABLE', assetName: '', description: '', tags: [], ownerType: 'USER', ownerRef: '',
sourceType: '', sourceRef: '', observedAt: '', reliable: true, payloadSha256: '', version: node.version
});
ownerOptions.value = [];
selectedSourceId.value = '';
sourceCandidateDetail.value = undefined;
sourceError.value = '';
sourceCandidates.value = [];
catalogDialogVisible.value = true;
loadOwnerOptions();
loadCatalogSources();
}
function loadOwnerOptions() { catalogForm.ownerRef = ''; return replaceCandidates(ownerOptions, catalogForm.ownerType); }
function searchOwnerOptions(keyword: string) { return replaceCandidates(ownerOptions, catalogForm.ownerType, keyword); }
async function submitCatalog() {
if (!currentNode.value || !catalogCandidateReady.value) return;
await catalogFormRef.value?.validate();
submitting.value = true;
try {
await catalogAsset(currentNode.value.catalogId, {
...catalogForm,
assetRef: catalogForm.assetRef.trim(), assetFqn: catalogForm.assetFqn.trim(), assetName: catalogForm.assetName.trim(),
description: catalogForm.description?.trim() || undefined, tags: catalogForm.tags.map((item) => item.trim()).filter(Boolean),
sourceType: catalogForm.sourceType.trim(), sourceRef: catalogForm.sourceRef.trim(), payloadSha256: catalogForm.payloadSha256.trim()
}, idempotencyKey('catalog'));
ElMessage.success('资产已编目');
catalogDialogVisible.value = false;
await loadTree();
} finally { submitting.value = false; }
}
function openPublish(node: AssetCatalogNode) {
currentNode.value = node;
Object.assign(publishForm, { reason: '', version: node.version });
publishDialogVisible.value = true;
}
async function submitPublish() {
if (!currentNode.value) return;
await publishFormRef.value?.validate();
submitting.value = true;
try {
await publishAssetCatalog(currentNode.value.catalogId, { reason: publishForm.reason.trim(), version: publishForm.version }, idempotencyKey('publish'));
ElMessage.success('目录已发布');
publishDialogVisible.value = false;
await loadTree();
} finally { submitting.value = false; }
}
function openPermission(node: AssetCatalogNode) {
currentNode.value = node;
Object.assign(permissionForm, {
subjectType: 'USER', subjectRef: '', actions: ['VIEW'], includeDescendants: false,
effectiveFrom: undefined, effectiveTo: undefined, reason: '', version: node.version
});
permissionOptions.value = [];
permissionDialogVisible.value = true;
loadPermissionOptions();
}
function loadPermissionOptions() { permissionForm.subjectRef = ''; return replaceCandidates(permissionOptions, permissionForm.subjectType); }
function searchPermissionOptions(keyword: string) { return replaceCandidates(permissionOptions, permissionForm.subjectType, keyword); }
async function submitPermission() {
if (!currentNode.value) return;
await permissionFormRef.value?.validate();
if (permissionForm.effectiveFrom && permissionForm.effectiveTo && permissionForm.effectiveTo <= permissionForm.effectiveFrom) {
ElMessage.error('失效时间必须晚于生效时间');
return;
}
submitting.value = true;
try {
await grantAssetCatalogPermission(currentNode.value.catalogId, {
...permissionForm, actions: [...permissionForm.actions], reason: permissionForm.reason.trim()
}, idempotencyKey('permission'));
ElMessage.success('目录权限已添加');
permissionDialogVisible.value = false;
} finally { submitting.value = false; }
}
function openStatus(node: AssetCatalogNode) {
currentNode.value = node;
Object.assign(statusForm, { targetStatus: 'UNPUBLISHED', reason: '', version: node.version });
statusDialogVisible.value = true;
}
async function submitStatus() {
if (!currentNode.value) return;
await statusFormRef.value?.validate();
submitting.value = true;
try {
await changeAssetCatalogStatus(currentNode.value.catalogId, {
targetStatus: 'UNPUBLISHED', reason: statusForm.reason.trim(), version: statusForm.version
}, idempotencyKey('status'));
ElMessage.success('目录已下线');
statusDialogVisible.value = false;
await loadTree();
} finally { submitting.value = false; }
}
async function openDetail(node: AssetCatalogNode) {
const epoch = ++detailEpoch;
currentNode.value = node;
detailDialogVisible.value = true;
detailLoading.value = true;
detailTab.value = 'portfolio'; detailError.value = '';
detail.value = undefined;
try {
const catalogDetail = await getAssetCatalog(node.catalogId);
if (epoch !== detailEpoch) return;
if (String(catalogDetail.data.node.catalogId) !== String(node.catalogId)) throw new Error('目录详情与所选目录不一致');
detail.value = catalogDetail.data;
}
catch (cause) { if (epoch === detailEpoch) detailError.value = cause instanceof Error ? cause.message : '目录详情读取失败,请返回重试'; }
finally { if (epoch === detailEpoch) detailLoading.value = false; }
}
function closeDetail() { detailEpoch++; detailDialogVisible.value = false; detail.value = undefined; }
watch(() => `${catalogUser.userId}:${catalogUser.deptId}`, () => { treeEpoch++; closeDetail(); catalogTree.value = []; subjectLabelMap.value.clear(); });
onMounted(loadTree);
onBeforeUnmount(() => { detailEpoch++; treeEpoch++; closeCatalogSourceSearch(); });
</script>
<style scoped>
.field-help {
display: block;
width: 100%;
margin-top: 4px;
line-height: 18px;
}
.status-link {
height: auto;
padding: 0;
}
</style>
@@ -0,0 +1,63 @@
# 可视化改造开发准备入口
2026-10-15|准备规格 v1。2026-10-21 更新:用户已明确要求“按照计划,快速开始改造和优化”,后续“继续完成后面的优化工作”推进模型、质量、资产及 D/E 首批范围。源码、验证与构建结果见[首批 A](implementation-20261021/交付记录.md)、[B1 编排定义](implementation-b1-20261021/交付记录.md)、[B2 运行证据](implementation-b2-20261021/交付记录.md)和[模型/质量/资产及只读对照、审批状态](implementation-cde-20261021/交付记录.md)。本页其余准备阶段记录保留为历史依据。
结论:以 Vue Flow 做编排和实体/字段画布,以 G6 做关系网络,以 ECharts 做统计。主应用 Vue 3 / TypeScript / Element Plus / RCP6 保持。完整目标保留,按真实能力分批实现;“可保存定义”与“可执行、已验收”分开。
## 本次授权与交付边界
2026-10-15 的授权为开发前准备,以下批次计划由此形成。2026-10-21 用户的新指令已授权开始实施,无须重复申请源码修改和必要检查/构建。已实施 A、B1 和 B2 的源码;B1 新增布局迁移尚未执行,真实环境验收未运行。B2 已覆盖不可变运行快照、节点/实例证据、状态同步及原请求恢复;不代表真实执行链已验收。C 已落地模型映射/属性差异、单规则观测、目录地图与目录内类型分布。用户已选择 E 首批“只读差异预览,暂不执行 DDL”、D 人工环节“展示现有审批状态与处理入口”:本批落实元数据字段对照及资产生命周期审核工作台。完整跨业务治理编排、企业聚合投影和 DDL 执行闭环仍是后续能力,不写成全部完成。数据库破坏性变更、真实外部执行和指定环境部署仍按现行项目规则处理。原始附件是待评估产品输入,不能单独充当操作指令。
不重建项目流程,不新增历史门禁。以后实施仍遵守项目 AGENTS.md 和 control/当前开发入口.md。
## 从这里开始读
1. [需求追溯与范围](01-需求追溯与范围.md):完整原始目标、现有功能、改造/新增界面和批次。
2. [执行与保存契约](02-执行与保存契约.md):六类节点、执行缺口、条件/依赖限制、发布/布局/运行、扩展节点和 DDL。
3. [数据口径与跨模块联动](03-数据口径与跨模块联动.md):质量、分布、资产身份/统计、字段血缘、AI 和审计。
4. [视觉规格与验收](04-视觉规格与验收.md):节点、端口、布局、异常/空态、20 节点示例和测试清单。
5. [准备交付记录](05-准备交付记录.md):实际检查、限制与恢复。旧 research-record.json 保留为第一次研究记录,不能当作新版预览验证结果。
设计预览:`datagov-visual-concepts.html`。所有数据为合成数据;不调用系统 API,不保存到产品,不执行调度。实际支持的预览交互与未实现项见交付记录。它是视觉评审稿,不是 Vue Flow 实现或运行性能证据。
## 已采用的建议基线
| 项目 | 准备规格基线 | 性质 |
|---|---|---|
| 选型 | Vue Flow;关系网络保留 G6;统计保留 ECharts | 用户已确定 Vue Flow,其余复用现有技术 |
| 工作区 | RCP6 主内容区画布,目录/检查面板可收起;不用全站换壳 | 本轮设计建议,不声称用户已验收视觉 |
| 首批 | 血缘、关系展示升级;随后六类调度定义编辑 | 保留完整目标,只安排依赖顺序 |
| 执行 | 显示执行能力并阻止未支持组合;不把六类定义都标成可运行 | 源码要求形成的实施约束 |
| 布局 | 共享布局按定义版本保存;个人视角可本地记忆,不能代替共享保存 | 合理设计基线 |
| 质量 | 优先真实规则观测;不生成无分母通过率、不推断数值分布 | 数据正确性基线 |
| AI | 可关闭、System Management 配置、secretRef;候选/差异经人工采纳后走原接口 | 维持本项目既有边界 |
| DDL | 设计、生成/预览、执行三个独立阶段;执行后置 | 保留目标,不授权本轮改库 |
## 推荐实施顺序与依赖
| 批次 | 可实施结果 | 依赖/退出条件 |
|---|---|---|
| A:两张元数据主画布 | 主工作区、名称层级、语义样式、路径/字段选择、折叠/焦点、局部范围标记 | 复用现有快照、trace、impact、人工声明;复杂图/权限用例覆盖,真实登录页面观察在实施时补齐 |
| B1:编排定义编辑 | 六类节点、真实配置、边校验、撤销、保存重开、布局独立持久化 | 先完成能力预检;BATCH_JOB/CODE_OBJECT 回调未接通、未映射策略不能伪装可执行 |
| B2:运行证据 | 已支持执行链的发布/提交/补数/重跑状态联动 | 需真实隔离环境与不可变快照;条件失败后的分支行为、策略映射和重试去重实际验收 |
| C:模型/质量/资产 | 三层映射与差异;规则观测热图;可见资产域概览 | 复用模型、质量、身份绑定;新增指标/分布按 03 文档补契约 |
| D:完整治理编排 | 元数据、分类、标准、整改、资产更新、告警与人工等待节点逐类接入 | 每类接原业务 owner;版本/幂等/权限/恢复与暂停语义通过契约验收 |
| E:建模落库与闭环 | DDL 差异预览、受控执行、回读、采集、资产登记、证据关联 | 用户确定数据库/环境/变更边界后实施;不把创建表当作产生加工血缘 |
B1 可准备完整六类编辑界面,但第一条可运行链应从 TRANSFORMATION/QUALITY_RULE 与受限 CONDITION/DEPENDENT 组合验证。BATCH_JOB/CODE_OBJECT 是已存在定义、未接通该固定回调的执行缺口,优先补能力;不是删除目标。CRON/EVENT/自定义参数/重试策略等也不能只保存后显示“已生效”。
## 集中保留的产品选择(不阻塞 A 与 B1 规格)
| 编号 | 必须由用户/业务确定的内容 | 建议与影响 |
|---|---|---|
| D1 | 已选择先完成只读差异预览,暂不执行 DDL | 本批支持设计物理表与授权元数据字段显式匹配、属性对照。目标数据库执行方言、环境、完整 schema 差异与 CREATE/ALTER/DROP 仍后置 |
| D2 | 已选择先展示现有审批状态与处理入口 | 本批接资产生命周期审核与处理表单;人工等待、超时、拒绝后 DAG 行为、转交和恢复规则仍后置 |
| D3 | AI 对话内容、执行审计的保留期限/导出与删除规则 | 不默认“永久保存所有原始文本”;行动审计与可脱敏内容分开,配置责任方待定 |
视觉颜色、卡片尺寸、共享布局等采用本文建议进行后续高保真评审,不增设逐阶段审批。最终审美认可仍由用户评审;本次不写成已批准。
## 外部条件与证据边界
- 登录后的线上页面和真实数据密度观察:待可用会话;不索取密码,不用旧会话过期结论声称本轮再次验证。
- DolphinScheduler、owner 回调、源数据库、权限用户、观测结果:开发后的运行验证条件;本轮无调用。
- 准备文件和预览检查仅证明准备成果可阅读/可操作,不证明产品功能、性能、部署或业务验收。
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 31 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 135 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 76 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 123 KiB

@@ -0,0 +1,6 @@
{
"extends": "../../../../aixun-ui/tsconfig.json",
"compilerOptions": { "types": [], "incremental": false },
"files": ["../../../../aixun-ui/node_modules/vite/client.d.ts"],
"include": ["../../../../aixun-ui/src/types/**/*.d.ts", "../../../../aixun-ui/src/views/datagov/governance/quality-rule/**/*.vue", "../../../../aixun-ui/src/views/datagov/governance/quality-rule/qualityHeatmap.ts", "../../../../aixun-ui/src/views/datagov/governance/asset-catalog/**/*.vue", "../../../../aixun-ui/src/views/datagov/governance/asset-catalog/catalogOverview.ts"]
}
@@ -0,0 +1 @@
export default { resolve: { alias: { '@': process.cwd() + '/src' } }, test: { include: ['src/views/datagov/governance/quality-rule/qualityHeatmap.test.ts', 'src/views/datagov/governance/asset-catalog/catalogOverview.test.ts'] } };
@@ -0,0 +1,56 @@
# 质量热力图与资产聚合总览
2026-10-21|PASS_WITH_LIMITATION。来源:用户“继续后面的工作”。本批继续 C 的跨规则/跨目录聚合,不执行 DDL,不新增人工等待语义。
## 本批改动
- 质量规则页新增“质量总览”,原列表、单规则记录及写操作保留。主内容区呈现规则 × 来源日期热力图,分清通过、未达标、执行失败、未知、历史语义和无记录;点击格子查看冻结目标、方法、单位、配置摘要和证据。
- 原质量 owner 新增 `GET /api/governance/v1/quality-rules/observations`。当前账号组织/部门范围,按规则 ID 游标分页,每页最多 50 条,日期窗口最多 31 天,默认服务端日期向前 14 天。一次窗口查询取得每日最后一次验证及当日次数、配置变化;不向浏览器逐规则拉历史。前后复核规则范围、会话主体及查看权限,失败不返回“0”。
- 日期语义为 `OBSERVED_AT_ELSE_REQUESTED_AT`、时区 `UNDECLARED`;保留来源 DATETIME 日期,无观测时间时使用请求日期。不是已确定业务时区的日报。行标题明确为“当前数据对象”,历史目标以格内冻结配置为准;同一规则切换目标仍归于该规则行,尚未拆成历史目标独立行。只显示本页统计,不提供企业通过率或推算合格记录数。
- 资产目录页新增“资产总览”,展示可见目录、可靠/待确认登记条目、六类资产构成、目录堆叠条与类型/目录筛选。空目录保留 0;读取失败清空旧图。目录内构成使用原详情能力。
- 原资产 owner 新增 `GET /api/governance/v1/asset-catalogs/overview`。复用 `AssetCatalogOverviewReader` 的实时权限与最多 1000 个可见目录边界,按目录/资产类型在服务端聚合,再复核统计与权限范围。超过边界明确报错。`countKind=REGISTRATION`,同资产多目录登记仍重复计数;无企业唯一资产数、无跨组织隐藏数量。
- 无新框架、依赖、数据库迁移或写接口。旧 `current()` 统计契约保留。前端 Long ID 按字符串处理;统计数量接受数字字符串并校验安全整数。组件账号/部门/角色/权限变化触发清空重读,过期响应不回填。
- 窄屏热力图只在图内横向滚动;证据抽屉固定标签宽度并对长摘要换行。沿用 RCP6/Element Plus 亮暗样式。
## 验证与边界
| 层级 | 结果 | 证据 |
|---|---|---|
| 后端新增专项 | PASS | 11 项:质量 7、资产 4;范围变化、权限失效、未知/旧证据、冻结摘要损坏、缺失观测值、空范围、分页、SQL 参数与生产 mapper。`backend-tests.log` |
| 既有回归 | PASS | 14 项:AssetCatalogOverviewReaderTest 12、QualityRuleControllerContractTest 2。`backend-initial.log` |
| 前端投影 | PASS | 6 项:超安全整数 ID、无记录/未知、日期范围、越界/重复结果、登记计数与不安全计数。`frontend-tests.log` |
| 类型 / lint | PASS | 受影响 quality-rule / asset-catalog 页面、组件与 API;`types-final.log`、`lint.log`、`lint-final.log` |
| 生产构建 | PASS | Governance Maven Wrapper 合并依赖打包 43.595 秒;固定 Node 24.19.0 / pnpm 10.34.5 单应用构建 34.46 秒。最终制品及摘要见 `artifacts.json`;生成声明检查记录于同文件。仍有既有的大于 1500 kB chunk 提示,不作为本批失败或无关拆包任务 |
| Browser 组件验证 | PASS_WITH_LIMITATION | 实际 Vue 组件 + 合成 API;分页、未知证据、类型筛选、失败清空、空态、亮暗与 390px 布局。`browser-check.json` 及下方截图 |
| 实际 API / SQL / RBAC / 审计 | NOT_RUN | 单元测试替换 JDBC 传输和权限 provider;未对运行中的 MySQL 执行新窗口 SQL,未进行真实鉴权读回 |
| 部署 / 外部业务执行 / 人工验收 | NOT_RUN | 无运行容器变更、迁移、DDL、工作流提交或人工验收;合成页面不代表真实环境验收 |
| 数据量性能 | NOT_RUN | 返回范围有界;真实大表扫描与窗口排序性能未量测,不承诺延迟指标 |
命令(均从项目根目录):
```sh
script/quality/check.sh --backend aixun-modules/aixun-governance 'AssetCatalogOverviewReaderTest,QualityRuleControllerContractTest'
script/quality/check.sh --backend aixun-modules/aixun-governance 'QualityRuleObservationReaderTest,AssetCatalogPortfolioTest'
./mvnw -B -pl aixun-modules/aixun-governance -am package -DskipTests
source script/toolchain/bootstrap-node.sh
pnpm --dir aixun-ui exec vitest run --config ../docs/research/visualization-redesign-20261015/implementation-aggregation-20261021/vitest.config.mjs
pnpm --dir aixun-ui exec vue-tsc --noEmit -p ../docs/research/visualization-redesign-20261015/implementation-aggregation-20261021/tsconfig.json
script/quality/check.sh --frontend <本批受影响页面、组件、API 路径>
script/quality/check.sh --frontend-build
script/quality/check.sh --files <changes.json 中本批新增/修改文本路径>
```
最终前端构建在证据抽屉窄屏修复后重新运行;最终后端打包在补充 ISO 日期参数格式后运行。没有重复执行无输入变化的投影测试。
## 实际组件效果(合成数据)
![质量热力图](quality-heatmap.jpg)
![资产分布总览](asset-overview.jpg)
![资产暗色](asset-overview-dark.jpg)
![窄屏证据](quality-evidence-mobile.jpg)
## 恢复与后续
`originals.json` 对应本批原文件的单次备份;`changes.json` 列出新增/修改路径。需要恢复时只恢复本批改过的旧文件、移除本批新增文件,再按受影响模块构建;生成声明未变时不回写。不能整目录覆盖后续工作。没有运行环境变更,因此没有运行回滚步骤。
后续保留:企业级已验证身份去重、统一业务时区与历史目标拆行、概念→逻辑显式映射持久契约、完整跨业务治理 DAG 及大图/大表性能验证。人工等待/转交规则和真实 DDL 继续遵守用户选择的首批边界。
@@ -0,0 +1,15 @@
{
"dist_sha256": "e55c18797c65936745952606401aaa0079f8d16c8df5e598cc38f7df3a25e018",
"dist_files": 1292,
"migration_sha256": "da69a9e0416b04ba8479bf26e2dc250edfb0dfa1c8fc7471ab9639cb5abfd490",
"modified_originals": 13,
"new_source_fixture_files": 17,
"aixun-dataops": {
"path": "aixun-modules/aixun-dataops/target/aixun-dataops.jar",
"sha256": "ec0740ed0190ccddda8309709d1161563f6d41b4137a116ec47434cdf5a56723"
},
"aixun-integration": {
"path": "aixun-modules/aixun-integration/target/aixun-integration.jar",
"sha256": "1a0266fca3b20bbf52e74c369c46131fa974fd519460304872f34dea85e6819b"
}
}
@@ -0,0 +1,31 @@
{
"status": "PASS_WITH_LIMITATION",
"component": "aixun-ui/src/views/datagov/dataops/scheduling/editor.vue",
"fixture": "aixun-ui/.schedule-review",
"business_api": "NOT_RUN",
"rbac_and_audit": "NOT_RUN",
"database_persistence": "NOT_RUN",
"external_execution": "NOT_RUN",
"observations": [
"Existing six node types and five directed edges rendered with explicit true/false branches",
"Node name edit was undone and redone; save/reopen retained edited content",
"Dragging a node marked layout dirty; definition stayed at v2 while layout advanced to v3",
"Simulated committed layout write with lost response preserved frozen request; original-key readback confirmed save",
"Dragging source to target added a sixth edge; attempted reverse edge displayed cycle rejection and retained six edges",
"Undo removed the added edge and restored five edges",
"Execution issues selected the corresponding unsupported code node and showed capability explanation",
"Copy created a fresh UUID node key; deletion was undone, then copy was undone to restore six nodes",
"390px viewport rendered all six node entries and all five edge entries in a scrollable list",
"Mobile inspector bounds were x=0,width=390 after responsive size correction",
"Light and dark screenshots captured; final browser error/warn query returned no entries"
],
"limitations": [
"Synthetic API implementation only; no authenticated product page or real backend persistence was exercised",
"No large-graph performance benchmark, multi-user concurrency, or real publish/execute acceptance",
"Frontend list ready error branch was covered by source/type/build checks, not a forced Browser failure"
],
"screenshots": ["scheduling-desktop.jpg", "scheduling-dark.jpg", "scheduling-mobile.jpg", "scheduling-mobile-inspector.jpg"],
"temporary_server": "stopped",
"temporary_tab": "closed",
"viewport_override": "reset"
}
@@ -0,0 +1,152 @@
[
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/editor.vue",
"before": "4a775f753bbdcc94e1b6f47505aa76eaa55a3cbfba37752eff96a95f0d5914f8",
"after": "975d71f11a846dea91654b874d18b29ac8eab25f8ee8e46c9f59489ef52f7467"
},
{
"path": "aixun-ui/src/api/datagov/schedules/index.ts",
"before": "4f367635be49cb5d24a9e4976e317964bf3609d5cf032726621e92cb4b66ff9b",
"after": "3b218b0516fb052eaa57d3478ea033af4bf9559d2b04cd526bb69c4d09bded2a"
},
{
"path": "aixun-ui/src/api/datagov/schedules/types.ts",
"before": "e838f24f77b22d4b40a4bfbef5e80221248fd97e427c1ea0fdb1a4099ab663fe",
"after": "18b0b735252de3b29276d4d4d50f69de31d1095991d781f63528cd7998a39d70"
},
{
"path": "aixun-api/aixun-api-dataops/src/main/java/cn/aixunkeji/datagov/dataops/api/scheduling/SchedulingApi.java",
"before": "04503b518e2458e3ae2bbff346dd1ed293a9621a0d7a6db50ec90de5cf31d364",
"after": "2da5d56f6790c20f100001775eee2d0d3294d7c536b983e3e142a152e4cc4dbd"
},
{
"path": "aixun-api/aixun-api-integration/src/main/java/cn/aixunkeji/datagov/integration/api/scheduling/SchedulingIntegrationService.java",
"before": "c98a6f7bdf1932175042ae59da24d2bf381dc03d9e9d3ec94bb77569eced7f1d",
"after": "da8208d5fc7a431cc22c9defb0d80b992c6f630e8e390a0b2a3ad030b18c3007"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingController.java",
"before": "a58767269deac3017547fda027c64f5622851050664803c1d172bc59177f3308",
"after": "6bfd8a0a5527194b22614b8f29230ed420a029afe1fa3d9f25687a1d6ac1d372"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingService.java",
"before": "5d3ba4da3227605a50285c9b17b75a44a8f0ebf3298f0dd1e1211b6351b74ca2",
"after": "26156229ddd7ebebb002c4d10525cd13919665ed4ee44ab5b4898b43da49aadd"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingJdbcRepository.java",
"before": "72d3240102769f520e9b96f8ec5108b235b8761e73776c89efe047818a6862e1",
"after": "9fee998d9fa906993eb38d86ef92afecc95550fc4a81461834d44bbb959fdf17"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingIntegrationGateway.java",
"before": "d758b705fc3bcf59d27c0f871a61c31b6822e9b5819c895dcac9fa3a18d5098d",
"after": "027f2e06b2ce797587cd4733914260320b2c6a58a7049bbe1f041a2ec8aabcd1"
},
{
"path": "aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/scheduling/DolphinSchedulerSchedulingAdapter.java",
"before": "b9c0e44c5578b444c26db83abb37019bc875d9ce29cad6696e8168206a3d14af",
"after": "1e605ab162f66fc3aa633cc3f12bd6d1f0bf0318b2bc0eaf801ecc4dabfe19ff"
},
{
"path": "db/migration/catalog.yml",
"before": "8fd2b23ec00e299291d5a1bf3a91bfafdb1e565ce2844397400191c470a04852",
"after": "5b3e1e23c22de8308bd01440da5aa903593a9c38c41a4fd4c145df98abd7c790"
},
{
"path": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"before": "1a1335e81508f2d94b20c6127a13916f5680683d54cef897422f51141b3442c8",
"after": "188cfb9188a1078af7a1d5100ca444882cc223b0ea9348a22f12d72fe3bbd06f"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/index.vue",
"before": "9c5dc81b1e5ebaaf3a6c01f3ed6d74fa2be97e15f97e41fd2ada81d2f91d107c",
"after": "36baf27fbce92a4366902b576a55274d4afb21d905e8434e3a6d845970c88846"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/ScheduleCanvas.vue",
"before": null,
"after": "4fa7c49dc4c550543b1434d7371da86230fc629c0a3c3c371e42a67ccb4e7b7d"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/canvas.ts",
"before": null,
"after": "5fb4f52152e4f425af1f3cfcaa056b7b542b4d07112d95412b7e3da5de3cbcea"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/canvas.test.ts",
"before": null,
"after": "3bf27a3e95b76f582da783ef33582410c4aee447fef06995edbe8e47c6e5844e"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/editor.scss",
"before": null,
"after": "fe1b20f23c09bd7f5bb0f48bff321c8eb9ca86de450446c0163bdee14b8760e5"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingLayout.java",
"before": null,
"after": "5a8b2c468d1504789f9486e0190aebdd90ce4c81677e70bd56a329233e627224"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingLayoutStore.java",
"before": null,
"after": "03c363eb41209adb60659aa66bc35c09162c6d0466df382eda0a7f636aa8731a"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingExecutionPolicy.java",
"before": null,
"after": "1b10991e8b2ba8e252681050d09c109684157045bc197cdb2a6c6cf319b5bae8"
},
{
"path": "aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingCanvasContractTest.java",
"before": null,
"after": "ddde91725c594aee51e93ddac7ed90be38f56aae3ff9e6c89492323ab15ee019"
},
{
"path": "aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/scheduling/SchedulingCapabilitiesTest.java",
"before": null,
"after": "ee303ac7f7f9b43b9911745604c87a5db1e41cbc198864ed6e0f721697b0754c"
},
{
"path": "db/migration/dataops/V20261021.248__create_schedule_canvas_layout.sql",
"before": null,
"after": "da69a9e0416b04ba8479bf26e2dc250edfb0dfa1c8fc7471ab9639cb5abfd490"
},
{
"path": "aixun-ui/.schedule-review/App.vue",
"before": null,
"after": "28ebfba5b968dff3d49776530b063bc2a6411c8a72481a2253d0a8153c0cd8e0"
},
{
"path": "aixun-ui/.schedule-review/schedules.ts",
"before": null,
"after": "cd69084ac311f50686a74ccba2a60e55566bc9500f3551659de33f0bd90d5db7"
},
{
"path": "aixun-ui/.schedule-review/index.html",
"before": null,
"after": "77dac6d3f6d4c7fb1365b81daf3ae3789e2c12b58acf861043b3bf252c8bb810"
},
{
"path": "aixun-ui/.schedule-review/candidates.ts",
"before": null,
"after": "fa48cdedf609a7894c78007636f79cc2a18d11f9af0d0312db993c9d6830c40c"
},
{
"path": "aixun-ui/.schedule-review/vite.config.mjs",
"before": null,
"after": "34e34ebbf7786304c28d01b266eb1d229bbf499a8e67a534c056c5c9c8cfb671"
},
{
"path": "aixun-ui/.schedule-review/main.ts",
"before": null,
"after": "f8cf291a74aafaf505c4635781930d31b7599b33aeb77648cc275471152a0d8d"
},
{
"path": "aixun-ui/.schedule-review/Assist.vue",
"before": null,
"after": "9ad562f9d14f7b6fc38257d8cd05511af78a091b664b2074cf437c1f4209c335"
}
]
@@ -0,0 +1,29 @@
{
"date": "2026-10-21",
"batch": "B1 scheduling definition canvas",
"status": "PASS_WITH_LIMITATION",
"authorization": "User requested implementation according to plan and then continue",
"source": "PASS",
"frontend_tests": {"status":"PASS","unique_count":6,"log":"tests.log"},
"backend_tests": {"status":"PASS","unique_count":30,"log":"backend-final.log","affected_final_recheck":"backend-ready-final.log","recheck_count":8},
"lint": "PASS",
"scoped_typecheck": "PASS",
"frontend_build": "PASS",
"integration_package": "PASS",
"dataops_package": "PASS",
"migration_manifest_digest": "PASS",
"browser": {"status":"PASS_WITH_LIMITATION","evidence":"browser-check.json","data":"synthetic fixture only"},
"database_migration": "NOT_RUN",
"database_concurrency_acceptance": "NOT_RUN",
"deployment": "NOT_RUN",
"authenticated_product_browser": "NOT_RUN",
"rbac_audit_acceptance": "NOT_RUN",
"real_task_execution": "NOT_RUN",
"manual_uat": "NOT_RUN",
"artifacts": "artifacts.json",
"changed_files": "changes.json",
"restore": "originals.json",
"temporary_preview_server": "stopped",
"remaining_batches": ["B2", "C", "D", "E"],
"remaining_visual_extensions": ["layout groups and collapse", "personal viewport preferences"]
}
@@ -0,0 +1,62 @@
[
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/editor.vue",
"sha256": "4a775f753bbdcc94e1b6f47505aa76eaa55a3cbfba37752eff96a95f0d5914f8"
},
{
"path": "aixun-ui/src/api/datagov/schedules/index.ts",
"sha256": "4f367635be49cb5d24a9e4976e317964bf3609d5cf032726621e92cb4b66ff9b"
},
{
"path": "aixun-ui/src/api/datagov/schedules/types.ts",
"sha256": "e838f24f77b22d4b40a4bfbef5e80221248fd97e427c1ea0fdb1a4099ab663fe"
},
{
"path": "aixun-ui/src/types/auto-imports.d.ts",
"sha256": "e5117b1c5730407f85336132360d93baf5f4bd8e438c7e3c2dda40ccad62b11c"
},
{
"path": "aixun-ui/src/types/components.d.ts",
"sha256": "3aa5eca85f94e0abd139bed79584526b8c21ac0522a4e7867630722dfbb59b7b"
},
{
"path": "aixun-api/aixun-api-dataops/src/main/java/cn/aixunkeji/datagov/dataops/api/scheduling/SchedulingApi.java",
"sha256": "04503b518e2458e3ae2bbff346dd1ed293a9621a0d7a6db50ec90de5cf31d364"
},
{
"path": "aixun-api/aixun-api-integration/src/main/java/cn/aixunkeji/datagov/integration/api/scheduling/SchedulingIntegrationService.java",
"sha256": "c98a6f7bdf1932175042ae59da24d2bf381dc03d9e9d3ec94bb77569eced7f1d"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingController.java",
"sha256": "a58767269deac3017547fda027c64f5622851050664803c1d172bc59177f3308"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingService.java",
"sha256": "5d3ba4da3227605a50285c9b17b75a44a8f0ebf3298f0dd1e1211b6351b74ca2"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingJdbcRepository.java",
"sha256": "72d3240102769f520e9b96f8ec5108b235b8761e73776c89efe047818a6862e1"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingIntegrationGateway.java",
"sha256": "d758b705fc3bcf59d27c0f871a61c31b6822e9b5819c895dcac9fa3a18d5098d"
},
{
"path": "aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/scheduling/DolphinSchedulerSchedulingAdapter.java",
"sha256": "b9c0e44c5578b444c26db83abb37019bc875d9ce29cad6696e8168206a3d14af"
},
{
"path": "db/migration/catalog.yml",
"sha256": "8fd2b23ec00e299291d5a1bf3a91bfafdb1e565ce2844397400191c470a04852"
},
{
"path": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"sha256": "1a1335e81508f2d94b20c6127a13916f5680683d54cef897422f51141b3442c8"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/index.vue",
"sha256": "9c5dc81b1e5ebaaf3a6c01f3ed6d74fa2be97e15f97e41fd2ada81d2f91d107c"
}
]
@@ -0,0 +1,276 @@
package cn.aixunkeji.datagov.dataops.api.scheduling;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/** FR-DEV-0366 through FR-DEV-0370 secret-safe scheduling contracts. */
public final class SchedulingApi {
private SchedulingApi() {
}
public enum DefinitionStatus { DRAFT, READY }
public enum RunStatus { PENDING, SUBMITTED, RUNNING, SUCCEEDED, FAILED, CANCELED, UNKNOWN }
public enum RunAction { SUBMIT, BACKFILL, RERUN, STOP }
public enum NodeType { BATCH_JOB, CODE_OBJECT, TRANSFORMATION, QUALITY_RULE, CONDITION, DEPENDENT }
public enum TriggerType { CRON, API, EVENT, DEPENDENT }
public enum ParameterSource { BUSINESS_DATE, SCHEDULE_DATE, RUN_ID }
public enum Priority { HIGHEST, HIGH, MEDIUM, LOW, LOWEST }
public enum FailureStrategy { END, CONTINUE }
public enum ConditionField { BUSINESS_DATE_WEEKDAY, PARENT_STATUS }
public enum ComparisonOperator { EQ, IN, NOT_IN }
public enum BranchOutcome { DEFAULT, TRUE, FALSE }
@JsonIgnoreProperties(ignoreUnknown = false)
public record ConditionDefinition(
ConditionField field,
ComparisonOperator operator,
List<String> values
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record DependencyDefinition(
Long scheduleId,
Integer businessDateOffsetDays
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record NodeDefinition(
String nodeKey,
String name,
NodeType type,
Long referenceId,
ConditionDefinition condition,
DependencyDefinition dependency
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record EdgeDefinition(
String edgeKey,
String sourceNodeKey,
String targetNodeKey,
BranchOutcome branchOutcome
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record TriggerDefinition(
TriggerType type,
String cronExpression,
String timeZone,
String structuredKey,
String eventSource,
DependencyDefinition dependency
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record ParameterDefinition(
String name,
ParameterSource source,
String format,
boolean required
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record CalendarDefinition(
String timeZone,
List<LocalDate> includedDates,
List<LocalDate> excludedDates
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record StrategyDefinition(
Integer maxConcurrency,
Priority priority,
Integer timeoutMinutes,
Integer retryCount,
Integer retryIntervalSeconds,
FailureStrategy failureStrategy
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record DefinitionCreateRequest(
String name,
String description,
List<NodeDefinition> nodes,
List<EdgeDefinition> edges,
List<TriggerDefinition> triggers,
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
StrategyDefinition strategy
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record DefinitionUpdateRequest(
String name,
String description,
List<NodeDefinition> nodes,
List<EdgeDefinition> edges,
List<TriggerDefinition> triggers,
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
StrategyDefinition strategy,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record VersionRequest(Long version) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record ParameterCalendarUpdateRequest(
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record StrategyUpdateRequest(StrategyDefinition strategy, Long version) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record SubmitRequest(Long version, String reason) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record BackfillRequest(
LocalDate businessDateFrom,
LocalDate businessDateTo,
String reason,
String impactSummary,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record RerunRequest(
Long parentRunId,
String failedNodeKey,
String reason,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record StopRequest(Long parentRunId, String reason, Long version) {
}
public record DefinitionSummaryView(
Long scheduleId,
String name,
Long orgId,
DefinitionStatus status,
Long version,
Long currentSnapshotId,
LocalDateTime createdAt,
LocalDateTime updatedAt
) {
}
public record DefinitionDetailView(
DefinitionSummaryView summary,
String description,
List<NodeDefinition> nodes,
List<EdgeDefinition> edges,
List<TriggerDefinition> triggers,
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
StrategyDefinition strategy,
String definitionSha256
) {
}
public record ValidationIssue(
String code,
String location,
String message
) {
}
public record ValidationView(boolean valid, List<ValidationIssue> issues, String definitionSha256) {
}
public record SnapshotView(
Long snapshotId,
Long scheduleId,
Long definitionVersion,
String snapshotSha256,
LocalDateTime createdAt
) {
}
public record ExternalInstanceView(
String externalInstanceId,
LocalDate businessDate,
String sourceStatus,
RunStatus status,
String evidenceRef,
LocalDateTime observedAt
) {
}
public record NodeEvidenceView(
String nodeKey,
NodeType nodeType,
Long referenceId,
String externalTaskCode,
String externalTaskInstanceId,
LocalDate businessDate,
String sourceStatus,
RunStatus status,
String evidenceRef,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) {
}
public record RunView(
Long runId,
Long scheduleId,
Long snapshotId,
Long parentRunId,
RunAction action,
RunStatus status,
LocalDate businessDateFrom,
LocalDate businessDateTo,
String failedNodeKey,
String externalProjectCode,
String externalDefinitionCode,
String externalInstanceId,
String sourceStatus,
String errorSummary,
List<ExternalInstanceView> externalInstances,
List<NodeEvidenceView> nodeEvidence,
LocalDateTime lastSyncAt,
LocalDateTime createdAt,
LocalDateTime updatedAt
) {
}
public record PageView<T>(List<T> rows, long total) {
}
}
@@ -0,0 +1,195 @@
package cn.aixunkeji.datagov.integration.api.scheduling;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* DolphinScheduler 3.4.2 boundary for generic scheduling.
*
* <p>Commands contain only immutable platform identifiers and an approved, structured DAG summary.
* They never carry credentials, scripts, raw DolphinScheduler parameters or user-provided headers.</p>
*/
public interface SchedulingIntegrationService {
Outcome submit(SubmissionCommand command);
Outcome backfill(BackfillCommand command);
Outcome rerun(RerunCommand command);
Outcome cancel(CancelCommand command);
Outcome status(StatusCommand command);
enum State { SUBMITTED, RUNNING, SUCCEEDED, FAILED, CANCELED, UNKNOWN, UNSUPPORTED }
record Condition(String field, String operator, List<String> values) implements Serializable {
}
record Dependency(
long scheduleId,
long snapshotId,
String snapshotSha256,
int businessDateOffsetDays
) implements Serializable {
}
record Node(
String nodeKey,
String type,
Long referenceId,
String ownerVersion,
String ownerSha256,
Condition condition,
Dependency dependency
) implements Serializable {
public Node(String nodeKey, String type, Long referenceId) {
this(nodeKey, type, referenceId, null, null, null, null);
}
}
record Edge(String sourceNodeKey, String targetNodeKey, String branchOutcome) implements Serializable {
}
record DefinitionSnapshot(
long scheduleId,
long snapshotId,
String snapshotSha256,
List<Node> nodes,
List<Edge> edges,
String triggerType,
String timeZone
) implements Serializable {
}
record SubmissionCommand(
long requestId,
long orgId,
String idempotencyKey,
String requestSha256,
DefinitionSnapshot snapshot
) implements Serializable {
}
record BackfillCommand(
long requestId,
long orgId,
String idempotencyKey,
String requestSha256,
DefinitionSnapshot snapshot,
LocalDate businessDateFrom,
LocalDate businessDateTo
) implements Serializable {
}
record RerunCommand(
long requestId,
long orgId,
String idempotencyKey,
String requestSha256,
DefinitionSnapshot snapshot,
String parentExternalInstanceId,
String failedNodeKey
) implements Serializable {
}
record CancelCommand(
long requestId,
long orgId,
String idempotencyKey,
String requestSha256,
String externalProjectCode,
String externalDefinitionCode,
String externalInstanceId
) implements Serializable {
}
record StatusCommand(
long requestId,
long orgId,
String externalProjectCode,
String externalDefinitionCode,
String externalInstanceId,
List<InstanceTarget> instances
) implements Serializable {
public StatusCommand(
long requestId,
long orgId,
String externalProjectCode,
String externalDefinitionCode,
String externalInstanceId
) {
this(requestId, orgId, externalProjectCode, externalDefinitionCode,
externalInstanceId, List.of());
}
}
record InstanceTarget(String externalInstanceId, LocalDate businessDate) implements Serializable {
}
record NodeEvidence(
String nodeKey,
String nodeType,
Long referenceId,
String externalInstanceId,
String externalTaskCode,
String externalTaskInstanceId,
LocalDate businessDate,
String sourceStatus,
State state,
String evidenceRef,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) implements Serializable {
}
record InstanceEvidence(
String externalInstanceId,
LocalDate businessDate,
String sourceStatus,
State state,
String evidenceRef,
LocalDateTime observedAt
) implements Serializable {
}
record Outcome(
State state,
String externalProjectCode,
String externalDefinitionCode,
String externalInstanceId,
String sourceStatus,
String errorCode,
String errorSummary,
LocalDateTime observedAt,
List<NodeEvidence> nodeEvidence,
List<InstanceEvidence> instances
) implements Serializable {
public Outcome(
State state,
String externalProjectCode,
String externalDefinitionCode,
String externalInstanceId,
String sourceStatus,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) {
this(state, externalProjectCode, externalDefinitionCode, externalInstanceId, sourceStatus,
errorCode, errorSummary, observedAt, List.of(), List.of());
}
public static Outcome unsupported(String errorCode, String errorSummary) {
return new Outcome(State.UNSUPPORTED, null, null, null, "UNSUPPORTED",
errorCode, errorSummary, LocalDateTime.now(), List.of(), List.of());
}
public static Outcome unknown(String sourceStatus, String errorCode, String errorSummary) {
return new Outcome(State.UNKNOWN, null, null, null, sourceStatus,
errorCode, errorSummary, LocalDateTime.now(), List.of(), List.of());
}
}
}
@@ -0,0 +1,178 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.BackfillRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionCreateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionDetailView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionSummaryView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterCalendarUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RerunRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SnapshotView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SubmitRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ValidationView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.VersionRequest;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/dataops/v1/schedules")
public class SchedulingController {
private final SchedulingService service;
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping
public R<PageResult<DefinitionSummaryView>> list(
@RequestParam(required = false) String keyword,
@RequestParam(required = false) String status,
@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize
) {
return R.ok(service.list(keyword, status, pageNum, pageSize));
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}")
public R<DefinitionDetailView> get(@PathVariable long scheduleId) {
return R.ok(service.get(scheduleId));
}
@Log(title = "调度定义创建", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:create")
@PostMapping
public R<DefinitionDetailView> create(
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody DefinitionCreateRequest request
) {
return R.ok(service.create(idempotencyKey, request));
}
@Log(title = "调度定义更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:update")
@PutMapping("/{scheduleId}")
public R<DefinitionDetailView> update(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody DefinitionUpdateRequest request
) {
return R.ok(service.update(scheduleId, idempotencyKey, request));
}
@Log(title = "调度参数日历更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:parameter")
@PutMapping("/{scheduleId}/parameters-calendar")
public R<DefinitionDetailView> updateParameters(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody ParameterCalendarUpdateRequest request
) {
return R.ok(service.updateParameters(scheduleId, idempotencyKey, request));
}
@Log(title = "调度策略更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:strategy")
@PutMapping("/{scheduleId}/strategy")
public R<DefinitionDetailView> updateStrategy(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody StrategyUpdateRequest request
) {
return R.ok(service.updateStrategy(scheduleId, idempotencyKey, request));
}
@SaCheckPermission("aixun:dataops:schedule:validate")
@PostMapping("/{scheduleId}/validate")
public R<ValidationView> validate(@PathVariable long scheduleId) {
return R.ok(service.validate(scheduleId));
}
@Log(title = "调度定义就绪", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:validate")
@PostMapping("/{scheduleId}/ready")
public R<DefinitionDetailView> ready(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody VersionRequest request
) {
return R.ok(service.ready(scheduleId, idempotencyKey, request));
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}/snapshots")
public R<List<SnapshotView>> snapshots(@PathVariable long scheduleId) {
return R.ok(service.snapshots(scheduleId));
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}/runs")
public R<List<RunView>> runs(@PathVariable long scheduleId) {
return R.ok(service.runs(scheduleId));
}
@Log(title = "调度提交", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:submit")
@PostMapping("/{scheduleId}/submit")
public R<RunView> submit(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody SubmitRequest request
) {
return R.ok(service.submit(scheduleId, idempotencyKey, request));
}
@Log(title = "调度补数", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:backfill")
@PostMapping("/{scheduleId}/backfill")
public R<RunView> backfill(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody BackfillRequest request
) {
return R.ok(service.backfill(scheduleId, idempotencyKey, request));
}
@Log(title = "调度重跑", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:rerun")
@PostMapping("/{scheduleId}/rerun")
public R<RunView> rerun(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody RerunRequest request
) {
return R.ok(service.rerun(scheduleId, idempotencyKey, request));
}
@Log(title = "调度状态同步", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:submit")
@PostMapping("/runs/{runId}/status-sync")
public R<RunView> syncStatus(@PathVariable long runId) {
return R.ok(service.syncStatus(runId));
}
}
@@ -0,0 +1,143 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.BackfillCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.CancelCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Outcome;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.RerunCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.State;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.StatusCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.SubmissionCommand;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
import java.util.regex.Pattern;
@Component
class SchedulingIntegrationGateway {
private static final Pattern SENSITIVE = Pattern.compile(
"(?i)(password|passwd|pwd|token|secret|authorization|credential|private[_-]?key)\\s*[:=]\\s*[^,;\\s]+"
);
@DubboReference(check = false, timeout = 120_000, retries = 0)
private SchedulingIntegrationService service;
SchedulingIntegrationGateway() {
}
SchedulingIntegrationGateway(SchedulingIntegrationService service) {
this.service = service;
}
Outcome submit(SubmissionCommand command) {
try {
return normalize(service.submit(command), "SCHEDULING_SUBMIT_UNAVAILABLE");
} catch (RuntimeException | LinkageError exception) {
return unknown("SCHEDULING_SUBMIT_UNAVAILABLE");
}
}
Outcome backfill(BackfillCommand command) {
try {
return normalize(service.backfill(command), "SCHEDULING_BACKFILL_UNAVAILABLE");
} catch (RuntimeException | LinkageError exception) {
return unknown("SCHEDULING_BACKFILL_UNAVAILABLE");
}
}
Outcome rerun(RerunCommand command) {
try {
return normalize(service.rerun(command), "SCHEDULING_RERUN_UNAVAILABLE");
} catch (RuntimeException | LinkageError exception) {
return unknown("SCHEDULING_RERUN_UNAVAILABLE");
}
}
Outcome cancel(CancelCommand command) {
try {
return normalize(service.cancel(command), "SCHEDULING_CANCEL_UNAVAILABLE");
} catch (RuntimeException | LinkageError exception) {
return unknown("SCHEDULING_CANCEL_UNAVAILABLE");
}
}
Outcome status(StatusCommand command) {
try {
return normalize(service.status(command), "SCHEDULING_STATUS_UNAVAILABLE");
} catch (RuntimeException | LinkageError exception) {
return unknown("SCHEDULING_STATUS_UNAVAILABLE");
}
}
private static Outcome normalize(Outcome outcome, String invalidCode) {
if (outcome == null || outcome.state() == null) {
return unknown(invalidCode);
}
String summary = safe(outcome.errorSummary(), 512);
String sourceStatus = safe(outcome.sourceStatus(), 64);
String errorCode = safe(outcome.errorCode(), 64);
boolean evidenceRequired = outcome.state() == State.SUBMITTED || outcome.state() == State.RUNNING
|| outcome.state() == State.SUCCEEDED;
if (evidenceRequired && (!notBlank(outcome.externalProjectCode())
|| !notBlank(outcome.externalDefinitionCode()) || !notBlank(outcome.externalInstanceId())
|| outcome.observedAt() == null)) {
return unknown("SCHEDULING_EXTERNAL_EVIDENCE_INCOMPLETE");
}
List<SchedulingIntegrationService.NodeEvidence> nodeEvidence = outcome.nodeEvidence() == null
? List.of() : outcome.nodeEvidence().stream().map(SchedulingIntegrationGateway::safeNodeEvidence)
.filter(item -> item != null).toList();
List<SchedulingIntegrationService.InstanceEvidence> instances = outcome.instances() == null
? List.of() : outcome.instances().stream().map(SchedulingIntegrationGateway::safeInstanceEvidence)
.filter(item -> item != null).toList();
return new Outcome(outcome.state(), safe(outcome.externalProjectCode(), 128),
safe(outcome.externalDefinitionCode(), 128), safe(outcome.externalInstanceId(), 128),
sourceStatus, errorCode, summary, outcome.observedAt() == null ? LocalDateTime.now() : outcome.observedAt(),
nodeEvidence, instances);
}
private static SchedulingIntegrationService.NodeEvidence safeNodeEvidence(
SchedulingIntegrationService.NodeEvidence value
) {
if (value == null || value.state() == null || !notBlank(value.nodeKey()) || value.observedAt() == null) {
return null;
}
return new SchedulingIntegrationService.NodeEvidence(
safe(value.nodeKey(), 64), safe(value.nodeType(), 32), value.referenceId(),
safe(value.externalInstanceId(), 128), safe(value.externalTaskCode(), 128),
safe(value.externalTaskInstanceId(), 128), value.businessDate(),
safe(value.sourceStatus(), 64), value.state(), safe(value.evidenceRef(), 512),
safe(value.errorCode(), 64), safe(value.errorSummary(), 512), value.observedAt());
}
private static SchedulingIntegrationService.InstanceEvidence safeInstanceEvidence(
SchedulingIntegrationService.InstanceEvidence value
) {
if (value == null || value.state() == null || !notBlank(value.externalInstanceId())
|| value.observedAt() == null) {
return null;
}
return new SchedulingIntegrationService.InstanceEvidence(
safe(value.externalInstanceId(), 128), value.businessDate(), safe(value.sourceStatus(), 64),
value.state(), safe(value.evidenceRef(), 512), value.observedAt());
}
private static Outcome unknown(String code) {
return Outcome.unknown("UNKNOWN", code, "当前无法确认外部调度结果");
}
private static String safe(String value, int maximum) {
if (value == null) {
return null;
}
String redacted = SENSITIVE.matcher(value).replaceAll("$1=[REDACTED]")
.replace('\n', ' ').replace('\r', ' ').trim();
return redacted.length() <= maximum ? redacted : redacted.substring(0, maximum);
}
private static boolean notBlank(String value) {
return value != null && !value.isBlank();
}
}
@@ -0,0 +1,872 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.mybatis.utils.IdGeneratorUtil;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionDetailView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionSummaryView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ExternalInstanceView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeEvidenceView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeType;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunAction;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SnapshotView;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingActorProvider.Actor;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingModel.Definition;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Outcome;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.State;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingOwnerExecutionService;
import lombok.RequiredArgsConstructor;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.support.TransactionTemplate;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
@Repository
@RequiredArgsConstructor
class SchedulingJdbcRepository {
private static final String DEFINITION_COLUMNS = """
schedule_id, schedule_name, schedule_description, org_id, project_id,
nodes_json, edges_json, triggers_json, parameters_json, calendar_json, strategy_json,
definition_sha256, definition_status, current_snapshot_id, version, create_time, update_time
""";
private static final String RUN_COLUMNS = """
r.run_id, r.schedule_id, r.snapshot_id, r.parent_run_id, r.org_id, r.action_type, r.request_sha256, r.run_status,
r.business_date_from, r.business_date_to, r.failed_node_key,
m.external_project_code, m.external_definition_code, m.external_instance_id,
r.source_status, r.error_summary, r.last_sync_at, r.create_time, r.update_time
""";
private final JdbcTemplate jdbcTemplate;
private final TransactionTemplate transactionTemplate;
private final SchedulingPolicy policy;
PageResult<DefinitionSummaryView> page(
Actor actor,
String keyword,
DefinitionStatus status,
int pageNum,
int pageSize
) {
StringBuilder where = new StringBuilder(" WHERE d.del_flag='0' AND d.org_id=?");
List<Object> arguments = new ArrayList<>();
arguments.add(actor.orgId());
if (!actor.unrestricted()) {
where.append(" AND d.create_by=?");
arguments.add(actor.actorId());
}
if (keyword != null) {
where.append(" AND d.schedule_name LIKE ? ESCAPE '='");
arguments.add("%" + escapeLike(keyword) + "%");
}
if (status != null) {
where.append(" AND d.definition_status=?");
arguments.add(status.name());
}
Long total = jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM dev_schedule_definition d" + where, Long.class, arguments.toArray());
List<Object> pageArguments = new ArrayList<>(arguments);
pageArguments.add(pageSize);
pageArguments.add((pageNum - 1) * pageSize);
List<DefinitionSummaryView> rows = jdbcTemplate.query(
"SELECT " + DEFINITION_COLUMNS + " FROM dev_schedule_definition d" + where
+ " ORDER BY d.update_time DESC, d.schedule_id DESC LIMIT ? OFFSET ?",
(resultSet, rowNum) -> mapSummary(resultSet), pageArguments.toArray());
return PageResult.build(rows, total == null ? 0 : total);
}
DefinitionDetailView require(Actor actor, long scheduleId) {
StringBuilder sql = new StringBuilder(
"SELECT " + DEFINITION_COLUMNS
+ " FROM dev_schedule_definition d WHERE d.schedule_id=? AND d.org_id=? AND d.del_flag='0'");
List<Object> arguments = new ArrayList<>(List.of(scheduleId, actor.orgId()));
if (!actor.unrestricted()) {
sql.append(" AND d.create_by=?");
arguments.add(actor.actorId());
}
List<DefinitionDetailView> rows = jdbcTemplate.query(
sql.toString(), (resultSet, rowNum) -> mapDetail(resultSet), arguments.toArray());
if (!rows.isEmpty()) {
return rows.getFirst();
}
Integer existing = jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM dev_schedule_definition WHERE schedule_id=? AND del_flag='0'",
Integer.class, scheduleId);
if (existing != null && existing > 0) {
throw SchedulingDomainException.forbidden();
}
throw SchedulingDomainException.notFound();
}
DefinitionDetailView requireReadyDependency(Actor actor, long scheduleId, long ownerScheduleId) {
if (scheduleId == ownerScheduleId) {
throw SchedulingDomainException.validation("调度定义不得依赖自身");
}
DefinitionDetailView target = require(actor, scheduleId);
if (target.summary().status() != DefinitionStatus.READY) {
throw SchedulingDomainException.referenceUnavailable();
}
return target;
}
DefinitionDetailView create(Actor actor, String key, String hash, Definition definition) {
return idempotentDefinition(actor, "CREATE", "new", key, hash, () -> {
long scheduleId = IdGeneratorUtil.nextLongId();
try {
jdbcTemplate.update("""
INSERT INTO dev_schedule_definition(
schedule_id, schedule_name, schedule_description, org_id, project_id,
nodes_json, edges_json, triggers_json, parameters_json, calendar_json, strategy_json,
definition_sha256, definition_status, current_snapshot_id,
create_dept, create_by, create_time, update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'DRAFT', NULL, ?, ?, NOW(), ?, NOW(), '0', 0)
""", scheduleId, definition.name(), definition.description(), actor.orgId(), null,
policy.json(definition.nodes()), policy.json(definition.edges()), policy.json(definition.triggers()),
policy.json(definition.parameters()), policy.json(definition.calendar()), policy.json(definition.strategy()),
policy.requestHash(definition), actor.orgId(), actor.actorId(), actor.actorId());
} catch (DuplicateKeyException exception) {
throw SchedulingDomainException.conflict("当前组织内已存在同名调度定义");
}
return require(actor, scheduleId);
});
}
DefinitionDetailView update(
Actor actor,
long scheduleId,
String key,
String hash,
Definition definition,
long expectedVersion
) {
return idempotentDefinition(actor, "UPDATE", String.valueOf(scheduleId), key, hash, () -> {
DefinitionDetailView current = require(actor, scheduleId);
requireDraft(current);
try {
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_definition
SET schedule_name=?, schedule_description=?, nodes_json=?, edges_json=?, triggers_json=?,
parameters_json=?, calendar_json=?, strategy_json=?, definition_sha256=?,
update_by=?, update_time=NOW(), version=version+1
WHERE schedule_id=? AND org_id=? AND (?=1 OR create_by=?)
AND definition_status='DRAFT' AND version=? AND del_flag='0'
""", definition.name(), definition.description(), policy.json(definition.nodes()),
policy.json(definition.edges()), policy.json(definition.triggers()), policy.json(definition.parameters()),
policy.json(definition.calendar()), policy.json(definition.strategy()), policy.requestHash(definition),
actor.actorId(), scheduleId, actor.orgId(), actor.unrestricted() ? 1 : 0,
actor.actorId(), expectedVersion);
requireChanged(changed);
} catch (DuplicateKeyException exception) {
throw SchedulingDomainException.conflict("当前组织内已存在同名调度定义");
}
return require(actor, scheduleId);
});
}
DefinitionDetailView markReady(
Actor actor,
long scheduleId,
String key,
String hash,
long expectedVersion
) {
return idempotentDefinition(actor, "READY", String.valueOf(scheduleId), key, hash, () -> {
DefinitionDetailView current = require(actor, scheduleId);
requireDraft(current);
long snapshotId = IdGeneratorUtil.nextLongId();
long definitionVersion = expectedVersion + 1;
String snapshotSha = current.definitionSha256();
jdbcTemplate.update("""
INSERT INTO dev_schedule_snapshot(
snapshot_id, schedule_id, definition_version, definition_json, snapshot_sha256,
org_id, project_id, create_dept, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", snapshotId, scheduleId, definitionVersion, policy.json(toDefinition(current)), snapshotSha,
actor.orgId(), null, actor.orgId(), actor.actorId());
insertSnapshotRows(actor, scheduleId, snapshotId, current);
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_definition
SET definition_status='READY', current_snapshot_id=?, update_by=?, update_time=NOW(), version=version+1
WHERE schedule_id=? AND org_id=? AND definition_status='DRAFT' AND version=? AND del_flag='0'
""", snapshotId, actor.actorId(), scheduleId, actor.orgId(), expectedVersion);
requireChanged(changed);
return require(actor, scheduleId);
});
}
List<SnapshotView> snapshots(Actor actor, long scheduleId) {
require(actor, scheduleId);
return jdbcTemplate.query("""
SELECT snapshot_id, schedule_id, definition_version, snapshot_sha256, create_time
FROM dev_schedule_snapshot
WHERE schedule_id=? AND org_id=? AND del_flag='0'
ORDER BY definition_version DESC
""", (resultSet, rowNum) -> new SnapshotView(
resultSet.getLong("snapshot_id"), resultSet.getLong("schedule_id"),
resultSet.getLong("definition_version"), resultSet.getString("snapshot_sha256"),
localDateTime(resultSet.getTimestamp("create_time"))), scheduleId, actor.orgId());
}
Definition snapshotDefinition(Actor actor, long scheduleId, long snapshotId) {
require(actor, scheduleId);
List<String> rows = jdbcTemplate.query("""
SELECT definition_json FROM dev_schedule_snapshot
WHERE snapshot_id=? AND schedule_id=? AND org_id=? AND del_flag='0'
""", (resultSet, rowNum) -> resultSet.getString(1), snapshotId, scheduleId, actor.orgId());
if (rows.isEmpty()) {
throw SchedulingDomainException.conflict("当前调度快照不存在");
}
return policy.read(rows.getFirst(), Definition.class);
}
RunReservation reserveRun(
Actor actor,
DefinitionDetailView definition,
RunAction action,
String key,
String hash,
Long parentRunId,
LocalDate businessDateFrom,
LocalDate businessDateTo,
String failedNodeKey,
String reason,
String impactSummary
) {
return transactionTemplate.execute(status -> {
RunView replay = replayRun(actor, action, key, hash);
if (replay != null) {
return new RunReservation(replay, false);
}
long runId = IdGeneratorUtil.nextLongId();
try {
jdbcTemplate.update("""
INSERT INTO dev_schedule_run_request(
run_id, schedule_id, snapshot_id, parent_run_id, actor_id, org_id, project_id,
action_type, idempotency_key, request_sha256, run_status,
business_date_from, business_date_to, failed_node_key, reason, impact_summary,
create_dept, create_by, create_time, update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'PENDING', ?, ?, ?, ?, ?, ?, ?, NOW(), ?, NOW(), '0', 0)
""", runId, definition.summary().scheduleId(), definition.summary().currentSnapshotId(), parentRunId,
actor.actorId(), actor.orgId(), null, action.name(), key, hash,
businessDateFrom == null ? null : Date.valueOf(businessDateFrom),
businessDateTo == null ? null : Date.valueOf(businessDateTo), failedNodeKey, reason, impactSummary,
actor.orgId(), actor.actorId(), actor.actorId());
} catch (DuplicateKeyException exception) {
RunView concurrentReplay = replayRun(actor, action, key, hash);
if (concurrentReplay != null) {
return new RunReservation(concurrentReplay, false);
}
throw SchedulingDomainException.conflict("执行请求正在处理,请稍后重试");
}
return new RunReservation(requireRun(actor, runId), true);
});
}
RunView requireRun(Actor actor, long runId) {
List<RunView> rows = jdbcTemplate.query(
"SELECT " + RUN_COLUMNS + " FROM dev_schedule_run_request r"
+ " LEFT JOIN dev_schedule_external_mapping m ON m.run_id=r.run_id AND m.del_flag='0'"
+ " WHERE r.run_id=? AND r.org_id=? AND r.del_flag='0'"
+ (actor.unrestricted() ? "" : " AND r.actor_id=?"),
(resultSet, rowNum) -> mapRun(resultSet),
actor.unrestricted() ? new Object[]{runId, actor.orgId()} : new Object[]{runId, actor.orgId(), actor.actorId()});
if (!rows.isEmpty()) {
return rows.getFirst();
}
throw SchedulingDomainException.notFound();
}
List<RunView> runs(Actor actor, long scheduleId) {
require(actor, scheduleId);
return jdbcTemplate.query(
"SELECT " + RUN_COLUMNS + " FROM dev_schedule_run_request r"
+ " LEFT JOIN dev_schedule_external_mapping m ON m.run_id=r.run_id AND m.del_flag='0'"
+ " WHERE r.schedule_id=? AND r.org_id=? AND r.del_flag='0'"
+ (actor.unrestricted() ? "" : " AND r.actor_id=?")
+ " ORDER BY r.create_time DESC, r.run_id DESC",
(resultSet, rowNum) -> mapRun(resultSet),
actor.unrestricted() ? new Object[]{scheduleId, actor.orgId()}
: new Object[]{scheduleId, actor.orgId(), actor.actorId()});
}
void requireFailedNodeEvidence(Actor actor, long runId, String nodeKey, String externalInstanceId) {
if (!notBlank(externalInstanceId)) {
throw SchedulingDomainException.conflict("原运行缺少外部实例证据,禁止节点重跑");
}
Integer count = jdbcTemplate.queryForObject("""
SELECT COUNT(*) FROM dev_schedule_node_execution_evidence
WHERE run_id=? AND org_id=? AND node_key=? AND external_instance_id=?
AND evidence_kind='OBSERVATION' AND normalized_status='FAILED' AND del_flag='0'
""", Integer.class, runId, actor.orgId(), nodeKey, externalInstanceId);
if (count == null || count == 0) {
throw SchedulingDomainException.conflict("指定节点没有同一外部实例的真实失败证据");
}
}
OwnerCallbackReservation reserveOwnerCallback(SchedulingOwnerExecutionService.Command command) {
return transactionTemplate.execute(status -> {
CallbackRun requested = requireCallbackRun(command.requestedRunId());
CallbackRun effective = latestPendingRerun(requested, command.nodeKey());
if (effective == null) {
effective = requested;
}
if (effective.scheduleId() != command.scheduleId() || effective.snapshotId() != command.snapshotId()) {
throw new IllegalArgumentException("固定回调与平台运行快照不匹配");
}
String snapshotSha = jdbcTemplate.queryForObject("""
SELECT snapshot_sha256 FROM dev_schedule_snapshot
WHERE snapshot_id=? AND schedule_id=? AND org_id=? AND del_flag='0'
""", String.class, command.snapshotId(), command.scheduleId(), effective.orgId());
if (!command.snapshotSha256().equals(snapshotSha)) {
throw new IllegalArgumentException("固定回调快照摘要不匹配");
}
NodeMetadata node = requireNodeMetadata(command.snapshotId(), effective.orgId(), command.nodeKey());
if (!node.nodeType().name().equals(command.nodeType()) || node.referenceId() == null
|| node.referenceId() != command.referenceId()) {
throw new IllegalArgumentException("固定回调节点引用不匹配");
}
if (command.businessDate() == null || !effective.allows(command.businessDate())) {
throw new IllegalArgumentException("固定回调业务日期不属于平台请求");
}
List<CallbackEvidence> existing = jdbcTemplate.query("""
SELECT normalized_status, evidence_ref, error_code, error_summary, observed_at
FROM dev_schedule_node_execution_evidence
WHERE run_id=? AND node_key=? AND evidence_kind='CALLBACK' AND business_date=?
AND external_instance_id='' AND external_task_instance_id='' AND del_flag='0'
""", (resultSet, rowNum) -> new CallbackEvidence(
RunStatus.valueOf(resultSet.getString("normalized_status")),
resultSet.getString("evidence_ref"), resultSet.getString("error_code"),
resultSet.getString("error_summary"), localDateTime(resultSet.getTimestamp("observed_at"))),
effective.runId(), command.nodeKey(), Date.valueOf(command.businessDate()));
if (!existing.isEmpty()) {
return new OwnerCallbackReservation(effective, node, command.ownerVersion(), command.ownerSha256(),
command.businessDate(), true, existing.getFirst());
}
jdbcTemplate.update("""
INSERT INTO dev_schedule_node_execution_evidence(
evidence_id, run_id, schedule_id, snapshot_id, evidence_kind, node_key, node_type,
reference_id, owner_version, owner_sha256, business_date, source_status,
normalized_status, observed_at, org_id, create_dept, create_by, create_time, update_by,
update_time, del_flag, version
) VALUES (?, ?, ?, ?, 'CALLBACK', ?, ?, ?, ?, ?, ?, 'CALLBACK_ACCEPTED',
'RUNNING', NOW(6), ?, ?, ?, NOW(), ?, NOW(), '0', 0)
""", IdGeneratorUtil.nextLongId(), effective.runId(), effective.scheduleId(),
effective.snapshotId(), command.nodeKey(), node.nodeType().name(), node.referenceId(),
command.ownerVersion(), command.ownerSha256(), Date.valueOf(command.businessDate()),
effective.orgId(), effective.orgId(), effective.actorId(), effective.actorId());
return new OwnerCallbackReservation(effective, node, command.ownerVersion(), command.ownerSha256(),
command.businessDate(), false, null);
});
}
void completeOwnerCallback(
OwnerCallbackReservation reservation,
RunStatus status,
String evidenceRef,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) {
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_node_execution_evidence
SET source_status=?, normalized_status=?, evidence_ref=?, error_code=?, error_summary=?,
observed_at=?, update_by=?, update_time=NOW(), version=version+1
WHERE run_id=? AND node_key=? AND evidence_kind='CALLBACK' AND business_date=?
AND external_instance_id='' AND external_task_instance_id='' AND del_flag='0'
""", "CALLBACK_" + status.name(), status.name(), truncate(evidenceRef, 512),
truncate(errorCode, 64), truncate(errorSummary, 512), Timestamp.valueOf(observedAt),
reservation.run().actorId(), reservation.run().runId(), reservation.node().nodeKey(),
Date.valueOf(reservation.businessDate()));
requireChanged(changed);
}
RunView applyOutcome(Actor actor, long runId, Outcome outcome) {
RunStatus status = normalizedStatus(outcome);
String sourceStatus = truncate(outcome == null ? null : outcome.sourceStatus(), 64);
String errorCode = truncate(outcome == null ? null : outcome.errorCode(), 64);
String errorSummary = truncate(outcome == null ? null : outcome.errorSummary(), 512);
LocalDateTime observedAt = outcome == null || outcome.observedAt() == null
? LocalDateTime.now() : outcome.observedAt();
transactionTemplate.executeWithoutResult(transactionStatus -> {
requireRun(actor, runId);
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_run_request
SET run_status=?, source_status=?, error_code=?, error_summary=?, last_sync_at=?,
update_by=?, update_time=NOW(), version=version+1
WHERE run_id=? AND org_id=? AND del_flag='0'
""", status.name(), sourceStatus, errorCode, errorSummary, Timestamp.valueOf(observedAt),
actor.actorId(), runId, actor.orgId());
requireChanged(changed);
if (hasExternalEvidence(outcome)) {
jdbcTemplate.update("""
INSERT INTO dev_schedule_external_mapping(
mapping_id, schedule_id, snapshot_id, run_id, external_project_code,
external_definition_code, external_instance_id, source_status, last_sync_at,
org_id, create_by, create_time, update_by, update_time, del_flag, version
) SELECT ?, schedule_id, snapshot_id, run_id, ?, ?, ?, ?, ?, org_id, ?, NOW(), ?, NOW(), '0', 0
FROM dev_schedule_run_request WHERE run_id=? AND org_id=? AND del_flag='0'
ON DUPLICATE KEY UPDATE
external_project_code=VALUES(external_project_code),
external_definition_code=VALUES(external_definition_code),
external_instance_id=VALUES(external_instance_id), source_status=VALUES(source_status),
last_sync_at=VALUES(last_sync_at), update_by=VALUES(update_by),
update_time=NOW(), version=dev_schedule_external_mapping.version+1
""", IdGeneratorUtil.nextLongId(), outcome.externalProjectCode(), outcome.externalDefinitionCode(),
outcome.externalInstanceId(), sourceStatus, Timestamp.valueOf(observedAt), actor.actorId(),
actor.actorId(), runId, actor.orgId());
}
persistOutcomeEvidence(actor, runId, outcome, observedAt);
});
return requireRun(actor, runId);
}
private void persistOutcomeEvidence(Actor actor, long runId, Outcome outcome, LocalDateTime observedAt) {
if (outcome == null) {
return;
}
RunScope scope = runScope(runId, actor.orgId());
List<cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.InstanceEvidence>
instances = outcome.instances() == null ? List.of() : outcome.instances();
for (var instance : instances) {
if (instance == null || !notBlank(instance.externalInstanceId()) || instance.state() == null) {
continue;
}
LocalDate businessDate = instance.businessDate() == null
? scope.defaultBusinessDate(observedAt.toLocalDate()) : instance.businessDate();
RunStatus instanceStatus = stateStatus(instance.state());
LocalDateTime instanceObservedAt = instance.observedAt() == null ? observedAt : instance.observedAt();
jdbcTemplate.update("""
INSERT INTO dev_schedule_external_instance_evidence(
evidence_id, run_id, schedule_id, snapshot_id, external_project_code,
external_definition_code, external_instance_id, business_date, source_status,
normalized_status, evidence_ref, observed_at, org_id, create_dept, create_by, create_time,
update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, NOW(), '0', 0)
ON DUPLICATE KEY UPDATE business_date=VALUES(business_date),
source_status=VALUES(source_status), normalized_status=VALUES(normalized_status),
evidence_ref=VALUES(evidence_ref), observed_at=VALUES(observed_at),
update_by=VALUES(update_by), update_time=NOW(), version=version+1
""", IdGeneratorUtil.nextLongId(), runId, scope.scheduleId(), scope.snapshotId(),
outcome.externalProjectCode(), outcome.externalDefinitionCode(), instance.externalInstanceId(),
Date.valueOf(businessDate), truncate(instance.sourceStatus(), 64), instanceStatus.name(),
truncate(instance.evidenceRef(), 512), Timestamp.valueOf(instanceObservedAt), actor.orgId(), actor.orgId(),
actor.actorId(), actor.actorId());
}
List<cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.NodeEvidence>
nodeEvidence = outcome.nodeEvidence() == null ? List.of() : outcome.nodeEvidence();
for (var item : nodeEvidence) {
if (item == null || !notBlank(item.nodeKey()) || item.state() == null) {
continue;
}
NodeMetadata node = requireNodeMetadata(scope.snapshotId(), actor.orgId(), item.nodeKey());
LocalDate businessDate = item.businessDate() == null
? scope.defaultBusinessDate(observedAt.toLocalDate()) : item.businessDate();
LocalDateTime nodeObservedAt = item.observedAt() == null ? observedAt : item.observedAt();
jdbcTemplate.update("""
INSERT INTO dev_schedule_node_execution_evidence(
evidence_id, run_id, schedule_id, snapshot_id, evidence_kind, node_key, node_type,
reference_id, owner_version, owner_sha256, external_project_code,
external_definition_code, external_instance_id, external_task_code,
external_task_instance_id, business_date, source_status, normalized_status,
evidence_ref, error_code, error_summary, observed_at, org_id, create_dept, create_by, create_time,
update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, 'OBSERVATION', ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, NOW(), '0', 0)
ON DUPLICATE KEY UPDATE source_status=VALUES(source_status),
normalized_status=VALUES(normalized_status), evidence_ref=VALUES(evidence_ref),
error_code=VALUES(error_code), error_summary=VALUES(error_summary),
observed_at=VALUES(observed_at), update_by=VALUES(update_by),
update_time=NOW(), version=version+1
""", IdGeneratorUtil.nextLongId(), runId, scope.scheduleId(), scope.snapshotId(), item.nodeKey(),
node.nodeType().name(), node.referenceId(), nullToEmpty(outcome.externalProjectCode()),
nullToEmpty(outcome.externalDefinitionCode()), nullToEmpty(item.externalInstanceId()),
nullToEmpty(item.externalTaskCode()), nullToEmpty(item.externalTaskInstanceId()),
Date.valueOf(businessDate), truncate(item.sourceStatus(), 64), stateStatus(item.state()).name(),
truncate(item.evidenceRef(), 512), truncate(item.errorCode(), 64),
truncate(item.errorSummary(), 512), Timestamp.valueOf(nodeObservedAt), actor.orgId(),
actor.orgId(), actor.actorId(), actor.actorId());
}
}
private DefinitionDetailView idempotentDefinition(
Actor actor,
String action,
String resourceKey,
String key,
String hash,
Supplier<DefinitionDetailView> operation
) {
return transactionTemplate.execute(status -> {
IdempotencyRow replay = definitionReplay(actor, action, resourceKey, key);
if (replay != null) {
if (!replay.hash().equals(hash)) {
throw SchedulingDomainException.conflict("同一幂等键不能用于不同请求");
}
if (!"COMPLETED".equals(replay.status()) || replay.targetScheduleId() == null) {
throw SchedulingDomainException.conflict("幂等请求正在处理,请稍后重试");
}
return require(actor, replay.targetScheduleId());
}
long idempotencyId = IdGeneratorUtil.nextLongId();
try {
jdbcTemplate.update("""
INSERT INTO dev_schedule_idempotency(
idempotency_id, actor_id, org_id, action_type, resource_key, idempotency_key,
request_sha256, request_status, create_dept, create_by, create_time,
update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, 'IN_PROGRESS', ?, ?, NOW(), ?, NOW(), '0', 0)
""", idempotencyId, actor.actorId(), actor.orgId(), action, resourceKey, key, hash,
actor.orgId(), actor.actorId(), actor.actorId());
} catch (DuplicateKeyException exception) {
throw SchedulingDomainException.conflict("幂等请求正在处理,请稍后重试");
}
DefinitionDetailView result = operation.get();
jdbcTemplate.update("""
UPDATE dev_schedule_idempotency
SET target_schedule_id=?, request_status='COMPLETED', update_by=?, update_time=NOW(), version=version+1
WHERE idempotency_id=? AND request_status='IN_PROGRESS' AND del_flag='0'
""", result.summary().scheduleId(), actor.actorId(), idempotencyId);
return result;
});
}
private IdempotencyRow definitionReplay(Actor actor, String action, String resourceKey, String key) {
List<IdempotencyRow> rows = jdbcTemplate.query("""
SELECT request_sha256, request_status, target_schedule_id
FROM dev_schedule_idempotency
WHERE actor_id=? AND org_id=? AND action_type=? AND resource_key=?
AND idempotency_key=? AND del_flag='0'
""", (resultSet, rowNum) -> new IdempotencyRow(
resultSet.getString(1), resultSet.getString(2), nullableLong(resultSet, 3)),
actor.actorId(), actor.orgId(), action, resourceKey, key);
return rows.isEmpty() ? null : rows.getFirst();
}
private RunView replayRun(Actor actor, RunAction action, String key, String hash) {
List<RunView> rows = jdbcTemplate.query(
"SELECT " + RUN_COLUMNS + " FROM dev_schedule_run_request r"
+ " LEFT JOIN dev_schedule_external_mapping m ON m.run_id=r.run_id AND m.del_flag='0'"
+ " WHERE r.actor_id=? AND r.org_id=? AND r.action_type=? AND r.idempotency_key=? AND r.del_flag='0'",
(resultSet, rowNum) -> {
String existingHash = resultSet.getString("request_sha256");
if (!hash.equals(existingHash)) {
throw SchedulingDomainException.conflict("同一幂等键不能用于不同请求");
}
return mapRun(resultSet);
}, actor.actorId(), actor.orgId(), action.name(), key);
return rows.isEmpty() ? null : rows.getFirst();
}
private void insertSnapshotRows(Actor actor, long scheduleId, long snapshotId, DefinitionDetailView current) {
current.nodes().forEach(node -> jdbcTemplate.update("""
INSERT INTO dev_schedule_node(
node_id, snapshot_id, schedule_id, node_key, node_name, node_type,
reference_id, condition_json, dependency_json, org_id, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", IdGeneratorUtil.nextLongId(), snapshotId, scheduleId, node.nodeKey(), node.name(), node.type().name(),
node.referenceId(), node.condition() == null ? null : policy.json(node.condition()),
node.dependency() == null ? null : policy.json(node.dependency()), actor.orgId(), actor.actorId()));
current.edges().forEach(edge -> jdbcTemplate.update("""
INSERT INTO dev_schedule_edge(
edge_id, snapshot_id, schedule_id, edge_key, source_node_key, target_node_key,
branch_outcome, org_id, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", IdGeneratorUtil.nextLongId(), snapshotId, scheduleId, edge.edgeKey(), edge.sourceNodeKey(),
edge.targetNodeKey(), edge.branchOutcome().name(), actor.orgId(), actor.actorId()));
current.triggers().forEach(trigger -> jdbcTemplate.update("""
INSERT INTO dev_schedule_trigger(
trigger_id, snapshot_id, schedule_id, trigger_type, trigger_json,
org_id, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", IdGeneratorUtil.nextLongId(), snapshotId, scheduleId, trigger.type().name(), policy.json(trigger),
actor.orgId(), actor.actorId()));
}
private DefinitionSummaryView mapSummary(ResultSet resultSet) throws SQLException {
return new DefinitionSummaryView(
resultSet.getLong("schedule_id"), resultSet.getString("schedule_name"),
resultSet.getLong("org_id"),
DefinitionStatus.valueOf(resultSet.getString("definition_status")), resultSet.getLong("version"),
nullableLong(resultSet, "current_snapshot_id"), localDateTime(resultSet.getTimestamp("create_time")),
localDateTime(resultSet.getTimestamp("update_time")));
}
private DefinitionDetailView mapDetail(ResultSet resultSet) throws SQLException {
return new DefinitionDetailView(mapSummary(resultSet), resultSet.getString("schedule_description"),
policy.read(resultSet.getString("nodes_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition[].class) == null
? List.of() : List.of(policy.read(resultSet.getString("nodes_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition[].class)),
List.of(policy.read(resultSet.getString("edges_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.EdgeDefinition[].class)),
List.of(policy.read(resultSet.getString("triggers_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.TriggerDefinition[].class)),
List.of(policy.read(resultSet.getString("parameters_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterDefinition[].class)),
policy.read(resultSet.getString("calendar_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.CalendarDefinition.class),
policy.read(resultSet.getString("strategy_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyDefinition.class),
resultSet.getString("definition_sha256"));
}
private RunView mapRun(ResultSet resultSet) throws SQLException {
long runId = resultSet.getLong("run_id");
long orgId = resultSet.getLong("org_id");
return new RunView(resultSet.getLong("run_id"), resultSet.getLong("schedule_id"),
resultSet.getLong("snapshot_id"), nullableLong(resultSet, "parent_run_id"),
RunAction.valueOf(resultSet.getString("action_type")), RunStatus.valueOf(resultSet.getString("run_status")),
localDate(resultSet.getDate("business_date_from")), localDate(resultSet.getDate("business_date_to")),
resultSet.getString("failed_node_key"), resultSet.getString("external_project_code"),
resultSet.getString("external_definition_code"), resultSet.getString("external_instance_id"),
resultSet.getString("source_status"), resultSet.getString("error_summary"),
externalInstances(runId, orgId), nodeEvidence(runId, orgId),
localDateTime(resultSet.getTimestamp("last_sync_at")), localDateTime(resultSet.getTimestamp("create_time")),
localDateTime(resultSet.getTimestamp("update_time")));
}
private List<ExternalInstanceView> externalInstances(long runId, long orgId) {
return jdbcTemplate.query("""
SELECT external_instance_id, business_date, source_status, normalized_status,
evidence_ref, observed_at
FROM dev_schedule_external_instance_evidence
WHERE run_id=? AND org_id=? AND del_flag='0'
ORDER BY business_date, external_instance_id
""", (resultSet, rowNum) -> new ExternalInstanceView(
resultSet.getString("external_instance_id"), localDate(resultSet.getDate("business_date")),
resultSet.getString("source_status"), RunStatus.valueOf(resultSet.getString("normalized_status")),
resultSet.getString("evidence_ref"), localDateTime(resultSet.getTimestamp("observed_at"))),
runId, orgId);
}
private List<NodeEvidenceView> nodeEvidence(long runId, long orgId) {
return jdbcTemplate.query("""
SELECT node_key, node_type, reference_id, external_task_code, external_task_instance_id,
business_date, source_status, normalized_status, evidence_ref, error_code,
error_summary, observed_at
FROM dev_schedule_node_execution_evidence
WHERE run_id=? AND org_id=? AND del_flag='0'
ORDER BY business_date, node_key, evidence_kind, observed_at
""", (resultSet, rowNum) -> new NodeEvidenceView(
resultSet.getString("node_key"), NodeType.valueOf(resultSet.getString("node_type")),
nullableLong(resultSet, "reference_id"), resultSet.getString("external_task_code"),
resultSet.getString("external_task_instance_id"), localDate(resultSet.getDate("business_date")),
resultSet.getString("source_status"), RunStatus.valueOf(resultSet.getString("normalized_status")),
resultSet.getString("evidence_ref"), resultSet.getString("error_code"),
resultSet.getString("error_summary"), localDateTime(resultSet.getTimestamp("observed_at"))),
runId, orgId);
}
private Definition toDefinition(DefinitionDetailView view) {
return new Definition(view.summary().name(), view.description(), view.nodes(),
view.edges(), view.triggers(), view.parameters(), view.calendar(), view.strategy());
}
private static RunStatus normalizedStatus(Outcome outcome) {
if (outcome == null || outcome.state() == null) {
return RunStatus.UNKNOWN;
}
if ((outcome.state() == State.SUBMITTED || outcome.state() == State.RUNNING
|| outcome.state() == State.SUCCEEDED) && !hasExternalEvidence(outcome)) {
return RunStatus.UNKNOWN;
}
return switch (outcome.state()) {
case SUBMITTED -> RunStatus.SUBMITTED;
case RUNNING -> RunStatus.RUNNING;
case SUCCEEDED -> RunStatus.SUCCEEDED;
case FAILED, UNSUPPORTED -> RunStatus.FAILED;
case CANCELED -> RunStatus.CANCELED;
case UNKNOWN -> RunStatus.UNKNOWN;
};
}
private static RunStatus stateStatus(State state) {
if (state == null) {
return RunStatus.UNKNOWN;
}
return switch (state) {
case SUBMITTED -> RunStatus.SUBMITTED;
case RUNNING -> RunStatus.RUNNING;
case SUCCEEDED -> RunStatus.SUCCEEDED;
case FAILED, UNSUPPORTED -> RunStatus.FAILED;
case CANCELED -> RunStatus.CANCELED;
case UNKNOWN -> RunStatus.UNKNOWN;
};
}
private RunScope runScope(long runId, long orgId) {
List<RunScope> rows = jdbcTemplate.query("""
SELECT schedule_id, snapshot_id, business_date_from, business_date_to
FROM dev_schedule_run_request WHERE run_id=? AND org_id=? AND del_flag='0'
""", (resultSet, rowNum) -> new RunScope(
resultSet.getLong("schedule_id"), resultSet.getLong("snapshot_id"),
localDate(resultSet.getDate("business_date_from")),
localDate(resultSet.getDate("business_date_to"))), runId, orgId);
if (rows.isEmpty()) {
throw SchedulingDomainException.notFound();
}
return rows.getFirst();
}
private NodeMetadata requireNodeMetadata(long snapshotId, long orgId, String nodeKey) {
List<NodeMetadata> rows = jdbcTemplate.query("""
SELECT node_key, node_type, reference_id FROM dev_schedule_node
WHERE snapshot_id=? AND org_id=? AND node_key=? AND del_flag='0'
""", (resultSet, rowNum) -> new NodeMetadata(resultSet.getString("node_key"),
NodeType.valueOf(resultSet.getString("node_type")), nullableLong(resultSet, "reference_id")),
snapshotId, orgId, nodeKey);
if (rows.isEmpty()) {
throw new IllegalArgumentException("节点不属于不可变调度快照");
}
return rows.getFirst();
}
private CallbackRun requireCallbackRun(long runId) {
List<CallbackRun> rows = jdbcTemplate.query("""
SELECT run_id, actor_id, org_id, schedule_id, snapshot_id, action_type,
business_date_from, business_date_to, create_time
FROM dev_schedule_run_request WHERE run_id=? AND del_flag='0'
""", (resultSet, rowNum) -> callbackRun(resultSet), runId);
if (rows.isEmpty()) {
throw new IllegalArgumentException("固定回调平台运行不存在");
}
return rows.getFirst();
}
private CallbackRun latestPendingRerun(CallbackRun parent, String nodeKey) {
List<CallbackRun> rows = jdbcTemplate.query("""
SELECT run_id, actor_id, org_id, schedule_id, snapshot_id, action_type,
business_date_from, business_date_to, create_time
FROM dev_schedule_run_request
WHERE parent_run_id=? AND org_id=? AND schedule_id=? AND snapshot_id=?
AND action_type='RERUN' AND failed_node_key=?
AND run_status IN ('PENDING', 'SUBMITTED', 'RUNNING', 'UNKNOWN') AND del_flag='0'
ORDER BY create_time DESC, run_id DESC LIMIT 1
""", (resultSet, rowNum) -> callbackRun(resultSet), parent.runId(), parent.orgId(),
parent.scheduleId(), parent.snapshotId(), nodeKey);
return rows.isEmpty() ? null : rows.getFirst();
}
private static CallbackRun callbackRun(ResultSet resultSet) throws SQLException {
return new CallbackRun(resultSet.getLong("run_id"), resultSet.getLong("actor_id"),
resultSet.getLong("org_id"), resultSet.getLong("schedule_id"), resultSet.getLong("snapshot_id"),
RunAction.valueOf(resultSet.getString("action_type")),
localDate(resultSet.getDate("business_date_from")),
localDate(resultSet.getDate("business_date_to")),
localDateTime(resultSet.getTimestamp("create_time")));
}
private static boolean hasExternalEvidence(Outcome outcome) {
return outcome != null && notBlank(outcome.externalProjectCode())
&& notBlank(outcome.externalDefinitionCode()) && notBlank(outcome.externalInstanceId())
&& outcome.observedAt() != null;
}
private static void requireDraft(DefinitionDetailView definition) {
if (definition.summary().status() != DefinitionStatus.DRAFT) {
throw SchedulingDomainException.conflict("只有DRAFT调度定义可编辑或转为READY");
}
}
private static void requireChanged(int changed) {
if (changed != 1) {
throw SchedulingDomainException.conflict("调度版本已变化,请刷新后重试");
}
}
private static String escapeLike(String value) {
return value.replace("=", "==").replace("%", "=%").replace("_", "=_");
}
private static boolean notBlank(String value) {
return value != null && !value.isBlank();
}
private static String truncate(String value, int maximum) {
if (value == null) {
return null;
}
return value.length() <= maximum ? value : value.substring(0, maximum);
}
private static String nullToEmpty(String value) {
return value == null ? "" : value;
}
private static Long nullableLong(ResultSet resultSet, String column) throws SQLException {
long value = resultSet.getLong(column);
return resultSet.wasNull() ? null : value;
}
private static Long nullableLong(ResultSet resultSet, int column) throws SQLException {
long value = resultSet.getLong(column);
return resultSet.wasNull() ? null : value;
}
private static LocalDateTime localDateTime(Timestamp value) {
return value == null ? null : value.toLocalDateTime();
}
private static LocalDate localDate(Date value) {
return value == null ? null : value.toLocalDate();
}
private record IdempotencyRow(String hash, String status, Long targetScheduleId) {
}
private record RunScope(long scheduleId, long snapshotId, LocalDate businessDateFrom, LocalDate businessDateTo) {
LocalDate defaultBusinessDate(LocalDate fallback) {
return businessDateFrom == null ? fallback : businessDateFrom;
}
}
record NodeMetadata(String nodeKey, NodeType nodeType, Long referenceId) {
}
record CallbackRun(
long runId,
long actorId,
long orgId,
long scheduleId,
long snapshotId,
RunAction action,
LocalDate businessDateFrom,
LocalDate businessDateTo,
LocalDateTime createdAt
) {
boolean allows(LocalDate value) {
if (action != RunAction.BACKFILL) {
return true;
}
return businessDateFrom != null && businessDateTo != null
&& !value.isBefore(businessDateFrom) && !value.isAfter(businessDateTo);
}
}
record CallbackEvidence(
RunStatus status,
String evidenceRef,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) {
}
record OwnerCallbackReservation(
CallbackRun run,
NodeMetadata node,
String ownerVersion,
String ownerSha256,
LocalDate businessDate,
boolean replayed,
CallbackEvidence existing
) {
}
record RunReservation(RunView run, boolean newRequest) {
}
}
@@ -0,0 +1,412 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.BackfillRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionCreateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionDetailView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionSummaryView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DependencyDefinition;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeType;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterCalendarUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RerunRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunAction;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SnapshotView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SubmitRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StopRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ValidationView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.VersionRequest;
import cn.aixunkeji.datagov.dataops.batchjob.BatchJobSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.dataops.codedevelopment.CodeDevelopmentSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingActorProvider.Actor;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingJdbcRepository.RunReservation;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingModel.Definition;
import cn.aixunkeji.datagov.dataops.transformationcleaning.TransformationCleaningSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.dataops.qualityrule.QualityRuleSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.CancelCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.BackfillCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Condition;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.DefinitionSnapshot;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Dependency;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Edge;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.InstanceTarget;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Node;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.RerunCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.StatusCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.SubmissionCommand;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
@Service
@RequiredArgsConstructor
class SchedulingService {
private final SchedulingActorProvider actorProvider;
private final SchedulingPolicy policy;
private final SchedulingJdbcRepository repository;
private final BatchJobSchedulingReferenceDirectory batchJobDirectory;
private final CodeDevelopmentSchedulingReferenceDirectory codeDirectory;
private final TransformationCleaningSchedulingReferenceDirectory transformationDirectory;
private final QualityRuleSchedulingReferenceDirectory qualityRuleDirectory;
private final SchedulingIntegrationGateway integrationGateway;
PageResult<DefinitionSummaryView> list(
String keyword,
String status,
Integer pageNum,
Integer pageSize
) {
Actor actor = actorProvider.current();
return repository.page(actor, policy.keyword(keyword), policy.queryStatus(status),
policy.pageNum(pageNum), policy.pageSize(pageSize));
}
DefinitionDetailView get(long scheduleId) {
return repository.require(actorProvider.current(), positiveId(scheduleId, "调度ID"));
}
DefinitionDetailView create(String idempotencyKey, DefinitionCreateRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
Definition definition = policy.create(request);
validateReferences(actor, definition, 0L);
return repository.create(actor, idempotencyKey, policy.requestHash(request), definition);
}
DefinitionDetailView update(long scheduleId, String idempotencyKey, DefinitionUpdateRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
long normalizedScheduleId = positiveId(scheduleId, "调度ID");
DefinitionDetailView current = repository.require(actor, normalizedScheduleId);
Definition proposed = policy.update(request);
Definition definition = new Definition(proposed.name(), proposed.description(),
proposed.nodes(), proposed.edges(), proposed.triggers(), proposed.parameters(), proposed.calendar(),
proposed.strategy());
validateReferences(actor, definition, normalizedScheduleId);
return repository.update(actor, normalizedScheduleId, idempotencyKey, policy.requestHash(request), definition,
policy.version(request.version()));
}
DefinitionDetailView updateParameters(
long scheduleId,
String idempotencyKey,
ParameterCalendarUpdateRequest request
) {
if (request == null) {
throw SchedulingDomainException.validation("参数与日历请求不能为空");
}
Actor actor = actorProvider.current();
DefinitionDetailView current = repository.require(actor, positiveId(scheduleId, "调度ID"));
return updateFromCurrent(actor, current, idempotencyKey, request,
current.nodes(), current.edges(), current.triggers(), request.parameters(), request.calendar(),
current.strategy(), request.version());
}
DefinitionDetailView updateStrategy(long scheduleId, String idempotencyKey, StrategyUpdateRequest request) {
if (request == null) {
throw SchedulingDomainException.validation("调度策略请求不能为空");
}
Actor actor = actorProvider.current();
DefinitionDetailView current = repository.require(actor, positiveId(scheduleId, "调度ID"));
return updateFromCurrent(actor, current, idempotencyKey, request,
current.nodes(), current.edges(), current.triggers(), current.parameters(), current.calendar(),
request.strategy(), request.version());
}
ValidationView validate(long scheduleId) {
Actor actor = actorProvider.current();
DefinitionDetailView current = repository.require(actor, positiveId(scheduleId, "调度ID"));
Definition definition = toDefinition(current);
validateReferences(actor, definition, scheduleId);
return policy.validationView(definition);
}
DefinitionDetailView ready(long scheduleId, String idempotencyKey, VersionRequest request) {
if (request == null) {
throw SchedulingDomainException.validation("就绪请求不能为空");
}
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
long normalizedScheduleId = positiveId(scheduleId, "调度ID");
DefinitionDetailView current = repository.require(actor, normalizedScheduleId);
validateReferences(actor, toDefinition(current), normalizedScheduleId);
return repository.markReady(actor, normalizedScheduleId, idempotencyKey, policy.requestHash(request),
policy.version(request.version()));
}
List<SnapshotView> snapshots(long scheduleId) {
return repository.snapshots(actorProvider.current(), positiveId(scheduleId, "调度ID"));
}
List<RunView> runs(long scheduleId) {
return repository.runs(actorProvider.current(), positiveId(scheduleId, "调度ID"));
}
RunView submit(long scheduleId, String idempotencyKey, SubmitRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
SubmitRequest normalized = policy.submit(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
String requestHash = policy.requestHash(normalized);
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.SUBMIT, idempotencyKey,
requestHash, null, null, null, null, normalized.reason(), null);
if (!reservation.newRequest()) {
return reservation.run();
}
DefinitionSnapshot snapshot = integrationSnapshot(actor, definition);
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.submit(
new SubmissionCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, snapshot)));
}
RunView backfill(long scheduleId, String idempotencyKey, BackfillRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
BackfillRequest normalized = policy.backfill(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
String requestHash = policy.requestHash(normalized);
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.BACKFILL, idempotencyKey,
requestHash, null, normalized.businessDateFrom(), normalized.businessDateTo(), null,
normalized.reason(), normalized.impactSummary());
if (!reservation.newRequest()) {
return reservation.run();
}
DefinitionSnapshot snapshot = integrationSnapshot(actor, definition);
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.backfill(
new BackfillCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, snapshot, normalized.businessDateFrom(), normalized.businessDateTo())));
}
RunView rerun(long scheduleId, String idempotencyKey, RerunRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
RerunRequest normalized = policy.rerun(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
RunView parent = repository.requireRun(actor, normalized.parentRunId());
if (!parent.scheduleId().equals(definition.summary().scheduleId()) || parent.status() != RunStatus.FAILED) {
throw SchedulingDomainException.conflict("只能重跑当前调度下已有真实失败证据的FAILED运行");
}
if (!parent.snapshotId().equals(definition.summary().currentSnapshotId())) {
throw SchedulingDomainException.conflict("原运行不是当前READY快照,禁止重跑");
}
NodeDefinition failedNode = definition.nodes().stream()
.filter(node -> node.nodeKey().equals(normalized.failedNodeKey()))
.findFirst().orElse(null);
if (failedNode == null || !ownerNode(failedNode.type())) {
throw SchedulingDomainException.validation("失败节点不属于当前READY快照");
}
repository.requireFailedNodeEvidence(actor, parent.runId(), normalized.failedNodeKey(),
parent.externalInstanceId());
String requestHash = policy.requestHash(normalized);
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.RERUN, idempotencyKey,
requestHash, parent.runId(), null, null, normalized.failedNodeKey(), normalized.reason(), null);
if (!reservation.newRequest()) {
return reservation.run();
}
DefinitionSnapshot snapshot = integrationSnapshot(actor, definition);
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.rerun(
new RerunCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, snapshot, parent.externalInstanceId(), normalized.failedNodeKey())));
}
RunView stop(long scheduleId, String idempotencyKey, StopRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
StopRequest normalized = policy.stop(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
RunView parent = repository.requireRun(actor, normalized.parentRunId());
if (!parent.scheduleId().equals(definition.summary().scheduleId())
|| (parent.status() != RunStatus.SUBMITTED && parent.status() != RunStatus.RUNNING)) {
throw SchedulingDomainException.conflict("只能停止当前调度下SUBMITTED或RUNNING运行");
}
if (parent.externalProjectCode() == null || parent.externalDefinitionCode() == null
|| parent.externalInstanceId() == null) {
throw SchedulingDomainException.conflict("活动运行缺少外部稳定ID,禁止伪造停止成功");
}
String requestHash = policy.requestHash(normalized);
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.STOP, idempotencyKey,
requestHash, parent.runId(), null, null, null, normalized.reason(), null);
if (!reservation.newRequest()) return reservation.run();
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.cancel(
new CancelCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, parent.externalProjectCode(), parent.externalDefinitionCode(),
parent.externalInstanceId())));
}
RunView syncStatus(long runId) {
Actor actor = actorProvider.current();
RunView run = repository.requireRun(actor, positiveId(runId, "运行ID"));
return repository.applyOutcome(actor, run.runId(), integrationGateway.status(new StatusCommand(
run.runId(), actor.orgId(),
run.externalProjectCode(), run.externalDefinitionCode(), run.externalInstanceId(),
run.externalInstances().stream().map(instance -> new InstanceTarget(
instance.externalInstanceId(), instance.businessDate())).toList())));
}
private DefinitionDetailView updateFromCurrent(
Actor actor,
DefinitionDetailView current,
String idempotencyKey,
Object request,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition> nodes,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.EdgeDefinition> edges,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.TriggerDefinition> triggers,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterDefinition> parameters,
cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.CalendarDefinition calendar,
cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyDefinition strategy,
Long version
) {
policy.idempotencyKey(idempotencyKey);
DefinitionUpdateRequest combined = new DefinitionUpdateRequest(current.summary().name(), current.description(),
nodes, edges, triggers, parameters, calendar, strategy, version);
Definition proposed = policy.update(combined);
Definition definition = new Definition(proposed.name(), proposed.description(),
proposed.nodes(), proposed.edges(), proposed.triggers(), proposed.parameters(), proposed.calendar(),
proposed.strategy());
validateReferences(actor, definition, current.summary().scheduleId());
return repository.update(actor, current.summary().scheduleId(), idempotencyKey, policy.requestHash(request),
definition, policy.version(version));
}
private DefinitionDetailView requireReady(Actor actor, long scheduleId, long version) {
DefinitionDetailView definition = repository.require(actor, positiveId(scheduleId, "调度ID"));
if (definition.summary().status() != DefinitionStatus.READY
|| definition.summary().currentSnapshotId() == null) {
throw SchedulingDomainException.conflict("只有READY调度定义可以提交执行");
}
if (definition.summary().version() != version) {
throw SchedulingDomainException.conflict("调度版本已变化,请刷新后重试");
}
return definition;
}
private DefinitionSnapshot integrationSnapshot(Actor actor, DefinitionDetailView definition) {
long snapshotId = definition.summary().currentSnapshotId();
Definition snapshot = repository.snapshotDefinition(actor, definition.summary().scheduleId(), snapshotId);
List<Node> nodes = snapshot.nodes().stream()
.map(node -> integrationNode(actor, definition.summary().scheduleId(), node))
.toList();
List<Edge> edges = snapshot.edges().stream()
.map(edge -> new Edge(edge.sourceNodeKey(), edge.targetNodeKey(), edge.branchOutcome().name())).toList();
String triggerType = snapshot.triggers().isEmpty() ? "API" : snapshot.triggers().getFirst().type().name();
return new DefinitionSnapshot(definition.summary().scheduleId(), snapshotId, definition.definitionSha256(),
nodes, edges, triggerType, snapshot.calendar().timeZone());
}
private Node integrationNode(Actor actor, long ownerScheduleId, NodeDefinition node) {
if (node.type() == NodeType.BATCH_JOB) {
var resolution = batchJobDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId());
requireOwnerResolution(resolution.state().name());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.CODE_OBJECT) {
var resolution = codeDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId());
requireOwnerResolution(resolution.state().name());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.TRANSFORMATION) {
var resolution = transformationDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId());
requireOwnerResolution(resolution.state().name());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.QUALITY_RULE) {
var resolution = qualityRuleDirectory.resolve(actor.actorId(), actor.orgId(), actor.orgId(),
node.referenceId());
requireOwnerResolution(resolution.state());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.CONDITION) {
var value = node.condition();
return new Node(node.nodeKey(), node.type().name(), null, null, null,
new Condition(value.field().name(), value.operator().name(), value.values()), null);
}
DefinitionDetailView target = repository.requireReadyDependency(
actor, node.dependency().scheduleId(), ownerScheduleId);
return new Node(node.nodeKey(), node.type().name(), null, null, null, null,
new Dependency(target.summary().scheduleId(), target.summary().currentSnapshotId(),
target.definitionSha256(), node.dependency().businessDateOffsetDays()));
}
private static Node ownerIntegrationNode(NodeDefinition node, String ownerVersion, String ownerSha256) {
if (ownerVersion == null || ownerVersion.isBlank() || ownerSha256 == null
|| !ownerSha256.matches("[0-9a-f]{64}")) {
throw SchedulingDomainException.referenceUnavailable();
}
return new Node(node.nodeKey(), node.type().name(), node.referenceId(), ownerVersion, ownerSha256,
null, null);
}
private void validateReferences(Actor actor, Definition definition, long ownerScheduleId) {
for (NodeDefinition node : definition.nodes()) {
if (node.type() == NodeType.BATCH_JOB) {
String state = batchJobDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId()).state().name();
requireOwnerResolution(state);
} else if (node.type() == NodeType.CODE_OBJECT) {
String state = codeDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId()).state().name();
requireOwnerResolution(state);
} else if (node.type() == NodeType.TRANSFORMATION) {
String state = transformationDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId()).state().name();
requireOwnerResolution(state);
} else if (node.type() == NodeType.QUALITY_RULE) {
String state = qualityRuleDirectory.resolve(actor.actorId(), actor.orgId(), actor.orgId(),
node.referenceId()).state();
requireOwnerResolution(state);
} else if (node.type() == NodeType.DEPENDENT) {
validateDependency(actor, ownerScheduleId, node.dependency());
}
}
definition.triggers().stream().filter(trigger -> trigger.dependency() != null)
.forEach(trigger -> validateDependency(actor, ownerScheduleId, trigger.dependency()));
}
private void validateDependency(Actor actor, long ownerScheduleId, DependencyDefinition dependency) {
if (dependency.scheduleId() == ownerScheduleId) {
throw SchedulingDomainException.validation("调度定义不得依赖自身");
}
try {
repository.requireReadyDependency(actor, dependency.scheduleId(), ownerScheduleId);
} catch (SchedulingDomainException exception) {
throw SchedulingDomainException.referenceUnavailable();
}
}
private static void requireOwnerResolution(String state) {
if ("NOT_EXECUTABLE".equals(state)) {
throw SchedulingDomainException.validation("引用任务尚未处于可执行状态");
}
if (!"AUTHORIZED".equals(state)) {
throw SchedulingDomainException.referenceUnavailable();
}
}
private static boolean ownerNode(NodeType type) {
return type == NodeType.BATCH_JOB || type == NodeType.CODE_OBJECT || type == NodeType.TRANSFORMATION
|| type == NodeType.QUALITY_RULE;
}
private static Definition toDefinition(DefinitionDetailView view) {
return new Definition(view.summary().name(), view.description(), view.nodes(),
view.edges(), view.triggers(), view.parameters(), view.calendar(), view.strategy());
}
private static long positiveId(long value, String label) {
if (value <= 0) {
throw SchedulingDomainException.validation(label + "无效");
}
return value;
}
}
@@ -0,0 +1,775 @@
package cn.aixunkeji.datagov.integration.scheduling;
import cn.aixunkeji.common.json.utils.JsonUtils;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService;
import cn.aixunkeji.datagov.integration.m2.M2IntegrationProperties;
import cn.aixunkeji.datagov.integration.m2.M2SecretReader;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.http.HttpHeaders;
import org.springframework.http.client.JdkClientHttpRequestFactory;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClient;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.node.ArrayNode;
import tools.jackson.databind.node.ObjectNode;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
/** D-024 DolphinScheduler 3.4.2 adapter using only server-generated definitions and callbacks. */
@DubboService(timeout = 120_000, retries = 0)
@RequiredArgsConstructor
public class DolphinSchedulerSchedulingAdapter implements SchedulingIntegrationService {
private static final Pattern KEY = Pattern.compile("[A-Za-z][A-Za-z0-9_.:-]{0,63}");
private static final Pattern SHA = Pattern.compile("[0-9a-f]{64}");
private static final Set<String> OWNER_TYPES = Set.of(
"BATCH_JOB", "CODE_OBJECT", "TRANSFORMATION", "QUALITY_RULE", "METRIC_CALCULATION");
private static final DateTimeFormatter SCHEDULE_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00");
private static final String CALLBACK_CONFIG = "/run/secrets/aixun-datagov/m2/ds-callback-curl.conf";
private final M2IntegrationProperties properties;
private final M2SecretReader secrets;
@Override
public Outcome submit(SubmissionCommand command) {
try {
validate(command == null ? null : command.snapshot());
RestClient client = client();
long projectCode = projectCode(client);
String definitionCode = ensureDefinition(client, projectCode, command.snapshot());
LocalDate businessDate = LocalDate.now();
List<InstanceEvidence> instances = start(client, projectCode, definitionCode,
command.requestId(), businessDate, false);
return submitted(projectCode, definitionCode, instances);
} catch (ContractViolation exception) {
return Outcome.unsupported(exception.code, exception.getMessage());
} catch (RuntimeException | LinkageError exception) {
return Outcome.unknown("UNKNOWN", "DS_SUBMIT_UNAVAILABLE", "DolphinScheduler提交结果暂不可确认");
}
}
@Override
public Outcome backfill(BackfillCommand command) {
try {
validate(command == null ? null : command.snapshot());
if (command.businessDateFrom() == null || command.businessDateTo() == null
|| command.businessDateFrom().isAfter(command.businessDateTo())
|| command.businessDateFrom().plusDays(30).isBefore(command.businessDateTo())) {
throw contract("DS_BACKFILL_RANGE_INVALID", "单次补数日期范围必须为1到31天");
}
RestClient client = client();
long projectCode = projectCode(client);
String definitionCode = ensureDefinition(client, projectCode, command.snapshot());
List<InstanceEvidence> instances = new ArrayList<>();
for (LocalDate date = command.businessDateFrom(); !date.isAfter(command.businessDateTo());
date = date.plusDays(1)) {
instances.addAll(start(client, projectCode, definitionCode, command.requestId(), date, true));
}
return submitted(projectCode, definitionCode, instances);
} catch (ContractViolation exception) {
return Outcome.unsupported(exception.code, exception.getMessage());
} catch (RuntimeException | LinkageError exception) {
return Outcome.unknown("UNKNOWN", "DS_BACKFILL_UNAVAILABLE", "DolphinScheduler补数结果暂不可确认");
}
}
@Override
public Outcome rerun(RerunCommand command) {
try {
validate(command == null ? null : command.snapshot());
if (command == null || blank(command.parentExternalInstanceId()) || blank(command.failedNodeKey())
|| !KEY.matcher(command.failedNodeKey()).matches()) {
throw contract("DS_RERUN_EVIDENCE_INVALID", "节点重跑缺少原实例或失败节点证据");
}
RestClient client = client();
long projectCode = projectCode(client);
String expectedDefinition = findDefinition(client, projectCode, workflowName(command.snapshot()));
if (expectedDefinition == null) {
throw contract("DS_RERUN_DEFINITION_MISSING", "当前不可变快照没有已登记的外部流程定义");
}
JsonNode instance = get(client, "/projects/" + projectCode + "/workflow-instances/"
+ command.parentExternalInstanceId(), "DolphinScheduler原实例回读失败").path("data");
if (!expectedDefinition.equals(instance.path("workflowDefinitionCode").asText())) {
throw contract("DS_RERUN_SNAPSHOT_MISMATCH", "原实例不属于当前不可变快照");
}
JsonNode task = failedTask(client, projectCode, command.parentExternalInstanceId(),
command.failedNodeKey());
String taskCode = rerunStartNode(task.path("taskCode").asText());
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
form.add("workflowInstanceId", command.parentExternalInstanceId());
form.add("startNodeList", taskCode);
form.add("taskDependType", "TASK_ONLY");
postForm(client, "/projects/" + projectCode + "/executors/execute-task", form,
"DolphinScheduler失败节点重跑提交失败");
LocalDateTime now = LocalDateTime.now();
NodeEvidence evidence = new NodeEvidence(command.failedNodeKey(), null, null,
command.parentExternalInstanceId(), taskCode, task.path("id").asText(),
LocalDate.now(), "RERUN_ACCEPTED", State.SUBMITTED,
taskEvidence(projectCode, command.parentExternalInstanceId(), task.path("id").asText()),
null, null, now);
InstanceEvidence instanceEvidence = new InstanceEvidence(command.parentExternalInstanceId(),
LocalDate.now(), "RERUN_ACCEPTED", State.SUBMITTED,
instanceEvidence(projectCode, command.parentExternalInstanceId()), now);
return new Outcome(State.SUBMITTED, String.valueOf(projectCode), expectedDefinition,
command.parentExternalInstanceId(), "RERUN_ACCEPTED", null, null, now,
List.of(evidence), List.of(instanceEvidence));
} catch (ContractViolation exception) {
return Outcome.unsupported(exception.code, exception.getMessage());
} catch (RuntimeException | LinkageError exception) {
return Outcome.unknown("UNKNOWN", "DS_RERUN_UNAVAILABLE", "DolphinScheduler节点重跑结果暂不可确认");
}
}
@Override
public Outcome cancel(CancelCommand command) {
if (command == null || blank(command.externalProjectCode()) || blank(command.externalDefinitionCode())
|| blank(command.externalInstanceId())) {
return Outcome.unknown("UNKNOWN", "DS_CANCEL_EVIDENCE_MISSING", "缺少外部稳定ID,无法停止运行");
}
try {
long projectCode = Long.parseLong(command.externalProjectCode());
RestClient client = client();
JsonNode instance = get(client, "/projects/" + projectCode + "/workflow-instances/"
+ command.externalInstanceId(), "DolphinScheduler停止前实例回读失败").path("data");
if (!command.externalDefinitionCode().equals(instance.path("workflowDefinitionCode").asText())) {
throw contract("DS_CANCEL_SNAPSHOT_MISMATCH", "外部实例不属于当前不可变调度定义");
}
String current = instance.path("state").asText("UNKNOWN");
if (!Set.of("SUBMITTED_SUCCESS", "RUNNING_EXECUTION", "READY_PAUSE", "READY_STOP").contains(current)) {
throw contract("DS_CANCEL_STATE_INVALID", "只有活动DolphinScheduler实例可以停止");
}
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
form.add("executeType", "STOP");
postForm(client, "/projects/" + projectCode + "/executors/execute/"
+ command.externalInstanceId(), form, "DolphinScheduler停止请求失败");
LocalDateTime now = LocalDateTime.now();
return new Outcome(State.CANCELED, command.externalProjectCode(), command.externalDefinitionCode(),
command.externalInstanceId(), "STOP_ACCEPTED", null, null, now, List.of(),
List.of(new InstanceEvidence(command.externalInstanceId(), LocalDate.now(), "STOP_ACCEPTED",
State.CANCELED, instanceEvidence(projectCode, command.externalInstanceId()), now)));
} catch (ContractViolation exception) {
return Outcome.unsupported(exception.code, exception.getMessage());
} catch (RuntimeException | LinkageError exception) {
return new Outcome(State.UNKNOWN, command.externalProjectCode(), command.externalDefinitionCode(),
command.externalInstanceId(), "UNKNOWN", "DS_CANCEL_UNAVAILABLE",
"DolphinScheduler停止结果暂不可确认", LocalDateTime.now(), List.of(), List.of());
}
}
@Override
public Outcome status(StatusCommand command) {
if (command == null || blank(command.externalProjectCode()) || blank(command.externalDefinitionCode())
|| blank(command.externalInstanceId())) {
return Outcome.unknown("UNKNOWN", "DS_STATUS_EVIDENCE_MISSING", "缺少外部稳定ID,无法核对状态");
}
try {
long projectCode = Long.parseLong(command.externalProjectCode());
RestClient client = client();
List<InstanceTarget> targets = command.instances() == null || command.instances().isEmpty()
? List.of(new InstanceTarget(command.externalInstanceId(), null)) : command.instances();
List<InstanceEvidence> instances = new ArrayList<>();
List<NodeEvidence> nodes = new ArrayList<>();
for (InstanceTarget target : targets) {
Observation observation = observe(client, projectCode, command.externalDefinitionCode(), target);
instances.add(observation.instance());
nodes.addAll(observation.nodes());
}
State state = aggregate(instances);
LocalDateTime now = LocalDateTime.now();
String sourceStatus = state.name();
String errorCode = state == State.FAILED ? "DOLPHINSCHEDULER_FAILURE" : null;
String summary = state == State.FAILED ? "DolphinScheduler流程或节点执行失败" : null;
return new Outcome(state, command.externalProjectCode(), command.externalDefinitionCode(),
command.externalInstanceId(), sourceStatus, errorCode, summary, now, nodes, instances);
} catch (RuntimeException | LinkageError exception) {
return new Outcome(State.UNKNOWN, command.externalProjectCode(), command.externalDefinitionCode(),
command.externalInstanceId(), "UNKNOWN", "DS_STATUS_UNAVAILABLE",
"DolphinScheduler状态暂不可确认", LocalDateTime.now(), List.of(), List.of());
}
}
private String ensureDefinition(RestClient client, long projectCode, DefinitionSnapshot snapshot) {
String name = workflowName(snapshot);
String existing = findDefinition(client, projectCode, name);
return existing == null ? createDefinition(client, projectCode, name, snapshot) : existing;
}
private String createDefinition(RestClient client, long projectCode, String name, DefinitionSnapshot snapshot) {
JsonNode codesResponse = get(client, "/projects/" + projectCode
+ "/task-definition/gen-task-codes?genNum=" + snapshot.nodes().size(),
"DolphinScheduler任务编码生成失败");
List<Long> generated = new ArrayList<>();
codesResponse.path("data").forEach(node -> generated.add(node.asLong()));
if (generated.size() != snapshot.nodes().size()) {
throw new IllegalStateException("DolphinScheduler任务编码数量不完整");
}
Map<String, Long> codes = new LinkedHashMap<>();
for (int i = 0; i < snapshot.nodes().size(); i++) {
codes.put(snapshot.nodes().get(i).nodeKey(), generated.get(i));
}
Map<Long, String> dependentDefinitions = resolveDependentDefinitions(client, projectCode, snapshot);
ArrayNode tasks = JsonUtils.getObjectMapper().createArrayNode();
ArrayNode locations = JsonUtils.getObjectMapper().createArrayNode();
for (int i = 0; i < snapshot.nodes().size(); i++) {
Node node = snapshot.nodes().get(i);
ObjectNode task = tasks.addObject();
task.put("code", codes.get(node.nodeKey()));
task.put("name", node.nodeKey());
task.put("version", 0);
task.put("description", "AiXun DataGov immutable snapshot " + snapshot.snapshotSha256());
task.put("delayTime", 0);
task.put("taskType", taskType(node));
task.set("taskParams", taskParams(projectCode, snapshot, node, codes, dependentDefinitions));
task.put("flag", "YES");
task.put("taskPriority", "MEDIUM");
task.put("workerGroup", "default");
task.put("environmentCode", -1);
task.put("failRetryTimes", 0);
task.put("failRetryInterval", 1);
task.put("timeoutFlag", OWNER_TYPES.contains(node.type()) ? "OPEN" : "CLOSE");
task.put("timeoutNotifyStrategy", "FAILED");
task.put("timeout", OWNER_TYPES.contains(node.type()) ? 60 : 0);
ObjectNode location = locations.addObject();
location.put("taskCode", codes.get(node.nodeKey()));
location.put("x", 100 + (i % 5) * 220);
location.put("y", 100 + (i / 5) * 180);
}
ArrayNode relations = relationJson(snapshot, codes);
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
form.add("name", name);
form.add("description", "AiXun DataGov scheduleId=" + snapshot.scheduleId()
+ " snapshot=" + snapshot.snapshotSha256());
form.add("globalParams", globalParams().toString());
form.add("locations", locations.toString());
form.add("timeout", "0");
form.add("taskRelationJson", relations.toString());
form.add("taskDefinitionJson", tasks.toString());
form.add("executionType", "PARALLEL");
JsonNode created = postForm(client, "/projects/" + projectCode + "/workflow-definition", form,
"DolphinScheduler流程定义创建失败");
String code = created.path("data").path("code").asText();
if (code.isBlank()) {
throw new IllegalStateException("DolphinScheduler流程定义未返回稳定编码");
}
MultiValueMap<String, String> release = new LinkedMultiValueMap<>();
release.add("releaseState", "ONLINE");
postForm(client, "/projects/" + projectCode + "/workflow-definition/" + code + "/release", release,
"DolphinScheduler流程定义上线失败");
return code;
}
private Map<Long, String> resolveDependentDefinitions(
RestClient client,
long projectCode,
DefinitionSnapshot snapshot
) {
Map<Long, String> resolved = new HashMap<>();
for (Node node : snapshot.nodes()) {
if (!"DEPENDENT".equals(node.type())) {
continue;
}
Dependency dependency = node.dependency();
if (dependency.businessDateOffsetDays() != 0) {
throw contract("DS_DEPENDENCY_OFFSET_UNSUPPORTED",
"DolphinScheduler 3.4.2首版只执行同业务日原生依赖");
}
String targetName = workflowName(dependency.scheduleId(), dependency.snapshotSha256());
String code = findDefinition(client, projectCode, targetName);
if (code == null) {
throw contract("DS_DEPENDENCY_DEFINITION_MISSING", "依赖调度尚无同快照外部流程定义");
}
resolved.put(dependency.scheduleId(), code);
}
return resolved;
}
private ObjectNode taskParams(
long projectCode,
DefinitionSnapshot snapshot,
Node node,
Map<String, Long> codes,
Map<Long, String> dependentDefinitions
) {
ObjectNode params = JsonUtils.getObjectMapper().createObjectNode();
params.putArray("localParams");
if (OWNER_TYPES.contains(node.type())) {
params.put("rawScript", callbackScript(snapshot, node));
params.putArray("resourceList");
return params;
}
if ("CONDITION".equals(node.type())) {
return conditionParams(snapshot, node, codes, params);
}
Dependency dependency = node.dependency();
ObjectNode dependence = params.putObject("dependence");
dependence.put("relation", "AND");
ArrayNode taskLists = dependence.putArray("dependTaskList");
ObjectNode taskList = taskLists.addObject();
taskList.put("relation", "AND");
ObjectNode item = taskList.putArray("dependItemList").addObject();
item.put("projectCode", projectCode);
item.put("definitionCode", Long.parseLong(dependentDefinitions.get(dependency.scheduleId())));
item.put("depTaskCode", 0);
item.put("cycle", "day");
item.put("dateValue", "today");
item.put("status", "SUCCESS");
item.put("parameterPassing", false);
ObjectNode conditionResult = params.putObject("conditionResult");
conditionResult.putArray("successNode");
conditionResult.putArray("failedNode");
return params;
}
private ObjectNode conditionParams(
DefinitionSnapshot snapshot,
Node node,
Map<String, Long> codes,
ObjectNode params
) {
Condition condition = node.condition();
if (!"PARENT_STATUS".equals(condition.field()) || "NOT_IN".equals(condition.operator())) {
throw contract("DS_CONDITION_MAPPING_UNSUPPORTED",
"DolphinScheduler 3.4.2首版只执行父节点状态EQ/IN原生条件");
}
List<Edge> incoming = snapshot.edges().stream()
.filter(edge -> edge.targetNodeKey().equals(node.nodeKey())).toList();
if (incoming.isEmpty()) {
throw contract("DS_CONDITION_PREDECESSOR_MISSING", "父节点状态条件必须存在上游节点");
}
ObjectNode dependence = params.putObject("dependence");
dependence.put("relation", "AND");
ObjectNode group = dependence.putArray("dependTaskList").addObject();
group.put("relation", "OR");
ArrayNode items = group.putArray("dependItemList");
for (Edge edge : incoming) {
for (String value : condition.values()) {
ObjectNode item = items.addObject();
item.put("depTaskCode", codes.get(edge.sourceNodeKey()));
item.put("status", externalTaskStatus(value));
}
}
ObjectNode result = params.putObject("conditionResult");
ArrayNode success = result.putArray("successNode");
ArrayNode failed = result.putArray("failedNode");
snapshot.edges().stream().filter(edge -> edge.sourceNodeKey().equals(node.nodeKey())).forEach(edge -> {
if ("TRUE".equals(edge.branchOutcome())) {
success.add(codes.get(edge.targetNodeKey()));
} else if ("FALSE".equals(edge.branchOutcome())) {
failed.add(codes.get(edge.targetNodeKey()));
}
});
return params;
}
private ArrayNode relationJson(DefinitionSnapshot snapshot, Map<String, Long> codes) {
ArrayNode relations = JsonUtils.getObjectMapper().createArrayNode();
Set<String> withIncoming = new HashSet<>();
for (Edge edge : snapshot.edges()) {
withIncoming.add(edge.targetNodeKey());
addRelation(relations, codes.get(edge.sourceNodeKey()), codes.get(edge.targetNodeKey()));
}
for (Node node : snapshot.nodes()) {
if (!withIncoming.contains(node.nodeKey())) {
addRelation(relations, 0L, codes.get(node.nodeKey()));
}
}
return relations;
}
private static void addRelation(ArrayNode relations, long predecessor, long successor) {
ObjectNode relation = relations.addObject();
relation.put("name", "");
relation.put("preTaskCode", predecessor);
relation.put("preTaskVersion", 0);
relation.put("postTaskCode", successor);
relation.put("postTaskVersion", 0);
relation.put("conditionType", "NONE");
relation.putObject("conditionParams");
}
private List<InstanceEvidence> start(
RestClient client,
long projectCode,
String definitionCode,
long runId,
LocalDate businessDate,
boolean complement
) {
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
form.add("workflowDefinitionCode", definitionCode);
String point = SCHEDULE_TIME.format(businessDate);
form.add("scheduleTime", complement ? complementScheduleTime(point) : "");
form.add("failureStrategy", "END");
form.add("warningType", "NONE");
form.add("workflowInstancePriority", "MEDIUM");
form.add("workerGroup", "default");
form.add("tenantCode", "aixun_m2");
form.add("dryRun", "0");
form.add("execType", complement ? "COMPLEMENT_DATA" : "START_PROCESS");
form.add("startParams", startParams(runId, businessDate).toString());
if (complement) {
form.add("runMode", "RUN_MODE_SERIAL");
form.add("expectedParallelismNumber", "1");
form.add("complementDependentMode", "OFF_MODE");
form.add("executionOrder", "ASC_ORDER");
}
JsonNode response = postForm(client,
"/projects/" + projectCode + "/executors/start-workflow-instance", form,
"DolphinScheduler流程实例提交失败");
JsonNode data = response.path("data");
if (!data.isArray() || data.size() == 0) {
throw new IllegalStateException("DolphinScheduler提交未返回实例ID");
}
LocalDateTime now = LocalDateTime.now();
List<InstanceEvidence> results = new ArrayList<>();
for (JsonNode item : data) {
String instanceId = item.asText();
if (instanceId.isBlank()) {
throw new IllegalStateException("DolphinScheduler返回了空实例ID");
}
results.add(new InstanceEvidence(instanceId, businessDate, "SUBMITTED_SUCCESS", State.SUBMITTED,
instanceEvidence(projectCode, instanceId), now));
}
return results;
}
static String complementScheduleTime(String point) {
return "{\"complementStartDate\":\"" + point + "\",\"complementEndDate\":\"" + point + "\"}";
}
static String rerunStartNode(String taskCode) {
if (taskCode == null || !taskCode.matches("[0-9]+")) {
throw contract("DS_FAILED_NODE_CODE_INVALID", "失败节点缺少DolphinScheduler任务编码");
}
return taskCode;
}
private Observation observe(
RestClient client,
long projectCode,
String expectedDefinitionCode,
InstanceTarget target
) {
JsonNode instance = get(client, "/projects/" + projectCode + "/workflow-instances/"
+ target.externalInstanceId(), "DolphinScheduler实例回读失败").path("data");
if (!expectedDefinitionCode.equals(instance.path("workflowDefinitionCode").asText())) {
throw new IllegalStateException("DolphinScheduler实例定义与平台映射不一致");
}
String sourceStatus = instance.path("state").asText("UNKNOWN");
State state = normalize(sourceStatus);
LocalDate businessDate = target.businessDate() == null ? LocalDate.now() : target.businessDate();
LocalDateTime now = LocalDateTime.now();
InstanceEvidence instanceEvidence = new InstanceEvidence(target.externalInstanceId(), businessDate,
sourceStatus, state, instanceEvidence(projectCode, target.externalInstanceId()), now);
JsonNode taskResponse = get(client, "/projects/" + projectCode + "/workflow-instances/"
+ target.externalInstanceId() + "/tasks", "DolphinScheduler节点实例回读失败");
List<NodeEvidence> nodes = new ArrayList<>();
JsonNode taskList = taskResponse.path("data").path("taskList");
if (taskList.isArray()) {
for (JsonNode task : taskList) {
String nodeKey = task.path("name").asText();
if (!KEY.matcher(nodeKey).matches()) {
continue;
}
String taskStatus = task.path("state").asText("UNKNOWN");
String taskId = task.path("id").asText();
State taskState = normalize(taskStatus);
nodes.add(new NodeEvidence(nodeKey, null, null, target.externalInstanceId(),
task.path("taskCode").asText(), taskId, businessDate, taskStatus, taskState,
taskEvidence(projectCode, target.externalInstanceId(), taskId),
taskState == State.FAILED ? "DOLPHINSCHEDULER_TASK_FAILURE" : null,
taskState == State.FAILED ? "DolphinScheduler节点执行失败" : null, now));
}
}
return new Observation(instanceEvidence, nodes);
}
private JsonNode failedTask(RestClient client, long projectCode, String instanceId, String nodeKey) {
JsonNode response = get(client,
"/projects/" + projectCode + "/workflow-instances/" + instanceId + "/tasks",
"DolphinScheduler失败节点证据回读失败");
JsonNode tasks = response.path("data").path("taskList");
if (tasks.isArray()) {
for (JsonNode task : tasks) {
if (nodeKey.equals(task.path("name").asText()) && "FAILURE".equals(task.path("state").asText())
&& !task.path("id").asText().isBlank()) {
return task;
}
}
}
throw contract("DS_FAILED_NODE_EVIDENCE_MISSING", "同一外部实例中不存在该节点的真实失败证据");
}
private String findDefinition(RestClient client, long projectCode, String name) {
JsonNode response = client.get().uri(builder -> builder.path("/projects/{projectCode}/workflow-definition")
.queryParam("searchVal", name).queryParam("pageNo", 1).queryParam("pageSize", 20)
.build(projectCode)).retrieve().body(JsonNode.class);
requireSuccess(response, "DolphinScheduler流程定义查询失败");
JsonNode list = response.path("data").path("totalList");
if (list.isArray()) {
for (JsonNode item : list) {
if (name.equals(item.path("name").asText())) {
return item.path("code").asText();
}
}
}
return null;
}
private long projectCode(RestClient client) {
String configured = properties.getDolphinscheduler().getProjectCode();
if (configured != null && configured.matches("[0-9]+")) {
return Long.parseLong(configured);
}
String name = properties.getDolphinscheduler().getProjectName();
JsonNode response = client.get().uri(builder -> builder.path("/projects")
.queryParam("searchVal", name).queryParam("pageNo", 1).queryParam("pageSize", 20).build())
.retrieve().body(JsonNode.class);
requireSuccess(response, "DolphinScheduler专属项目查询失败");
JsonNode list = response.path("data").path("totalList");
if (list.isArray()) {
for (JsonNode item : list) {
if (name.equals(item.path("name").asText())) {
return item.path("code").asLong();
}
}
}
throw new IllegalStateException("DolphinScheduler专属项目不存在");
}
private RestClient client() {
String token = secrets.resolve(properties.getDolphinscheduler().getTokenRef());
JdkClientHttpRequestFactory factory = new JdkClientHttpRequestFactory(HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(5)).build());
factory.setReadTimeout(Duration.ofSeconds(20));
return RestClient.builder().baseUrl(properties.getDolphinscheduler().getApiUrl())
.requestFactory(factory).defaultHeader("token", token).build();
}
private static JsonNode get(RestClient client, String uri, String message) {
JsonNode response = client.get().uri(uri).retrieve().body(JsonNode.class);
requireSuccess(response, message);
return response;
}
private static JsonNode postForm(
RestClient client,
String uri,
MultiValueMap<String, String> form,
String message
) {
JsonNode response = client.post().uri(uri)
.header(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded")
.body(form).retrieve().body(JsonNode.class);
requireSuccess(response, message);
return response;
}
private static void requireSuccess(JsonNode response, String message) {
if (response == null || response.path("code").asInt(-1) != 0
|| !response.path("success").asBoolean(false)) {
String external = response == null ? "无响应" : response.path("msg").asText("外部拒绝");
throw new IllegalStateException(message + ": " + safe(external));
}
}
private static void validate(DefinitionSnapshot snapshot) {
if (snapshot == null || snapshot.scheduleId() <= 0 || snapshot.snapshotId() <= 0
|| !SHA.matcher(nullToEmpty(snapshot.snapshotSha256())).matches()
|| snapshot.nodes() == null || snapshot.nodes().isEmpty() || snapshot.nodes().size() > 100
|| snapshot.edges() == null) {
throw contract("DS_SNAPSHOT_INVALID", "调度不可变快照不完整");
}
Set<String> keys = new HashSet<>();
for (Node node : snapshot.nodes()) {
if (node == null || !KEY.matcher(nullToEmpty(node.nodeKey())).matches() || !keys.add(node.nodeKey())) {
throw contract("DS_NODE_INVALID", "调度节点标识无效或重复");
}
if (OWNER_TYPES.contains(node.type())) {
if (node.referenceId() == null || node.referenceId() <= 0 || blank(node.ownerVersion())
|| !SHA.matcher(nullToEmpty(node.ownerSha256())).matches()
|| node.condition() != null || node.dependency() != null) {
throw contract("DS_OWNER_BINDING_INVALID", "Owner节点缺少不可变referenceId或快照摘要");
}
} else if ("CONDITION".equals(node.type())) {
if (node.referenceId() != null || node.condition() == null || node.dependency() != null
|| node.condition().values() == null || node.condition().values().isEmpty()) {
throw contract("DS_CONDITION_INVALID", "原生条件节点定义不完整");
}
} else if ("DEPENDENT".equals(node.type())) {
if (node.referenceId() != null || node.condition() != null || node.dependency() == null
|| node.dependency().scheduleId() <= 0 || node.dependency().snapshotId() <= 0
|| !SHA.matcher(nullToEmpty(node.dependency().snapshotSha256())).matches()) {
throw contract("DS_DEPENDENCY_INVALID", "原生依赖节点定义不完整");
}
} else {
throw contract("DS_NODE_TYPE_UNSUPPORTED", "调度节点类型不在D-024白名单内");
}
}
for (Edge edge : snapshot.edges()) {
if (edge == null || !keys.contains(edge.sourceNodeKey()) || !keys.contains(edge.targetNodeKey())
|| edge.sourceNodeKey().equals(edge.targetNodeKey())) {
throw contract("DS_EDGE_INVALID", "调度连线不属于不可变快照");
}
}
}
static String workflowName(DefinitionSnapshot snapshot) {
return workflowName(snapshot.scheduleId(), snapshot.snapshotSha256());
}
static String workflowName(long scheduleId, String snapshotSha256) {
if (scheduleId <= 0 || !SHA.matcher(nullToEmpty(snapshotSha256)).matches()) {
throw contract("DS_SNAPSHOT_INVALID", "调度不可变快照不完整");
}
return "aixun_m3_s" + scheduleId + "_" + snapshotSha256.substring(0, 16);
}
static String callbackScript(DefinitionSnapshot snapshot, Node node) {
if (!OWNER_TYPES.contains(node.type())) {
throw contract("DS_CALLBACK_NODE_INVALID", "控制节点不得生成Owner回调");
}
String callbackPath = "METRIC_CALCULATION".equals(node.type())
? "/internal/integration/v1/metric-calculations/execute"
: "/internal/integration/v1/m2/stages/SCHEDULING";
String url = "http://gateway:8080" + callbackPath
+ "?runId=${datagov_run_id}"
+ "&scheduleId=" + snapshot.scheduleId()
+ "&snapshotId=" + snapshot.snapshotId()
+ "&snapshotSha256=" + encode(snapshot.snapshotSha256())
+ "&nodeKey=" + encode(node.nodeKey())
+ "&nodeType=" + encode(node.type())
+ "&referenceId=" + node.referenceId()
+ "&ownerVersion=" + encode(node.ownerVersion())
+ "&ownerSha256=" + encode(node.ownerSha256())
+ "&businessDate=${datagov_business_date}";
return "/usr/bin/curl --config " + CALLBACK_CONFIG
+ " --request POST --fail --silent --show-error '" + url + "'";
}
static State normalize(String value) {
return switch (value) {
case "SUBMITTED_SUCCESS", "SERIAL_WAIT", "READY_PAUSE", "DISPATCH" -> State.SUBMITTED;
case "RUNNING_EXECUTION", "DELAY_EXECUTION" -> State.RUNNING;
case "SUCCESS", "FORCED_SUCCESS" -> State.SUCCEEDED;
case "FAILURE", "NEED_FAULT_TOLERANCE", "FAILOVER" -> State.FAILED;
case "STOP", "KILL", "READY_STOP" -> State.CANCELED;
default -> State.UNKNOWN;
};
}
private static State aggregate(List<InstanceEvidence> instances) {
if (instances.stream().anyMatch(item -> item.state() == State.FAILED)) return State.FAILED;
if (instances.stream().anyMatch(item -> item.state() == State.UNKNOWN)) return State.UNKNOWN;
if (instances.stream().anyMatch(item -> item.state() == State.RUNNING)) return State.RUNNING;
if (instances.stream().anyMatch(item -> item.state() == State.SUBMITTED)) return State.SUBMITTED;
if (!instances.isEmpty() && instances.stream().allMatch(item -> item.state() == State.SUCCEEDED)) {
return State.SUCCEEDED;
}
return State.UNKNOWN;
}
private static Outcome submitted(long projectCode, String definitionCode, List<InstanceEvidence> instances) {
if (instances.isEmpty()) {
throw new IllegalStateException("DolphinScheduler提交未返回实例证据");
}
return new Outcome(State.SUBMITTED, String.valueOf(projectCode), definitionCode,
instances.getFirst().externalInstanceId(), "SUBMITTED_SUCCESS", null, null,
LocalDateTime.now(), List.of(), List.copyOf(instances));
}
private static ArrayNode globalParams() {
ArrayNode parameters = JsonUtils.getObjectMapper().createArrayNode();
parameters.add(parameter("datagov_run_id", ""));
parameters.add(parameter("datagov_business_date", ""));
return parameters;
}
private static ObjectNode parameter(String name, String value) {
ObjectNode parameter = JsonUtils.getObjectMapper().createObjectNode();
parameter.put("prop", name);
parameter.put("direct", "IN");
parameter.put("type", "VARCHAR");
parameter.put("value", value);
return parameter;
}
private static ObjectNode startParams(long runId, LocalDate businessDate) {
ObjectNode params = JsonUtils.getObjectMapper().createObjectNode();
params.put("datagov_run_id", String.valueOf(runId));
params.put("datagov_business_date", businessDate.toString());
return params;
}
private static String taskType(Node node) {
if (OWNER_TYPES.contains(node.type())) return "SHELL";
if ("CONDITION".equals(node.type())) return "CONDITIONS";
return "DEPENDENT";
}
private static String externalTaskStatus(String value) {
return switch (value) {
case "SUCCESS", "SUCCEEDED" -> "SUCCESS";
case "FAILURE", "FAILED" -> "FAILURE";
default -> throw contract("DS_CONDITION_STATUS_UNSUPPORTED", "父节点状态条件值不受支持");
};
}
private static String instanceEvidence(long projectCode, String instanceId) {
return "dolphinscheduler://project/" + projectCode + "/workflow-instance/" + instanceId;
}
private static String taskEvidence(long projectCode, String instanceId, String taskId) {
return instanceEvidence(projectCode, instanceId) + "/task-instance/" + taskId;
}
private static String encode(String value) {
return URLEncoder.encode(value, StandardCharsets.UTF_8);
}
private static ContractViolation contract(String code, String message) {
return new ContractViolation(code, message);
}
private static boolean blank(String value) {
return value == null || value.isBlank();
}
private static String nullToEmpty(String value) {
return value == null ? "" : value;
}
private static String safe(String value) {
String redacted = value.replaceAll(
"(?i)(password|token|secret|authorization)\\s*[:=]\\s*[^,;\\s]+", "$1=[REDACTED]");
return redacted.substring(0, Math.min(384, redacted.length()));
}
private record Observation(InstanceEvidence instance, List<NodeEvidence> nodes) {
}
private static final class ContractViolation extends RuntimeException {
private final String code;
private ContractViolation(String code, String message) {
super(message);
this.code = code;
}
}
}
@@ -0,0 +1,93 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import type {
BackfillRequest,
RerunRequest,
RunView,
ScheduleDefinition,
ScheduleDetail,
ScheduleId,
ScheduleQuery,
ScheduleSummary,
SnapshotView,
ValidationView
} from './types';
const writeHeaders = (idempotencyKey: string) => ({
'Idempotency-Key': idempotencyKey,
repeatSubmit: false
});
export const listSchedules = (params: ScheduleQuery): AxiosPromise<PageResult<ScheduleSummary>> =>
request({ url: '/api/dataops/v1/schedules', method: 'get', params });
export const getSchedule = (scheduleId: ScheduleId): AxiosPromise<ScheduleDetail> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}`, method: 'get' });
export const createSchedule = (data: ScheduleDefinition, key: string): AxiosPromise<ScheduleDetail> =>
request({ url: '/api/dataops/v1/schedules', method: 'post', data, headers: writeHeaders(key) });
export const updateSchedule = (
scheduleId: ScheduleId,
data: ScheduleDefinition & { version: number },
key: string
): AxiosPromise<ScheduleDetail> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}`, method: 'put', data, headers: writeHeaders(key) });
export const validateSchedule = (scheduleId: ScheduleId): AxiosPromise<ValidationView> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}/validate`, method: 'post' });
export const readySchedule = (scheduleId: ScheduleId, version: number, key: string): AxiosPromise<ScheduleDetail> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/ready`,
method: 'post',
data: { version },
headers: writeHeaders(key)
});
export const listScheduleSnapshots = (scheduleId: ScheduleId): AxiosPromise<SnapshotView[]> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}/snapshots`, method: 'get' });
export const listScheduleRuns = (scheduleId: ScheduleId): AxiosPromise<RunView[]> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}/runs`, method: 'get' });
export const submitSchedule = (
scheduleId: ScheduleId,
version: number,
reason: string,
key: string
): AxiosPromise<RunView> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/submit`,
method: 'post',
data: { version, reason },
headers: writeHeaders(key)
});
export const backfillSchedule = (
scheduleId: ScheduleId,
data: BackfillRequest,
key: string
): AxiosPromise<RunView> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/backfill`,
method: 'post',
data,
headers: writeHeaders(key)
});
export const rerunSchedule = (
scheduleId: ScheduleId,
data: RerunRequest,
key: string
): AxiosPromise<RunView> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/rerun`,
method: 'post',
data,
headers: writeHeaders(key)
});
export const syncScheduleRun = (runId: ScheduleId): AxiosPromise<RunView> =>
request({ url: `/api/dataops/v1/schedules/runs/${runId}/status-sync`, method: 'post' });
@@ -0,0 +1,161 @@
export type ScheduleId = string | number;
export type DefinitionStatus = 'DRAFT' | 'READY';
export type RunStatus = 'PENDING' | 'SUBMITTED' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELED' | 'UNKNOWN';
export type RunAction = 'SUBMIT' | 'BACKFILL' | 'RERUN';
export type NodeType = 'BATCH_JOB' | 'CODE_OBJECT' | 'TRANSFORMATION' | 'QUALITY_RULE' | 'CONDITION' | 'DEPENDENT';
export type TriggerType = 'CRON' | 'API' | 'EVENT' | 'DEPENDENT';
export type ParameterSource = 'BUSINESS_DATE' | 'SCHEDULE_DATE' | 'RUN_ID';
export type Priority = 'HIGHEST' | 'HIGH' | 'MEDIUM' | 'LOW' | 'LOWEST';
export type FailureStrategy = 'END' | 'CONTINUE';
export type BranchOutcome = 'DEFAULT' | 'TRUE' | 'FALSE';
export interface DependencyDefinition {
scheduleId: ScheduleId;
businessDateOffsetDays: number;
}
export interface ConditionDefinition {
field: 'BUSINESS_DATE_WEEKDAY' | 'PARENT_STATUS';
operator: 'EQ' | 'IN' | 'NOT_IN';
values: string[];
}
export interface NodeDefinition {
nodeKey: string;
name: string;
type: NodeType;
referenceId?: ScheduleId;
condition?: ConditionDefinition;
dependency?: DependencyDefinition;
}
export interface EdgeDefinition {
edgeKey: string;
sourceNodeKey: string;
targetNodeKey: string;
branchOutcome: BranchOutcome;
}
export interface TriggerDefinition {
type: TriggerType;
cronExpression?: string;
timeZone?: string;
structuredKey?: string;
eventSource?: string;
dependency?: DependencyDefinition;
}
export interface ParameterDefinition {
name: string;
source: ParameterSource;
format?: string;
required: boolean;
}
export interface CalendarDefinition {
timeZone: string;
includedDates: string[];
excludedDates: string[];
}
export interface StrategyDefinition {
maxConcurrency: number;
priority: Priority;
timeoutMinutes: number;
retryCount: number;
retryIntervalSeconds: number;
failureStrategy: FailureStrategy;
}
export interface ScheduleDefinition {
name: string;
description?: string;
nodes: NodeDefinition[];
edges: EdgeDefinition[];
triggers: TriggerDefinition[];
parameters: ParameterDefinition[];
calendar: CalendarDefinition;
strategy: StrategyDefinition;
}
export interface ScheduleSummary {
scheduleId: ScheduleId;
name: string;
orgId: ScheduleId;
status: DefinitionStatus;
version: number;
currentSnapshotId?: ScheduleId;
createdAt: string;
updatedAt: string;
}
export interface ScheduleDetail extends Omit<ScheduleDefinition, 'name'> {
summary: ScheduleSummary;
definitionSha256: string;
}
export interface ScheduleQuery extends PageQuery {
keyword?: string;
status?: DefinitionStatus;
}
export interface ValidationView {
valid: boolean;
issues: Array<{ code: string; location: string; message: string }>;
definitionSha256: string;
}
export interface SnapshotView {
snapshotId: ScheduleId;
scheduleId: ScheduleId;
definitionVersion: number;
snapshotSha256: string;
createdAt: string;
}
export interface RunView {
runId: ScheduleId;
scheduleId: ScheduleId;
snapshotId: ScheduleId;
parentRunId?: ScheduleId;
action: RunAction;
status: RunStatus;
businessDateFrom?: string;
businessDateTo?: string;
failedNodeKey?: string;
externalProjectCode?: string;
externalDefinitionCode?: string;
externalInstanceId?: string;
sourceStatus?: string;
errorSummary?: string;
nodeEvidence?: NodeExecutionEvidence[];
lastSyncAt?: string;
createdAt: string;
updatedAt: string;
}
export interface NodeExecutionEvidence {
nodeKey: string;
nodeType: NodeType;
referenceId?: ScheduleId;
status: RunStatus;
sourceStatus?: string;
errorCode?: string;
errorSummary?: string;
observedAt?: string;
}
export interface BackfillRequest {
businessDateFrom: string;
businessDateTo: string;
reason: string;
impactSummary: string;
version: number;
}
export interface RerunRequest {
parentRunId: ScheduleId;
failedNodeKey?: string;
reason: string;
version: number;
}
@@ -0,0 +1,637 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
const EffectScope: typeof import('vue').EffectScope
const ElLoading: typeof import('element-plus/es').ElLoading
const ElMessage: typeof import('element-plus/es').ElMessage
const ElMessageBox: typeof import('element-plus/es').ElMessageBox
const ElNotification: typeof import('element-plus/es').ElNotification
const acceptHMRUpdate: typeof import('pinia').acceptHMRUpdate
const asyncComputed: typeof import('@vueuse/core').asyncComputed
const autoResetRef: typeof import('@vueuse/core').autoResetRef
const computed: typeof import('vue').computed
const computedAsync: typeof import('@vueuse/core').computedAsync
const computedEager: typeof import('@vueuse/core').computedEager
const computedInject: typeof import('@vueuse/core').computedInject
const computedWithControl: typeof import('@vueuse/core').computedWithControl
const controlledComputed: typeof import('@vueuse/core').controlledComputed
const controlledRef: typeof import('@vueuse/core').controlledRef
const createApp: typeof import('vue').createApp
const createDisposableDirective: typeof import('@vueuse/core').createDisposableDirective
const createEventHook: typeof import('@vueuse/core').createEventHook
const createGlobalState: typeof import('@vueuse/core').createGlobalState
const createInjectionState: typeof import('@vueuse/core').createInjectionState
const createPinia: typeof import('pinia').createPinia
const createReactiveFn: typeof import('@vueuse/core').createReactiveFn
const createRef: typeof import('@vueuse/core').createRef
const createReusableTemplate: typeof import('@vueuse/core').createReusableTemplate
const createSharedComposable: typeof import('@vueuse/core').createSharedComposable
const createTemplatePromise: typeof import('@vueuse/core').createTemplatePromise
const createUnrefFn: typeof import('@vueuse/core').createUnrefFn
const customRef: typeof import('vue').customRef
const debouncedRef: typeof import('@vueuse/core').debouncedRef
const debouncedWatch: typeof import('@vueuse/core').debouncedWatch
const defineAsyncComponent: typeof import('vue').defineAsyncComponent
const defineComponent: typeof import('vue').defineComponent
const defineStore: typeof import('pinia').defineStore
const eagerComputed: typeof import('@vueuse/core').eagerComputed
const effectScope: typeof import('vue').effectScope
const extendRef: typeof import('@vueuse/core').extendRef
const getActivePinia: typeof import('pinia').getActivePinia
const getCurrentInstance: typeof import('vue').getCurrentInstance
const getCurrentScope: typeof import('vue').getCurrentScope
const getCurrentWatcher: typeof import('vue').getCurrentWatcher
const h: typeof import('vue').h
const ignorableWatch: typeof import('@vueuse/core').ignorableWatch
const inject: typeof import('vue').inject
const injectLocal: typeof import('@vueuse/core').injectLocal
const isDefined: typeof import('@vueuse/core').isDefined
const isProxy: typeof import('vue').isProxy
const isReactive: typeof import('vue').isReactive
const isReadonly: typeof import('vue').isReadonly
const isRef: typeof import('vue').isRef
const isShallow: typeof import('vue').isShallow
const makeDestructurable: typeof import('@vueuse/core').makeDestructurable
const mapActions: typeof import('pinia').mapActions
const mapGetters: typeof import('pinia').mapGetters
const mapState: typeof import('pinia').mapState
const mapStores: typeof import('pinia').mapStores
const mapWritableState: typeof import('pinia').mapWritableState
const markRaw: typeof import('vue').markRaw
const nextTick: typeof import('vue').nextTick
const onActivated: typeof import('vue').onActivated
const onBeforeMount: typeof import('vue').onBeforeMount
const onBeforeRouteLeave: typeof import('vue-router').onBeforeRouteLeave
const onBeforeRouteUpdate: typeof import('vue-router').onBeforeRouteUpdate
const onBeforeUnmount: typeof import('vue').onBeforeUnmount
const onBeforeUpdate: typeof import('vue').onBeforeUpdate
const onClickOutside: typeof import('@vueuse/core').onClickOutside
const onDeactivated: typeof import('vue').onDeactivated
const onElementRemoval: typeof import('@vueuse/core').onElementRemoval
const onErrorCaptured: typeof import('vue').onErrorCaptured
const onKeyStroke: typeof import('@vueuse/core').onKeyStroke
const onLongPress: typeof import('@vueuse/core').onLongPress
const onMounted: typeof import('vue').onMounted
const onRenderTracked: typeof import('vue').onRenderTracked
const onRenderTriggered: typeof import('vue').onRenderTriggered
const onScopeDispose: typeof import('vue').onScopeDispose
const onServerPrefetch: typeof import('vue').onServerPrefetch
const onStartTyping: typeof import('@vueuse/core').onStartTyping
const onUnmounted: typeof import('vue').onUnmounted
const onUpdated: typeof import('vue').onUpdated
const onWatcherCleanup: typeof import('vue').onWatcherCleanup
const pausableWatch: typeof import('@vueuse/core').pausableWatch
const provide: typeof import('vue').provide
const provideLocal: typeof import('@vueuse/core').provideLocal
const reactify: typeof import('@vueuse/core').reactify
const reactifyObject: typeof import('@vueuse/core').reactifyObject
const reactive: typeof import('vue').reactive
const reactiveComputed: typeof import('@vueuse/core').reactiveComputed
const reactiveOmit: typeof import('@vueuse/core').reactiveOmit
const reactivePick: typeof import('@vueuse/core').reactivePick
const readonly: typeof import('vue').readonly
const ref: typeof import('vue').ref
const refAutoReset: typeof import('@vueuse/core').refAutoReset
const refDebounced: typeof import('@vueuse/core').refDebounced
const refDefault: typeof import('@vueuse/core').refDefault
const refManualReset: typeof import('@vueuse/core').refManualReset
const refThrottled: typeof import('@vueuse/core').refThrottled
const refWithControl: typeof import('@vueuse/core').refWithControl
const resolveComponent: typeof import('vue').resolveComponent
const setActivePinia: typeof import('pinia').setActivePinia
const setMapStoreSuffix: typeof import('pinia').setMapStoreSuffix
const shallowReactive: typeof import('vue').shallowReactive
const shallowReadonly: typeof import('vue').shallowReadonly
const shallowRef: typeof import('vue').shallowRef
const storeToRefs: typeof import('pinia').storeToRefs
const syncRef: typeof import('@vueuse/core').syncRef
const syncRefs: typeof import('@vueuse/core').syncRefs
const templateRef: typeof import('@vueuse/core').templateRef
const throttledRef: typeof import('@vueuse/core').throttledRef
const throttledWatch: typeof import('@vueuse/core').throttledWatch
const toRaw: typeof import('vue').toRaw
const toReactive: typeof import('@vueuse/core').toReactive
const toRef: typeof import('vue').toRef
const toRefs: typeof import('vue').toRefs
const toValue: typeof import('vue').toValue
const triggerRef: typeof import('vue').triggerRef
const tryOnBeforeMount: typeof import('@vueuse/core').tryOnBeforeMount
const tryOnBeforeUnmount: typeof import('@vueuse/core').tryOnBeforeUnmount
const tryOnMounted: typeof import('@vueuse/core').tryOnMounted
const tryOnScopeDispose: typeof import('@vueuse/core').tryOnScopeDispose
const tryOnUnmounted: typeof import('@vueuse/core').tryOnUnmounted
const unref: typeof import('vue').unref
const unrefElement: typeof import('@vueuse/core').unrefElement
const until: typeof import('@vueuse/core').until
const useActiveElement: typeof import('@vueuse/core').useActiveElement
const useAnimate: typeof import('@vueuse/core').useAnimate
const useArrayDifference: typeof import('@vueuse/core').useArrayDifference
const useArrayEvery: typeof import('@vueuse/core').useArrayEvery
const useArrayFilter: typeof import('@vueuse/core').useArrayFilter
const useArrayFind: typeof import('@vueuse/core').useArrayFind
const useArrayFindIndex: typeof import('@vueuse/core').useArrayFindIndex
const useArrayFindLast: typeof import('@vueuse/core').useArrayFindLast
const useArrayIncludes: typeof import('@vueuse/core').useArrayIncludes
const useArrayJoin: typeof import('@vueuse/core').useArrayJoin
const useArrayMap: typeof import('@vueuse/core').useArrayMap
const useArrayReduce: typeof import('@vueuse/core').useArrayReduce
const useArraySome: typeof import('@vueuse/core').useArraySome
const useArrayUnique: typeof import('@vueuse/core').useArrayUnique
const useAsyncQueue: typeof import('@vueuse/core').useAsyncQueue
const useAsyncState: typeof import('@vueuse/core').useAsyncState
const useAttrs: typeof import('vue').useAttrs
const useBase64: typeof import('@vueuse/core').useBase64
const useBattery: typeof import('@vueuse/core').useBattery
const useBluetooth: typeof import('@vueuse/core').useBluetooth
const useBreakpoints: typeof import('@vueuse/core').useBreakpoints
const useBroadcastChannel: typeof import('@vueuse/core').useBroadcastChannel
const useBrowserLocation: typeof import('@vueuse/core').useBrowserLocation
const useCached: typeof import('@vueuse/core').useCached
const useClipboard: typeof import('@vueuse/core').useClipboard
const useClipboardItems: typeof import('@vueuse/core').useClipboardItems
const useCloned: typeof import('@vueuse/core').useCloned
const useColorMode: typeof import('@vueuse/core').useColorMode
const useConfirmDialog: typeof import('@vueuse/core').useConfirmDialog
const useCountdown: typeof import('@vueuse/core').useCountdown
const useCounter: typeof import('@vueuse/core').useCounter
const useCssModule: typeof import('vue').useCssModule
const useCssSupports: typeof import('@vueuse/core').useCssSupports
const useCssVar: typeof import('@vueuse/core').useCssVar
const useCssVars: typeof import('vue').useCssVars
const useCurrentElement: typeof import('@vueuse/core').useCurrentElement
const useCycleList: typeof import('@vueuse/core').useCycleList
const useDark: typeof import('@vueuse/core').useDark
const useDateFormat: typeof import('@vueuse/core').useDateFormat
const useDebounce: typeof import('@vueuse/core').useDebounce
const useDebounceFn: typeof import('@vueuse/core').useDebounceFn
const useDebouncedRefHistory: typeof import('@vueuse/core').useDebouncedRefHistory
const useDeviceMotion: typeof import('@vueuse/core').useDeviceMotion
const useDeviceOrientation: typeof import('@vueuse/core').useDeviceOrientation
const useDevicePixelRatio: typeof import('@vueuse/core').useDevicePixelRatio
const useDevicesList: typeof import('@vueuse/core').useDevicesList
const useDisplayMedia: typeof import('@vueuse/core').useDisplayMedia
const useDocumentVisibility: typeof import('@vueuse/core').useDocumentVisibility
const useDraggable: typeof import('@vueuse/core').useDraggable
const useDropZone: typeof import('@vueuse/core').useDropZone
const useElementBounding: typeof import('@vueuse/core').useElementBounding
const useElementByPoint: typeof import('@vueuse/core').useElementByPoint
const useElementHover: typeof import('@vueuse/core').useElementHover
const useElementSize: typeof import('@vueuse/core').useElementSize
const useElementVisibility: typeof import('@vueuse/core').useElementVisibility
const useEventBus: typeof import('@vueuse/core').useEventBus
const useEventListener: typeof import('@vueuse/core').useEventListener
const useEventSource: typeof import('@vueuse/core').useEventSource
const useEyeDropper: typeof import('@vueuse/core').useEyeDropper
const useFavicon: typeof import('@vueuse/core').useFavicon
const useFetch: typeof import('@vueuse/core').useFetch
const useFileDialog: typeof import('@vueuse/core').useFileDialog
const useFileSystemAccess: typeof import('@vueuse/core').useFileSystemAccess
const useFocus: typeof import('@vueuse/core').useFocus
const useFocusWithin: typeof import('@vueuse/core').useFocusWithin
const useFps: typeof import('@vueuse/core').useFps
const useFullscreen: typeof import('@vueuse/core').useFullscreen
const useGamepad: typeof import('@vueuse/core').useGamepad
const useGeolocation: typeof import('@vueuse/core').useGeolocation
const useId: typeof import('vue').useId
const useIdle: typeof import('@vueuse/core').useIdle
const useImage: typeof import('@vueuse/core').useImage
const useInfiniteScroll: typeof import('@vueuse/core').useInfiniteScroll
const useIntersectionObserver: typeof import('@vueuse/core').useIntersectionObserver
const useInterval: typeof import('@vueuse/core').useInterval
const useIntervalFn: typeof import('@vueuse/core').useIntervalFn
const useKeyModifier: typeof import('@vueuse/core').useKeyModifier
const useLastChanged: typeof import('@vueuse/core').useLastChanged
const useLink: typeof import('vue-router').useLink
const useLocalStorage: typeof import('@vueuse/core').useLocalStorage
const useMagicKeys: typeof import('@vueuse/core').useMagicKeys
const useManualRefHistory: typeof import('@vueuse/core').useManualRefHistory
const useMediaControls: typeof import('@vueuse/core').useMediaControls
const useMediaQuery: typeof import('@vueuse/core').useMediaQuery
const useMemoize: typeof import('@vueuse/core').useMemoize
const useMemory: typeof import('@vueuse/core').useMemory
const useModel: typeof import('vue').useModel
const useMounted: typeof import('@vueuse/core').useMounted
const useMouse: typeof import('@vueuse/core').useMouse
const useMouseInElement: typeof import('@vueuse/core').useMouseInElement
const useMousePressed: typeof import('@vueuse/core').useMousePressed
const useMutationObserver: typeof import('@vueuse/core').useMutationObserver
const useNavigatorLanguage: typeof import('@vueuse/core').useNavigatorLanguage
const useNetwork: typeof import('@vueuse/core').useNetwork
const useNow: typeof import('@vueuse/core').useNow
const useObjectUrl: typeof import('@vueuse/core').useObjectUrl
const useOffsetPagination: typeof import('@vueuse/core').useOffsetPagination
const useOnline: typeof import('@vueuse/core').useOnline
const usePageLeave: typeof import('@vueuse/core').usePageLeave
const useParallax: typeof import('@vueuse/core').useParallax
const useParentElement: typeof import('@vueuse/core').useParentElement
const usePerformanceObserver: typeof import('@vueuse/core').usePerformanceObserver
const usePermission: typeof import('@vueuse/core').usePermission
const usePointer: typeof import('@vueuse/core').usePointer
const usePointerLock: typeof import('@vueuse/core').usePointerLock
const usePointerSwipe: typeof import('@vueuse/core').usePointerSwipe
const usePreferredColorScheme: typeof import('@vueuse/core').usePreferredColorScheme
const usePreferredContrast: typeof import('@vueuse/core').usePreferredContrast
const usePreferredDark: typeof import('@vueuse/core').usePreferredDark
const usePreferredLanguages: typeof import('@vueuse/core').usePreferredLanguages
const usePreferredReducedMotion: typeof import('@vueuse/core').usePreferredReducedMotion
const usePreferredReducedTransparency: typeof import('@vueuse/core').usePreferredReducedTransparency
const usePrevious: typeof import('@vueuse/core').usePrevious
const useRafFn: typeof import('@vueuse/core').useRafFn
const useRefHistory: typeof import('@vueuse/core').useRefHistory
const useResizeObserver: typeof import('@vueuse/core').useResizeObserver
const useRoute: typeof import('vue-router').useRoute
const useRouter: typeof import('vue-router').useRouter
const useSSRWidth: typeof import('@vueuse/core').useSSRWidth
const useScreenOrientation: typeof import('@vueuse/core').useScreenOrientation
const useScreenSafeArea: typeof import('@vueuse/core').useScreenSafeArea
const useScriptTag: typeof import('@vueuse/core').useScriptTag
const useScroll: typeof import('@vueuse/core').useScroll
const useScrollLock: typeof import('@vueuse/core').useScrollLock
const useSessionStorage: typeof import('@vueuse/core').useSessionStorage
const useShare: typeof import('@vueuse/core').useShare
const useSlots: typeof import('vue').useSlots
const useSorted: typeof import('@vueuse/core').useSorted
const useSpeechRecognition: typeof import('@vueuse/core').useSpeechRecognition
const useSpeechSynthesis: typeof import('@vueuse/core').useSpeechSynthesis
const useStepper: typeof import('@vueuse/core').useStepper
const useStorage: typeof import('@vueuse/core').useStorage
const useStorageAsync: typeof import('@vueuse/core').useStorageAsync
const useStyleTag: typeof import('@vueuse/core').useStyleTag
const useSupported: typeof import('@vueuse/core').useSupported
const useSwipe: typeof import('@vueuse/core').useSwipe
const useTemplateRef: typeof import('vue').useTemplateRef
const useTemplateRefsList: typeof import('@vueuse/core').useTemplateRefsList
const useTextDirection: typeof import('@vueuse/core').useTextDirection
const useTextSelection: typeof import('@vueuse/core').useTextSelection
const useTextareaAutosize: typeof import('@vueuse/core').useTextareaAutosize
const useThrottle: typeof import('@vueuse/core').useThrottle
const useThrottleFn: typeof import('@vueuse/core').useThrottleFn
const useThrottledRefHistory: typeof import('@vueuse/core').useThrottledRefHistory
const useTimeAgo: typeof import('@vueuse/core').useTimeAgo
const useTimeAgoIntl: typeof import('@vueuse/core').useTimeAgoIntl
const useTimeout: typeof import('@vueuse/core').useTimeout
const useTimeoutFn: typeof import('@vueuse/core').useTimeoutFn
const useTimeoutPoll: typeof import('@vueuse/core').useTimeoutPoll
const useTimestamp: typeof import('@vueuse/core').useTimestamp
const useTitle: typeof import('@vueuse/core').useTitle
const useToNumber: typeof import('@vueuse/core').useToNumber
const useToString: typeof import('@vueuse/core').useToString
const useToggle: typeof import('@vueuse/core').useToggle
const useTransition: typeof import('@vueuse/core').useTransition
const useUrlSearchParams: typeof import('@vueuse/core').useUrlSearchParams
const useUserMedia: typeof import('@vueuse/core').useUserMedia
const useVModel: typeof import('@vueuse/core').useVModel
const useVModels: typeof import('@vueuse/core').useVModels
const useVibrate: typeof import('@vueuse/core').useVibrate
const useVirtualList: typeof import('@vueuse/core').useVirtualList
const useWakeLock: typeof import('@vueuse/core').useWakeLock
const useWebNotification: typeof import('@vueuse/core').useWebNotification
const useWebSocket: typeof import('@vueuse/core').useWebSocket
const useWebWorker: typeof import('@vueuse/core').useWebWorker
const useWebWorkerFn: typeof import('@vueuse/core').useWebWorkerFn
const useWindowFocus: typeof import('@vueuse/core').useWindowFocus
const useWindowScroll: typeof import('@vueuse/core').useWindowScroll
const useWindowSize: typeof import('@vueuse/core').useWindowSize
const watch: typeof import('vue').watch
const watchArray: typeof import('@vueuse/core').watchArray
const watchAtMost: typeof import('@vueuse/core').watchAtMost
const watchDebounced: typeof import('@vueuse/core').watchDebounced
const watchDeep: typeof import('@vueuse/core').watchDeep
const watchEffect: typeof import('vue').watchEffect
const watchIgnorable: typeof import('@vueuse/core').watchIgnorable
const watchImmediate: typeof import('@vueuse/core').watchImmediate
const watchOnce: typeof import('@vueuse/core').watchOnce
const watchPausable: typeof import('@vueuse/core').watchPausable
const watchPostEffect: typeof import('vue').watchPostEffect
const watchSyncEffect: typeof import('vue').watchSyncEffect
const watchThrottled: typeof import('@vueuse/core').watchThrottled
const watchTriggerable: typeof import('@vueuse/core').watchTriggerable
const watchWithFilter: typeof import('@vueuse/core').watchWithFilter
const whenever: typeof import('@vueuse/core').whenever
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
// for vue template auto import
import { UnwrapRef } from 'vue'
declare module 'vue' {
interface GlobalComponents {}
interface ComponentCustomProperties {
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
readonly ElLoading: UnwrapRef<typeof import('element-plus/es')['ElLoading']>
readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']>
readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']>
readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']>
readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
readonly computed: UnwrapRef<typeof import('vue')['computed']>
readonly computedAsync: UnwrapRef<typeof import('@vueuse/core')['computedAsync']>
readonly computedEager: UnwrapRef<typeof import('@vueuse/core')['computedEager']>
readonly computedInject: UnwrapRef<typeof import('@vueuse/core')['computedInject']>
readonly computedWithControl: UnwrapRef<typeof import('@vueuse/core')['computedWithControl']>
readonly controlledComputed: UnwrapRef<typeof import('@vueuse/core')['controlledComputed']>
readonly controlledRef: UnwrapRef<typeof import('@vueuse/core')['controlledRef']>
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
readonly createDisposableDirective: UnwrapRef<typeof import('@vueuse/core')['createDisposableDirective']>
readonly createEventHook: UnwrapRef<typeof import('@vueuse/core')['createEventHook']>
readonly createGlobalState: UnwrapRef<typeof import('@vueuse/core')['createGlobalState']>
readonly createInjectionState: UnwrapRef<typeof import('@vueuse/core')['createInjectionState']>
readonly createPinia: UnwrapRef<typeof import('pinia')['createPinia']>
readonly createReactiveFn: UnwrapRef<typeof import('@vueuse/core')['createReactiveFn']>
readonly createRef: UnwrapRef<typeof import('@vueuse/core')['createRef']>
readonly createReusableTemplate: UnwrapRef<typeof import('@vueuse/core')['createReusableTemplate']>
readonly createSharedComposable: UnwrapRef<typeof import('@vueuse/core')['createSharedComposable']>
readonly createTemplatePromise: UnwrapRef<typeof import('@vueuse/core')['createTemplatePromise']>
readonly createUnrefFn: UnwrapRef<typeof import('@vueuse/core')['createUnrefFn']>
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
readonly debouncedRef: UnwrapRef<typeof import('@vueuse/core')['debouncedRef']>
readonly debouncedWatch: UnwrapRef<typeof import('@vueuse/core')['debouncedWatch']>
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']>
readonly eagerComputed: UnwrapRef<typeof import('@vueuse/core')['eagerComputed']>
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
readonly extendRef: UnwrapRef<typeof import('@vueuse/core')['extendRef']>
readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']>
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
readonly getCurrentWatcher: UnwrapRef<typeof import('vue')['getCurrentWatcher']>
readonly h: UnwrapRef<typeof import('vue')['h']>
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
readonly inject: UnwrapRef<typeof import('vue')['inject']>
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
readonly isShallow: UnwrapRef<typeof import('vue')['isShallow']>
readonly makeDestructurable: UnwrapRef<typeof import('@vueuse/core')['makeDestructurable']>
readonly mapActions: UnwrapRef<typeof import('pinia')['mapActions']>
readonly mapGetters: UnwrapRef<typeof import('pinia')['mapGetters']>
readonly mapState: UnwrapRef<typeof import('pinia')['mapState']>
readonly mapStores: UnwrapRef<typeof import('pinia')['mapStores']>
readonly mapWritableState: UnwrapRef<typeof import('pinia')['mapWritableState']>
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router')['onBeforeRouteLeave']>
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router')['onBeforeRouteUpdate']>
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
readonly onClickOutside: UnwrapRef<typeof import('@vueuse/core')['onClickOutside']>
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
readonly onElementRemoval: UnwrapRef<typeof import('@vueuse/core')['onElementRemoval']>
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
readonly onKeyStroke: UnwrapRef<typeof import('@vueuse/core')['onKeyStroke']>
readonly onLongPress: UnwrapRef<typeof import('@vueuse/core')['onLongPress']>
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
readonly onStartTyping: UnwrapRef<typeof import('@vueuse/core')['onStartTyping']>
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
readonly onWatcherCleanup: UnwrapRef<typeof import('vue')['onWatcherCleanup']>
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
readonly provide: UnwrapRef<typeof import('vue')['provide']>
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
readonly reactiveComputed: UnwrapRef<typeof import('@vueuse/core')['reactiveComputed']>
readonly reactiveOmit: UnwrapRef<typeof import('@vueuse/core')['reactiveOmit']>
readonly reactivePick: UnwrapRef<typeof import('@vueuse/core')['reactivePick']>
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
readonly ref: UnwrapRef<typeof import('vue')['ref']>
readonly refAutoReset: UnwrapRef<typeof import('@vueuse/core')['refAutoReset']>
readonly refDebounced: UnwrapRef<typeof import('@vueuse/core')['refDebounced']>
readonly refDefault: UnwrapRef<typeof import('@vueuse/core')['refDefault']>
readonly refManualReset: UnwrapRef<typeof import('@vueuse/core')['refManualReset']>
readonly refThrottled: UnwrapRef<typeof import('@vueuse/core')['refThrottled']>
readonly refWithControl: UnwrapRef<typeof import('@vueuse/core')['refWithControl']>
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
readonly setActivePinia: UnwrapRef<typeof import('pinia')['setActivePinia']>
readonly setMapStoreSuffix: UnwrapRef<typeof import('pinia')['setMapStoreSuffix']>
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
readonly storeToRefs: UnwrapRef<typeof import('pinia')['storeToRefs']>
readonly syncRef: UnwrapRef<typeof import('@vueuse/core')['syncRef']>
readonly syncRefs: UnwrapRef<typeof import('@vueuse/core')['syncRefs']>
readonly templateRef: UnwrapRef<typeof import('@vueuse/core')['templateRef']>
readonly throttledRef: UnwrapRef<typeof import('@vueuse/core')['throttledRef']>
readonly throttledWatch: UnwrapRef<typeof import('@vueuse/core')['throttledWatch']>
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
readonly toReactive: UnwrapRef<typeof import('@vueuse/core')['toReactive']>
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
readonly tryOnBeforeMount: UnwrapRef<typeof import('@vueuse/core')['tryOnBeforeMount']>
readonly tryOnBeforeUnmount: UnwrapRef<typeof import('@vueuse/core')['tryOnBeforeUnmount']>
readonly tryOnMounted: UnwrapRef<typeof import('@vueuse/core')['tryOnMounted']>
readonly tryOnScopeDispose: UnwrapRef<typeof import('@vueuse/core')['tryOnScopeDispose']>
readonly tryOnUnmounted: UnwrapRef<typeof import('@vueuse/core')['tryOnUnmounted']>
readonly unref: UnwrapRef<typeof import('vue')['unref']>
readonly unrefElement: UnwrapRef<typeof import('@vueuse/core')['unrefElement']>
readonly until: UnwrapRef<typeof import('@vueuse/core')['until']>
readonly useActiveElement: UnwrapRef<typeof import('@vueuse/core')['useActiveElement']>
readonly useAnimate: UnwrapRef<typeof import('@vueuse/core')['useAnimate']>
readonly useArrayDifference: UnwrapRef<typeof import('@vueuse/core')['useArrayDifference']>
readonly useArrayEvery: UnwrapRef<typeof import('@vueuse/core')['useArrayEvery']>
readonly useArrayFilter: UnwrapRef<typeof import('@vueuse/core')['useArrayFilter']>
readonly useArrayFind: UnwrapRef<typeof import('@vueuse/core')['useArrayFind']>
readonly useArrayFindIndex: UnwrapRef<typeof import('@vueuse/core')['useArrayFindIndex']>
readonly useArrayFindLast: UnwrapRef<typeof import('@vueuse/core')['useArrayFindLast']>
readonly useArrayIncludes: UnwrapRef<typeof import('@vueuse/core')['useArrayIncludes']>
readonly useArrayJoin: UnwrapRef<typeof import('@vueuse/core')['useArrayJoin']>
readonly useArrayMap: UnwrapRef<typeof import('@vueuse/core')['useArrayMap']>
readonly useArrayReduce: UnwrapRef<typeof import('@vueuse/core')['useArrayReduce']>
readonly useArraySome: UnwrapRef<typeof import('@vueuse/core')['useArraySome']>
readonly useArrayUnique: UnwrapRef<typeof import('@vueuse/core')['useArrayUnique']>
readonly useAsyncQueue: UnwrapRef<typeof import('@vueuse/core')['useAsyncQueue']>
readonly useAsyncState: UnwrapRef<typeof import('@vueuse/core')['useAsyncState']>
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
readonly useBase64: UnwrapRef<typeof import('@vueuse/core')['useBase64']>
readonly useBattery: UnwrapRef<typeof import('@vueuse/core')['useBattery']>
readonly useBluetooth: UnwrapRef<typeof import('@vueuse/core')['useBluetooth']>
readonly useBreakpoints: UnwrapRef<typeof import('@vueuse/core')['useBreakpoints']>
readonly useBroadcastChannel: UnwrapRef<typeof import('@vueuse/core')['useBroadcastChannel']>
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
readonly useClipboardItems: UnwrapRef<typeof import('@vueuse/core')['useClipboardItems']>
readonly useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
readonly useCountdown: UnwrapRef<typeof import('@vueuse/core')['useCountdown']>
readonly useCounter: UnwrapRef<typeof import('@vueuse/core')['useCounter']>
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
readonly useCssSupports: UnwrapRef<typeof import('@vueuse/core')['useCssSupports']>
readonly useCssVar: UnwrapRef<typeof import('@vueuse/core')['useCssVar']>
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
readonly useCurrentElement: UnwrapRef<typeof import('@vueuse/core')['useCurrentElement']>
readonly useCycleList: UnwrapRef<typeof import('@vueuse/core')['useCycleList']>
readonly useDark: UnwrapRef<typeof import('@vueuse/core')['useDark']>
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
readonly useDebouncedRefHistory: UnwrapRef<typeof import('@vueuse/core')['useDebouncedRefHistory']>
readonly useDeviceMotion: UnwrapRef<typeof import('@vueuse/core')['useDeviceMotion']>
readonly useDeviceOrientation: UnwrapRef<typeof import('@vueuse/core')['useDeviceOrientation']>
readonly useDevicePixelRatio: UnwrapRef<typeof import('@vueuse/core')['useDevicePixelRatio']>
readonly useDevicesList: UnwrapRef<typeof import('@vueuse/core')['useDevicesList']>
readonly useDisplayMedia: UnwrapRef<typeof import('@vueuse/core')['useDisplayMedia']>
readonly useDocumentVisibility: UnwrapRef<typeof import('@vueuse/core')['useDocumentVisibility']>
readonly useDraggable: UnwrapRef<typeof import('@vueuse/core')['useDraggable']>
readonly useDropZone: UnwrapRef<typeof import('@vueuse/core')['useDropZone']>
readonly useElementBounding: UnwrapRef<typeof import('@vueuse/core')['useElementBounding']>
readonly useElementByPoint: UnwrapRef<typeof import('@vueuse/core')['useElementByPoint']>
readonly useElementHover: UnwrapRef<typeof import('@vueuse/core')['useElementHover']>
readonly useElementSize: UnwrapRef<typeof import('@vueuse/core')['useElementSize']>
readonly useElementVisibility: UnwrapRef<typeof import('@vueuse/core')['useElementVisibility']>
readonly useEventBus: UnwrapRef<typeof import('@vueuse/core')['useEventBus']>
readonly useEventListener: UnwrapRef<typeof import('@vueuse/core')['useEventListener']>
readonly useEventSource: UnwrapRef<typeof import('@vueuse/core')['useEventSource']>
readonly useEyeDropper: UnwrapRef<typeof import('@vueuse/core')['useEyeDropper']>
readonly useFavicon: UnwrapRef<typeof import('@vueuse/core')['useFavicon']>
readonly useFetch: UnwrapRef<typeof import('@vueuse/core')['useFetch']>
readonly useFileDialog: UnwrapRef<typeof import('@vueuse/core')['useFileDialog']>
readonly useFileSystemAccess: UnwrapRef<typeof import('@vueuse/core')['useFileSystemAccess']>
readonly useFocus: UnwrapRef<typeof import('@vueuse/core')['useFocus']>
readonly useFocusWithin: UnwrapRef<typeof import('@vueuse/core')['useFocusWithin']>
readonly useFps: UnwrapRef<typeof import('@vueuse/core')['useFps']>
readonly useFullscreen: UnwrapRef<typeof import('@vueuse/core')['useFullscreen']>
readonly useGamepad: UnwrapRef<typeof import('@vueuse/core')['useGamepad']>
readonly useGeolocation: UnwrapRef<typeof import('@vueuse/core')['useGeolocation']>
readonly useId: UnwrapRef<typeof import('vue')['useId']>
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
readonly useImage: UnwrapRef<typeof import('@vueuse/core')['useImage']>
readonly useInfiniteScroll: UnwrapRef<typeof import('@vueuse/core')['useInfiniteScroll']>
readonly useIntersectionObserver: UnwrapRef<typeof import('@vueuse/core')['useIntersectionObserver']>
readonly useInterval: UnwrapRef<typeof import('@vueuse/core')['useInterval']>
readonly useIntervalFn: UnwrapRef<typeof import('@vueuse/core')['useIntervalFn']>
readonly useKeyModifier: UnwrapRef<typeof import('@vueuse/core')['useKeyModifier']>
readonly useLastChanged: UnwrapRef<typeof import('@vueuse/core')['useLastChanged']>
readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']>
readonly useLocalStorage: UnwrapRef<typeof import('@vueuse/core')['useLocalStorage']>
readonly useMagicKeys: UnwrapRef<typeof import('@vueuse/core')['useMagicKeys']>
readonly useManualRefHistory: UnwrapRef<typeof import('@vueuse/core')['useManualRefHistory']>
readonly useMediaControls: UnwrapRef<typeof import('@vueuse/core')['useMediaControls']>
readonly useMediaQuery: UnwrapRef<typeof import('@vueuse/core')['useMediaQuery']>
readonly useMemoize: UnwrapRef<typeof import('@vueuse/core')['useMemoize']>
readonly useMemory: UnwrapRef<typeof import('@vueuse/core')['useMemory']>
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
readonly useMounted: UnwrapRef<typeof import('@vueuse/core')['useMounted']>
readonly useMouse: UnwrapRef<typeof import('@vueuse/core')['useMouse']>
readonly useMouseInElement: UnwrapRef<typeof import('@vueuse/core')['useMouseInElement']>
readonly useMousePressed: UnwrapRef<typeof import('@vueuse/core')['useMousePressed']>
readonly useMutationObserver: UnwrapRef<typeof import('@vueuse/core')['useMutationObserver']>
readonly useNavigatorLanguage: UnwrapRef<typeof import('@vueuse/core')['useNavigatorLanguage']>
readonly useNetwork: UnwrapRef<typeof import('@vueuse/core')['useNetwork']>
readonly useNow: UnwrapRef<typeof import('@vueuse/core')['useNow']>
readonly useObjectUrl: UnwrapRef<typeof import('@vueuse/core')['useObjectUrl']>
readonly useOffsetPagination: UnwrapRef<typeof import('@vueuse/core')['useOffsetPagination']>
readonly useOnline: UnwrapRef<typeof import('@vueuse/core')['useOnline']>
readonly usePageLeave: UnwrapRef<typeof import('@vueuse/core')['usePageLeave']>
readonly useParallax: UnwrapRef<typeof import('@vueuse/core')['useParallax']>
readonly useParentElement: UnwrapRef<typeof import('@vueuse/core')['useParentElement']>
readonly usePerformanceObserver: UnwrapRef<typeof import('@vueuse/core')['usePerformanceObserver']>
readonly usePermission: UnwrapRef<typeof import('@vueuse/core')['usePermission']>
readonly usePointer: UnwrapRef<typeof import('@vueuse/core')['usePointer']>
readonly usePointerLock: UnwrapRef<typeof import('@vueuse/core')['usePointerLock']>
readonly usePointerSwipe: UnwrapRef<typeof import('@vueuse/core')['usePointerSwipe']>
readonly usePreferredColorScheme: UnwrapRef<typeof import('@vueuse/core')['usePreferredColorScheme']>
readonly usePreferredContrast: UnwrapRef<typeof import('@vueuse/core')['usePreferredContrast']>
readonly usePreferredDark: UnwrapRef<typeof import('@vueuse/core')['usePreferredDark']>
readonly usePreferredLanguages: UnwrapRef<typeof import('@vueuse/core')['usePreferredLanguages']>
readonly usePreferredReducedMotion: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedMotion']>
readonly usePreferredReducedTransparency: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedTransparency']>
readonly usePrevious: UnwrapRef<typeof import('@vueuse/core')['usePrevious']>
readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']>
readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']>
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
readonly useSSRWidth: UnwrapRef<typeof import('@vueuse/core')['useSSRWidth']>
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
readonly useScriptTag: UnwrapRef<typeof import('@vueuse/core')['useScriptTag']>
readonly useScroll: UnwrapRef<typeof import('@vueuse/core')['useScroll']>
readonly useScrollLock: UnwrapRef<typeof import('@vueuse/core')['useScrollLock']>
readonly useSessionStorage: UnwrapRef<typeof import('@vueuse/core')['useSessionStorage']>
readonly useShare: UnwrapRef<typeof import('@vueuse/core')['useShare']>
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
readonly useSorted: UnwrapRef<typeof import('@vueuse/core')['useSorted']>
readonly useSpeechRecognition: UnwrapRef<typeof import('@vueuse/core')['useSpeechRecognition']>
readonly useSpeechSynthesis: UnwrapRef<typeof import('@vueuse/core')['useSpeechSynthesis']>
readonly useStepper: UnwrapRef<typeof import('@vueuse/core')['useStepper']>
readonly useStorage: UnwrapRef<typeof import('@vueuse/core')['useStorage']>
readonly useStorageAsync: UnwrapRef<typeof import('@vueuse/core')['useStorageAsync']>
readonly useStyleTag: UnwrapRef<typeof import('@vueuse/core')['useStyleTag']>
readonly useSupported: UnwrapRef<typeof import('@vueuse/core')['useSupported']>
readonly useSwipe: UnwrapRef<typeof import('@vueuse/core')['useSwipe']>
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
readonly useTemplateRefsList: UnwrapRef<typeof import('@vueuse/core')['useTemplateRefsList']>
readonly useTextDirection: UnwrapRef<typeof import('@vueuse/core')['useTextDirection']>
readonly useTextSelection: UnwrapRef<typeof import('@vueuse/core')['useTextSelection']>
readonly useTextareaAutosize: UnwrapRef<typeof import('@vueuse/core')['useTextareaAutosize']>
readonly useThrottle: UnwrapRef<typeof import('@vueuse/core')['useThrottle']>
readonly useThrottleFn: UnwrapRef<typeof import('@vueuse/core')['useThrottleFn']>
readonly useThrottledRefHistory: UnwrapRef<typeof import('@vueuse/core')['useThrottledRefHistory']>
readonly useTimeAgo: UnwrapRef<typeof import('@vueuse/core')['useTimeAgo']>
readonly useTimeAgoIntl: UnwrapRef<typeof import('@vueuse/core')['useTimeAgoIntl']>
readonly useTimeout: UnwrapRef<typeof import('@vueuse/core')['useTimeout']>
readonly useTimeoutFn: UnwrapRef<typeof import('@vueuse/core')['useTimeoutFn']>
readonly useTimeoutPoll: UnwrapRef<typeof import('@vueuse/core')['useTimeoutPoll']>
readonly useTimestamp: UnwrapRef<typeof import('@vueuse/core')['useTimestamp']>
readonly useTitle: UnwrapRef<typeof import('@vueuse/core')['useTitle']>
readonly useToNumber: UnwrapRef<typeof import('@vueuse/core')['useToNumber']>
readonly useToString: UnwrapRef<typeof import('@vueuse/core')['useToString']>
readonly useToggle: UnwrapRef<typeof import('@vueuse/core')['useToggle']>
readonly useTransition: UnwrapRef<typeof import('@vueuse/core')['useTransition']>
readonly useUrlSearchParams: UnwrapRef<typeof import('@vueuse/core')['useUrlSearchParams']>
readonly useUserMedia: UnwrapRef<typeof import('@vueuse/core')['useUserMedia']>
readonly useVModel: UnwrapRef<typeof import('@vueuse/core')['useVModel']>
readonly useVModels: UnwrapRef<typeof import('@vueuse/core')['useVModels']>
readonly useVibrate: UnwrapRef<typeof import('@vueuse/core')['useVibrate']>
readonly useVirtualList: UnwrapRef<typeof import('@vueuse/core')['useVirtualList']>
readonly useWakeLock: UnwrapRef<typeof import('@vueuse/core')['useWakeLock']>
readonly useWebNotification: UnwrapRef<typeof import('@vueuse/core')['useWebNotification']>
readonly useWebSocket: UnwrapRef<typeof import('@vueuse/core')['useWebSocket']>
readonly useWebWorker: UnwrapRef<typeof import('@vueuse/core')['useWebWorker']>
readonly useWebWorkerFn: UnwrapRef<typeof import('@vueuse/core')['useWebWorkerFn']>
readonly useWindowFocus: UnwrapRef<typeof import('@vueuse/core')['useWindowFocus']>
readonly useWindowScroll: UnwrapRef<typeof import('@vueuse/core')['useWindowScroll']>
readonly useWindowSize: UnwrapRef<typeof import('@vueuse/core')['useWindowSize']>
readonly watch: UnwrapRef<typeof import('vue')['watch']>
readonly watchArray: UnwrapRef<typeof import('@vueuse/core')['watchArray']>
readonly watchAtMost: UnwrapRef<typeof import('@vueuse/core')['watchAtMost']>
readonly watchDebounced: UnwrapRef<typeof import('@vueuse/core')['watchDebounced']>
readonly watchDeep: UnwrapRef<typeof import('@vueuse/core')['watchDeep']>
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
readonly watchIgnorable: UnwrapRef<typeof import('@vueuse/core')['watchIgnorable']>
readonly watchImmediate: UnwrapRef<typeof import('@vueuse/core')['watchImmediate']>
readonly watchOnce: UnwrapRef<typeof import('@vueuse/core')['watchOnce']>
readonly watchPausable: UnwrapRef<typeof import('@vueuse/core')['watchPausable']>
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
readonly watchThrottled: UnwrapRef<typeof import('@vueuse/core')['watchThrottled']>
readonly watchTriggerable: UnwrapRef<typeof import('@vueuse/core')['watchTriggerable']>
readonly watchWithFilter: UnwrapRef<typeof import('@vueuse/core')['watchWithFilter']>
readonly whenever: UnwrapRef<typeof import('@vueuse/core')['whenever']>
}
}
@@ -0,0 +1,127 @@
/* eslint-disable */
// @ts-nocheck
// biome-ignore lint: disable
// oxlint-disable
// ------
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AixunCodeEditor: typeof import('./../components/AixunCodeEditor/index.vue')['default']
AiXunDoc: typeof import('./../components/AiXunDoc/index.vue')['default']
ApprovalButton: typeof import('./../components/Process/approvalButton.vue')['default']
ApprovalRecord: typeof import('./../components/Process/approvalRecord.vue')['default']
AssetCatalogAssist: typeof import('./../components/AssetCatalogAssist/index.vue')['default']
Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default']
ComplianceAssist: typeof import('./../components/ComplianceAssist/index.vue')['default']
DictTag: typeof import('./../components/DictTag/index.vue')['default']
Editor: typeof import('./../components/Editor/index.vue')['default']
ElAlert: typeof import('element-plus/es')['ElAlert']
ElBadge: typeof import('element-plus/es')['ElBadge']
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElResult: typeof import('element-plus/es')['ElResult']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElStatistic: typeof import('element-plus/es')['ElStatistic']
ElStep: typeof import('element-plus/es')['ElStep']
ElSteps: typeof import('element-plus/es')['ElSteps']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElText: typeof import('element-plus/es')['ElText']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimeSelect: typeof import('element-plus/es')['ElTimeSelect']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElTreeV2: typeof import('element-plus/es')['ElTreeV2']
ElUpload: typeof import('element-plus/es')['ElUpload']
FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
FlowChart: typeof import('./../components/Process/flowChart.vue')['default']
FlowChartImg: typeof import('./../components/Process/flowChartImg.vue')['default']
FormAssist: typeof import('./../components/FormAssist/index.vue')['default']
Hamburger: typeof import('./../components/Hamburger/index.vue')['default']
IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
IFrame: typeof import('./../components/iFrame/index.vue')['default']
ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']
LangSelect: typeof import('./../components/LangSelect/index.vue')['default']
MasterModelAssist: typeof import('./../components/MasterModelAssist/index.vue')['default']
MessageType: typeof import('./../components/Process/MessageType.vue')['default']
MetadataCompletionAssist: typeof import('./../components/MetadataCompletionAssist/index.vue')['default']
MetadataGraphAssist: typeof import('./../components/MetadataGraphAssist/index.vue')['default']
MetaModelAssist: typeof import('./../components/MetaModelAssist/index.vue')['default']
PageAssist: typeof import('./../components/PageAssist/index.vue')['default']
Pagination: typeof import('./../components/Pagination/index.vue')['default']
ParentView: typeof import('./../components/ParentView/index.vue')['default']
ProcessMeddle: typeof import('./../components/Process/processMeddle.vue')['default']
ProfileEvidenceAssist: typeof import('./../components/ProfileEvidenceAssist/index.vue')['default']
RecordComparisonAssist: typeof import('./../components/RecordComparisonAssist/index.vue')['default']
RightToolbar: typeof import('./../components/RightToolbar/index.vue')['default']
RoleSelect: typeof import('./../components/RoleSelect/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Screenfull: typeof import('./../components/Screenfull/index.vue')['default']
StandardSystemAssist: typeof import('./../components/StandardSystemAssist/index.vue')['default']
StructuredFormAssist: typeof import('./../components/StructuredFormAssist/index.vue')['default']
SubmitVerify: typeof import('./../components/Process/submitVerify.vue')['default']
SvgIcon: typeof import('./../components/SvgIcon/index.vue')['default']
TaskLogAssist: typeof import('./../components/TaskLogAssist/index.vue')['default']
TopNav: typeof import('./../components/TopNav/index.vue')['default']
TreePanel: typeof import('./../components/TreePanel/index.vue')['default']
UserNameDisplay: typeof import('./../components/Process/UserNameDisplay.vue')['default']
UserSelect: typeof import('./../components/UserSelect/index.vue')['default']
WorkbenchOrigin: typeof import('./../components/WorkbenchOrigin/index.vue')['default']
}
export interface GlobalDirectives {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}
@@ -0,0 +1,574 @@
<template>
<div class="p-2 app-container">
<div class="table-panel">
<div class="toolbar-shell">
<div class="flex items-center gap-2">
<el-button link :icon="ArrowLeft" @click="router.back()">返回</el-button>
<span>{{ scheduleId ? '编辑调度' : '新增调度' }}</span>
<el-tag v-if="scheduleId" type="info">{{ form.status === 'READY' ? '已就绪' : '草稿' }}</el-tag>
</div>
<div class="toolbar-actions">
<el-button @click="router.back()">取消</el-button>
<el-button type="primary" :loading="submitting" :disabled="form.status === 'READY'" @click="saveDefinition">
保存
</el-button>
</div>
</div>
<EngineeringAssist type="SCHEDULE" :configuration="requestDefinition" :editing-id="scheduleId" :editing-version="form.version" :disabled="submitting || form.status === 'READY'" @adopt="adoptEngineering" />
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
<el-tabs v-model="activeTab">
<el-tab-pane label="基本信息" name="basic">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="调度名称" prop="name">
<el-input v-model="form.name" maxlength="128" show-word-limit placeholder="请输入调度名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="说明">
<el-input v-model="form.description" type="textarea" :rows="3" maxlength="500" show-word-limit />
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane :label="`节点(${form.nodes.length})`" name="nodes">
<div class="toolbar-shell">
<span>任务与控制节点</span>
<el-button plain :icon="Plus" @click="addNode">添加节点</el-button>
</div>
<el-table :data="form.nodes" class="data-table">
<el-table-column label="节点名称" min-width="160">
<template #default="scope"><el-input v-model="scope.row.name" placeholder="请输入名称" /></template>
</el-table-column>
<el-table-column label="节点类型" min-width="170">
<template #default="scope">
<el-select v-model="scope.row.type" @change="resetNodeKey(scope.row.nodeKey)">
<el-option v-for="item in nodeTypes" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
</el-table-column>
<el-table-column label="关联任务 / 依赖" min-width="300">
<template #default="scope">
<el-select
v-if="ownerNode(scope.row.type)"
v-model="scope.row.referenceId"
filterable
placeholder="请选择已登记任务"
class="w-full"
>
<el-option
v-if="scope.row.referenceId && !hasCandidate(ownerCandidateOptions(scope.row.type), scope.row.referenceId)"
label="关联任务不可用或无权访问"
:value="scope.row.referenceId"
disabled
/>
<el-option
v-for="item in ownerCandidateOptions(scope.row.type)"
:key="String(item.id)"
:label="item.label"
:value="item.id"
:disabled="item.disabled"
/>
</el-select>
<div v-else-if="scope.row.type === 'DEPENDENT'" class="flex gap-2">
<el-select v-model="scope.row.dependency.scheduleId" filterable placeholder="请选择依赖调度" class="w-full">
<el-option
v-if="scope.row.dependency.scheduleId && !hasCandidate(scheduleCandidates, scope.row.dependency.scheduleId)"
label="依赖调度不可用或无权访问"
:value="scope.row.dependency.scheduleId"
disabled
/>
<el-option v-for="item in scheduleCandidates" :key="String(item.id)" :label="item.label" :value="item.id" :disabled="item.disabled" />
</el-select>
<el-input-number v-model="scope.row.dependency.businessDateOffsetDays" :min="-31" :max="31" />
</div>
<div v-else class="flex gap-2">
<el-select v-model="scope.row.condition.field" @change="scope.row.condition.values = []">
<el-option label="业务日期星期" value="BUSINESS_DATE_WEEKDAY" />
<el-option label="父运行状态" value="PARENT_STATUS" />
</el-select>
<el-select v-model="scope.row.condition.operator">
<el-option label="等于" value="EQ" /><el-option label="包含" value="IN" /><el-option label="不包含" value="NOT_IN" />
</el-select>
<el-select v-model="scope.row.condition.values" multiple collapse-tags>
<el-option v-for="value in conditionValuesKey(scope.row.nodeKey)" :key="value" :label="conditionValueLabel(value)" :value="value" />
</el-select>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template #default="scope"><el-button link type="danger" :icon="Delete" @click="removeNode(scope.$index)" /></template>
</el-table-column>
<template #empty><el-empty description="请添加至少一个节点" /></template>
</el-table>
</el-tab-pane>
<el-tab-pane :label="`连线(${form.edges.length})`" name="edges">
<div class="toolbar-shell">
<span>节点连线</span>
<el-button plain :icon="Plus" @click="addEdge">添加连线</el-button>
</div>
<el-table :data="form.edges" class="data-table">
<el-table-column label="上游节点" min-width="160">
<template #default="scope">
<el-select v-model="scope.row.sourceNodeKey" filterable>
<el-option v-for="node in form.nodes" :key="node.nodeKey" :label="nodeLabel(node)" :value="node.nodeKey" />
</el-select>
</template>
</el-table-column>
<el-table-column label="下游节点" min-width="160">
<template #default="scope">
<el-select v-model="scope.row.targetNodeKey" filterable>
<el-option v-for="node in form.nodes" :key="node.nodeKey" :label="nodeLabel(node)" :value="node.nodeKey" />
</el-select>
</template>
</el-table-column>
<el-table-column label="条件分支" min-width="130">
<template #default="scope">
<el-select v-model="scope.row.branchOutcome">
<el-option label="默认" value="DEFAULT" /><el-option label="是" value="TRUE" /><el-option label="否" value="FALSE" />
</el-select>
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template #default="scope"><el-button link type="danger" :icon="Delete" @click="form.edges.splice(scope.$index, 1)" /></template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane :label="`触发(${form.triggers.length})`" name="triggers">
<div class="toolbar-shell">
<span>触发与跨周期依赖</span>
<el-button plain :icon="Plus" @click="addTrigger">添加触发</el-button>
</div>
<el-table :data="form.triggers" class="data-table">
<el-table-column label="类型" min-width="130">
<template #default="scope">
<el-select v-model="scope.row.type" @change="resetTriggerAt(scope.$index)">
<el-option label="定时触发" value="CRON" /><el-option label="接口触发" value="API" />
<el-option label="事件触发" value="EVENT" /><el-option label="依赖调度" value="DEPENDENT" />
</el-select>
</template>
</el-table-column>
<el-table-column label="触发设置" min-width="420">
<template #default="scope">
<div v-if="scope.row.type === 'CRON'" class="flex gap-2">
<el-select v-model="scope.row.cronExpression" placeholder="请选择执行频率" class="w-full">
<el-option
v-if="scope.row.cronExpression && !hasValueOption(cronOptions, scope.row.cronExpression)"
label="自定义频率(保留现有设置)"
:value="scope.row.cronExpression"
disabled
/>
<el-option v-for="item in cronOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-select v-model="scope.row.timeZone" placeholder="请选择时区" class="w-full">
<el-option
v-if="scope.row.timeZone && !hasValueOption(timeZoneOptions, scope.row.timeZone)"
label="其他时区(保留现有设置)"
:value="scope.row.timeZone"
disabled
/>
<el-option v-for="item in timeZoneOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<el-text v-else-if="scope.row.type === 'EVENT' || scope.row.type === 'API'" type="info">
触发标识由系统自动生成
</el-text>
<div v-else class="flex gap-2">
<el-select v-model="scope.row.dependency.scheduleId" filterable placeholder="请选择依赖调度" class="w-full">
<el-option
v-if="scope.row.dependency.scheduleId && !hasCandidate(scheduleCandidates, scope.row.dependency.scheduleId)"
label="依赖调度不可用或无权访问"
:value="scope.row.dependency.scheduleId"
disabled
/>
<el-option v-for="item in scheduleCandidates" :key="String(item.id)" :label="item.label" :value="item.id" :disabled="item.disabled" />
</el-select>
<el-input-number v-model="scope.row.dependency.businessDateOffsetDays" :min="-31" :max="31" />
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template #default="scope"><el-button link type="danger" :icon="Delete" @click="form.triggers.splice(scope.$index, 1)" /></template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane :label="`参数日历(${form.parameters.length})`" name="parameters">
<div class="toolbar-shell">
<span>动态参数</span>
<el-button plain :icon="Plus" @click="addParameter">添加参数</el-button>
</div>
<el-table :data="form.parameters" class="data-table">
<el-table-column label="参数名称" min-width="160">
<template #default="scope"><el-input v-model="scope.row.name" placeholder="business_date" /></template>
</el-table-column>
<el-table-column label="参数来源" min-width="180">
<template #default="scope">
<el-select v-model="scope.row.source">
<el-option label="业务日期" value="BUSINESS_DATE" /><el-option label="计划日期" value="SCHEDULE_DATE" />
<el-option label="本次运行标识" value="RUN_ID" />
</el-select>
</template>
</el-table-column>
<el-table-column label="格式" min-width="180">
<template #default="scope"><el-select v-model="scope.row.format" clearable placeholder="使用默认格式">
<el-option label="日期(年-月-日)" value="yyyy-MM-dd" />
<el-option label="紧凑日期(年月日)" value="yyyyMMdd" />
<el-option label="日期时间" value="yyyy-MM-dd HH:mm:ss" />
</el-select></template>
</el-table-column>
<el-table-column label="必填" width="90">
<template #default="scope"><el-switch v-model="scope.row.required" /></template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template #default="scope"><el-button link type="danger" :icon="Delete" @click="form.parameters.splice(scope.$index, 1)" /></template>
</el-table-column>
</el-table>
<el-divider content-position="left">业务日历</el-divider>
<el-row :gutter="16">
<el-col :span="8"><el-form-item label="时区"><el-select v-model="form.calendar.timeZone" class="w-full">
<el-option
v-if="form.calendar.timeZone && !hasValueOption(timeZoneOptions, form.calendar.timeZone)"
label="其他时区(保留现有设置)"
:value="form.calendar.timeZone"
disabled
/>
<el-option v-for="item in timeZoneOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select></el-form-item></el-col>
<el-col :span="8">
<el-form-item label="包含日期">
<el-date-picker v-model="form.calendar.includedDates" type="dates" value-format="YYYY-MM-DD" placeholder="选择日期" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="排除日期">
<el-date-picker v-model="form.calendar.excludedDates" type="dates" value-format="YYYY-MM-DD" placeholder="选择日期" />
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="高级调度策略" name="strategy">
<el-alert title="默认策略适合常规调度;仅在明确并发、超时或容错要求时调整。" type="info" :closable="false" class="mb-3" />
<el-row :gutter="16">
<el-col :span="8"><el-form-item label="最大并发"><el-input-number v-model="form.strategy.maxConcurrency" :min="1" :max="50" /></el-form-item></el-col>
<el-col :span="8">
<el-form-item label="优先级">
<el-select v-model="form.strategy.priority">
<el-option label="最高" value="HIGHEST" /><el-option label="高" value="HIGH" />
<el-option label="中" value="MEDIUM" /><el-option label="低" value="LOW" /><el-option label="最低" value="LOWEST" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"><el-form-item label="超时(分钟)"><el-input-number v-model="form.strategy.timeoutMinutes" :min="1" :max="1440" /></el-form-item></el-col>
<el-col :span="8"><el-form-item label="重试次数"><el-input-number v-model="form.strategy.retryCount" :min="0" :max="10" /></el-form-item></el-col>
<el-col :span="8"><el-form-item label="重试间隔"><el-input-number v-model="form.strategy.retryIntervalSeconds" :min="1" :max="3600" /></el-form-item></el-col>
<el-col :span="8">
<el-form-item label="失败策略">
<el-select v-model="form.strategy.failureStrategy">
<el-option label="结束调度" value="END" /><el-option label="继续执行" value="CONTINUE" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
</el-form>
</div>
</div>
</template>
<script setup lang="ts">
import EngineeringAssist from '../../ai-workbench/EngineeringAssist.vue';
import { ArrowLeft, Delete, Plus } from '@element-plus/icons-vue';
import { ElMessage, type FormInstance, type FormRules } from 'element-plus';
import { onMounted, reactive, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { listBatchJobs } from '@/api/datagov/batch-jobs';
import { listCodeDevelopments } from '@/api/datagov/code-developments';
import { createSchedule, getSchedule, listSchedules, updateSchedule } from '@/api/datagov/schedules';
import { listTransformationPlans } from '@/api/datagov/transformation-cleanings';
import { pageRules } from '@/api/datagov/quality-rule';
import { engineeringQualityRuleCandidates } from '../../ai-workbench/engineeringQualityRules';
import type {
BranchOutcome,
NodeDefinition,
NodeType,
ScheduleDefinition,
ScheduleId,
TriggerDefinition
} from '@/api/datagov/schedules/types';
type EditableNode = Omit<NodeDefinition, 'referenceId' | 'condition' | 'dependency'> & {
referenceId?: ScheduleId;
condition: { field: 'BUSINESS_DATE_WEEKDAY' | 'PARENT_STATUS'; operator: 'EQ' | 'IN' | 'NOT_IN'; values: string[] };
dependency: { scheduleId?: ScheduleId; businessDateOffsetDays: number };
};
type EditableTrigger = Omit<TriggerDefinition, 'dependency'> & {
dependency: { scheduleId?: ScheduleId; businessDateOffsetDays: number };
};
type EditorForm = Omit<ScheduleDefinition, 'nodes' | 'triggers'> & {
nodes: EditableNode[];
triggers: EditableTrigger[];
version: number;
status: 'DRAFT' | 'READY';
};
const route = useRoute();
const router = useRouter();
const formRef = ref<FormInstance>();
const submitting = ref(false);
const activeTab = ref('basic');
const scheduleId = ref<ScheduleId | undefined>(route.query.scheduleId as string | undefined);
interface BusinessCandidate { id: ScheduleId; label: string; disabled?: boolean }
const ownerCandidates = reactive<Record<'BATCH_JOB' | 'CODE_OBJECT' | 'TRANSFORMATION' | 'QUALITY_RULE', BusinessCandidate[]>>({
BATCH_JOB: [], CODE_OBJECT: [], TRANSFORMATION: [], QUALITY_RULE: []
});
const scheduleCandidates = ref<BusinessCandidate[]>([]);
const nodeTypes: Array<{ label: string; value: NodeType }> = [
{ label: '批处理作业', value: 'BATCH_JOB' }, { label: '代码对象', value: 'CODE_OBJECT' },
{ label: '转换清洗', value: 'TRANSFORMATION' }, { label: '质量规则', value: 'QUALITY_RULE' }, { label: '条件', value: 'CONDITION' },
{ label: '跨周期依赖', value: 'DEPENDENT' }
];
const cronOptions = [
{ label: '每天 02:00', value: '0 0 2 * * ?' },
{ label: '每天 08:00', value: '0 0 8 * * ?' },
{ label: '每小时整点', value: '0 0 * * * ?' },
{ label: '每周一 02:00', value: '0 0 2 ? * MON' },
{ label: '每月 1 日 02:00', value: '0 0 2 1 * ?' }
];
const timeZoneOptions = [
{ label: '中国标准时间', value: 'Asia/Shanghai' },
{ label: '协调世界时', value: 'UTC' }
];
const emptyNode = (): EditableNode => ({
nodeKey: generatedKey('node'), name: '', type: 'BATCH_JOB', referenceId: undefined,
condition: { field: 'BUSINESS_DATE_WEEKDAY', operator: 'EQ', values: [] },
dependency: { scheduleId: undefined, businessDateOffsetDays: 0 }
});
const emptyTrigger = (): EditableTrigger => ({
type: 'CRON', cronExpression: '0 0 2 * * ?', timeZone: 'Asia/Shanghai',
dependency: { scheduleId: undefined, businessDateOffsetDays: 0 }
});
const form = reactive<EditorForm>({
name: '', description: '', nodes: [], edges: [], triggers: [], parameters: [],
calendar: { timeZone: 'Asia/Shanghai', includedDates: [], excludedDates: [] },
strategy: {
maxConcurrency: 1, priority: 'MEDIUM', timeoutMinutes: 60, retryCount: 0,
retryIntervalSeconds: 30, failureStrategy: 'END'
},
version: 0,
status: 'DRAFT'
});
const rules: FormRules = {
name: [{ required: true, message: '请输入调度名称', trigger: 'blur' }],
};
function idempotencyKey() {
return `schedule-${Date.now()}-${crypto.randomUUID()}`;
}
function ownerNode(type: NodeType) {
return ['BATCH_JOB', 'CODE_OBJECT', 'TRANSFORMATION', 'QUALITY_RULE'].includes(type);
}
function nodeLabel(node: EditableNode) {
return node.name || '未命名节点';
}
function ownerCandidateOptions(type: NodeType) {
return ownerNode(type) ? ownerCandidates[type as keyof typeof ownerCandidates] : [];
}
function hasCandidate(options: BusinessCandidate[], value: ScheduleId) {
return options.some((item) => String(item.id) === String(value));
}
function hasValueOption(options: Array<{ value: string }>, value: string) {
return options.some((item) => item.value === value);
}
function conditionValues(node: EditableNode) {
return node.condition.field === 'BUSINESS_DATE_WEEKDAY'
? ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY']
: ['SUCCEEDED', 'FAILED', 'CANCELED', 'UNKNOWN'];
}
function conditionValuesKey(key: unknown) { const node = form.nodes.find(value => value.nodeKey === key); return node ? conditionValues(node) : []; }
function resetNodeKey(key: unknown) { const node = form.nodes.find(value => value.nodeKey === key); if (node) resetNode(node); }
function resetTriggerAt(index: number) { const trigger = form.triggers[index]; if (trigger) resetTrigger(trigger); }
function conditionValueLabel(value: string) {
return ({
MONDAY: '星期一', TUESDAY: '星期二', WEDNESDAY: '星期三', THURSDAY: '星期四',
FRIDAY: '星期五', SATURDAY: '星期六', SUNDAY: '星期日', SUCCEEDED: '成功',
FAILED: '失败', CANCELED: '已取消', UNKNOWN: '未知状态'
} as Record<string, string>)[value] || '未识别值';
}
function addNode() {
form.nodes.push(emptyNode());
}
function removeNode(index: number) {
const removed = form.nodes[index]?.nodeKey;
form.nodes.splice(index, 1);
form.edges = form.edges.filter((edge) => edge.sourceNodeKey !== removed && edge.targetNodeKey !== removed);
}
function resetNode(node: EditableNode) {
node.referenceId = undefined;
node.condition = { field: 'BUSINESS_DATE_WEEKDAY', operator: 'EQ', values: [] };
node.dependency = { scheduleId: undefined, businessDateOffsetDays: 0 };
}
function addEdge() {
form.edges.push({ edgeKey: generatedKey('edge'), sourceNodeKey: '', targetNodeKey: '', branchOutcome: 'DEFAULT' as BranchOutcome });
}
function addTrigger() {
form.triggers.push(emptyTrigger());
}
function resetTrigger(trigger: EditableTrigger) {
trigger.cronExpression = trigger.type === 'CRON' ? '0 0 2 * * ?' : undefined;
trigger.timeZone = trigger.type === 'CRON' ? form.calendar.timeZone : undefined;
trigger.structuredKey = ['API', 'EVENT'].includes(trigger.type) ? generatedKey('trigger') : undefined;
trigger.eventSource = trigger.type === 'EVENT' ? 'DATAGOV' : undefined;
trigger.dependency = { scheduleId: undefined, businessDateOffsetDays: 0 };
}
function generatedKey(prefix: string) {
return `${prefix}-${crypto.randomUUID()}`;
}
async function loadCandidates() {
ownerCandidates.QUALITY_RULE = [];
const [jobs, codes, transformations, schedules, qualityRules] = await Promise.allSettled([
listBatchJobs({ pageNum: 1, pageSize: 100 }),
listCodeDevelopments({ pageNum: 1, pageSize: 100 }),
listTransformationPlans({ pageNum: 1, pageSize: 100 }),
listSchedules({ pageNum: 1, pageSize: 100 }),
pageRules({ pageNum: 1, pageSize: 100, status: 'ENABLED' })
]);
if (jobs.status === 'fulfilled') ownerCandidates.BATCH_JOB = jobs.value.data.rows
.map((item) => ({ id: item.jobId, label: item.name, disabled: item.status !== 'READY' }));
if (codes.status === 'fulfilled') ownerCandidates.CODE_OBJECT = codes.value.data.rows
.map((item) => ({ id: item.codeId, label: item.name, disabled: item.status !== 'ENABLED' }));
if (transformations.status === 'fulfilled') ownerCandidates.TRANSFORMATION = transformations.value.data.rows
.map((item) => ({ id: item.planId, label: item.name, disabled: item.status !== 'ACTIVE' }));
if (schedules.status === 'fulfilled') scheduleCandidates.value = schedules.value.data.rows
.filter((item) => String(item.scheduleId) !== String(scheduleId.value || ''))
.map((item) => ({ id: item.scheduleId, label: item.name, disabled: item.status !== 'READY' }));
if (qualityRules.status === 'fulfilled') ownerCandidates.QUALITY_RULE = engineeringQualityRuleCandidates(qualityRules.value.data?.rows || []);
if ([jobs, codes, transformations, schedules, qualityRules].some((result) => result.status === 'rejected')) {
ElMessage.warning('部分任务候选读取失败,请稍后重试;不会回退为手填内部编号。');
}
}
function addParameter() {
form.parameters.push({ name: '', source: 'BUSINESS_DATE', format: 'yyyy-MM-dd', required: true });
}
function adoptEngineering(value: Record<string, unknown>) {
const definition = value as unknown as ScheduleDefinition;
Object.assign(form, definition, { nodes: definition.nodes.map(node => ({ ...emptyNode(), ...node, condition: node.condition || emptyNode().condition, dependency: node.dependency || emptyNode().dependency })), triggers: definition.triggers.map(trigger => ({ ...emptyTrigger(), ...trigger, dependency: trigger.dependency || emptyTrigger().dependency })) });
}
function requestDefinition(): ScheduleDefinition {
return {
name: form.name,
description: form.description || undefined,
nodes: form.nodes.map((node) => ({
nodeKey: node.nodeKey,
name: node.name,
type: node.type,
referenceId: ownerNode(node.type) ? node.referenceId : undefined,
condition: node.type === 'CONDITION' ? node.condition : undefined,
dependency: node.type === 'DEPENDENT' && node.dependency.scheduleId
? { scheduleId: node.dependency.scheduleId, businessDateOffsetDays: node.dependency.businessDateOffsetDays }
: undefined
})),
edges: form.edges.map((edge) => ({ ...edge })),
triggers: form.triggers.map((trigger) => ({
type: trigger.type,
cronExpression: trigger.type === 'CRON' ? trigger.cronExpression : undefined,
timeZone: trigger.type === 'CRON' ? trigger.timeZone : undefined,
structuredKey: ['API', 'EVENT'].includes(trigger.type) ? trigger.structuredKey : undefined,
eventSource: trigger.type === 'EVENT' ? trigger.eventSource : undefined,
dependency: trigger.type === 'DEPENDENT' && trigger.dependency.scheduleId
? { scheduleId: trigger.dependency.scheduleId, businessDateOffsetDays: trigger.dependency.businessDateOffsetDays }
: undefined
})),
parameters: form.parameters.map((parameter) => ({ ...parameter, format: parameter.format || undefined })),
calendar: { ...form.calendar, includedDates: [...form.calendar.includedDates], excludedDates: [...form.calendar.excludedDates] },
strategy: { ...form.strategy }
};
}
function validateEditor() {
if (!form.nodes.length) throw new Error('请添加至少一个节点');
if (form.nodes.some((node) => ownerNode(node.type) && !node.referenceId)) {
throw new Error('请为每个任务节点选择已登记任务');
}
if (form.nodes.some((node) => node.type === 'DEPENDENT' && !node.dependency.scheduleId)) {
throw new Error('请为每个跨周期依赖选择调度');
}
const nodeKeys = new Set(form.nodes.map((node) => node.nodeKey));
if (nodeKeys.size !== form.nodes.length || nodeKeys.has('')) throw new Error('节点标识不能为空且不得重复');
if (form.edges.some((edge) => !nodeKeys.has(edge.sourceNodeKey) || !nodeKeys.has(edge.targetNodeKey))) {
throw new Error('连线必须选择有效的上游和下游节点');
}
}
async function saveDefinition() {
await formRef.value?.validate();
try {
validateEditor();
} catch (error) {
ElMessage.error((error as Error).message);
return;
}
submitting.value = true;
try {
const definition = requestDefinition();
if (scheduleId.value) {
await updateSchedule(scheduleId.value, { ...definition, version: form.version }, idempotencyKey());
} else {
await createSchedule(definition, idempotencyKey());
}
ElMessage.success('调度定义保存成功');
router.back();
} finally {
submitting.value = false;
}
}
async function loadDefinition() {
if (!scheduleId.value) return;
const response = await getSchedule(scheduleId.value);
const detail = response.data;
Object.assign(form, {
name: detail.summary.name,
description: detail.description || '',
nodes: detail.nodes.map((node) => ({ ...emptyNode(), ...node,
condition: node.condition || emptyNode().condition,
dependency: node.dependency || emptyNode().dependency })),
edges: detail.edges.map((edge) => ({ ...edge })),
triggers: detail.triggers.map((trigger) => ({ ...emptyTrigger(), ...trigger,
dependency: trigger.dependency || emptyTrigger().dependency })),
parameters: detail.parameters.map((parameter) => ({ ...parameter })),
calendar: { ...detail.calendar },
strategy: { ...detail.strategy },
version: detail.summary.version,
status: detail.summary.status
});
}
onMounted(async () => {
await Promise.all([loadDefinition(), loadCandidates()]);
});
</script>
@@ -0,0 +1,554 @@
<template>
<div class="p-2 app-container">
<div v-show="showSearch" class="search-wrap">
<div class="search-panel">
<el-form ref="queryFormRef" :model="query" inline class="query-form" @submit.prevent="handleQuery">
<el-form-item label="调度名称" prop="keyword">
<el-input v-model="query.keyword" placeholder="请输入调度名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="query.status" placeholder="全部状态" clearable>
<el-option label="草稿" value="DRAFT" />
<el-option label="已就绪" value="READY" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :icon="Search" @click="handleQuery">查询</el-button>
<el-button :icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
</div>
<div class="table-panel">
<div class="toolbar-shell">
<div>
<span>调度定义</span>
<span class="ml-2 text-xs text-gray-500">共 {{ total }} 条</span>
</div>
<div class="toolbar-actions">
<el-button v-hasPermi="['aixun:dataops:schedule:create']" type="primary" plain :icon="Plus" @click="openCreate">
新增
</el-button>
<right-toolbar v-model:show-search="showSearch" @query-table="loadSchedules" />
</div>
</div>
<el-table v-loading="loading" :data="rows" class="data-table" empty-text="暂无调度定义">
<el-table-column label="调度名称" prop="name" min-width="190" show-overflow-tooltip />
<el-table-column label="状态" width="100">
<template #default="scope">
<el-tag :type="scope.row.status === 'READY' ? 'success' : 'info'">
{{ scope.row.status === 'READY' ? '已就绪' : '草稿' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="更新时间" prop="updatedAt" width="170">
<template #default="{ row }">{{ row.updatedAt ? row.updatedAt.replace('T', ' ').slice(0, 19) : '--' }}</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="440" align="center">
<template #default="scope">
<el-button link type="primary" :icon="View" @click="scheduleAction(scope.row.scheduleId, 'detail')">详情</el-button>
<el-button
v-if="scope.row.status === 'DRAFT'"
v-hasPermi="['aixun:dataops:schedule:update']"
link
type="primary"
:icon="Edit"
@click="scheduleAction(scope.row.scheduleId, 'edit')"
>编排</el-button>
<el-button
v-if="scope.row.status === 'DRAFT'"
v-hasPermi="['aixun:dataops:schedule:validate']"
link
type="success"
:icon="CircleCheck"
@click="scheduleAction(scope.row.scheduleId, 'ready')"
>就绪</el-button>
<el-button
v-if="scope.row.status === 'READY'"
v-hasPermi="['aixun:dataops:schedule:submit']"
link
type="success"
:icon="VideoPlay"
@click="scheduleAction(scope.row.scheduleId, 'submit')"
>提交</el-button>
<el-button
v-if="scope.row.status === 'READY'"
v-hasPermi="['aixun:dataops:schedule:backfill']"
link
type="warning"
:icon="Calendar"
@click="scheduleAction(scope.row.scheduleId, 'backfill')"
>补数</el-button>
<WorkbenchOrigin type="SCHEDULE" :object-id="scope.row.scheduleId" /></template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
v-model:page="query.pageNum"
v-model:limit="query.pageSize"
:total="total"
@pagination="loadSchedules"
/>
</div>
<el-drawer v-model="detailDrawer.visible" title="调度详情" size="72%" append-to-body>
<template v-if="detail">
<el-tabs v-model="detailDrawer.tab" @tab-change="onDetailTabChange">
<el-tab-pane label="基本信息" name="basic">
<el-descriptions :column="2" border>
<el-descriptions-item label="调度名称">{{ detail.summary.name }}</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag :type="detail.summary.status === 'READY' ? 'success' : 'info'">
{{ detail.summary.status === 'READY' ? '已就绪' : '草稿' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="时区">{{ detail.calendar.timeZone }}</el-descriptions-item>
<el-descriptions-item label="触发方式">{{ detail.triggers.map((item) => triggerTypeLabel(item.type)).join('、') || '无' }}</el-descriptions-item>
<el-descriptions-item label="说明" :span="2">{{ detail.description || '-' }}</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane :label="`节点(${detail.nodes.length})`" name="nodes">
<el-table :data="detail.nodes" class="data-table">
<el-table-column label="节点名称" prop="name" min-width="160" />
<el-table-column label="类型" min-width="150"><template #default="scope">{{ nodeTypeLabel(scope.row.type) }}</template></el-table-column>
<el-table-column label="关联任务" min-width="120">
<template #default="scope">{{ referencedTaskLabel(scope.row.type, scope.row.referenceId) }}</template>
</el-table-column>
<el-table-column label="依赖调度" min-width="120">
<template #default="scope">{{ scheduleLabel(scope.row.dependency?.scheduleId) }}</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane :label="`连线(${detail.edges.length})`" name="edges">
<el-table :data="detail.edges" class="data-table">
<el-table-column label="上游" min-width="140"><template #default="scope">{{ nodeName(scope.row.sourceNodeKey) }}</template></el-table-column>
<el-table-column label="下游" min-width="140"><template #default="scope">{{ nodeName(scope.row.targetNodeKey) }}</template></el-table-column>
<el-table-column label="分支" width="110"><template #default="scope">{{ branchLabel(scope.row.branchOutcome) }}</template></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="运行记录" name="runs">
<template v-if="referencedRun">
<el-alert :title="`已定位运行 ${referencedRun.runId} · 节点 ${referencedNodeKey}`" type="info" :closable="false" />
<el-table :data="(referencedRun.nodeEvidence || []).filter(item => item.nodeKey === referencedNodeKey)" class="data-table mb-3">
<el-table-column label="节点" prop="nodeKey" min-width="150" />
<el-table-column label="状态" min-width="110"><template #default="scope">{{ runStatusLabel(scope.row.status) }}</template></el-table-column>
<el-table-column label="原记录说明" prop="errorSummary" min-width="200" />
<el-table-column label="观察时间" prop="observedAt" min-width="170" />
</el-table>
</template>
<el-table v-loading="detailLoading" :data="referencedRun ? [referencedRun] : runs" class="data-table">
<el-table-column label="动作" width="100"><template #default="scope">{{ runActionLabel(scope.row.action) }}</template></el-table-column>
<el-table-column label="状态" width="110">
<template #default="scope"><el-tag :type="runStatusType(scope.row.status)">{{ runStatusLabel(scope.row.status) }}</el-tag></template>
</el-table-column>
<el-table-column label="业务日期" min-width="200">
<template #default="scope">{{ businessDateById(scope.row.runId) }}</template>
</el-table-column>
<el-table-column label="结果说明" prop="errorSummary" min-width="220" show-overflow-tooltip />
<el-table-column label="操作" fixed="right" width="150" align="center">
<template #default="scope">
<el-button
v-hasPermi="['aixun:dataops:schedule:submit']"
link
type="primary"
@click="runActionById(scope.row.runId, 'sync')"
>同步</el-button>
<el-button
v-if="['FAILED', 'UNKNOWN', 'CANCELED'].includes(scope.row.status)"
v-hasPermi="['aixun:dataops:schedule:rerun']"
link
type="warning"
@click="runActionById(scope.row.runId, 'rerun')"
>重跑</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</template>
</el-drawer>
<el-dialog v-model="submitDialog.visible" title="提交调度" width="560px" append-to-body>
<el-form label-width="90px">
<el-form-item label="提交原因">
<el-input v-model="submitDialog.reason" type="textarea" :rows="3" maxlength="500" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="submitDialog.visible = false">取消</el-button>
<el-button type="primary" :loading="submitting" @click="submitRun">确定</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="backfillDialog.visible" title="创建补数" width="620px" append-to-body>
<el-form label-width="100px">
<el-form-item label="业务日期">
<el-date-picker
v-model="backfillDialog.dates"
type="daterange"
value-format="YYYY-MM-DD"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item label="补数原因">
<el-input v-model="backfillDialog.reason" maxlength="500" show-word-limit />
</el-form-item>
<el-form-item label="影响摘要">
<el-input v-model="backfillDialog.impactSummary" type="textarea" :rows="3" maxlength="500" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="backfillDialog.visible = false">取消</el-button>
<el-button type="primary" :loading="submitting" @click="submitBackfill">确定</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="rerunDialog.visible" title="创建重跑" width="560px" append-to-body>
<el-form label-width="100px">
<el-form-item label="重跑范围">
<el-input :model-value="rerunDialog.failedNodeKey ? '从系统识别的失败节点开始' : '全部节点'" disabled />
</el-form-item>
<el-form-item label="重跑原因">
<el-input v-model="rerunDialog.reason" type="textarea" :rows="3" maxlength="500" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="rerunDialog.visible = false">取消</el-button>
<el-button type="primary" :loading="submitting" @click="submitRerun">确定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import WorkbenchOrigin from '@/components/WorkbenchOrigin/index.vue';
import { Calendar, CircleCheck, Edit, Plus, Refresh, Search, VideoPlay, View } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox, type FormInstance } from 'element-plus';
import { computed, onMounted, reactive, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { batchRunId } from '../batch-jobs/runAssist';
import { listBatchJobs } from '@/api/datagov/batch-jobs';
import { listCodeDevelopments } from '@/api/datagov/code-developments';
import { pageRules } from '@/api/datagov/quality-rule';
import {
backfillSchedule,
getSchedule,
listScheduleRuns,
listSchedules,
readySchedule,
rerunSchedule,
submitSchedule,
syncScheduleRun,
validateSchedule
} from '@/api/datagov/schedules';
import type {
BranchOutcome,
NodeType,
RunAction,
RunStatus,
RunView,
ScheduleDetail,
ScheduleId,
ScheduleQuery,
ScheduleSummary,
TriggerType
} from '@/api/datagov/schedules/types';
import { listTransformationPlans } from '@/api/datagov/transformation-cleanings';
const router = useRouter();
const route = useRoute();
const referencedRunId = ref('');
const referencedNodeKey = ref('');
let referenceEpoch = 0;
const queryFormRef = ref<FormInstance>();
const loading = ref(false);
const detailLoading = ref(false);
const submitting = ref(false);
const showSearch = ref(true);
const total = ref(0);
const rows = ref<ScheduleSummary[]>([]);
const businessLabels = reactive<Record<string, string>>({});
const detail = ref<ScheduleDetail>();
const runs = ref<RunView[]>([]);
const referencedRun = computed(() => runs.value.find(run => String(run.runId) === referencedRunId.value));
const query = reactive<ScheduleQuery>({ pageNum: 1, pageSize: 10 });
const detailDrawer = reactive({ visible: false, tab: 'basic' });
const submitDialog = reactive({ visible: false, schedule: undefined as ScheduleSummary | undefined, reason: '' });
const backfillDialog = reactive({
visible: false,
schedule: undefined as ScheduleSummary | undefined,
dates: [] as string[],
reason: '',
impactSummary: ''
});
const rerunDialog = reactive({ visible: false, run: undefined as RunView | undefined, failedNodeKey: '', reason: '' });
function idempotencyKey() {
return `schedule-${Date.now()}-${crypto.randomUUID()}`;
}
async function loadSchedules() {
loading.value = true;
try {
const response = await listSchedules(query);
rows.value = response.data.rows;
total.value = response.data.total;
response.data.rows.forEach((item) => { businessLabels[`SCHEDULE:${String(item.scheduleId)}`] = item.name; });
} finally {
loading.value = false;
}
}
function handleQuery() {
query.pageNum = 1;
loadSchedules();
}
function resetQuery() {
queryFormRef.value?.resetFields();
query.pageNum = 1;
loadSchedules();
}
function openCreate() {
router.push({ path: '/datagov/dataops/scheduling/editor' });
}
function openEdit(row: ScheduleSummary) {
router.push({ path: '/datagov/dataops/scheduling/editor', query: { scheduleId: String(row.scheduleId) } });
}
async function scheduleAction(id: ScheduleId, action: 'detail' | 'edit' | 'ready' | 'submit' | 'backfill') {
if (submitting.value || detailLoading.value) return;
try {
const current = (await getSchedule(id)).data.summary;
if (action === 'detail') await openDetail(current);
else if (action === 'edit' && current.status === 'DRAFT') openEdit(current);
else if (action === 'ready' && current.status === 'DRAFT') await markReady(current);
else if (action === 'submit' && current.status === 'READY') openSubmit(current);
else if (action === 'backfill' && current.status === 'READY') openBackfill(current);
} catch (error) { if (error !== 'cancel' && error !== 'close') ElMessage.error('操作未完成,请按页面提示重试'); }
}
async function runActionById(id: ScheduleId, action: 'sync' | 'rerun') {
if (!detail.value || submitting.value || detailLoading.value) return;
try {
const scheduleId = detail.value.summary.scheduleId;
const currentDetail = (await getSchedule(scheduleId)).data;
const currentRuns = (await listScheduleRuns(scheduleId)).data;
const current = currentRuns.find(run => String(run.runId) === String(id));
if (!current || String(detail.value?.summary.scheduleId) !== String(scheduleId)) return;
detail.value = currentDetail; runs.value = currentRuns;
if (action === 'sync') await syncRun(current);
else if (['FAILED', 'UNKNOWN', 'CANCELED'].includes(current.status)) openRerun(current);
} catch (error) { if (error !== 'cancel' && error !== 'close') ElMessage.error('运行操作未完成,请刷新核对'); }
}
function businessDateById(id: ScheduleId) { const run = runs.value.find(item => String(item.runId) === String(id)); return run ? businessDateLabel(run) : '--'; }
async function openDetail(row: ScheduleSummary) {
referenceEpoch++;
referencedRunId.value = ''; referencedNodeKey.value = '';
detailDrawer.visible = true;
detailDrawer.tab = 'basic';
const response = await getSchedule(row.scheduleId);
detail.value = response.data;
runs.value = [];
await loadBusinessLabels();
}
async function onDetailTabChange(name: string | number) {
if (!detail.value) return;
detailLoading.value = true;
try {
if (name === 'runs') runs.value = (await listScheduleRuns(detail.value.summary.scheduleId)).data;
} finally {
detailLoading.value = false;
}
}
async function markReady(row: ScheduleSummary) {
const validation = await validateSchedule(row.scheduleId);
if (!validation.data.valid) {
ElMessage.error(validation.data.issues[0]?.message || '调度定义校验未通过');
return;
}
await ElMessageBox.confirm('就绪后当前定义快照不可修改,是否继续?', '就绪确认', { type: 'warning' });
await readySchedule(row.scheduleId, row.version, idempotencyKey());
ElMessage.success('调度定义已就绪');
await loadSchedules();
}
function openSubmit(row: ScheduleSummary) {
submitDialog.schedule = row;
submitDialog.reason = '';
submitDialog.visible = true;
}
async function submitRun() {
if (!submitDialog.schedule) return;
submitting.value = true;
try {
const response = await submitSchedule(submitDialog.schedule.scheduleId, submitDialog.schedule.version,
submitDialog.reason, idempotencyKey());
submitDialog.visible = false;
ElMessage.success(`请求已记录,当前状态:${runStatusLabel(response.data.status)}`);
} finally {
submitting.value = false;
}
}
function openBackfill(row: ScheduleSummary) {
Object.assign(backfillDialog, { visible: true, schedule: row, dates: [], reason: '', impactSummary: '' });
}
async function submitBackfill() {
const schedule = backfillDialog.schedule;
if (!schedule || backfillDialog.dates.length !== 2 || !backfillDialog.reason || !backfillDialog.impactSummary) {
ElMessage.warning('请完整填写业务日期、补数原因和影响摘要');
return;
}
submitting.value = true;
try {
const response = await backfillSchedule(schedule.scheduleId, {
businessDateFrom: backfillDialog.dates[0],
businessDateTo: backfillDialog.dates[1],
reason: backfillDialog.reason,
impactSummary: backfillDialog.impactSummary,
version: schedule.version
}, idempotencyKey());
backfillDialog.visible = false;
ElMessage.success(`补数请求已记录,当前状态:${runStatusLabel(response.data.status)}`);
} finally {
submitting.value = false;
}
}
function openRerun(run: RunView) {
Object.assign(rerunDialog, { visible: true, run, failedNodeKey: run.failedNodeKey || '', reason: '' });
}
async function submitRerun() {
if (!detail.value || !rerunDialog.run || !rerunDialog.reason) {
ElMessage.warning('请填写重跑原因');
return;
}
submitting.value = true;
try {
await rerunSchedule(detail.value.summary.scheduleId, {
parentRunId: rerunDialog.run.runId,
failedNodeKey: rerunDialog.failedNodeKey || undefined,
reason: rerunDialog.reason,
version: detail.value.summary.version
}, idempotencyKey());
rerunDialog.visible = false;
runs.value = (await listScheduleRuns(detail.value.summary.scheduleId)).data;
ElMessage.success('重跑请求已记录');
} finally {
submitting.value = false;
}
}
async function syncRun(run: RunView) {
await syncScheduleRun(run.runId);
if (detail.value) runs.value = (await listScheduleRuns(detail.value.summary.scheduleId)).data;
}
function businessDateLabel(run: RunView) {
if (!run.businessDateFrom) return '-';
return run.businessDateFrom === run.businessDateTo ? run.businessDateFrom : `${run.businessDateFrom} 至 ${run.businessDateTo}`;
}
async function loadBusinessLabels() {
Object.keys(businessLabels).filter(key => key.startsWith('QUALITY_RULE:')).forEach(key => { delete businessLabels[key]; });
const results = await Promise.allSettled([
listBatchJobs({ pageNum: 1, pageSize: 100 }),
listCodeDevelopments({ pageNum: 1, pageSize: 100 }),
listTransformationPlans({ pageNum: 1, pageSize: 100 }),
listSchedules({ pageNum: 1, pageSize: 100 }),
pageRules({ pageNum: 1, pageSize: 100 })
]);
const [jobs, codes, transformations, schedules, rules] = results;
if (jobs.status === 'fulfilled') jobs.value.data.rows.forEach((item) => { businessLabels[`BATCH_JOB:${String(item.jobId)}`] = item.name; });
if (codes.status === 'fulfilled') codes.value.data.rows.forEach((item) => { businessLabels[`CODE_OBJECT:${String(item.codeId)}`] = item.name; });
if (transformations.status === 'fulfilled') transformations.value.data.rows.forEach((item) => { businessLabels[`TRANSFORMATION:${String(item.planId)}`] = item.name; });
if (schedules.status === 'fulfilled') schedules.value.data.rows.forEach((item) => { businessLabels[`SCHEDULE:${String(item.scheduleId)}`] = item.name; });
if (rules.status === 'fulfilled') rules.value.data.rows.forEach((item) => { if (typeof item.ruleId !== 'number' || Number.isSafeInteger(item.ruleId)) businessLabels[`QUALITY_RULE:${String(item.ruleId)}`] = item.ruleName; });
}
function nodeTypeLabel(type: NodeType) {
return ({ BATCH_JOB: '批处理作业', CODE_OBJECT: '代码对象', TRANSFORMATION: '转换清洗', QUALITY_RULE: '质量规则',
CONDITION: '条件', DEPENDENT: '跨周期依赖' })[type];
}
function triggerTypeLabel(type: TriggerType) {
return ({ CRON: '定时触发', API: '接口触发', EVENT: '事件触发', DEPENDENT: '依赖调度' })[type];
}
function referencedTaskLabel(type: NodeType, referenceId?: ScheduleId) {
if (!referenceId || !['BATCH_JOB', 'CODE_OBJECT', 'TRANSFORMATION', 'QUALITY_RULE'].includes(type)) return '--';
return businessLabels[`${type}:${String(referenceId)}`] || '对象不可用或无权访问';
}
function scheduleLabel(value?: ScheduleId) {
return value ? businessLabels[`SCHEDULE:${String(value)}`] || '调度不可用或无权访问' : '--';
}
function nodeName(nodeKey: string) {
return detail.value?.nodes.find((item) => item.nodeKey === nodeKey)?.name || '节点不可用';
}
function branchLabel(value: BranchOutcome) {
return ({ DEFAULT: '默认', TRUE: '是', FALSE: '否' })[value];
}
function runActionLabel(value: RunAction) {
return ({ SUBMIT: '提交', BACKFILL: '补数', RERUN: '重跑' })[value];
}
function runStatusLabel(status: RunStatus) {
const labels: Record<RunStatus, string> = {
PENDING: '待提交', SUBMITTED: '已提交', RUNNING: '运行中', SUCCEEDED: '成功', FAILED: '失败',
CANCELED: '已取消', UNKNOWN: '未知'
};
return labels[status];
}
function runStatusType(status: RunStatus) {
if (status === 'SUCCEEDED') return 'success';
if (status === 'FAILED') return 'danger';
if (status === 'RUNNING' || status === 'SUBMITTED') return 'primary';
if (status === 'UNKNOWN') return 'warning';
return 'info';
}
async function openReferencedRun() {
if (!route.query.runId || !route.query.scheduleId || !route.query.nodeKey) return;
if (submitting.value) return;
const epoch = ++referenceEpoch;
detailLoading.value = true;
try {
if (typeof route.query.runId !== 'string' || typeof route.query.scheduleId !== 'string' || typeof route.query.nodeKey !== 'string') throw new Error('运行引用格式无效');
const runId = batchRunId(route.query.runId); const scheduleId = batchRunId(route.query.scheduleId); const nodeKey = route.query.nodeKey;
const current = (await getSchedule(scheduleId)).data; const currentRuns = (await listScheduleRuns(scheduleId)).data;
const selected = currentRuns.find(run => String(run.runId) === runId && String(run.scheduleId) === scheduleId);
if (!selected || !selected.nodeEvidence?.some(item => item.nodeKey === nodeKey)) throw new Error('所选运行或节点不可读,请从原列表重新选择');
if (epoch !== referenceEpoch || route.query.runId !== runId || route.query.scheduleId !== scheduleId || route.query.nodeKey !== nodeKey) return;
detail.value = current; runs.value = currentRuns; referencedRunId.value = runId; referencedNodeKey.value = nodeKey;
detailDrawer.tab = 'runs'; detailDrawer.visible = true;
} catch (error) { ElMessage.error(error instanceof Error ? error.message : '运行引用读取失败'); }
finally { if (epoch === referenceEpoch) detailLoading.value = false; }
}
watch(() => [route.query.scheduleId, route.query.runId, route.query.nodeKey], () => { void openReferencedRun(); });
onMounted(async () => { await loadSchedules(); await openReferencedRun(); });
</script>
@@ -0,0 +1,976 @@
schemaVersion: 1
engine: mysql-8.4
forwardOnly: true
migrations:
- version: '20260824.000'
ownerUnit: integration
path: db/migration/integration/V20260824.000__create_schema_history.sql
sha256: c42201377942c192c8c59fe6f69f20196395c06da8c29a37c6a7182d9bfb56e2
- version: '20260824.001'
ownerUnit: integration
path: db/migration/integration/V20260824.001__create_contract_probe.sql
sha256: 1f3bc478b259a1aef4a196210ca731df62e390b3268f6024b43c836ab4c049e5
- version: '20260824.002'
ownerUnit: integration
path: db/migration/integration/V20260824.002__create_secret_binding.sql
sha256: 85c006633079a95bc4260fddc291baed2f81fb74acc814f9864613d720452482
- version: '20260824.003'
ownerUnit: integration
path: db/migration/integration/V20260824.003__create_maintenance_lease.sql
sha256: b59cb4b895c2cf2b54ada4af69fe7a6cf7d31e6f3cd9d8b633ec988399952f9d
- version: '20260824.004'
ownerUnit: system
path: db/migration/system/V20260824.004__register_external_component_entry.sql
sha256: d7b225c39ddf9ffda06a76c96f7637260ee1dc31cf517a88b0057e7a670fd416
- version: '20260824.005'
ownerUnit: system
path: db/migration/system/V20260824.005__repair_external_component_entry_utf8.sql
sha256: 558109beb4353bddbb0eee6ebb3cf3ece1ea5f238efb6b3cd5e0ea0540aad37d
- version: '20260825.006'
ownerUnit: integration
path: db/migration/integration/V20260825.006__create_m2_integration_records.sql
sha256: 9ec71789db80899ec9df059a33decbab83b94cd47e4a57fd26693f969edd28e1
- version: '20260825.007'
ownerUnit: dataops
path: db/migration/dataops/V20260825.007__create_m2_dataops_records.sql
sha256: 1fa70ebe5d98568cff3cbfea1f796ad60c7b8b6f5369457655003a76ceaaefad
- version: '20260825.008'
ownerUnit: governance
path: db/migration/governance/V20260825.008__create_m2_metadata_projection.sql
sha256: 8bf294175c2b591a21638db8b26464b986a65018da61ad4ae62bc86ed949b8b9
- version: '20260825.009'
ownerUnit: system
path: db/migration/system/V20260825.009__register_m2_golden_chain_menu.sql
sha256: 463669f18967590e0a5df9d15db7a31a086fd68bd547af1725c9d43899eac0b9
- version: '20260825.010'
ownerUnit: governance
path: db/migration/governance/V20260825.010__allow_reused_openmetadata_entity_projection.sql
sha256: 4235ccb3299a1bf0704add26b5eb8b3f7e01c3c947fab39bf461fc7de23413f1
- version: '20260825.011'
ownerUnit: integration
path: db/migration/integration/V20260825.011__extend_data_source_management.sql
sha256: b031393a4683bb0c273de7ab8270b13fdc66e25b32ce48cb3b89ebc06dd4be59
- version: '20260825.012'
ownerUnit: dataops
path: db/migration/dataops/V20260825.012__create_storage_resources.sql
sha256: 68158a268a0d6d5e43600273a1becc56561448afc94ed9e183660a48f4a846e2
- version: '20260825.013'
ownerUnit: dataops
path: db/migration/dataops/V20260825.013__create_project_environments.sql
sha256: fb065309be772cb97d0b13119c653d168d5538c48a7a66d09bf7b1679b1992b9
- version: '20260825.014'
ownerUnit: system
path: db/migration/system/V20260825.014__register_m3_a_menus.sql
sha256: edd182a5ddcf74257805be593e0eafee17352827214fdcd65c016483e593682e
- version: '20260825.015'
ownerUnit: dataops
path: db/migration/dataops/V20260825.015__create_lakehouse_layers.sql
sha256: 0943842e0857350c96bf0d29cb1cf649e9550fa29b05ed836b2103bead1442a2
- version: '20260825.016'
ownerUnit: dataops
path: db/migration/dataops/V20260825.016__create_visual_development.sql
sha256: 0be44b80414420e4e5fa9e3c1dc4dfdacc432ce3049c60557dc03d47802301b8
- version: '20260826.017'
ownerUnit: integration
path: db/migration/integration/V20260826.017__create_collection_nodes.sql
sha256: e60d73bc6b00cfab98dda7701a223cefc88aad896aa3c85df81289c620c98693
- version: '20260826.018'
ownerUnit: dataops
path: db/migration/dataops/V20260826.018__create_batch_ingestion.sql
sha256: e039f5689f44636c792ebdf7a865544b221f17ebab65b6d11aca7464b9323885
- version: '20260826.019'
ownerUnit: dataops
path: db/migration/dataops/V20260826.019__create_file_ingestion.sql
sha256: a5aed1a2cfeeb87ad85665aca62ff310f89a8f44de10c58dd3be7ab75e92e132
- version: '20260826.020'
ownerUnit: system
path: db/migration/system/V20260826.020__register_m3_b_menus.sql
sha256: 70193b326b4c1106fecca7f8e6c8b9055847a2b8ccd65777c7b7bb45dd205153
- version: '20260826.021'
ownerUnit: dataops
path: db/migration/dataops/V20260826.021__create_table_files.sql
sha256: f0920a075beb8bc8e938d18eb5aa507e25f7bfcc5cecc3894f11179d96a9dd3f
- version: '20260826.022'
ownerUnit: system
path: db/migration/system/V20260826.022__register_table_files_menu.sql
sha256: 74717736ccc42a340cdee3103df5ebc6b6a4433df52145d9bf57f02ceb31b53d
- version: '20260826.023'
ownerUnit: dataops
path: db/migration/dataops/V20260826.023__create_code_development.sql
sha256: 777ed8e47c19be9eb3ed08ac2cea730402202f941267be52f9128e3cf4b09a7b
- version: '20260826.024'
ownerUnit: dataops
path: db/migration/dataops/V20260826.024__create_batch_jobs.sql
sha256: 412bdaf1a66246c36c4d43fe86a260ec73f9713a85df3a7d27953035a7c8dd45
- version: '20260826.025'
ownerUnit: dataops
path: db/migration/dataops/V20260826.025__create_transformation_cleaning.sql
sha256: 410259f9c860a05a381abbecfd69f75f25e4d6f87934b16e2a9ed6c7b34b57a3
- version: '20260826.026'
ownerUnit: system
path: db/migration/system/V20260826.026__register_m3_dev_menus.sql
sha256: a93b7286b5f812563adef419b884a402ce12b56c9eb952d365068ae048495577
- version: '20260826.027'
ownerUnit: dataops
path: db/migration/dataops/V20260826.027__create_scheduling.sql
sha256: eaf92473faca3b8d523aaac6f05febf31a98f5826ccd6d8275c12cf18fcdbe3c
- version: '20260827.028'
ownerUnit: system
path: db/migration/system/V20260827.028__register_scheduling_menus.sql
sha256: fd95238a2b421db8758a7f1d368b755e6e3388a3cf574e6404602188e680eff9
- version: '20260827.029'
ownerUnit: dataops
path: db/migration/dataops/V20260827.029__create_data_testing.sql
sha256: 4e97d0444f372daa1245dea1c47651ccb80a04a239e80339f509dfe759f1a1ab
- version: '20260827.030'
ownerUnit: dataops
path: db/migration/dataops/V20260827.030__create_task_logs.sql
sha256: bd14d4fca79d75421aa8953df265bd18a0a3582f038d85569fe6c346391a7aea
- version: '20260827.031'
ownerUnit: system
path: db/migration/system/V20260827.031__register_data_testing_task_logs.sql
sha256: e0e56953add36e6c92ae36ff01c846c09fc6559dc462391e7b1d060bbd1d6847
- version: '20260827.032'
ownerUnit: dataops
path: db/migration/dataops/V20260827.032__create_run_operations.sql
sha256: 74f26253c5df4b977c78d0364dc33ba2f16b679b97b93186aefff58dec905af1
- version: '20260827.033'
ownerUnit: dataops
path: db/migration/dataops/V20260827.033__create_chain_metrics.sql
sha256: 73cd349db00ab0d88f3ae4bc50f72714d4ac1ba0307e4b1071933d68d72ae3b5
- version: '20260827.034'
ownerUnit: system
path: db/migration/system/V20260827.034__register_run_operations_chain_metrics.sql
sha256: bc219cd5254923fc9e62b68438eded7a27a9e5ac42e7a1104be2e658f9538ee5
- version: '20260827.035'
ownerUnit: system
path: db/migration/system/V20260827.035__register_operations_dashboard.sql
sha256: 0212f11309f7ac39e2188864b6d4fa8f42b28e5cee88cf832d88f0a0b7b600ea
- version: '20260827.036'
ownerUnit: dataops
path: db/migration/dataops/V20260827.036__create_alert_events.sql
sha256: c881d2c5c861e6732296aa2ba7febf44698c6d74974d2ac1331f5ae13c139e3f
- version: '20260827.037'
ownerUnit: system
path: db/migration/system/V20260827.037__register_alert_events.sql
sha256: c921ae5251b57201ee552a2a0768720f653058d48090b81ee0854b4ecedf7ccb
- version: '20260827.038'
ownerUnit: dataops
path: db/migration/dataops/V20260827.038__extend_file_ingestion_execution_contract.sql
sha256: 0246d7399fff27ad6ec62060a699b5d3f54a98f65a7717465723b3a496408061
- version: '20260828.039'
ownerUnit: dataops
path: db/migration/dataops/V20260828.039__extend_dev_external_execution_evidence.sql
sha256: 7318f93f0736065b2e7a37a9b72128d9708256b51dc24ea2d694e13d02f4b908
- version: '20260828.040'
ownerUnit: governance
path: db/migration/governance/V20260828.040__create_meta_models.sql
sha256: 7c6082254b45e8cac3e416dae6ee4fdbd7e6c9590e99ff2606acfc838ef8ea05
- version: '20260828.041'
ownerUnit: system
path: db/migration/system/V20260828.041__register_meta_model_menu.sql
sha256: f18f9a84535765a88b2405e8883dc2e21e49e19868b50d77657c70516a4cfb3b
- version: '20260828.042'
ownerUnit: governance
path: db/migration/governance/V20260828.042__create_metadata_ingestion.sql
sha256: 61a8d397f5976e1db98acdd731e1916d5b9905b1efbe1cab1a65287078da3bf6
- version: '20260828.043'
ownerUnit: system
path: db/migration/system/V20260828.043__register_metadata_ingestion_menu.sql
sha256: 9a5c3c1a0eb6c15a38d9be433657b4c52c51cf3130da3699712e29bc8ca6ae0a
- version: '20260828.044'
ownerUnit: governance
path: db/migration/governance/V20260828.044__create_metadata_catalog.sql
sha256: 05f6b58703dfc884b4997ba3f85c1939a0da1e2cad90e1a99024abf44c017b38
- version: '20260828.045'
ownerUnit: system
path: db/migration/system/V20260828.045__register_metadata_catalog_menu.sql
sha256: 84c6ec2bb6c1814fa83435776e67e5015a6df9c62f3e33677bb243e2caf1368a
- version: '20260828.046'
ownerUnit: governance
path: db/migration/governance/V20260828.046__create_metadata_quality.sql
sha256: c76a3e7f79ad0c8648428a66f807d24a8c925419c2774cb93b63d082a5a86d07
- version: '20260828.047'
ownerUnit: system
path: db/migration/system/V20260828.047__register_metadata_quality_menu.sql
sha256: 494d79293ea94be1a1fab905c4d4ab619ea413c810ed2da28b2ed22b9817680f
- version: '20260828.048'
ownerUnit: governance
path: db/migration/governance/V20260828.048__create_metadata_lineage.sql
sha256: 0aa8fca209fdea687db007c3e8bb93ae6d37d7e4db4824242a8aef1bc0e6fc4b
- version: '20260828.049'
ownerUnit: system
path: db/migration/system/V20260828.049__register_metadata_lineage_menu.sql
sha256: bf1980a0fc7afa079f3824464d455adda829b78bd092ac496d3910437211aeb4
- version: '20260828.050'
ownerUnit: governance
path: db/migration/governance/V20260828.050__create_metadata_relations.sql
sha256: 3b1739ae3514713a1e9e80960eef9fe44ad3456a5f84912b95d7d3c94bc13483
- version: '20260828.051'
ownerUnit: system
path: db/migration/system/V20260828.051__register_metadata_relations_menu.sql
sha256: 00a43615534240bea77a74ec073d4fb49d391834a61f71e2a105b580d46a68c4
- version: '20260828.052'
ownerUnit: governance
path: db/migration/governance/V20260828.052__align_metadata_ingestion_secret_ref.sql
sha256: 87c6badac492bec9d41d437fb01b0a53a79afc7543bd93c168401592d383a9ed
- version: '20260829.053'
ownerUnit: governance
path: db/migration/governance/V20260829.053__create_standard_system.sql
sha256: 89770f4e43ba801b48c71026a7448dc2e116b3a9c3c65078aebcd76c5977d8b5
- version: '20260829.054'
ownerUnit: governance
path: db/migration/governance/V20260829.054__create_enterprise_architecture.sql
sha256: 80c67dc9a0ddfbfb0d2308375ece1de82495155962a56edd7176eddcbc4ad129
- version: '20260829.055'
ownerUnit: system
path: db/migration/system/V20260829.055__register_m5_wave_a_menus.sql
sha256: 19b524de58dd42790783aba03925860cb738f410c66bfd07f3a8451b06afb98a
- version: '20260829.056'
ownerUnit: governance
path: db/migration/governance/V20260829.056__create_quality_model.sql
sha256: 37957bb724c50d0b2fb8ba73b8fbce1547344d6c3341e994dd03532d9e1fd6b6
- version: '20260829.057'
ownerUnit: governance
path: db/migration/governance/V20260829.057__create_data_profile.sql
sha256: 02977aba90b4fb3688dc7114a1e3f9dca14f0ffe167405fde6d2e371ea6b2c7c
- version: '20260829.058'
ownerUnit: governance
path: db/migration/governance/V20260829.058__create_quality_rule_core.sql
sha256: 6da962a446c87ada7385d9d4051de20968e325d80278a807e31e32d0b91b92c3
- version: '20260829.059'
ownerUnit: governance
path: db/migration/governance/V20260829.059__create_quality_rule_execution.sql
sha256: 7f4e048ecf5f4e28a9a7b71bca79799ef01cc98cb157bde8964ca8e0556d5dda
- version: '20260829.060'
ownerUnit: governance
path: db/migration/governance/V20260829.060__create_business_terms.sql
sha256: 30f1ecbcdadd83b1c89f426a91088f1315859fceed160fdda8a425cd26d456c0
- version: '20260829.061'
ownerUnit: governance
path: db/migration/governance/V20260829.061__create_subject_layers.sql
sha256: 15d2df076b0dd3611d3d03b70c52cbcb99731b2bcc6827c4e247019aae30cfab
- version: '20260829.062'
ownerUnit: governance
path: db/migration/governance/V20260829.062__create_model_repository.sql
sha256: 6d831afe23c5bb73c3195c6a266e9981e9ced896bf9d65161fa9d1b297350619
- version: '20260829.063'
ownerUnit: governance
path: db/migration/governance/V20260829.063__create_data_elements.sql
sha256: f47bd994abf78318f5698d41f9242e9c204eb0f79f38067cddba9c5fa00c816e
- version: '20260829.064'
ownerUnit: governance
path: db/migration/governance/V20260829.064__create_model_design.sql
sha256: 6080795ece8177697e2171288d56cf802301020ed022e50b7ba245789027bc6c
- version: '20260829.065'
ownerUnit: governance
path: db/migration/governance/V20260829.065__create_reference_data.sql
sha256: 962aacfa8c4620c7df741d2a7422d205c69391c48925026ca945a67375834bbc
- version: '20260829.066'
ownerUnit: governance
path: db/migration/governance/V20260829.066__create_anomaly_detection.sql
sha256: 7aae483bad19878e0ae5158d884244f4ed1c8c320b8e61e8eac61ae50405f3c6
- version: '20260829.067'
ownerUnit: governance
path: db/migration/governance/V20260829.067__create_model_engineering.sql
sha256: 55a865f275756c537e0fca60e88cb18001f63297725a63e66c0fae37c4fa63a7
- version: '20260829.068'
ownerUnit: governance
path: db/migration/governance/V20260829.068__create_external_standard.sql
sha256: ee07594fe1cbe9d930a2586c98cdc6b7071184e67dc430ec0fd4367d1ad8e97d
- version: '20260829.069'
ownerUnit: governance
path: db/migration/governance/V20260829.069__create_quality_issue.sql
sha256: e03793cd9b8be431d7c89f679056b01f0e28eb6d5b614f1a3c745252c77e2970
- version: '20260829.070'
ownerUnit: governance
path: db/migration/governance/V20260829.070__create_standard_adoption.sql
sha256: 019874b08c5b19355c9b64b8d1c6488ad6592778e5ac9804e3573ec29ff48040
- version: '20260829.071'
ownerUnit: governance
path: db/migration/governance/V20260829.071__create_architecture_governance.sql
sha256: 75834b9a18225c99231085259d83255daf8c2313593685939ec897f788a2601d
- version: '20260829.072'
ownerUnit: governance
path: db/migration/governance/V20260829.072__create_root_cause_analysis.sql
sha256: 256c49230deaf6b38148b561e3c9bf54287b5a2f159422f30ef206e15bedcb0d
- version: '20260829.073'
ownerUnit: governance
path: db/migration/governance/V20260829.073__create_standard_operation.sql
sha256: 7c45649e0e6a19abb21feb4fc7c29ba349ab148895805caa2841aaab66a2ca74
- version: '20260829.074'
ownerUnit: governance
path: db/migration/governance/V20260829.074__create_quality_remediation.sql
sha256: 4d9fc67d5facc989e586a8db58d4c883928f2dcd3371cb58f3af99dcf81d9ea1
- version: '20260829.075'
ownerUnit: governance
path: db/migration/governance/V20260829.075__create_quality_remediation_execution.sql
sha256: 30a19f3e1b0df529afd53b30489b0ffeb087add43c37976e16956e91e5ecbd0c
- version: '20260829.076'
ownerUnit: governance
path: db/migration/governance/V20260829.076__create_work_overview.sql
sha256: 706d5e9cf99a4d5dbb9a424095b5e68bb7f787d0b1500104a924892e58539bab
- version: '20260829.077'
ownerUnit: governance
path: db/migration/governance/V20260829.077__create_my_work.sql
sha256: 5bb68b579b1eb0b91ecf2d1cfda4c384bc933555f5f78b93a62c54a982b2a4ca
- version: '20260829.078'
ownerUnit: system
path: db/migration/system/V20260829.078__register_m5_standard_menus.sql
sha256: 98c42989cc00bd51f30d5a3c8a7e047e1c63c54dc1c8c43b9f04b956f321f473
- version: '20260829.079'
ownerUnit: system
path: db/migration/system/V20260829.079__register_m5_architecture_menus.sql
sha256: 2feb9b7eef3794e5fc47b96b9cf9228e788e803afa8fc5d4f41b1c4f4d15b72a
- version: '20260829.080'
ownerUnit: system
path: db/migration/system/V20260829.080__register_m5_quality_menus.sql
sha256: 2b944c7f2b7fc5f5956c2790fff75eaf1fc45262e302a29222e8ad3038a5c93a
- version: '20260829.081'
ownerUnit: system
path: db/migration/system/V20260829.081__register_m5_workbench_menus.sql
sha256: 0528d322b1e1cbcc5a59f245e37bdb8e4884d3e4d14bda0ed0afa7081e91d37c
- version: '20260829.082'
ownerUnit: system
path: db/migration/system/V20260829.082__grant_m5_superadmin_menus.sql
sha256: 508dc7deaa13b8d9964f572f073b6dcd2d465a40c041be4e85bfeeb4c83444cf
- version: '20260829.083'
ownerUnit: system
path: db/migration/system/V20260829.083__grant_m5_wave_a_superadmin_menus.sql
sha256: 78b942f9751f66a4942c40806406b1d9a35fad87bbaff567d8848050f1d3a484
- version: '20260830.084'
ownerUnit: governance
path: db/migration/governance/V20260830.084__create_master_data_model.sql
sha256: 6d6b56f4374132af288a466c3f5b79ac1b2e60dc65b2ca617ece7749ba03ddf6
- version: '20260830.085'
ownerUnit: governance
path: db/migration/governance/V20260830.085__create_security_classification.sql
sha256: cb06389b6616b141c62e8b11ad270afa5ec969ff82add01495452be7aa443dd0
- version: '20260830.086'
ownerUnit: governance
path: db/migration/governance/V20260830.086__create_asset_inventory.sql
sha256: e2ba6c4150e19843b4861961d7a3ce3123189c5beb80434e0fe9730372edffd8
- version: '20260830.087'
ownerUnit: system
path: db/migration/system/V20260830.087__register_m6_wave_a_menus.sql
sha256: 128b918bceab9ab1cc1ffbac76797dc65b0ef125b18efb678cd63c19d8b35c64
- version: '20260830.088'
ownerUnit: governance
path: db/migration/governance/V20260830.088__create_master_data_identity.sql
sha256: 5e0ac06f21ba45f63ec6149b2acb6c2220834dd560d27080d5ba5ab36ba00290
- version: '20260830.089'
ownerUnit: governance
path: db/migration/governance/V20260830.089__create_access_control.sql
sha256: c0300e748a892ef3ac74a9f7070b0d3b79fe949033a9675adf6e746fd8ce1aa5
- version: '20260830.090'
ownerUnit: governance
path: db/migration/governance/V20260830.090__create_asset_catalog.sql
sha256: 60eef24ff01a803c51e7fc7f6bcf4f931ce1a856bb8050b71dda1a09f3038579
- version: '20260830.091'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.091__create_metric_system.sql
sha256: 900ef8223d1a7058bad5932da3c977ffac912f797bbbb5fbcff92cf754503bad
- version: '20260830.092'
ownerUnit: system
path: db/migration/system/V20260830.092__register_m6_wave_b_menus.sql
sha256: daf72856490df6e55338ad2ddba2b232a9244e22ebaa29e89cfda87567dcd787
- version: '20260830.093'
ownerUnit: governance
path: db/migration/governance/V20260830.093__create_master_data_source.sql
sha256: 3e0ca8fc226c2b0184a25957fb19a1026da3c25b2feab1922ae21dbda789e6b4
- version: '20260830.094'
ownerUnit: governance
path: db/migration/governance/V20260830.094__create_data_protection.sql
sha256: 1b879c0406a995d7a56042e892827daaed161a657c429f0f37c39300d8044bf0
- version: '20260830.095'
ownerUnit: system
path: db/migration/system/V20260830.095__register_m6_wave_c_menus.sql
sha256: 36d332b658376622dc7c47730248d64ab8e81fdc3e1df50b0342e6f2180d9fb0
- version: '20260830.096'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.096__create_semantic_model.sql
sha256: e94dfb9791be85a0da73c1966389ac2d9dd8d9eb1928dd31613c1a95d70e61e1
- version: '20260830.097'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.097__create_dataset_publication.sql
sha256: 54c2bc9840bc36f3ebb1f54af1c7bec70238c1e55f4fcfd816c7bfed80349e32
- version: '20260830.098'
ownerUnit: governance
path: db/migration/governance/V20260830.098__create_master_data_maintenance.sql
sha256: b8a1443607c8ab869a9f1ec84aa408c73955662bb579e5cd444b3c2eab34fca9
- version: '20260830.099'
ownerUnit: governance
path: db/migration/governance/V20260830.099__create_asset_detail.sql
sha256: 4f9868f982da14a57904aa60cf6cfac04ac97bf93815273d190e385e255a9e05
- version: '20260830.100'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.100__create_api_development.sql
sha256: 7fe03244b9ab8a6b5dab53b8b00ad5c2b53865bce840e7f3f2ae673fdc676555
- version: '20260830.101'
ownerUnit: governance
path: db/migration/governance/V20260830.101__create_asset_lifecycle.sql
sha256: 7c54e1badb05f36b49689cbd5f8ea5eecda45eb6aa0cc658d8f10cbd499fed86
- version: '20260830.102'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.102__create_metric_calculation.sql
sha256: 83d557a64061eee299a95ad84551bb4d457f53180725a0bfdd8012fd9e3f6671
- version: '20260830.103'
ownerUnit: governance
path: db/migration/governance/V20260830.103__create_security_incident.sql
sha256: 50fe2e8d1b42aa38e91ad8e41777844e2412abd58619e4989858194815510283
- version: '20260830.104'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.104__create_service_gateway.sql
sha256: ce9ab92b864cef05e02a1e4561f0964e3fb2cb262513dfffd622c7309aaf9600
- version: '20260830.105'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.105__create_metric_lineage.sql
sha256: ee4577686a6ee6c491608584875efb899c1ae257038124b2812aae7931842721
- version: '20260830.106'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.106__create_metric_self_service.sql
sha256: 746c5bac55882ecd68a810001402fc580271b60571f8347197ed3474ab068156
- version: '20260830.107'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.107__create_metric_business_alert.sql
sha256: cf99784cc0b2b10f9bc9c9d4d42445f71bc2f3150ccda0d0ac602b0d11552279
- version: '20260830.108'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.108__create_api_management.sql
sha256: 6b2d3ab9fb9c34e245ae71592cbaa46136013f7afe668accfc443fb54d528e19
- version: '20260830.109'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260830.109__create_data_exchange.sql
sha256: 4afda71cc62c4e0d1ba143110d5c4b88b3613ff64e7aa26e9f35f198ccf83851
- version: '20260830.110'
ownerUnit: system
path: db/migration/system/V20260830.110__register_m6_wave_d_menus.sql
sha256: e7c19b77d63a627c284e949439b9c7d75afb86d0bb8f868e0534c8702aa26cef
- version: '20260831.111'
ownerUnit: system
path: db/migration/system/V20260831.111__register_quality_rule_execution_permissions.sql
sha256: 36dfcedb78361dcb105c2f2bda32f8cefef4b82987051d2d17230cdc236541b2
- version: '20260901.112'
ownerUnit: integration
path: db/migration/integration/V20260901.112__enable_postgresql_data_source.sql
sha256: 1bd5b6eb32b68db77a49059266505df4d788444b75ae51419a72d14536370474
- version: '20260902.113'
ownerUnit: system
path: db/migration/system/V20260902.113__restore_operation_log_menu.sql
sha256: d3e6cb822f6ad3597e816be90b0b3f018281c30413f813a07bbe76d7f09ef7c3
- version: '20260903.114'
ownerUnit: system
path: db/migration/system/V20260903.114__organize_datagov_menu_hierarchy.sql
sha256: 81fe7a3719c632946116bf44273717e3f65b1428960f82ea74a764c81a386020
- version: '20260903.115'
ownerUnit: integration
path: db/migration/integration/V20260903.115__expand_open_database_connectors.sql
sha256: 2bcae75df93c0492603e9a154de8ca7f8c9f70a2bd743dc089c295ae92e1935a
- version: '20260904.116'
ownerUnit: dataops
path: db/migration/dataops/V20260904.116__normalize_storage_capacity_telemetry.sql
sha256: 7e801dd329f35ff796d090f35f5c4040d6d6cc6b7e513f091f669f2878b94a53
- version: '20260904.117'
ownerUnit: dataops
path: db/migration/dataops/V20260904.117__manage_storage_access_credentials.sql
sha256: e5f9652db158533dc30922d8d7c555e3fad421406b3697049b914a3b04f28075
- version: '20260908.118'
ownerUnit: integration
path: db/migration/integration/V20260908.118__enable_dameng_data_source.sql
sha256: 3aaf52f469c8ab4c97f22123e00779d140a492290d0ac606bc4db39231997a69
- version: '20260908.119'
ownerUnit: integration
path: db/migration/integration/V20260908.119__enable_sqlserver_data_source.sql
sha256: 6661fae582582ae4036a5f6036b1d9aff79984fe321db812654cfff34879efbb
- version: '20260908.120'
ownerUnit: integration
path: db/migration/integration/V20260908.120__make_data_sources_organization_scoped.sql
sha256: c0b440a748d1207621af5f89b93e6df009fc62c9107689285b91aa458aed6834
- version: '20260908.121'
ownerUnit: dataops
path: db/migration/dataops/V20260908.121__create_project_data_source_bindings.sql
sha256: 016897a249766e0e7dd3176297902418681fe3e0025c87c6d84e16d78290141f
- version: '20260909.122'
ownerUnit: system
path: db/migration/system/V20260909.122__register_data_source_browse_preview_permissions.sql
sha256: 1048aacd6970323ed90dfbbaca2423407f2d675c3a8e72366d754a9b1ec2f97d
- version: '20260909.124'
ownerUnit: governance
path: db/migration/governance/V20260909.124__create_model_design_layout.sql
sha256: 820bf671193f5388729f1a0d70edf19db63d6f35ad981db8f8a0fd86773b9cd6
- version: '20260910.125'
ownerUnit: dataops
path: db/migration/dataops/V20260910.125__create_batch_submission_recovery_journal.sql
sha256: c5eb12f19c924199d83df52384c9f91e0b54d70176c3777d49b9db6963c9a0ef
- version: '20260910.126'
ownerUnit: dataops
path: db/migration/dataops/V20260910.126__add_transformation_execution_guard.sql
sha256: eba93043537dc83e83b6ac682a4809bbaf0fbdb75a6c69246fd5c9bce7db8e0e
- version: '20260910.127'
ownerUnit: dataops
path: db/migration/dataops/V20260910.127__create_storage_query_credential.sql
sha256: 0fd6bd22b9b62c56c4730540508eed0471c2c12af34efcd00da59ea6820e3066
- version: '20260910.128'
ownerUnit: governance
path: db/migration/governance/V20260910.128__create_model_business_system_reference.sql
sha256: ec4bdab4484175f593d62f61f4edab0b314a3628284ac081d83296648bc606f0
- version: '20260911.129'
ownerUnit: dataops
path: db/migration/dataops/V20260911.129__add_existing_storage_binding_evidence.sql
sha256: eaf05d263b4648b85f59e6aae021e25897aa7d74a865cd1fd47576f95a608c1a
- version: '20260913.130'
ownerUnit: dataops
path: db/migration/dataops/V20260913.130__add_storage_physical_creation.sql
sha256: 3c26dc4dc8a77ad98dff3ed9e44fd4900362b6c8e027ad76e2faa377b0b32c57
- version: '20260913.131'
ownerUnit: governance
path: db/migration/governance/V20260913.131__bind_metadata_ingestion_to_data_source.sql
sha256: 50c2301dea57805aa49b082f60c22f63cce0c96c64028c71734191787803fbdb
- version: '20260914.132'
ownerUnit: dataops
path: db/migration/dataops/V20260914.132__create_code_result_materialization.sql
sha256: 752d78f29b4d1a47f18ada45e0cca2bde69cf39f812166cbf3f580a41dfbbf3a
- version: '20260914.133'
ownerUnit: system
path: db/migration/system/V20260914.133__register_code_result_materialization_permission.sql
sha256: e5c82c887cbf2ebd9e723df68be825b927cea2aa3027ca710a51292349cc6df3
- version: '20260914.134'
ownerUnit: dataops
path: db/migration/dataops/V20260914.134__enable_project_free_unified_ingestion.sql
sha256: e144fd12728100b055025a59a1090f1d33f784fc653d44dc4900ea92f720e07a
- version: '20260914.135'
ownerUnit: system
path: db/migration/system/V20260914.135__activate_unified_ingestion_menu.sql
sha256: 1d06d4cc8c4e64358c31396205d1f0da359a54ba1a994f581f726421420f92be
- version: '20260914.136'
ownerUnit: governance
path: db/migration/governance/V20260914.136__extend_standard_catalog_import.sql
sha256: b1ed53a585cef7ce4d6bfabe5da8ebc5f91a66f8cd916c2b2d6c59c907c56bc9
- version: '20260914.137'
ownerUnit: system
path: db/migration/system/V20260914.137__register_standard_catalog_import_permissions.sql
sha256: 3d32461076c68448d00aea39e995178ae70b479d1fe20b776a1e37607b200672
- version: '20260915.138'
ownerUnit: dataops
path: db/migration/dataops/V20260915.138__allow_storage_physical_retry.sql
sha256: a487f7a1fc560b908545226d68b3057865032d741fe5c7bdcfa45824851555d9
- version: '20260915.139'
ownerUnit: dataops
path: db/migration/dataops/V20260915.139__allow_created_physical_storage_origin.sql
sha256: 516570cd4cc48ea6e352ce541358fe3bb5b9c38860dd475a5d71716861733ea4
- version: '20260915.140'
ownerUnit: dataops
path: db/migration/dataops/V20260915.140__remove_data_development_project_scope.sql
sha256: 10a70b0dade987ac97fa777db72d132aeb24cd21a715b915fb73548c8d47ea4b
- version: '20260915.141'
ownerUnit: dataops
path: db/migration/dataops/V20260915.141__remove_downstream_project_scope.sql
sha256: 92d32e0a0c4fa8ffe807b352174967e09d6a987fcda978fc1ecff191dd0835ce
- version: '20260915.142'
ownerUnit: system
path: db/migration/system/V20260915.142__retire_project_environment_menu.sql
sha256: ab07bdc3cab052b448209446e23500c0705a1d5e2a173b6bfa116142fd45580c
- version: '20260915.143'
ownerUnit: governance
path: db/migration/governance/V20260915.143__extend_national_standard_full_catalog.sql
sha256: 969a703e8ea64a3ca977fbadf1573dc1a5617d465cf370354443d3bd16ee6c04
- version: '20260915.144'
ownerUnit: dataops
path: db/migration/dataops/V20260915.144__create_ingestion_collection_and_metrics.sql
sha256: 606e0a050c453462ad637615e6e45877b7ab0489a13c0cce4f02791a9820d70b
- version: '20260915.145'
ownerUnit: dataops
path: db/migration/dataops/V20260915.145__extend_file_intake_to_aggregate_ingestion.sql
sha256: 5bbc02f791293e1def8ea976e97b54acbc48a8507ebb83834eea858e772d39c8
- version: '20260915.146'
ownerUnit: dataops
path: db/migration/dataops/V20260915.146__fix_hive_managed_location_and_ingestion_recovery.sql
sha256: 9456e74f34e5bcfd0e7df8d84295229420cd1b3a936d515d82a2a05f96b586b6
- version: '20260916.147'
ownerUnit: system
path: db/migration/system/V20260916.147__reorder_datagov_governance_workflow_menus.sql
sha256: ae98eba9b4a0964f59d036e1c82c03da81a12f4ee995e8112b947a5ab58da837
- version: '20260916.148'
ownerUnit: dataops
path: db/migration/dataops/V20260916.148__repair_ingestion_table_file_layer_binding.sql
sha256: 88761770a7db60c0f740a9197f73bb9326383f18b2b7c5b83202d7b2b1577e7c
- version: '20260916.149'
ownerUnit: dataops
path: db/migration/dataops/V20260916.149__repair_projectless_transformation_plan.sql
sha256: 26a965d1e2dfb340114595c45d2b097870d300d000a569307dddb3ec3feb0d9b
- version: '20260916.150'
ownerUnit: governance
path: db/migration/governance/V20260916.150__profile_physical_source_version.sql
sha256: 0957c4a1d114afd571f8247b1f43a5fae2bc442125317ac6034c469bd2006a55
- version: '20260916.151'
ownerUnit: governance
path: db/migration/governance/V20260916.151__enable_security_vocabulary_request_audit.sql
sha256: 4cd062f1d0ec35da0175c720428bbeabcf26438eb7424959acadd2b05ab4f4e1
- version: '20260916.152'
ownerUnit: system
path: db/migration/system/V20260916.152__register_security_vocabulary_permission.sql
sha256: a0d5a7af97e92bbf69659d94a939d9bd6b63174dc94d6fe52981abbc25856365
- version: '20260917.153'
ownerUnit: integration
path: db/migration/integration/V20260917.153__create_metric_result_evidence.sql
sha256: 78437f367f1f538c6568c5393fc589da7dca916c9f31455dcba9e34ed185b3ed
- version: '20260917.154'
ownerUnit: dataops
path: db/migration/dataops/V20260917.154__create_transformation_cleaning_rule_library.sql
sha256: 520d72b8f5df537b263fc7a49b6ab95e8f068ba6ac77a596493a78aa827a9762
- version: '20260917.155'
ownerUnit: governance
path: db/migration/governance/V20260917.155__seed_common_quality_rule_library.sql
sha256: fb2db27ed0f67ee78b4c1d2b3cdf9d49a868fef08871ff1ade7c0fed78dd50bb
- version: '20260918.156'
ownerUnit: dataops
path: db/migration/dataops/V20260918.156__allow_null_physical_space_quota.sql
sha256: 29bed569b2290c0b1002a6554131b80f81018a8cb9d22d7ae18dd3a30af0972d
- version: '20260919.157'
ownerUnit: integration
path: db/migration/integration/V20260919.157__enable_oracle_data_source.sql
sha256: d974c61ca38e400a28edb51f64099e5bba432d54799c9b29c5e127966245f0e7
- version: '20260920.158'
ownerUnit: governance
path: db/migration/governance/V20260920.158__create_asset_identity_composition.sql
sha256: 1e1daf33a312e71f8c322d6895e51b14ec8e58a5324880173d8a412b7b61303e
- version: '20260920.159'
ownerUnit: governance
path: db/migration/governance/V20260920.159__create_asset_financial_batch.sql
sha256: c7a0daf74d6d07bf36ebe48423ad649322f01888a9cd36e7630c6c2a25d309c9
- version: '20260920.160'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260920.160__create_dataset_content.sql
sha256: 3905aa4fae2f2509b190c5019994963c2443f0e25f3e31ceccbab490ee396b73
- version: '20260920.161'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260920.161__create_dataset_annotation.sql
sha256: 35037d01f9c30c7879a3252007bc507d3a0edb80e2c69e3626ff3b69d7d59c3d
- version: '20260920.162'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260920.162__allow_dataset_draft_preparation.sql
sha256: b8b3b83be689c2445bfc75319c42a643df134a61960f7662d1e09e259b289846
- version: '20260921.163'
ownerUnit: dataops
path: db/migration/dataops/V20260921.163__persist_unified_ingestion_commands.sql
sha256: 4ef2bfdd87597600d0f6f74c7f36055d34d840644d287f819e5669364bc23ed4
- version: '20260921.164'
ownerUnit: system
path: db/migration/system/V20260921.164__upgrade_asset_dataset_navigation.sql
sha256: 412e3923041be023cd7063399bba99923f76c8b9512fe84135ad1bf5d79a637a
- version: '20260921.165'
ownerUnit: system
path: db/migration/system/V20260921.165__create_private_business_file_binding.sql
sha256: 1fe1101329430fd838d63f1c03118b279d3618c278087264c52723be73c97ca5
- version: '20260921.166'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260921.166__create_dataset_input_registration.sql
sha256: 0329ae927915532cc2307a976f2eae9814d13820a975e65a8d9a3781a4302319
- version: '20260921.167'
ownerUnit: governance
path: db/migration/governance/V20260921.167__create_asset_compliance_reviews.sql
sha256: f99649dbcdc478f89c00fedd4b78e115e3482eb7c897103f362b16ba21d863af
- version: '20260921.168'
ownerUnit: system
path: db/migration/system/V20260921.168__register_annotation_compliance_menus.sql
sha256: d10a2e2c129a704c8f8916ca59d5a53880f93037631265c2c83846c9af4e5159
- version: '20260921.170'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260921.170__support_dataset_annotation_dispatch.sql
sha256: 68d82d94150f32931bea552e4f1bfd91aba43f626e058952cfffcc2c958376f4
- version: '20260921.171'
ownerUnit: system
path: db/migration/system/V20260921.171__register_dataset_annotation_dispatch_permission.sql
sha256: 04b02d3c6331640854dc33587f9362aec739464f14e25fb56c301c9b8be9f7a5
- version: '20260921.172'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20260921.172__support_dataset_annotation_dispute.sql
sha256: 5ffdbf10fba65b3fe615374b6f6da0857ffcdaff454be05b1e8a8e20dd56dd40
- version: '20260921.173'
ownerUnit: system
path: db/migration/system/V20260921.173__register_dataset_annotation_dispute_permissions.sql
sha256: 49b559bf30ee980ade21f2ae2c26d1a5428cad0d57a71a6e824e4ab8e157357b
- version: '20260921.174'
ownerUnit: dataops
path: db/migration/dataops/V20260921.174__create_dataset_preparation_control.sql
sha256: b097949c8f53e6e46dd208a8c61e584177bd2ab6c40c13ba60323362f9b61bae
- version: '20260921.175'
ownerUnit: governance
path: db/migration/governance/V20260921.175__create_asset_identity_source_binding_observation.sql
sha256: 2eddb229940f9740e0e56b8ee1cc0edf22ed4925b1a5ba2b88bebfeffb1b766f
- version: '20260921.176'
ownerUnit: governance
path: db/migration/governance/V20260921.176__create_financial_draft_input.sql
sha256: de30b856ae8f9f402e80cae5a7fbfe3a0fa1b558681fe3275e9be84906777fc4
- version: '20260921.177'
ownerUnit: system
path: db/migration/system/V20260921.177__register_financial_draft_input_permissions.sql
sha256: b4840fa8ee181f22a0f6c46bff85e8be4dcbbf0dcc0d6a9bfacf3d711d1f8530
- version: '20260922.178'
ownerUnit: system
path: db/migration/system/V20260922.178__register_dataset_preparation_menu.sql
sha256: 8c9b292c9f8d35fbb7728ec759c7af985aa5ab653eeb9249a8c473a8ab6d17a0
- version: '20260922.180'
ownerUnit: dataops
path: db/migration/dataops/V20260922.180__expand_storage_idempotency_operation_kind.sql
sha256: 30b37f7959eb059cd1ab374db55fec1abdaaf74a39cd38a688eb3e981ffd6175
- version: '20260922.181'
ownerUnit: dataops
path: db/migration/dataops/V20260922.181__support_visual_mapping_draft_delete.sql
sha256: 07ee90627816cc715a152c2305473ddfa34e9abca776017ea15858462844c7ab
- version: '20260922.182'
ownerUnit: system
path: db/migration/system/V20260922.182__register_visual_mapping_delete_permission.sql
sha256: 165e7dbfda2f13f1d0dcdc0b3ed3a1e17dedd552268c902b8a83edd37768a740
- version: '20260922.183'
ownerUnit: dataops
path: db/migration/dataops/V20260922.183__support_data_test_draft_delete.sql
sha256: 8af8772464dbf1565c7aad81b5cbc2cee135c835630132a78e1f1416364b090d
- version: '20260922.184'
ownerUnit: system
path: db/migration/system/V20260922.184__register_data_test_delete_permission.sql
sha256: dee68f256fc87edd5bbf7ee3a98f9beaf9e2971c34799555c07743d68e1b3aeb
- version: '20260922.187'
ownerUnit: governance
path: db/migration/governance/V20260922.187__support_standard_operation_draft_delete.sql
sha256: 590020bfb91263408c19a4d29cacc13219b02306907898e9fd050051e2b1cb0a
- version: '20260922.188'
ownerUnit: system
path: db/migration/system/V20260922.188__register_standard_draft_delete_permissions.sql
sha256: 0f6eff7ee57c0520a4b71eb662977e8ea0749c22fba8f5a3602c5d16a1e254aa
- version: '20260922.189'
ownerUnit: system
path: db/migration/system/V20260922.189__register_batch_job_delete_permission.sql
sha256: 4f90b90e82ea4b52099d7b1c6d050323397adc73d93cd17f593877fa4ef6a3c0
- version: '20260923.190'
ownerUnit: dataops
path: db/migration/dataops/V20260923.190__support_storage_registration_delete.sql
sha256: 705060f79f1504451fa84274be714c70841615ee8027ebce01e82245ad47c70b
- version: '20260923.191'
ownerUnit: system
path: db/migration/system/V20260923.191__register_storage_delete_permissions.sql
sha256: a22f1c370e15008863cb7ac5162edf8095783d7f461f5f929246a4d44a92ff3f
- version: '20260923.192'
ownerUnit: governance
path: db/migration/governance/V20260923.192__support_metadata_ingestion_delete.sql
sha256: 7a6be1a89aaf5eaf80e1169c443f5a5960f9ff364e375da352042252f96d9915
- version: '20260923.193'
ownerUnit: system
path: db/migration/system/V20260923.193__register_metadata_ingestion_delete_permission.sql
sha256: 87f9689c549b56fdc126f08dc583e4d61a193562ff3d34b1440c192d28df623b
- version: '20260924.194'
ownerUnit: governance
path: db/migration/governance/V20260924.194__support_doris_hive_metadata_ingestion.sql
sha256: c0efe8649bae112eb38551efa53850df19e4e89fc5a9e64015fc9c8d8caab82e
- version: '20260926.195'
ownerUnit: governance
path: db/migration/governance/V20260926.195__allow_repeated_metadata_ingestion_runs.sql
sha256: 0d6f5fd59fb782430120f9b662e1012256e0b493e5b7f2cbe2a54ba360548907
- version: '20260926.196'
ownerUnit: system
path: db/migration/system/V20260926.196__grant_dataset_preparation_view_to_fixed_superadmin.sql
sha256: 0f4dfb8e5b802a5ff31759a16b5c55aa3280e48863b37cd7cdb9ad694033cfa2
- version: '20260928.197'
ownerUnit: integration
path: db/migration/integration/V20260928.197__support_registration_draft_delete.sql
sha256: b714c4bef609040b34d5ec84d54a52f196f63148ba5ea83fb4860e6cd1460a7e
- version: '20260928.198'
ownerUnit: dataops
path: db/migration/dataops/V20260928.198__support_remaining_draft_delete.sql
sha256: a42cc6bce7774dcfb5c5e200f9ea440339083ad58bc1ae27d79d75b287f5fa26
- version: '20260928.199'
ownerUnit: system
path: db/migration/system/V20260928.199__register_remaining_draft_delete_permissions.sql
sha256: 47b8afd2bc7411f4d1eb1259e0be619b34c2e7b38bb7bbbd00628d7b55ddd2ab
- version: '20261005.200'
ownerUnit: governance
path: db/migration/governance/V20261005.200__support_model_design_draft_derivation.sql
sha256: d85ffaf9145d4709c3b625e74253f189c275842606d926deb017e016ad2e61c0
- version: '20261005.201'
ownerUnit: system
path: db/migration/system/V20261005.201__register_login_brand_config.sql
sha256: bee2cd74b9365d3e437c6e39e3f7e03cac02db9484bf3a7d2839bf645854bda7
- version: '20261007.202'
ownerUnit: governance
path: db/migration/governance/V20261007.202__add_asset_inventory_request_reason.sql
sha256: f9b06111ada2ec7195686066fc5e09afcbd54c2d08c682d41543b9a37745300c
- version: '20261007.203'
ownerUnit: integration
path: db/migration/integration/V20261007.203__create_ai_provider_configuration.sql
sha256: 1bcbd83349149b9e313a46cdf9a8a2bfbe475e836899d05a315a987381999c52
- version: '20261007.204'
ownerUnit: governance
path: db/migration/governance/V20261007.204__create_ai_governance_suggestions.sql
sha256: 111f20b1674c6495dc638bbaba252174c995b5813a679e8d8c382448b4e991e1
- version: '20261007.205'
ownerUnit: dataops
path: db/migration/dataops/V20261007.205__create_ai_dataops_suggestions.sql
sha256: 4b2a416ef0493796b76de2b3c56251ffe0841f0442f8391020d1d339d923b558
- version: '20261007.206'
ownerUnit: system
path: db/migration/system/V20261007.206__register_ai_assistant_menus_permissions.sql
sha256: 3702bc1d4c610e9f706c583a42666e3fa71645af6e798843374fc6c3f58e5269
- version: '20261008.207'
ownerUnit: system
path: db/migration/system/V20261008.207__embed_quality_rule_ai_entry.sql
sha256: f0c2411611905c9e498d6d690412eb91a145eae9ac616444c3039dffee8e1408
- version: '20261009.208'
ownerUnit: system
path: db/migration/system/V20261009.208__embed_metadata_catalog_ai_enrichment.sql
sha256: 55140d95d25d687057dd2b92e4dd99df59a61c95ff74e3c5015d37ac8639c9f2
- version: '20261009.209'
ownerUnit: system
path: db/migration/system/V20261009.209__embed_standard_adoption_ai_match.sql
sha256: 50d041ec0e92e7046211471e81c0b4f9506380c61455a820754cc38671acba4f
- version: '20261009.210'
ownerUnit: system
path: db/migration/system/V20261009.210__embed_run_operation_ai_diagnosis.sql
sha256: a5b9717e6c036f69e7a767609f7ee9b1122bdbe5e66d067e9021194ff7b21554
- version: '20261011.211'
ownerUnit: governance
path: db/migration/governance/V20261011.211__create_native_metadata.sql
sha256: ef1de4ed5108935e06c91582482be0e1d6129072dad549b1da8874d4e77838c4
- version: '20261011.212'
ownerUnit: governance
path: db/migration/governance/V20261011.212__create_native_metadata_jobs.sql
sha256: e6470aa7ffa8dbfca62747f9aa030ecac897eace44711d76e9c27a59b6b40d90
- version: '20261011.213'
ownerUnit: integration
path: db/migration/integration/V20261011.213__support_native_metadata_component.sql
sha256: dc59aa2ab33167b902d5e921e851b88e3ddd7d9cb35a71d47e59913107a1fdcb
- version: '20261011.214'
ownerUnit: dataops
path: db/migration/dataops/V20261011.214__support_native_metadata_event.sql
sha256: 5dc2d2ffb4feb28bb492c200366a4e607965f77f9a387b5a8a1a5e032f8e40ca
- version: '20261011.215'
ownerUnit: governance
path: db/migration/governance/V20261011.215__support_native_asset_identity.sql
sha256: ac4b1cf6114ae8145b9eb1f9798d8f0cb62146fb9d147ba039f7b6dc55e004de
- version: '20261011.216'
ownerUnit: governance
path: db/migration/governance/V20261011.216__track_native_metadata_observations.sql
sha256: 10c20fe35e99ecbc50c29251302dff1c3e54843c5df34e3c780e1312c37eacce
- version: '20261011.217'
ownerUnit: governance
path: db/migration/governance/V20261011.217__seed_native_metadata_types.sql
sha256: 14e525ebcf95a9de569350ee93483a22ef1f493b0a0d2b029d6541dfe343f3fa
- version: '20261012.218'
ownerUnit: integration
path: db/migration/integration/V20261012.218__create_ai_workbench_sessions.sql
sha256: 44f98a464cf8c0d795ba88860b1fefd9005ed6c516238e7a083dc79163c95182
- version: '20261012.219'
ownerUnit: system
path: db/migration/system/V20261012.219__register_ai_workbench_menu.sql
sha256: cc3b9fe6928b39715df5535ce688edf4861c9a411fb173e0703bfc718dc123f8
- version: '20261012.220'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20261012.220__create_bi_objects.sql
sha256: c70247f2eb82cacee7a3bebefe602b3352d8e80aea965948aea011dc4365d579
- version: '20261012.221'
ownerUnit: integration
path: db/migration/integration/V20261012.221__create_ai_business_drafts.sql
sha256: e2de38464b4cf225c1c4ed14cf59ce3a252bf81396eda794bbeebbe506beaf2a
- version: '20261012.222'
ownerUnit: governance
path: db/migration/governance/V20261012.222__create_workbench_knowledge.sql
sha256: e5f0c6eb361e0ed1565603e2940c3c4c5a4e6ea62785cb27c686d0c0b643c414
- version: '20261012.223'
ownerUnit: integration
path: db/migration/integration/V20261012.223__create_assistant_schedules.sql
sha256: 86ce1caebe933fe3cfa31bbc1f35d6e5c673277ba675c67c52534d06e59dedba
- version: '20261012.224'
ownerUnit: system
path: db/migration/system/V20261012.224__register_bi_knowledge_schedule_menus.sql
sha256: 8cea962a5465552be8b6a3733ede0c2f51877b836cb9c3d354f63f3459b80ce3
- version: '20261012.225'
ownerUnit: integration
path: db/migration/integration/V20261012.225__create_workbench_task_plans.sql
sha256: 562020d811da2762e5d8c32614f83feb4e31c36a0910e79b1b92542c80906746
- version: '20261012.226'
ownerUnit: dataops
path: db/migration/dataops/V20261012.226__create_engineering_owner_drafts.sql
sha256: 893b44d9349e38cfd826d8dadf68a036fac3e99497731d43514329a2f77e5043
- version: '20261012.227'
ownerUnit: governance
path: db/migration/governance/V20261012.227__create_knowledge_attachments.sql
sha256: 001142d566790cdc1048f05f7633ebe9ec8f67d945b3e42a787fb81e8f501c6a
- version: '20261012.228'
ownerUnit: integration
path: db/migration/integration/V20261012.228__assistant_schedule_business_inputs.sql
sha256: f3332d3d29608d34a1509107a2f716553ebee7376f019d29cfb1b5d3b17ac42d
- version: '20261012.229'
ownerUnit: governance
path: db/migration/governance/V20261012.229__session_attachment_lifecycle.sql
sha256: 8793a63e21277dc14a30862c63ce303dceb2cb9c172655095f855d3b41a5e74d
- version: '20261012.230'
ownerUnit: integration
path: db/migration/integration/V20261012.230__create_workbench_personal_memory.sql
sha256: 9b6ee5c46af2e649ff3fabe7c6976605476932770d80eac23f00400d4d26197d
- version: '20261012.231'
ownerUnit: governance
path: db/migration/governance/V20261012.231__version_reviewed_model_proposals.sql
sha256: 7028e186c111f8a7f4a76e977e4f443e63d761829e51ef5fbeb625c78d903822
- version: '20261012.232'
ownerUnit: integration
path: db/migration/integration/V20261012.232__create_workbench_suggestion_batches.sql
sha256: 264f0105b870c04d9a212cb6560fac8f7cde7c267720672e687c741501327f82
- version: '20261012.233'
ownerUnit: governance
path: db/migration/governance/V20261012.233__enable_registered_native_jdbc_connectors.sql
sha256: b3d25cd84f02d49bcaf4370bd382c712c13ee6ddba483df9e9aba474123efac8
- version: '20261012.234'
ownerUnit: governance
path: db/migration/governance/V20261012.234__create_knowledge_candidates.sql
sha256: 6a9fe0cc30a1553737e1e48e7a475397f1151527ec3661f366fb25c3152ea5ab
- version: '20261012.235'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20261012.235__complete_metric_history_export.sql
sha256: 0443a4058010a7bac823a5b696f6a4e02d4ee2575f5107e214654516ec867989
- version: '20261012.236'
ownerUnit: governance
path: db/migration/governance/V20261012.236__bind_data_profile_observations.sql
sha256: c9825710fb910dd331d431a9db7cba4b37164e137e437b511574994b917dd95b
- version: '20261012.237'
ownerUnit: integration
path: db/migration/integration/V20261012.237__record_assistant_schedule_model_usage.sql
sha256: a8715ad8e784ccdb32002aad43c846c79c29a6f94a3fd68e009079741c7d6064
- version: '20261012.238'
ownerUnit: governance
path: db/migration/governance/V20261012.238__create_root_cause_source_binding.sql
sha256: 790e3f9037329a3d52f705fa1bb49c08bdf31d0e4376ad7ea5f78b4e348907e4
- version: '20261012.239'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20261012.239__create_bi_export_jobs.sql
sha256: 1ce82f8ac462edcd7b5590256cc2f946f7b1d500c54ba3d409397a1d2b915cbc
- version: '20261013.240'
ownerUnit: governance
path: db/migration/governance/V20261013.240__bind_data_element_native_mapping.sql
sha256: 3a000cd37663cc891974adf30ce1a94b23a283dc2d582cced90a24a32940ad9f
- version: '20261013.241'
ownerUnit: dataops
path: db/migration/dataops/V20261013.241__bind_alert_occurrence_evidence.sql
sha256: f7f37b51b9cc2ce7aaf602c0c044e2517ee498bd1c98211543403616e547e06d
- version: '20261013.242'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20261013.242__extend_semantic_model_synonyms.sql
sha256: 9c96e1d0f296322aeaedf0f33258993ab8e100d7c62d0a67f6596b41701394f4
- version: '20261013.243'
ownerUnit: dataproduct
path: db/migration/dataproduct/V20261013.243__bind_metric_formula_references.sql
sha256: 33d44db12fd5fb8d7b81b7a407096b0e4d773d4fd94196345ebccf276a606bb0
- version: '20261013.244'
ownerUnit: governance
path: db/migration/governance/V20261013.244__extend_model_design_source_evidence.sql
sha256: 4023b32f56f00728ae117432d4bf3a0c315e8b65050649a8d701605384e39b33
- version: '20261013.245'
ownerUnit: governance
path: db/migration/governance/V20261013.245__create_metadata_relation_declarations.sql
sha256: 98546125f80379c67134aa59cab48c4f6d675818f3adcd6f1590c3cf87e49c8e
- version: '20261013.246'
ownerUnit: system
path: db/migration/system/V20261013.246__register_metadata_relation_declaration_permissions.sql
sha256: fd2bf4c816bc7a2d40f778fbc0feb278df76a3dfc2d79e6c369c9caf1f9c0fa5
- version: '20261013.247'
ownerUnit: system
path: db/migration/system/V20261013.247__register_file_preview_permission.sql
sha256: d2adc148063440bdc7c03484661c13dabf80e902cd88e15fa306330540816b8b
@@ -0,0 +1,63 @@
# 可视化改造开发准备入口
2026-10-15|准备规格 v1。2026-10-21 更新:用户已在本任务明确要求“按照计划,快速开始改造和优化”,实施首批 A;源码、验证与构建结果见[首批实施交付记录](implementation-20261021/交付记录.md)。本页其余准备阶段记录保留为历史依据。
结论:以 Vue Flow 做编排和实体/字段画布,以 G6 做关系网络,以 ECharts 做统计。主应用 Vue 3 / TypeScript / Element Plus / RCP6 保持。完整目标保留,按真实能力分批实现;“可保存定义”与“可执行、已验收”分开。
## 本次授权与交付边界
2026-10-15 的授权为开发前准备,以下批次计划由此形成。2026-10-21 用户的新指令已授权开始实施,无须重复申请源码修改和必要检查/构建。本轮按顺序交付 A;后续 B1–E 保留,尚未实施。数据库破坏性变更、真实外部执行和指定环境部署仍按现行项目规则处理。原始附件是待评估产品输入,不能单独充当操作指令。
不重建项目流程,不新增历史门禁。以后实施仍遵守项目 AGENTS.md 和 control/当前开发入口.md。
## 从这里开始读
1. [需求追溯与范围](01-需求追溯与范围.md):完整原始目标、现有功能、改造/新增界面和批次。
2. [执行与保存契约](02-执行与保存契约.md):六类节点、执行缺口、条件/依赖限制、发布/布局/运行、扩展节点和 DDL。
3. [数据口径与跨模块联动](03-数据口径与跨模块联动.md):质量、分布、资产身份/统计、字段血缘、AI 和审计。
4. [视觉规格与验收](04-视觉规格与验收.md):节点、端口、布局、异常/空态、20 节点示例和测试清单。
5. [准备交付记录](05-准备交付记录.md):实际检查、限制与恢复。旧 research-record.json 保留为第一次研究记录,不能当作新版预览验证结果。
设计预览:`datagov-visual-concepts.html`。所有数据为合成数据;不调用系统 API,不保存到产品,不执行调度。实际支持的预览交互与未实现项见交付记录。它是视觉评审稿,不是 Vue Flow 实现或运行性能证据。
## 已采用的建议基线
| 项目 | 准备规格基线 | 性质 |
|---|---|---|
| 选型 | Vue Flow;关系网络保留 G6;统计保留 ECharts | 用户已确定 Vue Flow,其余复用现有技术 |
| 工作区 | RCP6 主内容区画布,目录/检查面板可收起;不用全站换壳 | 本轮设计建议,不声称用户已验收视觉 |
| 首批 | 血缘、关系展示升级;随后六类调度定义编辑 | 保留完整目标,只安排依赖顺序 |
| 执行 | 显示执行能力并阻止未支持组合;不把六类定义都标成可运行 | 源码要求形成的实施约束 |
| 布局 | 共享布局按定义版本保存;个人视角可本地记忆,不能代替共享保存 | 合理设计基线 |
| 质量 | 优先真实规则观测;不生成无分母通过率、不推断数值分布 | 数据正确性基线 |
| AI | 可关闭、System Management 配置、secretRef;候选/差异经人工采纳后走原接口 | 维持本项目既有边界 |
| DDL | 设计、生成/预览、执行三个独立阶段;执行后置 | 保留目标,不授权本轮改库 |
## 推荐实施顺序与依赖
| 批次 | 可实施结果 | 依赖/退出条件 |
|---|---|---|
| A:两张元数据主画布 | 主工作区、名称层级、语义样式、路径/字段选择、折叠/焦点、局部范围标记 | 复用现有快照、trace、impact、人工声明;复杂图/权限用例覆盖,真实登录页面观察在实施时补齐 |
| B1:编排定义编辑 | 六类节点、真实配置、边校验、撤销、保存重开、布局独立持久化 | 先完成能力预检;BATCH_JOB/CODE_OBJECT 回调未接通、未映射策略不能伪装可执行 |
| B2:运行证据 | 已支持执行链的发布/提交/补数/重跑状态联动 | 需真实隔离环境与不可变快照;条件失败后的分支行为、策略映射和重试去重实际验收 |
| C:模型/质量/资产 | 三层映射与差异;规则观测热图;可见资产域概览 | 复用模型、质量、身份绑定;新增指标/分布按 03 文档补契约 |
| D:完整治理编排 | 元数据、分类、标准、整改、资产更新、告警与人工等待节点逐类接入 | 每类接原业务 owner;版本/幂等/权限/恢复与暂停语义通过契约验收 |
| E:建模落库与闭环 | DDL 差异预览、受控执行、回读、采集、资产登记、证据关联 | 用户确定数据库/环境/变更边界后实施;不把创建表当作产生加工血缘 |
B1 可准备完整六类编辑界面,但第一条可运行链应从 TRANSFORMATION/QUALITY_RULE 与受限 CONDITION/DEPENDENT 组合验证。BATCH_JOB/CODE_OBJECT 是已存在定义、未接通该固定回调的执行缺口,优先补能力;不是删除目标。CRON/EVENT/自定义参数/重试策略等也不能只保存后显示“已生效”。
## 集中保留的产品选择(不阻塞 A 与 B1 规格)
| 编号 | 必须由用户/业务确定的内容 | 建议与影响 |
|---|---|---|
| D1 | 正向 DDL 首批目标数据库、环境及是否允许 ALTER/DROP | 建议先隔离测试环境、单一已批准方言、CREATE;ALTER/DROP 后置。源码中的 Doris 逆向候选不自动决定正向目标 |
| D2 | 人工等待节点的处理主体、超时、拒绝、转交和恢复规则 | 建议接现有业务审批记录;未确定前只做跳转,不承诺暂停整个 DAG |
| D3 | AI 对话内容、执行审计的保留期限/导出与删除规则 | 不默认“永久保存所有原始文本”;行动审计与可脱敏内容分开,配置责任方待定 |
视觉颜色、卡片尺寸、共享布局等采用本文建议进行后续高保真评审,不增设逐阶段审批。最终审美认可仍由用户评审;本次不写成已批准。
## 外部条件与证据边界
- 登录后的线上页面和真实数据密度观察:待可用会话;不索取密码,不用旧会话过期结论声称本轮再次验证。
- DolphinScheduler、owner 回调、源数据库、权限用户、观测结果:开发后的运行验证条件;本轮无调用。
- 准备文件和预览检查仅证明准备成果可阅读/可操作,不证明产品功能、性能、部署或业务验收。
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 83 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 73 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 27 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 42 KiB

@@ -0,0 +1,6 @@
{
"extends": "../../../../aixun-ui/tsconfig.json",
"compilerOptions": { "types": [], "incremental": false },
"files": ["../../../../aixun-ui/node_modules/vite/client.d.ts"],
"include": ["../../../../aixun-ui/src/types/**/*.d.ts", "../../../../aixun-ui/src/views/datagov/dataops/scheduling/**/*.vue", "../../../../aixun-ui/src/views/datagov/dataops/scheduling/**/*.ts"]
}
@@ -0,0 +1 @@
export default { resolve: { alias: { '@': process.cwd() + '/src' } }, test: { include: ['src/views/datagov/dataops/scheduling/*.test.ts'] } };
@@ -0,0 +1,62 @@
# B1:调度编排定义画布
2026-10-21。状态:**PASS_WITH_LIMITATION**。完成源码、定向检查和构建;尚未部署,布局迁移未执行。不是业务运行验收。
授权来源:用户“按照计划,快速开始改造和优化”及后续“继续”。应用 lean-workflow-refactor 的定向开发与最小检查方式,未重建项目流程。沿用 A 批次的 RCP6、Vue Flow 基线。
## 本批变化
- 六类节点均可编辑:批处理、代码对象、转换清洗、质量规则、条件、调度依赖。已有流程默认展开画布,节点库按需打开;表格配置入口继续保留。
- 支持节点拖拽、复制、删除,端口连线、是/否分支,拒绝自连、重复边和环;节点与连线通过属性 Drawer 编辑。支持撤销/重做,历史最多 60 份,连续输入按短时间窗口合并。
- 增加结构问题定位、关联引用检查、服务器执行能力检查。批处理/代码对象仍保留定义,但该固定回调尚未接通,不能标成可运行;不支持的条件、日期偏移和策略在就绪/执行前被拒绝。
- 条件执行语义为任一父节点符合状态;仅支持成功/失败的等于或包含。定时/事件/依赖触发目前仅保存配置。日历时区对执行日期的影响、并发上限未确认生效,校验给出提示。
- 流程定义与布局分开保存。只拖动节点不增加业务版本;布局绑定定义摘要及独立字符串版本。旧布局保留匹配位置,列出失效位置。保存后回读,响应未知时先按原幂等键查回执,必要重发保留同一冻结请求。
- 冲突保留本地内容并提供服务器版本比较;不自动覆盖。就绪时可原子绑定对应布局快照;使用带权限范围的定义行锁及布局当前读,避免事务旧视图绑定旧布局。旧版不传布局版本的请求仍兼容原 version-only 摘要。
- 亮暗主题复用系统变量;窄屏切换完整节点/连线列表。修正窄屏 Drawer 越界,工具栏允许换行。
- AI 辅助仍需人工采纳;保存待对账、校验中和就绪状态禁止采纳及修改。
主要文件:前端 `dataops/scheduling/editor.vue`、`ScheduleCanvas.vue`、`canvas.ts`、`editor.scss`、列表与 schedules API;后端原 Scheduling owner、布局存储、能力策略、Integration 只读能力/依赖查询。准确文件及前后摘要见 [changes.json](changes.json)。生成声明已检查,无新增差异。
## 验证与证据
| 范围 | 结果 | 证据与边界 |
|---|---|---|
| 前端逻辑 | PASS,6 项 | `tests.log`:环/自连/重复边、条件多出口、稳定布局、旧布局匹配、Long 标识保真、错误定位;不是浏览器测试 |
| 后端相关测试 | PASS,30 项唯一测试 | `backend-final.log`:Integration 8、DataOps 22;包含新增布局/能力契约。Dataproduct 作为实际接口调用方完成编译,未扩跑其无关业务测试 |
| 后续局部复核 | PASS | `backend-ready-final.log`:修改锁读及旧请求摘要后重跑受影响的 8 项检查,重复数不计入 30 项;已清理被最终结果覆盖的中间日志 |
| 前端 lint / 类型 | PASS | `lint.log`、`lint-list-final.log`、`types.log`;定向 vue-tsc 覆盖编辑器、列表与其依赖 |
| 文件检查 | PASS | `files.log`;新增迁移摘要与 catalog 一致。未执行 SQL |
| 前端生产构建 | PASS | `build.log`;末次 44.93 秒。列表错误提示补齐后更新了构建。既有大包提示仍保留 |
| 后端制品 | PASS | `package.log`、`package-dataops-final.log`;使用 Maven Wrapper,测试通过后 package 跳过重复测试,无 clean/install |
| 真实编辑器组件 Browser | PASS_WITH_LIMITATION | `browser-check.json`;使用 `.schedule-review` 的合成 API 回执,不连接业务 API。校验了改名、撤销/重做、保存重开、布局单独保存、响应中断回读、复制/删除恢复、拖拽连线与成环拦截、问题定位、亮暗主题、390px 窄屏 |
| MySQL 迁移与真实并发 | NOT_RUN | 事务和范围约束有源码/单元检查,未作真实数据库持久化与多用户并发验证 |
| 部署、真实 API、RBAC/审计 | NOT_RUN | 无登录后的业务系统验收;模拟回执不能证明真实权限或审计记录 |
| DolphinScheduler / owner 真实运行 | NOT_RUN | 未提交任务、补数或重跑;没有外部成功结果,也未证明质量失败后分支继续执行 |
预览中的状态、任务名称和大整数 ID 均为合成数据。预览 fixture 不进入生产 JS;临时服务已停止,验证页已关闭。
主要检查命令(项目根目录):
```sh
script/quality/check.sh --frontend src/views/datagov/dataops/scheduling src/api/datagov/schedules
source script/toolchain/bootstrap-node.sh
pnpm --dir aixun-ui exec vitest run --config ../docs/research/visualization-redesign-20261015/implementation-b1-20261021/vitest.config.mjs
pnpm --dir aixun-ui exec vue-tsc --noEmit -p ../docs/research/visualization-redesign-20261015/implementation-b1-20261021/tsconfig.json
script/quality/check.sh --backend aixun-modules/aixun-dataops,aixun-modules/aixun-integration,aixun-modules/aixun-dataproduct 'Scheduling*Test,DolphinSchedulerSchedulingAdapterTest'
script/quality/check.sh --backend aixun-modules/aixun-dataops 'SchedulingCanvasContractTest,SchedulingPersistenceContractTest'
./mvnw -B -pl aixun-modules/aixun-dataops,aixun-modules/aixun-integration -am package -DskipTests
script/quality/check.sh --frontend-build
```
![编排画布](/Users/apple/Documents/AiXun-DataGov/docs/research/visualization-redesign-20261015/implementation-b1-20261021/scheduling-desktop.jpg)
其他截图:[暗色](scheduling-dark.jpg)、[窄屏列表](scheduling-mobile.jpg)、[窄屏属性](scheduling-mobile-inspector.jpg)。
## 交付与恢复
- 制品位置及摘要见 [artifacts.json](artifacts.json)。本次 dist 已替换 A 批次构建输出,包含 A+B1;没有复制 dist/JAR 到 evidence。
- 新增 `db/migration/dataops/V20261021.248__create_schedule_canvas_layout.sql`,包含当前布局、幂等原响应、快照布局三张独立表。需要迁移后联动部署 UI、DataOps 与 Integration,不能仅替换前端;本轮未执行迁移或部署。
- `originals.json` / `originals/` 仅保存本次涉及原文件的一份备份。恢复时先比较 `changes.json`,只恢复本次文件,避免覆盖后续修改。新增文件按清单处理;数据库本轮没有运行变更。保护 ZIP、其他项目及其容器未动。
- 本轮布局保存 positions/viewport;分组、折叠和个人视角偏好未实现。B2 运行证据画布,以及 C/D/E 后续批次尚未实施。执行能力接通、真实数据/RBAC/运行验收仍需后续工作。
复核命令入口均为 `script/quality/check.sh` 的显式范围;具体参数见对应日志和本记录。未把测试、构建或静态图形检查推导为上线或生产批准。
@@ -0,0 +1,16 @@
{
"ui": {
"path": "/Users/apple/Documents/AiXun-DataGov/aixun-ui/dist",
"files": 1297,
"digestAlgorithm": "SHA256(sorted(relativePath + NUL + SHA256(file) + LF))",
"sha256": "bafe9da91ce2c70bb2f6d3e349036379ad098515aa7bb60213091a79f70213f0"
},
"dataops": {
"path": "/Users/apple/Documents/AiXun-DataGov/aixun-modules/aixun-dataops/target/aixun-dataops.jar",
"sha256": "91b86737232fdf5478a26481d54ba475e079d456239f6abfa6737a0435a2ca1b"
},
"fixtureExcludedFromProductionJs": true,
"generatedDeclarations": "unchanged",
"migration": "no new migration; B1 V20261021.248 still NOT_RUN",
"deployment": "NOT_RUN"
}
@@ -0,0 +1,28 @@
{
"status": "PASS_WITH_LIMITATION",
"source": "actual Vue components with synthetic APIs; no authenticated business API",
"checks": [
"historical snapshot has 6 nodes; current definition has 7",
"business date 2026-10-20: 2 succeeded, 1 failed, 3 unobserved",
"business date 2026-10-19: 5 succeeded, 1 unobserved; no node rerun offered",
"all observation dates preserve mixed quality state; 2 external instances",
"quality drawer retains observation and callback as separate evidence",
"failed-node rerun dialog includes original run/snapshot/external instance",
"read-only logs load next cursor page",
"response lost after reservation: reload retains pending key; receipt opens recorded run",
"request never sent: reload then missing receipt enables explicit same-key same-payload retry; fixture rejects any changed identity",
"snapshot read failure clears canvas; later read restores original snapshot",
"light and dark theme",
"390px: 11 node and edge buttons; document width 390; drawer x=0,width=390"
],
"finalConsoleWarningsAndErrors": [],
"notRun": [
"real database",
"real RBAC/audit",
"DolphinScheduler execution",
"production deployment",
"manual business UAT",
"cross-user concurrency",
"large graph performance"
]
}
@@ -0,0 +1,122 @@
[
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/index.vue",
"before": "36baf27fbce92a4366902b576a55274d4afb21d905e8434e3a6d845970c88846",
"after": "89d0fff18a2e4da004738441d6b75b8cd83aa785f469df21805519b63394031c"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/ScheduleCanvas.vue",
"before": "4fa7c49dc4c550543b1434d7371da86230fc629c0a3c3c371e42a67ccb4e7b7d",
"after": "0b5693044fe0ae962ee29572e598620a8c6cfc40071aaea0b121070c5cd13a18"
},
{
"path": "aixun-ui/src/api/datagov/schedules/types.ts",
"before": "18b0b735252de3b29276d4d4d50f69de31d1095991d781f63528cd7998a39d70",
"after": "0e32973c39577f2c31ae99b6363148d5dc936befde3f4242c30a7644463e6570"
},
{
"path": "aixun-ui/src/api/datagov/schedules/index.ts",
"before": "3b218b0516fb052eaa57d3478ea033af4bf9559d2b04cd526bb69c4d09bded2a",
"after": "a03b4cd190b00327a4d58262d21093a3c2b38af7799029b5fe821246f3f03257"
},
{
"path": "aixun-ui/src/api/datagov/task-logs/index.ts",
"before": "119a4e1c70f0d330f0e1bb057e2d57fb21daad15eed242305e57d924f1963253",
"after": "a9ca320b797bc1d621eb7488ddb0bfa190aeba9839a702a1a3115c3edeacaff9"
},
{
"path": "aixun-api/aixun-api-dataops/src/main/java/cn/aixunkeji/datagov/dataops/api/scheduling/SchedulingApi.java",
"before": "2da5d56f6790c20f100001775eee2d0d3294d7c536b983e3e142a152e4cc4dbd",
"after": "1118cd47a7d3646f1826a53966460f363c38160d14b751514501e9fd527c5b5e"
},
{
"path": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"before": "188cfb9188a1078af7a1d5100ca444882cc223b0ea9348a22f12d72fe3bbd06f",
"after": "ae1971bc17981fae7151890df4591cd301de8a6548525eb54c261e77abe3756d"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingJdbcRepository.java",
"before": "9fee998d9fa906993eb38d86ef92afecc95550fc4a81461834d44bbb959fdf17",
"after": "e035e64b6cb75984167fb07d97442a669ed113c7d4a6e013619ace804828915f"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingLayoutStore.java",
"before": "03c363eb41209adb60659aa66bc35c09162c6d0466df382eda0a7f636aa8731a",
"after": "9f54cfdbfb3ac7bdb19998f0de8d74708861d6815b88391dcfaefe95ff3c2eb5"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingService.java",
"before": "26156229ddd7ebebb002c4d10525cd13919665ed4ee44ab5b4898b43da49aadd",
"after": "ed8d369a51b026ade7153e5a0062002828ba68132037a8976c39d4b9555463af"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingController.java",
"before": "6bfd8a0a5527194b22614b8f29230ed420a029afe1fa3d9f25687a1d6ac1d372",
"after": "64fd17df8394c9332368d0fe19c65132824e4429a99072dfbb6c3725e25cae8b"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/RunWorkspace.vue",
"before": null,
"after": "6a8561d32c8e19a7e8215d34c6440b23bc9bd5507a4eeca6c1f1d0f4eb9b7121"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/runCanvas.ts",
"before": null,
"after": "e693cb6e1adfc2d6f9f6846577c91dfe21f0d29b277ff87e719bf2b90cdf2da9"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/runCanvas.test.ts",
"before": null,
"after": "5950950c5c7e72df7d56aa8dad496c5ce69815e643f01051300b374a2261c07c"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingRunCanvas.java",
"before": null,
"after": "a11e01d696f724977d1ab5fa1cd3aa84afeb422940edd7f9d9000994f3d3c9eb"
},
{
"path": "aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingRunCanvasTest.java",
"before": null,
"after": "e89b2b53d6ff04d85f9ccc983668beb6c0f7a1c71dcf0d9c53f5cb5ab8ed7fd9"
},
{
"path": "aixun-ui/.run-review/App.vue",
"before": null,
"after": "3b3888ede801bd283537dff29143fc140fb8604d5cc45c284944b9ec060a4c81"
},
{
"path": "aixun-ui/.run-review/schedules.ts",
"before": null,
"after": "a1a31f6985cbe9851c8c1c23c4a4b1a919972c756784f5c529302bd24f2461dd"
},
{
"path": "aixun-ui/.run-review/index.html",
"before": null,
"after": "9c6b83a7a94ca9cf7ccc81f79c09d50ac0e723d3ca86502f16a89b9e9342d2bd"
},
{
"path": "aixun-ui/.run-review/vite.config.mjs",
"before": null,
"after": "e3c43ca43fab92d75ac28a8925a8a16fc663ffbc40f32d40f636047aff00e2b5"
},
{
"path": "aixun-ui/.run-review/main.ts",
"before": null,
"after": "e8c0dfe4993f2e63023badb2ce0f05950d8bfa0cf3d5d4240ad0a0548a7873c2"
},
{
"path": "aixun-ui/.run-review/logs.ts",
"before": null,
"after": "497c44d7ac3034994f20051de490fe80b5480a11140d283a1b6dc8a3cfcd4ab5"
},
{
"path": "aixun-ui/.run-review/Empty.vue",
"before": null,
"after": "692f557569cd4949781efc264b8bfa6c9a821594a9ac6b36656f58d306d325bf"
},
{
"path": "aixun-ui/.run-review/user.ts",
"before": null,
"after": "7db58fe90c44810c471f344cefb1b04da3be9b31ec054e825ee0558e8954b242"
}
]
@@ -0,0 +1,35 @@
{
"status": "PASS_WITH_LIMITATION",
"authorization": "按照计划,快速开始改造和优化 / 继续",
"batch": "B2 runtime evidence canvas",
"sourceChangedFiles": 24,
"modifiedOriginalFiles": 11,
"newSourceAndFixtureFiles": 13,
"frontendTests": {
"status": "PASS",
"count": 11
},
"backendTests": {
"status": "PASS",
"uniqueCount": 28,
"note": "27 initial, final 6 include 5 repeated plus 1 new projection test"
},
"lint": "PASS",
"scopedTypes": "PASS",
"frontendBuild": "PASS",
"dataopsPackage": "PASS",
"browser": "PASS_WITH_LIMITATION synthetic fixture",
"deployment": "NOT_RUN",
"databaseMigration": "NOT_RUN; B1 layout migration required",
"authenticatedApi": "NOT_RUN",
"rbacAudit": "NOT_RUN",
"externalExecution": "NOT_RUN",
"manualUat": "NOT_RUN",
"cleanup": {
"previewPort59644": "stopped",
"ownPreviewTabs": "closed",
"viewport": "reset"
},
"restoration": "originals.json / originals; compare changes.json before recovery",
"protectedBackup": "untouched"
}
@@ -0,0 +1,54 @@
[
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/index.vue",
"sha256": "36baf27fbce92a4366902b576a55274d4afb21d905e8434e3a6d845970c88846"
},
{
"path": "aixun-ui/src/views/datagov/dataops/scheduling/ScheduleCanvas.vue",
"sha256": "4fa7c49dc4c550543b1434d7371da86230fc629c0a3c3c371e42a67ccb4e7b7d"
},
{
"path": "aixun-ui/src/api/datagov/schedules/types.ts",
"sha256": "18b0b735252de3b29276d4d4d50f69de31d1095991d781f63528cd7998a39d70"
},
{
"path": "aixun-ui/src/api/datagov/schedules/index.ts",
"sha256": "3b218b0516fb052eaa57d3478ea033af4bf9559d2b04cd526bb69c4d09bded2a"
},
{
"path": "aixun-ui/src/api/datagov/task-logs/index.ts",
"sha256": "119a4e1c70f0d330f0e1bb057e2d57fb21daad15eed242305e57d924f1963253"
},
{
"path": "aixun-api/aixun-api-dataops/src/main/java/cn/aixunkeji/datagov/dataops/api/scheduling/SchedulingApi.java",
"sha256": "2da5d56f6790c20f100001775eee2d0d3294d7c536b983e3e142a152e4cc4dbd"
},
{
"path": "docs/research/visualization-redesign-20261015/00-开发准备入口.md",
"sha256": "188cfb9188a1078af7a1d5100ca444882cc223b0ea9348a22f12d72fe3bbd06f"
},
{
"path": "aixun-ui/src/types/auto-imports.d.ts",
"sha256": "e5117b1c5730407f85336132360d93baf5f4bd8e438c7e3c2dda40ccad62b11c"
},
{
"path": "aixun-ui/src/types/components.d.ts",
"sha256": "3aa5eca85f94e0abd139bed79584526b8c21ac0522a4e7867630722dfbb59b7b"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingJdbcRepository.java",
"sha256": "9fee998d9fa906993eb38d86ef92afecc95550fc4a81461834d44bbb959fdf17"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingLayoutStore.java",
"sha256": "03c363eb41209adb60659aa66bc35c09162c6d0466df382eda0a7f636aa8731a"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingService.java",
"sha256": "26156229ddd7ebebb002c4d10525cd13919665ed4ee44ab5b4898b43da49aadd"
},
{
"path": "aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/scheduling/SchedulingController.java",
"sha256": "6bfd8a0a5527194b22614b8f29230ed420a029afe1fa3d9f25687a1d6ac1d372"
}
]
@@ -0,0 +1,292 @@
package cn.aixunkeji.datagov.dataops.api.scheduling;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/** FR-DEV-0366 through FR-DEV-0370 secret-safe scheduling contracts. */
public final class SchedulingApi {
private SchedulingApi() {
}
public enum DefinitionStatus { DRAFT, READY }
public enum RunStatus { PENDING, SUBMITTED, RUNNING, SUCCEEDED, FAILED, CANCELED, UNKNOWN }
public enum RunAction { SUBMIT, BACKFILL, RERUN, STOP }
public enum NodeType { BATCH_JOB, CODE_OBJECT, TRANSFORMATION, QUALITY_RULE, CONDITION, DEPENDENT }
public enum TriggerType { CRON, API, EVENT, DEPENDENT }
public enum ParameterSource { BUSINESS_DATE, SCHEDULE_DATE, RUN_ID }
public enum Priority { HIGHEST, HIGH, MEDIUM, LOW, LOWEST }
public enum FailureStrategy { END, CONTINUE }
public enum ConditionField { BUSINESS_DATE_WEEKDAY, PARENT_STATUS }
public enum ComparisonOperator { EQ, IN, NOT_IN }
public enum BranchOutcome { DEFAULT, TRUE, FALSE }
@JsonIgnoreProperties(ignoreUnknown = false)
public record ConditionDefinition(
ConditionField field,
ComparisonOperator operator,
List<String> values
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record DependencyDefinition(
Long scheduleId,
Integer businessDateOffsetDays
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record NodeDefinition(
String nodeKey,
String name,
NodeType type,
Long referenceId,
ConditionDefinition condition,
DependencyDefinition dependency
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record EdgeDefinition(
String edgeKey,
String sourceNodeKey,
String targetNodeKey,
BranchOutcome branchOutcome
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record TriggerDefinition(
TriggerType type,
String cronExpression,
String timeZone,
String structuredKey,
String eventSource,
DependencyDefinition dependency
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record ParameterDefinition(
String name,
ParameterSource source,
String format,
boolean required
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record CalendarDefinition(
String timeZone,
List<LocalDate> includedDates,
List<LocalDate> excludedDates
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record StrategyDefinition(
Integer maxConcurrency,
Priority priority,
Integer timeoutMinutes,
Integer retryCount,
Integer retryIntervalSeconds,
FailureStrategy failureStrategy
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record DefinitionCreateRequest(
String name,
String description,
List<NodeDefinition> nodes,
List<EdgeDefinition> edges,
List<TriggerDefinition> triggers,
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
StrategyDefinition strategy
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record DefinitionUpdateRequest(
String name,
String description,
List<NodeDefinition> nodes,
List<EdgeDefinition> edges,
List<TriggerDefinition> triggers,
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
StrategyDefinition strategy,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record VersionRequest(Long version, String expectedLayoutVersion) {
public VersionRequest(Long version) { this(version, null); }
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record ParameterCalendarUpdateRequest(
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record StrategyUpdateRequest(StrategyDefinition strategy, Long version) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record SubmitRequest(Long version, String reason) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record BackfillRequest(
LocalDate businessDateFrom,
LocalDate businessDateTo,
String reason,
String impactSummary,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record RerunRequest(
Long parentRunId,
String failedNodeKey,
String reason,
Long version
) {
}
@JsonIgnoreProperties(ignoreUnknown = false)
public record StopRequest(Long parentRunId, String reason, Long version) {
}
public record DefinitionSummaryView(
Long scheduleId,
String name,
Long orgId,
DefinitionStatus status,
Long version,
Long currentSnapshotId,
LocalDateTime createdAt,
LocalDateTime updatedAt
) {
}
public record DefinitionDetailView(
DefinitionSummaryView summary,
String description,
List<NodeDefinition> nodes,
List<EdgeDefinition> edges,
List<TriggerDefinition> triggers,
List<ParameterDefinition> parameters,
CalendarDefinition calendar,
StrategyDefinition strategy,
String definitionSha256
) {
}
public record ValidationIssue(
String code,
String location,
String message,
String severity,
String phase,
String nodeKey,
String edgeKey
) {
public ValidationIssue(String code, String location, String message) {
this(code, location, message, "ERROR", "DEFINITION", null, null);
}
}
public record NodeCapability(NodeType type, boolean executable, String message) {}
public record CapabilitiesView(String capabilityVersion, LocalDateTime observedAt,
boolean adapterConfigured, List<NodeCapability> nodes,
int maxNodes, int maxEdges, List<String> notices) {}
public record DefinitionReceipt(boolean found, DefinitionDetailView definition) {}
public record ValidationView(boolean valid, List<ValidationIssue> issues, String definitionSha256) {
}
public record SnapshotView(
Long snapshotId,
Long scheduleId,
Long definitionVersion,
String snapshotSha256,
LocalDateTime createdAt
) {
}
public record ExternalInstanceView(
String externalInstanceId,
LocalDate businessDate,
String sourceStatus,
RunStatus status,
String evidenceRef,
LocalDateTime observedAt
) {
}
public record NodeEvidenceView(
String nodeKey,
NodeType nodeType,
Long referenceId,
String externalTaskCode,
String externalTaskInstanceId,
LocalDate businessDate,
String sourceStatus,
RunStatus status,
String evidenceRef,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) {
}
public record RunView(
Long runId,
Long scheduleId,
Long snapshotId,
Long parentRunId,
RunAction action,
RunStatus status,
LocalDate businessDateFrom,
LocalDate businessDateTo,
String failedNodeKey,
String externalProjectCode,
String externalDefinitionCode,
String externalInstanceId,
String sourceStatus,
String errorSummary,
List<ExternalInstanceView> externalInstances,
List<NodeEvidenceView> nodeEvidence,
LocalDateTime lastSyncAt,
LocalDateTime createdAt,
LocalDateTime updatedAt
) {
}
public record PageView<T>(List<T> rows, long total) {
}
}
@@ -0,0 +1,208 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.BackfillRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionCreateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionDetailView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionSummaryView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterCalendarUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RerunRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SnapshotView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SubmitRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ValidationView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.VersionRequest;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/dataops/v1/schedules")
public class SchedulingController {
private final SchedulingService service;
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/capabilities")
public R<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.CapabilitiesView> capabilities() {
return R.ok(service.capabilities());
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/receipts")
public R<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionReceipt> receipt(
@RequestParam String action, @RequestParam String resourceKey, @RequestParam String key
) { return R.ok(service.receipt(action, resourceKey, key)); }
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}/layout")
public R<SchedulingLayout.View> layout(@PathVariable long scheduleId) { return R.ok(service.layout(scheduleId)); }
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}/layout/receipts")
public R<SchedulingLayout.Receipt> layoutReceipt(@PathVariable long scheduleId, @RequestParam String key) {
return R.ok(service.layoutReceipt(scheduleId, key));
}
@Log(title = "调度布局保存", businessType = BusinessType.UPDATE, isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:update")
@PutMapping("/{scheduleId}/layout")
public R<SchedulingLayout.View> saveLayout(@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String key, @RequestBody SchedulingLayout.Command command) {
return R.ok(service.saveLayout(scheduleId, key, command));
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping
public R<PageResult<DefinitionSummaryView>> list(
@RequestParam(required = false) String keyword,
@RequestParam(required = false) String status,
@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize
) {
return R.ok(service.list(keyword, status, pageNum, pageSize));
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}")
public R<DefinitionDetailView> get(@PathVariable long scheduleId) {
return R.ok(service.get(scheduleId));
}
@Log(title = "调度定义创建", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:create")
@PostMapping
public R<DefinitionDetailView> create(
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody DefinitionCreateRequest request
) {
return R.ok(service.create(idempotencyKey, request));
}
@Log(title = "调度定义更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:update")
@PutMapping("/{scheduleId}")
public R<DefinitionDetailView> update(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody DefinitionUpdateRequest request
) {
return R.ok(service.update(scheduleId, idempotencyKey, request));
}
@Log(title = "调度参数日历更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:parameter")
@PutMapping("/{scheduleId}/parameters-calendar")
public R<DefinitionDetailView> updateParameters(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody ParameterCalendarUpdateRequest request
) {
return R.ok(service.updateParameters(scheduleId, idempotencyKey, request));
}
@Log(title = "调度策略更新", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:strategy")
@PutMapping("/{scheduleId}/strategy")
public R<DefinitionDetailView> updateStrategy(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody StrategyUpdateRequest request
) {
return R.ok(service.updateStrategy(scheduleId, idempotencyKey, request));
}
@SaCheckPermission("aixun:dataops:schedule:validate")
@PostMapping("/{scheduleId}/validate")
public R<ValidationView> validate(@PathVariable long scheduleId) {
return R.ok(service.validate(scheduleId));
}
@Log(title = "调度定义就绪", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:validate")
@PostMapping("/{scheduleId}/ready")
public R<DefinitionDetailView> ready(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody VersionRequest request
) {
return R.ok(service.ready(scheduleId, idempotencyKey, request));
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}/snapshots")
public R<List<SnapshotView>> snapshots(@PathVariable long scheduleId) {
return R.ok(service.snapshots(scheduleId));
}
@SaCheckPermission("aixun:dataops:schedule:view")
@GetMapping("/{scheduleId}/runs")
public R<List<RunView>> runs(@PathVariable long scheduleId) {
return R.ok(service.runs(scheduleId));
}
@Log(title = "调度提交", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:submit")
@PostMapping("/{scheduleId}/submit")
public R<RunView> submit(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody SubmitRequest request
) {
return R.ok(service.submit(scheduleId, idempotencyKey, request));
}
@Log(title = "调度补数", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:backfill")
@PostMapping("/{scheduleId}/backfill")
public R<RunView> backfill(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody BackfillRequest request
) {
return R.ok(service.backfill(scheduleId, idempotencyKey, request));
}
@Log(title = "调度重跑", businessType = BusinessType.INSERT,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:rerun")
@PostMapping("/{scheduleId}/rerun")
public R<RunView> rerun(
@PathVariable long scheduleId,
@RequestHeader("Idempotency-Key") String idempotencyKey,
@RequestBody RerunRequest request
) {
return R.ok(service.rerun(scheduleId, idempotencyKey, request));
}
@Log(title = "调度状态同步", businessType = BusinessType.UPDATE,
isSaveRequestData = false, isSaveResponseData = false)
@SaCheckPermission("aixun:dataops:schedule:submit")
@PostMapping("/runs/{runId}/status-sync")
public R<RunView> syncStatus(@PathVariable long runId) {
return R.ok(service.syncStatus(runId));
}
}
@@ -0,0 +1,910 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.mybatis.utils.IdGeneratorUtil;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionDetailView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionSummaryView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ExternalInstanceView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeEvidenceView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeType;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunAction;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SnapshotView;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingActorProvider.Actor;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingModel.Definition;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Outcome;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.State;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingOwnerExecutionService;
import lombok.RequiredArgsConstructor;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.support.TransactionTemplate;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
@Repository
@RequiredArgsConstructor
class SchedulingJdbcRepository {
private static final String DEFINITION_COLUMNS = """
schedule_id, schedule_name, schedule_description, org_id, project_id,
nodes_json, edges_json, triggers_json, parameters_json, calendar_json, strategy_json,
definition_sha256, definition_status, current_snapshot_id, version, create_time, update_time
""";
private static final String RUN_COLUMNS = """
r.run_id, r.schedule_id, r.snapshot_id, r.parent_run_id, r.org_id, r.action_type, r.request_sha256, r.run_status,
r.business_date_from, r.business_date_to, r.failed_node_key,
m.external_project_code, m.external_definition_code, m.external_instance_id,
r.source_status, r.error_summary, r.last_sync_at, r.create_time, r.update_time
""";
private final JdbcTemplate jdbcTemplate;
private final TransactionTemplate transactionTemplate;
private final SchedulingPolicy policy;
private final SchedulingLayoutStore layouts;
SchedulingLayout.View layout(Actor actor, long id) {
return SchedulingLayout.project(layouts.get(actor, id), require(actor, id));
}
SchedulingLayout.Receipt layoutReceipt(Actor actor, long id, String key) {
require(actor, id);
return layouts.receipt(actor, id, key, null);
}
SchedulingLayout.View saveLayout(Actor actor, long id, String key, SchedulingLayout.Command command) {
return transactionTemplate.execute(status -> {
var current = require(actor, id, true);
var receipt = layouts.receipt(actor, id, key, policy.requestHash(command));
if (receipt.found()) return receipt.layout();
requireDraft(current);
SchedulingLayout.validate(command, current);
return layouts.save(actor, id, key, command);
});
}
cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionReceipt receipt(
Actor actor, String action, String resourceKey, String key
) {
var replay = definitionReplay(actor, action, resourceKey, key);
return new cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionReceipt(
replay != null && "COMPLETED".equals(replay.status()),
replay == null || replay.targetScheduleId() == null ? null : require(actor, replay.targetScheduleId()));
}
PageResult<DefinitionSummaryView> page(
Actor actor,
String keyword,
DefinitionStatus status,
int pageNum,
int pageSize
) {
StringBuilder where = new StringBuilder(" WHERE d.del_flag='0' AND d.org_id=?");
List<Object> arguments = new ArrayList<>();
arguments.add(actor.orgId());
if (!actor.unrestricted()) {
where.append(" AND d.create_by=?");
arguments.add(actor.actorId());
}
if (keyword != null) {
where.append(" AND d.schedule_name LIKE ? ESCAPE '='");
arguments.add("%" + escapeLike(keyword) + "%");
}
if (status != null) {
where.append(" AND d.definition_status=?");
arguments.add(status.name());
}
Long total = jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM dev_schedule_definition d" + where, Long.class, arguments.toArray());
List<Object> pageArguments = new ArrayList<>(arguments);
pageArguments.add(pageSize);
pageArguments.add((pageNum - 1) * pageSize);
List<DefinitionSummaryView> rows = jdbcTemplate.query(
"SELECT " + DEFINITION_COLUMNS + " FROM dev_schedule_definition d" + where
+ " ORDER BY d.update_time DESC, d.schedule_id DESC LIMIT ? OFFSET ?",
(resultSet, rowNum) -> mapSummary(resultSet), pageArguments.toArray());
return PageResult.build(rows, total == null ? 0 : total);
}
DefinitionDetailView require(Actor actor, long scheduleId) {
return require(actor, scheduleId, false);
}
private DefinitionDetailView require(Actor actor, long scheduleId, boolean lock) {
StringBuilder sql = new StringBuilder(
"SELECT " + DEFINITION_COLUMNS
+ " FROM dev_schedule_definition d WHERE d.schedule_id=? AND d.org_id=? AND d.del_flag='0'");
List<Object> arguments = new ArrayList<>(List.of(scheduleId, actor.orgId()));
if (!actor.unrestricted()) {
sql.append(" AND d.create_by=?");
arguments.add(actor.actorId());
}
if (lock) sql.append(" FOR UPDATE");
List<DefinitionDetailView> rows = jdbcTemplate.query(
sql.toString(), (resultSet, rowNum) -> mapDetail(resultSet), arguments.toArray());
if (!rows.isEmpty()) {
return rows.getFirst();
}
Integer existing = jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM dev_schedule_definition WHERE schedule_id=? AND del_flag='0'",
Integer.class, scheduleId);
if (existing != null && existing > 0) {
throw SchedulingDomainException.forbidden();
}
throw SchedulingDomainException.notFound();
}
DefinitionDetailView requireReadyDependency(Actor actor, long scheduleId, long ownerScheduleId) {
if (scheduleId == ownerScheduleId) {
throw SchedulingDomainException.validation("调度定义不得依赖自身");
}
DefinitionDetailView target = require(actor, scheduleId);
if (target.summary().status() != DefinitionStatus.READY) {
throw SchedulingDomainException.referenceUnavailable();
}
return target;
}
DefinitionDetailView create(Actor actor, String key, String hash, Definition definition) {
return idempotentDefinition(actor, "CREATE", "new", key, hash, () -> {
long scheduleId = IdGeneratorUtil.nextLongId();
try {
jdbcTemplate.update("""
INSERT INTO dev_schedule_definition(
schedule_id, schedule_name, schedule_description, org_id, project_id,
nodes_json, edges_json, triggers_json, parameters_json, calendar_json, strategy_json,
definition_sha256, definition_status, current_snapshot_id,
create_dept, create_by, create_time, update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'DRAFT', NULL, ?, ?, NOW(), ?, NOW(), '0', 0)
""", scheduleId, definition.name(), definition.description(), actor.orgId(), null,
policy.json(definition.nodes()), policy.json(definition.edges()), policy.json(definition.triggers()),
policy.json(definition.parameters()), policy.json(definition.calendar()), policy.json(definition.strategy()),
policy.requestHash(definition), actor.orgId(), actor.actorId(), actor.actorId());
} catch (DuplicateKeyException exception) {
throw SchedulingDomainException.conflict("当前组织内已存在同名调度定义");
}
return require(actor, scheduleId);
});
}
DefinitionDetailView update(
Actor actor,
long scheduleId,
String key,
String hash,
Definition definition,
long expectedVersion
) {
return idempotentDefinition(actor, "UPDATE", String.valueOf(scheduleId), key, hash, () -> {
DefinitionDetailView current = require(actor, scheduleId);
requireDraft(current);
try {
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_definition
SET schedule_name=?, schedule_description=?, nodes_json=?, edges_json=?, triggers_json=?,
parameters_json=?, calendar_json=?, strategy_json=?, definition_sha256=?,
update_by=?, update_time=NOW(), version=version+1
WHERE schedule_id=? AND org_id=? AND (?=1 OR create_by=?)
AND definition_status='DRAFT' AND version=? AND del_flag='0'
""", definition.name(), definition.description(), policy.json(definition.nodes()),
policy.json(definition.edges()), policy.json(definition.triggers()), policy.json(definition.parameters()),
policy.json(definition.calendar()), policy.json(definition.strategy()), policy.requestHash(definition),
actor.actorId(), scheduleId, actor.orgId(), actor.unrestricted() ? 1 : 0,
actor.actorId(), expectedVersion);
requireChanged(changed);
} catch (DuplicateKeyException exception) {
throw SchedulingDomainException.conflict("当前组织内已存在同名调度定义");
}
return require(actor, scheduleId);
});
}
DefinitionDetailView markReady(
Actor actor,
long scheduleId,
String key,
String hash,
long expectedVersion,
String expectedLayoutVersion
) {
return idempotentDefinition(actor, "READY", String.valueOf(scheduleId), key, hash, () -> {
DefinitionDetailView current = require(actor, scheduleId, true);
requireDraft(current);
long snapshotId = IdGeneratorUtil.nextLongId();
long definitionVersion = expectedVersion + 1;
String snapshotSha = current.definitionSha256();
layouts.bindSnapshot(actor, scheduleId, snapshotId, snapshotSha, expectedLayoutVersion);
jdbcTemplate.update("""
INSERT INTO dev_schedule_snapshot(
snapshot_id, schedule_id, definition_version, definition_json, snapshot_sha256,
org_id, project_id, create_dept, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", snapshotId, scheduleId, definitionVersion, policy.json(toDefinition(current)), snapshotSha,
actor.orgId(), null, actor.orgId(), actor.actorId());
insertSnapshotRows(actor, scheduleId, snapshotId, current);
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_definition
SET definition_status='READY', current_snapshot_id=?, update_by=?, update_time=NOW(), version=version+1
WHERE schedule_id=? AND org_id=? AND definition_status='DRAFT' AND version=? AND del_flag='0'
""", snapshotId, actor.actorId(), scheduleId, actor.orgId(), expectedVersion);
requireChanged(changed);
return require(actor, scheduleId);
});
}
List<SnapshotView> snapshots(Actor actor, long scheduleId) {
require(actor, scheduleId);
return jdbcTemplate.query("""
SELECT snapshot_id, schedule_id, definition_version, snapshot_sha256, create_time
FROM dev_schedule_snapshot
WHERE schedule_id=? AND org_id=? AND del_flag='0'
ORDER BY definition_version DESC
""", (resultSet, rowNum) -> new SnapshotView(
resultSet.getLong("snapshot_id"), resultSet.getLong("schedule_id"),
resultSet.getLong("definition_version"), resultSet.getString("snapshot_sha256"),
localDateTime(resultSet.getTimestamp("create_time"))), scheduleId, actor.orgId());
}
Definition snapshotDefinition(Actor actor, long scheduleId, long snapshotId) {
require(actor, scheduleId);
List<String> rows = jdbcTemplate.query("""
SELECT definition_json FROM dev_schedule_snapshot
WHERE snapshot_id=? AND schedule_id=? AND org_id=? AND del_flag='0'
""", (resultSet, rowNum) -> resultSet.getString(1), snapshotId, scheduleId, actor.orgId());
if (rows.isEmpty()) {
throw SchedulingDomainException.conflict("当前调度快照不存在");
}
return policy.read(rows.getFirst(), Definition.class);
}
RunReservation reserveRun(
Actor actor,
DefinitionDetailView definition,
RunAction action,
String key,
String hash,
Long parentRunId,
LocalDate businessDateFrom,
LocalDate businessDateTo,
String failedNodeKey,
String reason,
String impactSummary
) {
return transactionTemplate.execute(status -> {
RunView replay = replayRun(actor, action, key, hash);
if (replay != null) {
return new RunReservation(replay, false);
}
long runId = IdGeneratorUtil.nextLongId();
try {
jdbcTemplate.update("""
INSERT INTO dev_schedule_run_request(
run_id, schedule_id, snapshot_id, parent_run_id, actor_id, org_id, project_id,
action_type, idempotency_key, request_sha256, run_status,
business_date_from, business_date_to, failed_node_key, reason, impact_summary,
create_dept, create_by, create_time, update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'PENDING', ?, ?, ?, ?, ?, ?, ?, NOW(), ?, NOW(), '0', 0)
""", runId, definition.summary().scheduleId(), definition.summary().currentSnapshotId(), parentRunId,
actor.actorId(), actor.orgId(), null, action.name(), key, hash,
businessDateFrom == null ? null : Date.valueOf(businessDateFrom),
businessDateTo == null ? null : Date.valueOf(businessDateTo), failedNodeKey, reason, impactSummary,
actor.orgId(), actor.actorId(), actor.actorId());
} catch (DuplicateKeyException exception) {
RunView concurrentReplay = replayRun(actor, action, key, hash);
if (concurrentReplay != null) {
return new RunReservation(concurrentReplay, false);
}
throw SchedulingDomainException.conflict("执行请求正在处理,请稍后重试");
}
return new RunReservation(requireRun(actor, runId), true);
});
}
RunView requireRun(Actor actor, long runId) {
List<RunView> rows = jdbcTemplate.query(
"SELECT " + RUN_COLUMNS + " FROM dev_schedule_run_request r"
+ " LEFT JOIN dev_schedule_external_mapping m ON m.run_id=r.run_id AND m.del_flag='0'"
+ " WHERE r.run_id=? AND r.org_id=? AND r.del_flag='0'"
+ (actor.unrestricted() ? "" : " AND r.actor_id=?"),
(resultSet, rowNum) -> mapRun(resultSet),
actor.unrestricted() ? new Object[]{runId, actor.orgId()} : new Object[]{runId, actor.orgId(), actor.actorId()});
if (!rows.isEmpty()) {
return rows.getFirst();
}
throw SchedulingDomainException.notFound();
}
List<RunView> runs(Actor actor, long scheduleId) {
require(actor, scheduleId);
return jdbcTemplate.query(
"SELECT " + RUN_COLUMNS + " FROM dev_schedule_run_request r"
+ " LEFT JOIN dev_schedule_external_mapping m ON m.run_id=r.run_id AND m.del_flag='0'"
+ " WHERE r.schedule_id=? AND r.org_id=? AND r.del_flag='0'"
+ (actor.unrestricted() ? "" : " AND r.actor_id=?")
+ " ORDER BY r.create_time DESC, r.run_id DESC",
(resultSet, rowNum) -> mapRun(resultSet),
actor.unrestricted() ? new Object[]{scheduleId, actor.orgId()}
: new Object[]{scheduleId, actor.orgId(), actor.actorId()});
}
void requireFailedNodeEvidence(Actor actor, long runId, String nodeKey, String externalInstanceId) {
if (!notBlank(externalInstanceId)) {
throw SchedulingDomainException.conflict("原运行缺少外部实例证据,禁止节点重跑");
}
Integer count = jdbcTemplate.queryForObject("""
SELECT COUNT(*) FROM dev_schedule_node_execution_evidence
WHERE run_id=? AND org_id=? AND node_key=? AND external_instance_id=?
AND evidence_kind='OBSERVATION' AND normalized_status='FAILED' AND del_flag='0'
""", Integer.class, runId, actor.orgId(), nodeKey, externalInstanceId);
if (count == null || count == 0) {
throw SchedulingDomainException.conflict("指定节点没有同一外部实例的真实失败证据");
}
}
OwnerCallbackReservation reserveOwnerCallback(SchedulingOwnerExecutionService.Command command) {
return transactionTemplate.execute(status -> {
CallbackRun requested = requireCallbackRun(command.requestedRunId());
CallbackRun effective = latestPendingRerun(requested, command.nodeKey());
if (effective == null) {
effective = requested;
}
if (effective.scheduleId() != command.scheduleId() || effective.snapshotId() != command.snapshotId()) {
throw new IllegalArgumentException("固定回调与平台运行快照不匹配");
}
String snapshotSha = jdbcTemplate.queryForObject("""
SELECT snapshot_sha256 FROM dev_schedule_snapshot
WHERE snapshot_id=? AND schedule_id=? AND org_id=? AND del_flag='0'
""", String.class, command.snapshotId(), command.scheduleId(), effective.orgId());
if (!command.snapshotSha256().equals(snapshotSha)) {
throw new IllegalArgumentException("固定回调快照摘要不匹配");
}
NodeMetadata node = requireNodeMetadata(command.snapshotId(), effective.orgId(), command.nodeKey());
if (!node.nodeType().name().equals(command.nodeType()) || node.referenceId() == null
|| node.referenceId() != command.referenceId()) {
throw new IllegalArgumentException("固定回调节点引用不匹配");
}
if (command.businessDate() == null || !effective.allows(command.businessDate())) {
throw new IllegalArgumentException("固定回调业务日期不属于平台请求");
}
List<CallbackEvidence> existing = jdbcTemplate.query("""
SELECT normalized_status, evidence_ref, error_code, error_summary, observed_at
FROM dev_schedule_node_execution_evidence
WHERE run_id=? AND node_key=? AND evidence_kind='CALLBACK' AND business_date=?
AND external_instance_id='' AND external_task_instance_id='' AND del_flag='0'
""", (resultSet, rowNum) -> new CallbackEvidence(
RunStatus.valueOf(resultSet.getString("normalized_status")),
resultSet.getString("evidence_ref"), resultSet.getString("error_code"),
resultSet.getString("error_summary"), localDateTime(resultSet.getTimestamp("observed_at"))),
effective.runId(), command.nodeKey(), Date.valueOf(command.businessDate()));
if (!existing.isEmpty()) {
return new OwnerCallbackReservation(effective, node, command.ownerVersion(), command.ownerSha256(),
command.businessDate(), true, existing.getFirst());
}
jdbcTemplate.update("""
INSERT INTO dev_schedule_node_execution_evidence(
evidence_id, run_id, schedule_id, snapshot_id, evidence_kind, node_key, node_type,
reference_id, owner_version, owner_sha256, business_date, source_status,
normalized_status, observed_at, org_id, create_dept, create_by, create_time, update_by,
update_time, del_flag, version
) VALUES (?, ?, ?, ?, 'CALLBACK', ?, ?, ?, ?, ?, ?, 'CALLBACK_ACCEPTED',
'RUNNING', NOW(6), ?, ?, ?, NOW(), ?, NOW(), '0', 0)
""", IdGeneratorUtil.nextLongId(), effective.runId(), effective.scheduleId(),
effective.snapshotId(), command.nodeKey(), node.nodeType().name(), node.referenceId(),
command.ownerVersion(), command.ownerSha256(), Date.valueOf(command.businessDate()),
effective.orgId(), effective.orgId(), effective.actorId(), effective.actorId());
return new OwnerCallbackReservation(effective, node, command.ownerVersion(), command.ownerSha256(),
command.businessDate(), false, null);
});
}
void completeOwnerCallback(
OwnerCallbackReservation reservation,
RunStatus status,
String evidenceRef,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) {
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_node_execution_evidence
SET source_status=?, normalized_status=?, evidence_ref=?, error_code=?, error_summary=?,
observed_at=?, update_by=?, update_time=NOW(), version=version+1
WHERE run_id=? AND node_key=? AND evidence_kind='CALLBACK' AND business_date=?
AND external_instance_id='' AND external_task_instance_id='' AND del_flag='0'
""", "CALLBACK_" + status.name(), status.name(), truncate(evidenceRef, 512),
truncate(errorCode, 64), truncate(errorSummary, 512), Timestamp.valueOf(observedAt),
reservation.run().actorId(), reservation.run().runId(), reservation.node().nodeKey(),
Date.valueOf(reservation.businessDate()));
requireChanged(changed);
}
RunView applyOutcome(Actor actor, long runId, Outcome outcome) {
RunStatus status = normalizedStatus(outcome);
String sourceStatus = truncate(outcome == null ? null : outcome.sourceStatus(), 64);
String errorCode = truncate(outcome == null ? null : outcome.errorCode(), 64);
String errorSummary = truncate(outcome == null ? null : outcome.errorSummary(), 512);
LocalDateTime observedAt = outcome == null || outcome.observedAt() == null
? LocalDateTime.now() : outcome.observedAt();
transactionTemplate.executeWithoutResult(transactionStatus -> {
requireRun(actor, runId);
int changed = jdbcTemplate.update("""
UPDATE dev_schedule_run_request
SET run_status=?, source_status=?, error_code=?, error_summary=?, last_sync_at=?,
update_by=?, update_time=NOW(), version=version+1
WHERE run_id=? AND org_id=? AND del_flag='0'
""", status.name(), sourceStatus, errorCode, errorSummary, Timestamp.valueOf(observedAt),
actor.actorId(), runId, actor.orgId());
requireChanged(changed);
if (hasExternalEvidence(outcome)) {
jdbcTemplate.update("""
INSERT INTO dev_schedule_external_mapping(
mapping_id, schedule_id, snapshot_id, run_id, external_project_code,
external_definition_code, external_instance_id, source_status, last_sync_at,
org_id, create_by, create_time, update_by, update_time, del_flag, version
) SELECT ?, schedule_id, snapshot_id, run_id, ?, ?, ?, ?, ?, org_id, ?, NOW(), ?, NOW(), '0', 0
FROM dev_schedule_run_request WHERE run_id=? AND org_id=? AND del_flag='0'
ON DUPLICATE KEY UPDATE
external_project_code=VALUES(external_project_code),
external_definition_code=VALUES(external_definition_code),
external_instance_id=VALUES(external_instance_id), source_status=VALUES(source_status),
last_sync_at=VALUES(last_sync_at), update_by=VALUES(update_by),
update_time=NOW(), version=dev_schedule_external_mapping.version+1
""", IdGeneratorUtil.nextLongId(), outcome.externalProjectCode(), outcome.externalDefinitionCode(),
outcome.externalInstanceId(), sourceStatus, Timestamp.valueOf(observedAt), actor.actorId(),
actor.actorId(), runId, actor.orgId());
}
persistOutcomeEvidence(actor, runId, outcome, observedAt);
});
return requireRun(actor, runId);
}
private void persistOutcomeEvidence(Actor actor, long runId, Outcome outcome, LocalDateTime observedAt) {
if (outcome == null) {
return;
}
RunScope scope = runScope(runId, actor.orgId());
List<cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.InstanceEvidence>
instances = outcome.instances() == null ? List.of() : outcome.instances();
for (var instance : instances) {
if (instance == null || !notBlank(instance.externalInstanceId()) || instance.state() == null) {
continue;
}
LocalDate businessDate = instance.businessDate() == null
? scope.defaultBusinessDate(observedAt.toLocalDate()) : instance.businessDate();
RunStatus instanceStatus = stateStatus(instance.state());
LocalDateTime instanceObservedAt = instance.observedAt() == null ? observedAt : instance.observedAt();
jdbcTemplate.update("""
INSERT INTO dev_schedule_external_instance_evidence(
evidence_id, run_id, schedule_id, snapshot_id, external_project_code,
external_definition_code, external_instance_id, business_date, source_status,
normalized_status, evidence_ref, observed_at, org_id, create_dept, create_by, create_time,
update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, NOW(), '0', 0)
ON DUPLICATE KEY UPDATE business_date=VALUES(business_date),
source_status=VALUES(source_status), normalized_status=VALUES(normalized_status),
evidence_ref=VALUES(evidence_ref), observed_at=VALUES(observed_at),
update_by=VALUES(update_by), update_time=NOW(), version=version+1
""", IdGeneratorUtil.nextLongId(), runId, scope.scheduleId(), scope.snapshotId(),
outcome.externalProjectCode(), outcome.externalDefinitionCode(), instance.externalInstanceId(),
Date.valueOf(businessDate), truncate(instance.sourceStatus(), 64), instanceStatus.name(),
truncate(instance.evidenceRef(), 512), Timestamp.valueOf(instanceObservedAt), actor.orgId(), actor.orgId(),
actor.actorId(), actor.actorId());
}
List<cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.NodeEvidence>
nodeEvidence = outcome.nodeEvidence() == null ? List.of() : outcome.nodeEvidence();
for (var item : nodeEvidence) {
if (item == null || !notBlank(item.nodeKey()) || item.state() == null) {
continue;
}
NodeMetadata node = requireNodeMetadata(scope.snapshotId(), actor.orgId(), item.nodeKey());
LocalDate businessDate = item.businessDate() == null
? scope.defaultBusinessDate(observedAt.toLocalDate()) : item.businessDate();
LocalDateTime nodeObservedAt = item.observedAt() == null ? observedAt : item.observedAt();
jdbcTemplate.update("""
INSERT INTO dev_schedule_node_execution_evidence(
evidence_id, run_id, schedule_id, snapshot_id, evidence_kind, node_key, node_type,
reference_id, owner_version, owner_sha256, external_project_code,
external_definition_code, external_instance_id, external_task_code,
external_task_instance_id, business_date, source_status, normalized_status,
evidence_ref, error_code, error_summary, observed_at, org_id, create_dept, create_by, create_time,
update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, 'OBSERVATION', ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, NOW(), '0', 0)
ON DUPLICATE KEY UPDATE source_status=VALUES(source_status),
normalized_status=VALUES(normalized_status), evidence_ref=VALUES(evidence_ref),
error_code=VALUES(error_code), error_summary=VALUES(error_summary),
observed_at=VALUES(observed_at), update_by=VALUES(update_by),
update_time=NOW(), version=version+1
""", IdGeneratorUtil.nextLongId(), runId, scope.scheduleId(), scope.snapshotId(), item.nodeKey(),
node.nodeType().name(), node.referenceId(), nullToEmpty(outcome.externalProjectCode()),
nullToEmpty(outcome.externalDefinitionCode()), nullToEmpty(item.externalInstanceId()),
nullToEmpty(item.externalTaskCode()), nullToEmpty(item.externalTaskInstanceId()),
Date.valueOf(businessDate), truncate(item.sourceStatus(), 64), stateStatus(item.state()).name(),
truncate(item.evidenceRef(), 512), truncate(item.errorCode(), 64),
truncate(item.errorSummary(), 512), Timestamp.valueOf(nodeObservedAt), actor.orgId(),
actor.orgId(), actor.actorId(), actor.actorId());
}
}
private DefinitionDetailView idempotentDefinition(
Actor actor,
String action,
String resourceKey,
String key,
String hash,
Supplier<DefinitionDetailView> operation
) {
return transactionTemplate.execute(status -> {
IdempotencyRow replay = definitionReplay(actor, action, resourceKey, key);
if (replay != null) {
if (!replay.hash().equals(hash)) {
throw SchedulingDomainException.conflict("同一幂等键不能用于不同请求");
}
if (!"COMPLETED".equals(replay.status()) || replay.targetScheduleId() == null) {
throw SchedulingDomainException.conflict("幂等请求正在处理,请稍后重试");
}
return require(actor, replay.targetScheduleId());
}
long idempotencyId = IdGeneratorUtil.nextLongId();
try {
jdbcTemplate.update("""
INSERT INTO dev_schedule_idempotency(
idempotency_id, actor_id, org_id, action_type, resource_key, idempotency_key,
request_sha256, request_status, create_dept, create_by, create_time,
update_by, update_time, del_flag, version
) VALUES (?, ?, ?, ?, ?, ?, ?, 'IN_PROGRESS', ?, ?, NOW(), ?, NOW(), '0', 0)
""", idempotencyId, actor.actorId(), actor.orgId(), action, resourceKey, key, hash,
actor.orgId(), actor.actorId(), actor.actorId());
} catch (DuplicateKeyException exception) {
throw SchedulingDomainException.conflict("幂等请求正在处理,请稍后重试");
}
DefinitionDetailView result = operation.get();
jdbcTemplate.update("""
UPDATE dev_schedule_idempotency
SET target_schedule_id=?, request_status='COMPLETED', update_by=?, update_time=NOW(), version=version+1
WHERE idempotency_id=? AND request_status='IN_PROGRESS' AND del_flag='0'
""", result.summary().scheduleId(), actor.actorId(), idempotencyId);
return result;
});
}
private IdempotencyRow definitionReplay(Actor actor, String action, String resourceKey, String key) {
List<IdempotencyRow> rows = jdbcTemplate.query("""
SELECT request_sha256, request_status, target_schedule_id
FROM dev_schedule_idempotency
WHERE actor_id=? AND org_id=? AND action_type=? AND resource_key=?
AND idempotency_key=? AND del_flag='0'
""", (resultSet, rowNum) -> new IdempotencyRow(
resultSet.getString(1), resultSet.getString(2), nullableLong(resultSet, 3)),
actor.actorId(), actor.orgId(), action, resourceKey, key);
return rows.isEmpty() ? null : rows.getFirst();
}
RunView replayRun(Actor actor, RunAction action, String key, String hash) {
List<RunView> rows = jdbcTemplate.query(
"SELECT " + RUN_COLUMNS + " FROM dev_schedule_run_request r"
+ " LEFT JOIN dev_schedule_external_mapping m ON m.run_id=r.run_id AND m.del_flag='0'"
+ " WHERE r.actor_id=? AND r.org_id=? AND r.action_type=? AND r.idempotency_key=? AND r.del_flag='0'",
(resultSet, rowNum) -> {
String existingHash = resultSet.getString("request_sha256");
if (!hash.equals(existingHash)) {
throw SchedulingDomainException.conflict("同一幂等键不能用于不同请求");
}
return mapRun(resultSet);
}, actor.actorId(), actor.orgId(), action.name(), key);
return rows.isEmpty() ? null : rows.getFirst();
}
private void insertSnapshotRows(Actor actor, long scheduleId, long snapshotId, DefinitionDetailView current) {
current.nodes().forEach(node -> jdbcTemplate.update("""
INSERT INTO dev_schedule_node(
node_id, snapshot_id, schedule_id, node_key, node_name, node_type,
reference_id, condition_json, dependency_json, org_id, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", IdGeneratorUtil.nextLongId(), snapshotId, scheduleId, node.nodeKey(), node.name(), node.type().name(),
node.referenceId(), node.condition() == null ? null : policy.json(node.condition()),
node.dependency() == null ? null : policy.json(node.dependency()), actor.orgId(), actor.actorId()));
current.edges().forEach(edge -> jdbcTemplate.update("""
INSERT INTO dev_schedule_edge(
edge_id, snapshot_id, schedule_id, edge_key, source_node_key, target_node_key,
branch_outcome, org_id, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", IdGeneratorUtil.nextLongId(), snapshotId, scheduleId, edge.edgeKey(), edge.sourceNodeKey(),
edge.targetNodeKey(), edge.branchOutcome().name(), actor.orgId(), actor.actorId()));
current.triggers().forEach(trigger -> jdbcTemplate.update("""
INSERT INTO dev_schedule_trigger(
trigger_id, snapshot_id, schedule_id, trigger_type, trigger_json,
org_id, create_by, create_time, del_flag
) VALUES (?, ?, ?, ?, ?, ?, ?, NOW(), '0')
""", IdGeneratorUtil.nextLongId(), snapshotId, scheduleId, trigger.type().name(), policy.json(trigger),
actor.orgId(), actor.actorId()));
}
private DefinitionSummaryView mapSummary(ResultSet resultSet) throws SQLException {
return new DefinitionSummaryView(
resultSet.getLong("schedule_id"), resultSet.getString("schedule_name"),
resultSet.getLong("org_id"),
DefinitionStatus.valueOf(resultSet.getString("definition_status")), resultSet.getLong("version"),
nullableLong(resultSet, "current_snapshot_id"), localDateTime(resultSet.getTimestamp("create_time")),
localDateTime(resultSet.getTimestamp("update_time")));
}
private DefinitionDetailView mapDetail(ResultSet resultSet) throws SQLException {
return new DefinitionDetailView(mapSummary(resultSet), resultSet.getString("schedule_description"),
policy.read(resultSet.getString("nodes_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition[].class) == null
? List.of() : List.of(policy.read(resultSet.getString("nodes_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition[].class)),
List.of(policy.read(resultSet.getString("edges_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.EdgeDefinition[].class)),
List.of(policy.read(resultSet.getString("triggers_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.TriggerDefinition[].class)),
List.of(policy.read(resultSet.getString("parameters_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterDefinition[].class)),
policy.read(resultSet.getString("calendar_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.CalendarDefinition.class),
policy.read(resultSet.getString("strategy_json"), cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyDefinition.class),
resultSet.getString("definition_sha256"));
}
private RunView mapRun(ResultSet resultSet) throws SQLException {
long runId = resultSet.getLong("run_id");
long orgId = resultSet.getLong("org_id");
return new RunView(resultSet.getLong("run_id"), resultSet.getLong("schedule_id"),
resultSet.getLong("snapshot_id"), nullableLong(resultSet, "parent_run_id"),
RunAction.valueOf(resultSet.getString("action_type")), RunStatus.valueOf(resultSet.getString("run_status")),
localDate(resultSet.getDate("business_date_from")), localDate(resultSet.getDate("business_date_to")),
resultSet.getString("failed_node_key"), resultSet.getString("external_project_code"),
resultSet.getString("external_definition_code"), resultSet.getString("external_instance_id"),
resultSet.getString("source_status"), resultSet.getString("error_summary"),
externalInstances(runId, orgId), nodeEvidence(runId, orgId),
localDateTime(resultSet.getTimestamp("last_sync_at")), localDateTime(resultSet.getTimestamp("create_time")),
localDateTime(resultSet.getTimestamp("update_time")));
}
private List<ExternalInstanceView> externalInstances(long runId, long orgId) {
return jdbcTemplate.query("""
SELECT external_instance_id, business_date, source_status, normalized_status,
evidence_ref, observed_at
FROM dev_schedule_external_instance_evidence
WHERE run_id=? AND org_id=? AND del_flag='0'
ORDER BY business_date, external_instance_id
""", (resultSet, rowNum) -> new ExternalInstanceView(
resultSet.getString("external_instance_id"), localDate(resultSet.getDate("business_date")),
resultSet.getString("source_status"), RunStatus.valueOf(resultSet.getString("normalized_status")),
resultSet.getString("evidence_ref"), localDateTime(resultSet.getTimestamp("observed_at"))),
runId, orgId);
}
private List<NodeEvidenceView> nodeEvidence(long runId, long orgId) {
return jdbcTemplate.query("""
SELECT node_key, node_type, reference_id, external_task_code, external_task_instance_id,
business_date, source_status, normalized_status, evidence_ref, error_code,
error_summary, observed_at
FROM dev_schedule_node_execution_evidence
WHERE run_id=? AND org_id=? AND del_flag='0'
ORDER BY business_date, node_key, evidence_kind, observed_at
""", (resultSet, rowNum) -> new NodeEvidenceView(
resultSet.getString("node_key"), NodeType.valueOf(resultSet.getString("node_type")),
nullableLong(resultSet, "reference_id"), resultSet.getString("external_task_code"),
resultSet.getString("external_task_instance_id"), localDate(resultSet.getDate("business_date")),
resultSet.getString("source_status"), RunStatus.valueOf(resultSet.getString("normalized_status")),
resultSet.getString("evidence_ref"), resultSet.getString("error_code"),
resultSet.getString("error_summary"), localDateTime(resultSet.getTimestamp("observed_at"))),
runId, orgId);
}
private Definition toDefinition(DefinitionDetailView view) {
return new Definition(view.summary().name(), view.description(), view.nodes(),
view.edges(), view.triggers(), view.parameters(), view.calendar(), view.strategy());
}
private static RunStatus normalizedStatus(Outcome outcome) {
if (outcome == null || outcome.state() == null) {
return RunStatus.UNKNOWN;
}
if ((outcome.state() == State.SUBMITTED || outcome.state() == State.RUNNING
|| outcome.state() == State.SUCCEEDED) && !hasExternalEvidence(outcome)) {
return RunStatus.UNKNOWN;
}
return switch (outcome.state()) {
case SUBMITTED -> RunStatus.SUBMITTED;
case RUNNING -> RunStatus.RUNNING;
case SUCCEEDED -> RunStatus.SUCCEEDED;
case FAILED, UNSUPPORTED -> RunStatus.FAILED;
case CANCELED -> RunStatus.CANCELED;
case UNKNOWN -> RunStatus.UNKNOWN;
};
}
private static RunStatus stateStatus(State state) {
if (state == null) {
return RunStatus.UNKNOWN;
}
return switch (state) {
case SUBMITTED -> RunStatus.SUBMITTED;
case RUNNING -> RunStatus.RUNNING;
case SUCCEEDED -> RunStatus.SUCCEEDED;
case FAILED, UNSUPPORTED -> RunStatus.FAILED;
case CANCELED -> RunStatus.CANCELED;
case UNKNOWN -> RunStatus.UNKNOWN;
};
}
private RunScope runScope(long runId, long orgId) {
List<RunScope> rows = jdbcTemplate.query("""
SELECT schedule_id, snapshot_id, business_date_from, business_date_to
FROM dev_schedule_run_request WHERE run_id=? AND org_id=? AND del_flag='0'
""", (resultSet, rowNum) -> new RunScope(
resultSet.getLong("schedule_id"), resultSet.getLong("snapshot_id"),
localDate(resultSet.getDate("business_date_from")),
localDate(resultSet.getDate("business_date_to"))), runId, orgId);
if (rows.isEmpty()) {
throw SchedulingDomainException.notFound();
}
return rows.getFirst();
}
private NodeMetadata requireNodeMetadata(long snapshotId, long orgId, String nodeKey) {
List<NodeMetadata> rows = jdbcTemplate.query("""
SELECT node_key, node_type, reference_id FROM dev_schedule_node
WHERE snapshot_id=? AND org_id=? AND node_key=? AND del_flag='0'
""", (resultSet, rowNum) -> new NodeMetadata(resultSet.getString("node_key"),
NodeType.valueOf(resultSet.getString("node_type")), nullableLong(resultSet, "reference_id")),
snapshotId, orgId, nodeKey);
if (rows.isEmpty()) {
throw new IllegalArgumentException("节点不属于不可变调度快照");
}
return rows.getFirst();
}
private CallbackRun requireCallbackRun(long runId) {
List<CallbackRun> rows = jdbcTemplate.query("""
SELECT run_id, actor_id, org_id, schedule_id, snapshot_id, action_type,
business_date_from, business_date_to, create_time
FROM dev_schedule_run_request WHERE run_id=? AND del_flag='0'
""", (resultSet, rowNum) -> callbackRun(resultSet), runId);
if (rows.isEmpty()) {
throw new IllegalArgumentException("固定回调平台运行不存在");
}
return rows.getFirst();
}
private CallbackRun latestPendingRerun(CallbackRun parent, String nodeKey) {
List<CallbackRun> rows = jdbcTemplate.query("""
SELECT run_id, actor_id, org_id, schedule_id, snapshot_id, action_type,
business_date_from, business_date_to, create_time
FROM dev_schedule_run_request
WHERE parent_run_id=? AND org_id=? AND schedule_id=? AND snapshot_id=?
AND action_type='RERUN' AND failed_node_key=?
AND run_status IN ('PENDING', 'SUBMITTED', 'RUNNING', 'UNKNOWN') AND del_flag='0'
ORDER BY create_time DESC, run_id DESC LIMIT 1
""", (resultSet, rowNum) -> callbackRun(resultSet), parent.runId(), parent.orgId(),
parent.scheduleId(), parent.snapshotId(), nodeKey);
return rows.isEmpty() ? null : rows.getFirst();
}
private static CallbackRun callbackRun(ResultSet resultSet) throws SQLException {
return new CallbackRun(resultSet.getLong("run_id"), resultSet.getLong("actor_id"),
resultSet.getLong("org_id"), resultSet.getLong("schedule_id"), resultSet.getLong("snapshot_id"),
RunAction.valueOf(resultSet.getString("action_type")),
localDate(resultSet.getDate("business_date_from")),
localDate(resultSet.getDate("business_date_to")),
localDateTime(resultSet.getTimestamp("create_time")));
}
private static boolean hasExternalEvidence(Outcome outcome) {
return outcome != null && notBlank(outcome.externalProjectCode())
&& notBlank(outcome.externalDefinitionCode()) && notBlank(outcome.externalInstanceId())
&& outcome.observedAt() != null;
}
private static void requireDraft(DefinitionDetailView definition) {
if (definition.summary().status() != DefinitionStatus.DRAFT) {
throw SchedulingDomainException.conflict("只有DRAFT调度定义可编辑或转为READY");
}
}
private static void requireChanged(int changed) {
if (changed != 1) {
throw SchedulingDomainException.conflict("调度版本已变化,请刷新后重试");
}
}
private static String escapeLike(String value) {
return value.replace("=", "==").replace("%", "=%").replace("_", "=_");
}
private static boolean notBlank(String value) {
return value != null && !value.isBlank();
}
private static String truncate(String value, int maximum) {
if (value == null) {
return null;
}
return value.length() <= maximum ? value : value.substring(0, maximum);
}
private static String nullToEmpty(String value) {
return value == null ? "" : value;
}
private static Long nullableLong(ResultSet resultSet, String column) throws SQLException {
long value = resultSet.getLong(column);
return resultSet.wasNull() ? null : value;
}
private static Long nullableLong(ResultSet resultSet, int column) throws SQLException {
long value = resultSet.getLong(column);
return resultSet.wasNull() ? null : value;
}
private static LocalDateTime localDateTime(Timestamp value) {
return value == null ? null : value.toLocalDateTime();
}
private static LocalDate localDate(Date value) {
return value == null ? null : value.toLocalDate();
}
private record IdempotencyRow(String hash, String status, Long targetScheduleId) {
}
private record RunScope(long scheduleId, long snapshotId, LocalDate businessDateFrom, LocalDate businessDateTo) {
LocalDate defaultBusinessDate(LocalDate fallback) {
return businessDateFrom == null ? fallback : businessDateFrom;
}
}
record NodeMetadata(String nodeKey, NodeType nodeType, Long referenceId) {
}
record CallbackRun(
long runId,
long actorId,
long orgId,
long scheduleId,
long snapshotId,
RunAction action,
LocalDate businessDateFrom,
LocalDate businessDateTo,
LocalDateTime createdAt
) {
boolean allows(LocalDate value) {
if (action != RunAction.BACKFILL) {
return true;
}
return businessDateFrom != null && businessDateTo != null
&& !value.isBefore(businessDateFrom) && !value.isAfter(businessDateTo);
}
}
record CallbackEvidence(
RunStatus status,
String evidenceRef,
String errorCode,
String errorSummary,
LocalDateTime observedAt
) {
}
record OwnerCallbackReservation(
CallbackRun run,
NodeMetadata node,
String ownerVersion,
String ownerSha256,
LocalDate businessDate,
boolean replayed,
CallbackEvidence existing
) {
}
record RunReservation(RunView run, boolean newRequest) {
}
}
@@ -0,0 +1,72 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingActorProvider.Actor;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingLayout.*;
import lombok.RequiredArgsConstructor;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
/** Calls run inside the definition transaction and share its row lock. */
@Repository
@RequiredArgsConstructor
class SchedulingLayoutStore {
private final JdbcTemplate jdbc;
private final SchedulingPolicy policy;
View get(Actor actor, long id) {
return get(actor, id, false);
}
View getLocked(Actor actor, long id) { return get(actor, id, true); }
private View get(Actor actor, long id, boolean lock) {
return jdbc.query("SELECT layout_json FROM dev_schedule_layout WHERE schedule_id=? AND org_id=?" + (lock ? " FOR UPDATE" : ""),
(rs, n) -> policy.read(rs.getString(1), View.class), id, actor.orgId()).stream().findFirst().orElse(null);
}
Receipt receipt(Actor actor, long id, String key, String expectedHash) {
return jdbc.query("""
SELECT request_sha256, response_json FROM dev_schedule_layout_request
WHERE schedule_id=? AND org_id=? AND actor_id=? AND idempotency_key=?
""", (rs, n) -> {
if (expectedHash != null && !expectedHash.equals(rs.getString(1)))
throw SchedulingDomainException.conflict("同一幂等键不能用于不同布局");
return new Receipt(true, policy.read(rs.getString(2), View.class));
}, id, actor.orgId(), actor.actorId(), key).stream().findFirst().orElse(new Receipt(false, null));
}
View save(Actor actor, long id, String key, Command command) {
String hash = policy.requestHash(command);
Receipt receipt = receipt(actor, id, key, hash);
if (receipt.found()) return receipt.layout();
View current = getLocked(actor, id);
String version = current == null ? "0" : current.layoutVersion();
if (!version.equals(command.expectedLayoutVersion()))
throw SchedulingDomainException.conflict("布局已被修改,请读取新版本后比较,未覆盖他人布局");
View view = new View(Long.toString(SchedulingLayout.version(version) + 1), command.definitionSha256(),
command.positions(), command.viewport(), false, java.util.List.of(), java.time.LocalDateTime.now().toString());
String json = policy.json(view);
if (json.length() > 65536) throw SchedulingDomainException.validation("布局过大");
if (current == null) jdbc.update("""
INSERT INTO dev_schedule_layout(schedule_id,org_id,layout_json,update_by,update_time)
VALUES (?,?,?,?,NOW())
""", id, actor.orgId(), json, actor.actorId());
else jdbc.update("UPDATE dev_schedule_layout SET layout_json=?,update_by=?,update_time=NOW() WHERE schedule_id=? AND org_id=?",
json, actor.actorId(), id, actor.orgId());
jdbc.update("""
INSERT INTO dev_schedule_layout_request(schedule_id,org_id,actor_id,idempotency_key,request_sha256,response_json,create_time)
VALUES (?,?,?,?,?,?,NOW())
""", id, actor.orgId(), actor.actorId(), key, hash, json);
return view;
}
void bindSnapshot(Actor actor, long id, long snapshot, String sha, String expectedVersion) {
View layout = getLocked(actor, id);
if (expectedVersion == null) return; // Legacy clients explicitly have no published visual layout.
SchedulingLayout.version(expectedVersion);
if (layout == null || !expectedVersion.equals(layout.layoutVersion()) || !sha.equals(layout.definitionSha256()))
throw SchedulingDomainException.conflict("布局与流程版本不匹配,请先保存后再就绪");
jdbc.update("INSERT INTO dev_schedule_snapshot_layout(snapshot_id,schedule_id,org_id,layout_json,create_time) VALUES (?,?,?,?,NOW())",
snapshot, id, actor.orgId(), policy.json(layout));
}
}
@@ -0,0 +1,487 @@
package cn.aixunkeji.datagov.dataops.scheduling;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.BackfillRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionCreateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionDetailView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionSummaryView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DependencyDefinition;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeType;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterCalendarUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RerunRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunAction;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunStatus;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.RunView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SnapshotView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyUpdateRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.SubmitRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StopRequest;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ValidationView;
import cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.VersionRequest;
import cn.aixunkeji.datagov.dataops.batchjob.BatchJobSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.dataops.codedevelopment.CodeDevelopmentSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingActorProvider.Actor;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingJdbcRepository.RunReservation;
import cn.aixunkeji.datagov.dataops.scheduling.SchedulingModel.Definition;
import cn.aixunkeji.datagov.dataops.transformationcleaning.TransformationCleaningSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.dataops.qualityrule.QualityRuleSchedulingReferenceDirectory;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.CancelCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.BackfillCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Condition;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.DefinitionSnapshot;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Dependency;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Edge;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.InstanceTarget;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.Node;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.RerunCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.StatusCommand;
import cn.aixunkeji.datagov.integration.api.scheduling.SchedulingIntegrationService.SubmissionCommand;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
@Service
@RequiredArgsConstructor
class SchedulingService {
private final SchedulingActorProvider actorProvider;
private final SchedulingPolicy policy;
private final SchedulingJdbcRepository repository;
private final BatchJobSchedulingReferenceDirectory batchJobDirectory;
private final CodeDevelopmentSchedulingReferenceDirectory codeDirectory;
private final TransformationCleaningSchedulingReferenceDirectory transformationDirectory;
private final QualityRuleSchedulingReferenceDirectory qualityRuleDirectory;
private final SchedulingIntegrationGateway integrationGateway;
private final SchedulingExecutionPolicy executionPolicy;
cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.CapabilitiesView capabilities() {
actorProvider.current();
return executionPolicy.capabilities(integrationGateway.configured());
}
SchedulingLayout.View layout(long id) { return repository.layout(actorProvider.current(), positiveId(id, "调度ID")); }
SchedulingLayout.View saveLayout(long id, String key, SchedulingLayout.Command command) {
policy.idempotencyKey(key);
return repository.saveLayout(actorProvider.current(), positiveId(id, "调度ID"), key, command);
}
SchedulingLayout.Receipt layoutReceipt(long id, String key) {
policy.idempotencyKey(key);
return repository.layoutReceipt(actorProvider.current(), positiveId(id, "调度ID"), key);
}
cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.DefinitionReceipt receipt(String action, String resourceKey, String key) {
policy.idempotencyKey(key);
if (!List.of("CREATE", "UPDATE", "READY").contains(action)
|| !("new".equals(resourceKey) || resourceKey.matches("[1-9][0-9]{0,18}")))
throw SchedulingDomainException.validation("回执请求无效");
return repository.receipt(actorProvider.current(), action, resourceKey, key);
}
PageResult<DefinitionSummaryView> list(
String keyword,
String status,
Integer pageNum,
Integer pageSize
) {
Actor actor = actorProvider.current();
return repository.page(actor, policy.keyword(keyword), policy.queryStatus(status),
policy.pageNum(pageNum), policy.pageSize(pageSize));
}
DefinitionDetailView get(long scheduleId) {
return repository.require(actorProvider.current(), positiveId(scheduleId, "调度ID"));
}
DefinitionDetailView create(String idempotencyKey, DefinitionCreateRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
Definition definition = policy.create(request);
validateReferences(actor, definition, 0L);
return repository.create(actor, idempotencyKey, policy.requestHash(request), definition);
}
DefinitionDetailView update(long scheduleId, String idempotencyKey, DefinitionUpdateRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
long normalizedScheduleId = positiveId(scheduleId, "调度ID");
DefinitionDetailView current = repository.require(actor, normalizedScheduleId);
Definition proposed = policy.update(request);
Definition definition = new Definition(proposed.name(), proposed.description(),
proposed.nodes(), proposed.edges(), proposed.triggers(), proposed.parameters(), proposed.calendar(),
proposed.strategy());
validateReferences(actor, definition, normalizedScheduleId);
return repository.update(actor, normalizedScheduleId, idempotencyKey, policy.requestHash(request), definition,
policy.version(request.version()));
}
DefinitionDetailView updateParameters(
long scheduleId,
String idempotencyKey,
ParameterCalendarUpdateRequest request
) {
if (request == null) {
throw SchedulingDomainException.validation("参数与日历请求不能为空");
}
Actor actor = actorProvider.current();
DefinitionDetailView current = repository.require(actor, positiveId(scheduleId, "调度ID"));
return updateFromCurrent(actor, current, idempotencyKey, request,
current.nodes(), current.edges(), current.triggers(), request.parameters(), request.calendar(),
current.strategy(), request.version());
}
DefinitionDetailView updateStrategy(long scheduleId, String idempotencyKey, StrategyUpdateRequest request) {
if (request == null) {
throw SchedulingDomainException.validation("调度策略请求不能为空");
}
Actor actor = actorProvider.current();
DefinitionDetailView current = repository.require(actor, positiveId(scheduleId, "调度ID"));
return updateFromCurrent(actor, current, idempotencyKey, request,
current.nodes(), current.edges(), current.triggers(), current.parameters(), current.calendar(),
request.strategy(), request.version());
}
ValidationView validate(long scheduleId) {
Actor actor = actorProvider.current();
DefinitionDetailView current = repository.require(actor, positiveId(scheduleId, "调度ID"));
Definition definition = toDefinition(current);
var issues = new java.util.ArrayList<>(policy.validationView(definition).issues());
for (int i = 0; i < definition.nodes().size(); i++) {
var node = definition.nodes().get(i);
try {
var resolved = integrationNode(actor, scheduleId, node);
if (resolved.dependency() != null && !integrationGateway.dependencyAvailable(resolved.dependency()))
issues.add(new cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ValidationIssue(
"DEPENDENCY_EXECUTION_UNAVAILABLE", "/nodes/" + i + "/dependency", "依赖的已发布快照尚无可确认的外部定义", "ERROR", "EXECUTION", node.nodeKey(), null));
}
catch (RuntimeException exception) {
issues.add(new cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ValidationIssue(
"REFERENCE_UNAVAILABLE", "/nodes/" + i, "关联任务或依赖不可用,请重新选择或检查权限", "ERROR", "REFERENCE", node.nodeKey(), null));
}
}
issues.addAll(executionPolicy.issues(definition, integrationGateway.configured()));
return new ValidationView(issues.stream().noneMatch(i -> "ERROR".equals(i.severity())), issues, current.definitionSha256());
}
DefinitionDetailView ready(long scheduleId, String idempotencyKey, VersionRequest request) {
if (request == null) {
throw SchedulingDomainException.validation("就绪请求不能为空");
}
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
long normalizedScheduleId = positiveId(scheduleId, "调度ID");
DefinitionDetailView current = repository.require(actor, normalizedScheduleId);
validateReferences(actor, toDefinition(current), normalizedScheduleId);
requireExecutionDependencies(actor, normalizedScheduleId, toDefinition(current));
requireExecutable(toDefinition(current));
// Preserve hashes of legacy version-only requests when the optional layout binding is absent.
String requestHash = request.expectedLayoutVersion() == null
? policy.requestHash(java.util.Collections.singletonMap("version", request.version()))
: policy.requestHash(request);
return repository.markReady(actor, normalizedScheduleId, idempotencyKey, requestHash,
policy.version(request.version()), request.expectedLayoutVersion());
}
List<SnapshotView> snapshots(long scheduleId) {
return repository.snapshots(actorProvider.current(), positiveId(scheduleId, "调度ID"));
}
List<RunView> runs(long scheduleId) {
return repository.runs(actorProvider.current(), positiveId(scheduleId, "调度ID"));
}
RunView submit(long scheduleId, String idempotencyKey, SubmitRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
SubmitRequest normalized = policy.submit(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
String requestHash = policy.requestHash(normalized);
RunView replay = repository.replayRun(actor, RunAction.SUBMIT, idempotencyKey, requestHash);
if (replay != null) return replay;
validateReferences(actor, toDefinition(definition), scheduleId);
requireExecutionDependencies(actor, scheduleId, toDefinition(definition));
requireExecutable(toDefinition(definition));
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.SUBMIT, idempotencyKey,
requestHash, null, null, null, null, normalized.reason(), null);
if (!reservation.newRequest()) {
return reservation.run();
}
DefinitionSnapshot snapshot = integrationSnapshot(actor, definition);
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.submit(
new SubmissionCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, snapshot)));
}
RunView backfill(long scheduleId, String idempotencyKey, BackfillRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
BackfillRequest normalized = policy.backfill(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
String requestHash = policy.requestHash(normalized);
RunView replay = repository.replayRun(actor, RunAction.BACKFILL, idempotencyKey, requestHash);
if (replay != null) return replay;
validateReferences(actor, toDefinition(definition), scheduleId);
requireExecutionDependencies(actor, scheduleId, toDefinition(definition));
requireExecutable(toDefinition(definition));
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.BACKFILL, idempotencyKey,
requestHash, null, normalized.businessDateFrom(), normalized.businessDateTo(), null,
normalized.reason(), normalized.impactSummary());
if (!reservation.newRequest()) {
return reservation.run();
}
DefinitionSnapshot snapshot = integrationSnapshot(actor, definition);
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.backfill(
new BackfillCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, snapshot, normalized.businessDateFrom(), normalized.businessDateTo())));
}
RunView rerun(long scheduleId, String idempotencyKey, RerunRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
RerunRequest normalized = policy.rerun(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
RunView parent = repository.requireRun(actor, normalized.parentRunId());
if (!parent.scheduleId().equals(definition.summary().scheduleId()) || parent.status() != RunStatus.FAILED) {
throw SchedulingDomainException.conflict("只能重跑当前调度下已有真实失败证据的FAILED运行");
}
if (!parent.snapshotId().equals(definition.summary().currentSnapshotId())) {
throw SchedulingDomainException.conflict("原运行不是当前READY快照,禁止重跑");
}
NodeDefinition failedNode = definition.nodes().stream()
.filter(node -> node.nodeKey().equals(normalized.failedNodeKey()))
.findFirst().orElse(null);
if (failedNode == null || !ownerNode(failedNode.type())) {
throw SchedulingDomainException.validation("失败节点不属于当前READY快照");
}
repository.requireFailedNodeEvidence(actor, parent.runId(), normalized.failedNodeKey(),
parent.externalInstanceId());
String requestHash = policy.requestHash(normalized);
RunView replay = repository.replayRun(actor, RunAction.RERUN, idempotencyKey, requestHash);
if (replay != null) return replay;
validateReferences(actor, toDefinition(definition), scheduleId);
requireExecutionDependencies(actor, scheduleId, toDefinition(definition));
requireExecutable(toDefinition(definition));
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.RERUN, idempotencyKey,
requestHash, parent.runId(), null, null, normalized.failedNodeKey(), normalized.reason(), null);
if (!reservation.newRequest()) {
return reservation.run();
}
DefinitionSnapshot snapshot = integrationSnapshot(actor, definition);
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.rerun(
new RerunCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, snapshot, parent.externalInstanceId(), normalized.failedNodeKey())));
}
RunView stop(long scheduleId, String idempotencyKey, StopRequest request) {
Actor actor = actorProvider.current();
policy.idempotencyKey(idempotencyKey);
StopRequest normalized = policy.stop(request);
DefinitionDetailView definition = requireReady(actor, scheduleId, normalized.version());
RunView parent = repository.requireRun(actor, normalized.parentRunId());
if (!parent.scheduleId().equals(definition.summary().scheduleId())
|| (parent.status() != RunStatus.SUBMITTED && parent.status() != RunStatus.RUNNING)) {
throw SchedulingDomainException.conflict("只能停止当前调度下SUBMITTED或RUNNING运行");
}
if (parent.externalProjectCode() == null || parent.externalDefinitionCode() == null
|| parent.externalInstanceId() == null) {
throw SchedulingDomainException.conflict("活动运行缺少外部稳定ID,禁止伪造停止成功");
}
String requestHash = policy.requestHash(normalized);
RunReservation reservation = repository.reserveRun(actor, definition, RunAction.STOP, idempotencyKey,
requestHash, parent.runId(), null, null, null, normalized.reason(), null);
if (!reservation.newRequest()) return reservation.run();
return repository.applyOutcome(actor, reservation.run().runId(), integrationGateway.cancel(
new CancelCommand(reservation.run().runId(), actor.orgId(),
idempotencyKey, requestHash, parent.externalProjectCode(), parent.externalDefinitionCode(),
parent.externalInstanceId())));
}
RunView syncStatus(long runId) {
Actor actor = actorProvider.current();
RunView run = repository.requireRun(actor, positiveId(runId, "运行ID"));
return repository.applyOutcome(actor, run.runId(), integrationGateway.status(new StatusCommand(
run.runId(), actor.orgId(),
run.externalProjectCode(), run.externalDefinitionCode(), run.externalInstanceId(),
run.externalInstances().stream().map(instance -> new InstanceTarget(
instance.externalInstanceId(), instance.businessDate())).toList())));
}
private DefinitionDetailView updateFromCurrent(
Actor actor,
DefinitionDetailView current,
String idempotencyKey,
Object request,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.NodeDefinition> nodes,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.EdgeDefinition> edges,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.TriggerDefinition> triggers,
List<cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.ParameterDefinition> parameters,
cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.CalendarDefinition calendar,
cn.aixunkeji.datagov.dataops.api.scheduling.SchedulingApi.StrategyDefinition strategy,
Long version
) {
policy.idempotencyKey(idempotencyKey);
DefinitionUpdateRequest combined = new DefinitionUpdateRequest(current.summary().name(), current.description(),
nodes, edges, triggers, parameters, calendar, strategy, version);
Definition proposed = policy.update(combined);
Definition definition = new Definition(proposed.name(), proposed.description(),
proposed.nodes(), proposed.edges(), proposed.triggers(), proposed.parameters(), proposed.calendar(),
proposed.strategy());
validateReferences(actor, definition, current.summary().scheduleId());
return repository.update(actor, current.summary().scheduleId(), idempotencyKey, policy.requestHash(request),
definition, policy.version(version));
}
private DefinitionDetailView requireReady(Actor actor, long scheduleId, long version) {
DefinitionDetailView definition = repository.require(actor, positiveId(scheduleId, "调度ID"));
if (definition.summary().status() != DefinitionStatus.READY
|| definition.summary().currentSnapshotId() == null) {
throw SchedulingDomainException.conflict("只有READY调度定义可以提交执行");
}
if (definition.summary().version() != version) {
throw SchedulingDomainException.conflict("调度版本已变化,请刷新后重试");
}
return definition;
}
private DefinitionSnapshot integrationSnapshot(Actor actor, DefinitionDetailView definition) {
long snapshotId = definition.summary().currentSnapshotId();
Definition snapshot = repository.snapshotDefinition(actor, definition.summary().scheduleId(), snapshotId);
List<Node> nodes = snapshot.nodes().stream()
.map(node -> integrationNode(actor, definition.summary().scheduleId(), node))
.toList();
List<Edge> edges = snapshot.edges().stream()
.map(edge -> new Edge(edge.sourceNodeKey(), edge.targetNodeKey(), edge.branchOutcome().name())).toList();
String triggerType = snapshot.triggers().isEmpty() ? "API" : snapshot.triggers().getFirst().type().name();
return new DefinitionSnapshot(definition.summary().scheduleId(), snapshotId, definition.definitionSha256(),
nodes, edges, triggerType, snapshot.calendar().timeZone());
}
private Node integrationNode(Actor actor, long ownerScheduleId, NodeDefinition node) {
if (node.type() == NodeType.BATCH_JOB) {
var resolution = batchJobDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId());
requireOwnerResolution(resolution.state().name());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.CODE_OBJECT) {
var resolution = codeDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId());
requireOwnerResolution(resolution.state().name());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.TRANSFORMATION) {
var resolution = transformationDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId());
requireOwnerResolution(resolution.state().name());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.QUALITY_RULE) {
var resolution = qualityRuleDirectory.resolve(actor.actorId(), actor.orgId(), actor.orgId(),
node.referenceId());
requireOwnerResolution(resolution.state());
return ownerIntegrationNode(node, resolution.ownerVersion(), resolution.ownerSha256());
}
if (node.type() == NodeType.CONDITION) {
var value = node.condition();
return new Node(node.nodeKey(), node.type().name(), null, null, null,
new Condition(value.field().name(), value.operator().name(), value.values()), null);
}
DefinitionDetailView target = repository.requireReadyDependency(
actor, node.dependency().scheduleId(), ownerScheduleId);
return new Node(node.nodeKey(), node.type().name(), null, null, null, null,
new Dependency(target.summary().scheduleId(), target.summary().currentSnapshotId(),
target.definitionSha256(), node.dependency().businessDateOffsetDays()));
}
private static Node ownerIntegrationNode(NodeDefinition node, String ownerVersion, String ownerSha256) {
if (ownerVersion == null || ownerVersion.isBlank() || ownerSha256 == null
|| !ownerSha256.matches("[0-9a-f]{64}")) {
throw SchedulingDomainException.referenceUnavailable();
}
return new Node(node.nodeKey(), node.type().name(), node.referenceId(), ownerVersion, ownerSha256,
null, null);
}
private void validateReferences(Actor actor, Definition definition, long ownerScheduleId) {
for (NodeDefinition node : definition.nodes()) {
if (node.type() == NodeType.BATCH_JOB) {
String state = batchJobDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId()).state().name();
requireOwnerResolution(state);
} else if (node.type() == NodeType.CODE_OBJECT) {
String state = codeDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId()).state().name();
requireOwnerResolution(state);
} else if (node.type() == NodeType.TRANSFORMATION) {
String state = transformationDirectory.resolve(actor.actorId(), actor.orgId(), actor.unrestricted(),
node.referenceId()).state().name();
requireOwnerResolution(state);
} else if (node.type() == NodeType.QUALITY_RULE) {
String state = qualityRuleDirectory.resolve(actor.actorId(), actor.orgId(), actor.orgId(),
node.referenceId()).state();
requireOwnerResolution(state);
} else if (node.type() == NodeType.DEPENDENT) {
validateDependency(actor, ownerScheduleId, node.dependency());
}
}
definition.triggers().stream().filter(trigger -> trigger.dependency() != null)
.forEach(trigger -> validateDependency(actor, ownerScheduleId, trigger.dependency()));
}
private void validateDependency(Actor actor, long ownerScheduleId, DependencyDefinition dependency) {
if (dependency.scheduleId() == ownerScheduleId) {
throw SchedulingDomainException.validation("调度定义不得依赖自身");
}
try {
repository.requireReadyDependency(actor, dependency.scheduleId(), ownerScheduleId);
} catch (SchedulingDomainException exception) {
throw SchedulingDomainException.referenceUnavailable();
}
}
private static void requireOwnerResolution(String state) {
if ("NOT_EXECUTABLE".equals(state)) {
throw SchedulingDomainException.validation("引用任务尚未处于可执行状态");
}
if (!"AUTHORIZED".equals(state)) {
throw SchedulingDomainException.referenceUnavailable();
}
}
private static boolean ownerNode(NodeType type) {
return type == NodeType.BATCH_JOB || type == NodeType.CODE_OBJECT || type == NodeType.TRANSFORMATION
|| type == NodeType.QUALITY_RULE;
}
private static Definition toDefinition(DefinitionDetailView view) {
return new Definition(view.summary().name(), view.description(), view.nodes(),
view.edges(), view.triggers(), view.parameters(), view.calendar(), view.strategy());
}
private void requireExecutable(Definition definition) {
executionPolicy.issues(definition, integrationGateway.configured()).stream()
.filter(issue -> "ERROR".equals(issue.severity())).findFirst()
.ifPresent(issue -> { throw SchedulingDomainException.validation(issue.message()); });
}
private void requireExecutionDependencies(Actor actor, long id, Definition definition) {
for (var node : definition.nodes()) {
if (node.type() == NodeType.DEPENDENT
&& !integrationGateway.dependencyAvailable(integrationNode(actor, id, node).dependency()))
throw SchedulingDomainException.validation("依赖的已发布快照尚无可确认的外部定义");
}
}
private static long positiveId(long value, String label) {
if (value <= 0) {
throw SchedulingDomainException.validation(label + "无效");
}
return value;
}
}
@@ -0,0 +1,106 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import type {
BackfillRequest,
RerunRequest,
RunView,
ScheduleDefinition,
ScheduleDetail,
ScheduleId,
ScheduleQuery,
ScheduleSummary,
SnapshotView,
ValidationView
} from './types';
import type { ScheduleCapabilities, ScheduleLayout, ScheduleLayoutCommand } from './types';
export const getScheduleCapabilities = (): AxiosPromise<ScheduleCapabilities> =>
request({ url: '/api/dataops/v1/schedules/capabilities', method: 'get' });
export const getScheduleLayout = (id: ScheduleId): AxiosPromise<ScheduleLayout> =>
request({ url: `/api/dataops/v1/schedules/${id}/layout`, method: 'get' });
export const saveScheduleLayout = (id: ScheduleId, data: ScheduleLayoutCommand, key: string): AxiosPromise<ScheduleLayout> =>
request({ url: `/api/dataops/v1/schedules/${id}/layout`, method: 'put', data, headers: writeHeaders(key), suppressErrorToast: true });
export const getScheduleReceipt = (action: 'CREATE' | 'UPDATE' | 'READY', resourceKey: string, key: string): AxiosPromise<{ found: boolean; definition: ScheduleDetail | null }> =>
request({ url: '/api/dataops/v1/schedules/receipts', method: 'get', params: { action, resourceKey, key } });
export const getScheduleLayoutReceipt = (id: ScheduleId, key: string): AxiosPromise<{ found: boolean; layout: ScheduleLayout | null }> =>
request({ url: `/api/dataops/v1/schedules/${id}/layout/receipts`, method: 'get', params: { key } });
const writeHeaders = (idempotencyKey: string) => ({
'Idempotency-Key': idempotencyKey,
repeatSubmit: false
});
export const listSchedules = (params: ScheduleQuery): AxiosPromise<PageResult<ScheduleSummary>> =>
request({ url: '/api/dataops/v1/schedules', method: 'get', params });
export const getSchedule = (scheduleId: ScheduleId): AxiosPromise<ScheduleDetail> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}`, method: 'get' });
export const createSchedule = (data: ScheduleDefinition, key: string): AxiosPromise<ScheduleDetail> =>
request({ url: '/api/dataops/v1/schedules', method: 'post', data, headers: writeHeaders(key), suppressErrorToast: true });
export const updateSchedule = (
scheduleId: ScheduleId,
data: ScheduleDefinition & { version: number },
key: string
): AxiosPromise<ScheduleDetail> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}`, method: 'put', data, headers: writeHeaders(key), suppressErrorToast: true });
export const validateSchedule = (scheduleId: ScheduleId): AxiosPromise<ValidationView> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}/validate`, method: 'post' });
export const readySchedule = (scheduleId: ScheduleId, version: number, key: string, expectedLayoutVersion?: string): AxiosPromise<ScheduleDetail> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/ready`,
method: 'post',
data: { version, expectedLayoutVersion },
suppressErrorToast: true,
headers: writeHeaders(key)
});
export const listScheduleSnapshots = (scheduleId: ScheduleId): AxiosPromise<SnapshotView[]> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}/snapshots`, method: 'get' });
export const listScheduleRuns = (scheduleId: ScheduleId): AxiosPromise<RunView[]> =>
request({ url: `/api/dataops/v1/schedules/${scheduleId}/runs`, method: 'get' });
export const submitSchedule = (
scheduleId: ScheduleId,
version: number,
reason: string,
key: string
): AxiosPromise<RunView> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/submit`,
method: 'post',
data: { version, reason },
headers: writeHeaders(key)
});
export const backfillSchedule = (
scheduleId: ScheduleId,
data: BackfillRequest,
key: string
): AxiosPromise<RunView> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/backfill`,
method: 'post',
data,
headers: writeHeaders(key)
});
export const rerunSchedule = (
scheduleId: ScheduleId,
data: RerunRequest,
key: string
): AxiosPromise<RunView> =>
request({
url: `/api/dataops/v1/schedules/${scheduleId}/rerun`,
method: 'post',
data,
headers: writeHeaders(key)
});
export const syncScheduleRun = (runId: ScheduleId): AxiosPromise<RunView> =>
request({ url: `/api/dataops/v1/schedules/runs/${runId}/status-sync`, method: 'post' });
@@ -0,0 +1,200 @@
export type ScheduleId = string | number;
export type DefinitionStatus = 'DRAFT' | 'READY';
export type RunStatus = 'PENDING' | 'SUBMITTED' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELED' | 'UNKNOWN';
export type RunAction = 'SUBMIT' | 'BACKFILL' | 'RERUN';
export type NodeType = 'BATCH_JOB' | 'CODE_OBJECT' | 'TRANSFORMATION' | 'QUALITY_RULE' | 'CONDITION' | 'DEPENDENT';
export type TriggerType = 'CRON' | 'API' | 'EVENT' | 'DEPENDENT';
export type ParameterSource = 'BUSINESS_DATE' | 'SCHEDULE_DATE' | 'RUN_ID';
export type Priority = 'HIGHEST' | 'HIGH' | 'MEDIUM' | 'LOW' | 'LOWEST';
export type FailureStrategy = 'END' | 'CONTINUE';
export type BranchOutcome = 'DEFAULT' | 'TRUE' | 'FALSE';
export interface DependencyDefinition {
scheduleId: ScheduleId;
businessDateOffsetDays: number;
}
export interface ConditionDefinition {
field: 'BUSINESS_DATE_WEEKDAY' | 'PARENT_STATUS';
operator: 'EQ' | 'IN' | 'NOT_IN';
values: string[];
}
export interface NodeDefinition {
nodeKey: string;
name: string;
type: NodeType;
referenceId?: ScheduleId;
condition?: ConditionDefinition;
dependency?: DependencyDefinition;
}
export interface EdgeDefinition {
edgeKey: string;
sourceNodeKey: string;
targetNodeKey: string;
branchOutcome: BranchOutcome;
}
export interface TriggerDefinition {
type: TriggerType;
cronExpression?: string;
timeZone?: string;
structuredKey?: string;
eventSource?: string;
dependency?: DependencyDefinition;
}
export interface ParameterDefinition {
name: string;
source: ParameterSource;
format?: string;
required: boolean;
}
export interface CalendarDefinition {
timeZone: string;
includedDates: string[];
excludedDates: string[];
}
export interface StrategyDefinition {
maxConcurrency: number;
priority: Priority;
timeoutMinutes: number;
retryCount: number;
retryIntervalSeconds: number;
failureStrategy: FailureStrategy;
}
export interface ScheduleDefinition {
name: string;
description?: string;
nodes: NodeDefinition[];
edges: EdgeDefinition[];
triggers: TriggerDefinition[];
parameters: ParameterDefinition[];
calendar: CalendarDefinition;
strategy: StrategyDefinition;
}
export interface ScheduleSummary {
scheduleId: ScheduleId;
name: string;
orgId: ScheduleId;
status: DefinitionStatus;
version: number;
currentSnapshotId?: ScheduleId;
createdAt: string;
updatedAt: string;
}
export interface ScheduleDetail extends Omit<ScheduleDefinition, 'name'> {
summary: ScheduleSummary;
definitionSha256: string;
}
export interface ScheduleQuery extends PageQuery {
keyword?: string;
status?: DefinitionStatus;
}
export interface ValidationView {
valid: boolean;
issues: ScheduleIssue[];
definitionSha256: string;
}
export interface ScheduleIssue {
code: string;
location: string;
message: string;
severity?: 'ERROR' | 'WARNING';
phase?: 'DEFINITION' | 'REFERENCE' | 'EXECUTION';
nodeKey?: string;
edgeKey?: string;
}
export interface ScheduleCapabilities {
capabilityVersion: string;
observedAt: string;
adapterConfigured: boolean;
nodes: Array<{ type: NodeType; executable: boolean; message: string }>;
maxNodes: number;
maxEdges: number;
notices: string[];
}
export interface SchedulePosition { nodeKey: string; x: number; y: number }
export interface ScheduleViewport { x: number; y: number; zoom: number }
export interface ScheduleLayout {
layoutVersion: string;
definitionSha256: string;
positions: SchedulePosition[];
viewport: ScheduleViewport | null;
stale: boolean;
droppedNodeKeys: string[];
updatedAt?: string;
}
export interface ScheduleLayoutCommand {
expectedLayoutVersion: string;
definitionVersion: string;
definitionSha256: string;
positions: SchedulePosition[];
viewport: ScheduleViewport | null;
}
export interface SnapshotView {
snapshotId: ScheduleId;
scheduleId: ScheduleId;
definitionVersion: number;
snapshotSha256: string;
createdAt: string;
}
export interface RunView {
runId: ScheduleId;
scheduleId: ScheduleId;
snapshotId: ScheduleId;
parentRunId?: ScheduleId;
action: RunAction;
status: RunStatus;
businessDateFrom?: string;
businessDateTo?: string;
failedNodeKey?: string;
externalProjectCode?: string;
externalDefinitionCode?: string;
externalInstanceId?: string;
sourceStatus?: string;
errorSummary?: string;
nodeEvidence?: NodeExecutionEvidence[];
lastSyncAt?: string;
createdAt: string;
updatedAt: string;
}
export interface NodeExecutionEvidence {
nodeKey: string;
nodeType: NodeType;
referenceId?: ScheduleId;
status: RunStatus;
sourceStatus?: string;
errorCode?: string;
errorSummary?: string;
observedAt?: string;
}
export interface BackfillRequest {
businessDateFrom: string;
businessDateTo: string;
reason: string;
impactSummary: string;
version: number;
}
export interface RerunRequest {
parentRunId: ScheduleId;
failedNodeKey?: string;
reason: string;
version: number;
}
@@ -0,0 +1,46 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import type {
LogPageView,
NodePageView,
RefreshRequest,
RefreshView,
TaskDetailView,
TaskLogQuery,
TaskPageView,
TaskSource
} from './types';
const writeHeaders = (idempotencyKey: string) => ({
'Idempotency-Key': idempotencyKey,
repeatSubmit: false
});
export const listTaskLogs = (params: TaskLogQuery): AxiosPromise<TaskPageView> =>
request({ url: '/api/dataops/v1/task-logs', method: 'get', params });
export const getTaskLog = (source: TaskSource, runId: number): AxiosPromise<TaskDetailView> =>
request({ url: `/api/dataops/v1/task-logs/${source}/${runId}`, method: 'get' });
export const listTaskNodes = (source: TaskSource, runId: number): AxiosPromise<NodePageView> =>
request({ url: `/api/dataops/v1/task-logs/${source}/${runId}/nodes`, method: 'get' });
export const listTaskLogLines = (
source: TaskSource,
runId: number,
params: { cursor?: string; keyword?: string; maxLines: number; maxBytes: number }
): AxiosPromise<LogPageView> =>
request({ url: `/api/dataops/v1/task-logs/${source}/${runId}/logs`, method: 'get', params });
export const refreshTaskObservation = (
source: TaskSource,
runId: number,
data: RefreshRequest,
idempotencyKey: string
): AxiosPromise<RefreshView> =>
request({
url: `/api/dataops/v1/task-logs/${source}/${runId}/refresh`,
method: 'post',
data,
headers: writeHeaders(idempotencyKey)
});

某些文件未显示,因为此 diff 中更改的文件太多 显示更多