Commit 64a92b2e by 张立顺

feat 自测功能修复

1 parent 86eaeb13
...@@ -22,7 +22,7 @@ export const RECRUIT_MENU_ENABLED = false ...@@ -22,7 +22,7 @@ export const RECRUIT_MENU_ENABLED = false
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2; let index = 1;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = getSystemInfoSync(); const systemInfo = getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
# DEVLOG — packageDynamicForm # DEVLOG — packageDynamicForm
## 2026-07-13 — 门店日报「岚图 or 其他品牌」显隐修复
- **根因**:Excel 转换 `parse_brand_restriction` 对「岚图,其他品牌」误设 `brandId: [3067]`,与 `filterBrandId` 在 `brandSpec` 中 AND 组合,导致仅其他品牌门店无法见 F2-37/F2-57/F2-58 及驻店 F1-11-1 等。
- **修复**:改为 `brandId: []` + `filterBrandId: 五界`;重生成 `schema-store-daily-v2.1.1` 与 `schema-staff-daily-v2.1.1`。
- **单测**:`IT-V211-STORE-007`~`013`、`IT-V211-STAFF-006`~`008`、`IT-STORE-TPL-008/009`、`IT-STAFF-TPL-009`。
- **文档**:`excel转js模板配置说明` §3.3 or/and 映射;`staff-template-features`、`store-template-features`。
## 2026-07-09 — 门店日报 V2.1.1 新增 F2-14-12 ## 2026-07-09 — 门店日报 V2.1.1 新增 F2-14-12
- **模版**:`schema-store-daily-v2.1.1.js/json` 在 F2-14 子表单新增 `F2-14-12`「今日厂家权益有效转介绍」(延保 2.3.1/2.3.2,integer ≥0,与售前 `F2-11-9` 对称)。 - **模版**:`schema-store-daily-v2.1.1.js/json` 在 F2-14 子表单新增 `F2-14-12`「今日厂家权益有效转介绍」(延保 2.3.1/2.3.2,integer ≥0,与售前 `F2-11-9` 对称)。
......
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
### 相关单测 ### 相关单测
- `IT-STAFF-TPL-001`~`008` — `staff-template-schema.test.mjs`(V2.1.1) - `IT-STAFF-TPL-001`~`009` — `staff-template-schema.test.mjs`(V2.1.1)
- `IT-V211-STAFF-006`~`008` — `v211-template-visibility.test.mjs`(岚图 or 其他品牌)
- `IT-V211-*` — `v211-template-visibility.test.mjs` - `IT-V211-*` — `v211-template-visibility.test.mjs`
- `IT-LOADER-001` ~ `003` — `staffDailyFormLoader` - `IT-LOADER-001` ~ `003` — `staffDailyFormLoader`
- `IT-STAFF-API-SWITCH-*` — `staffDailyReportAdapters` - `IT-STAFF-API-SWITCH-*` — `staffDailyReportAdapters`
...@@ -144,7 +145,8 @@ ...@@ -144,7 +145,8 @@
- `IT-STORE-ECHO-*` — 门店 jsonContent 回显 - `IT-STORE-ECHO-*` — 门店 jsonContent 回显
- `IT-APP-ORDER-*` / `IT-APP-CV-*` / `IT-SUBFORM-MAX-*` — 提交顺序、childrenValue、20 行上限 - `IT-APP-ORDER-*` / `IT-APP-CV-*` / `IT-SUBFORM-MAX-*` — 提交顺序、childrenValue、20 行上限
- `IT-STORE-PENDING-*` — `storeMonthlyPendingCount.test.mjs`(F2-24 待邀约数 adapter/门面/shouldFetch) - `IT-STORE-PENDING-*` — `storeMonthlyPendingCount.test.mjs`(F2-24 待邀约数 adapter/门面/shouldFetch)
- `IT-STORE-TPL-001`~`006` — `store-template-schema.test.mjs`(V2.1.1) - `IT-STORE-TPL-001`~`009` — `store-template-schema.test.mjs`(V2.1.1)
- `IT-V211-STORE-007`~`013` — `v211-template-visibility.test.mjs`(岚图 or 其他品牌)
- `IT-V211-*` — `v211-template-visibility.test.mjs` - `IT-V211-*` — `v211-template-visibility.test.mjs`
- `IT-STORE-STAFF-COUNT-*` — `store-staff-count.test.mjs` - `IT-STORE-STAFF-COUNT-*` — `store-staff-count.test.mjs`
......
...@@ -155,7 +155,7 @@ flowchart TD ...@@ -155,7 +155,7 @@ flowchart TD
**岚图 F1-10 子字段**:延保售前/售后/未触客返店(F1-10-3~5)。 **岚图 F1-10 子字段**:延保售前/售后/未触客返店(F1-10-3~5)。
**其他品牌 F1-11 子字段(12 项)**:轻改售前/售后/交付引荐等;延保售前/售后/未触客;权益售前/售后/未触客及扩展指标。 **其他品牌 F1-11 子字段(12 项)**:轻改售前/售后/交付引荐等;延保售前/售后/未触客;权益售前/售后/未触客及扩展指标。其中 F1-11-1/9/2 等轻改子项为「岚图 or 其他品牌」:`brandId: []` + `filterBrandId: 五界`。
--- ---
...@@ -180,11 +180,14 @@ flowchart TD ...@@ -180,11 +180,14 @@ flowchart TD
| F2-93 | divider | 轻改 | qgCode | | F2-93 | divider | 轻改 | qgCode |
| F2-16/17 | numberInput | 鸿蒙店总售后指标 | 五界 + 轻改 | | F2-16/17 | numberInput | 鸿蒙店总售后指标 | 五界 + 轻改 |
| F2-18~22 | numberInput | 各界店总交付数 | 单品牌 brandId + 轻改 | | F2-18~22 | numberInput | 各界店总交付数 | 单品牌 brandId + 轻改 |
| F2-23~25 | numberInput | 其他品牌轻改指标 | filterBrandId | | F2-37 | numberInput | 其他品牌店总交付数(轻改) | 岚图 or 其他品牌:`brandId: []` + `filterBrandId: 五界` |
| F2-23~25 | numberInput | 其他品牌轻改指标 | 同上 |
| F2-24 | numberInput | 本月待邀约 | API 回填 monthly.pending.count | | F2-24 | numberInput | 本月待邀约 | API 回填 monthly.pending.count |
| F2-26 | subform | 销售部(轻改) | 轻改 sceneList | | F2-26 | subform | 问界鸿蒙销售部(轻改) | 五界 brandId |
| F2-27 | subform | 交付部(轻改) | 轻改 sceneList | | F2-27 | subform | 问界鸿蒙交付部(轻改) | 五界 brandId |
| F2-28 | subform | 售后部(轻改) | 轻改 sceneList | | F2-28 | subform | 问界鸿蒙售后部(轻改) | 五界 brandId |
| F2-57 | subform | 其他品牌销售部(轻改) | 岚图 or 其他品牌 |
| F2-58 | subform | 其他品牌售后部(轻改) | 岚图 or 其他品牌 |
--- ---
......
...@@ -116,11 +116,23 @@ Excel 显隐列中的场景 token 会映射为数字码(与配置中心注释 ...@@ -116,11 +116,23 @@ Excel 显隐列中的场景 token 会映射为数字码(与配置中心注释
|------------|------| |------------|------|
| 不限 / 空 | `brandId: []`,无 `filterBrandId` | | 不限 / 空 | `brandId: []`,无 `filterBrandId` |
| 仅「其他品牌」 | `brandId: []`,`filterBrandId: [3454, 3503, 3458, 3574, 3502, 3067]` | | 仅「其他品牌」 | `brandId: []`,`filterBrandId: [3454, 3503, 3458, 3574, 3502, 3067]` |
| 「岚图」+「其他品牌」 | `brandId: [3067]`,`filterBrandId: [五界 ID]`(隐藏仅五界经营的门店) | | 「岚图」+「其他品牌」 | `brandId: []`,`filterBrandId: [五界 ID]`(OR 语义:岚图或其它品牌任一即显示;隐藏仅五界经营的门店) |
| 具体品牌名 | `brandId: [对应 ID]` | | 具体品牌名 | `brandId: [对应 ID]` |
运行时 `filterBrandId` 含义:商户经营品牌**全部**落在列表内时隐藏该字段(见 [staff-template-features.md](./staff-template-features.md))。 运行时 `filterBrandId` 含义:商户经营品牌**全部**落在列表内时隐藏该字段(见 [staff-template-features.md](./staff-template-features.md))。
### 3.3 显隐文案 or / and 与运行时
Excel 显隐如 `F2-37`:`[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3]`:
| 连接词 | 含义 | schema / 运行时 |
|--------|------|-----------------|
| **or**(品牌内) | 岚图或其它品牌有其一 | `brandId: []` + `filterBrandId: 五界`(有品牌不在五界内即显示) |
| **or**(场景内) | 1.1/1.2/1.3 有其一 | `baseSceneCode: [100101,100102,100103]` + `matchesBaseSceneCode` 用 `.some()` |
| **and**(两段之间) | 品牌条件且场景条件都要满足 | `brandSpec` **且** `baseSceneSpec` 均通过([`visibility/specs/index.js`](../form-engine/visibility/specs/index.js)) |
驻店 F1-11-1/9/2 与门店 F2-37、F2-23~25、F2-57/58 共用上述「岚图 or 其他品牌」编码。
--- ---
## 4. 生成流程(脚本内部) ## 4. 生成流程(脚本内部)
...@@ -265,7 +277,7 @@ node --test packageDynamicForm/tests/staff-template-schema.test.mjs packageDynam ...@@ -265,7 +277,7 @@ node --test packageDynamicForm/tests/staff-template-schema.test.mjs packageDynam
1. 将生成的 JS 粘贴配置中心或切换 mock 指向新 fixture。 1. 将生成的 JS 粘贴配置中心或切换 mock 指向新 fixture。
2. 轻改场景(`100101`):问界门店应见 F1-12/F1-13、品牌 group 内轻改子字段;不见权益字段。 2. 轻改场景(`100101`):问界门店应见 F1-12/F1-13、品牌 group 内轻改子字段;不见权益字段。
3. 权益场景(`110101`):仅见 F1-11 广联权益等 `baseSceneCode` 含 110101 的字段(且 F1-11 需满足「其他品牌」`filterBrandId` 规则)。 3. 权益场景(`110101`):仅见 F1-11 广联权益等 `baseSceneCode` 含 110101 的字段(且 F1-11 需满足「其他品牌」`filterBrandId` 规则)。
4. 延保场景(`110201`):见延保子字段;不见轻改/权益字段。 4. 轻改场景仅其他品牌门店:应见 F2-57/F2-58(岚图 or 其他品牌 subform),不见 F2-26/27/28。
--- ---
......
...@@ -57,7 +57,8 @@ ...@@ -57,7 +57,8 @@
| group `rules` / `childrenRules` | `schema-normalizer` → `normalizeStaticGroupChildren` | `childrenRules` 合并进子字段 `rules`(min/integer 等) | | group `rules` / `childrenRules` | `schema-normalizer` → `normalizeStaticGroupChildren` | `childrenRules` 合并进子字段 `rules`(min/integer 等) |
| 子字段 `sceneType` / `baseSceneCode` | `isFieldVisible` → `matchesBaseSceneCode` | 轻改码 vs 延保码分行展示 | | 子字段 `sceneType` / `baseSceneCode` | `isFieldVisible` → `matchesBaseSceneCode` | 轻改码 vs 延保码分行展示 |
| group `brandId` | `hasIntersection(brandId, ctx.brandIds)` | 无该品牌则不展示整块 group | | group `brandId` | `hasIntersection(brandId, ctx.brandIds)` | 无该品牌则不展示整块 group |
| F1-11 `filterBrandId` | `shouldHideByFilterBrandId` | 经营品牌全部在列表内时隐藏「其他品牌」 | | F1-11 `filterBrandId` | `shouldHideByFilterBrandId` | 经营品牌全部在列表内时隐藏「其他品牌」整块 group |
| F1-11-1/9/2 等轻改子字段 | `brandId: []` + `filterBrandId: 五界` | Excel「岚图 or 其他品牌」:岚图或其它品牌任一即显示;纯五界隐藏 |
| 详情回显 | `hasDetailEcho` + `echoSubformKeys`(含 group) | 回显白名单内跳过 brand/filter 限制;**仍按** `sceneList` ↔ `baseSceneCode` 过滤;static group 不因 echo 回退全量子字段 | | 详情回显 | `hasDetailEcho` + `echoSubformKeys`(含 group) | 回显白名单内跳过 brand/filter 限制;**仍按** `sceneList` ↔ `baseSceneCode` 过滤;static group 不因 echo 回退全量子字段 |
| 保存 | `buildDynamicSavePayload` / App jsonContent | 顶层 value;无 subform;**lists 仅可见**;**jsonContent 含出勤等动态规则隐藏的块**;**不含**场景/brand 级隐藏块与纯模板 `0`(见 `json-content-persist.js`) | | 保存 | `buildDynamicSavePayload` / App jsonContent | 顶层 value;无 subform;**lists 仅可见**;**jsonContent 含出勤等动态规则隐藏的块**;**不含**场景/brand 级隐藏块与纯模板 `0`(见 `json-content-persist.js`) |
...@@ -79,7 +80,8 @@ ...@@ -79,7 +80,8 @@
|---------|------| |---------|------|
| IT-ENG-001、IT-ENG-014 | `form-engine.test.mjs` — 出勤 gate、F1-11 filterBrandId | | IT-ENG-001、IT-ENG-014 | `form-engine.test.mjs` — 出勤 gate、F1-11 filterBrandId |
| IT-ENG-007d | `radio-value` 中文/legacy 归一 | | IT-ENG-007d | `radio-value` 中文/legacy 归一 |
| IT-STAFF-TPL-001~008 | `staff-template-schema.test.mjs`(V2.1.1 fixture) | | IT-STAFF-TPL-001~009 | `staff-template-schema.test.mjs`(V2.1.1 fixture) |
| IT-V211-STAFF-006~008 | `v211-template-visibility.test.mjs`(岚图 or 其他品牌子字段) |
| IT-V211-* | `v211-template-visibility.test.mjs` | | IT-V211-* | `v211-template-visibility.test.mjs` |
| IT-LOADER-001~003 | `staffDailyFormLoader.test.mjs` | | IT-LOADER-001~003 | `staffDailyFormLoader.test.mjs` |
......
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
| 售前 subform | F2-9、F2-10、F2-11 | subform | 鸿蒙 / 岚图 / 其他品牌 | | 售前 subform | F2-9、F2-10、F2-11 | subform | 鸿蒙 / 岚图 / 其他品牌 |
| 售后 subform | F2-12、F2-13、F2-14 | subform | 同上;F2-14 含 `F2-14-12` 今日厂家权益有效转介绍(延保 2.3.1/2.3.2,与售前 `F2-11-9` 对称) | | 售后 subform | F2-12、F2-13、F2-14 | subform | 同上;F2-14 含 `F2-14-12` 今日厂家权益有效转介绍(延保 2.3.1/2.3.2,与售前 `F2-11-9` 对称) |
| 轻改标题 | F2-93 | divider | `qgCode` | | 轻改标题 | F2-93 | divider | `qgCode` |
| 轻改指标 | F2-16~F2-25 | numberInput | 五界交付数分品牌;F2-23~25 `filterBrandId` | | 轻改指标 | F2-16~F2-25、F2-37 | numberInput | 五界交付数分品牌;F2-23~25、**F2-37** 为「岚图 or 其他品牌」:`brandId: []` + `filterBrandId: 五界` |
| 轻改 subform | F2-26、F2-27、F2-28 | subform | 销售 / 交付 / 售后 | | 轻改 subform | F2-26、F2-27、F2-28 | subform | 五界销售 / 交付 / 售后 |
| 岚图/其他品牌轻改 subform | F2-57、F2-58 | subform | `brandId: []` + `filterBrandId: 五界`;岚图或其它品牌门店可见,纯五界隐藏 |
--- ---
...@@ -84,8 +85,8 @@ ...@@ -84,8 +85,8 @@
|---------|------| |---------|------|
| IT-STORE-DIV-001~007 | `form-engine.test.mjs` | | IT-STORE-DIV-001~007 | `form-engine.test.mjs` |
| IT-STORE-ENG-003/005 | `form-engine.test.mjs` | | IT-STORE-ENG-003/005 | `form-engine.test.mjs` |
| IT-STORE-TPL-001~007 | `store-template-schema.test.mjs`(V2.1.1 fixture) | | IT-STORE-TPL-001~009 | `store-template-schema.test.mjs`(V2.1.1 fixture) |
| IT-V211-* | `v211-template-visibility.test.mjs` | | IT-V211-STORE-007~013 | `v211-template-visibility.test.mjs`(岚图 or 其他品牌) |
| IT-STORE-STAFF-COUNT-001~005 | `store-staff-count.test.mjs` | | IT-STORE-STAFF-COUNT-001~005 | `store-staff-count.test.mjs` |
| IT-STORE-PENDING-* | `storeMonthlyPendingCount.test.mjs` | | IT-STORE-PENDING-* | `storeMonthlyPendingCount.test.mjs` |
| IT-STORE-FILTER-001/002 | `form-engine.test.mjs` | | IT-STORE-FILTER-001/002 | `form-engine.test.mjs` |
......
...@@ -708,7 +708,7 @@ ...@@ -708,7 +708,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[场景 包含 1.1 or 1.2 or 1.3] and [门店经营品牌 包含 岚图 or 其他品牌] 则 [显示] //[场景 包含 1.1 or 1.2 or 1.3] and [门店经营品牌 包含 岚图 or 其他品牌] 则 [显示]
value: 0, value: 0,
...@@ -726,7 +726,7 @@ ...@@ -726,7 +726,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[场景 包含 1.1 or 1.2 or 1.3] and [门店经营品牌 包含 岚图 or 其他品牌] 则 [显示] //[场景 包含 1.1 or 1.2 or 1.3] and [门店经营品牌 包含 岚图 or 其他品牌] 则 [显示]
value: 0, value: 0,
...@@ -744,7 +744,7 @@ ...@@ -744,7 +744,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[场景 包含 1.1 or 1.2 or 1.3] and [门店经营品牌 包含 岚图 or 其他品牌] 则 [显示] //[场景 包含 1.1 or 1.2 or 1.3] and [门店经营品牌 包含 岚图 or 其他品牌] 则 [显示]
value: 0, value: 0,
......
...@@ -959,9 +959,7 @@ ...@@ -959,9 +959,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -989,9 +987,7 @@ ...@@ -989,9 +987,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -1019,9 +1015,7 @@ ...@@ -1019,9 +1015,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
......
...@@ -1625,7 +1625,7 @@ ...@@ -1625,7 +1625,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示] //[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示]
value: 0, value: 0,
...@@ -1728,7 +1728,7 @@ ...@@ -1728,7 +1728,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示] //[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示]
value: 0, value: 0,
...@@ -1746,7 +1746,7 @@ ...@@ -1746,7 +1746,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示] //[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示]
value: 0, value: 0,
...@@ -1764,7 +1764,7 @@ ...@@ -1764,7 +1764,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示] //[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示]
value: 0, value: 0,
...@@ -2099,7 +2099,7 @@ ...@@ -2099,7 +2099,7 @@
type: 'subform', type: 'subform',
required: false, required: false,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示] //[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示]
rules: {}, rules: {},
...@@ -2122,7 +2122,7 @@ ...@@ -2122,7 +2122,7 @@
type: 'select', type: 'select',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
options: [], options: [],
optionsKey: '4sStaffList', optionsKey: '4sStaffList',
...@@ -2137,7 +2137,7 @@ ...@@ -2137,7 +2137,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2154,7 +2154,7 @@ ...@@ -2154,7 +2154,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2171,7 +2171,7 @@ ...@@ -2171,7 +2171,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2188,7 +2188,7 @@ ...@@ -2188,7 +2188,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2205,7 +2205,7 @@ ...@@ -2205,7 +2205,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2222,7 +2222,7 @@ ...@@ -2222,7 +2222,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2239,7 +2239,7 @@ ...@@ -2239,7 +2239,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2259,7 +2259,7 @@ ...@@ -2259,7 +2259,7 @@
type: 'subform', type: 'subform',
required: false, required: false,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
//[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示] //[门店经营品牌 包含 岚图 or 其他品牌] and [场景 包含 1.1 or 1.2 or 1.3] 则 [显示]
rules: {}, rules: {},
...@@ -2278,7 +2278,7 @@ ...@@ -2278,7 +2278,7 @@
type: 'select', type: 'select',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
options: [], options: [],
optionsKey: '4sStaffList', optionsKey: '4sStaffList',
...@@ -2293,7 +2293,7 @@ ...@@ -2293,7 +2293,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2310,7 +2310,7 @@ ...@@ -2310,7 +2310,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
...@@ -2327,7 +2327,7 @@ ...@@ -2327,7 +2327,7 @@
type: 'numberInput', type: 'numberInput',
required: true, required: true,
sceneType: [1], sceneType: [1],
brandId: [3067], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
value: 0, value: 0,
rules: { rules: {
......
...@@ -2481,9 +2481,7 @@ ...@@ -2481,9 +2481,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -2626,9 +2624,7 @@ ...@@ -2626,9 +2624,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -2656,9 +2652,7 @@ ...@@ -2656,9 +2652,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -2686,9 +2680,7 @@ ...@@ -2686,9 +2680,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3281,9 +3273,7 @@ ...@@ -3281,9 +3273,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3308,9 +3298,7 @@ ...@@ -3308,9 +3298,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3336,9 +3324,7 @@ ...@@ -3336,9 +3324,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3366,9 +3352,7 @@ ...@@ -3366,9 +3352,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3396,9 +3380,7 @@ ...@@ -3396,9 +3380,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3426,9 +3408,7 @@ ...@@ -3426,9 +3408,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3456,9 +3436,7 @@ ...@@ -3456,9 +3436,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3486,9 +3464,7 @@ ...@@ -3486,9 +3464,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3516,9 +3492,7 @@ ...@@ -3516,9 +3492,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3579,9 +3553,7 @@ ...@@ -3579,9 +3553,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3606,9 +3578,7 @@ ...@@ -3606,9 +3578,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3634,9 +3604,7 @@ ...@@ -3634,9 +3604,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3664,9 +3632,7 @@ ...@@ -3664,9 +3632,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
...@@ -3694,9 +3660,7 @@ ...@@ -3694,9 +3660,7 @@
"sceneType": [ "sceneType": [
1 1
], ],
"brandId": [ "brandId": [],
3067
],
"baseSceneCode": [ "baseSceneCode": [
100101, 100101,
100102, 100102,
......
...@@ -263,7 +263,11 @@ def parse_scene_type(text: str) -> list[int]: ...@@ -263,7 +263,11 @@ def parse_scene_type(text: str) -> list[int]:
def parse_brand_restriction(text: str) -> tuple[list[int], list[int]]: def parse_brand_restriction(text: str) -> tuple[list[int], list[int]]:
"""返回 (brandId, filterBrandId)。""" """返回 (brandId, filterBrandId)。
「岚图,其他品牌」为 OR 语义:brandId 留空,filterBrandId 仅含五界;
运行时 brandSpec 在经营品牌全部落在五界内时隐藏,岚图或其它品牌任一即可显示。
"""
text = (text or '').strip() text = (text or '').strip()
if not text or text == '不限': if not text or text == '不限':
return [], [] return [], []
...@@ -275,8 +279,8 @@ def parse_brand_restriction(text: str) -> tuple[list[int], list[int]]: ...@@ -275,8 +279,8 @@ def parse_brand_restriction(text: str) -> tuple[list[int], list[int]]:
if has_other and not named: if has_other and not named:
return [], list(FILTER_BRAND_IDS) return [], list(FILTER_BRAND_IDS)
if has_other and named: if has_other and named:
# 岚图 + 其他品牌:隐藏仅五界经营的门店 # 岚图 or 其他品牌:OR 语义,仅用 filterBrandId 隐藏纯五界门店
return brand_ids, list(FIVE_REALM_IDS) return [], list(FIVE_REALM_IDS)
return brand_ids, [] return brand_ids, []
......
...@@ -125,4 +125,12 @@ describe('staff daily template V2.1.1 schema', () => { ...@@ -125,4 +125,12 @@ describe('staff daily template V2.1.1 schema', () => {
const childKeys = (group?.children || []).map(c => c.key) const childKeys = (group?.children || []).map(c => c.key)
assert.deepEqual(childKeys, ['F1-10-3', 'F1-10-4', 'F1-10-5']) assert.deepEqual(childKeys, ['F1-10-3', 'F1-10-4', 'F1-10-5'])
}) })
it('IT-STAFF-TPL-009: F1-11-1 lantu-or-other-brand uses empty brandId', () => {
const group = findFieldByKey(staffSchema.list, 'F1-11')
const child = findChildByKey(group, 'F1-11-1')
assert.deepEqual(child?.brandId, [])
assert.deepEqual(child?.filterBrandId, [3454, 3503, 3458, 3574, 3502])
assert.deepEqual(child?.baseSceneCode, [100101, 100102, 100103])
})
}) })
...@@ -121,4 +121,21 @@ describe('store daily template V2.1.1 schema', () => { ...@@ -121,4 +121,21 @@ describe('store daily template V2.1.1 schema', () => {
integer: true integer: true
}) })
}) })
it('IT-STORE-TPL-008: F2-57/F2-58 lantu-or-other-brand use empty brandId', () => {
const fiveRealmFilter = [3454, 3503, 3458, 3574, 3502]
for (const key of ['F2-57', 'F2-58']) {
const field = findFieldByKey(storeSchema.list, key)
assert.deepEqual(field?.brandId, [], key)
assert.deepEqual(field?.filterBrandId, fiveRealmFilter, key)
}
})
it('IT-STORE-TPL-009: F2-37 lantu-or-other-brand boutique metric', () => {
const field = findFieldByKey(storeSchema.list, 'F2-37')
assert.equal(field?.label, '其他品牌店总交付数')
assert.deepEqual(field?.brandId, [])
assert.deepEqual(field?.filterBrandId, [3454, 3503, 3458, 3574, 3502])
assert.deepEqual(field?.baseSceneCode, [100101, 100102, 100103])
})
}) })
...@@ -110,6 +110,24 @@ function matchesBaseSceneCode(field, ctx) { ...@@ -110,6 +110,24 @@ function matchesBaseSceneCode(field, ctx) {
return fieldCodes.some(code => merchantCodes.includes(code)) return fieldCodes.some(code => merchantCodes.includes(code))
} }
/** 与 form-engine brandSpec 契约一致 */
function matchesBrandSpec(field, ctx) {
const brandIds = ctx.brandIds || []
if (field.brandId?.length > 0) {
const hasIntersection = field.brandId.some(id => brandIds.includes(id))
if (!hasIntersection) return false
}
if (field.filterBrandId?.length > 0 && brandIds.length > 0) {
const hasOtherBrand = brandIds.some(id => !field.filterBrandId.includes(id))
if (!hasOtherBrand) return false
}
return true
}
function isFieldVisibleForTest(field, ctx) {
return matchesBaseSceneCode(field, ctx) && matchesBrandSpec(field, ctx)
}
describe('V2.1.1 visibility contract under boutique-only scene', () => { describe('V2.1.1 visibility contract under boutique-only scene', () => {
const boutiqueCtx = { const boutiqueCtx = {
baseSceneCode: 100101, baseSceneCode: 100101,
...@@ -188,3 +206,114 @@ describe('V2.1.1 visibility contract under boutique-only scene', () => { ...@@ -188,3 +206,114 @@ describe('V2.1.1 visibility contract under boutique-only scene', () => {
} }
}) })
}) })
describe('V2.1.1 store lantu-or-other-brand visibility', () => {
const boutiqueScene = [{ baseSceneCode: 100101 }]
const otherOnlyCtx = {
baseSceneCode: 100101,
brandIds: [9999],
sceneList: boutiqueScene
}
const lantuOnlyCtx = {
baseSceneCode: 100101,
brandIds: [3067],
sceneList: boutiqueScene
}
const fiveRealmOnlyCtx = {
baseSceneCode: 100101,
brandIds: [3454],
sceneList: boutiqueScene
}
const mixedCtx = {
baseSceneCode: 100101,
brandIds: [3454, 9999],
sceneList: boutiqueScene
}
it('IT-V211-STORE-007: F2-57/F2-58 visible for other-brand-only merchant', () => {
for (const key of ['F2-57', 'F2-58']) {
const field = findFieldByKey(storeSchema.list, key)
assert.equal(isFieldVisibleForTest(field, otherOnlyCtx), true, key)
}
})
it('IT-V211-STORE-008: F2-57/F2-58 visible for lantu-only merchant', () => {
for (const key of ['F2-57', 'F2-58']) {
const field = findFieldByKey(storeSchema.list, key)
assert.equal(isFieldVisibleForTest(field, lantuOnlyCtx), true, key)
}
})
it('IT-V211-STORE-009: F2-57/F2-58 hidden for five-realm-only merchant', () => {
for (const key of ['F2-57', 'F2-58']) {
const field = findFieldByKey(storeSchema.list, key)
assert.equal(isFieldVisibleForTest(field, fiveRealmOnlyCtx), false, key)
}
})
it('IT-V211-STORE-010: F2-57/F2-58 visible when five-realm plus other brand', () => {
for (const key of ['F2-57', 'F2-58']) {
const field = findFieldByKey(storeSchema.list, key)
assert.equal(isFieldVisibleForTest(field, mixedCtx), true, key)
}
})
it('IT-V211-STORE-011: F2-23 visible for other-brand-only merchant', () => {
const field = findFieldByKey(storeSchema.list, 'F2-23')
assert.equal(isFieldVisibleForTest(field, otherOnlyCtx), true)
})
it('IT-V211-STORE-012: F2-37 visible for lantu-or-other-brand with boutique scene', () => {
const field = findFieldByKey(storeSchema.list, 'F2-37')
assert.equal(isFieldVisibleForTest(field, otherOnlyCtx), true)
assert.equal(isFieldVisibleForTest(field, lantuOnlyCtx), true)
assert.equal(isFieldVisibleForTest(field, fiveRealmOnlyCtx), false)
})
it('IT-V211-STORE-013: F2-37 hidden when boutique scene missing', () => {
const field = findFieldByKey(storeSchema.list, 'F2-37')
const warrantyOnlyCtx = {
baseSceneCode: 110201,
brandIds: [9999],
sceneList: [{ baseSceneCode: 110201 }]
}
assert.equal(isFieldVisibleForTest(field, warrantyOnlyCtx), false)
})
})
describe('V2.1.1 staff lantu-or-other-brand visibility', () => {
const boutiqueScene = [{ baseSceneCode: 100101 }]
const otherOnlyCtx = {
baseSceneCode: 100101,
brandIds: [9999],
sceneList: boutiqueScene
}
const lantuOnlyCtx = {
baseSceneCode: 100101,
brandIds: [3067],
sceneList: boutiqueScene
}
const fiveRealmOnlyCtx = {
baseSceneCode: 100101,
brandIds: [3454],
sceneList: boutiqueScene
}
it('IT-V211-STAFF-006: F1-11-1 visible for other-brand-only merchant', () => {
const f111 = findFieldByKey(staffSchema.list, 'F1-11')
const child = findChildByKey(f111, 'F1-11-1')
assert.equal(isFieldVisibleForTest(child, otherOnlyCtx), true)
})
it('IT-V211-STAFF-007: F1-11-1 visible for lantu-only merchant', () => {
const f111 = findFieldByKey(staffSchema.list, 'F1-11')
const child = findChildByKey(f111, 'F1-11-1')
assert.equal(isFieldVisibleForTest(child, lantuOnlyCtx), true)
})
it('IT-V211-STAFF-008: F1-11-1 hidden for five-realm-only merchant', () => {
const f111 = findFieldByKey(staffSchema.list, 'F1-11')
const child = findChildByKey(f111, 'F1-11-1')
assert.equal(isFieldVisibleForTest(child, fiveRealmOnlyCtx), false)
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!