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 3c853e27
authored
Aug 14, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 门店日报模板声明重复手机号校验
1 parent
072ecfe0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
7 deletions
docs/superpowers/plans/2026-08-14-subform-duplicate-validation.md
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.js
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.json
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.js
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.json
packageDynamicForm/scripts/convert-excel-template-to-schema.py
packageDynamicForm/tests/store-v230-template-schema.test.mjs
packageDynamicForm/tests/test_store_v230_converter.py
docs/superpowers/plans/2026-08-14-subform-duplicate-validation.md
View file @
3c853e2
...
@@ -190,7 +190,7 @@ git commit -m "feat: 门店日报按模板拦截重复手机号"
...
@@ -190,7 +190,7 @@ git commit -m "feat: 门店日报按模板拦截重复手机号"
**Files:**
**Files:**
-
Modify:
`packageDynamicForm/scripts/convert-excel-template-to-schema.py`
-
Modify:
`packageDynamicForm/scripts/convert-excel-template-to-schema.py`
-
Modify:
`packageDynamicForm/tests/test_store_v230_converter.py`
-
Modify:
`packageDynamicForm/tests/test_store_v230_converter.py`
-
Modify:
`packageDynamicForm/tests/store-
template-v230
-schema.test.mjs`
-
Modify:
`packageDynamicForm/tests/store-
v230-template
-schema.test.mjs`
-
Modify:
`packageDynamicForm/fixtures/schema-store-daily-v2.3.0.js`
-
Modify:
`packageDynamicForm/fixtures/schema-store-daily-v2.3.0.js`
-
Modify:
`packageDynamicForm/fixtures/schema-store-daily-v2.3.0.json`
-
Modify:
`packageDynamicForm/fixtures/schema-store-daily-v2.3.0.json`
-
Modify:
`packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.js`
-
Modify:
`packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.js`
...
@@ -225,7 +225,7 @@ for (const schema of [dailyJs, dailyJson, prodJs, prodJson]) {
...
@@ -225,7 +225,7 @@ for (const schema of [dailyJs, dailyJson, prodJs, prodJson]) {
Run:
`C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe -m unittest packageDynamicForm.tests.test_store_v230_converter`
Run:
`C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe -m unittest packageDynamicForm.tests.test_store_v230_converter`
Run:
`node --test packageDynamicForm/tests/store-
template-v230
-schema.test.mjs`
Run:
`node --test packageDynamicForm/tests/store-
v230-template
-schema.test.mjs`
Expected: FAIL,属性尚未注入。
Expected: FAIL,属性尚未注入。
...
@@ -257,14 +257,14 @@ $input='C:\Users\admin\Downloads\门店工作汇报-V2.3.0输入输出模板 (1)
...
@@ -257,14 +257,14 @@ $input='C:\Users\admin\Downloads\门店工作汇报-V2.3.0输入输出模板 (1)
Run:
`C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe -m unittest packageDynamicForm.tests.test_store_v230_converter`
Run:
`C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe -m unittest packageDynamicForm.tests.test_store_v230_converter`
Run:
`node --test packageDynamicForm/tests/store-
template-v230
-schema.test.mjs packageDynamicForm/tests/store-v230-context-visibility.test.mjs`
Run:
`node --test packageDynamicForm/tests/store-
v230-template
-schema.test.mjs packageDynamicForm/tests/store-v230-context-visibility.test.mjs`
Expected: PASS;四份模板属性相同且指向真实子字段。
Expected: PASS;四份模板属性相同且指向真实子字段。
-
[
]
**Step 7: 提交转换器与模板**
-
[
]
**Step 7: 提交转换器与模板**
```
powershell
```
powershell
git add packageDynamicForm/scripts/convert-excel-template-to-schema.py packageDynamicForm/tests/test_store_v230_converter.py packageDynamicForm/tests/store-
template-v230
-schema.test.mjs packageDynamicForm/fixtures/schema-store-daily-v2.3.0.js packageDynamicForm/fixtures/schema-store-daily-v2.3.0.json packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.js packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.json
git add packageDynamicForm/scripts/convert-excel-template-to-schema.py packageDynamicForm/tests/test_store_v230_converter.py packageDynamicForm/tests/store-
v230-template
-schema.test.mjs packageDynamicForm/fixtures/schema-store-daily-v2.3.0.js packageDynamicForm/fixtures/schema-store-daily-v2.3.0.json packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.js packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.json
git commit -m
"feat: 门店日报模板声明重复手机号校验"
git commit -m
"feat: 门店日报模板声明重复手机号校验"
```
```
...
...
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.js
View file @
3c853e2
...
@@ -209,6 +209,7 @@
...
@@ -209,6 +209,7 @@
result
:
"val1 && Array.isArray(val1) && val1.includes('1')"
result
:
"val1 && Array.isArray(val1) && val1.includes('1')"
}
}
},
},
validateDuplicates
:
[
'F2-107-2'
],
children
:
[
children
:
[
[
[
{
{
...
...
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.json
View file @
3c853e2
...
@@ -681,7 +681,10 @@
...
@@ -681,7 +681,10 @@
],
],
"result"
:
"val1 && Array.isArray(val1) && val1.includes('1')"
"result"
:
"val1 && Array.isArray(val1) && val1.includes('1')"
}
}
}
},
"validateDuplicates"
:
[
"F2-107-2"
]
}
}
]
]
}
}
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.js
View file @
3c853e2
...
@@ -209,6 +209,7 @@
...
@@ -209,6 +209,7 @@
result
:
"val1 && Array.isArray(val1) && val1.includes('1')"
result
:
"val1 && Array.isArray(val1) && val1.includes('1')"
}
}
},
},
validateDuplicates
:
[
'F2-107-2'
],
children
:
[
children
:
[
[
[
{
{
...
...
packageDynamicForm/fixtures/schema-store-daily-v2.3.0.prod.json
View file @
3c853e2
...
@@ -681,7 +681,10 @@
...
@@ -681,7 +681,10 @@
],
],
"result"
:
"val1 && Array.isArray(val1) && val1.includes('1')"
"result"
:
"val1 && Array.isArray(val1) && val1.includes('1')"
}
}
}
},
"validateDuplicates"
:
[
"F2-107-2"
]
}
}
]
]
}
}
packageDynamicForm/scripts/convert-excel-template-to-schema.py
View file @
3c853e2
...
@@ -884,6 +884,8 @@ def assemble_v230_list(records: list[dict], sheet_cfg: dict) -> list[dict]:
...
@@ -884,6 +884,8 @@ def assemble_v230_list(records: list[dict], sheet_cfg: dict) -> list[dict]:
for
key
,
rule
in
child_show_rules
.
items
()
for
key
,
rule
in
child_show_rules
.
items
()
if
key
in
child_keys
if
key
in
child_keys
}
}
if
parent
.
get
(
'key'
)
==
'F2-107'
:
parent
[
'validateDuplicates'
]
=
[
'F2-107-2'
]
top_fields
.
sort
(
key
=
lambda
field
:
int
(
field
.
get
(
'sortNum'
)
or
0
))
top_fields
.
sort
(
key
=
lambda
field
:
int
(
field
.
get
(
'sortNum'
)
or
0
))
return
top_fields
return
top_fields
...
@@ -923,6 +925,14 @@ def validate_v230_shape(records: list[dict], fields: list[dict], sheet_cfg: dict
...
@@ -923,6 +925,14 @@ def validate_v230_shape(records: list[dict], fields: list[dict], sheet_cfg: dict
)
)
child_key_set
=
set
(
actual_child_keys
)
child_key_set
=
set
(
actual_child_keys
)
duplicate_keys
=
(
subform
or
{})
.
get
(
'validateDuplicates'
)
or
[]
if
not
isinstance
(
duplicate_keys
,
list
):
raise
ValueError
(
'validateDuplicates must be a list for F2-107'
)
for
duplicate_key
in
duplicate_keys
:
if
duplicate_key
not
in
child_key_set
:
raise
ValueError
(
f
'validateDuplicates key missing from F2-107: {duplicate_key}'
)
for
target
,
rule
in
(
subform
or
{})
.
get
(
'childrenShowRules'
,
{})
.
items
():
for
target
,
rule
in
(
subform
or
{})
.
get
(
'childrenShowRules'
,
{})
.
items
():
if
target
not
in
child_key_set
:
if
target
not
in
child_key_set
:
raise
ValueError
(
f
'childrenShowRules target missing from F2-107: {target}'
)
raise
ValueError
(
f
'childrenShowRules target missing from F2-107: {target}'
)
...
@@ -1097,7 +1107,8 @@ FIELD_PROP_ORDER = [
...
@@ -1097,7 +1107,8 @@ FIELD_PROP_ORDER = [
'optionsKey'
,
'value'
,
'prefixComponent'
,
'optionsKey'
,
'value'
,
'prefixComponent'
,
'unit'
,
'rules'
,
'unit'
,
'rules'
,
'filterBrandId'
,
'completeFun'
,
'disabledFun'
,
'isYB'
,
'isQY'
,
'filterBrandId'
,
'completeFun'
,
'disabledFun'
,
'isYB'
,
'isQY'
,
'ybCode'
,
'qyCode'
,
'qgCode'
,
'childrenRules'
,
'childrenShowRules'
,
'children'
,
'ybCode'
,
'qyCode'
,
'qgCode'
,
'childrenRules'
,
'childrenShowRules'
,
'validateDuplicates'
,
'children'
,
]
]
DIVIDER_PROP_ORDER
=
[
DIVIDER_PROP_ORDER
=
[
...
...
packageDynamicForm/tests/store-v230-template-schema.test.mjs
View file @
3c853e2
...
@@ -61,6 +61,20 @@ describe('store daily template V2.3.0 schema', () => {
...
@@ -61,6 +61,20 @@ describe('store daily template V2.3.0 schema', () => {
assert.equal(findDeep(daily.list, 'F2-107')?.children?.[0]?.length, 18)
assert.equal(findDeep(daily.list, 'F2-107')?.children?.[0]?.length, 18)
})
})
it('IT-V230-001b: daily and production JS/JSON declare duplicate customer phone validation', () => {
const schemas = [
daily.list,
production.list,
loadBareArray('schema-store-daily-v2.3.0.js'),
loadBareArray('schema-store-daily-v2.3.0.prod.js')
]
for (const list of schemas) {
const group = findDeep(list, 'F2-107')
assert.deepEqual(group?.validateDuplicates, ['F2-107-2'])
assert.ok(group?.children?.[0]?.some(child => child.key === 'F2-107-2'))
}
})
it('IT-V230-002: selector, phone, date, car and VIN mappings', () => {
it('IT-V230-002: selector, phone, date, car and VIN mappings', () => {
assert.equal(findDeep(daily.list, 'F2-101')?.type, 'multipleSelect')
assert.equal(findDeep(daily.list, 'F2-101')?.type, 'multipleSelect')
assert.equal(findDeep(daily.list, 'F2-101')?.optionsKey, 'storeStaffList')
assert.equal(findDeep(daily.list, 'F2-101')?.optionsKey, 'storeStaffList')
...
...
packageDynamicForm/tests/test_store_v230_converter.py
View file @
3c853e2
...
@@ -290,6 +290,7 @@ class StoreV230ConverterTest(unittest.TestCase):
...
@@ -290,6 +290,7 @@ class StoreV230ConverterTest(unittest.TestCase):
[
child
[
'key'
]
for
child
in
subform
[
'children'
][
0
]],
[
child
[
'key'
]
for
child
in
subform
[
'children'
][
0
]],
[
'F2-107-4'
,
'F2-107-7'
,
'F2-107-17'
],
[
'F2-107-4'
,
'F2-107-7'
,
'F2-107-17'
],
)
)
self
.
assertEqual
(
subform
[
'validateDuplicates'
],
[
'F2-107-2'
])
self
.
assertEqual
(
self
.
assertEqual
(
subform
[
'childrenShowRules'
][
'F2-107-17'
][
'keys'
],
subform
[
'childrenShowRules'
][
'F2-107-17'
][
'keys'
],
[
'F2-107-7'
],
[
'F2-107-7'
],
...
@@ -312,6 +313,7 @@ class StoreV230ConverterTest(unittest.TestCase):
...
@@ -312,6 +313,7 @@ class StoreV230ConverterTest(unittest.TestCase):
)
)
source
=
converter
.
emit_js_array
(
fields
,
{},
{
'fileHeader'
:
''
,
'jsDoc'
:
''
,
'fields'
:
{}})
source
=
converter
.
emit_js_array
(
fields
,
{},
{
'fileHeader'
:
''
,
'jsDoc'
:
''
,
'fields'
:
{}})
self
.
assertIn
(
"validateDuplicates: ['F2-107-2']"
,
source
)
self
.
assertIn
(
'result: "!Array.isArray(val1) || (val1 && !val1.includes('
,
source
)
self
.
assertIn
(
'result: "!Array.isArray(val1) || (val1 && !val1.includes('
,
source
)
self
.
assertNotIn
(
"result: '!Array.isArray(val1) || !val1.includes("
,
source
)
self
.
assertNotIn
(
"result: '!Array.isArray(val1) || !val1.includes("
,
source
)
script
=
(
script
=
(
...
@@ -537,6 +539,11 @@ class StoreV230ConverterTest(unittest.TestCase):
...
@@ -537,6 +539,11 @@ class StoreV230ConverterTest(unittest.TestCase):
}]
}]
converter
.
validate_v230_shape
([],
context_dependencies
,
validation_cfg
)
converter
.
validate_v230_shape
([],
context_dependencies
,
validation_cfg
)
bad_duplicate_key
=
copy
.
deepcopy
(
context_dependencies
)
bad_duplicate_key
[
0
][
'validateDuplicates'
]
=
[
'F2-107-99'
]
with
self
.
assertRaisesRegex
(
ValueError
,
r'validateDuplicates.*F2-107-99'
):
converter
.
validate_v230_shape
([],
bad_duplicate_key
,
validation_cfg
)
declarative_options
=
copy
.
deepcopy
(
context_dependencies
)
declarative_options
=
copy
.
deepcopy
(
context_dependencies
)
declarative_options
[
0
][
'children'
][
0
][
0
]
.
update
({
declarative_options
[
0
][
'children'
][
0
][
0
]
.
update
({
'type'
:
'multipleSelect'
,
'type'
:
'multipleSelect'
,
...
...
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