This commit is contained in:
zlwu committed 2026-06-21 09:19:07 +08:00
1 parent c3be9d1dce
commit 299609706c
328 files changed
+144899 -13873

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import type { TagType, ViewField } from '@/components/business/system-view-dialog/types'
import { formatViewValue } from '@/components/business/system-view-dialog/types'
type DictStoreLike = {
getLabel: (dictType: string, value: string) => string
getTagType: (dictType: string, value: string) => TagType
}
export function crmField(label: string, value: unknown, extra?: Partial<ViewField>): ViewField {
return { label, value: formatViewValue(value), ...extra }
}
export function crmLongField(label: string, value: unknown, extra?: Partial<ViewField>): ViewField {
return { label, value: formatViewValue(value), long: true, span: true, ...extra }
}
export function crmDictField(
label: string,
dictType: string,
value: string | null | undefined,
dictStore: DictStoreLike,
extra?: Partial<ViewField>
): ViewField {
return {
label,
value: value ? String(dictStore.getLabel(dictType, value)) : '—',
tagType: value ? dictStore.getTagType(dictType, value) : undefined,
...extra
}
}
export function crmTagField(
label: string,
display: string,
tagType?: TagType,
extra?: Partial<ViewField>
): ViewField {
return { label, value: display || '—', tagType, ...extra }
}