Commit b5c20a66 by 张立顺

feat 模板单位添加

1 parent 6d6d5885
......@@ -119,6 +119,7 @@
brandId: [],
baseSceneCode: [110201, 110202],
//[场景 包含 2.3.1 or 2.3.2] and [今日出勤=在岗] 则 [显示]
unit: '元',
value: 0,
rules: {
min: 0,
......
......@@ -477,6 +477,7 @@
brandId: [3067],
//[门店经营品牌 包含 岚图] and [场景 包含 2.3.1 or 2.3.2] 则 [显示]
baseSceneCode: [110201, 110202],
unit: '%',
value: 0,
rules: {
min: 0,
......@@ -494,6 +495,7 @@
brandId: [3067],
//[门店经营品牌 包含 岚图] and [场景 包含 2.3.1 or 2.3.2] 则 [显示]
baseSceneCode: [110201, 110202],
unit: '%',
value: 0,
rules: {
min: 0,
......@@ -982,6 +984,7 @@
sceneType: [0, 0],
brandId: [],
baseSceneCode: [110101, 110102, 110201, 110202],
unit: '元',
value: 0,
rules: {
min: 0,
......@@ -1474,6 +1477,7 @@
sceneType: [0, 0],
brandId: [],
baseSceneCode: [110101, 110102, 110201, 110202],
unit: '元',
value: 0,
rules: {
min: 0,
......@@ -1848,6 +1852,7 @@
sceneType: [1],
brandId: [3454, 3503, 3458, 3574, 3502],
baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0,
rules: {
min: 0,
......@@ -1949,6 +1954,7 @@
sceneType: [1],
brandId: [3454, 3503, 3458, 3574, 3502],
baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0,
rules: {
min: 0,
......@@ -2082,6 +2088,7 @@
sceneType: [1],
brandId: [3454, 3503, 3458, 3574, 3502],
baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0,
rules: {
min: 0,
......@@ -2207,6 +2214,7 @@
sceneType: [1],
brandId: [],
baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0,
rules: {
min: 0,
......@@ -2329,6 +2337,7 @@
sceneType: [1],
brandId: [],
baseSceneCode: [100101, 100102, 100103],
unit: '元',
value: 0,
rules: {
min: 0,
......
This diff could not be displayed because it is too large.
......@@ -133,4 +133,11 @@ describe('staff daily template V2.1.1 schema', () => {
assert.deepEqual(child?.filterBrandId, [3454, 3503, 3458, 3574, 3502])
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) {
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 = []) {
const keys = []
function walk(field) {
......@@ -138,4 +156,24 @@ describe('store daily template V2.1.1 schema', () => {
assert.deepEqual(field?.filterBrandId, [3454, 3503, 3458, 3574, 3502])
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!