feat: 新增现场日历并将四类日历的起止地改为选填,以支持现场派车记录。

This commit is contained in:
wuzilong committed 2026-10-30 11:58:48 +08:00
1 parent 0453e90000
commit cd99b040aa
15 files changed
+172 -31

No files matched your search

@@ -107,8 +107,22 @@ test('同一车辆按创建时间正序,复制时排在一起且每条换行',
])
assert.equal(text.startsWith('2026-10-28'), true)
})
test('表单拒绝空白、无效日期,保留手写起止地', () => {
assert.equal(validateManualDraft({ ...row('1'), origin: ' ' }), '请填写始发地')
test('表单允许起止地留空,仍拒绝无效日期和超长地址', () => {
for (const calendarKind of ['acid', 'alkali', 'other', 'site'] as const) {
for (const addresses of [
{ origin: '', destination: '云栋' },
{ origin: '山峡', destination: '' },
{ origin: ' ', destination: ' ' }
]) {
assert.equal(validateManualDraft({ ...row('1'), calendarKind, ...addresses }), '')
}
}
for (const field of ['origin', 'destination']) {
assert.equal(
validateManualDraft({ ...row('1'), [field]: '地'.repeat(256) }),
'始发地和目的地最多255个字符'
)
}
assert.equal(
validateManualDraft({ ...row('1'), dispatchDate: '2026-02-30' }),
'请选择有效的派车日期'
@@ -118,7 +132,9 @@ test('表单拒绝空白、无效日期,保留手写起止地', () => {
test('数量是可空文本,复制逐条展示,日汇总仍只计车次', () => {
const tons = { ...row('1'), quantity: '32.50' }
const blank = { ...row('2'), quantity: ' ' }
const day = manualCalendarDays([tons, blank], '2026-10').find((item) => item.date === '2026-10-26')!
const day = manualCalendarDays([tons, blank], '2026-10').find(
(item) => item.date === '2026-10-26'
)!
assert.deepEqual(day.products[0], { id: 'p1', name: '液碱', count: 2 })
const text = manualCopyText('2026-10-26', [tons, blank])
assert.match(text, /液碱 32\.50吨 山峡 → 云栋/)
@@ -130,8 +146,5 @@ test('数量是可空文本,复制逐条展示,日汇总仍只计车次', ()
validateManualDraft({ ...row('1'), quantity: '12.345' }),
'数量须为数字,最多两位小数'
)
assert.equal(
validateManualDraft({ ...row('1'), quantity: '1吨' }),
'数量须为数字,最多两位小数'
)
assert.equal(validateManualDraft({ ...row('1'), quantity: '1吨' }), '数量须为数字,最多两位小数')
})