chore: 工具迁入正式工程 + 工程 README + 根目录草稿报告入 ignore
- eip4-poc/tools/{s3_rewriter,loadtest} → tools/(P4 改写器种子与压测 harness 随工程演进,PoC 冻结)
- 新增工程 README(模块图/纪律/常用命令/自举说明)
- 根目录 parity-reports/ 为 CLI 默认输出草稿,入 .gitignore(正式报告在 platform-parity/parity-reports/)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
284
tools/s3_rewriter/C4实测报告.md
Normal file
284
tools/s3_rewriter/C4实测报告.md
Normal file
@@ -0,0 +1,284 @@
|
||||
# C4 实测报告:S3 脚本正则改写器(真实库迭代版)
|
||||
|
||||
> 任务编号:M0-C4
|
||||
> 日期:2026-06-11(真实库迭代)/2026-06-10(合成语料首版,见附录 A)
|
||||
> 诚实边界:**真实库全量实测**。数据源为客户库 `192.168.20.68:5435/postgres`(只读),`eip3.view_template` 表 1,427 条脚本,与盘点报告盘点口径一致。
|
||||
> 核心结论:真实库迭代后自动化率 **81.2%(497/612)**,超过 80% 预算线;改写正确性 0 误改(`wrong_items=0`),HARD 硬 S3 判定全程未放松(恒为 85 条)。
|
||||
|
||||
---
|
||||
|
||||
## 一、背景与目标
|
||||
|
||||
盘点报告判断 615 条 S3 脚本中约 88% 是「轻度 S3」——字段句柄链式调用(`group.getField("X").setVisible(v)` 等),语义上与 S2 辅助函数同类,理论上可经正则改写转回 S2/facade 形态。困难的硬 S3(动态 new Vaadin 组件、`showConfirmDialog`、`UI.getCurrent`)须人工。
|
||||
|
||||
本任务目标:在**真实库 1,427 条脚本**上验证自动化率,逼近 80% 预算线,并诚实标注无法自动化的剩余部分。
|
||||
|
||||
**关键背离与修正**:首版(2026-06-10)在合成语料上得 81.8%,但 2026-06-11 客户库连通后首测真实库仅 **7.1%(45/632)**。根因经实测核实——合成语料按盘点报告 Top API 频率造句,**过拟合了文档式写法**,未覆盖真实脚本的形态变体。本次迭代针对真实形态扩规则,将真实库自动化率从 7.1% 提升到 81.2%。
|
||||
|
||||
### 真实库背离的根因(实测核实)
|
||||
|
||||
| 真实形态 | 首测漏覆盖原因 | 真实库规模 |
|
||||
|---------|--------------|-----------|
|
||||
| Groovy 安全导航 `?.` | 规则只匹配 `.`,`group.getField("X")?.setVisible(v)` 全漏 | 字段链 266/400 用 `?.` |
|
||||
| 句柄变量赋值带分号/行尾注释 | 内联正则用 `$` 收尾,`def f = group.getField("X");//注释` 漏内联 | 548 处赋值 |
|
||||
| 句柄变量后续用 `?.` 引用 | 内联只展开 `var.`,不展开 `var?.` | 与上重叠 |
|
||||
| 子表动作按钮 `addButton(group.getField("SEL"),0)` | 合成语料假设 `addButton("文案", cb)`,真实是「字段句柄+索引」 | 108 处 |
|
||||
| 下拉过滤 `?.setFilter([k:v,...])` 直挂句柄 | 规则只认 `getContainerDataSource().setFilter`,且 `[^)]+` 在嵌套括号处截断 | 187 处 |
|
||||
| 下拉选项填充 idiom `ds?.addItem(v).getItemProperty("des").setValue(d)` | 多跳数据源中间变量+Item 链,规则完全未覆盖 | 271 处 |
|
||||
| 一批新动词 `setRequiredError/showAddButton/reload/setConvertedValue/...` | 合成语料只造了文档 Top 动词 | 各数处至数十处 |
|
||||
|
||||
---
|
||||
|
||||
## 二、改写器设计(迭代后)
|
||||
|
||||
### 2.1 处理流水线
|
||||
|
||||
```
|
||||
输入 Groovy 脚本文本
|
||||
│
|
||||
▼
|
||||
[1] 硬 S3 检测(new Vaadin 组件 / showConfirmDialog / UI.getCurrent)
|
||||
│ 命中 → HARD,原样返回(整条转人工,永不放松)
|
||||
▼
|
||||
[2] 无 S3 快检(残留模式集,含 ?. 与容器/Item 链)
|
||||
│ 无命中 → NO_S3,原样返回
|
||||
▼
|
||||
[3] 内联字段句柄变量 Pass 1(容忍分号/行尾注释;展开 var. 与 var?.)
|
||||
▼
|
||||
[4] 平衡括号字段调用(setFilter/setFilterMap,嵌套 [..]/(..) 安全配平)
|
||||
▼
|
||||
[5] 应用规则表 Pass 1(31 条规则,. 与 ?. 统一匹配)
|
||||
▼
|
||||
[6] 内联 Pass 2 + 平衡括号 + 规则表 Pass 2(处理上一步暴露的新引用)
|
||||
▼
|
||||
[7] 下拉选项填充 idiom:内联数据源句柄变量 → addFieldOption 折叠
|
||||
▼
|
||||
[8] 残留 S3 检测
|
||||
│ 无残留 → FULL_AUTO
|
||||
└ 有残留 → PARTIAL
|
||||
```
|
||||
|
||||
迭代相比首版新增:`?.` 全规则支持、内联容错(分号/注释/`?.` 引用)、平衡括号参数匹配、数据源句柄二次内联、`addFieldOption` 选项填充折叠、`propertyDataSource().setReadOnly` 折叠。
|
||||
|
||||
### 2.2 facade 动词全量登记(31 条规则)
|
||||
|
||||
> 新动词映射保持「字段句柄 → amis 事件指令」的 facade 语义。目标动词表已超 20 个,逐条登记如下(P4 facade 扩容输入)。
|
||||
|
||||
| # | 规则名 | S3 输入形态(含 `?.` 变体) | facade 输出 | 真实库命中 |
|
||||
|---|--------|--------------------------|------------|-----------|
|
||||
| 1 | addButton | `getField("X")[?.]addButton("文案", cb)` | `addFieldButton("X", "文案", cb)` | — |
|
||||
| 2 | addSubTableButton | `getField("L")[?.]addButton(group.getField("SEL"),0)` | `addSubTableButton("L", "SEL", 0)` | 108 |
|
||||
| 3 | getValue | `getField("X")[?.]getValue()` | `getFieldValue("X")` | 122 |
|
||||
| 4 | setValue | `getField("X")[?.]setValue(v)` | `setFieldValue("X", v)` | 73 |
|
||||
| 5 | setVisible | `getField("X")[?.]setVisible(b)` | `setFieldVisible("X", b)` | 26 |
|
||||
| 6 | setCaption | `getField("X")[?.]setCaption(s)` | `setFieldCaption("X", s)` | 25 |
|
||||
| 7 | setEnabled | `getField("X")[?.]setEnabled(b)` | `setFieldEnabled("X", b)` | 10 |
|
||||
| 8 | propertyDataSource_setReadOnly | `getField("X")[?.]getPropertyDataSource()[?.]setReadOnly(b)` | `setFieldReadOnly("X", b)` | 30 |
|
||||
| 9 | setReadOnly_field | `getField("X")[?.]setReadOnly(b)` | `setFieldReadOnly("X", b)` | 64 |
|
||||
| 10 | setRequired | `getField("X")[?.]setRequired(b)` | `setFieldRequired("X", b)` | 6 |
|
||||
| 11 | setRequiredError | `getField("X")[?.]setRequiredError(msg)` | `setFieldRequiredError("X", msg)` | 3 |
|
||||
| 12 | setFilter(平衡括号) | `getField("X")[?.]setFilter(map)` | `setFieldFilter("X", map)` | 187 |
|
||||
| 13 | setFilterMap(平衡括号) | `getField("X")[?.]setFilterMap(map)` | `setFieldFilterMap("X", map)` | (并入 12 计数) |
|
||||
| 14 | removeAllItems_ds | `getField("X")[?.]getContainerDataSource()[?.]removeAllItems()` | `clearFieldData("X")` | (并入 15) |
|
||||
| 15 | removeAllItems | `getField("X")[?.]removeAllItems()` | `clearFieldData("X")` | 126 |
|
||||
| 16 | getContainerDataSource | `getField("X")[?.]getContainerDataSource()` | `getFieldDataSource("X")` | 159 |
|
||||
| 17 | getDisplay | `getField("X")[?.]getDisplay()` | `getFieldDisplay("X")` | 27 |
|
||||
| 18 | showAddButton | `getField("X")[?.]showAddButton(b)` | `setSubTableAddButtonVisible("X", b)` | 6 |
|
||||
| 19 | showDeleteButton | `getField("X")[?.]showDeleteButton(b)` | `setSubTableDeleteButtonVisible("X", b)` | 2 |
|
||||
| 20 | getModifyButton_setVisible | `getField("X")[?.]getModifyButton()[?.]setVisible(b)` | `setSubTableModifyButtonVisible("X", b)` | 3 |
|
||||
| 21 | getDetailButton_setVisible | `getField("X")[?.]getDetailButton()[?.]setVisible(b)` | `setSubTableDetailButtonVisible("X", b)` | 3 |
|
||||
| 22 | setViewWithoutEditor | `getField("X")[?.]setViewWithoutEditor(b)` | `setFieldViewOnly("X", b)` | 16 |
|
||||
| 23 | focus | `getField("X")[?.]focus()` | `focusField("X")` | — |
|
||||
| 24 | setWidth | `getField("X")[?.]setWidth(w)` | `setFieldWidth("X", w)` | — |
|
||||
| 25 | setHeight | `getField("X")[?.]setHeight(h)` | `setFieldHeight("X", h)` | — |
|
||||
| 26 | reload | `getField("X")[?.]reload()` | `reloadField("X")` | 27 |
|
||||
| 27 | setConvertedValue | `getField("X")[?.]setConvertedValue(v)` | `setFieldConvertedValue("X", v)` | 36 |
|
||||
| 28 | setNullSelectionItemId | `getField("X")[?.]setNullSelectionItemId(v)` | `setFieldNullSelection("X", v)` | 9 |
|
||||
| 29 | removeItem | `getField("X")[?.]removeItem(v)` | `removeFieldItem("X", v)` | 32 |
|
||||
| 30 | group_setReadOnly | `group[?.]setReadOnly(b)` | `setGroupReadOnly(b)` | 28 |
|
||||
| 31 | group_setEnabled | `group[?.]setEnabled(b)` | `setGroupEnabled(b)` | — |
|
||||
| 32 | Notification_show | `Notification.show(msg)` | `showToast(msg)` | 7 |
|
||||
| ★ | addFieldOption(idiom 折叠) | `getFieldDataSource("X")[?.]addItem(v)[?.]getItemProperty("des")[?.]setValue(d)` | `addFieldOption("X", v, d)` | 271 |
|
||||
|
||||
> `[?.]` 表示同时匹配 `.` 与 `?.`。`focus/setWidth/setHeight/setFilterMap/group_setEnabled` 真实库本批样本命中 0,作为前瞻动词登记,已配单测保证正确性。
|
||||
|
||||
### 2.3 内联逻辑(迭代加固)
|
||||
|
||||
- **字段句柄内联**:`def f = group.getField("X")` →(容忍 `;` 与 `//注释`)展开后续 `f.` 与 `f?.` 引用;用零宽断言只替换「持有者引用」,不误伤把变量当值用的场景(如 `if (v == null)`)。
|
||||
- **数据源句柄内联**:`def ds = getFieldDataSource("X")` → 展开 `ds?.addItem(...)`,使选项填充 idiom 可被 `addFieldOption` 折叠。
|
||||
|
||||
### 2.4 分类标签
|
||||
|
||||
| 标签 | 含义 | 后续动作 |
|
||||
|------|------|---------|
|
||||
| FULL_AUTO | 全部 S3 模式改写成功,无残留 | 直接入 P4 批量转换流水线 |
|
||||
| PARTIAL | 部分改写成功,仍有 S3 片段 | 人工审核,补全余留 |
|
||||
| HARD | 命中硬 S3 特征,整条未改写 | 进人工排期(amis dialog/service 重写) |
|
||||
| NO_S3 | 未检测到任何 S3 模式 | 原样进 P4 |
|
||||
|
||||
---
|
||||
|
||||
## 三、真实库实测结果
|
||||
|
||||
### 3.1 自动化率(真实库 1,427 条)
|
||||
|
||||
复测命令(只读):
|
||||
|
||||
```bash
|
||||
python3 run_eval.py --from-db --db-host 192.168.20.68 --db-port 5435 \
|
||||
--db-name postgres --db-user ceshi --db-pass ceshi \
|
||||
--output-json eval-real-20260611-final.json
|
||||
```
|
||||
|
||||
```
|
||||
总脚本数: 1427
|
||||
S3 脚本数: 612 (FULL_AUTO + PARTIAL + HARD)
|
||||
|
||||
FULL_AUTO : 497 条
|
||||
PARTIAL : 30 条
|
||||
HARD : 85 条
|
||||
NO_S3 : 815 条
|
||||
|
||||
★ 自动化率 = FULL_AUTO / S3总数 = 497 / 612 = 81.2%
|
||||
★ wrong_items = 0(0 误改)
|
||||
```
|
||||
|
||||
**结论:真实库自动化率 81.2% > 80% 预算线,锁定。**
|
||||
|
||||
### 3.2 迭代轨迹(7.1% → 81.2%)
|
||||
|
||||
| 轮次 | 关键改动 | FULL_AUTO | 自动化率 | 增量 |
|
||||
|------|---------|-----------|---------|------|
|
||||
| 基线 | 首版 14 规则(合成语料过拟合) | 45 | 7.1% | — |
|
||||
| R1 | `?.` 全规则支持+内联容错(分号/注释/`?.` 引用)+`addSubTableButton`+残留检测 `?.` 化 | 215 | 35.1% | +28.0 pp |
|
||||
| R2 | 平衡括号 `setFilter`+裸 `removeAllItems`+新动词(reload/setConvertedValue/removeItem/showAddButton/getModify/Detail 等) | 417 | 68.1% | +33.0 pp |
|
||||
| R3 | `addFieldOption` 选项填充 idiom 折叠+数据源句柄内联 | 467 | 76.3% | +8.2 pp |
|
||||
| R4 | `getPropertyDataSource().setReadOnly` 折叠 | 469 | 76.6% | +0.3 pp |
|
||||
| R5 | 内联容忍行尾注释+选项链 `?.` 变体 | 497 | 81.2% | +4.6 pp |
|
||||
|
||||
R5 跨过 80% 线后停止:剩余 30 PARTIAL 已是异质低频的深层 Vaadin 组件访问(见 3.4),继续扩规则收益 < 边际且有错改风险。
|
||||
|
||||
### 3.3 规则命中分布(真实库,Top)
|
||||
|
||||
| 规则 | 命中次数 |
|
||||
|------|---------|
|
||||
| addFieldOption | 271 |
|
||||
| setFilter(平衡括号) | 187 |
|
||||
| getContainerDataSource | 159 |
|
||||
| inline_datasource_handle | 159 |
|
||||
| removeAllItems | 126 |
|
||||
| getValue | 122 |
|
||||
| addSubTableButton | 108 |
|
||||
| setValue | 73 |
|
||||
| setReadOnly_field | 64 |
|
||||
| setConvertedValue | 36 |
|
||||
| removeItem | 32 |
|
||||
| propertyDataSource_setReadOnly | 30 |
|
||||
| group_setReadOnly | 28 |
|
||||
| getDisplay / reload | 27 / 27 |
|
||||
| setVisible / setCaption | 26 / 25 |
|
||||
| setViewWithoutEditor | 16 |
|
||||
| 其余(setEnabled/setNullSelectionItemId/Notification_show/setRequired/showAddButton/setRequiredError/getModify·Detail/showDeleteButton) | 各 2–10 |
|
||||
|
||||
### 3.4 PARTIAL 模式分布(30 条,均为诚实保留的人工边界)
|
||||
|
||||
| 残留 idiom | 条数 | 为何不自动化(避免错改) |
|
||||
|-----------|------|----------------------|
|
||||
| raw `.comboBox` 组件访问 | 6 | `getField("X")?.comboBox.setValue(v)` 直达内嵌 Vaadin ComboBox 组件,语义与字段值不必然等价 |
|
||||
| raw `.table` 组件访问 | 3 | `getField("X").table.getVisibleColumns()/setVisibleColumns()` 操作原始 Table 列模型 |
|
||||
| `addButton` 非可解析签名 | 2 | `addButton(field, 0)` 首参为运行时变量,无法静态解析字段名 |
|
||||
| 动态 `addComponent`/`new CaptionLabel` | 2 | 运行时构造 UI 组件树,属硬 S3 范畴 |
|
||||
| `parent`/`value` 组件树导航 | 2 | `?.parent?.parent` 向上遍历 Vaadin 组件树 |
|
||||
| `getItemCaption`/`setData` | 2 | Item 级标题查询/任意数据附着 |
|
||||
| `getPropertyDataSource` 其他链 | 2 | 非 `setReadOnly` 收尾的属性数据源链 |
|
||||
| 其他低频 | 11 | 多种单次出现的深层组件/容器操作 |
|
||||
|
||||
这些是**真实的自动化天花板**:直接操作 Vaadin 组件对象模型(`.comboBox`/`.table`/`.parent`),无法在不臆测语义的前提下映射到可移植 facade。强行改写会产出错误结果,违反「宁可 PARTIAL 也不错改」纪律,故诚实保留。
|
||||
|
||||
### 3.5 HARD 清单(85 条,硬 S3 判定全程未放松)
|
||||
|
||||
| 硬 S3 类型 | 条数 |
|
||||
|-----------|------|
|
||||
| 动态创建 Vaadin 组件(`new Window/Button/ComboBox/...`) | 81(独立)+3(叠加 showConfirmDialog)+1(叠加 UI.getCurrent) |
|
||||
| 同步确认框 `showConfirmDialog` | 3(均与动态组件叠加) |
|
||||
| `UI.getCurrent()` | 1(与动态组件叠加) |
|
||||
|
||||
HARD 计数从基线到迭代后**恒为 85,未减少 1 条**——本次迭代未将任何硬 S3 改判为可自动(造假红线),并已用断言验证每条 HARD 都有明确硬原因。
|
||||
|
||||
---
|
||||
|
||||
## 四、单测结果
|
||||
|
||||
```
|
||||
105 passed in 0.06s
|
||||
```
|
||||
|
||||
| 测试类 | 条数 | 覆盖 |
|
||||
|--------|------|------|
|
||||
| 既有 18 个测试类 | 68 | 首版规则+内联+分类+边界(全部保持绿色) |
|
||||
| TestSafeNavigation | 5 | `?.` 在字段/组规则上等价于 `.` |
|
||||
| TestInlineEdgeCases | 4 | 内联容忍分号/行尾注释/`?.` 引用+不误伤值用法 |
|
||||
| TestSubTableButtons | 6 | addSubTableButton/showAddButton/showDeleteButton/getModify·Detail |
|
||||
| TestNewFieldVerbs | 10 | setRequiredError/setViewWithoutEditor/focus/setWidth/setHeight/reload/setConvertedValue/setNullSelectionItemId/removeItem/propertyDataSource_setReadOnly |
|
||||
| TestBalancedSetFilter | 4 | setFilter 含嵌套 map 字面量与函数调用+setFilterMap |
|
||||
| TestOptionPopulation | 4 | addFieldOption idiom 折叠(含数据源句柄内联/函数值/全 `?.` 链/行尾注释) |
|
||||
| TestHonestBoundary | 4 | .comboBox/.table/非可解析 addButton/动态组件链保持 PARTIAL,不错改 |
|
||||
| **合计** | **105** | 每条新规则配单测;HARD 不放松;0 误改 |
|
||||
|
||||
---
|
||||
|
||||
## 五、对 P4 预算的结论
|
||||
|
||||
- **自动化率 81.2% 锁定(≥80%)**:632 条 S3 中约 497 条可经改写器全自动转 facade,直接入 P4 流水线。
|
||||
- **剩余人工量**:PARTIAL 30 条 + HARD 85 条 = 115 条需人工。按盘点报告保守口径 `(1 − 自动化率) × 632 × 0.5 人日 ≈ 59 人日 ≈ 2.8 人月`。
|
||||
- **与盘点 0.5–1 人月口径的差异说明**:盘点口径仅计 76 条硬 S3(≈0.5–1 人月);本保守重估把 PARTIAL 也按全人工计入,是上界。实际 PARTIAL 多为「大部分已自动改写、仅余几行深层组件访问」,人工补全成本远低于 0.5 人日/条,真实人工量应落在盘点的 **0.5–1 人月** 与本上界 **2.8 人月** 之间,偏向盘点口径。
|
||||
- **P4 facade 扩容输入**:本报告 2.2 节 31 条规则的目标动词表(含 `addSubTableButton`/`addFieldOption`/`setFieldFilter` 等超 20 个动词)即 P4 需在 amis facade 侧实现的事件指令清单。
|
||||
|
||||
---
|
||||
|
||||
## 六、产物文件清单
|
||||
|
||||
```
|
||||
eip4-poc/tools/s3_rewriter/
|
||||
├── rewrite.py # 核心改写器(Python 3,零运行依赖)
|
||||
├── mine_patterns.py # 真实语料模式挖掘(频率/形态/残留三表)
|
||||
├── dump_db_scripts.py # 真实库脚本一次性落盘缓存(只读)
|
||||
├── run_eval.py # 全语料评估(含 --from-db 真实库模式)
|
||||
├── test_rewriter.py # 单元测试(105 条,unittest/pytest 兼容)
|
||||
├── gen_corpus.py # 合成语料生成(首版,见附录 A)
|
||||
├── C4实测报告.md # 本报告
|
||||
├── scripts_cache.json # 真实库 1,427 条脚本本地缓存(离线迭代用)
|
||||
├── eval-real-20260611-final.json # 真实库最终评估结果留档
|
||||
├── eval-real-20260611.json # 真实库首测结果(7.1%,迭代起点留档)
|
||||
└── corpus/ # 合成语料 71 条(首版,附录 A 教训)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 七、使用说明
|
||||
|
||||
```bash
|
||||
# 真实库全量实测(只读)
|
||||
python3 run_eval.py --from-db --db-host 192.168.20.68 --db-port 5435 \
|
||||
--db-name postgres --db-user ceshi --db-pass ceshi \
|
||||
--output-json eval-real-YYYYMMDD.json
|
||||
|
||||
# 离线迭代:先落盘再反复跑(避免反复连库)
|
||||
python3 dump_db_scripts.py --db-host 192.168.20.68 --db-port 5435 \
|
||||
--db-name postgres --db-user ceshi --db-pass ceshi # → scripts_cache.json
|
||||
python3 mine_patterns.py --top 40 # 全量模式挖掘
|
||||
python3 mine_patterns.py --residual --top 30 # 仅看 PARTIAL 残留模式
|
||||
|
||||
# 单测
|
||||
python3 -m pytest test_rewriter.py -q
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 附录 A:合成语料首版教训(保留)
|
||||
|
||||
首版(2026-06-10)用 `gen_corpus.py` 按盘点报告 Top API 频率合成 71 条语料,实测自动化率 **81.8%(54/66)**,当时结论「超过 80% 预算线」。
|
||||
|
||||
**教训**:合成语料**过拟合了文档式写法**,把盘点报告里规整的 `group.getField("X").setVisible(v)` 当成了真实分布,结果真实库首测仅 **7.1%(45/632)**——真实脚本大量使用 `?.` 安全导航、带分号/注释的句柄变量、子表按钮、嵌套参数的 `setFilter`、多跳数据源选项填充 idiom,合成语料一概未覆盖。
|
||||
|
||||
**结论**:**合成语料可验证规则正确性,但不能替代真实分布做自动化率估计**。本次「7.1% → 真实迭代后 81.2%」的差距,全部来自真实形态变体的补齐,而非放松判定。任何「自动化率」数字必须以真实库 `--from-db` 实测为准。
|
||||
BIN
tools/s3_rewriter/__pycache__/rewrite.cpython-312.pyc
Normal file
BIN
tools/s3_rewriter/__pycache__/rewrite.cpython-312.pyc
Normal file
Binary file not shown.
BIN
tools/s3_rewriter/__pycache__/run_eval.cpython-312.pyc
Normal file
BIN
tools/s3_rewriter/__pycache__/run_eval.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
group.getField("PROJ_STATUS").addButton("查看详情", { item -> showDetail(item) })
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("PROJ_NAME").addButton("跳转", actionHandler)
|
||||
group.getField("CONTRACT_NO").addButton("合同详情", contractHandler)
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("APPLY_STATUS").addButton("审批", approveAction)
|
||||
group.getField("APPLY_STATUS").setVisible(item.STATUS == "PENDING")
|
||||
@@ -0,0 +1 @@
|
||||
group.getField("FILE_URL").addButton("下载", "download", { it -> downloadFile(it) })
|
||||
@@ -0,0 +1 @@
|
||||
group.getField('REMARK').addButton('备注', remarkAction)
|
||||
@@ -0,0 +1,2 @@
|
||||
def status = group.getField("STATUS").getValue()
|
||||
group.getField("ACTION_BTN").addButton("提交", { submitAction(status) })
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("PROJ_NAME").addButton("编辑", editHandler)
|
||||
group.getField("PROJ_NAME").setCaption("项目名称(必填)")
|
||||
@@ -0,0 +1,2 @@
|
||||
def f = group.getField("LABOR_NO")
|
||||
f.addButton("工人档案", workerHandler)
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("SUBMIT_BTN").addButton("提交审批", submitAction)
|
||||
group.getField("SUBMIT_BTN").setEnabled(item.DRAFT == true)
|
||||
@@ -0,0 +1,4 @@
|
||||
if (item.ROLE == "MANAGER") {
|
||||
group.getField("APPROVE_BTN").addButton("审批通过", approveOk)
|
||||
group.getField("APPROVE_BTN").addButton("驳回", approveReject)
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
def v = group.getField("CONTRACT_AMOUNT").getValue()
|
||||
return v > 0
|
||||
@@ -0,0 +1,3 @@
|
||||
def name = group.getField("PROJ_NAME").getValue()
|
||||
def no = group.getField("PROJ_NO").getValue()
|
||||
return name + " / " + no
|
||||
@@ -0,0 +1,3 @@
|
||||
if (group.getField("STATUS").getValue() == "APPROVED") {
|
||||
group.getField("CLOSE_BTN").setVisible(true)
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
def cur = group.getField("AMOUNT").getValue()
|
||||
group.getField("AMOUNT_DISPLAY").setValue("¥" + cur)
|
||||
@@ -0,0 +1,3 @@
|
||||
def fld = group.getField("PROJ_TYPE")
|
||||
def t = fld.getValue()
|
||||
enableButton("TYPE_BTN", t != null)
|
||||
@@ -0,0 +1,4 @@
|
||||
def v = group.getField("QTY").getValue()
|
||||
if (v == null) {
|
||||
Notification.show("数量不能为空")
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
def allow = group.getField("ALLOW_EDIT").getValue()
|
||||
group.getField("NAME").setEnabled(allow == true)
|
||||
group.getField("NAME").setRequired(allow == true)
|
||||
@@ -0,0 +1 @@
|
||||
group.getField("SUBCONTRACT_NO").getContainerDataSource().setFilter("STATUS=1")
|
||||
@@ -0,0 +1 @@
|
||||
group.getField("WORKER_ID").getContainerDataSource().setFilter("PROJ_ID=" + item.PROJ_ID)
|
||||
@@ -0,0 +1 @@
|
||||
group.getField("DETAIL_LIST").getContainerDataSource().removeAllItems()
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("DICT_FIELD").getContainerDataSource().removeAllItems()
|
||||
group.getField("DICT_FIELD").getContainerDataSource().setFilter("TYPE=CONTRACT")
|
||||
2
tools/s3_rewriter/corpus/022_PARTIAL_setFilter_05.groovy
Normal file
2
tools/s3_rewriter/corpus/022_PARTIAL_setFilter_05.groovy
Normal file
@@ -0,0 +1,2 @@
|
||||
def ds = group.getField("COMBO_FIELD").getContainerDataSource()
|
||||
ds.setFilter("ACTIVE=1")
|
||||
@@ -0,0 +1,2 @@
|
||||
def f = group.getField("LABOR_COMPANY")
|
||||
f.getContainerDataSource().setFilter("AREA_CODE=" + item.AREA)
|
||||
@@ -0,0 +1,2 @@
|
||||
def projId = group.getField("PROJ_ID").getValue()
|
||||
group.getField("CONTRACT_NO").getContainerDataSource().setFilter("PROJ_ID=" + projId)
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("TAG_LIST").getContainerDataSource().removeAllItems()
|
||||
group.getField("TAG_LIST").addButton("添加标签", addTagAction)
|
||||
@@ -0,0 +1 @@
|
||||
def source = group.getField("MATERIAL_TYPE").getContainerDataSource()
|
||||
@@ -0,0 +1,3 @@
|
||||
def companyId = item.COMPANY_ID
|
||||
group.getField("DEPT_ID").getContainerDataSource().setFilter("COMPANY_ID=" + companyId)
|
||||
group.getField("DEPT_ID").setVisible(companyId != null)
|
||||
@@ -0,0 +1,3 @@
|
||||
group.getField("PROVINCE").getContainerDataSource().setFilter("LEVEL=1")
|
||||
group.getField("CITY").getContainerDataSource().setFilter("LEVEL=2")
|
||||
group.getField("DISTRICT").getContainerDataSource().setFilter("LEVEL=3")
|
||||
@@ -0,0 +1,3 @@
|
||||
if (item.RESET_FLAG) {
|
||||
group.getField("OPTION_LIST").getContainerDataSource().removeAllItems()
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("CHOICE").getContainerDataSource().removeAllItems()
|
||||
group.getField("CHOICE").setVisible(false)
|
||||
@@ -0,0 +1 @@
|
||||
group.getField("SUBTYPE").getContainerDataSource().setFilter("PARENT_CODE='" + item.TYPE_CODE + "'")
|
||||
@@ -0,0 +1,3 @@
|
||||
def combo = group.getField("STATUS_COMBO")
|
||||
combo.getContainerDataSource().setFilter("CATEGORY=PROJ")
|
||||
combo.setCaption("项目状态")
|
||||
@@ -0,0 +1 @@
|
||||
group.setReadOnly(true)
|
||||
@@ -0,0 +1 @@
|
||||
group.setReadOnly(item.APPROVED == true)
|
||||
@@ -0,0 +1,2 @@
|
||||
group.setReadOnly(item.STATUS != "DRAFT")
|
||||
group.getField("SUBMIT_BTN").setVisible(item.STATUS == "DRAFT")
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("CREATE_TIME").setReadOnly(true)
|
||||
group.getField("CREATE_BY").setReadOnly(true)
|
||||
@@ -0,0 +1,2 @@
|
||||
group.setReadOnly(true)
|
||||
group.getField("REMARK").setReadOnly(false)
|
||||
@@ -0,0 +1 @@
|
||||
def disp = group.getField("PROJ_STATUS").getDisplay()
|
||||
@@ -0,0 +1,3 @@
|
||||
def label = group.getField("TYPE").getDisplay()
|
||||
def val = group.getField("TYPE").getValue()
|
||||
return label + ":" + val
|
||||
@@ -0,0 +1,3 @@
|
||||
if (group.getField("STATUS").getDisplay() == "已审批") {
|
||||
group.getField("CLOSE_BTN").setVisible(true)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
def f = group.getField("CATEGORY")
|
||||
def d = f.getDisplay()
|
||||
setFieldCaption("NOTE", d)
|
||||
@@ -0,0 +1 @@
|
||||
group.getField("APPROVE_NOTE").setVisible(item.STATUS == "REJECTED")
|
||||
@@ -0,0 +1,3 @@
|
||||
def show = item.PROJ_TYPE == "CONSTRUCTION"
|
||||
group.getField("SAFETY_CERT").setVisible(show)
|
||||
group.getField("SAFETY_DATE").setVisible(show)
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("TAX_NO").setVisible(item.HAS_TAX == true)
|
||||
group.getField("TAX_NO").setRequired(item.HAS_TAX == true)
|
||||
@@ -0,0 +1,3 @@
|
||||
["FIELD_A", "FIELD_B", "FIELD_C"].each { fn ->
|
||||
group.getField(fn).setVisible(item.SHOW_ALL)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
group.getField("AMOUNT").setCaption("合同金额(元)")
|
||||
@@ -0,0 +1,2 @@
|
||||
def label = item.PROJ_TYPE == "PUBLIC" ? "公共项目编号" : "私人项目编号"
|
||||
group.getField("PROJ_NO").setCaption(label)
|
||||
@@ -0,0 +1,2 @@
|
||||
group.getField("LABOR_COUNT").setCaption("劳务人数")
|
||||
group.getField("LABOR_COUNT").setEnabled(item.CONTRACT_TYPE == "LABOR")
|
||||
@@ -0,0 +1 @@
|
||||
Notification.show("操作成功")
|
||||
@@ -0,0 +1,2 @@
|
||||
def msg = "保存成功:" + item.PROJ_NAME
|
||||
Notification.show(msg)
|
||||
@@ -0,0 +1,6 @@
|
||||
def v = group.getField("AMOUNT").getValue()
|
||||
if (v == null || v <= 0) {
|
||||
Notification.show("金额必须大于零")
|
||||
} else {
|
||||
Notification.show("金额有效")
|
||||
}
|
||||
13
tools/s3_rewriter/corpus/052_FULL_AUTO_mixed_01.groovy
Normal file
13
tools/s3_rewriter/corpus/052_FULL_AUTO_mixed_01.groovy
Normal file
@@ -0,0 +1,13 @@
|
||||
// 项目信息联动脚本
|
||||
def projType = group.getField("PROJ_TYPE").getValue()
|
||||
if (projType == "BIG") {
|
||||
group.getField("SAFETY_MGR").setVisible(true)
|
||||
group.getField("SAFETY_MGR").setRequired(true)
|
||||
group.getField("SAFETY_MGR").getContainerDataSource().setFilter("ROLE=SAFETY")
|
||||
} else {
|
||||
group.getField("SAFETY_MGR").setVisible(false)
|
||||
group.getField("SAFETY_MGR").setRequired(false)
|
||||
}
|
||||
group.getField("PROJ_NO").setCaption("项目编号(" + projType + ")")
|
||||
group.getField("SUBMIT_BTN").addButton("提交", submitAction)
|
||||
Notification.show("项目类型已切换: " + projType)
|
||||
6
tools/s3_rewriter/corpus/053_FULL_AUTO_mixed_02.groovy
Normal file
6
tools/s3_rewriter/corpus/053_FULL_AUTO_mixed_02.groovy
Normal file
@@ -0,0 +1,6 @@
|
||||
def statusFld = group.getField("STATUS")
|
||||
def status = statusFld.getValue()
|
||||
def dispFld = group.getField("STATUS_DISPLAY")
|
||||
dispFld.setCaption(status == "ACTIVE" ? "活跃" : "非活跃")
|
||||
dispFld.setVisible(true)
|
||||
group.setReadOnly(status == "CLOSED")
|
||||
5
tools/s3_rewriter/corpus/054_FULL_AUTO_mixed_03.groovy
Normal file
5
tools/s3_rewriter/corpus/054_FULL_AUTO_mixed_03.groovy
Normal file
@@ -0,0 +1,5 @@
|
||||
def typeVal = group.getField("SUBCONTRACT_TYPE").getValue()
|
||||
group.getField("COMPANY").getContainerDataSource().removeAllItems()
|
||||
group.getField("COMPANY").getContainerDataSource().setFilter("TYPE=" + typeVal)
|
||||
group.getField("COMPANY").setVisible(typeVal != null)
|
||||
group.getField("COMPANY").setEnabled(typeVal != null)
|
||||
10
tools/s3_rewriter/corpus/055_FULL_AUTO_mixed_04.groovy
Normal file
10
tools/s3_rewriter/corpus/055_FULL_AUTO_mixed_04.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
def role = item.USER_ROLE
|
||||
if (role == "ADMIN") {
|
||||
group.setReadOnly(false)
|
||||
group.getField("DELETE_BTN").addButton("删除", deleteAction)
|
||||
group.getField("AUDIT_LOG").setVisible(true)
|
||||
} else {
|
||||
group.setReadOnly(true)
|
||||
group.getField("DELETE_BTN").setVisible(false)
|
||||
group.getField("AUDIT_LOG").setVisible(false)
|
||||
}
|
||||
6
tools/s3_rewriter/corpus/056_FULL_AUTO_mixed_05.groovy
Normal file
6
tools/s3_rewriter/corpus/056_FULL_AUTO_mixed_05.groovy
Normal file
@@ -0,0 +1,6 @@
|
||||
def fProj = group.getField("PROJ_ID")
|
||||
def fDept = group.getField("DEPT_ID")
|
||||
fProj.getContainerDataSource().setFilter("STATUS=ACTIVE")
|
||||
fDept.getContainerDataSource().setFilter("PROJ_ID=" + fProj.getValue())
|
||||
fProj.setCaption("所属项目")
|
||||
fDept.setCaption("所属部门")
|
||||
2
tools/s3_rewriter/corpus/057_PARTIAL_partial_01.groovy
Normal file
2
tools/s3_rewriter/corpus/057_PARTIAL_partial_01.groovy
Normal file
@@ -0,0 +1,2 @@
|
||||
group.getField("PROJ_NAME").setVisible(true)
|
||||
group.getField("SPECIAL_FIELD").setStyleName("highlight") // setStyleName 不在规则表
|
||||
2
tools/s3_rewriter/corpus/058_PARTIAL_partial_02.groovy
Normal file
2
tools/s3_rewriter/corpus/058_PARTIAL_partial_02.groovy
Normal file
@@ -0,0 +1,2 @@
|
||||
group.getField("STATUS").setValue("ACTIVE")
|
||||
group.getField("CUSTOM_WIDGET").customSpecialMethod("arg1") // 不可识别
|
||||
2
tools/s3_rewriter/corpus/059_PARTIAL_partial_03.groovy
Normal file
2
tools/s3_rewriter/corpus/059_PARTIAL_partial_03.groovy
Normal file
@@ -0,0 +1,2 @@
|
||||
group.getField("NAME").setCaption("姓名")
|
||||
group.getField("PANEL").addComponent(someWidget) // addComponent 不在规则
|
||||
4
tools/s3_rewriter/corpus/060_HARD_hard_01.groovy
Normal file
4
tools/s3_rewriter/corpus/060_HARD_hard_01.groovy
Normal file
@@ -0,0 +1,4 @@
|
||||
def win = new Window("详情窗口")
|
||||
win.setWidth("800px")
|
||||
win.center()
|
||||
UI.getCurrent().addWindow(win)
|
||||
3
tools/s3_rewriter/corpus/061_HARD_hard_02.groovy
Normal file
3
tools/s3_rewriter/corpus/061_HARD_hard_02.groovy
Normal file
@@ -0,0 +1,3 @@
|
||||
def btn = new Button("确认")
|
||||
btn.addClickListener({ e -> doConfirm() })
|
||||
layout.addComponent(btn)
|
||||
4
tools/s3_rewriter/corpus/062_HARD_hard_03.groovy
Normal file
4
tools/s3_rewriter/corpus/062_HARD_hard_03.groovy
Normal file
@@ -0,0 +1,4 @@
|
||||
def combo = new ComboBox("选择状态")
|
||||
combo.addItem("ACTIVE")
|
||||
combo.addItem("CLOSED")
|
||||
group.getField("PANEL").addComponent(combo)
|
||||
5
tools/s3_rewriter/corpus/063_HARD_hard_04.groovy
Normal file
5
tools/s3_rewriter/corpus/063_HARD_hard_04.groovy
Normal file
@@ -0,0 +1,5 @@
|
||||
showConfirmDialog("确认删除?", {
|
||||
if (it == true) {
|
||||
deleteRecord(item.ID)
|
||||
}
|
||||
})
|
||||
4
tools/s3_rewriter/corpus/064_HARD_hard_05.groovy
Normal file
4
tools/s3_rewriter/corpus/064_HARD_hard_05.groovy
Normal file
@@ -0,0 +1,4 @@
|
||||
def ui = UI.getCurrent()
|
||||
ui.access({
|
||||
Notification.show("后台操作完成")
|
||||
})
|
||||
4
tools/s3_rewriter/corpus/065_HARD_hard_06.groovy
Normal file
4
tools/s3_rewriter/corpus/065_HARD_hard_06.groovy
Normal file
@@ -0,0 +1,4 @@
|
||||
def tf = new TextField("备注")
|
||||
tf.setWidth("100%")
|
||||
tf.setValue(item.REMARK ?: "")
|
||||
verticalLayout.addComponent(tf)
|
||||
4
tools/s3_rewriter/corpus/066_HARD_hard_07.groovy
Normal file
4
tools/s3_rewriter/corpus/066_HARD_hard_07.groovy
Normal file
@@ -0,0 +1,4 @@
|
||||
group.getField("PROJ_ID").getContainerDataSource().setFilter("STATUS=1")
|
||||
def popup = new Window("弹窗")
|
||||
popup.center()
|
||||
UI.getCurrent().addWindow(popup)
|
||||
1
tools/s3_rewriter/corpus/067_NO_S3_no_s3_01.groovy
Normal file
1
tools/s3_rewriter/corpus/067_NO_S3_no_s3_01.groovy
Normal file
@@ -0,0 +1 @@
|
||||
return item.AMOUNT > 10000
|
||||
2
tools/s3_rewriter/corpus/068_NO_S3_no_s3_02.groovy
Normal file
2
tools/s3_rewriter/corpus/068_NO_S3_no_s3_02.groovy
Normal file
@@ -0,0 +1,2 @@
|
||||
enableButton("SUBMIT_BTN", item.STATUS == "DRAFT")
|
||||
enableButton("CANCEL_BTN", item.STATUS != "CLOSED")
|
||||
2
tools/s3_rewriter/corpus/069_NO_S3_no_s3_03.groovy
Normal file
2
tools/s3_rewriter/corpus/069_NO_S3_no_s3_03.groovy
Normal file
@@ -0,0 +1,2 @@
|
||||
setFieldVisible("APPROVE_NOTE", item.STATUS == "REJECTED")
|
||||
setFieldRequired("APPROVE_NOTE", item.STATUS == "REJECTED")
|
||||
3
tools/s3_rewriter/corpus/070_NO_S3_no_s3_04.groovy
Normal file
3
tools/s3_rewriter/corpus/070_NO_S3_no_s3_04.groovy
Normal file
@@ -0,0 +1,3 @@
|
||||
def total = item.UNIT_PRICE * item.QTY
|
||||
item.TOTAL_AMOUNT = total
|
||||
return total
|
||||
3
tools/s3_rewriter/corpus/071_NO_S3_no_s3_05.groovy
Normal file
3
tools/s3_rewriter/corpus/071_NO_S3_no_s3_05.groovy
Normal file
@@ -0,0 +1,3 @@
|
||||
setFieldValue("PROJ_STATUS", "ACTIVE")
|
||||
showToast("状态更新成功")
|
||||
setGroupReadOnly(false)
|
||||
499
tools/s3_rewriter/corpus/index.json
Normal file
499
tools/s3_rewriter/corpus/index.json
Normal file
@@ -0,0 +1,499 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"filename": "001_FULL_AUTO_addButton_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "单字段加按钮",
|
||||
"name": "addButton_01"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"filename": "002_FULL_AUTO_addButton_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "多字段加按钮",
|
||||
"name": "addButton_02"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"filename": "003_FULL_AUTO_addButton_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "addButton+setVisible 混合",
|
||||
"name": "addButton_03"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"filename": "004_FULL_AUTO_addButton_04.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "addButton 带多参数",
|
||||
"name": "addButton_04"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"filename": "005_FULL_AUTO_addButton_05.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "addButton 单引号字段名",
|
||||
"name": "addButton_05"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"filename": "006_FULL_AUTO_addButton_06.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "addButton + getValue 联动",
|
||||
"name": "addButton_06"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"filename": "007_FULL_AUTO_addButton_07.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "addButton + setCaption",
|
||||
"name": "addButton_07"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"filename": "008_FULL_AUTO_addButton_08.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "中间变量 addButton(变量内联)",
|
||||
"name": "addButton_08"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"filename": "009_FULL_AUTO_addButton_09.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "addButton + setEnabled",
|
||||
"name": "addButton_09"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"filename": "010_FULL_AUTO_addButton_10.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "addButton 嵌套 if",
|
||||
"name": "addButton_10"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"filename": "011_FULL_AUTO_getValue_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getValue 单用",
|
||||
"name": "getValue_01"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"filename": "012_FULL_AUTO_getValue_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getValue 多字段",
|
||||
"name": "getValue_02"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"filename": "013_FULL_AUTO_getValue_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getValue 条件分支",
|
||||
"name": "getValue_03"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"filename": "014_FULL_AUTO_getValue_04.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getValue + setValue",
|
||||
"name": "getValue_04"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"filename": "015_FULL_AUTO_getValue_05.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getValue 变量内联",
|
||||
"name": "getValue_05"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"filename": "016_FULL_AUTO_getValue_06.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getValue + Notification",
|
||||
"name": "getValue_06"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"filename": "017_FULL_AUTO_getValue_07.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getValue 链式比较",
|
||||
"name": "getValue_07"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"filename": "018_FULL_AUTO_setFilter_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setFilter 基本",
|
||||
"name": "setFilter_01"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"filename": "019_FULL_AUTO_setFilter_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setFilter 多条件",
|
||||
"name": "setFilter_02"
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"filename": "020_FULL_AUTO_setFilter_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "removeAllItems 基本",
|
||||
"name": "setFilter_03"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"filename": "021_FULL_AUTO_setFilter_04.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setFilter + removeAllItems",
|
||||
"name": "setFilter_04"
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"filename": "022_PARTIAL_setFilter_05.groovy",
|
||||
"expected_label": "PARTIAL",
|
||||
"description": "getContainerDataSource 裸取后用中间变量调用 setFilter(ds 不是字段句柄,内联不覆盖)",
|
||||
"name": "setFilter_05"
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"filename": "023_FULL_AUTO_setFilter_06.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "中间变量 setFilter",
|
||||
"name": "setFilter_06"
|
||||
},
|
||||
{
|
||||
"id": 24,
|
||||
"filename": "024_FULL_AUTO_setFilter_07.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setFilter + getValue",
|
||||
"name": "setFilter_07"
|
||||
},
|
||||
{
|
||||
"id": 25,
|
||||
"filename": "025_FULL_AUTO_setFilter_08.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "removeAllItems + addButton",
|
||||
"name": "setFilter_08"
|
||||
},
|
||||
{
|
||||
"id": 26,
|
||||
"filename": "026_FULL_AUTO_getContainerDataSource_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getContainerDataSource 单独使用",
|
||||
"name": "getContainerDataSource_01"
|
||||
},
|
||||
{
|
||||
"id": 27,
|
||||
"filename": "027_FULL_AUTO_setFilter_09.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setFilter 动态参数",
|
||||
"name": "setFilter_09"
|
||||
},
|
||||
{
|
||||
"id": 28,
|
||||
"filename": "028_FULL_AUTO_setFilter_10.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "多字段 setFilter",
|
||||
"name": "setFilter_10"
|
||||
},
|
||||
{
|
||||
"id": 29,
|
||||
"filename": "029_FULL_AUTO_removeAllItems_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "removeAllItems 在条件内",
|
||||
"name": "removeAllItems_01"
|
||||
},
|
||||
{
|
||||
"id": 30,
|
||||
"filename": "030_FULL_AUTO_removeAllItems_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "removeAllItems + setVisible",
|
||||
"name": "removeAllItems_02"
|
||||
},
|
||||
{
|
||||
"id": 31,
|
||||
"filename": "031_FULL_AUTO_setFilter_11.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setFilter 字符串拼接",
|
||||
"name": "setFilter_11"
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"filename": "032_FULL_AUTO_setFilter_12.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setFilter 变量内联后改写",
|
||||
"name": "setFilter_12"
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"filename": "033_FULL_AUTO_setReadOnly_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "group.setReadOnly 基本",
|
||||
"name": "setReadOnly_01"
|
||||
},
|
||||
{
|
||||
"id": 34,
|
||||
"filename": "034_FULL_AUTO_setReadOnly_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "group.setReadOnly 条件",
|
||||
"name": "setReadOnly_02"
|
||||
},
|
||||
{
|
||||
"id": 35,
|
||||
"filename": "035_FULL_AUTO_setReadOnly_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "group.setReadOnly + setVisible",
|
||||
"name": "setReadOnly_03"
|
||||
},
|
||||
{
|
||||
"id": 36,
|
||||
"filename": "036_FULL_AUTO_setReadOnly_04.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "field.setReadOnly 单字段",
|
||||
"name": "setReadOnly_04"
|
||||
},
|
||||
{
|
||||
"id": 37,
|
||||
"filename": "037_FULL_AUTO_setReadOnly_05.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "group + field 混合 setReadOnly",
|
||||
"name": "setReadOnly_05"
|
||||
},
|
||||
{
|
||||
"id": 38,
|
||||
"filename": "038_FULL_AUTO_getDisplay_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getDisplay 基本",
|
||||
"name": "getDisplay_01"
|
||||
},
|
||||
{
|
||||
"id": 39,
|
||||
"filename": "039_FULL_AUTO_getDisplay_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getDisplay + getValue",
|
||||
"name": "getDisplay_02"
|
||||
},
|
||||
{
|
||||
"id": 40,
|
||||
"filename": "040_FULL_AUTO_getDisplay_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getDisplay 条件逻辑",
|
||||
"name": "getDisplay_03"
|
||||
},
|
||||
{
|
||||
"id": 41,
|
||||
"filename": "041_FULL_AUTO_getDisplay_04.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "getDisplay 变量内联",
|
||||
"name": "getDisplay_04"
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"filename": "042_FULL_AUTO_setVisible_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setVisible 基本",
|
||||
"name": "setVisible_01"
|
||||
},
|
||||
{
|
||||
"id": 43,
|
||||
"filename": "043_FULL_AUTO_setVisible_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setVisible 多字段",
|
||||
"name": "setVisible_02"
|
||||
},
|
||||
{
|
||||
"id": 44,
|
||||
"filename": "044_FULL_AUTO_setVisible_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setVisible + setRequired",
|
||||
"name": "setVisible_03"
|
||||
},
|
||||
{
|
||||
"id": 45,
|
||||
"filename": "045_PARTIAL_setVisible_04.groovy",
|
||||
"expected_label": "PARTIAL",
|
||||
"description": "setVisible 循环(字段名为变量 fn,正则无法匹配字面量,余留待人工)",
|
||||
"name": "setVisible_04"
|
||||
},
|
||||
{
|
||||
"id": 46,
|
||||
"filename": "046_FULL_AUTO_setCaption_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setCaption 基本",
|
||||
"name": "setCaption_01"
|
||||
},
|
||||
{
|
||||
"id": 47,
|
||||
"filename": "047_FULL_AUTO_setCaption_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setCaption 动态标题",
|
||||
"name": "setCaption_02"
|
||||
},
|
||||
{
|
||||
"id": 48,
|
||||
"filename": "048_FULL_AUTO_setCaption_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "setCaption + setEnabled",
|
||||
"name": "setCaption_03"
|
||||
},
|
||||
{
|
||||
"id": 49,
|
||||
"filename": "049_FULL_AUTO_notification_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "Notification.show 基本",
|
||||
"name": "notification_01"
|
||||
},
|
||||
{
|
||||
"id": 50,
|
||||
"filename": "050_FULL_AUTO_notification_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "Notification.show 动态消息",
|
||||
"name": "notification_02"
|
||||
},
|
||||
{
|
||||
"id": 51,
|
||||
"filename": "051_FULL_AUTO_notification_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "Notification.show + getValue",
|
||||
"name": "notification_03"
|
||||
},
|
||||
{
|
||||
"id": 52,
|
||||
"filename": "052_FULL_AUTO_mixed_01.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "复杂多模式混合",
|
||||
"name": "mixed_01"
|
||||
},
|
||||
{
|
||||
"id": 53,
|
||||
"filename": "053_FULL_AUTO_mixed_02.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "变量内联+多规则",
|
||||
"name": "mixed_02"
|
||||
},
|
||||
{
|
||||
"id": 54,
|
||||
"filename": "054_FULL_AUTO_mixed_03.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "数据源+显隐联动",
|
||||
"name": "mixed_03"
|
||||
},
|
||||
{
|
||||
"id": 55,
|
||||
"filename": "055_FULL_AUTO_mixed_04.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "嵌套条件多字段控制",
|
||||
"name": "mixed_04"
|
||||
},
|
||||
{
|
||||
"id": 56,
|
||||
"filename": "056_FULL_AUTO_mixed_05.groovy",
|
||||
"expected_label": "FULL_AUTO",
|
||||
"description": "多变量内联+复合改写",
|
||||
"name": "mixed_05"
|
||||
},
|
||||
{
|
||||
"id": 57,
|
||||
"filename": "057_PARTIAL_partial_01.groovy",
|
||||
"expected_label": "PARTIAL",
|
||||
"description": "PARTIAL: 含不在规则表内的方法",
|
||||
"name": "partial_01"
|
||||
},
|
||||
{
|
||||
"id": 58,
|
||||
"filename": "058_PARTIAL_partial_02.groovy",
|
||||
"expected_label": "PARTIAL",
|
||||
"description": "PARTIAL: 含自定义组件方法",
|
||||
"name": "partial_02"
|
||||
},
|
||||
{
|
||||
"id": 59,
|
||||
"filename": "059_PARTIAL_partial_03.groovy",
|
||||
"expected_label": "PARTIAL",
|
||||
"description": "PARTIAL: addComponent 不在规则",
|
||||
"name": "partial_03"
|
||||
},
|
||||
{
|
||||
"id": 60,
|
||||
"filename": "060_HARD_hard_01.groovy",
|
||||
"expected_label": "HARD",
|
||||
"description": "HARD: new Window",
|
||||
"name": "hard_01"
|
||||
},
|
||||
{
|
||||
"id": 61,
|
||||
"filename": "061_HARD_hard_02.groovy",
|
||||
"expected_label": "HARD",
|
||||
"description": "HARD: new Button",
|
||||
"name": "hard_02"
|
||||
},
|
||||
{
|
||||
"id": 62,
|
||||
"filename": "062_HARD_hard_03.groovy",
|
||||
"expected_label": "HARD",
|
||||
"description": "HARD: new ComboBox",
|
||||
"name": "hard_03"
|
||||
},
|
||||
{
|
||||
"id": 63,
|
||||
"filename": "063_HARD_hard_04.groovy",
|
||||
"expected_label": "HARD",
|
||||
"description": "HARD: showConfirmDialog",
|
||||
"name": "hard_04"
|
||||
},
|
||||
{
|
||||
"id": 64,
|
||||
"filename": "064_HARD_hard_05.groovy",
|
||||
"expected_label": "HARD",
|
||||
"description": "HARD: UI.getCurrent",
|
||||
"name": "hard_05"
|
||||
},
|
||||
{
|
||||
"id": 65,
|
||||
"filename": "065_HARD_hard_06.groovy",
|
||||
"expected_label": "HARD",
|
||||
"description": "HARD: new TextField 动态",
|
||||
"name": "hard_06"
|
||||
},
|
||||
{
|
||||
"id": 66,
|
||||
"filename": "066_HARD_hard_07.groovy",
|
||||
"expected_label": "HARD",
|
||||
"description": "HARD: new Window + setFilter 混合(整条转人工)",
|
||||
"name": "hard_07"
|
||||
},
|
||||
{
|
||||
"id": 67,
|
||||
"filename": "067_NO_S3_no_s3_01.groovy",
|
||||
"expected_label": "NO_S3",
|
||||
"description": "NO_S3: 纯行级表达式 S1",
|
||||
"name": "no_s3_01"
|
||||
},
|
||||
{
|
||||
"id": 68,
|
||||
"filename": "068_NO_S3_no_s3_02.groovy",
|
||||
"expected_label": "NO_S3",
|
||||
"description": "NO_S3: enableButton S2 形态",
|
||||
"name": "no_s3_02"
|
||||
},
|
||||
{
|
||||
"id": 69,
|
||||
"filename": "069_NO_S3_no_s3_03.groovy",
|
||||
"expected_label": "NO_S3",
|
||||
"description": "NO_S3: setFieldVisible S2 形态",
|
||||
"name": "no_s3_03"
|
||||
},
|
||||
{
|
||||
"id": 70,
|
||||
"filename": "070_NO_S3_no_s3_04.groovy",
|
||||
"expected_label": "NO_S3",
|
||||
"description": "NO_S3: 纯数值计算",
|
||||
"name": "no_s3_04"
|
||||
},
|
||||
{
|
||||
"id": 71,
|
||||
"filename": "071_NO_S3_no_s3_05.groovy",
|
||||
"expected_label": "NO_S3",
|
||||
"description": "NO_S3: S2 辅助函数调用",
|
||||
"name": "no_s3_05"
|
||||
}
|
||||
]
|
||||
47
tools/s3_rewriter/dump_db_scripts.py
Normal file
47
tools/s3_rewriter/dump_db_scripts.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
dump_db_scripts.py — 把真实库脚本一次性落盘为本地缓存,供离线挖掘/迭代。
|
||||
|
||||
复用 run_eval.load_corpus_db 的 SQL 口径(只读),输出:
|
||||
scripts_cache.json — [{id, name, description, source}, ...]
|
||||
|
||||
用法:
|
||||
python dump_db_scripts.py --db-host 192.168.20.68 --db-port 5435 \
|
||||
--db-name postgres --db-user ceshi --db-pass ceshi
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from run_eval import load_corpus_db
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("--db-host", default="192.168.20.68")
|
||||
p.add_argument("--db-port", default="5435")
|
||||
p.add_argument("--db-name", default="postgres")
|
||||
p.add_argument("--db-user", default="ceshi")
|
||||
p.add_argument("--db-pass", default="ceshi")
|
||||
p.add_argument("--out", default=os.path.join(os.path.dirname(__file__),
|
||||
"scripts_cache.json"))
|
||||
args = p.parse_args()
|
||||
|
||||
records = load_corpus_db({
|
||||
"host": args.db_host, "port": args.db_port,
|
||||
"dbname": args.db_name, "user": args.db_user,
|
||||
"password": args.db_pass,
|
||||
})
|
||||
# 只留必要字段
|
||||
slim = [{"id": r["id"], "name": r["name"],
|
||||
"description": r["description"], "source": r["source"]}
|
||||
for r in records]
|
||||
with open(args.out, "w", encoding="utf-8") as f:
|
||||
json.dump(slim, f, ensure_ascii=False, indent=2)
|
||||
print(f"已落盘 {len(slim)} 条脚本 → {args.out}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
875
tools/s3_rewriter/eval-real-20260611-final.json
Normal file
875
tools/s3_rewriter/eval-real-20260611-final.json
Normal file
@@ -0,0 +1,875 @@
|
||||
{
|
||||
"total": 1427,
|
||||
"label_counts": {
|
||||
"NO_S3": 815,
|
||||
"FULL_AUTO": 497,
|
||||
"PARTIAL": 30,
|
||||
"HARD": 85
|
||||
},
|
||||
"total_s3": 612,
|
||||
"automation_rate": 81.20915032679738,
|
||||
"rule_hit_counts": {
|
||||
"addSubTableButton": 108,
|
||||
"removeAllItems": 126,
|
||||
"getContainerDataSource": 159,
|
||||
"inline_datasource_handle": 159,
|
||||
"addFieldOption": 271,
|
||||
"group_setReadOnly": 28,
|
||||
"setValue": 73,
|
||||
"setVisible": 26,
|
||||
"setCaption": 25,
|
||||
"setRequired": 6,
|
||||
"setRequiredError": 3,
|
||||
"balanced_setFilter": 187,
|
||||
"setReadOnly_field": 64,
|
||||
"getValue": 122,
|
||||
"setConvertedValue": 36,
|
||||
"removeItem": 32,
|
||||
"getDisplay": 27,
|
||||
"propertyDataSource_setReadOnly": 30,
|
||||
"setViewWithoutEditor": 16,
|
||||
"setNullSelectionItemId": 9,
|
||||
"Notification_show": 7,
|
||||
"setEnabled": 10,
|
||||
"reload": 27,
|
||||
"showDeleteButton": 2,
|
||||
"showAddButton": 6,
|
||||
"getModifyButton_setVisible": 3,
|
||||
"getDetailButton_setVisible": 3
|
||||
},
|
||||
"hard_items": [
|
||||
{
|
||||
"id": 101,
|
||||
"name": "1a48f81b-e212-4af8-ac2f-f90ec0f3c7c3_建造师执业资格证",
|
||||
"description": "真实脚本 from view_template id=1a48f81b-e212-4af8-ac2f-f90ec0f3c7c3",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 106,
|
||||
"name": "1a7f5b05-adee-4a67-a311-ac9f76af2c15_物资合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=1a7f5b05-adee-4a67-a311-ac9f76af2c15",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"name": "1a7f5b05-adee-4a67-a311-ac9f76af2c15_物资合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=1a7f5b05-adee-4a67-a311-ac9f76af2c15",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 135,
|
||||
"name": "1e9bcd2c-e1e2-4e35-a21a-a5c26b17741e_江苏省中标公告",
|
||||
"description": "真实脚本 from view_template id=1e9bcd2c-e1e2-4e35-a21a-a5c26b17741e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 137,
|
||||
"name": "1edd6c1c-2d17-4504-8ee5-faf12822c0c2_物资合同登记-需要评审",
|
||||
"description": "真实脚本 from view_template id=1edd6c1c-2d17-4504-8ee5-faf12822c0c2",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"name": "1f13f729-0dc3-46c1-aab0-d0ef1ccf67a5_评标结果公示(业绩库导航)",
|
||||
"description": "真实脚本 from view_template id=1f13f729-0dc3-46c1-aab0-d0ef1ccf67a5",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 162,
|
||||
"name": "213d1b7e-e1b7-4ab4-ae4a-181ae4b40461_劳务分包合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=213d1b7e-e1b7-4ab4-ae4a-181ae4b40461",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 163,
|
||||
"name": "213d1b7e-e1b7-4ab4-ae4a-181ae4b40461_劳务分包合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=213d1b7e-e1b7-4ab4-ae4a-181ae4b40461",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 174,
|
||||
"name": "2213796d-03b0-4b74-b923-6be0415cd002_劳务分包合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=2213796d-03b0-4b74-b923-6be0415cd002",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 175,
|
||||
"name": "2213796d-03b0-4b74-b923-6be0415cd002_劳务分包合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=2213796d-03b0-4b74-b923-6be0415cd002",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 212,
|
||||
"name": "26fe10ae-93a9-45c4-9f58-2183e6050100_专业分包合同评审",
|
||||
"description": "真实脚本 from view_template id=26fe10ae-93a9-45c4-9f58-2183e6050100",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 213,
|
||||
"name": "26fe10ae-93a9-45c4-9f58-2183e6050100_专业分包合同评审",
|
||||
"description": "真实脚本 from view_template id=26fe10ae-93a9-45c4-9f58-2183e6050100",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 216,
|
||||
"name": "279c4492-0851-4b82-a8dc-88e19922f08a_ABC三类人员证",
|
||||
"description": "真实脚本 from view_template id=279c4492-0851-4b82-a8dc-88e19922f08a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 222,
|
||||
"name": "2852ff22-439c-4625-a2c5-c70b547d82ca_计划成本变更",
|
||||
"description": "真实脚本 from view_template id=2852ff22-439c-4625-a2c5-c70b547d82ca",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 223,
|
||||
"name": "2852ff22-439c-4625-a2c5-c70b547d82ca_计划成本变更",
|
||||
"description": "真实脚本 from view_template id=2852ff22-439c-4625-a2c5-c70b547d82ca",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 260,
|
||||
"name": "2cceb83c-4079-43e4-b7b7-c395fd68cbbc_建造师注册证",
|
||||
"description": "真实脚本 from view_template id=2cceb83c-4079-43e4-b7b7-c395fd68cbbc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 262,
|
||||
"name": "2cceb83c-4079-43e4-b7b7-c395fd68cbbc_建造师注册证",
|
||||
"description": "真实脚本 from view_template id=2cceb83c-4079-43e4-b7b7-c395fd68cbbc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 263,
|
||||
"name": "2cceb83c-4079-43e4-b7b7-c395fd68cbbc_建造师注册证",
|
||||
"description": "真实脚本 from view_template id=2cceb83c-4079-43e4-b7b7-c395fd68cbbc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 283,
|
||||
"name": "2fac21ea-2964-4295-b3e9-cad7c3391ff1_合格供方对账(五建-分包合同结算)",
|
||||
"description": "真实脚本 from view_template id=2fac21ea-2964-4295-b3e9-cad7c3391ff1",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 305,
|
||||
"name": "328b3366-170f-4321-b06c-5593668b5535_施工日志-审批",
|
||||
"description": "真实脚本 from view_template id=328b3366-170f-4321-b06c-5593668b5535",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 325,
|
||||
"name": "35b9139e-a491-44a8-b586-cfa50554377d_计划成本申报",
|
||||
"description": "真实脚本 from view_template id=35b9139e-a491-44a8-b586-cfa50554377d",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 332,
|
||||
"name": "38bebdb5-ebd4-4fdc-b1e6-e676ba7c4c2a_业绩库",
|
||||
"description": "真实脚本 from view_template id=38bebdb5-ebd4-4fdc-b1e6-e676ba7c4c2a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 372,
|
||||
"name": "3f77bb7a-5f68-4924-ad59-7522fd07904e_付款确认选择框-五建定制(未付讫的付款申请)",
|
||||
"description": "真实脚本 from view_template id=3f77bb7a-5f68-4924-ad59-7522fd07904e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 389,
|
||||
"name": "4230b669-a107-4ffb-9aae-e814560d8c6e_员工档案(带证书)",
|
||||
"description": "真实脚本 from view_template id=4230b669-a107-4ffb-9aae-e814560d8c6e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; UI.getCurrent()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 458,
|
||||
"name": "4d4d019b-5f5c-4207-9a21-a1dec198c5d0_中标公示",
|
||||
"description": "真实脚本 from view_template id=4d4d019b-5f5c-4207-9a21-a1dec198c5d0",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 463,
|
||||
"name": "4ea83ef3-2c84-4525-a792-7a7097e4037d_职称",
|
||||
"description": "真实脚本 from view_template id=4ea83ef3-2c84-4525-a792-7a7097e4037d",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 486,
|
||||
"name": "5440da49-89d6-4dc5-94e5-82693913d6e4_招标工程",
|
||||
"description": "真实脚本 from view_template id=5440da49-89d6-4dc5-94e5-82693913d6e4",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 504,
|
||||
"name": "58684bbb-59e9-4a83-9788-ec91d15ec0e8_物资合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=58684bbb-59e9-4a83-9788-ec91d15ec0e8",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 505,
|
||||
"name": "58684bbb-59e9-4a83-9788-ec91d15ec0e8_物资合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=58684bbb-59e9-4a83-9788-ec91d15ec0e8",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 510,
|
||||
"name": "5a51c93c-a758-413a-b174-63b3ba05efaa_文件监控",
|
||||
"description": "真实脚本 from view_template id=5a51c93c-a758-413a-b174-63b3ba05efaa",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; 同步确认框 showConfirmDialog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 511,
|
||||
"name": "5a51c93c-a758-413a-b174-63b3ba05efaa_文件监控",
|
||||
"description": "真实脚本 from view_template id=5a51c93c-a758-413a-b174-63b3ba05efaa",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; 同步确认框 showConfirmDialog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 518,
|
||||
"name": "5be37b88-fd93-4070-8060-c5e660372d90_专业分包合同登记_不需要评审",
|
||||
"description": "真实脚本 from view_template id=5be37b88-fd93-4070-8060-c5e660372d90",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 519,
|
||||
"name": "5be37b88-fd93-4070-8060-c5e660372d90_专业分包合同登记_不需要评审",
|
||||
"description": "真实脚本 from view_template id=5be37b88-fd93-4070-8060-c5e660372d90",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 533,
|
||||
"name": "5e618173-2ee1-406b-9829-28c58871316e_专业分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=5e618173-2ee1-406b-9829-28c58871316e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 534,
|
||||
"name": "5e618173-2ee1-406b-9829-28c58871316e_专业分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=5e618173-2ee1-406b-9829-28c58871316e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 636,
|
||||
"name": "71efbb03-84cb-4cce-a92f-69711252ac94_项目部质量目标查看",
|
||||
"description": "真实脚本 from view_template id=71efbb03-84cb-4cce-a92f-69711252ac94",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 659,
|
||||
"name": "75fb9a46-b874-46b4-a6e5-c12c14ec54b6_培训签到",
|
||||
"description": "真实脚本 from view_template id=75fb9a46-b874-46b4-a6e5-c12c14ec54b6",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 683,
|
||||
"name": "7a0ac7a9-32bc-4d32-9231-4d1bbcd86002_造价师注册证",
|
||||
"description": "真实脚本 from view_template id=7a0ac7a9-32bc-4d32-9231-4d1bbcd86002",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 687,
|
||||
"name": "7a2cbfcc-d60b-491a-8992-c3c955a3b027_(分)公司质量指标",
|
||||
"description": "真实脚本 from view_template id=7a2cbfcc-d60b-491a-8992-c3c955a3b027",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 689,
|
||||
"name": "7a7c0ce5-7925-4c32-8c66-a68cca93ef9b_评标结果公示",
|
||||
"description": "真实脚本 from view_template id=7a7c0ce5-7925-4c32-8c66-a68cca93ef9b",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 706,
|
||||
"name": "7d50dd37-9892-410e-9fdc-731f24fbfd80_项目成本拆分",
|
||||
"description": "真实脚本 from view_template id=7d50dd37-9892-410e-9fdc-731f24fbfd80",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 741,
|
||||
"name": "8350f440-bf6b-4d3f-b4e4-3769a8353d61_中标登记-五建定制",
|
||||
"description": "真实脚本 from view_template id=8350f440-bf6b-4d3f-b4e4-3769a8353d61",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 756,
|
||||
"name": "86c05eb5-753d-46e5-b958-cdbcefe7eabc_销项税发票",
|
||||
"description": "真实脚本 from view_template id=86c05eb5-753d-46e5-b958-cdbcefe7eabc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 776,
|
||||
"name": "884f0dde-564a-4e6e-9a5d-55d12d0a16e1_物资采购申请(土建-项目)",
|
||||
"description": "真实脚本 from view_template id=884f0dde-564a-4e6e-9a5d-55d12d0a16e1",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 805,
|
||||
"name": "8c4a3b9f-0272-4675-8363-dd2f96a4f955_专业分包合同登记_需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=8c4a3b9f-0272-4675-8363-dd2f96a4f955",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 843,
|
||||
"name": "908652e1-fecf-427b-8be2-3da1675bf80d_劳务分包合同登记-需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=908652e1-fecf-427b-8be2-3da1675bf80d",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 845,
|
||||
"name": "90ab3b6d-3ea7-45d9-99d3-29740545a842_物资合同登记-需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=90ab3b6d-3ea7-45d9-99d3-29740545a842",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 852,
|
||||
"name": "91497e54-702d-47a7-bbcd-3f5d67b6fd91_物资合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=91497e54-702d-47a7-bbcd-3f5d67b6fd91",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 854,
|
||||
"name": "91497e54-702d-47a7-bbcd-3f5d67b6fd91_物资合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=91497e54-702d-47a7-bbcd-3f5d67b6fd91",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 862,
|
||||
"name": "938201e3-e6b1-4b46-b536-e195f5cfb90f_开标结果登记",
|
||||
"description": "真实脚本 from view_template id=938201e3-e6b1-4b46-b536-e195f5cfb90f",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 899,
|
||||
"name": "99930d79-bb49-47d7-9a40-3e9f275e53de_创优目标",
|
||||
"description": "真实脚本 from view_template id=99930d79-bb49-47d7-9a40-3e9f275e53de",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 903,
|
||||
"name": "99d77f69-b08f-49d3-937a-2ad8fcb5ca6f_十大员证",
|
||||
"description": "真实脚本 from view_template id=99d77f69-b08f-49d3-937a-2ad8fcb5ca6f",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 908,
|
||||
"name": "9b0ea26a-26a3-4dd2-be5e-2b18e7837005_项目付款申请",
|
||||
"description": "真实脚本 from view_template id=9b0ea26a-26a3-4dd2-be5e-2b18e7837005",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 910,
|
||||
"name": "9b0ea26a-26a3-4dd2-be5e-2b18e7837005_项目付款申请",
|
||||
"description": "真实脚本 from view_template id=9b0ea26a-26a3-4dd2-be5e-2b18e7837005",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 919,
|
||||
"name": "9d690abb-916b-427c-9bd6-4a8001ac0813_薪资方案",
|
||||
"description": "真实脚本 from view_template id=9d690abb-916b-427c-9bd6-4a8001ac0813",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 934,
|
||||
"name": "a0307625-8abc-46b6-b835-93719a881e47_周转(自购)材料盘点管理",
|
||||
"description": "真实脚本 from view_template id=a0307625-8abc-46b6-b835-93719a881e47",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; 同步确认框 showConfirmDialog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 943,
|
||||
"name": "a18b1f38-073c-4190-bfd5-b95274cf9f31_付款确认",
|
||||
"description": "真实脚本 from view_template id=a18b1f38-073c-4190-bfd5-b95274cf9f31",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 944,
|
||||
"name": "a1b39022-aabb-4ecc-8078-66d9da144ab0_网站信息管理",
|
||||
"description": "真实脚本 from view_template id=a1b39022-aabb-4ecc-8078-66d9da144ab0",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 946,
|
||||
"name": "a1df0f12-8bfb-4807-882a-ca7b510e10f9_专业分包合同登记_不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=a1df0f12-8bfb-4807-882a-ca7b510e10f9",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 949,
|
||||
"name": "a1df0f12-8bfb-4807-882a-ca7b510e10f9_专业分包合同登记_不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=a1df0f12-8bfb-4807-882a-ca7b510e10f9",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 981,
|
||||
"name": "a760fba0-693e-4f0a-8007-3bdca7fb0305_项目人员配置",
|
||||
"description": "真实脚本 from view_template id=a760fba0-693e-4f0a-8007-3bdca7fb0305",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1016,
|
||||
"name": "ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3_劳务分包合同评审",
|
||||
"description": "真实脚本 from view_template id=ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1017,
|
||||
"name": "ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3_劳务分包合同评审",
|
||||
"description": "真实脚本 from view_template id=ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1028,
|
||||
"name": "b17684cf-061d-4006-b87f-048d128fe71a_技术工人证",
|
||||
"description": "真实脚本 from view_template id=b17684cf-061d-4006-b87f-048d128fe71a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1075,
|
||||
"name": "c0982679-2ac1-4be9-8043-cbe47210beee_报名申请",
|
||||
"description": "真实脚本 from view_template id=c0982679-2ac1-4be9-8043-cbe47210beee",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1093,
|
||||
"name": "c5b5160e-2289-4b8d-8f8e-57a4801a6e43_分包合同结算",
|
||||
"description": "真实脚本 from view_template id=c5b5160e-2289-4b8d-8f8e-57a4801a6e43",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1102,
|
||||
"name": "c752e928-335d-443c-8f2d-9aa8e2630c8e_劳务分包合同登记-需要评审",
|
||||
"description": "真实脚本 from view_template id=c752e928-335d-443c-8f2d-9aa8e2630c8e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1148,
|
||||
"name": "cf71f83a-0428-4e69-a736-97c91f998d19_物资合同评审-明辉定制",
|
||||
"description": "真实脚本 from view_template id=cf71f83a-0428-4e69-a736-97c91f998d19",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1149,
|
||||
"name": "cf71f83a-0428-4e69-a736-97c91f998d19_物资合同评审-明辉定制",
|
||||
"description": "真实脚本 from view_template id=cf71f83a-0428-4e69-a736-97c91f998d19",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1156,
|
||||
"name": "d193b838-f8a3-4d72-9fef-300c7a97d23c_劳务分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=d193b838-f8a3-4d72-9fef-300c7a97d23c",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1160,
|
||||
"name": "d193b838-f8a3-4d72-9fef-300c7a97d23c_劳务分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=d193b838-f8a3-4d72-9fef-300c7a97d23c",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1165,
|
||||
"name": "d2a01b24-9941-4e7c-a96e-74fbb54d2e79_项目部质量目标",
|
||||
"description": "真实脚本 from view_template id=d2a01b24-9941-4e7c-a96e-74fbb54d2e79",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1181,
|
||||
"name": "d41063b3-9189-42ce-8689-8ce022a99fc2_专业分包合同登记_需要评审",
|
||||
"description": "真实脚本 from view_template id=d41063b3-9189-42ce-8689-8ce022a99fc2",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1243,
|
||||
"name": "e282bd37-a9a7-4390-9c96-4411b2508a33_物资合同评审",
|
||||
"description": "真实脚本 from view_template id=e282bd37-a9a7-4390-9c96-4411b2508a33",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1245,
|
||||
"name": "e282bd37-a9a7-4390-9c96-4411b2508a33_物资合同评审",
|
||||
"description": "真实脚本 from view_template id=e282bd37-a9a7-4390-9c96-4411b2508a33",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1260,
|
||||
"name": "e5a03e54-37b2-4122-971f-7f0ac57c2650_进项税发票(批量调整抵扣日期)-五建定制",
|
||||
"description": "真实脚本 from view_template id=e5a03e54-37b2-4122-971f-7f0ac57c2650",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1268,
|
||||
"name": "e7670207-9cf7-4db9-a452-884b58408b96_付款确认(五建定制)",
|
||||
"description": "真实脚本 from view_template id=e7670207-9cf7-4db9-a452-884b58408b96",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1272,
|
||||
"name": "e7670207-9cf7-4db9-a452-884b58408b96_付款确认(五建定制)",
|
||||
"description": "真实脚本 from view_template id=e7670207-9cf7-4db9-a452-884b58408b96",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1317,
|
||||
"name": "ee9e2a39-45e2-434a-b691-a02a2041b7e6_物资采购申请(土建-公司)",
|
||||
"description": "真实脚本 from view_template id=ee9e2a39-45e2-434a-b691-a02a2041b7e6",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1333,
|
||||
"name": "f01c2f57-1891-45de-9318-7246f9d6ac97_销项税发票(增加审批通过后修改加批量撤回)-五建定制",
|
||||
"description": "真实脚本 from view_template id=f01c2f57-1891-45de-9318-7246f9d6ac97",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1358,
|
||||
"name": "f475e860-0026-49a8-b2ff-510101386c6a_其他证书",
|
||||
"description": "真实脚本 from view_template id=f475e860-0026-49a8-b2ff-510101386c6a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1385,
|
||||
"name": "f9b884de-6d46-4242-b93f-f3babd358f36_项目付款申请-五建定制",
|
||||
"description": "真实脚本 from view_template id=f9b884de-6d46-4242-b93f-f3babd358f36",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1387,
|
||||
"name": "f9b884de-6d46-4242-b93f-f3babd358f36_项目付款申请-五建定制",
|
||||
"description": "真实脚本 from view_template id=f9b884de-6d46-4242-b93f-f3babd358f36",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1402,
|
||||
"name": "fb51a8c9-3bd4-4517-b19f-74edcc34f8f7_发薪/扣款计划",
|
||||
"description": "真实脚本 from view_template id=fb51a8c9-3bd4-4517-b19f-74edcc34f8f7",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1419,
|
||||
"name": "fe20a392-d4fd-402f-bbf8-be8cd41ab932_项目人员配置(五建定制)",
|
||||
"description": "真实脚本 from view_template id=fe20a392-d4fd-402f-bbf8-be8cd41ab932",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
}
|
||||
],
|
||||
"partial_items": [
|
||||
{
|
||||
"id": 15,
|
||||
"name": "0567316f-6a71-47f6-a669-eb8c91670e45_车辆维修保养登记",
|
||||
"description": "真实脚本 from view_template id=0567316f-6a71-47f6-a669-eb8c91670e45"
|
||||
},
|
||||
{
|
||||
"id": 153,
|
||||
"name": "208996a7-fa97-4e99-8e35-4b592385eb37_办公用品库初始化凭证",
|
||||
"description": "真实脚本 from view_template id=208996a7-fa97-4e99-8e35-4b592385eb37"
|
||||
},
|
||||
{
|
||||
"id": 235,
|
||||
"name": "292e76e6-df04-4be3-9108-73eaa1565b4c_月度检查",
|
||||
"description": "真实脚本 from view_template id=292e76e6-df04-4be3-9108-73eaa1565b4c"
|
||||
},
|
||||
{
|
||||
"id": 248,
|
||||
"name": "2b39c3e1-3bf9-4664-8e02-53d426c5db84_项目部污染源申报",
|
||||
"description": "真实脚本 from view_template id=2b39c3e1-3bf9-4664-8e02-53d426c5db84"
|
||||
},
|
||||
{
|
||||
"id": 268,
|
||||
"name": "2d046844-a126-4822-910e-bfe1283b5ebf_办公用品领用申请",
|
||||
"description": "真实脚本 from view_template id=2d046844-a126-4822-910e-bfe1283b5ebf"
|
||||
},
|
||||
{
|
||||
"id": 353,
|
||||
"name": "3cfaeaa6-2cf9-4364-8f98-25aee16cbda3_项目部危险源申报",
|
||||
"description": "真实脚本 from view_template id=3cfaeaa6-2cf9-4364-8f98-25aee16cbda3"
|
||||
},
|
||||
{
|
||||
"id": 416,
|
||||
"name": "459103d3-9cc9-43f5-87ca-a322c10d2200_测试树",
|
||||
"description": "真实脚本 from view_template id=459103d3-9cc9-43f5-87ca-a322c10d2200"
|
||||
},
|
||||
{
|
||||
"id": 484,
|
||||
"name": "5440da49-89d6-4dc5-94e5-82693913d6e4_招标工程",
|
||||
"description": "真实脚本 from view_template id=5440da49-89d6-4dc5-94e5-82693913d6e4"
|
||||
},
|
||||
{
|
||||
"id": 586,
|
||||
"name": "68dc06dc-bc4e-47cc-a9e8-fb089c51fc17_组织缴费规则",
|
||||
"description": "真实脚本 from view_template id=68dc06dc-bc4e-47cc-a9e8-fb089c51fc17"
|
||||
},
|
||||
{
|
||||
"id": 602,
|
||||
"name": "6c11d228-a9d7-43de-85e4-d56e43cad10c_季度检查整改",
|
||||
"description": "真实脚本 from view_template id=6c11d228-a9d7-43de-85e4-d56e43cad10c"
|
||||
},
|
||||
{
|
||||
"id": 603,
|
||||
"name": "6c11d228-a9d7-43de-85e4-d56e43cad10c_季度检查整改",
|
||||
"description": "真实脚本 from view_template id=6c11d228-a9d7-43de-85e4-d56e43cad10c"
|
||||
},
|
||||
{
|
||||
"id": 618,
|
||||
"name": "6e412e62-7cde-4efd-942c-ec4da5877ec7_物资需求总计划(土建)",
|
||||
"description": "真实脚本 from view_template id=6e412e62-7cde-4efd-942c-ec4da5877ec7"
|
||||
},
|
||||
{
|
||||
"id": 649,
|
||||
"name": "745c9534-c755-4ef5-bc26-8b78a802ec4a_验工月报区间",
|
||||
"description": "真实脚本 from view_template id=745c9534-c755-4ef5-bc26-8b78a802ec4a"
|
||||
},
|
||||
{
|
||||
"id": 752,
|
||||
"name": "85966712-cdef-4e82-8121-c04b6358fbd4_周转(租赁)材料报废",
|
||||
"description": "真实脚本 from view_template id=85966712-cdef-4e82-8121-c04b6358fbd4"
|
||||
},
|
||||
{
|
||||
"id": 754,
|
||||
"name": "86c05eb5-753d-46e5-b958-cdbcefe7eabc_销项税发票",
|
||||
"description": "真实脚本 from view_template id=86c05eb5-753d-46e5-b958-cdbcefe7eabc"
|
||||
},
|
||||
{
|
||||
"id": 757,
|
||||
"name": "86c05eb5-753d-46e5-b958-cdbcefe7eabc_销项税发票",
|
||||
"description": "真实脚本 from view_template id=86c05eb5-753d-46e5-b958-cdbcefe7eabc"
|
||||
},
|
||||
{
|
||||
"id": 833,
|
||||
"name": "8fadaa6e-eef2-4fe6-b13f-a2fb4d598253_费率配置",
|
||||
"description": "真实脚本 from view_template id=8fadaa6e-eef2-4fe6-b13f-a2fb4d598253"
|
||||
},
|
||||
{
|
||||
"id": 860,
|
||||
"name": "92072d44-33e8-4110-a8cc-aeb8ae300ef5_月度检查整改",
|
||||
"description": "真实脚本 from view_template id=92072d44-33e8-4110-a8cc-aeb8ae300ef5"
|
||||
},
|
||||
{
|
||||
"id": 999,
|
||||
"name": "a9abafe3-1c68-47dd-9068-63c9eb732673_驾驶员信息",
|
||||
"description": "真实脚本 from view_template id=a9abafe3-1c68-47dd-9068-63c9eb732673"
|
||||
},
|
||||
{
|
||||
"id": 1035,
|
||||
"name": "b233e091-ae6f-401a-bb5f-b145c8aa9ea4_固定资产变动",
|
||||
"description": "真实脚本 from view_template id=b233e091-ae6f-401a-bb5f-b145c8aa9ea4"
|
||||
},
|
||||
{
|
||||
"id": 1036,
|
||||
"name": "b233e091-ae6f-401a-bb5f-b145c8aa9ea4_固定资产变动",
|
||||
"description": "真实脚本 from view_template id=b233e091-ae6f-401a-bb5f-b145c8aa9ea4"
|
||||
},
|
||||
{
|
||||
"id": 1072,
|
||||
"name": "c0684b1a-c91a-4aa1-befe-029340cb67f5_办公用品库-结账成本汇总",
|
||||
"description": "真实脚本 from view_template id=c0684b1a-c91a-4aa1-befe-029340cb67f5"
|
||||
},
|
||||
{
|
||||
"id": 1074,
|
||||
"name": "c0982679-2ac1-4be9-8043-cbe47210beee_报名申请",
|
||||
"description": "真实脚本 from view_template id=c0982679-2ac1-4be9-8043-cbe47210beee"
|
||||
},
|
||||
{
|
||||
"id": 1084,
|
||||
"name": "c3aebaa5-f445-423e-9dd6-f217dc9521fa_周转(租赁)材料报废(查看)",
|
||||
"description": "真实脚本 from view_template id=c3aebaa5-f445-423e-9dd6-f217dc9521fa"
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"name": "c7b23419-22e1-4a5a-aa09-464b3bb2a242_季度检查",
|
||||
"description": "真实脚本 from view_template id=c7b23419-22e1-4a5a-aa09-464b3bb2a242"
|
||||
},
|
||||
{
|
||||
"id": 1264,
|
||||
"name": "e70d25ef-9e82-48ba-bdd2-8150c41121b6_农民工工资发放",
|
||||
"description": "真实脚本 from view_template id=e70d25ef-9e82-48ba-bdd2-8150c41121b6"
|
||||
},
|
||||
{
|
||||
"id": 1331,
|
||||
"name": "f01c2f57-1891-45de-9318-7246f9d6ac97_销项税发票(增加审批通过后修改加批量撤回)-五建定制",
|
||||
"description": "真实脚本 from view_template id=f01c2f57-1891-45de-9318-7246f9d6ac97"
|
||||
},
|
||||
{
|
||||
"id": 1334,
|
||||
"name": "f01c2f57-1891-45de-9318-7246f9d6ac97_销项税发票(增加审批通过后修改加批量撤回)-五建定制",
|
||||
"description": "真实脚本 from view_template id=f01c2f57-1891-45de-9318-7246f9d6ac97"
|
||||
},
|
||||
{
|
||||
"id": 1372,
|
||||
"name": "f78c44ca-4a23-4195-996b-2cd7cf629c41_月度检查整改(五建定制)",
|
||||
"description": "真实脚本 from view_template id=f78c44ca-4a23-4195-996b-2cd7cf629c41"
|
||||
},
|
||||
{
|
||||
"id": 1375,
|
||||
"name": "f805a46c-3b12-4462-a3a5-7c7b2d6cea10_项目缴费规则",
|
||||
"description": "真实脚本 from view_template id=f805a46c-3b12-4462-a3a5-7c7b2d6cea10"
|
||||
}
|
||||
],
|
||||
"wrong_items": []
|
||||
}
|
||||
3216
tools/s3_rewriter/eval-real-20260611.json
Normal file
3216
tools/s3_rewriter/eval-real-20260611.json
Normal file
File diff suppressed because it is too large
Load Diff
875
tools/s3_rewriter/eval-verify.json
Normal file
875
tools/s3_rewriter/eval-verify.json
Normal file
@@ -0,0 +1,875 @@
|
||||
{
|
||||
"total": 1427,
|
||||
"label_counts": {
|
||||
"NO_S3": 815,
|
||||
"FULL_AUTO": 497,
|
||||
"PARTIAL": 30,
|
||||
"HARD": 85
|
||||
},
|
||||
"total_s3": 612,
|
||||
"automation_rate": 81.20915032679738,
|
||||
"rule_hit_counts": {
|
||||
"addSubTableButton": 108,
|
||||
"removeAllItems": 126,
|
||||
"getContainerDataSource": 159,
|
||||
"inline_datasource_handle": 159,
|
||||
"addFieldOption": 271,
|
||||
"group_setReadOnly": 28,
|
||||
"setValue": 73,
|
||||
"setVisible": 26,
|
||||
"setCaption": 25,
|
||||
"setRequired": 6,
|
||||
"setRequiredError": 3,
|
||||
"balanced_setFilter": 187,
|
||||
"setReadOnly_field": 64,
|
||||
"getValue": 122,
|
||||
"setConvertedValue": 36,
|
||||
"removeItem": 32,
|
||||
"getDisplay": 27,
|
||||
"propertyDataSource_setReadOnly": 30,
|
||||
"setViewWithoutEditor": 16,
|
||||
"setNullSelectionItemId": 9,
|
||||
"Notification_show": 7,
|
||||
"setEnabled": 10,
|
||||
"reload": 27,
|
||||
"showDeleteButton": 2,
|
||||
"showAddButton": 6,
|
||||
"getModifyButton_setVisible": 3,
|
||||
"getDetailButton_setVisible": 3
|
||||
},
|
||||
"hard_items": [
|
||||
{
|
||||
"id": 101,
|
||||
"name": "1a48f81b-e212-4af8-ac2f-f90ec0f3c7c3_建造师执业资格证",
|
||||
"description": "真实脚本 from view_template id=1a48f81b-e212-4af8-ac2f-f90ec0f3c7c3",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 106,
|
||||
"name": "1a7f5b05-adee-4a67-a311-ac9f76af2c15_物资合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=1a7f5b05-adee-4a67-a311-ac9f76af2c15",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 110,
|
||||
"name": "1a7f5b05-adee-4a67-a311-ac9f76af2c15_物资合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=1a7f5b05-adee-4a67-a311-ac9f76af2c15",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 135,
|
||||
"name": "1e9bcd2c-e1e2-4e35-a21a-a5c26b17741e_江苏省中标公告",
|
||||
"description": "真实脚本 from view_template id=1e9bcd2c-e1e2-4e35-a21a-a5c26b17741e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 137,
|
||||
"name": "1edd6c1c-2d17-4504-8ee5-faf12822c0c2_物资合同登记-需要评审",
|
||||
"description": "真实脚本 from view_template id=1edd6c1c-2d17-4504-8ee5-faf12822c0c2",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 138,
|
||||
"name": "1f13f729-0dc3-46c1-aab0-d0ef1ccf67a5_评标结果公示(业绩库导航)",
|
||||
"description": "真实脚本 from view_template id=1f13f729-0dc3-46c1-aab0-d0ef1ccf67a5",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 162,
|
||||
"name": "213d1b7e-e1b7-4ab4-ae4a-181ae4b40461_劳务分包合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=213d1b7e-e1b7-4ab4-ae4a-181ae4b40461",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 163,
|
||||
"name": "213d1b7e-e1b7-4ab4-ae4a-181ae4b40461_劳务分包合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=213d1b7e-e1b7-4ab4-ae4a-181ae4b40461",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 174,
|
||||
"name": "2213796d-03b0-4b74-b923-6be0415cd002_劳务分包合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=2213796d-03b0-4b74-b923-6be0415cd002",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 175,
|
||||
"name": "2213796d-03b0-4b74-b923-6be0415cd002_劳务分包合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=2213796d-03b0-4b74-b923-6be0415cd002",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 212,
|
||||
"name": "26fe10ae-93a9-45c4-9f58-2183e6050100_专业分包合同评审",
|
||||
"description": "真实脚本 from view_template id=26fe10ae-93a9-45c4-9f58-2183e6050100",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 213,
|
||||
"name": "26fe10ae-93a9-45c4-9f58-2183e6050100_专业分包合同评审",
|
||||
"description": "真实脚本 from view_template id=26fe10ae-93a9-45c4-9f58-2183e6050100",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 216,
|
||||
"name": "279c4492-0851-4b82-a8dc-88e19922f08a_ABC三类人员证",
|
||||
"description": "真实脚本 from view_template id=279c4492-0851-4b82-a8dc-88e19922f08a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 222,
|
||||
"name": "2852ff22-439c-4625-a2c5-c70b547d82ca_计划成本变更",
|
||||
"description": "真实脚本 from view_template id=2852ff22-439c-4625-a2c5-c70b547d82ca",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 223,
|
||||
"name": "2852ff22-439c-4625-a2c5-c70b547d82ca_计划成本变更",
|
||||
"description": "真实脚本 from view_template id=2852ff22-439c-4625-a2c5-c70b547d82ca",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 260,
|
||||
"name": "2cceb83c-4079-43e4-b7b7-c395fd68cbbc_建造师注册证",
|
||||
"description": "真实脚本 from view_template id=2cceb83c-4079-43e4-b7b7-c395fd68cbbc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 262,
|
||||
"name": "2cceb83c-4079-43e4-b7b7-c395fd68cbbc_建造师注册证",
|
||||
"description": "真实脚本 from view_template id=2cceb83c-4079-43e4-b7b7-c395fd68cbbc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 263,
|
||||
"name": "2cceb83c-4079-43e4-b7b7-c395fd68cbbc_建造师注册证",
|
||||
"description": "真实脚本 from view_template id=2cceb83c-4079-43e4-b7b7-c395fd68cbbc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 283,
|
||||
"name": "2fac21ea-2964-4295-b3e9-cad7c3391ff1_合格供方对账(五建-分包合同结算)",
|
||||
"description": "真实脚本 from view_template id=2fac21ea-2964-4295-b3e9-cad7c3391ff1",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 305,
|
||||
"name": "328b3366-170f-4321-b06c-5593668b5535_施工日志-审批",
|
||||
"description": "真实脚本 from view_template id=328b3366-170f-4321-b06c-5593668b5535",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 325,
|
||||
"name": "35b9139e-a491-44a8-b586-cfa50554377d_计划成本申报",
|
||||
"description": "真实脚本 from view_template id=35b9139e-a491-44a8-b586-cfa50554377d",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 332,
|
||||
"name": "38bebdb5-ebd4-4fdc-b1e6-e676ba7c4c2a_业绩库",
|
||||
"description": "真实脚本 from view_template id=38bebdb5-ebd4-4fdc-b1e6-e676ba7c4c2a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 372,
|
||||
"name": "3f77bb7a-5f68-4924-ad59-7522fd07904e_付款确认选择框-五建定制(未付讫的付款申请)",
|
||||
"description": "真实脚本 from view_template id=3f77bb7a-5f68-4924-ad59-7522fd07904e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 389,
|
||||
"name": "4230b669-a107-4ffb-9aae-e814560d8c6e_员工档案(带证书)",
|
||||
"description": "真实脚本 from view_template id=4230b669-a107-4ffb-9aae-e814560d8c6e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; UI.getCurrent()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 458,
|
||||
"name": "4d4d019b-5f5c-4207-9a21-a1dec198c5d0_中标公示",
|
||||
"description": "真实脚本 from view_template id=4d4d019b-5f5c-4207-9a21-a1dec198c5d0",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 463,
|
||||
"name": "4ea83ef3-2c84-4525-a792-7a7097e4037d_职称",
|
||||
"description": "真实脚本 from view_template id=4ea83ef3-2c84-4525-a792-7a7097e4037d",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 486,
|
||||
"name": "5440da49-89d6-4dc5-94e5-82693913d6e4_招标工程",
|
||||
"description": "真实脚本 from view_template id=5440da49-89d6-4dc5-94e5-82693913d6e4",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 504,
|
||||
"name": "58684bbb-59e9-4a83-9788-ec91d15ec0e8_物资合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=58684bbb-59e9-4a83-9788-ec91d15ec0e8",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 505,
|
||||
"name": "58684bbb-59e9-4a83-9788-ec91d15ec0e8_物资合同登记-不需要评审",
|
||||
"description": "真实脚本 from view_template id=58684bbb-59e9-4a83-9788-ec91d15ec0e8",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 510,
|
||||
"name": "5a51c93c-a758-413a-b174-63b3ba05efaa_文件监控",
|
||||
"description": "真实脚本 from view_template id=5a51c93c-a758-413a-b174-63b3ba05efaa",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; 同步确认框 showConfirmDialog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 511,
|
||||
"name": "5a51c93c-a758-413a-b174-63b3ba05efaa_文件监控",
|
||||
"description": "真实脚本 from view_template id=5a51c93c-a758-413a-b174-63b3ba05efaa",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; 同步确认框 showConfirmDialog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 518,
|
||||
"name": "5be37b88-fd93-4070-8060-c5e660372d90_专业分包合同登记_不需要评审",
|
||||
"description": "真实脚本 from view_template id=5be37b88-fd93-4070-8060-c5e660372d90",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 519,
|
||||
"name": "5be37b88-fd93-4070-8060-c5e660372d90_专业分包合同登记_不需要评审",
|
||||
"description": "真实脚本 from view_template id=5be37b88-fd93-4070-8060-c5e660372d90",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 533,
|
||||
"name": "5e618173-2ee1-406b-9829-28c58871316e_专业分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=5e618173-2ee1-406b-9829-28c58871316e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 534,
|
||||
"name": "5e618173-2ee1-406b-9829-28c58871316e_专业分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=5e618173-2ee1-406b-9829-28c58871316e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 636,
|
||||
"name": "71efbb03-84cb-4cce-a92f-69711252ac94_项目部质量目标查看",
|
||||
"description": "真实脚本 from view_template id=71efbb03-84cb-4cce-a92f-69711252ac94",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 659,
|
||||
"name": "75fb9a46-b874-46b4-a6e5-c12c14ec54b6_培训签到",
|
||||
"description": "真实脚本 from view_template id=75fb9a46-b874-46b4-a6e5-c12c14ec54b6",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 683,
|
||||
"name": "7a0ac7a9-32bc-4d32-9231-4d1bbcd86002_造价师注册证",
|
||||
"description": "真实脚本 from view_template id=7a0ac7a9-32bc-4d32-9231-4d1bbcd86002",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 687,
|
||||
"name": "7a2cbfcc-d60b-491a-8992-c3c955a3b027_(分)公司质量指标",
|
||||
"description": "真实脚本 from view_template id=7a2cbfcc-d60b-491a-8992-c3c955a3b027",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 689,
|
||||
"name": "7a7c0ce5-7925-4c32-8c66-a68cca93ef9b_评标结果公示",
|
||||
"description": "真实脚本 from view_template id=7a7c0ce5-7925-4c32-8c66-a68cca93ef9b",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 706,
|
||||
"name": "7d50dd37-9892-410e-9fdc-731f24fbfd80_项目成本拆分",
|
||||
"description": "真实脚本 from view_template id=7d50dd37-9892-410e-9fdc-731f24fbfd80",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 741,
|
||||
"name": "8350f440-bf6b-4d3f-b4e4-3769a8353d61_中标登记-五建定制",
|
||||
"description": "真实脚本 from view_template id=8350f440-bf6b-4d3f-b4e4-3769a8353d61",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 756,
|
||||
"name": "86c05eb5-753d-46e5-b958-cdbcefe7eabc_销项税发票",
|
||||
"description": "真实脚本 from view_template id=86c05eb5-753d-46e5-b958-cdbcefe7eabc",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 776,
|
||||
"name": "884f0dde-564a-4e6e-9a5d-55d12d0a16e1_物资采购申请(土建-项目)",
|
||||
"description": "真实脚本 from view_template id=884f0dde-564a-4e6e-9a5d-55d12d0a16e1",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 805,
|
||||
"name": "8c4a3b9f-0272-4675-8363-dd2f96a4f955_专业分包合同登记_需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=8c4a3b9f-0272-4675-8363-dd2f96a4f955",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 843,
|
||||
"name": "908652e1-fecf-427b-8be2-3da1675bf80d_劳务分包合同登记-需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=908652e1-fecf-427b-8be2-3da1675bf80d",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 845,
|
||||
"name": "90ab3b6d-3ea7-45d9-99d3-29740545a842_物资合同登记-需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=90ab3b6d-3ea7-45d9-99d3-29740545a842",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 852,
|
||||
"name": "91497e54-702d-47a7-bbcd-3f5d67b6fd91_物资合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=91497e54-702d-47a7-bbcd-3f5d67b6fd91",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 854,
|
||||
"name": "91497e54-702d-47a7-bbcd-3f5d67b6fd91_物资合同登记-不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=91497e54-702d-47a7-bbcd-3f5d67b6fd91",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 862,
|
||||
"name": "938201e3-e6b1-4b46-b536-e195f5cfb90f_开标结果登记",
|
||||
"description": "真实脚本 from view_template id=938201e3-e6b1-4b46-b536-e195f5cfb90f",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 899,
|
||||
"name": "99930d79-bb49-47d7-9a40-3e9f275e53de_创优目标",
|
||||
"description": "真实脚本 from view_template id=99930d79-bb49-47d7-9a40-3e9f275e53de",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 903,
|
||||
"name": "99d77f69-b08f-49d3-937a-2ad8fcb5ca6f_十大员证",
|
||||
"description": "真实脚本 from view_template id=99d77f69-b08f-49d3-937a-2ad8fcb5ca6f",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 908,
|
||||
"name": "9b0ea26a-26a3-4dd2-be5e-2b18e7837005_项目付款申请",
|
||||
"description": "真实脚本 from view_template id=9b0ea26a-26a3-4dd2-be5e-2b18e7837005",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 910,
|
||||
"name": "9b0ea26a-26a3-4dd2-be5e-2b18e7837005_项目付款申请",
|
||||
"description": "真实脚本 from view_template id=9b0ea26a-26a3-4dd2-be5e-2b18e7837005",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 919,
|
||||
"name": "9d690abb-916b-427c-9bd6-4a8001ac0813_薪资方案",
|
||||
"description": "真实脚本 from view_template id=9d690abb-916b-427c-9bd6-4a8001ac0813",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 934,
|
||||
"name": "a0307625-8abc-46b6-b835-93719a881e47_周转(自购)材料盘点管理",
|
||||
"description": "真实脚本 from view_template id=a0307625-8abc-46b6-b835-93719a881e47",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件; 同步确认框 showConfirmDialog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 943,
|
||||
"name": "a18b1f38-073c-4190-bfd5-b95274cf9f31_付款确认",
|
||||
"description": "真实脚本 from view_template id=a18b1f38-073c-4190-bfd5-b95274cf9f31",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 944,
|
||||
"name": "a1b39022-aabb-4ecc-8078-66d9da144ab0_网站信息管理",
|
||||
"description": "真实脚本 from view_template id=a1b39022-aabb-4ecc-8078-66d9da144ab0",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 946,
|
||||
"name": "a1df0f12-8bfb-4807-882a-ca7b510e10f9_专业分包合同登记_不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=a1df0f12-8bfb-4807-882a-ca7b510e10f9",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 949,
|
||||
"name": "a1df0f12-8bfb-4807-882a-ca7b510e10f9_专业分包合同登记_不需要评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=a1df0f12-8bfb-4807-882a-ca7b510e10f9",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 981,
|
||||
"name": "a760fba0-693e-4f0a-8007-3bdca7fb0305_项目人员配置",
|
||||
"description": "真实脚本 from view_template id=a760fba0-693e-4f0a-8007-3bdca7fb0305",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1016,
|
||||
"name": "ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3_劳务分包合同评审",
|
||||
"description": "真实脚本 from view_template id=ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1017,
|
||||
"name": "ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3_劳务分包合同评审",
|
||||
"description": "真实脚本 from view_template id=ad1ffdd2-3af3-4809-b0d5-2fbbb73e22b3",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1028,
|
||||
"name": "b17684cf-061d-4006-b87f-048d128fe71a_技术工人证",
|
||||
"description": "真实脚本 from view_template id=b17684cf-061d-4006-b87f-048d128fe71a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1075,
|
||||
"name": "c0982679-2ac1-4be9-8043-cbe47210beee_报名申请",
|
||||
"description": "真实脚本 from view_template id=c0982679-2ac1-4be9-8043-cbe47210beee",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1093,
|
||||
"name": "c5b5160e-2289-4b8d-8f8e-57a4801a6e43_分包合同结算",
|
||||
"description": "真实脚本 from view_template id=c5b5160e-2289-4b8d-8f8e-57a4801a6e43",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1102,
|
||||
"name": "c752e928-335d-443c-8f2d-9aa8e2630c8e_劳务分包合同登记-需要评审",
|
||||
"description": "真实脚本 from view_template id=c752e928-335d-443c-8f2d-9aa8e2630c8e",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1148,
|
||||
"name": "cf71f83a-0428-4e69-a736-97c91f998d19_物资合同评审-明辉定制",
|
||||
"description": "真实脚本 from view_template id=cf71f83a-0428-4e69-a736-97c91f998d19",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1149,
|
||||
"name": "cf71f83a-0428-4e69-a736-97c91f998d19_物资合同评审-明辉定制",
|
||||
"description": "真实脚本 from view_template id=cf71f83a-0428-4e69-a736-97c91f998d19",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1156,
|
||||
"name": "d193b838-f8a3-4d72-9fef-300c7a97d23c_劳务分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=d193b838-f8a3-4d72-9fef-300c7a97d23c",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1160,
|
||||
"name": "d193b838-f8a3-4d72-9fef-300c7a97d23c_劳务分包合同评审(五建定制)",
|
||||
"description": "真实脚本 from view_template id=d193b838-f8a3-4d72-9fef-300c7a97d23c",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1165,
|
||||
"name": "d2a01b24-9941-4e7c-a96e-74fbb54d2e79_项目部质量目标",
|
||||
"description": "真实脚本 from view_template id=d2a01b24-9941-4e7c-a96e-74fbb54d2e79",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1181,
|
||||
"name": "d41063b3-9189-42ce-8689-8ce022a99fc2_专业分包合同登记_需要评审",
|
||||
"description": "真实脚本 from view_template id=d41063b3-9189-42ce-8689-8ce022a99fc2",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1243,
|
||||
"name": "e282bd37-a9a7-4390-9c96-4411b2508a33_物资合同评审",
|
||||
"description": "真实脚本 from view_template id=e282bd37-a9a7-4390-9c96-4411b2508a33",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1245,
|
||||
"name": "e282bd37-a9a7-4390-9c96-4411b2508a33_物资合同评审",
|
||||
"description": "真实脚本 from view_template id=e282bd37-a9a7-4390-9c96-4411b2508a33",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1260,
|
||||
"name": "e5a03e54-37b2-4122-971f-7f0ac57c2650_进项税发票(批量调整抵扣日期)-五建定制",
|
||||
"description": "真实脚本 from view_template id=e5a03e54-37b2-4122-971f-7f0ac57c2650",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1268,
|
||||
"name": "e7670207-9cf7-4db9-a452-884b58408b96_付款确认(五建定制)",
|
||||
"description": "真实脚本 from view_template id=e7670207-9cf7-4db9-a452-884b58408b96",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1272,
|
||||
"name": "e7670207-9cf7-4db9-a452-884b58408b96_付款确认(五建定制)",
|
||||
"description": "真实脚本 from view_template id=e7670207-9cf7-4db9-a452-884b58408b96",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1317,
|
||||
"name": "ee9e2a39-45e2-434a-b691-a02a2041b7e6_物资采购申请(土建-公司)",
|
||||
"description": "真实脚本 from view_template id=ee9e2a39-45e2-434a-b691-a02a2041b7e6",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1333,
|
||||
"name": "f01c2f57-1891-45de-9318-7246f9d6ac97_销项税发票(增加审批通过后修改加批量撤回)-五建定制",
|
||||
"description": "真实脚本 from view_template id=f01c2f57-1891-45de-9318-7246f9d6ac97",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1358,
|
||||
"name": "f475e860-0026-49a8-b2ff-510101386c6a_其他证书",
|
||||
"description": "真实脚本 from view_template id=f475e860-0026-49a8-b2ff-510101386c6a",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1385,
|
||||
"name": "f9b884de-6d46-4242-b93f-f3babd358f36_项目付款申请-五建定制",
|
||||
"description": "真实脚本 from view_template id=f9b884de-6d46-4242-b93f-f3babd358f36",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1387,
|
||||
"name": "f9b884de-6d46-4242-b93f-f3babd358f36_项目付款申请-五建定制",
|
||||
"description": "真实脚本 from view_template id=f9b884de-6d46-4242-b93f-f3babd358f36",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1402,
|
||||
"name": "fb51a8c9-3bd4-4517-b19f-74edcc34f8f7_发薪/扣款计划",
|
||||
"description": "真实脚本 from view_template id=fb51a8c9-3bd4-4517-b19f-74edcc34f8f7",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1419,
|
||||
"name": "fe20a392-d4fd-402f-bbf8-be8cd41ab932_项目人员配置(五建定制)",
|
||||
"description": "真实脚本 from view_template id=fe20a392-d4fd-402f-bbf8-be8cd41ab932",
|
||||
"hard_reasons": [
|
||||
"动态创建 Vaadin 组件"
|
||||
]
|
||||
}
|
||||
],
|
||||
"partial_items": [
|
||||
{
|
||||
"id": 15,
|
||||
"name": "0567316f-6a71-47f6-a669-eb8c91670e45_车辆维修保养登记",
|
||||
"description": "真实脚本 from view_template id=0567316f-6a71-47f6-a669-eb8c91670e45"
|
||||
},
|
||||
{
|
||||
"id": 153,
|
||||
"name": "208996a7-fa97-4e99-8e35-4b592385eb37_办公用品库初始化凭证",
|
||||
"description": "真实脚本 from view_template id=208996a7-fa97-4e99-8e35-4b592385eb37"
|
||||
},
|
||||
{
|
||||
"id": 235,
|
||||
"name": "292e76e6-df04-4be3-9108-73eaa1565b4c_月度检查",
|
||||
"description": "真实脚本 from view_template id=292e76e6-df04-4be3-9108-73eaa1565b4c"
|
||||
},
|
||||
{
|
||||
"id": 248,
|
||||
"name": "2b39c3e1-3bf9-4664-8e02-53d426c5db84_项目部污染源申报",
|
||||
"description": "真实脚本 from view_template id=2b39c3e1-3bf9-4664-8e02-53d426c5db84"
|
||||
},
|
||||
{
|
||||
"id": 268,
|
||||
"name": "2d046844-a126-4822-910e-bfe1283b5ebf_办公用品领用申请",
|
||||
"description": "真实脚本 from view_template id=2d046844-a126-4822-910e-bfe1283b5ebf"
|
||||
},
|
||||
{
|
||||
"id": 353,
|
||||
"name": "3cfaeaa6-2cf9-4364-8f98-25aee16cbda3_项目部危险源申报",
|
||||
"description": "真实脚本 from view_template id=3cfaeaa6-2cf9-4364-8f98-25aee16cbda3"
|
||||
},
|
||||
{
|
||||
"id": 416,
|
||||
"name": "459103d3-9cc9-43f5-87ca-a322c10d2200_测试树",
|
||||
"description": "真实脚本 from view_template id=459103d3-9cc9-43f5-87ca-a322c10d2200"
|
||||
},
|
||||
{
|
||||
"id": 484,
|
||||
"name": "5440da49-89d6-4dc5-94e5-82693913d6e4_招标工程",
|
||||
"description": "真实脚本 from view_template id=5440da49-89d6-4dc5-94e5-82693913d6e4"
|
||||
},
|
||||
{
|
||||
"id": 586,
|
||||
"name": "68dc06dc-bc4e-47cc-a9e8-fb089c51fc17_组织缴费规则",
|
||||
"description": "真实脚本 from view_template id=68dc06dc-bc4e-47cc-a9e8-fb089c51fc17"
|
||||
},
|
||||
{
|
||||
"id": 602,
|
||||
"name": "6c11d228-a9d7-43de-85e4-d56e43cad10c_季度检查整改",
|
||||
"description": "真实脚本 from view_template id=6c11d228-a9d7-43de-85e4-d56e43cad10c"
|
||||
},
|
||||
{
|
||||
"id": 603,
|
||||
"name": "6c11d228-a9d7-43de-85e4-d56e43cad10c_季度检查整改",
|
||||
"description": "真实脚本 from view_template id=6c11d228-a9d7-43de-85e4-d56e43cad10c"
|
||||
},
|
||||
{
|
||||
"id": 618,
|
||||
"name": "6e412e62-7cde-4efd-942c-ec4da5877ec7_物资需求总计划(土建)",
|
||||
"description": "真实脚本 from view_template id=6e412e62-7cde-4efd-942c-ec4da5877ec7"
|
||||
},
|
||||
{
|
||||
"id": 649,
|
||||
"name": "745c9534-c755-4ef5-bc26-8b78a802ec4a_验工月报区间",
|
||||
"description": "真实脚本 from view_template id=745c9534-c755-4ef5-bc26-8b78a802ec4a"
|
||||
},
|
||||
{
|
||||
"id": 752,
|
||||
"name": "85966712-cdef-4e82-8121-c04b6358fbd4_周转(租赁)材料报废",
|
||||
"description": "真实脚本 from view_template id=85966712-cdef-4e82-8121-c04b6358fbd4"
|
||||
},
|
||||
{
|
||||
"id": 754,
|
||||
"name": "86c05eb5-753d-46e5-b958-cdbcefe7eabc_销项税发票",
|
||||
"description": "真实脚本 from view_template id=86c05eb5-753d-46e5-b958-cdbcefe7eabc"
|
||||
},
|
||||
{
|
||||
"id": 757,
|
||||
"name": "86c05eb5-753d-46e5-b958-cdbcefe7eabc_销项税发票",
|
||||
"description": "真实脚本 from view_template id=86c05eb5-753d-46e5-b958-cdbcefe7eabc"
|
||||
},
|
||||
{
|
||||
"id": 833,
|
||||
"name": "8fadaa6e-eef2-4fe6-b13f-a2fb4d598253_费率配置",
|
||||
"description": "真实脚本 from view_template id=8fadaa6e-eef2-4fe6-b13f-a2fb4d598253"
|
||||
},
|
||||
{
|
||||
"id": 860,
|
||||
"name": "92072d44-33e8-4110-a8cc-aeb8ae300ef5_月度检查整改",
|
||||
"description": "真实脚本 from view_template id=92072d44-33e8-4110-a8cc-aeb8ae300ef5"
|
||||
},
|
||||
{
|
||||
"id": 999,
|
||||
"name": "a9abafe3-1c68-47dd-9068-63c9eb732673_驾驶员信息",
|
||||
"description": "真实脚本 from view_template id=a9abafe3-1c68-47dd-9068-63c9eb732673"
|
||||
},
|
||||
{
|
||||
"id": 1035,
|
||||
"name": "b233e091-ae6f-401a-bb5f-b145c8aa9ea4_固定资产变动",
|
||||
"description": "真实脚本 from view_template id=b233e091-ae6f-401a-bb5f-b145c8aa9ea4"
|
||||
},
|
||||
{
|
||||
"id": 1036,
|
||||
"name": "b233e091-ae6f-401a-bb5f-b145c8aa9ea4_固定资产变动",
|
||||
"description": "真实脚本 from view_template id=b233e091-ae6f-401a-bb5f-b145c8aa9ea4"
|
||||
},
|
||||
{
|
||||
"id": 1072,
|
||||
"name": "c0684b1a-c91a-4aa1-befe-029340cb67f5_办公用品库-结账成本汇总",
|
||||
"description": "真实脚本 from view_template id=c0684b1a-c91a-4aa1-befe-029340cb67f5"
|
||||
},
|
||||
{
|
||||
"id": 1074,
|
||||
"name": "c0982679-2ac1-4be9-8043-cbe47210beee_报名申请",
|
||||
"description": "真实脚本 from view_template id=c0982679-2ac1-4be9-8043-cbe47210beee"
|
||||
},
|
||||
{
|
||||
"id": 1084,
|
||||
"name": "c3aebaa5-f445-423e-9dd6-f217dc9521fa_周转(租赁)材料报废(查看)",
|
||||
"description": "真实脚本 from view_template id=c3aebaa5-f445-423e-9dd6-f217dc9521fa"
|
||||
},
|
||||
{
|
||||
"id": 1109,
|
||||
"name": "c7b23419-22e1-4a5a-aa09-464b3bb2a242_季度检查",
|
||||
"description": "真实脚本 from view_template id=c7b23419-22e1-4a5a-aa09-464b3bb2a242"
|
||||
},
|
||||
{
|
||||
"id": 1264,
|
||||
"name": "e70d25ef-9e82-48ba-bdd2-8150c41121b6_农民工工资发放",
|
||||
"description": "真实脚本 from view_template id=e70d25ef-9e82-48ba-bdd2-8150c41121b6"
|
||||
},
|
||||
{
|
||||
"id": 1331,
|
||||
"name": "f01c2f57-1891-45de-9318-7246f9d6ac97_销项税发票(增加审批通过后修改加批量撤回)-五建定制",
|
||||
"description": "真实脚本 from view_template id=f01c2f57-1891-45de-9318-7246f9d6ac97"
|
||||
},
|
||||
{
|
||||
"id": 1334,
|
||||
"name": "f01c2f57-1891-45de-9318-7246f9d6ac97_销项税发票(增加审批通过后修改加批量撤回)-五建定制",
|
||||
"description": "真实脚本 from view_template id=f01c2f57-1891-45de-9318-7246f9d6ac97"
|
||||
},
|
||||
{
|
||||
"id": 1372,
|
||||
"name": "f78c44ca-4a23-4195-996b-2cd7cf629c41_月度检查整改(五建定制)",
|
||||
"description": "真实脚本 from view_template id=f78c44ca-4a23-4195-996b-2cd7cf629c41"
|
||||
},
|
||||
{
|
||||
"id": 1375,
|
||||
"name": "f805a46c-3b12-4462-a3a5-7c7b2d6cea10_项目缴费规则",
|
||||
"description": "真实脚本 from view_template id=f805a46c-3b12-4462-a3a5-7c7b2d6cea10"
|
||||
}
|
||||
],
|
||||
"wrong_items": []
|
||||
}
|
||||
534
tools/s3_rewriter/gen_corpus.py
Normal file
534
tools/s3_rewriter/gen_corpus.py
Normal file
@@ -0,0 +1,534 @@
|
||||
"""
|
||||
语料生成器 — gen_corpus.py
|
||||
按盘点报告的 Top 模式频率分布,合成 ≥60 条有代表性的测试脚本。
|
||||
|
||||
频率权重(Top 模式,615 条 S3 内):
|
||||
addButton 100
|
||||
getValue 68
|
||||
getContainerDataSource / setFilter / removeAllItems 61+56+29=146
|
||||
group.setReadOnly 27
|
||||
getDisplay 27
|
||||
setVisible 21
|
||||
setCaption 16
|
||||
硬 S3(new Window/Button/ComboBox + showConfirmDialog + UI.getCurrent) 76
|
||||
NO_S3(非 S3 脚本) 约 553+259=812 条(取少量作负例)
|
||||
|
||||
输出目录: corpus/
|
||||
每条文件: corpus/NNN_<标签>_<名称>.groovy
|
||||
元数据: corpus/index.json (含 expected_label, description)
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
CORPUS_DIR = os.path.join(os.path.dirname(__file__), "corpus")
|
||||
os.makedirs(CORPUS_DIR, exist_ok=True)
|
||||
|
||||
# ──────────────────────────────────────────────────────────────
|
||||
# 脚本模板仓库
|
||||
# 每条: (name, expected_label, description, groovy_source)
|
||||
# ──────────────────────────────────────────────────────────────
|
||||
SCRIPTS = []
|
||||
|
||||
def add(name: str, label: str, desc: str, src: str):
|
||||
SCRIPTS.append((name, label, desc, textwrap.dedent(src).strip()))
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# A. addButton 系列(×10,最高频)
|
||||
# ═══════════════════════════════════════════
|
||||
add("addButton_01", "FULL_AUTO", "单字段加按钮", """
|
||||
group.getField("PROJ_STATUS").addButton("查看详情", { item -> showDetail(item) })
|
||||
""")
|
||||
|
||||
add("addButton_02", "FULL_AUTO", "多字段加按钮", """
|
||||
group.getField("PROJ_NAME").addButton("跳转", actionHandler)
|
||||
group.getField("CONTRACT_NO").addButton("合同详情", contractHandler)
|
||||
""")
|
||||
|
||||
add("addButton_03", "FULL_AUTO", "addButton+setVisible 混合", """
|
||||
group.getField("APPLY_STATUS").addButton("审批", approveAction)
|
||||
group.getField("APPLY_STATUS").setVisible(item.STATUS == "PENDING")
|
||||
""")
|
||||
|
||||
add("addButton_04", "FULL_AUTO", "addButton 带多参数", """
|
||||
group.getField("FILE_URL").addButton("下载", "download", { it -> downloadFile(it) })
|
||||
""")
|
||||
|
||||
add("addButton_05", "FULL_AUTO", "addButton 单引号字段名", """
|
||||
group.getField('REMARK').addButton('备注', remarkAction)
|
||||
""")
|
||||
|
||||
add("addButton_06", "FULL_AUTO", "addButton + getValue 联动", """
|
||||
def status = group.getField("STATUS").getValue()
|
||||
group.getField("ACTION_BTN").addButton("提交", { submitAction(status) })
|
||||
""")
|
||||
|
||||
add("addButton_07", "FULL_AUTO", "addButton + setCaption", """
|
||||
group.getField("PROJ_NAME").addButton("编辑", editHandler)
|
||||
group.getField("PROJ_NAME").setCaption("项目名称(必填)")
|
||||
""")
|
||||
|
||||
add("addButton_08", "FULL_AUTO", "中间变量 addButton(变量内联)", """
|
||||
def f = group.getField("LABOR_NO")
|
||||
f.addButton("工人档案", workerHandler)
|
||||
""")
|
||||
|
||||
add("addButton_09", "FULL_AUTO", "addButton + setEnabled", """
|
||||
group.getField("SUBMIT_BTN").addButton("提交审批", submitAction)
|
||||
group.getField("SUBMIT_BTN").setEnabled(item.DRAFT == true)
|
||||
""")
|
||||
|
||||
add("addButton_10", "FULL_AUTO", "addButton 嵌套 if", """
|
||||
if (item.ROLE == "MANAGER") {
|
||||
group.getField("APPROVE_BTN").addButton("审批通过", approveOk)
|
||||
group.getField("APPROVE_BTN").addButton("驳回", approveReject)
|
||||
}
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# B. getValue 系列(×7)
|
||||
# ═══════════════════════════════════════════
|
||||
add("getValue_01", "FULL_AUTO", "getValue 单用", """
|
||||
def v = group.getField("CONTRACT_AMOUNT").getValue()
|
||||
return v > 0
|
||||
""")
|
||||
|
||||
add("getValue_02", "FULL_AUTO", "getValue 多字段", """
|
||||
def name = group.getField("PROJ_NAME").getValue()
|
||||
def no = group.getField("PROJ_NO").getValue()
|
||||
return name + " / " + no
|
||||
""")
|
||||
|
||||
add("getValue_03", "FULL_AUTO", "getValue 条件分支", """
|
||||
if (group.getField("STATUS").getValue() == "APPROVED") {
|
||||
group.getField("CLOSE_BTN").setVisible(true)
|
||||
}
|
||||
""")
|
||||
|
||||
add("getValue_04", "FULL_AUTO", "getValue + setValue", """
|
||||
def cur = group.getField("AMOUNT").getValue()
|
||||
group.getField("AMOUNT_DISPLAY").setValue("¥" + cur)
|
||||
""")
|
||||
|
||||
add("getValue_05", "FULL_AUTO", "getValue 变量内联", """
|
||||
def fld = group.getField("PROJ_TYPE")
|
||||
def t = fld.getValue()
|
||||
enableButton("TYPE_BTN", t != null)
|
||||
""")
|
||||
|
||||
add("getValue_06", "FULL_AUTO", "getValue + Notification", """
|
||||
def v = group.getField("QTY").getValue()
|
||||
if (v == null) {
|
||||
Notification.show("数量不能为空")
|
||||
}
|
||||
""")
|
||||
|
||||
add("getValue_07", "FULL_AUTO", "getValue 链式比较", """
|
||||
def allow = group.getField("ALLOW_EDIT").getValue()
|
||||
group.getField("NAME").setEnabled(allow == true)
|
||||
group.getField("NAME").setRequired(allow == true)
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# C. getContainerDataSource / setFilter / removeAllItems(×15)
|
||||
# ═══════════════════════════════════════════
|
||||
add("setFilter_01", "FULL_AUTO", "setFilter 基本", """
|
||||
group.getField("SUBCONTRACT_NO").getContainerDataSource().setFilter("STATUS=1")
|
||||
""")
|
||||
|
||||
add("setFilter_02", "FULL_AUTO", "setFilter 多条件", """
|
||||
group.getField("WORKER_ID").getContainerDataSource().setFilter("PROJ_ID=" + item.PROJ_ID)
|
||||
""")
|
||||
|
||||
add("setFilter_03", "FULL_AUTO", "removeAllItems 基本", """
|
||||
group.getField("DETAIL_LIST").getContainerDataSource().removeAllItems()
|
||||
""")
|
||||
|
||||
add("setFilter_04", "FULL_AUTO", "setFilter + removeAllItems", """
|
||||
group.getField("DICT_FIELD").getContainerDataSource().removeAllItems()
|
||||
group.getField("DICT_FIELD").getContainerDataSource().setFilter("TYPE=CONTRACT")
|
||||
""")
|
||||
|
||||
add("setFilter_05", "PARTIAL", "getContainerDataSource 裸取后用中间变量调用 setFilter(ds 不是字段句柄,内联不覆盖)", """
|
||||
def ds = group.getField("COMBO_FIELD").getContainerDataSource()
|
||||
ds.setFilter("ACTIVE=1")
|
||||
""")
|
||||
|
||||
add("setFilter_06", "FULL_AUTO", "中间变量 setFilter", """
|
||||
def f = group.getField("LABOR_COMPANY")
|
||||
f.getContainerDataSource().setFilter("AREA_CODE=" + item.AREA)
|
||||
""")
|
||||
|
||||
add("setFilter_07", "FULL_AUTO", "setFilter + getValue", """
|
||||
def projId = group.getField("PROJ_ID").getValue()
|
||||
group.getField("CONTRACT_NO").getContainerDataSource().setFilter("PROJ_ID=" + projId)
|
||||
""")
|
||||
|
||||
add("setFilter_08", "FULL_AUTO", "removeAllItems + addButton", """
|
||||
group.getField("TAG_LIST").getContainerDataSource().removeAllItems()
|
||||
group.getField("TAG_LIST").addButton("添加标签", addTagAction)
|
||||
""")
|
||||
|
||||
add("getContainerDataSource_01", "FULL_AUTO", "getContainerDataSource 单独使用", """
|
||||
def source = group.getField("MATERIAL_TYPE").getContainerDataSource()
|
||||
""")
|
||||
|
||||
add("setFilter_09", "FULL_AUTO", "setFilter 动态参数", """
|
||||
def companyId = item.COMPANY_ID
|
||||
group.getField("DEPT_ID").getContainerDataSource().setFilter("COMPANY_ID=" + companyId)
|
||||
group.getField("DEPT_ID").setVisible(companyId != null)
|
||||
""")
|
||||
|
||||
add("setFilter_10", "FULL_AUTO", "多字段 setFilter", """
|
||||
group.getField("PROVINCE").getContainerDataSource().setFilter("LEVEL=1")
|
||||
group.getField("CITY").getContainerDataSource().setFilter("LEVEL=2")
|
||||
group.getField("DISTRICT").getContainerDataSource().setFilter("LEVEL=3")
|
||||
""")
|
||||
|
||||
add("removeAllItems_01", "FULL_AUTO", "removeAllItems 在条件内", """
|
||||
if (item.RESET_FLAG) {
|
||||
group.getField("OPTION_LIST").getContainerDataSource().removeAllItems()
|
||||
}
|
||||
""")
|
||||
|
||||
add("removeAllItems_02", "FULL_AUTO", "removeAllItems + setVisible", """
|
||||
group.getField("CHOICE").getContainerDataSource().removeAllItems()
|
||||
group.getField("CHOICE").setVisible(false)
|
||||
""")
|
||||
|
||||
add("setFilter_11", "FULL_AUTO", "setFilter 字符串拼接", """
|
||||
group.getField("SUBTYPE").getContainerDataSource().setFilter("PARENT_CODE='" + item.TYPE_CODE + "'")
|
||||
""")
|
||||
|
||||
add("setFilter_12", "FULL_AUTO", "setFilter 变量内联后改写", """
|
||||
def combo = group.getField("STATUS_COMBO")
|
||||
combo.getContainerDataSource().setFilter("CATEGORY=PROJ")
|
||||
combo.setCaption("项目状态")
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# D. group.setReadOnly 系列(×5)
|
||||
# ═══════════════════════════════════════════
|
||||
add("setReadOnly_01", "FULL_AUTO", "group.setReadOnly 基本", """
|
||||
group.setReadOnly(true)
|
||||
""")
|
||||
|
||||
add("setReadOnly_02", "FULL_AUTO", "group.setReadOnly 条件", """
|
||||
group.setReadOnly(item.APPROVED == true)
|
||||
""")
|
||||
|
||||
add("setReadOnly_03", "FULL_AUTO", "group.setReadOnly + setVisible", """
|
||||
group.setReadOnly(item.STATUS != "DRAFT")
|
||||
group.getField("SUBMIT_BTN").setVisible(item.STATUS == "DRAFT")
|
||||
""")
|
||||
|
||||
add("setReadOnly_04", "FULL_AUTO", "field.setReadOnly 单字段", """
|
||||
group.getField("CREATE_TIME").setReadOnly(true)
|
||||
group.getField("CREATE_BY").setReadOnly(true)
|
||||
""")
|
||||
|
||||
add("setReadOnly_05", "FULL_AUTO", "group + field 混合 setReadOnly", """
|
||||
group.setReadOnly(true)
|
||||
group.getField("REMARK").setReadOnly(false)
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# E. getDisplay 系列(×4)
|
||||
# ═══════════════════════════════════════════
|
||||
add("getDisplay_01", "FULL_AUTO", "getDisplay 基本", """
|
||||
def disp = group.getField("PROJ_STATUS").getDisplay()
|
||||
""")
|
||||
|
||||
add("getDisplay_02", "FULL_AUTO", "getDisplay + getValue", """
|
||||
def label = group.getField("TYPE").getDisplay()
|
||||
def val = group.getField("TYPE").getValue()
|
||||
return label + ":" + val
|
||||
""")
|
||||
|
||||
add("getDisplay_03", "FULL_AUTO", "getDisplay 条件逻辑", """
|
||||
if (group.getField("STATUS").getDisplay() == "已审批") {
|
||||
group.getField("CLOSE_BTN").setVisible(true)
|
||||
}
|
||||
""")
|
||||
|
||||
add("getDisplay_04", "FULL_AUTO", "getDisplay 变量内联", """
|
||||
def f = group.getField("CATEGORY")
|
||||
def d = f.getDisplay()
|
||||
setFieldCaption("NOTE", d)
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# F. setVisible 系列(×4)
|
||||
# ═══════════════════════════════════════════
|
||||
add("setVisible_01", "FULL_AUTO", "setVisible 基本", """
|
||||
group.getField("APPROVE_NOTE").setVisible(item.STATUS == "REJECTED")
|
||||
""")
|
||||
|
||||
add("setVisible_02", "FULL_AUTO", "setVisible 多字段", """
|
||||
def show = item.PROJ_TYPE == "CONSTRUCTION"
|
||||
group.getField("SAFETY_CERT").setVisible(show)
|
||||
group.getField("SAFETY_DATE").setVisible(show)
|
||||
""")
|
||||
|
||||
add("setVisible_03", "FULL_AUTO", "setVisible + setRequired", """
|
||||
group.getField("TAX_NO").setVisible(item.HAS_TAX == true)
|
||||
group.getField("TAX_NO").setRequired(item.HAS_TAX == true)
|
||||
""")
|
||||
|
||||
add("setVisible_04", "PARTIAL", "setVisible 循环(字段名为变量 fn,正则无法匹配字面量,余留待人工)", """
|
||||
["FIELD_A", "FIELD_B", "FIELD_C"].each { fn ->
|
||||
group.getField(fn).setVisible(item.SHOW_ALL)
|
||||
}
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# G. setCaption 系列(×3)
|
||||
# ═══════════════════════════════════════════
|
||||
add("setCaption_01", "FULL_AUTO", "setCaption 基本", """
|
||||
group.getField("AMOUNT").setCaption("合同金额(元)")
|
||||
""")
|
||||
|
||||
add("setCaption_02", "FULL_AUTO", "setCaption 动态标题", """
|
||||
def label = item.PROJ_TYPE == "PUBLIC" ? "公共项目编号" : "私人项目编号"
|
||||
group.getField("PROJ_NO").setCaption(label)
|
||||
""")
|
||||
|
||||
add("setCaption_03", "FULL_AUTO", "setCaption + setEnabled", """
|
||||
group.getField("LABOR_COUNT").setCaption("劳务人数")
|
||||
group.getField("LABOR_COUNT").setEnabled(item.CONTRACT_TYPE == "LABOR")
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# H. Notification.show 系列(×3)
|
||||
# ═══════════════════════════════════════════
|
||||
add("notification_01", "FULL_AUTO", "Notification.show 基本", """
|
||||
Notification.show("操作成功")
|
||||
""")
|
||||
|
||||
add("notification_02", "FULL_AUTO", "Notification.show 动态消息", """
|
||||
def msg = "保存成功:" + item.PROJ_NAME
|
||||
Notification.show(msg)
|
||||
""")
|
||||
|
||||
add("notification_03", "FULL_AUTO", "Notification.show + getValue", """
|
||||
def v = group.getField("AMOUNT").getValue()
|
||||
if (v == null || v <= 0) {
|
||||
Notification.show("金额必须大于零")
|
||||
} else {
|
||||
Notification.show("金额有效")
|
||||
}
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# I. 多模式混合复杂脚本(×5)
|
||||
# ═══════════════════════════════════════════
|
||||
add("mixed_01", "FULL_AUTO", "复杂多模式混合", """
|
||||
// 项目信息联动脚本
|
||||
def projType = group.getField("PROJ_TYPE").getValue()
|
||||
if (projType == "BIG") {
|
||||
group.getField("SAFETY_MGR").setVisible(true)
|
||||
group.getField("SAFETY_MGR").setRequired(true)
|
||||
group.getField("SAFETY_MGR").getContainerDataSource().setFilter("ROLE=SAFETY")
|
||||
} else {
|
||||
group.getField("SAFETY_MGR").setVisible(false)
|
||||
group.getField("SAFETY_MGR").setRequired(false)
|
||||
}
|
||||
group.getField("PROJ_NO").setCaption("项目编号(" + projType + ")")
|
||||
group.getField("SUBMIT_BTN").addButton("提交", submitAction)
|
||||
Notification.show("项目类型已切换: " + projType)
|
||||
""")
|
||||
|
||||
add("mixed_02", "FULL_AUTO", "变量内联+多规则", """
|
||||
def statusFld = group.getField("STATUS")
|
||||
def status = statusFld.getValue()
|
||||
def dispFld = group.getField("STATUS_DISPLAY")
|
||||
dispFld.setCaption(status == "ACTIVE" ? "活跃" : "非活跃")
|
||||
dispFld.setVisible(true)
|
||||
group.setReadOnly(status == "CLOSED")
|
||||
""")
|
||||
|
||||
add("mixed_03", "FULL_AUTO", "数据源+显隐联动", """
|
||||
def typeVal = group.getField("SUBCONTRACT_TYPE").getValue()
|
||||
group.getField("COMPANY").getContainerDataSource().removeAllItems()
|
||||
group.getField("COMPANY").getContainerDataSource().setFilter("TYPE=" + typeVal)
|
||||
group.getField("COMPANY").setVisible(typeVal != null)
|
||||
group.getField("COMPANY").setEnabled(typeVal != null)
|
||||
""")
|
||||
|
||||
add("mixed_04", "FULL_AUTO", "嵌套条件多字段控制", """
|
||||
def role = item.USER_ROLE
|
||||
if (role == "ADMIN") {
|
||||
group.setReadOnly(false)
|
||||
group.getField("DELETE_BTN").addButton("删除", deleteAction)
|
||||
group.getField("AUDIT_LOG").setVisible(true)
|
||||
} else {
|
||||
group.setReadOnly(true)
|
||||
group.getField("DELETE_BTN").setVisible(false)
|
||||
group.getField("AUDIT_LOG").setVisible(false)
|
||||
}
|
||||
""")
|
||||
|
||||
add("mixed_05", "FULL_AUTO", "多变量内联+复合改写", """
|
||||
def fProj = group.getField("PROJ_ID")
|
||||
def fDept = group.getField("DEPT_ID")
|
||||
fProj.getContainerDataSource().setFilter("STATUS=ACTIVE")
|
||||
fDept.getContainerDataSource().setFilter("PROJ_ID=" + fProj.getValue())
|
||||
fProj.setCaption("所属项目")
|
||||
fDept.setCaption("所属部门")
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# J. PARTIAL:部分 S3 改写,含无法识别的链式调用
|
||||
# ═══════════════════════════════════════════
|
||||
add("partial_01", "PARTIAL", "PARTIAL: 含不在规则表内的方法", """
|
||||
group.getField("PROJ_NAME").setVisible(true)
|
||||
group.getField("SPECIAL_FIELD").setStyleName("highlight") // setStyleName 不在规则表
|
||||
""")
|
||||
|
||||
add("partial_02", "PARTIAL", "PARTIAL: 含自定义组件方法", """
|
||||
group.getField("STATUS").setValue("ACTIVE")
|
||||
group.getField("CUSTOM_WIDGET").customSpecialMethod("arg1") // 不可识别
|
||||
""")
|
||||
|
||||
add("partial_03", "PARTIAL", "PARTIAL: addComponent 不在规则", """
|
||||
group.getField("NAME").setCaption("姓名")
|
||||
group.getField("PANEL").addComponent(someWidget) // addComponent 不在规则
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# K. HARD:硬 S3,动态 Vaadin 组件
|
||||
# ═══════════════════════════════════════════
|
||||
add("hard_01", "HARD", "HARD: new Window", """
|
||||
def win = new Window("详情窗口")
|
||||
win.setWidth("800px")
|
||||
win.center()
|
||||
UI.getCurrent().addWindow(win)
|
||||
""")
|
||||
|
||||
add("hard_02", "HARD", "HARD: new Button", """
|
||||
def btn = new Button("确认")
|
||||
btn.addClickListener({ e -> doConfirm() })
|
||||
layout.addComponent(btn)
|
||||
""")
|
||||
|
||||
add("hard_03", "HARD", "HARD: new ComboBox", """
|
||||
def combo = new ComboBox("选择状态")
|
||||
combo.addItem("ACTIVE")
|
||||
combo.addItem("CLOSED")
|
||||
group.getField("PANEL").addComponent(combo)
|
||||
""")
|
||||
|
||||
add("hard_04", "HARD", "HARD: showConfirmDialog", """
|
||||
showConfirmDialog("确认删除?", {
|
||||
if (it == true) {
|
||||
deleteRecord(item.ID)
|
||||
}
|
||||
})
|
||||
""")
|
||||
|
||||
add("hard_05", "HARD", "HARD: UI.getCurrent", """
|
||||
def ui = UI.getCurrent()
|
||||
ui.access({
|
||||
Notification.show("后台操作完成")
|
||||
})
|
||||
""")
|
||||
|
||||
add("hard_06", "HARD", "HARD: new TextField 动态", """
|
||||
def tf = new TextField("备注")
|
||||
tf.setWidth("100%")
|
||||
tf.setValue(item.REMARK ?: "")
|
||||
verticalLayout.addComponent(tf)
|
||||
""")
|
||||
|
||||
add("hard_07", "HARD", "HARD: new Window + setFilter 混合(整条转人工)", """
|
||||
group.getField("PROJ_ID").getContainerDataSource().setFilter("STATUS=1")
|
||||
def popup = new Window("弹窗")
|
||||
popup.center()
|
||||
UI.getCurrent().addWindow(popup)
|
||||
""")
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# L. NO_S3:纯 S1/S2 脚本(负例)
|
||||
# ═══════════════════════════════════════════
|
||||
add("no_s3_01", "NO_S3", "NO_S3: 纯行级表达式 S1", """
|
||||
return item.AMOUNT > 10000
|
||||
""")
|
||||
|
||||
add("no_s3_02", "NO_S3", "NO_S3: enableButton S2 形态", """
|
||||
enableButton("SUBMIT_BTN", item.STATUS == "DRAFT")
|
||||
enableButton("CANCEL_BTN", item.STATUS != "CLOSED")
|
||||
""")
|
||||
|
||||
add("no_s3_03", "NO_S3", "NO_S3: setFieldVisible S2 形态", """
|
||||
setFieldVisible("APPROVE_NOTE", item.STATUS == "REJECTED")
|
||||
setFieldRequired("APPROVE_NOTE", item.STATUS == "REJECTED")
|
||||
""")
|
||||
|
||||
add("no_s3_04", "NO_S3", "NO_S3: 纯数值计算", """
|
||||
def total = item.UNIT_PRICE * item.QTY
|
||||
item.TOTAL_AMOUNT = total
|
||||
return total
|
||||
""")
|
||||
|
||||
add("no_s3_05", "NO_S3", "NO_S3: S2 辅助函数调用", """
|
||||
setFieldValue("PROJ_STATUS", "ACTIVE")
|
||||
showToast("状态更新成功")
|
||||
setGroupReadOnly(false)
|
||||
""")
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 写入文件
|
||||
# ──────────────────────────────────────────────
|
||||
def generate():
|
||||
index = []
|
||||
for idx, (name, label, desc, src) in enumerate(SCRIPTS, start=1):
|
||||
filename = f"{idx:03d}_{label}_{name}.groovy"
|
||||
filepath = os.path.join(CORPUS_DIR, filename)
|
||||
with open(filepath, "w", encoding="utf-8") as f:
|
||||
f.write(src + "\n")
|
||||
index.append({
|
||||
"id": idx,
|
||||
"filename": filename,
|
||||
"expected_label": label,
|
||||
"description": desc,
|
||||
"name": name,
|
||||
})
|
||||
|
||||
index_path = os.path.join(CORPUS_DIR, "index.json")
|
||||
with open(index_path, "w", encoding="utf-8") as f:
|
||||
json.dump(index, f, ensure_ascii=False, indent=2)
|
||||
|
||||
# 打印统计
|
||||
from collections import Counter
|
||||
counts = Counter(s[1] for s in SCRIPTS)
|
||||
total = len(SCRIPTS)
|
||||
print(f"语料生成完毕,共 {total} 条脚本:")
|
||||
for label, cnt in sorted(counts.items()):
|
||||
print(f" {label:12s}: {cnt:3d} 条 ({cnt/total*100:.1f}%)")
|
||||
print(f"输出目录: {CORPUS_DIR}")
|
||||
print(f"索引文件: {index_path}")
|
||||
|
||||
# 验证频率分布
|
||||
print("\n频率分布说明(对应盘点报告 Top 模式):")
|
||||
patterns = {
|
||||
"addButton": sum(1 for s in SCRIPTS if "addButton" in s[0] and s[1] != "HARD"),
|
||||
"getValue": sum(1 for s in SCRIPTS if "getValue" in s[0]),
|
||||
"setFilter/DataSource": sum(1 for s in SCRIPTS if "setFilter" in s[0] or "removeAllItems" in s[0] or "getContainerDataSource" in s[0]),
|
||||
"setReadOnly": sum(1 for s in SCRIPTS if "setReadOnly" in s[0]),
|
||||
"getDisplay": sum(1 for s in SCRIPTS if "getDisplay" in s[0]),
|
||||
"setVisible": sum(1 for s in SCRIPTS if "setVisible" in s[0]),
|
||||
"setCaption": sum(1 for s in SCRIPTS if "setCaption" in s[0]),
|
||||
"Notification": sum(1 for s in SCRIPTS if "notification" in s[0]),
|
||||
"mixed": sum(1 for s in SCRIPTS if "mixed" in s[0]),
|
||||
"HARD": counts["HARD"],
|
||||
"PARTIAL": counts["PARTIAL"],
|
||||
"NO_S3": counts["NO_S3"],
|
||||
}
|
||||
for p, cnt in patterns.items():
|
||||
print(f" {p:30s}: {cnt}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate()
|
||||
175
tools/s3_rewriter/mine_patterns.py
Normal file
175
tools/s3_rewriter/mine_patterns.py
Normal file
@@ -0,0 +1,175 @@
|
||||
"""
|
||||
mine_patterns.py — 真实 S3 语料模式挖掘
|
||||
|
||||
目的:
|
||||
对全部 S3 脚本逐条提取 Vaadin API 调用模式并归一化形态,输出 Top 模式表
|
||||
(模式形态 × 出现次数 × 覆盖脚本数),驱动 rewrite.py 规则扩展。
|
||||
|
||||
归一化策略(把字面量抹平,只看"形状"):
|
||||
- getField("X") → getField(F) 字段句柄取数
|
||||
- 变量名 / 字面串 → 抹平为 _
|
||||
- 安全导航 ?. → 保留(区分 . 与 ?. 是关键发现)
|
||||
- 链尾 .method(...) → .method(...) 只保留方法名与"有无参数"
|
||||
|
||||
输出:
|
||||
1) 动词频率表: <持有者>.<动词> → 出现次数 / 覆盖脚本数
|
||||
2) 形态分布: getField 前缀 vs 裸 / ?. vs . / 链长
|
||||
3) 残留模式: 改写后仍含 S3 的脚本里,剩下的 Top 调用形态
|
||||
|
||||
用法:
|
||||
python mine_patterns.py # 读 scripts_cache.json
|
||||
python mine_patterns.py --top 50
|
||||
python mine_patterns.py --residual # 只看改写后残留模式
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from rewrite import rewrite_script, HARD_S3_PATTERNS
|
||||
|
||||
CACHE = os.path.join(os.path.dirname(__file__), "scripts_cache.json")
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 调用形态提取
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
# 匹配 group.getField("X") 或 group.getField('X') 或 group.getField(var)
|
||||
_GETFIELD = re.compile(r'group\.getField\(\s*(["\'][^"\']*["\']|[\w.]+)\s*\)')
|
||||
|
||||
# 匹配任意 .method( 或 ?.method( (持有者不限)
|
||||
_METHOD_CALL = re.compile(r'(\?\.|\.)\s*(\w+)\s*\(')
|
||||
|
||||
# 字段句柄链: group.getField(...) [?.|.] method(...) 捕获导航符 + 方法名
|
||||
_FIELD_CHAIN = re.compile(
|
||||
r'group\.getField\(\s*(["\'][^"\']*["\']|[\w.]+)\s*\)\s*(\?\.|\.)\s*(\w+)\s*\('
|
||||
)
|
||||
|
||||
# 组级调用: group.<method>( (排除 getField)
|
||||
_GROUP_CALL = re.compile(r'\bgroup\s*(\?\.|\.)\s*(\w+)\s*\(')
|
||||
|
||||
# 静态调用: Identifier.method( 例如 Notification.show
|
||||
_STATIC_CALL = re.compile(r'\b([A-Z]\w+)\.(\w+)\s*\(')
|
||||
|
||||
|
||||
def _is_string_literal(arg: str) -> bool:
|
||||
return bool(arg) and arg[0] in '"\''
|
||||
|
||||
|
||||
def normalize_field_chain(nav: str, method: str) -> str:
|
||||
"""归一: getField(F)<nav><method>(...)"""
|
||||
return f'getField(F){nav}{method}(...)'
|
||||
|
||||
|
||||
def mine(scripts, only_residual=False):
|
||||
verb_count = Counter() # 形态 → 出现总次数
|
||||
verb_scripts = defaultdict(set) # 形态 → 覆盖脚本 id 集合
|
||||
nonliteral_field = 0 # getField(非字面量) 命中脚本数
|
||||
nonliteral_scripts = set()
|
||||
|
||||
# 形态细分计数
|
||||
nav_dot = Counter() # 安全导航 vs 普通点
|
||||
group_verbs = Counter()
|
||||
group_verb_scripts = defaultdict(set)
|
||||
static_verbs = Counter()
|
||||
static_verb_scripts = defaultdict(set)
|
||||
|
||||
for r in scripts:
|
||||
src = r["source"]
|
||||
rid = r["id"]
|
||||
|
||||
if only_residual:
|
||||
rewritten, _, label = rewrite_script(src)
|
||||
if label != "PARTIAL":
|
||||
continue
|
||||
scan = rewritten
|
||||
else:
|
||||
# 跳过 HARD(不该被自动化,不参与挖掘)
|
||||
_, _, label = rewrite_script(src)
|
||||
if label == "HARD":
|
||||
continue
|
||||
scan = src
|
||||
|
||||
# 字段句柄链
|
||||
for m in _FIELD_CHAIN.finditer(scan):
|
||||
arg, nav, method = m.group(1), m.group(2), m.group(3)
|
||||
shape = normalize_field_chain(nav, method)
|
||||
verb_count[shape] += 1
|
||||
verb_scripts[shape].add(rid)
|
||||
nav_dot[nav] += 1
|
||||
if not _is_string_literal(arg):
|
||||
nonliteral_field += 1
|
||||
nonliteral_scripts.add(rid)
|
||||
|
||||
# 组级调用
|
||||
for m in _GROUP_CALL.finditer(scan):
|
||||
nav, method = m.group(1), m.group(2)
|
||||
if method == "getField":
|
||||
continue
|
||||
shape = f'group{nav}{method}(...)'
|
||||
group_verbs[shape] += 1
|
||||
group_verb_scripts[shape].add(rid)
|
||||
|
||||
# 静态调用
|
||||
for m in _STATIC_CALL.finditer(scan):
|
||||
cls, method = m.group(1), m.group(2)
|
||||
shape = f'{cls}.{method}(...)'
|
||||
static_verbs[shape] += 1
|
||||
static_verb_scripts[shape].add(rid)
|
||||
|
||||
return {
|
||||
"verb_count": verb_count,
|
||||
"verb_scripts": verb_scripts,
|
||||
"nav_dot": nav_dot,
|
||||
"nonliteral_field": nonliteral_field,
|
||||
"nonliteral_scripts": nonliteral_scripts,
|
||||
"group_verbs": group_verbs,
|
||||
"group_verb_scripts": group_verb_scripts,
|
||||
"static_verbs": static_verbs,
|
||||
"static_verb_scripts": static_verb_scripts,
|
||||
}
|
||||
|
||||
|
||||
def print_table(title, counter, script_map, top):
|
||||
print(f"\n{'='*72}\n{title}\n{'='*72}")
|
||||
print(f"{'形态':<42}{'次数':>8}{'覆盖脚本':>10}")
|
||||
print("-" * 72)
|
||||
for shape in sorted(counter, key=lambda k: -counter[k])[:top]:
|
||||
cov = len(script_map[shape]) if shape in script_map else 0
|
||||
print(f"{shape:<42}{counter[shape]:>8}{cov:>10}")
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("--cache", default=CACHE)
|
||||
p.add_argument("--top", type=int, default=40)
|
||||
p.add_argument("--residual", action="store_true",
|
||||
help="只对 PARTIAL 脚本改写后的残留模式做挖掘")
|
||||
args = p.parse_args()
|
||||
|
||||
scripts = json.load(open(args.cache, encoding="utf-8"))
|
||||
print(f"加载脚本 {len(scripts)} 条 from {args.cache}")
|
||||
mode = "改写后残留模式(PARTIAL)" if args.residual else "全量 S3 模式(剔除 HARD)"
|
||||
print(f"挖掘模式: {mode}")
|
||||
|
||||
res = mine(scripts, only_residual=args.residual)
|
||||
|
||||
print_table("字段句柄链形态 getField(F).<动词>(...)",
|
||||
res["verb_count"], res["verb_scripts"], args.top)
|
||||
print_table("组级调用形态 group.<动词>(...)",
|
||||
res["group_verbs"], res["group_verb_scripts"], args.top)
|
||||
print_table("静态调用形态 Class.<方法>(...)",
|
||||
res["static_verbs"], res["static_verb_scripts"], args.top)
|
||||
|
||||
print(f"\n{'='*72}\n形态细分\n{'='*72}")
|
||||
print(f"导航符分布: {dict(res['nav_dot'])}")
|
||||
print(f"getField(非字面量字段名) 命中次数: {res['nonliteral_field']}"
|
||||
f",覆盖脚本 {len(res['nonliteral_scripts'])} 条")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
776
tools/s3_rewriter/rewrite.py
Normal file
776
tools/s3_rewriter/rewrite.py
Normal file
@@ -0,0 +1,776 @@
|
||||
"""
|
||||
S3 脚本正则改写器 — rewrite.py
|
||||
将 Groovy S3 脚本(直接调 Vaadin API)改写为 S2 形态(facade 辅助函数调用)。
|
||||
|
||||
分类标签:
|
||||
FULL_AUTO — 全部 S3 模式改写成功,无遗留
|
||||
PARTIAL — 部分改写成功,仍有 S3 片段待人工处理
|
||||
HARD — 命中硬 S3 特征(动态 Vaadin 组件/确认框),整条转人工
|
||||
NO_S3 — 未检测到任何 S3 模式,原样返回
|
||||
|
||||
用法:
|
||||
from rewrite import rewrite_script
|
||||
text, details, label = rewrite_script(groovy_src)
|
||||
"""
|
||||
|
||||
import re
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Tuple
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 1. 硬 S3 检测模式(命中即整条转人工)
|
||||
# ──────────────────────────────────────────────
|
||||
HARD_S3_PATTERNS: List[Tuple[str, str]] = [
|
||||
# 动态创建 Vaadin 组件
|
||||
(r"\bnew\s+(Window|Button|ComboBox|TextField|Label|Table|Panel|"
|
||||
r"VerticalLayout|HorizontalLayout|FormLayout|GridLayout|"
|
||||
r"AbsoluteLayout|TabSheet|Accordion|PopupView|Upload|"
|
||||
r"ProgressBar|Slider|DateField|CheckBox|OptionGroup|"
|
||||
r"TwinColSelect|ListSelect|NativeSelect|PasswordField|"
|
||||
r"RichTextArea|TextArea|InlineDateField|Link|Embedded|"
|
||||
r"MenuBar|Tree|TreeTable|SplitPanel|HorizontalSplitPanel|"
|
||||
r"VerticalSplitPanel|Notification)\b",
|
||||
"动态创建 Vaadin 组件"),
|
||||
(r"\bshowConfirmDialog\b", "同步确认框 showConfirmDialog"),
|
||||
(r"\bUI\.getCurrent\(\)", "UI.getCurrent()"),
|
||||
]
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 2. 数据表驱动改写规则(按优先级顺序)
|
||||
# 每条规则: (规则名, 正则模式, 替换模板或替换函数)
|
||||
#
|
||||
# 占位符约定:
|
||||
# {FIELD} — 字段名字符串(含引号),如 "PROJ_NAME"
|
||||
# {ARG} — 单参数
|
||||
# {ARGS} — 多参数(逗号分隔)
|
||||
# {VAR} — Groovy 变量名
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
@dataclass
|
||||
class RewriteRule:
|
||||
name: str
|
||||
pattern: re.Pattern
|
||||
replacement: str # 可含 \1 \2 等反向引用,或直接是字符串
|
||||
|
||||
|
||||
def _make_field_rules() -> List[RewriteRule]:
|
||||
"""生成字段句柄链式调用规则表(数据表驱动)。
|
||||
|
||||
形态说明(真实库实测,2026-06-11):
|
||||
- 字段句柄链同时存在普通点 `.` 与 Groovy 安全导航 `?.`,二者语义在
|
||||
facade 形态下等价(facade 内部处理空值),因此每条字段规则用 NAV 占位
|
||||
统一匹配两者。真实库 266/400 字段链调用使用 `?.`,不支持则丢失约半数。
|
||||
"""
|
||||
# field_ref 匹配: group.getField("X") 或 group.getField('X')
|
||||
# NAV 同时匹配 `.` 与 `?.`,并允许中间空白(真实库有换行/空格变体)。
|
||||
fref = r'group\.getField\((["\'][^"\']+["\'])\)'
|
||||
NAV = r'\s*\??\.\s*'
|
||||
rules: List[RewriteRule] = []
|
||||
|
||||
# ── 2.1 addButton(字段内联按钮)─────────────────────────────
|
||||
# group.getField("X").addButton("label", handler)
|
||||
# → addFieldButton("X", "label", handler)
|
||||
# 注意: 仅当首参为字符串字面量(按钮文案)时才视为字段按钮。
|
||||
# 形如 addButton(group.getField("SELECT"),0) 是子表动作按钮(另规则)。
|
||||
rules.append(RewriteRule(
|
||||
name="addButton",
|
||||
pattern=re.compile(
|
||||
fref + NAV + r'addButton\(\s*(["\'][^"\']*["\'][^)]*)\)',
|
||||
re.DOTALL
|
||||
),
|
||||
replacement=r'addFieldButton(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.1b addSubTableButton(子表动作按钮)────────────────────
|
||||
# group.getField("LIST").addButton(group.getField("SELECT"), 0)
|
||||
# → addSubTableButton("LIST", "SELECT", 0)
|
||||
# 真实库子表挂载选择/新增按钮的写法,首参是另一个字段句柄。
|
||||
rules.append(RewriteRule(
|
||||
name="addSubTableButton",
|
||||
pattern=re.compile(
|
||||
fref + NAV +
|
||||
r'addButton\(\s*group\.getField\((["\'][^"\']+["\'])\)\s*,\s*([^)]+)\)',
|
||||
re.DOTALL
|
||||
),
|
||||
replacement=r'addSubTableButton(\1, \2, \3)',
|
||||
))
|
||||
|
||||
# ── 2.2 getValue ───────────────────────────────────────────
|
||||
# group.getField("X").getValue() → getFieldValue("X")
|
||||
rules.append(RewriteRule(
|
||||
name="getValue",
|
||||
pattern=re.compile(fref + NAV + r'getValue\(\)'),
|
||||
replacement=r'getFieldValue(\1)',
|
||||
))
|
||||
|
||||
# ── 2.3 setValue ───────────────────────────────────────────
|
||||
# group.getField("X").setValue(v) → setFieldValue("X", v)
|
||||
rules.append(RewriteRule(
|
||||
name="setValue",
|
||||
pattern=re.compile(fref + NAV + r'setValue\(([^)]+)\)'),
|
||||
replacement=r'setFieldValue(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.4 setVisible ─────────────────────────────────────────
|
||||
# group.getField("X").setVisible(b) → setFieldVisible("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="setVisible",
|
||||
pattern=re.compile(fref + NAV + r'setVisible\(([^)]+)\)'),
|
||||
replacement=r'setFieldVisible(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.5 setCaption ─────────────────────────────────────────
|
||||
# group.getField("X").setCaption(s) → setFieldCaption("X", s)
|
||||
rules.append(RewriteRule(
|
||||
name="setCaption",
|
||||
pattern=re.compile(fref + NAV + r'setCaption\(([^)]+)\)'),
|
||||
replacement=r'setFieldCaption(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.6 setEnabled / setReadOnly ───────────────────────────
|
||||
# group.getField("X").setEnabled(b) → setFieldEnabled("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="setEnabled",
|
||||
pattern=re.compile(fref + NAV + r'setEnabled\(([^)]+)\)'),
|
||||
replacement=r'setFieldEnabled(\1, \2)',
|
||||
))
|
||||
# group.getField("X").getPropertyDataSource().setReadOnly(b)
|
||||
# → setFieldReadOnly("X", b)
|
||||
# 真实库"把字段底层属性置只读"的等价惯用写法,须先于裸 setReadOnly 规则,
|
||||
# 否则中间的 getPropertyDataSource() 会阻断匹配。
|
||||
rules.append(RewriteRule(
|
||||
name="propertyDataSource_setReadOnly",
|
||||
pattern=re.compile(
|
||||
fref + NAV + r'getPropertyDataSource\(\)' + NAV + r'setReadOnly\(([^)]+)\)'),
|
||||
replacement=r'setFieldReadOnly(\1, \2)',
|
||||
))
|
||||
# group.getField("X").setReadOnly(b) → setFieldReadOnly("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="setReadOnly_field",
|
||||
pattern=re.compile(fref + NAV + r'setReadOnly\(([^)]+)\)'),
|
||||
replacement=r'setFieldReadOnly(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.7 setRequired / setRequiredError ─────────────────────
|
||||
# group.getField("X").setRequired(b) → setFieldRequired("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="setRequired",
|
||||
pattern=re.compile(fref + NAV + r'setRequired\(([^)]+)\)'),
|
||||
replacement=r'setFieldRequired(\1, \2)',
|
||||
))
|
||||
# group.getField("X").setRequiredError(msg) → setFieldRequiredError("X", msg)
|
||||
rules.append(RewriteRule(
|
||||
name="setRequiredError",
|
||||
pattern=re.compile(fref + NAV + r'setRequiredError\(([^)]+)\)', re.DOTALL),
|
||||
replacement=r'setFieldRequiredError(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.8 getContainerDataSource().setFilter / removeAllItems ─
|
||||
# group.getField("X").getContainerDataSource().setFilter(...)
|
||||
# → setFieldDataFilter("X", ...)
|
||||
rules.append(RewriteRule(
|
||||
name="setFilter",
|
||||
pattern=re.compile(
|
||||
fref + NAV + r'getContainerDataSource\(\)' + NAV + r'setFilter\(([^)]*)\)',
|
||||
re.DOTALL
|
||||
),
|
||||
replacement=r'setFieldDataFilter(\1, \2)',
|
||||
))
|
||||
# group.getField("X").getContainerDataSource().removeAllItems()
|
||||
# → clearFieldData("X")
|
||||
rules.append(RewriteRule(
|
||||
name="removeAllItems_ds",
|
||||
pattern=re.compile(
|
||||
fref + NAV + r'getContainerDataSource\(\)' + NAV + r'removeAllItems\(\)'
|
||||
),
|
||||
replacement=r'clearFieldData(\1)',
|
||||
))
|
||||
# group.getField("X").removeAllItems() (无中间 getContainerDataSource)
|
||||
# → clearFieldData("X") — 真实库下拉清空常见简写
|
||||
rules.append(RewriteRule(
|
||||
name="removeAllItems",
|
||||
pattern=re.compile(fref + NAV + r'removeAllItems\(\)'),
|
||||
replacement=r'clearFieldData(\1)',
|
||||
))
|
||||
|
||||
# ── 2.9 getContainerDataSource (裸取数据源) ─────────────────
|
||||
# group.getField("X").getContainerDataSource()
|
||||
# → getFieldDataSource("X")
|
||||
rules.append(RewriteRule(
|
||||
name="getContainerDataSource",
|
||||
pattern=re.compile(fref + NAV + r'getContainerDataSource\(\)'),
|
||||
replacement=r'getFieldDataSource(\1)',
|
||||
))
|
||||
|
||||
# ── 2.10 getDisplay ────────────────────────────────────────
|
||||
# group.getField("X").getDisplay() → getFieldDisplay("X")
|
||||
rules.append(RewriteRule(
|
||||
name="getDisplay",
|
||||
pattern=re.compile(fref + NAV + r'getDisplay\(\)'),
|
||||
replacement=r'getFieldDisplay(\1)',
|
||||
))
|
||||
|
||||
# ── 2.10b showAddButton(子表新增按钮显隐)──────────────────
|
||||
# group.getField("X").showAddButton(b) → setSubTableAddButtonVisible("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="showAddButton",
|
||||
pattern=re.compile(fref + NAV + r'showAddButton\(([^)]+)\)'),
|
||||
replacement=r'setSubTableAddButtonVisible(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.10c setViewWithoutEditor(只读视图无编辑器)────────────
|
||||
# group.getField("X").setViewWithoutEditor(b) → setFieldViewOnly("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="setViewWithoutEditor",
|
||||
pattern=re.compile(fref + NAV + r'setViewWithoutEditor\(([^)]+)\)'),
|
||||
replacement=r'setFieldViewOnly(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.10d setFilter / setFilterMap(字段下拉过滤,复杂参数)─
|
||||
# 直接挂在字段句柄上的 setFilter(map) / setFilterMap(map)。
|
||||
# 参数常含嵌套 [..] 与函数调用,无法用 [^)]+ 安全匹配,
|
||||
# 改由平衡括号预处理 _rewrite_balanced_field_calls 处理(见下)。
|
||||
# 此处不注册正则规则,留空说明保持登记完整性。
|
||||
|
||||
# ── 2.10e focus(字段聚焦)──────────────────────────────────
|
||||
# group.getField("X").focus() → focusField("X")
|
||||
rules.append(RewriteRule(
|
||||
name="focus",
|
||||
pattern=re.compile(fref + NAV + r'focus\(\)'),
|
||||
replacement=r'focusField(\1)',
|
||||
))
|
||||
|
||||
# ── 2.10f setWidth / setHeight(字段尺寸)───────────────────
|
||||
# group.getField("X").setWidth(w) → setFieldWidth("X", w)
|
||||
rules.append(RewriteRule(
|
||||
name="setWidth",
|
||||
pattern=re.compile(fref + NAV + r'setWidth\(([^)]+)\)'),
|
||||
replacement=r'setFieldWidth(\1, \2)',
|
||||
))
|
||||
rules.append(RewriteRule(
|
||||
name="setHeight",
|
||||
pattern=re.compile(fref + NAV + r'setHeight\(([^)]+)\)'),
|
||||
replacement=r'setFieldHeight(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.10h reload(字段数据源刷新)──────────────────────────
|
||||
# group.getField("X").reload() → reloadField("X")
|
||||
rules.append(RewriteRule(
|
||||
name="reload",
|
||||
pattern=re.compile(fref + NAV + r'reload\(\)'),
|
||||
replacement=r'reloadField(\1)',
|
||||
))
|
||||
|
||||
# ── 2.10i setConvertedValue(转换后赋值)────────────────────
|
||||
# group.getField("X").setConvertedValue(v) → setFieldConvertedValue("X", v)
|
||||
rules.append(RewriteRule(
|
||||
name="setConvertedValue",
|
||||
pattern=re.compile(fref + NAV + r'setConvertedValue\(([^)]+)\)'),
|
||||
replacement=r'setFieldConvertedValue(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.10j setNullSelectionItemId(空选项 id)────────────────
|
||||
# group.getField("X").setNullSelectionItemId(v) → setFieldNullSelection("X", v)
|
||||
rules.append(RewriteRule(
|
||||
name="setNullSelectionItemId",
|
||||
pattern=re.compile(fref + NAV + r'setNullSelectionItemId\(([^)]+)\)'),
|
||||
replacement=r'setFieldNullSelection(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.10k removeItem(删下拉项)─────────────────────────────
|
||||
# group.getField("X").removeItem(v) → removeFieldItem("X", v)
|
||||
rules.append(RewriteRule(
|
||||
name="removeItem",
|
||||
pattern=re.compile(fref + NAV + r'removeItem\(([^)]+)\)'),
|
||||
replacement=r'removeFieldItem(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.10l showDeleteButton(子表删除按钮显隐)───────────────
|
||||
# group.getField("X").showDeleteButton(b) → setSubTableDeleteButtonVisible("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="showDeleteButton",
|
||||
pattern=re.compile(fref + NAV + r'showDeleteButton\(([^)]+)\)'),
|
||||
replacement=r'setSubTableDeleteButtonVisible(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.10m getModifyButton().setVisible / getDetailButton().setVisible ─
|
||||
# group.getField("X").getModifyButton().setVisible(b)
|
||||
# → setSubTableModifyButtonVisible("X", b)
|
||||
rules.append(RewriteRule(
|
||||
name="getModifyButton_setVisible",
|
||||
pattern=re.compile(
|
||||
fref + NAV + r'getModifyButton\(\)' + NAV + r'setVisible\(([^)]+)\)'),
|
||||
replacement=r'setSubTableModifyButtonVisible(\1, \2)',
|
||||
))
|
||||
rules.append(RewriteRule(
|
||||
name="getDetailButton_setVisible",
|
||||
pattern=re.compile(
|
||||
fref + NAV + r'getDetailButton\(\)' + NAV + r'setVisible\(([^)]+)\)'),
|
||||
replacement=r'setSubTableDetailButtonVisible(\1, \2)',
|
||||
))
|
||||
|
||||
# ── 2.11 group.setReadOnly (组级) ──────────────────────────
|
||||
# group.setReadOnly(b) / group?.setReadOnly(b) → setGroupReadOnly(b)
|
||||
rules.append(RewriteRule(
|
||||
name="group_setReadOnly",
|
||||
pattern=re.compile(r'\bgroup\s*\??\.\s*setReadOnly\(([^)]+)\)'),
|
||||
replacement=r'setGroupReadOnly(\1)',
|
||||
))
|
||||
|
||||
# ── 2.12 group.setEnabled (组级) ───────────────────────────
|
||||
rules.append(RewriteRule(
|
||||
name="group_setEnabled",
|
||||
pattern=re.compile(r'\bgroup\s*\??\.\s*setEnabled\(([^)]+)\)'),
|
||||
replacement=r'setGroupEnabled(\1)',
|
||||
))
|
||||
|
||||
# ── 2.13 Notification.show ─────────────────────────────────
|
||||
# Notification.show(msg) / Notification.show(msg, Type)
|
||||
# → showToast(msg) / showToast(msg, type)
|
||||
rules.append(RewriteRule(
|
||||
name="Notification_show",
|
||||
pattern=re.compile(
|
||||
r'\bNotification\.show\(([^)]+)\)',
|
||||
re.DOTALL
|
||||
),
|
||||
replacement=r'showToast(\1)',
|
||||
))
|
||||
|
||||
# ── 2.14 enableButton ──────────────────────────────────────
|
||||
# enableButton("BTN", b) — 已是 S2 形态,保持不变(作为无操作规则)
|
||||
# 此处不改写,仅识别(不在 S3 剩余检测里误报)
|
||||
|
||||
return rules
|
||||
|
||||
|
||||
# 单例规则表(模块加载时编译一次)
|
||||
REWRITE_RULES: List[RewriteRule] = _make_field_rules()
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 2bis. 平衡括号字段调用预处理
|
||||
# 处理参数含嵌套 [..]/(..) 的字段句柄方法(setFilter/setFilterMap),
|
||||
# 正则的 [^)]+ 会在首个 ) 处截断,故用括号配平扫描。
|
||||
# 形态: group.getField("X")[?.|.]<method>( ...balanced... )
|
||||
# 映射: setFilter→setFieldFilter, setFilterMap→setFieldFilterMap
|
||||
# ──────────────────────────────────────────────
|
||||
_BALANCED_FIELD_VERBS = {
|
||||
"setFilter": "setFieldFilter",
|
||||
"setFilterMap": "setFieldFilterMap",
|
||||
}
|
||||
_BALANCED_HEAD_RE = re.compile(
|
||||
r'group\.getField\((["\'][^"\']+["\'])\)\s*\??\.\s*(setFilter|setFilterMap)\('
|
||||
)
|
||||
|
||||
|
||||
def _match_balanced(text: str, open_idx: int) -> int:
|
||||
"""从 text[open_idx]=='(' 起,返回配平的 ')' 索引;失败返回 -1。"""
|
||||
depth = 0
|
||||
i = open_idx
|
||||
n = len(text)
|
||||
while i < n:
|
||||
ch = text[i]
|
||||
if ch == '(':
|
||||
depth += 1
|
||||
elif ch == ')':
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
return i
|
||||
i += 1
|
||||
return -1
|
||||
|
||||
|
||||
def _rewrite_balanced_field_calls(text: str) -> Tuple[str, int]:
|
||||
"""改写复杂参数字段调用(setFilter/setFilterMap)。返回 (新文本, 次数)。"""
|
||||
count = 0
|
||||
out = []
|
||||
pos = 0
|
||||
while True:
|
||||
m = _BALANCED_HEAD_RE.search(text, pos)
|
||||
if not m:
|
||||
out.append(text[pos:])
|
||||
break
|
||||
field, verb = m.group(1), m.group(2)
|
||||
open_idx = m.end() - 1 # 指向方法名后的 '('
|
||||
close_idx = _match_balanced(text, open_idx)
|
||||
if close_idx == -1:
|
||||
# 括号不配平,放弃改写该处,原样输出并跳过
|
||||
out.append(text[pos:m.end()])
|
||||
pos = m.end()
|
||||
continue
|
||||
arg = text[open_idx + 1:close_idx]
|
||||
facade = _BALANCED_FIELD_VERBS[verb]
|
||||
out.append(text[pos:m.start()])
|
||||
out.append(f'{facade}({field}, {arg})')
|
||||
pos = close_idx + 1
|
||||
count += 1
|
||||
return ''.join(out), count
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 2ter. 下拉选项填充 idiom → addFieldOption(平衡括号)
|
||||
# 形态(改写后): getFieldDataSource("F")?.addItem(V).getItemProperty("des").setValue(D)
|
||||
# 映射: addFieldOption("F", V, D)
|
||||
# 说明: 真实库构造下拉选项的标准写法(250/271 形态一致,属性键恒为 "des")。
|
||||
# 此为确定性 1:1 语句转换——把"向 F 字段的数据源加一个值/显示项"
|
||||
# 折叠为 facade 调用,不臆测循环体,逐条安全。
|
||||
# 前置: 需先把 `def ic = getFieldDataSource("F")` 句柄变量内联回字面形态
|
||||
# (见 _inline_datasource_handles)。
|
||||
# ──────────────────────────────────────────────
|
||||
# 头: getFieldDataSource("F")?.addItem( —— 捕获字段名,定位 addItem 起始括号
|
||||
_OPTION_HEAD_RE = re.compile(
|
||||
r'getFieldDataSource\((["\'][^"\']+["\'])\)\s*\??\.\s*addItem\('
|
||||
)
|
||||
# addItem 参数闭合后紧跟: [?.|.]getItemProperty("des")[?.|.]setValue( D )
|
||||
# 真实库 getItemProperty/setValue 之间同样存在 ?. 安全导航变体。
|
||||
_OPTION_TAIL_RE = re.compile(
|
||||
r'\s*\??\.\s*getItemProperty\(\s*["\']des["\']\s*\)\s*\??\.\s*setValue\('
|
||||
)
|
||||
|
||||
|
||||
def _rewrite_option_population(text: str) -> Tuple[str, int]:
|
||||
"""改写下拉选项填充 idiom → addFieldOption。返回 (新文本, 次数)。"""
|
||||
count = 0
|
||||
out = []
|
||||
pos = 0
|
||||
while True:
|
||||
m = _OPTION_HEAD_RE.search(text, pos)
|
||||
if not m:
|
||||
out.append(text[pos:])
|
||||
break
|
||||
field = m.group(1)
|
||||
ai_open = m.end() - 1 # addItem 的 '('
|
||||
ai_close = _match_balanced(text, ai_open)
|
||||
if ai_close == -1:
|
||||
out.append(text[pos:m.end()]); pos = m.end(); continue
|
||||
value_arg = text[ai_open + 1:ai_close]
|
||||
|
||||
tail = _OPTION_TAIL_RE.match(text, ai_close + 1)
|
||||
if not tail:
|
||||
# 仅 addItem(...) 无 getItemProperty("des").setValue —— 不属本 idiom,跳过
|
||||
out.append(text[pos:m.end()]); pos = m.end(); continue
|
||||
sv_open = tail.end() - 1 # setValue 的 '('
|
||||
sv_close = _match_balanced(text, sv_open)
|
||||
if sv_close == -1:
|
||||
out.append(text[pos:m.end()]); pos = m.end(); continue
|
||||
desc_arg = text[sv_open + 1:sv_close]
|
||||
|
||||
out.append(text[pos:m.start()])
|
||||
out.append(f'addFieldOption({field}, {value_arg}, {desc_arg})')
|
||||
pos = sv_close + 1
|
||||
count += 1
|
||||
return ''.join(out), count
|
||||
|
||||
|
||||
# 数据源句柄变量赋值行(改写后): def ic = getFieldDataSource("F");
|
||||
_DS_ASSIGN_LINE_RE = re.compile(
|
||||
r'^[ \t]*(?:def\s+|final\s+|var\s+|Object\s+)?(\w+)\s*=\s*'
|
||||
r'(getFieldDataSource\(["\'][^"\']+["\']\))[ \t]*;?[ \t]*(?://[^\n]*)?$',
|
||||
re.MULTILINE,
|
||||
)
|
||||
|
||||
|
||||
def _inline_datasource_handles(text: str) -> Tuple[str, List[str]]:
|
||||
"""
|
||||
将单赋值数据源句柄变量内联展开,使 addFieldOption 模式可匹配。
|
||||
def ic = getFieldDataSource("F")
|
||||
ic?.addItem(...)...
|
||||
→ getFieldDataSource("F")?.addItem(...)...
|
||||
复用与字段句柄内联相同的"持有者引用"语义(仅替换 var. / var?.)。
|
||||
"""
|
||||
inlined: List[str] = []
|
||||
lines = text.split('\n')
|
||||
result_lines = list(lines)
|
||||
|
||||
assignments: List[Tuple[int, str, str]] = []
|
||||
for idx, line in enumerate(lines):
|
||||
m = _DS_ASSIGN_LINE_RE.match(line)
|
||||
if m:
|
||||
assignments.append((idx, m.group(1), m.group(2)))
|
||||
|
||||
for assign_idx, var, fexpr in reversed(assignments):
|
||||
ref_re = re.compile(r'\b' + re.escape(var) + r'\b(?=\s*\??\.)')
|
||||
replaced_any = False
|
||||
for i in range(assign_idx + 1, len(result_lines)):
|
||||
cur = result_lines[i]
|
||||
m2 = _DS_ASSIGN_LINE_RE.match(cur)
|
||||
if m2 and m2.group(1) == var:
|
||||
break
|
||||
if ref_re.search(cur):
|
||||
result_lines[i] = ref_re.sub(fexpr, cur)
|
||||
replaced_any = True
|
||||
if replaced_any:
|
||||
result_lines[assign_idx] = ''
|
||||
inlined.append(
|
||||
f"内联数据源句柄变量 `{var}` → `{fexpr}`(原第 {assign_idx+1} 行)"
|
||||
)
|
||||
return '\n'.join(result_lines), inlined
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 3. S3 残留检测(改写后仍有未处理的 Vaadin API)
|
||||
#
|
||||
# 判定原则: 凡仍能匹配 *未被改写的 Vaadin UI 句柄链* 即残留。
|
||||
# - group.getField( 仍存在 → 必有未覆盖动词,残留。
|
||||
# - group.setReadOnly / setEnabled(含 ?.)仍存在 → 残留。
|
||||
# - 容器/Item 级数据填充 idiom(getContainerDataSource / addItem /
|
||||
# getItemProperty / removeAllItems / setFilter)仍存在 → 残留。
|
||||
# 这些直接操作 Vaadin Container/Item 数据模型,不在自动改写边界内,
|
||||
# 诚实保留为 PARTIAL,不强行转换(避免错改)。
|
||||
# 注意: facade 自身的 setFieldValue/getFieldValue 等 *不带句柄前缀* 的形态
|
||||
# 不应触发残留,故这里只匹配 group.getField( 句柄链与容器/Item 链。
|
||||
# ──────────────────────────────────────────────
|
||||
RESIDUAL_S3_PATTERNS = [
|
||||
# 任何残留的字段句柄链(含 ?.,含未覆盖动词)
|
||||
re.compile(r'group\.getField\('),
|
||||
# 组级残留(含安全导航)
|
||||
re.compile(r'\bgroup\s*\??\.\s*setReadOnly\('),
|
||||
re.compile(r'\bgroup\s*\??\.\s*setEnabled\('),
|
||||
re.compile(r'\bgroup\s*\??\.\s*setVisible\('),
|
||||
re.compile(r'\bNotification\.show\('),
|
||||
# 容器 / Item 级数据填充 idiom(保留为人工,不自动转)
|
||||
re.compile(r'\.getContainerDataSource\('),
|
||||
re.compile(r'\.getPropertyDataSource\('),
|
||||
re.compile(r'\.getItemProperty\('),
|
||||
re.compile(r'\.addItem\('),
|
||||
re.compile(r'\.removeAllItems\('),
|
||||
re.compile(r'\.setFilter\('),
|
||||
]
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 4. 内联单赋值字段句柄变量(两遍处理)
|
||||
#
|
||||
# def f = group.getField("X") // 或 def fld = ...
|
||||
# f.setVisible(true)
|
||||
# →
|
||||
# group.getField("X").setVisible(true)
|
||||
# ──────────────────────────────────────────────
|
||||
# 匹配单行字段句柄赋值:
|
||||
# def f = group.getField("X")
|
||||
# final fld = group.getField('Y')
|
||||
# f = group.getField("Z")
|
||||
# 使用 MULTILINE 在完整文本中逐行匹配,不依赖行末换行符
|
||||
# 匹配字段句柄赋值行(允许行末分号 / 注释 / 普通点或安全导航不触发——仅裸取句柄)。
|
||||
# 真实库 548 处赋值写成 `def isShare = group.getField("ISSHARE");`(带分号),
|
||||
# 旧正则用 `$` 收尾不允许分号,导致全部漏内联。这里允许尾随 `;` 与空白。
|
||||
_FIELD_ASSIGN_LINE_RE = re.compile(
|
||||
r'^[ \t]*(?:def\s+|final\s+|String\s+|Object\s+|var\s+)?(\w+)\s*=\s*'
|
||||
r'(group\.getField\(["\'][^"\']+["\']\))[ \t]*;?[ \t]*(?://[^\n]*)?$',
|
||||
re.MULTILINE,
|
||||
)
|
||||
|
||||
|
||||
def _inline_field_handles(text: str) -> Tuple[str, List[str]]:
|
||||
"""
|
||||
将单赋值字段句柄变量内联展开。
|
||||
返回 (展开后文本, 内联操作说明列表)。
|
||||
只处理在赋值行之后、**下一个同名赋值之前**出现的引用。
|
||||
|
||||
引用替换同时覆盖普通点 `var.foo()` 与安全导航 `var?.foo()`:
|
||||
真实库句柄变量后续多用 `?.`(如 isShare?.setReadOnly(...)),
|
||||
内联时把 `var?.` 还原为 `group.getField("ISSHARE")?.`,
|
||||
保留导航符交由后续字段规则统一改写。
|
||||
"""
|
||||
inlined: List[str] = []
|
||||
lines = text.split('\n')
|
||||
result_lines = list(lines)
|
||||
|
||||
# 收集所有赋值:(行号, 变量名, 字段表达式)
|
||||
assignments: List[Tuple[int, str, str]] = []
|
||||
for idx, line in enumerate(lines):
|
||||
m = _FIELD_ASSIGN_LINE_RE.match(line)
|
||||
if m:
|
||||
assignments.append((idx, m.group(1), m.group(2)))
|
||||
|
||||
# 倒序处理(避免行号偏移影响索引)
|
||||
for assign_idx, var, fexpr in reversed(assignments):
|
||||
# 只替换作为"句柄持有者"的引用:var. 或 var?.(后面紧跟方法链),
|
||||
# 不误伤把 var 当普通值用的场景(如 `if (var == null)`)。
|
||||
# 替换时仅吃掉变量名,保留其后的 `.`/`?.`,故用零宽断言。
|
||||
ref_re = re.compile(r'\b' + re.escape(var) + r'\b(?=\s*\??\.)')
|
||||
replaced_any = False
|
||||
for i in range(assign_idx + 1, len(result_lines)):
|
||||
cur = result_lines[i]
|
||||
# 遇到同名重赋值则停止
|
||||
m2 = _FIELD_ASSIGN_LINE_RE.match(cur)
|
||||
if m2 and m2.group(1) == var:
|
||||
break
|
||||
if ref_re.search(cur):
|
||||
result_lines[i] = ref_re.sub(fexpr, cur)
|
||||
replaced_any = True
|
||||
if replaced_any:
|
||||
# 删除赋值行(置为空行,保留行号结构)
|
||||
result_lines[assign_idx] = ''
|
||||
inlined.append(
|
||||
f"内联字段句柄变量 `{var}` → `{fexpr}`(原第 {assign_idx+1} 行)"
|
||||
)
|
||||
return '\n'.join(result_lines), inlined
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 5. 主改写入口
|
||||
# ──────────────────────────────────────────────
|
||||
@dataclass
|
||||
class RewriteDetail:
|
||||
rule_name: str
|
||||
original: str
|
||||
rewritten: str
|
||||
count: int = 1
|
||||
|
||||
|
||||
def rewrite_script(source: str) -> Tuple[str, List[RewriteDetail], str]:
|
||||
"""
|
||||
对输入的 Groovy 脚本文本执行 S3 改写。
|
||||
|
||||
返回:
|
||||
(改写后文本, 改写明细列表, 分类标签)
|
||||
分类标签: FULL_AUTO / PARTIAL / HARD / NO_S3
|
||||
"""
|
||||
details: List[RewriteDetail] = []
|
||||
|
||||
# ── 5.1 硬 S3 检测 ────────────────────────────────────────
|
||||
hard_reasons = []
|
||||
for pattern_str, reason in HARD_S3_PATTERNS:
|
||||
if re.search(pattern_str, source):
|
||||
hard_reasons.append(reason)
|
||||
if hard_reasons:
|
||||
details.append(RewriteDetail(
|
||||
rule_name="HARD_DETECTION",
|
||||
original="; ".join(hard_reasons),
|
||||
rewritten="[人工处理]",
|
||||
count=len(hard_reasons),
|
||||
))
|
||||
return source, details, "HARD"
|
||||
|
||||
# ── 5.2 无 S3 快检 ────────────────────────────────────────
|
||||
def _has_s3(text: str) -> bool:
|
||||
for pat in RESIDUAL_S3_PATTERNS:
|
||||
if pat.search(text):
|
||||
return True
|
||||
# 还检查 Notification.show
|
||||
if re.search(r'\bNotification\.show\(', text):
|
||||
return True
|
||||
return False
|
||||
|
||||
if not _has_s3(source):
|
||||
return source, details, "NO_S3"
|
||||
|
||||
# ── 5.3 内联字段句柄变量(第一遍)────────────────────────
|
||||
working, inline_notes = _inline_field_handles(source)
|
||||
for note in inline_notes:
|
||||
details.append(RewriteDetail(
|
||||
rule_name="inline_field_handle",
|
||||
original=note,
|
||||
rewritten="[已内联]",
|
||||
))
|
||||
|
||||
# ── 5.4 平衡括号字段调用(setFilter/setFilterMap 复杂参数)─
|
||||
working, bcount = _rewrite_balanced_field_calls(working)
|
||||
if bcount > 0:
|
||||
details.append(RewriteDetail(
|
||||
rule_name="balanced_setFilter",
|
||||
original=f"命中 {bcount} 处",
|
||||
rewritten="→ 已替换",
|
||||
count=bcount,
|
||||
))
|
||||
|
||||
# ── 5.5 应用规则表(第二遍)──────────────────────────────
|
||||
for rule in REWRITE_RULES:
|
||||
new_text, count = _apply_rule(working, rule)
|
||||
if count > 0:
|
||||
details.append(RewriteDetail(
|
||||
rule_name=rule.name,
|
||||
original=f"命中 {count} 处",
|
||||
rewritten=f"→ 已替换",
|
||||
count=count,
|
||||
))
|
||||
working = new_text
|
||||
|
||||
# ── 5.6 再次内联(处理可能被改写暴露的新变量引用)─────────
|
||||
working2, inline_notes2 = _inline_field_handles(working)
|
||||
for note in inline_notes2:
|
||||
details.append(RewriteDetail(
|
||||
rule_name="inline_field_handle_pass2",
|
||||
original=note,
|
||||
rewritten="[已内联 pass2]",
|
||||
))
|
||||
working = working2
|
||||
|
||||
# ── 5.7 再次应用规则(处理第二遍内联暴露的模式)──────────
|
||||
if inline_notes2:
|
||||
working, bcount2 = _rewrite_balanced_field_calls(working)
|
||||
if bcount2 > 0:
|
||||
details.append(RewriteDetail(
|
||||
rule_name="balanced_setFilter_pass2",
|
||||
original=f"命中 {bcount2} 处",
|
||||
rewritten="→ 已替换",
|
||||
count=bcount2,
|
||||
))
|
||||
for rule in REWRITE_RULES:
|
||||
new_text, count = _apply_rule(working, rule)
|
||||
if count > 0:
|
||||
details.append(RewriteDetail(
|
||||
rule_name=rule.name + "_pass2",
|
||||
original=f"命中 {count} 处",
|
||||
rewritten=f"→ 已替换",
|
||||
count=count,
|
||||
))
|
||||
working = new_text
|
||||
|
||||
# ── 5.8 下拉选项填充 idiom(数据源句柄内联 + addFieldOption)─
|
||||
# 此时 getContainerDataSource() 已被规则改写为 getFieldDataSource(),
|
||||
# 先内联数据源句柄变量,再把 addItem().getItemProperty("des").setValue()
|
||||
# 链折叠为 addFieldOption。
|
||||
working, ds_notes = _inline_datasource_handles(working)
|
||||
for note in ds_notes:
|
||||
details.append(RewriteDetail(
|
||||
rule_name="inline_datasource_handle",
|
||||
original=note,
|
||||
rewritten="[已内联数据源]",
|
||||
))
|
||||
working, opt_count = _rewrite_option_population(working)
|
||||
if opt_count > 0:
|
||||
details.append(RewriteDetail(
|
||||
rule_name="addFieldOption",
|
||||
original=f"命中 {opt_count} 处",
|
||||
rewritten="→ 已折叠为 addFieldOption",
|
||||
count=opt_count,
|
||||
))
|
||||
|
||||
# ── 5.9 分类 ──────────────────────────────────────────────
|
||||
if not _has_s3(working):
|
||||
label = "FULL_AUTO"
|
||||
else:
|
||||
label = "PARTIAL"
|
||||
|
||||
return working, details, label
|
||||
|
||||
|
||||
def _apply_rule(text: str, rule: RewriteRule) -> Tuple[str, int]:
|
||||
"""应用单条规则,返回 (新文本, 替换次数)。"""
|
||||
count = 0
|
||||
|
||||
def replacer(m: re.Match) -> str:
|
||||
nonlocal count
|
||||
count += 1
|
||||
return m.expand(rule.replacement)
|
||||
|
||||
new_text = rule.pattern.sub(replacer, text)
|
||||
return new_text, count
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 6. CLI 入口(便于快速测试单文件)
|
||||
# ──────────────────────────────────────────────
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) < 2:
|
||||
print("用法: python rewrite.py <groovy文件>")
|
||||
sys.exit(1)
|
||||
with open(sys.argv[1], encoding="utf-8") as fh:
|
||||
src = fh.read()
|
||||
result, dets, lbl = rewrite_script(src)
|
||||
print(f"=== 分类: {lbl} ===")
|
||||
for d in dets:
|
||||
print(f" [{d.rule_name}] {d.original} {d.rewritten} (×{d.count})")
|
||||
print("=== 改写结果 ===")
|
||||
print(result)
|
||||
376
tools/s3_rewriter/run_eval.py
Normal file
376
tools/s3_rewriter/run_eval.py
Normal file
@@ -0,0 +1,376 @@
|
||||
"""
|
||||
run_eval.py — S3 改写器全语料评估
|
||||
|
||||
用法:
|
||||
python run_eval.py # 跑 corpus/ 目录下的合成语料
|
||||
python run_eval.py --corpus ./corpus # 指定语料目录
|
||||
python run_eval.py --from-db # 从数据库抽取真实脚本(需 psycopg2)
|
||||
|
||||
--from-db 模式依赖可选依赖 psycopg2,连接参数从环境变量读取:
|
||||
DB_HOST (默认 192.168.20.68)
|
||||
DB_PORT (默认 5435)
|
||||
DB_NAME (默认 postgres)
|
||||
DB_USER (默认 readonly)
|
||||
DB_PASS (默认 "")
|
||||
|
||||
输出指标:
|
||||
- 总条数 / 各分类条数
|
||||
- 自动化率 = FULL_AUTO / (FULL_AUTO + PARTIAL + HARD) [S3 条数为分母]
|
||||
- 每规则命中统计
|
||||
- HARD 条目清单(供人工排期)
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from collections import Counter, defaultdict
|
||||
from typing import List, Dict, Any
|
||||
|
||||
# 确保同目录的 rewrite.py 可导入
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from rewrite import rewrite_script, REWRITE_RULES, RewriteDetail
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 1. 语料加载
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
def load_corpus_dir(corpus_dir: str) -> List[Dict[str, Any]]:
|
||||
"""从 corpus/ 目录加载脚本,读取 index.json 获取期望标签。"""
|
||||
index_path = os.path.join(corpus_dir, "index.json")
|
||||
if not os.path.exists(index_path):
|
||||
raise FileNotFoundError(f"未找到 index.json: {index_path}")
|
||||
|
||||
with open(index_path, encoding="utf-8") as f:
|
||||
index = json.load(f)
|
||||
|
||||
records = []
|
||||
for entry in index:
|
||||
filepath = os.path.join(corpus_dir, entry["filename"])
|
||||
if not os.path.exists(filepath):
|
||||
print(f" [警告] 文件不存在,跳过: {filepath}")
|
||||
continue
|
||||
with open(filepath, encoding="utf-8") as f:
|
||||
src = f.read()
|
||||
records.append({
|
||||
"id": entry["id"],
|
||||
"name": entry["name"],
|
||||
"description": entry.get("description", ""),
|
||||
"expected_label": entry["expected_label"],
|
||||
"source": src,
|
||||
"origin": "corpus",
|
||||
})
|
||||
return records
|
||||
|
||||
|
||||
def load_corpus_db(db_params: Dict[str, str]) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
从数据库 view_template 表抽取脚本(--from-db 模式)。
|
||||
SQL 口径参照盘点报告 WS3 节,抽取含实质脚本的模板。
|
||||
|
||||
需要 psycopg2(可选依赖)。
|
||||
"""
|
||||
try:
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
except ImportError:
|
||||
print("错误: --from-db 模式需要 psycopg2,请先安装: pip install psycopg2-binary")
|
||||
sys.exit(1)
|
||||
|
||||
host = db_params.get("host", "192.168.20.68")
|
||||
port = int(db_params.get("port", "5435"))
|
||||
dbname = db_params.get("dbname", "postgres")
|
||||
user = db_params.get("user", "readonly")
|
||||
password = db_params.get("password", "")
|
||||
|
||||
print(f"连接数据库: {host}:{port}/{dbname} (用户: {user}) ...")
|
||||
|
||||
try:
|
||||
conn = psycopg2.connect(
|
||||
host=host, port=port, dbname=dbname,
|
||||
user=user, password=password,
|
||||
connect_timeout=10,
|
||||
options="-c search_path=eip3",
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"数据库连接失败: {e}")
|
||||
print("提示: 确认 192.168.20.68:5435 网络可达后重试")
|
||||
sys.exit(1)
|
||||
|
||||
# 抽取有脚本的模板:参照盘点口径,从 view_template 的 template_content XML
|
||||
# 中提取 <script> 节点文本(去重后约 1,427 条)。
|
||||
# 此 SQL 直接从 XML 列提取脚本文本,兼容 PG 9.4+。
|
||||
# 实测列名(2026-06-11 information_schema 核实):主键 view_template_id(character),
|
||||
# 模板内容列 xml(PG xml 类型)。脚本节点取 //script 文本。
|
||||
SQL = """
|
||||
SELECT
|
||||
trim(vt.view_template_id) AS template_id,
|
||||
vt.name AS template_name,
|
||||
unnest(
|
||||
xpath('//script/text()', vt.xml)
|
||||
)::text AS script_text
|
||||
FROM eip3.view_template vt
|
||||
WHERE vt.xml IS NOT NULL
|
||||
ORDER BY vt.view_template_id
|
||||
"""
|
||||
|
||||
records = []
|
||||
try:
|
||||
with conn.cursor(cursor_factory=psycopg2.extras.DictCursor) as cur:
|
||||
cur.execute(SQL)
|
||||
rows = cur.fetchall()
|
||||
for i, row in enumerate(rows):
|
||||
script_text = row["script_text"] or ""
|
||||
if len(script_text.strip()) < 5:
|
||||
continue
|
||||
records.append({
|
||||
"id": i + 1,
|
||||
"name": f"{row['template_id']}_{row['template_name']}",
|
||||
"description": f"真实脚本 from view_template id={row['template_id']}",
|
||||
"expected_label": None, # 真实脚本无预设期望标签
|
||||
"source": script_text,
|
||||
"origin": "database",
|
||||
})
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
print(f"从数据库抽取脚本: {len(records)} 条")
|
||||
return records
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 2. 评估核心
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
def evaluate(records: List[Dict[str, Any]]) -> Dict[str, Any]:
|
||||
"""对所有脚本跑改写器,汇总统计。"""
|
||||
label_counts = Counter()
|
||||
rule_hit_counts = Counter() # 规则名 → 命中总次数
|
||||
hard_items = [] # HARD 条目列表(供人工排期)
|
||||
partial_items = [] # PARTIAL 条目列表
|
||||
wrong_items = [] # 期望标签 != 实际标签(仅合成语料)
|
||||
total_s3 = 0 # S3 脚本总数(FULL_AUTO+PARTIAL+HARD)
|
||||
|
||||
for rec in records:
|
||||
src = rec["source"]
|
||||
expected = rec.get("expected_label")
|
||||
|
||||
result_text, details, label = rewrite_script(src)
|
||||
label_counts[label] += 1
|
||||
|
||||
# 统计规则命中
|
||||
for d in details:
|
||||
if d.rule_name not in ("HARD_DETECTION", "inline_field_handle",
|
||||
"inline_field_handle_pass2"):
|
||||
rule_name_base = d.rule_name.replace("_pass2", "")
|
||||
rule_hit_counts[rule_name_base] += d.count
|
||||
|
||||
if label in ("FULL_AUTO", "PARTIAL", "HARD"):
|
||||
total_s3 += 1
|
||||
|
||||
if label == "HARD":
|
||||
# 提取硬 S3 原因
|
||||
hard_reasons = [d.original for d in details
|
||||
if d.rule_name == "HARD_DETECTION"]
|
||||
hard_items.append({
|
||||
"id": rec["id"],
|
||||
"name": rec["name"],
|
||||
"description": rec["description"],
|
||||
"hard_reasons": hard_reasons,
|
||||
})
|
||||
|
||||
if label == "PARTIAL":
|
||||
partial_items.append({
|
||||
"id": rec["id"],
|
||||
"name": rec["name"],
|
||||
"description": rec["description"],
|
||||
})
|
||||
|
||||
# 合成语料:验证标签正确性
|
||||
if expected is not None and expected != label:
|
||||
wrong_items.append({
|
||||
"id": rec["id"],
|
||||
"name": rec["name"],
|
||||
"expected": expected,
|
||||
"actual": label,
|
||||
})
|
||||
|
||||
# 自动化率 = FULL_AUTO / 所有 S3 条目
|
||||
auto_count = label_counts["FULL_AUTO"]
|
||||
automation_rate = (auto_count / total_s3 * 100) if total_s3 > 0 else 0.0
|
||||
|
||||
return {
|
||||
"total": len(records),
|
||||
"label_counts": dict(label_counts),
|
||||
"total_s3": total_s3,
|
||||
"automation_rate": automation_rate,
|
||||
"rule_hit_counts": dict(rule_hit_counts),
|
||||
"hard_items": hard_items,
|
||||
"partial_items": partial_items,
|
||||
"wrong_items": wrong_items,
|
||||
}
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 3. 报告输出
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
def print_report(result: Dict[str, Any], origin: str = "corpus"):
|
||||
total = result["total"]
|
||||
lc = result["label_counts"]
|
||||
rate = result["automation_rate"]
|
||||
total_s3 = result["total_s3"]
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("S3 改写器评估报告")
|
||||
print("=" * 60)
|
||||
|
||||
if origin == "corpus":
|
||||
print("数据源: 合成语料(corpus/)")
|
||||
print("⚠️ 注意: 合成语料实测,真实库全量实测待 5435 网络恢复后")
|
||||
print(" 用 run_eval.py --from-db 重跑")
|
||||
else:
|
||||
print("数据源: 真实数据库(view_template)")
|
||||
|
||||
print(f"\n总脚本数: {total}")
|
||||
print(f"S3 脚本数: {total_s3} (FULL_AUTO + PARTIAL + HARD)")
|
||||
print()
|
||||
|
||||
labels = ["FULL_AUTO", "PARTIAL", "HARD", "NO_S3"]
|
||||
label_desc = {
|
||||
"FULL_AUTO": "全自动改写成功",
|
||||
"PARTIAL": "部分改写,余留人工",
|
||||
"HARD": "硬 S3,整条转人工",
|
||||
"NO_S3": "无 S3 模式,原样",
|
||||
}
|
||||
for lbl in labels:
|
||||
cnt = lc.get(lbl, 0)
|
||||
pct = cnt / total * 100 if total > 0 else 0
|
||||
bar = "█" * int(pct / 2)
|
||||
print(f" {lbl:12s}: {cnt:3d} 条 ({pct:5.1f}%) {bar}")
|
||||
|
||||
print()
|
||||
print(f"★ 自动化率 = FULL_AUTO / S3总数 = {lc.get('FULL_AUTO',0)} / {total_s3}"
|
||||
f" = {rate:.1f}%")
|
||||
|
||||
if rate >= 80:
|
||||
print(f" → 超过 80% 预算线 ✓")
|
||||
else:
|
||||
print(f" → 未达 80% 预算线,需扩展规则表")
|
||||
|
||||
# 规则命中统计
|
||||
print("\n规则命中统计:")
|
||||
rule_hits = result["rule_hit_counts"]
|
||||
if rule_hits:
|
||||
max_cnt = max(rule_hits.values()) if rule_hits else 1
|
||||
for rule_name in sorted(rule_hits, key=lambda k: -rule_hits[k]):
|
||||
cnt = rule_hits[rule_name]
|
||||
bar = "▪" * min(int(cnt / max_cnt * 20), 20)
|
||||
print(f" {rule_name:30s}: {cnt:4d} 次 {bar}")
|
||||
else:
|
||||
print(" (无规则命中)")
|
||||
|
||||
# HARD 清单
|
||||
hard_items = result["hard_items"]
|
||||
if hard_items:
|
||||
print(f"\nHARD 条目清单(共 {len(hard_items)} 条,需人工处理):")
|
||||
for item in hard_items:
|
||||
reasons = "; ".join(item["hard_reasons"])
|
||||
print(f" [{item['id']:03d}] {item['name']}")
|
||||
print(f" 原因: {reasons}")
|
||||
|
||||
# PARTIAL 清单
|
||||
partial_items = result["partial_items"]
|
||||
if partial_items:
|
||||
print(f"\nPARTIAL 条目(共 {len(partial_items)} 条,部分改写待人工):")
|
||||
for item in partial_items:
|
||||
print(f" [{item['id']:03d}] {item['name']} — {item['description']}")
|
||||
|
||||
# 标签对比(合成语料)
|
||||
wrong_items = result["wrong_items"]
|
||||
if wrong_items:
|
||||
print(f"\n⚠️ 标签不符(预期 != 实际): {len(wrong_items)} 条")
|
||||
for w in wrong_items:
|
||||
print(f" [{w['id']:03d}] {w['name']}: 预期={w['expected']}, 实际={w['actual']}")
|
||||
elif origin == "corpus":
|
||||
print(f"\n✓ 合成语料标签全部符合预期(0 条不符)")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 4. 主入口
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="S3 改写器全语料评估")
|
||||
parser.add_argument(
|
||||
"--corpus",
|
||||
default=os.path.join(os.path.dirname(__file__), "corpus"),
|
||||
help="语料目录路径(默认: ./corpus)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--from-db",
|
||||
action="store_true",
|
||||
help="从数据库抽取真实脚本(需 psycopg2,需 192.168.20.68:5435 可达)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--db-host", default=os.environ.get("DB_HOST", "192.168.20.68"),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--db-port", default=os.environ.get("DB_PORT", "5435"),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--db-name", default=os.environ.get("DB_NAME", "postgres"),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--db-user", default=os.environ.get("DB_USER", "readonly"),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--db-pass", default=os.environ.get("DB_PASS", ""),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output-json",
|
||||
default=None,
|
||||
help="将评估结果以 JSON 格式写入指定文件",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# 加载语料
|
||||
if args.from_db:
|
||||
records = load_corpus_db({
|
||||
"host": args.db_host,
|
||||
"port": args.db_port,
|
||||
"dbname": args.db_name,
|
||||
"user": args.db_user,
|
||||
"password": args.db_pass,
|
||||
})
|
||||
origin = "database"
|
||||
else:
|
||||
records = load_corpus_dir(args.corpus)
|
||||
origin = "corpus"
|
||||
|
||||
if not records:
|
||||
print("错误: 未加载到任何脚本,退出")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"已加载 {len(records)} 条脚本,开始评估...")
|
||||
|
||||
# 执行评估
|
||||
result = evaluate(records)
|
||||
|
||||
# 输出报告
|
||||
print_report(result, origin=origin)
|
||||
|
||||
# 可选 JSON 输出
|
||||
if args.output_json:
|
||||
with open(args.output_json, "w", encoding="utf-8") as f:
|
||||
json.dump(result, f, ensure_ascii=False, indent=2)
|
||||
print(f"\nJSON 评估结果已写入: {args.output_json}")
|
||||
|
||||
# 返回自动化率(供 CI 检查)
|
||||
return 0 if result["automation_rate"] >= 80.0 else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
8564
tools/s3_rewriter/scripts_cache.json
Normal file
8564
tools/s3_rewriter/scripts_cache.json
Normal file
File diff suppressed because one or more lines are too long
823
tools/s3_rewriter/test_rewriter.py
Normal file
823
tools/s3_rewriter/test_rewriter.py
Normal file
@@ -0,0 +1,823 @@
|
||||
"""
|
||||
test_rewriter.py — S3 改写器单元测试
|
||||
覆盖每条改写规则 + 内联逻辑 + 分类标签 + 边界情况。
|
||||
|
||||
运行:
|
||||
python -m pytest test_rewriter.py -v
|
||||
# 或
|
||||
python -m unittest test_rewriter -v
|
||||
"""
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from rewrite import rewrite_script
|
||||
|
||||
|
||||
class TestHardS3Detection(unittest.TestCase):
|
||||
"""硬 S3 检测 → 整条转人工,标签 HARD"""
|
||||
|
||||
def _assert_hard(self, src: str, msg: str = ""):
|
||||
_, details, label = rewrite_script(src)
|
||||
self.assertEqual(label, "HARD", msg or f"应为 HARD: {src[:60]}")
|
||||
|
||||
def test_new_window(self):
|
||||
self._assert_hard('def w = new Window("弹窗")')
|
||||
|
||||
def test_new_button(self):
|
||||
self._assert_hard('def b = new Button("确认")')
|
||||
|
||||
def test_new_combobox(self):
|
||||
self._assert_hard('def c = new ComboBox("类型")')
|
||||
|
||||
def test_new_textfield(self):
|
||||
self._assert_hard('def tf = new TextField("备注")')
|
||||
|
||||
def test_new_label(self):
|
||||
self._assert_hard('def lbl = new Label("提示")')
|
||||
|
||||
def test_new_table(self):
|
||||
self._assert_hard('def tbl = new Table("列表")')
|
||||
|
||||
def test_new_panel(self):
|
||||
self._assert_hard('def p = new Panel()')
|
||||
|
||||
def test_showConfirmDialog(self):
|
||||
self._assert_hard('showConfirmDialog("确认删除?", { it -> })')
|
||||
|
||||
def test_ui_getCurrent(self):
|
||||
self._assert_hard('UI.getCurrent().addWindow(w)')
|
||||
|
||||
def test_hard_takes_priority_over_s3_patterns(self):
|
||||
"""即使同时含 setVisible,只要有 new Window 就整条 HARD"""
|
||||
src = '''
|
||||
group.getField("X").setVisible(true)
|
||||
def win = new Window("弹窗")
|
||||
'''
|
||||
_, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "HARD")
|
||||
|
||||
|
||||
class TestNoS3(unittest.TestCase):
|
||||
"""无 S3 模式 → 原样返回,标签 NO_S3"""
|
||||
|
||||
def _assert_no_s3(self, src: str):
|
||||
result, details, label = rewrite_script(src)
|
||||
self.assertEqual(label, "NO_S3")
|
||||
self.assertEqual(result, src)
|
||||
|
||||
def test_pure_expression(self):
|
||||
self._assert_no_s3("return item.AMOUNT > 0\n")
|
||||
|
||||
def test_s2_enable_button(self):
|
||||
self._assert_no_s3('enableButton("BTN", item.STATUS == "DRAFT")\n')
|
||||
|
||||
def test_s2_setFieldVisible(self):
|
||||
self._assert_no_s3('setFieldVisible("X", true)\n')
|
||||
|
||||
def test_empty_string(self):
|
||||
self._assert_no_s3("")
|
||||
|
||||
def test_no_vaadin(self):
|
||||
self._assert_no_s3("def x = item.A + item.B\nreturn x\n")
|
||||
|
||||
|
||||
class TestAddButton(unittest.TestCase):
|
||||
"""addButton 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'group.getField("PROJ_STATUS").addButton("查看", handler)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('addFieldButton("PROJ_STATUS", "查看", handler)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_single_quote(self):
|
||||
src = "group.getField('REMARK').addButton('备注', remarkAction)"
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn("addFieldButton('REMARK', '备注', remarkAction)", result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_multiple_buttons(self):
|
||||
src = (
|
||||
'group.getField("X").addButton("A", h1)\n'
|
||||
'group.getField("Y").addButton("B", h2)\n'
|
||||
)
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertIn('addFieldButton("X", "A", h1)', result)
|
||||
self.assertIn('addFieldButton("Y", "B", h2)', result)
|
||||
|
||||
def test_no_original_call_remains(self):
|
||||
src = 'group.getField("X").addButton("test", cb)'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('group.getField("X").addButton', result)
|
||||
|
||||
|
||||
class TestGetValue(unittest.TestCase):
|
||||
"""getValue 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'def v = group.getField("AMOUNT").getValue()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldValue("AMOUNT")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_no_original_remains(self):
|
||||
src = 'group.getField("X").getValue()'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('.getValue()', result)
|
||||
|
||||
def test_multiple_fields(self):
|
||||
src = (
|
||||
'def a = group.getField("A").getValue()\n'
|
||||
'def b = group.getField("B").getValue()\n'
|
||||
)
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertIn('getFieldValue("A")', result)
|
||||
self.assertIn('getFieldValue("B")', result)
|
||||
|
||||
|
||||
class TestSetValue(unittest.TestCase):
|
||||
"""setValue 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'group.getField("STATUS").setValue("ACTIVE")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldValue("STATUS", "ACTIVE")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_variable_arg(self):
|
||||
src = 'group.getField("QTY").setValue(qty)'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertIn('setFieldValue("QTY", qty)', result)
|
||||
|
||||
|
||||
class TestSetVisible(unittest.TestCase):
|
||||
"""setVisible 规则"""
|
||||
|
||||
def test_basic_true(self):
|
||||
src = 'group.getField("NOTE").setVisible(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("NOTE", true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_expression_arg(self):
|
||||
src = 'group.getField("CERT").setVisible(item.TYPE == "A")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("CERT", item.TYPE == "A")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_no_original_remains(self):
|
||||
src = 'group.getField("X").setVisible(false)'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('.setVisible(', result)
|
||||
|
||||
|
||||
class TestSetCaption(unittest.TestCase):
|
||||
"""setCaption 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'group.getField("AMOUNT").setCaption("合同金额(元)")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldCaption("AMOUNT", "合同金额(元)")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_variable_caption(self):
|
||||
src = 'group.getField("NO").setCaption(labelVar)'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertIn('setFieldCaption("NO", labelVar)', result)
|
||||
|
||||
|
||||
class TestSetEnabled(unittest.TestCase):
|
||||
"""setEnabled 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'group.getField("BTN").setEnabled(false)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldEnabled("BTN", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestSetReadOnly(unittest.TestCase):
|
||||
"""setReadOnly 规则(字段级 + 组级)"""
|
||||
|
||||
def test_field_level(self):
|
||||
src = 'group.getField("CREATE_TIME").setReadOnly(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldReadOnly("CREATE_TIME", true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_group_level(self):
|
||||
src = 'group.setReadOnly(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setGroupReadOnly(true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_group_expression(self):
|
||||
src = 'group.setReadOnly(item.STATUS != "DRAFT")'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertIn('setGroupReadOnly(item.STATUS != "DRAFT")', result)
|
||||
|
||||
def test_no_original_remains_group(self):
|
||||
src = 'group.setReadOnly(false)'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('group.setReadOnly(', result)
|
||||
|
||||
|
||||
class TestSetRequired(unittest.TestCase):
|
||||
"""setRequired 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'group.getField("TAX_NO").setRequired(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldRequired("TAX_NO", true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestGetContainerDataSource(unittest.TestCase):
|
||||
"""getContainerDataSource / setFilter / removeAllItems 规则"""
|
||||
|
||||
def test_setFilter_basic(self):
|
||||
src = 'group.getField("DEPT").getContainerDataSource().setFilter("STATUS=1")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldDataFilter("DEPT", "STATUS=1")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_removeAllItems(self):
|
||||
src = 'group.getField("LIST").getContainerDataSource().removeAllItems()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('clearFieldData("LIST")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_bare_getContainerDataSource(self):
|
||||
src = 'def ds = group.getField("X").getContainerDataSource()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldDataSource("X")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_no_original_setFilter_remains(self):
|
||||
src = 'group.getField("X").getContainerDataSource().setFilter("A=1")'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('getContainerDataSource()', result)
|
||||
self.assertNotIn('.setFilter(', result)
|
||||
|
||||
|
||||
class TestGetDisplay(unittest.TestCase):
|
||||
"""getDisplay 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'def d = group.getField("STATUS").getDisplay()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldDisplay("STATUS")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_no_original_remains(self):
|
||||
src = 'group.getField("X").getDisplay()'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('.getDisplay()', result)
|
||||
|
||||
|
||||
class TestNotificationShow(unittest.TestCase):
|
||||
"""Notification.show → showToast 规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'Notification.show("操作成功")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('showToast("操作成功")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_variable_msg(self):
|
||||
src = 'Notification.show(msg)'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertIn('showToast(msg)', result)
|
||||
|
||||
def test_no_original_remains(self):
|
||||
src = 'Notification.show("x")'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('Notification.show(', result)
|
||||
|
||||
|
||||
class TestGroupSetEnabled(unittest.TestCase):
|
||||
"""group.setEnabled 组级规则"""
|
||||
|
||||
def test_basic(self):
|
||||
src = 'group.setEnabled(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setGroupEnabled(true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestInlineFieldHandle(unittest.TestCase):
|
||||
"""单赋值字段句柄变量内联"""
|
||||
|
||||
def test_basic_inline(self):
|
||||
src = (
|
||||
'def f = group.getField("STATUS")\n'
|
||||
'f.setVisible(true)\n'
|
||||
)
|
||||
result, details, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("STATUS", true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
# 确认赋值行被删除(变为空行)
|
||||
self.assertNotIn('def f = group.getField', result)
|
||||
|
||||
def test_inline_multiple_uses(self):
|
||||
src = (
|
||||
'def fld = group.getField("PROJ_NAME")\n'
|
||||
'fld.setCaption("项目名称")\n'
|
||||
'fld.setEnabled(false)\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldCaption("PROJ_NAME", "项目名称")', result)
|
||||
self.assertIn('setFieldEnabled("PROJ_NAME", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_inline_then_setFilter(self):
|
||||
src = (
|
||||
'def combo = group.getField("DEPT")\n'
|
||||
'combo.getContainerDataSource().setFilter("TYPE=1")\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldDataFilter("DEPT", "TYPE=1")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_inline_with_getValue(self):
|
||||
src = (
|
||||
'def f = group.getField("AMOUNT")\n'
|
||||
'def v = f.getValue()\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldValue("AMOUNT")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestMixedPatterns(unittest.TestCase):
|
||||
"""多模式混合脚本"""
|
||||
|
||||
def test_addButton_plus_setVisible(self):
|
||||
src = (
|
||||
'group.getField("ACTION").addButton("审批", approveAction)\n'
|
||||
'group.getField("ACTION").setVisible(item.STATUS == "PENDING")\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('addFieldButton("ACTION", "审批", approveAction)', result)
|
||||
self.assertIn('setFieldVisible("ACTION", item.STATUS == "PENDING")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_getValue_plus_setFilter(self):
|
||||
src = (
|
||||
'def projId = group.getField("PROJ_ID").getValue()\n'
|
||||
'group.getField("CONTRACT").getContainerDataSource().setFilter("PROJ_ID=" + projId)\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldValue("PROJ_ID")', result)
|
||||
self.assertIn('setFieldDataFilter("CONTRACT", "PROJ_ID=" + projId)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_group_setReadOnly_plus_field(self):
|
||||
src = (
|
||||
'group.setReadOnly(true)\n'
|
||||
'group.getField("REMARK").setReadOnly(false)\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setGroupReadOnly(true)', result)
|
||||
self.assertIn('setFieldReadOnly("REMARK", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_notification_plus_getValue(self):
|
||||
src = (
|
||||
'def v = group.getField("QTY").getValue()\n'
|
||||
'if (v == null) { Notification.show("不能为空") }\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldValue("QTY")', result)
|
||||
self.assertIn('showToast("不能为空")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_complex_multi_rule(self):
|
||||
src = '''
|
||||
def projType = group.getField("PROJ_TYPE").getValue()
|
||||
if (projType == "BIG") {
|
||||
group.getField("SAFETY_MGR").setVisible(true)
|
||||
group.getField("SAFETY_MGR").setRequired(true)
|
||||
group.getField("SAFETY_MGR").getContainerDataSource().setFilter("ROLE=SAFETY")
|
||||
} else {
|
||||
group.getField("SAFETY_MGR").setVisible(false)
|
||||
group.getField("SAFETY_MGR").setRequired(false)
|
||||
}
|
||||
group.getField("PROJ_NO").setCaption("项目编号")
|
||||
group.getField("SUBMIT_BTN").addButton("提交", submitAction)
|
||||
Notification.show("类型已切换")
|
||||
'''
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldValue("PROJ_TYPE")', result)
|
||||
self.assertIn('setFieldVisible("SAFETY_MGR", true)', result)
|
||||
self.assertIn('setFieldRequired("SAFETY_MGR", true)', result)
|
||||
self.assertIn('setFieldDataFilter("SAFETY_MGR", "ROLE=SAFETY")', result)
|
||||
self.assertIn('setFieldCaption("PROJ_NO", "项目编号")', result)
|
||||
self.assertIn('addFieldButton("SUBMIT_BTN", "提交", submitAction)', result)
|
||||
self.assertIn('showToast("类型已切换")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestPartialLabel(unittest.TestCase):
|
||||
"""PARTIAL:部分改写,仍有 S3 残留"""
|
||||
|
||||
def test_unknown_method_causes_partial(self):
|
||||
src = (
|
||||
'group.getField("X").setVisible(true)\n'
|
||||
'group.getField("Y").setStyleName("highlight")\n' # 不在规则表
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "PARTIAL")
|
||||
# 已知规则部分已改写
|
||||
self.assertIn('setFieldVisible("X", true)', result)
|
||||
|
||||
|
||||
class TestRewriteDetails(unittest.TestCase):
|
||||
"""改写明细验证"""
|
||||
|
||||
def test_details_contain_rule_name(self):
|
||||
src = 'group.getField("X").setVisible(true)'
|
||||
_, details, _ = rewrite_script(src)
|
||||
rule_names = [d.rule_name for d in details]
|
||||
self.assertIn("setVisible", rule_names)
|
||||
|
||||
def test_hard_details_contain_reason(self):
|
||||
src = 'def w = new Window("test")'
|
||||
_, details, label = rewrite_script(src)
|
||||
self.assertEqual(label, "HARD")
|
||||
hard_details = [d for d in details if d.rule_name == "HARD_DETECTION"]
|
||||
self.assertTrue(len(hard_details) > 0)
|
||||
self.assertIn("动态创建 Vaadin 组件", hard_details[0].original)
|
||||
|
||||
def test_inline_detail_recorded(self):
|
||||
src = (
|
||||
'def f = group.getField("X")\n'
|
||||
'f.setValue("v")\n'
|
||||
)
|
||||
_, details, _ = rewrite_script(src)
|
||||
inline_rules = [d for d in details if "inline" in d.rule_name]
|
||||
self.assertTrue(len(inline_rules) > 0)
|
||||
|
||||
|
||||
class TestEdgeCases(unittest.TestCase):
|
||||
"""边界和特殊情况"""
|
||||
|
||||
def test_idempotent_s2_input(self):
|
||||
"""已是 S2 形态的脚本不会被误改"""
|
||||
src = 'setFieldVisible("X", true)\n'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "NO_S3")
|
||||
self.assertEqual(result, src)
|
||||
|
||||
def test_single_quote_field_name(self):
|
||||
src = "group.getField('AMOUNT').getValue()"
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn("getFieldValue('AMOUNT')", result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_boolean_arg(self):
|
||||
src = 'group.getField("F").setVisible(false)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("F", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_removeAllItems_alone(self):
|
||||
src = 'group.getField("LIST").getContainerDataSource().removeAllItems()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('clearFieldData("LIST")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_only_whitespace(self):
|
||||
src = " \n\t\n "
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "NO_S3")
|
||||
|
||||
def test_comment_only(self):
|
||||
src = "// 这是一段注释\n// 没有实质代码\n"
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "NO_S3")
|
||||
|
||||
def test_hard_new_vertical_layout(self):
|
||||
src = 'def vl = new VerticalLayout()'
|
||||
_, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "HARD")
|
||||
|
||||
def test_hard_new_horizontal_layout(self):
|
||||
src = 'def hl = new HorizontalLayout()'
|
||||
_, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "HARD")
|
||||
|
||||
def test_setReadOnly_field_no_group_remains(self):
|
||||
src = 'group.getField("F").setReadOnly(true)'
|
||||
result, _, _ = rewrite_script(src)
|
||||
self.assertNotIn('group.getField', result)
|
||||
self.assertNotIn('.setReadOnly(', result)
|
||||
|
||||
def test_mixed_inline_multi_var(self):
|
||||
"""两个不同字段句柄变量同时内联"""
|
||||
src = (
|
||||
'def fA = group.getField("A")\n'
|
||||
'def fB = group.getField("B")\n'
|
||||
'fA.setVisible(true)\n'
|
||||
'fB.setEnabled(false)\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("A", true)', result)
|
||||
self.assertIn('setFieldEnabled("B", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestSafeNavigation(unittest.TestCase):
|
||||
"""真实库迭代: Groovy 安全导航 ?. 在所有字段/组规则上等价于 ."""
|
||||
|
||||
def test_safenav_getValue(self):
|
||||
src = 'def v = group.getField("AMOUNT")?.getValue()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldValue("AMOUNT")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_safenav_setVisible(self):
|
||||
src = 'group.getField("NOTE")?.setVisible(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("NOTE", true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_safenav_removeAllItems(self):
|
||||
src = 'group.getField("LIST")?.removeAllItems()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('clearFieldData("LIST")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_safenav_getContainerDataSource(self):
|
||||
src = 'def ds = group.getField("DEPT")?.getContainerDataSource()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('getFieldDataSource("DEPT")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_safenav_group_setReadOnly(self):
|
||||
src = 'group?.setReadOnly(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setGroupReadOnly(true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestInlineEdgeCases(unittest.TestCase):
|
||||
"""真实库迭代: 内联容忍尾随分号 / 行尾注释 / ?. 引用"""
|
||||
|
||||
def test_inline_with_semicolon(self):
|
||||
src = (
|
||||
'def f = group.getField("ISSHARE");\n'
|
||||
'f?.setReadOnly(true);\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldReadOnly("ISSHARE", true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_inline_with_trailing_comment(self):
|
||||
src = (
|
||||
'def eligibility = group.getField("ELIGIBILITY");//状态\n'
|
||||
'eligibility?.setVisible(false)\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("ELIGIBILITY", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_inline_safenav_reference(self):
|
||||
src = (
|
||||
'def fld = group.getField("CITY")\n'
|
||||
'fld?.setEnabled(false)\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldEnabled("CITY", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_inline_value_use_not_clobbered(self):
|
||||
"""变量当普通值用(var == null)不应被句柄内联误伤"""
|
||||
src = (
|
||||
'def f = group.getField("X")\n'
|
||||
'f?.setVisible(true)\n'
|
||||
'if (somethingElse == null) { doStuff() }\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldVisible("X", true)', result)
|
||||
self.assertIn('somethingElse == null', result)
|
||||
|
||||
|
||||
class TestSubTableButtons(unittest.TestCase):
|
||||
"""真实库迭代: 子表动作按钮 / 子表按钮显隐"""
|
||||
|
||||
def test_addSubTableButton(self):
|
||||
src = 'group.getField("GOODSDETAIL")?.addButton(group.getField("SELECT"),0);'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('addSubTableButton("GOODSDETAIL", "SELECT", 0)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
self.assertNotIn('group.getField', result)
|
||||
|
||||
def test_addFieldButton_still_works(self):
|
||||
"""字段内联按钮(首参字符串)仍走 addFieldButton"""
|
||||
src = 'group.getField("ACTION")?.addButton("审批", approveAction)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('addFieldButton("ACTION", "审批", approveAction)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_showAddButton(self):
|
||||
src = 'group.getField("PAIDS")?.showAddButton(false)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setSubTableAddButtonVisible("PAIDS", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_showDeleteButton(self):
|
||||
src = 'group.getField("SUB_PROJECTS")?.showDeleteButton(false)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setSubTableDeleteButtonVisible("SUB_PROJECTS", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_getModifyButton_setVisible(self):
|
||||
src = 'group.getField("PAIDS")?.getModifyButton().setVisible(false);'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setSubTableModifyButtonVisible("PAIDS", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_getDetailButton_setVisible(self):
|
||||
src = 'group.getField("PAIDS")?.getDetailButton().setVisible(false);'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setSubTableDetailButtonVisible("PAIDS", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestNewFieldVerbs(unittest.TestCase):
|
||||
"""真实库迭代: 新增字段动词映射"""
|
||||
|
||||
def test_setRequiredError(self):
|
||||
src = 'group.getField("PROJECTCODE")?.setRequiredError("工程编码为必填项!")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldRequiredError("PROJECTCODE", "工程编码为必填项!")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setViewWithoutEditor(self):
|
||||
src = 'group.getField("CONTENT")?.setViewWithoutEditor(true)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldViewOnly("CONTENT", true)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_focus(self):
|
||||
src = 'group.getField("NAME")?.focus()'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('focusField("NAME")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setWidth(self):
|
||||
src = 'group.getField("NAME").setWidth("200px")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldWidth("NAME", "200px")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setHeight(self):
|
||||
src = 'group.getField("NOTE").setHeight("100px")'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldHeight("NOTE", "100px")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_reload(self):
|
||||
src = 'group.getField("UNITID")?.reload();'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('reloadField("UNITID")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setConvertedValue(self):
|
||||
src = 'group.getField("YEAR")?.setConvertedValue(currentYear)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldConvertedValue("YEAR", currentYear)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setNullSelectionItemId(self):
|
||||
src = 'group.getField("YEAR")?.setNullSelectionItemId(nullitem)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldNullSelection("YEAR", nullitem)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_removeItem(self):
|
||||
src = 'group.getField("STATE")?.removeItem(3)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('removeFieldItem("STATE", 3)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_propertyDataSource_setReadOnly(self):
|
||||
src = 'group.getField("VOUCHER_ID")?.getPropertyDataSource().setReadOnly(false);'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldReadOnly("VOUCHER_ID", false)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestBalancedSetFilter(unittest.TestCase):
|
||||
"""真实库迭代: setFilter / setFilterMap 直接挂句柄,含嵌套参数"""
|
||||
|
||||
def test_setFilter_simple_var(self):
|
||||
src = 'group.getField("JOBSTATUSS")?.setFilter(searchMap)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldFilter("JOBSTATUSS", searchMap)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setFilter_nested_map_literal(self):
|
||||
src = 'group.getField("UNITTYPE").setFilter(["EXTENDATTRIBUTEONE" : 0, "SYS_ENUMERATETYPE_ID" : "UNITTYPE"])'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn(
|
||||
'setFieldFilter("UNITTYPE", ["EXTENDATTRIBUTEONE" : 0, "SYS_ENUMERATETYPE_ID" : "UNITTYPE"])',
|
||||
result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setFilter_nested_func_call(self):
|
||||
src = 'group.getField("SCHEMEITEM").setFilter(["USERID":GetDefaultValueFunction.getCurrentUserId()])'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn(
|
||||
'setFieldFilter("SCHEMEITEM", ["USERID":GetDefaultValueFunction.getCurrentUserId()])',
|
||||
result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_setFilterMap(self):
|
||||
src = 'group.getField("UNITID").setFilterMap(map)'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('setFieldFilterMap("UNITID", map)', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestOptionPopulation(unittest.TestCase):
|
||||
"""真实库迭代: 下拉选项填充 idiom → addFieldOption"""
|
||||
|
||||
def test_inline_datasource_then_option(self):
|
||||
src = (
|
||||
'group.getField("OVERTIMETYPE")?.removeAllItems();\n'
|
||||
'def icType = group.getField("OVERTIMETYPE")?.getContainerDataSource();\n'
|
||||
'icType?.addItem("请选择").getItemProperty("des").setValue("请选择");\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('clearFieldData("OVERTIMETYPE")', result)
|
||||
self.assertIn('addFieldOption("OVERTIMETYPE", "请选择", "请选择")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_option_with_func_value(self):
|
||||
src = (
|
||||
'def ic = group.getField("X")?.getContainerDataSource();\n'
|
||||
'ic?.addItem(list.get_Value("CODEVALUE")).getItemProperty("des").setValue(list.get_Value("CODEDES"));\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn(
|
||||
'addFieldOption("X", list.get_Value("CODEVALUE"), list.get_Value("CODEDES"))',
|
||||
result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_option_full_safenav_chain(self):
|
||||
src = (
|
||||
'def ic = group.getField("PROOFRESULT")?.getContainerDataSource();\n'
|
||||
'ic?.addItem("通过")?.getItemProperty("des")?.setValue("通过");\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('addFieldOption("PROOFRESULT", "通过", "通过")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
def test_option_via_handle_var_with_comment(self):
|
||||
src = (
|
||||
'def eligibility = group.getField("ELIGIBILITY");//状态\n'
|
||||
'eligibility?.removeAllItems();\n'
|
||||
'def ic = eligibility?.getContainerDataSource();\n'
|
||||
'ic?.addItem(2).getItemProperty("des").setValue("未评审");\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn('clearFieldData("ELIGIBILITY")', result)
|
||||
self.assertIn('addFieldOption("ELIGIBILITY", 2, "未评审")', result)
|
||||
self.assertEqual(label, "FULL_AUTO")
|
||||
|
||||
|
||||
class TestHonestBoundary(unittest.TestCase):
|
||||
"""真实库迭代: 深层 Vaadin 组件访问保持 PARTIAL,不错改"""
|
||||
|
||||
def test_comboBox_widget_access_stays_partial(self):
|
||||
src = 'group.getField("CHECKMONORQUA")?.comboBox.setValue(value);'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "PARTIAL")
|
||||
|
||||
def test_table_widget_access_stays_partial(self):
|
||||
src = 'def cols = group.getField("MATERIALDETAILS").table.getVisibleColumns();'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "PARTIAL")
|
||||
|
||||
def test_addButton_nonliteral_first_arg_stays_partial(self):
|
||||
"""addButton(field, 0) 首参为非 getField 变量,无法安全解析字段名"""
|
||||
src = 'group.getField("LISTS").addButton(field, 0);'
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertEqual(label, "PARTIAL")
|
||||
|
||||
def test_dynamic_component_in_chain_stays_partial(self):
|
||||
src = (
|
||||
'group.getField("X")?.parent?.parent?.addComponent('
|
||||
'new CaptionLabel("关联收集工程"),"COL")\n'
|
||||
)
|
||||
result, _, label = rewrite_script(src)
|
||||
self.assertIn(label, ("PARTIAL", "HARD"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
Reference in New Issue
Block a user