Commit b5c20a66 by 张立顺

feat 模板单位添加

1 parent 6d6d5885
...@@ -119,6 +119,7 @@ ...@@ -119,6 +119,7 @@
brandId: [], brandId: [],
baseSceneCode: [110201, 110202], baseSceneCode: [110201, 110202],
//[场景 包含 2.3.1 or 2.3.2] and [今日出勤=在岗] 则 [显示] //[场景 包含 2.3.1 or 2.3.2] and [今日出勤=在岗] 则 [显示]
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
......
...@@ -125,7 +125,8 @@ ...@@ -125,7 +125,8 @@
"min": 0, "min": 0,
"decimal": true "decimal": true
}, },
"value": 0 "value": 0,
"unit": "元"
}, },
{ {
"label": "备注", "label": "备注",
......
...@@ -477,6 +477,7 @@ ...@@ -477,6 +477,7 @@
brandId: [3067], brandId: [3067],
//[门店经营品牌 包含 岚图] and [场景 包含 2.3.1 or 2.3.2] 则 [显示] //[门店经营品牌 包含 岚图] and [场景 包含 2.3.1 or 2.3.2] 则 [显示]
baseSceneCode: [110201, 110202], baseSceneCode: [110201, 110202],
unit: '%',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -494,6 +495,7 @@ ...@@ -494,6 +495,7 @@
brandId: [3067], brandId: [3067],
//[门店经营品牌 包含 岚图] and [场景 包含 2.3.1 or 2.3.2] 则 [显示] //[门店经营品牌 包含 岚图] and [场景 包含 2.3.1 or 2.3.2] 则 [显示]
baseSceneCode: [110201, 110202], baseSceneCode: [110201, 110202],
unit: '%',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -982,6 +984,7 @@ ...@@ -982,6 +984,7 @@
sceneType: [0, 0], sceneType: [0, 0],
brandId: [], brandId: [],
baseSceneCode: [110101, 110102, 110201, 110202], baseSceneCode: [110101, 110102, 110201, 110202],
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -1474,6 +1477,7 @@ ...@@ -1474,6 +1477,7 @@
sceneType: [0, 0], sceneType: [0, 0],
brandId: [], brandId: [],
baseSceneCode: [110101, 110102, 110201, 110202], baseSceneCode: [110101, 110102, 110201, 110202],
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -1848,6 +1852,7 @@ ...@@ -1848,6 +1852,7 @@
sceneType: [1], sceneType: [1],
brandId: [3454, 3503, 3458, 3574, 3502], brandId: [3454, 3503, 3458, 3574, 3502],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -1949,6 +1954,7 @@ ...@@ -1949,6 +1954,7 @@
sceneType: [1], sceneType: [1],
brandId: [3454, 3503, 3458, 3574, 3502], brandId: [3454, 3503, 3458, 3574, 3502],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -2082,6 +2088,7 @@ ...@@ -2082,6 +2088,7 @@
sceneType: [1], sceneType: [1],
brandId: [3454, 3503, 3458, 3574, 3502], brandId: [3454, 3503, 3458, 3574, 3502],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -2207,6 +2214,7 @@ ...@@ -2207,6 +2214,7 @@
sceneType: [1], sceneType: [1],
brandId: [], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
...@@ -2329,6 +2337,7 @@ ...@@ -2329,6 +2337,7 @@
sceneType: [1], sceneType: [1],
brandId: [], brandId: [],
baseSceneCode: [100101, 100102, 100103], baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0, value: 0,
rules: { rules: {
min: 0, min: 0,
......
...@@ -597,7 +597,8 @@ ...@@ -597,7 +597,8 @@
"min": 0, "min": 0,
"decimal": true "decimal": true
}, },
"value": 0 "value": 0,
"unit": "%"
}, },
{ {
"label": "岚图售后月销售目标完成率", "label": "岚图售后月销售目标完成率",
...@@ -619,7 +620,8 @@ ...@@ -619,7 +620,8 @@
"min": 0, "min": 0,
"decimal": true "decimal": true
}, },
"value": 0 "value": 0,
"unit": "%"
}, },
{ {
"label": "问界鸿蒙售前数据 (延保)", "label": "问界鸿蒙售前数据 (延保)",
...@@ -1400,7 +1402,8 @@ ...@@ -1400,7 +1402,8 @@
3502, 3502,
3067 3067
], ],
"value": 0 "value": 0,
"unit": "元"
} }
] ]
], ],
...@@ -2230,7 +2233,8 @@ ...@@ -2230,7 +2233,8 @@
3502, 3502,
3067 3067
], ],
"value": 0 "value": 0,
"unit": "元"
} }
] ]
], ],
...@@ -2827,7 +2831,8 @@ ...@@ -2827,7 +2831,8 @@
"min": 0, "min": 0,
"decimal": true "decimal": true
}, },
"value": 0 "value": 0,
"unit": "元"
} }
] ]
], ],
...@@ -3001,7 +3006,8 @@ ...@@ -3001,7 +3006,8 @@
"min": 0, "min": 0,
"decimal": true "decimal": true
}, },
"value": 0 "value": 0,
"unit": "元"
}, },
{ {
"label": "本月特殊客户", "label": "本月特殊客户",
...@@ -3237,7 +3243,8 @@ ...@@ -3237,7 +3243,8 @@
"min": 0, "min": 0,
"decimal": true "decimal": true
}, },
"value": 0 "value": 0,
"unit": "元"
} }
] ]
], ],
...@@ -3453,7 +3460,8 @@ ...@@ -3453,7 +3460,8 @@
3574, 3574,
3502 3502
], ],
"value": 0 "value": 0,
"unit": "元"
}, },
{ {
"label": "今日无效客户", "label": "今日无效客户",
...@@ -3677,7 +3685,8 @@ ...@@ -3677,7 +3685,8 @@
3574, 3574,
3502 3502
], ],
"value": 0 "value": 0,
"unit": "元"
} }
] ]
], ],
......
...@@ -133,4 +133,11 @@ describe('staff daily template V2.1.1 schema', () => { ...@@ -133,4 +133,11 @@ describe('staff daily template V2.1.1 schema', () => {
assert.deepEqual(child?.filterBrandId, [3454, 3503, 3458, 3574, 3502]) assert.deepEqual(child?.filterBrandId, [3454, 3503, 3458, 3574, 3502])
assert.deepEqual(child?.baseSceneCode, [100101, 100102, 100103]) assert.deepEqual(child?.baseSceneCode, [100101, 100102, 100103])
}) })
it('IT-STAFF-TPL-010: F1-3 refund amount has unit 元 from Excel rule', () => {
const field = findFieldByKey(staffSchema.list, 'F1-3')
assert.equal(field?.label, '延保退单金额')
assert.equal(field?.unit, '元')
assert.equal(field?.rules?.decimal, true)
})
}) })
...@@ -8,6 +8,24 @@ function findFieldByKey(list, key) { ...@@ -8,6 +8,24 @@ function findFieldByKey(list, key) {
return list.find(item => item.key === key) return list.find(item => item.key === key)
} }
/** 递归按 key 查找字段(含 subform / group 子项) */
function findFieldByKeyDeep(list, key) {
for (const field of list || []) {
if (field?.key === key) return field
const children = field?.children
if (!Array.isArray(children)) continue
for (const child of children) {
if (Array.isArray(child)) {
const found = findFieldByKeyDeep(child, key)
if (found) return found
} else if (child?.key === key) {
return child
}
}
}
return null
}
function collectAllKeys(list = []) { function collectAllKeys(list = []) {
const keys = [] const keys = []
function walk(field) { function walk(field) {
...@@ -138,4 +156,24 @@ describe('store daily template V2.1.1 schema', () => { ...@@ -138,4 +156,24 @@ describe('store daily template V2.1.1 schema', () => {
assert.deepEqual(field?.filterBrandId, [3454, 3503, 3458, 3574, 3502]) assert.deepEqual(field?.filterBrandId, [3454, 3503, 3458, 3574, 3502])
assert.deepEqual(field?.baseSceneCode, [100101, 100102, 100103]) assert.deepEqual(field?.baseSceneCode, [100101, 100102, 100103])
}) })
it('IT-STORE-TPL-010: Excel 后置显示文字元/% fields have unit', () => {
const yuanKeys = [
'F2-11-12',
'F2-14-11',
'F2-26-4',
'F2-27-6',
'F2-28-6',
'F2-57-6',
'F2-58-4'
]
for (const key of yuanKeys) {
const field = findFieldByKeyDeep(storeSchema.list, key)
assert.equal(field?.unit, '元', key)
}
for (const key of ['F2-34', 'F2-35']) {
const field = findFieldByKeyDeep(storeSchema.list, key)
assert.equal(field?.unit, '%', key)
}
})
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!