Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 28f9bf93
authored
Jun 11, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
df9693ee
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
197 additions
and
69 deletions
packageDynamicForm/docs/ARCHITECTURE.md
packageDynamicForm/docs/DEVLOG.md
packageDynamicForm/docs/daily-report-save-and-json.md
packageDynamicForm/docs/staff-template-features.md
packageDynamicForm/form-engine/app-daily-save.js
packageDynamicForm/form-engine/submit-adapter.js
packageDynamicForm/form-engine/values.js
packageDynamicForm/tests/form-engine.test.mjs
packageDynamicForm/tests/hidden-clear.test.mjs
packageDynamicForm/docs/ARCHITECTURE.md
View file @
28f9bf9
...
...
@@ -135,10 +135,10 @@ sequenceDiagram
**不变式(任一步破坏即可能出 bug)**
1.
**加载**
:
`buildInitialValues`
→
`buildGroupRowsCache`
→
`applyVisibilityClearing`
(
`clearHiddenFieldValues`
+
`clearHiddenSubformRowValues`
+ rebuild cache
;
`loadSchema`
/
`init`
内可能执行两次)。
1.
**加载**
:
`buildInitialValues`
→
`buildGroupRowsCache`
→
`applyVisibilityClearing`
(
`clearHiddenFieldValues`
仅清理误挂顶层的 subform 列 key;
`clearHiddenSubformRowValues`
清行内联动 hidden
;
`loadSchema`
/
`init`
内可能执行两次)。
2.
**子表单元格编辑**
:先写
`groupRowsCache`
(
`setRowFieldInCache`
/
`setNegotiationDualKeyFieldInCache`
)→
`syncValuesFromGroupCache`
→
`applyVisibilityClearing`
→
`alignGroupRowsCacheAfterHiddenClear`
(隐藏 subform 时删 cache key)。
3.
**校验**
:
`validate()`
开头
`syncSubformValuesFromCache`
(cache → values)。
4.
**保存**
:
`collectSaveValues`
/
`collectSubformStorageValues`
对 subform
**以 cache 为准**
覆盖
`values[groupKey]`
。
4.
**保存**
:
`collectSaveValues`
/
`collectSubformStorageValues`
对 subform
**以 cache 为准**
覆盖
`values[groupKey]`
;lists 用
`assembleFormListForSaveLists`
(可见),jsonContent 用
`assembleFormListForJsonContent`
(持久化隐藏值)
。
5.
**对外写入**
:Page 只调
`engine.setGroupFieldValue`
/
`setAppGroupFieldValue`
/
`mutateSubform`
;勿直接改
`getViewState().groupRowsCache`
再写回。
开发态可在
`form-engine/subform-invariants.js`
调用
`assertSubformCacheValuesAligned`
(单测与调试)。
...
...
packageDynamicForm/docs/DEVLOG.md
View file @
28f9bf9
...
...
@@ -77,6 +77,12 @@
-
**实现**
:
`normalizeDecimalInputString`
对齐精品创建前导零、孤立
`.`
、
`.5`
→
`0.5`
等;
`sanitizeDecimalInput`
/
`normalizeDecimalDisplay`
薄包装。
-
**单测**
:
`IT-NUM-DEC-006`
~
`012`
。
## 2026-06-10 — 调休/模版隐藏字段 jsonContent 持久化
-
**问题**
:驻店调休(及门店/洽谈模版级隐藏)保存时 jsonContent 仅含可见字段,再次编辑无法回显隐藏块数据。
-
**修复**
:
`clearHiddenFieldValues`
不再因模版显隐删除顶层 values;新增
`buildJsonContentPersistList`
/
`assembleFormListForJsonContent`
,lists 仍仅可见、
`jsonContent`
含仍有存储值的隐藏块。
-
**单测**
:
`IT-API-004b`
、
`IT-STAFF-SAVE-OFF-001`
、
`IT-HIDDEN-CLEAR-002`
、
`IT-NEG/STORE-SAVE-HIDDEN-001`
。
## 2026-06-04 — 周历未填报日期底部红点
-
**变更**
:
`weekCalendar`
未填报日期由右上角「空」字徽章改为日期数字下方红色圆点(
`hasDailyValue`
逻辑不变)。
...
...
packageDynamicForm/docs/daily-report-save-and-json.md
View file @
28f9bf9
...
...
@@ -28,11 +28,14 @@ sequenceDiagram
| 步骤 | 说明 | 小程序入口 |
|------|------|------------|
| 1 | 组装可见字段 + subform 行(
**children**
形态) |
[
`assembleFormListForSaveLists`
](
../form-engine/submit-adapter.js
)
→
`buildAppJsonContent`
+
`formatFieldForAppJsonContent`
|
| 2 | 用
**未序列化**
的 list 生成 lists |
`buildAppNormalizedListsFromJsonContent(JSON.stringify(list))`
|
| 3 | 同一 list →
**childrenValue**
入库 jsonContent |
`serializeFormListForAppJsonStorage(list)`
|
| 1a | 组装
**可见**
字段 + subform 行(
**children**
形态)→
`fieldDataList`
/
`subformDataList`
|
[
`assembleFormListForSaveLists`
](
../form-engine/submit-adapter.js
)
|
| 1b | 组装
**持久化**
字段(可见 + 仍有存储值的隐藏块)→
**jsonContent**
|
[
`assembleFormListForJsonContent`
](
../form-engine/submit-adapter.js
)
→
`buildJsonContentPersistList`
|
| 2 | 用
**未序列化**
的可见 list 生成 lists |
`buildAppNormalizedListsFromJsonContent(JSON.stringify(formListForLists))`
|
| 3 | 持久化 list →
**childrenValue**
入库 jsonContent |
`serializeFormListForAppJsonStorage(formListForJson)`
|
| 4 | 请求体 |
[
`buildDailyReportSaveRequest`
](
../form-engine/save-request.js
)
|
**显隐与持久化**
:模版级隐藏(调休、品牌/场景过滤等)
**仅隐藏 UI**
,不清
`values`
;
`jsonContent`
写入仍有值的隐藏块供再次编辑回显。
`fieldDataList`
/
`subformDataList`
/ 校验仍仅
**当前可见**
字段。subform 行内
`childrenShowRules`
联动切换仍清 hidden cell(如洽谈「是否成交」否)。
**HTTP 传输**
:
`fieldDataList`
/
`subformDataList`
不再作为顶层字段;由
[
`save-request.js`
](
../form-engine/save-request.js
)
组装
**`requestJson`**
(
`JSON.stringify({ fieldDataList, subformDataList? })`
,与
`jsonContent`
同级字符串)。空
`subformDataList`
在
`requestJson`
对象内
**不传**
;
`buildDailyReportSaveRequest`
返回值中的 lists 仍为数组,供 mock 回显。
**统一提交入口**
:
[
`buildAppDailyReportSubmitPayload`
](
../form-engine/app-subform-json.js
)
...
...
packageDynamicForm/docs/staff-template-features.md
View file @
28f9bf9
...
...
@@ -55,7 +55,7 @@
| group
`brandId`
|
`hasIntersection(brandId, ctx.brandIds)`
| 无该品牌则不展示整块 group |
| F1-11
`filterBrandId`
|
`shouldHideByFilterBrandId`
| 经营品牌全部在列表内时隐藏「其他品牌」 |
| 详情回显 |
`hasDetailEcho`
+
`echoSubformKeys`
(含 group) | 回显白名单内跳过 brand/filter 限制 |
| 保存 |
`buildDynamicSavePayload`
/ App jsonContent | 顶层 value;无 subform;
`jsonContent`
与
`fieldDataList`
均仅当前可见字段(调休时含 F1-1、F1-4 等无 result 字段
) |
| 保存 |
`buildDynamicSavePayload`
/ App jsonContent | 顶层 value;无 subform;
**lists 仅可见**
;
**jsonContent 含可见 + 有值的隐藏块**
(调休时品牌 group 仍入库供回显
) |
---
...
...
packageDynamicForm/form-engine/app-daily-save.js
View file @
28f9bf9
...
...
@@ -2,10 +2,16 @@
* 小程序门店/洽谈 engine 保存 payload(依赖 submit-adapter)
* @see packageDynamicForm/docs/daily-report-save-and-json.md
*/
import
{
buildAppDailyReportSubmitPayload
}
from
'./app-subform-json.js'
import
{
assembleFormListForSaveLists
}
from
'./submit-adapter.js'
import
{
buildAppNormalizedListsFromJsonContent
,
serializeFormListForAppJsonStorage
}
from
'./app-subform-json.js'
import
{
assembleFormListForSaveLists
,
assembleFormListForJsonContent
}
from
'./submit-adapter.js'
/** 门店/洽谈保存 payload:
提交顺序对齐 gl_tape mixins.submitReport
*/
/** 门店/洽谈保存 payload:
lists 仅可见字段,jsonContent 含持久化隐藏值
*/
export
function
buildAppDailySavePayload
({
reportTemplateId
,
dailyReportRecordId
,
...
...
@@ -13,8 +19,11 @@ export function buildAppDailySavePayload({
}
=
{})
{
const
visibleList
=
engine
.
getVisibleList
?.()
||
[]
const
formListForLists
=
assembleFormListForSaveLists
(
engine
,
visibleList
)
const
{
jsonContent
,
fieldDataList
,
subformDataList
}
=
buildAppDailyReportSubmitPayload
(
formListForLists
)
const
formListForJson
=
assembleFormListForJsonContent
(
engine
)
const
{
fieldDataList
,
subformDataList
}
=
buildAppNormalizedListsFromJsonContent
(
JSON
.
stringify
(
formListForLists
)
)
const
jsonContent
=
JSON
.
stringify
(
serializeFormListForAppJsonStorage
(
formListForJson
))
const
payload
=
{
reportTemplateId
,
...
...
packageDynamicForm/form-engine/submit-adapter.js
View file @
28f9bf9
...
...
@@ -3,7 +3,7 @@
* @see packageDynamicForm/docs/ARCHITECTURE.md
* @see packageDynamicForm/docs/group-repeater.md
*
* buildDynamicSavePayload:
visibleFormList + normalized 字段列表
* buildDynamicSavePayload:
lists 仅可见;jsonContent 含持久化隐藏值
* parseJsonContentDetailValues:仅从 jsonContent 解析 values;radio/select/multipleSelect 归一化
*/
import
{
getVisibleList
,
getVisibleLeafFields
}
from
'./visibility.js'
...
...
@@ -30,7 +30,6 @@ import {
mapSchemaFieldToStorageType
,
serializeFieldValueForStorage
,
buildAppNormalizedListsFromJsonContent
,
buildAppDailyReportSubmitPayload
,
buildAppJsonContent
,
serializeFormListForAppJsonStorage
,
resolveAppRowFieldEngineValue
...
...
@@ -131,6 +130,45 @@ function mergeStorageValues(saveValues = {}, engine, visibleList = []) {
return
{
...
saveValues
,
...
collectSubformStorageValues
(
engine
,
visibleList
)
}
}
function
hasStoredValue
(
value
)
{
if
(
value
===
undefined
||
value
===
null
||
value
===
''
)
{
return
false
}
if
(
Array
.
isArray
(
value
)
&&
value
.
length
===
0
)
{
return
false
}
return
true
}
/** 按 schema 顺序:可见项 + 仍有存储值的隐藏项(供 jsonContent 持久化) */
export
function
buildJsonContentPersistList
(
schemaList
=
[],
visibleList
=
[],
values
=
{},
groupRowsCache
=
{}
)
{
const
visibleKeySet
=
new
Set
((
visibleList
||
[]).
map
(
field
=>
field
.
key
))
return
(
schemaList
||
[]).
filter
(
field
=>
{
if
(
!
field
?.
key
)
{
return
false
}
if
(
visibleKeySet
.
has
(
field
.
key
))
{
return
true
}
if
(
field
.
type
===
'subform'
)
{
const
rows
=
groupRowsCache
[
field
.
key
]
return
Array
.
isArray
(
rows
)
&&
rows
.
length
>
0
}
if
(
field
.
type
===
'group'
)
{
return
getStaticGroupChildren
(
field
).
some
(
child
=>
hasStoredValue
(
values
[
child
.
key
]))
}
if
(
field
.
type
===
'divider'
)
{
return
false
}
return
hasStoredValue
(
values
[
field
.
key
])
})
}
function
assembleFormListForSaveListsWithValues
(
engine
,
visibleList
=
[],
saveValues
=
{})
{
const
cache
=
engine
.
getGroupRowsCache
?.()
||
{}
const
topLevel
=
buildVisibleFormList
(
...
...
@@ -147,6 +185,17 @@ export function assembleFormListForSaveLists(engine, visibleList = []) {
return
assembleFormListForSaveListsWithValues
(
engine
,
visibleList
,
saveValues
)
}
/** 组装 jsonContent 用的 formList(可见 + 有值的隐藏字段) */
export
function
assembleFormListForJsonContent
(
engine
)
{
const
schemaList
=
engine
.
getSchemaList
?.()
||
[]
const
visibleList
=
engine
.
getVisibleList
?.()
||
[]
const
values
=
engine
.
getValues
?.()
||
{}
const
cache
=
engine
.
getGroupRowsCache
?.()
||
{}
const
persistList
=
buildJsonContentPersistList
(
schemaList
,
visibleList
,
values
,
cache
)
const
saveValues
=
collectSaveValues
(
engine
,
persistList
)
return
assembleFormListForSaveListsWithValues
(
engine
,
persistList
,
saveValues
)
}
/** 从 formList 提取 values(含 subform 行与静态 group 子字段) */
export
function
extractValuesFromFormList
(
list
=
[])
{
const
values
=
{}
...
...
@@ -249,14 +298,16 @@ export function buildDynamicSavePayload({
let
subformDataList
=
[]
let
jsonContent
if
(
normalizedFieldDataList
)
{
const
formListForSave
=
assembleFormListForSaveLists
(
engine
,
visibleList
)
jsonContent
=
JSON
.
stringify
(
serializeFormListForAppJsonStorage
(
formListForSave
))
;({
fieldDataList
,
subformDataList
}
=
buildAppDailyReportSubmitPayload
(
formListForSave
))
const
formListForLists
=
assembleFormListForSaveLists
(
engine
,
visibleList
)
const
formListForJson
=
assembleFormListForJsonContent
(
engine
)
jsonContent
=
JSON
.
stringify
(
serializeFormListForAppJsonStorage
(
formListForJson
))
;({
fieldDataList
,
subformDataList
}
=
buildAppNormalizedListsFromJsonContent
(
JSON
.
stringify
(
formListForLists
)
))
}
else
{
fieldDataList
=
buildFieldDataList
(
visibleList
,
listValues
)
jsonContent
=
JSON
.
stringify
(
serializeFormListForAppJsonStorage
(
buildVisibleFormList
(
visibleList
,
saveValues
))
serializeFormListForAppJsonStorage
(
assembleFormListForJsonContent
(
engine
))
)
}
const
payload
=
{
...
...
@@ -352,6 +403,8 @@ export default {
buildDynamicSavePayload
,
buildVisibleFormList
,
assembleFormListForSaveLists
,
assembleFormListForJsonContent
,
buildJsonContentPersistList
,
collectSaveValues
,
mergeValuesIntoSchema
,
extractValuesFromFormList
,
...
...
packageDynamicForm/form-engine/values.js
View file @
28f9bf9
/** 表单 values 读写与隐藏字段清理 — @see packageDynamicForm/docs/ARCHITECTURE.md */
import
{
getVisibleList
,
getVisibleLeafFields
,
resolveEffectiveRowFields
}
from
'./visibility.js'
import
{
getVisibleList
,
resolveEffectiveRowFields
}
from
'./visibility.js'
import
{
filterVisibleRowFields
}
from
'./group-visibility.js'
import
{
listSubforms
,
listStaticGroups
,
getStaticGroupChildren
,
getSubformRowTemplate
,
getSubformRowTemplateForAdd
...
...
@@ -103,20 +102,8 @@ export function setFieldValue(values, key, value) {
}
}
/** 清除不可见字段的值(含 subform 子字段与静态 group 子字段)
* @returns {object} 清理后的 values */
/** 清除误挂在顶层的 subform 列 key;模版级隐藏字段保留 values 供 jsonContent 回显 */
export
function
clearHiddenFieldValues
(
list
,
ctx
,
values
)
{
const
visibleList
=
getVisibleList
(
list
,
ctx
,
values
)
const
visibleFixedKeys
=
new
Set
(
getVisibleLeafFields
(
list
,
ctx
,
values
).
map
(
field
=>
field
.
key
)
)
const
visibleSubformKeys
=
new
Set
(
visibleList
.
filter
(
field
=>
field
.
type
===
'subform'
).
map
(
field
=>
field
.
key
)
)
const
visibleStaticGroupKeys
=
new
Set
(
visibleList
.
filter
(
field
=>
field
.
type
===
'group'
).
map
(
field
=>
field
.
key
)
)
const
subformChildKeys
=
new
Set
()
listSubforms
(
list
).
forEach
(
subform
=>
{
getSubformRowTemplate
(
subform
).
forEach
(
child
=>
{
...
...
@@ -124,41 +111,12 @@ export function clearHiddenFieldValues(list, ctx, values) {
})
})
const
staticGroupChildKeys
=
new
Map
()
listStaticGroups
(
list
).
forEach
(
group
=>
{
const
keys
=
getStaticGroupChildren
(
group
)
.
map
(
child
=>
child
.
key
)
.
filter
(
Boolean
)
staticGroupChildKeys
.
set
(
group
.
key
,
new
Set
(
keys
))
})
const
nextValues
=
{
...
values
}
Object
.
keys
(
nextValues
).
forEach
(
key
=>
{
if
(
subformChildKeys
.
has
(
key
))
{
delete
nextValues
[
key
]
}
})
listStaticGroups
(
list
).
forEach
(
group
=>
{
const
childKeys
=
staticGroupChildKeys
.
get
(
group
.
key
)
if
(
!
childKeys
)
return
childKeys
.
forEach
(
key
=>
{
if
(
!
visibleFixedKeys
.
has
(
key
))
{
delete
nextValues
[
key
]
}
})
if
(
!
visibleStaticGroupKeys
.
has
(
group
.
key
)
&&
Array
.
isArray
(
nextValues
[
group
.
key
]))
{
delete
nextValues
[
group
.
key
]
}
})
;(
list
||
[]).
forEach
(
field
=>
{
if
(
field
.
type
===
'subform'
&&
!
visibleSubformKeys
.
has
(
field
.
key
))
{
delete
nextValues
[
field
.
key
]
}
else
if
(
field
.
type
!==
'group'
&&
field
.
type
!==
'subform'
&&
!
visibleFixedKeys
.
has
(
field
.
key
))
{
delete
nextValues
[
field
.
key
]
}
})
return
nextValues
}
...
...
packageDynamicForm/tests/form-engine.test.mjs
View file @
28f9bf9
...
...
@@ -998,7 +998,7 @@ describe('submit adapter', async () => {
assert.equal(wenjieField.value, 1)
})
it('IT-API-004b: buildDynamicSavePayload off-duty jsonContent
matches visible fields only
', () => {
it('IT-API-004b: buildDynamicSavePayload off-duty jsonContent
persists hidden brand values
', () => {
const engine = createFormEngine(schema)
engine.setPageContext({
baseSceneCode: 100101,
...
...
@@ -1006,6 +1006,10 @@ describe('submit adapter', async () => {
merchantId: '100',
sceneList: [{ baseSceneCode: 100101 }]
})
engine.setFieldValue('F1-1', '在岗')
engine.setFieldValue('F1-5-1', 1)
engine.setFieldValue('F1-5-2', 2)
engine.setFieldValue('F1-5-3', 3)
engine.setFieldValue('F1-1', '调休')
const payload = buildDynamicSavePayload({
reportTemplateId: 1001,
...
...
@@ -1017,13 +1021,52 @@ describe('submit adapter', async () => {
const listKeys = jsonContent.map(item => item.key)
assert.ok(listKeys.includes('F1-1'))
assert.ok(listKeys.includes('F1-4'))
assert.ok(
!
listKeys.includes('F1-5'))
assert.ok(listKeys.includes('F1-5'))
assert.ok(!listKeys.includes('F1-2'))
assert.equal(jsonContent.find(item => item.key === 'F1-1').value, '调休')
const wenjie = jsonContent.find(item => item.key === 'F1-5')
assert.equal(wenjie.children.find(item => item.key === 'F1-5-1').value, 1)
assert.equal(payload.fieldDataList.length, 1)
assert.equal(payload.fieldDataList[0].fieldKey, 'F1-1')
})
it('IT-STAFF-SAVE-OFF-001: off-duty save round-trip restores brand values when switching to on-duty', () => {
const engine = createFormEngine(schema)
engine.setPageContext({
baseSceneCode: 100101,
brandIds: [3454],
merchantId: '100',
sceneList: [{ baseSceneCode: 100101 }]
})
engine.setFieldValue('F1-1', '在岗')
engine.setFieldValue('F1-5-1', 1)
engine.setFieldValue('F1-5-2', 2)
engine.setFieldValue('F1-5-3', 3)
engine.setFieldValue('F1-1', '调休')
const payload = buildDynamicSavePayload({
reportTemplateId: 1001,
engine,
reportDate: '2026-05-27',
normalizedFieldDataList: true
})
const ctx = enrichPageContextWithDetailEcho(
{
baseSceneCode: 100101,
brandIds: [3454],
merchantId: '100',
sceneList: [{ baseSceneCode: 100101 }]
},
{ jsonContent: payload.jsonContent }
)
const detailValues = parseJsonContentDetailValues(payload.jsonContent, schema.list)
const engine2 = createFormEngine(schema)
engine2.init(schema, { ...ctx, initialValues: detailValues })
assert.equal(engine2.getValues()['F1-5-1'], 1)
const afterOnDuty = engine2.setFieldValue('F1-1', '在岗')
assert.equal(afterOnDuty.values['F1-5-1'], 1)
assert.ok(afterOnDuty.sectionGroups.some(item => item.key === 'F1-5'))
})
it('IT-STAFF-OFF-002: off-duty echo then switch to on-duty shows brand groups', () => {
const engine = createFormEngine(schema)
const ctx = enrichPageContextWithDetailEcho(
...
...
packageDynamicForm/tests/hidden-clear.test.mjs
View file @
28f9bf9
...
...
@@ -8,6 +8,7 @@ describe('hidden field clear on linkage toggle', async () => {
const negotiationSchema = loadSchemaFixture('negotiation')
const staffSchema = loadSchemaFixture('staff')
const storeSchema = loadSchemaFixture('store')
const warrantyCtx = {
baseSceneCode: 110201,
...
...
@@ -53,7 +54,7 @@ describe('hidden field clear on linkage toggle', async () => {
assert.ok(cacheKeys.includes('F3-1-11'))
})
it('IT-HIDDEN-CLEAR-002: staff 调休
clears rules.result hidden field values
', () => {
it('IT-HIDDEN-CLEAR-002: staff 调休
preserves rules.result hidden field values for jsonContent
', () => {
const engine = createFormEngine(staffSchema)
engine.init(staffSchema, staffCtx)
...
...
@@ -69,10 +70,10 @@ describe('hidden field clear on linkage toggle', async () => {
state = engine.getViewState()
assert.equal(state.values['F1-1'], '调休')
assert.equal(state.values['F1-5-1'],
undefined
)
assert.equal(state.values['F1-5-2'],
undefined
)
assert.equal(state.values['F1-5-3'],
undefined
)
assert.
equal(state.values['F1-2'], undefined
)
assert.equal(state.values['F1-5-1'],
1
)
assert.equal(state.values['F1-5-2'],
2
)
assert.equal(state.values['F1-5-3'],
3
)
assert.
ok(!state.visibleList.some(item => item.key === 'F1-5')
)
})
it('IT-HIDDEN-CLEAR-003: save jsonContent excludes hidden subform cells after toggle', () => {
...
...
@@ -101,4 +102,59 @@ describe('hidden field clear on linkage toggle', async () => {
assert.ok(!Object.prototype.hasOwnProperty.call(rowBag, 'F3-1-12'))
assert.ok(!Object.prototype.hasOwnProperty.call(rowBag, 'F3-1-13'))
})
it('IT-NEG-SAVE-HIDDEN-001: jsonContent includes template-hidden subform with data, lists do not', () => {
const engine = createFormEngine(negotiationSchema)
engine.init(negotiationSchema, {
...warrantyCtx,
initialValues: {
'F3-3': [
{
'F3-3-1': '13800138000',
'F3-3-2': '张三'
}
]
}
})
assert.ok(!engine.getVisibleList().some(item => item.key === 'F3-3'))
assert.ok(engine.getValues()['F3-3']?.length)
const payload = buildAppDailySavePayload({
reportTemplateId: 10003,
engine
})
const jsonKeys = JSON.parse(payload.jsonContent).map(item => item.key)
assert.ok(jsonKeys.includes('F3-3'))
assert.ok(!payload.fieldDataList.some(item => item.groupKey === 'F3-3'))
assert.ok(!payload.subformDataList.some(item => item.parentFieldKey === 'F3-3'))
})
it('IT-STORE-SAVE-HIDDEN-001: jsonContent includes template-hidden subform with data, lists do not', () => {
const warrantyCtx = {
baseSceneCode: 110201,
brandIds: [3454],
sceneList: [{ baseSceneCode: 110201 }]
}
const boutiqueCtx = {
baseSceneCode: 100101,
brandIds: [3454],
sceneList: [{ baseSceneCode: 100101 }]
}
const engine = createFormEngine(storeSchema)
engine.init(storeSchema, warrantyCtx)
const f29 = storeSchema.list.find(item => item.key === 'F2-9')
engine.addGroupRow(f29)
engine.setGroupFieldValue('F2-9', 0, 'F2-9-2', 5)
engine.setPageContext(boutiqueCtx)
assert.ok(!engine.getVisibleList().some(item => item.key === 'F2-9'))
assert.equal(engine.getValues()['F2-9']?.[0]?.['F2-9-2'], 5)
const payload = buildAppDailySavePayload({
reportTemplateId: 10002,
engine
})
const jsonKeys = JSON.parse(payload.jsonContent).map(item => item.key)
assert.ok(jsonKeys.includes('F2-9'))
assert.ok(!payload.subformDataList.some(item => item.parentFieldKey === 'F2-9'))
})
})
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment