提交
This commit is contained in:
1 parent
c3be9d1dce
commit
299609706c
328 files changed
+144899
-13873
No files matched your search
@@ -32,6 +32,15 @@ export function statusTone(status: number | string | null | undefined): string {
|
||||
return map[status] ?? 'info'
|
||||
}
|
||||
|
||||
/** 业务类型 → Element Plus Tag type(报销单/备用金) */
|
||||
export function bizTypeTagType(
|
||||
bizType: string | undefined | null
|
||||
): 'success' | 'warning' | 'danger' | 'info' | 'primary' {
|
||||
if (bizType === '报销单') return 'primary'
|
||||
if (bizType === '备用金') return 'warning'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
/** bx 状态 → Element Plus Tag type(对齐 OpenSpec 语义色) */
|
||||
export function statusTagType(
|
||||
status: number | string | null | undefined
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
|
||||
type BxKvOpts = Partial<Pick<ViewField, 'long' | 'fullSpan' | 'span' | 'money' | 'tagType'>>
|
||||
|
||||
/** 构建报销模块查看弹窗 KV 字段(空值统一为 —) */
|
||||
export function bxViewKv(label: string, value: unknown, opts: BxKvOpts = {}): ViewField {
|
||||
const text =
|
||||
value === null || value === undefined || value === ''
|
||||
? undefined
|
||||
: typeof value === 'boolean'
|
||||
? value
|
||||
? '是'
|
||||
: '否'
|
||||
: String(value)
|
||||
return { label, value: text, ...opts }
|
||||
}
|
||||
|
||||
/** 长文本 / 备注 / 地址等 */
|
||||
export function bxViewKvLong(label: string, value: unknown, opts: BxKvOpts = {}): ViewField {
|
||||
return bxViewKv(label, value, { long: true, span: true, ...opts })
|
||||
}
|
||||
|
||||
/** 金额类(红色加粗由 money 样式控制) */
|
||||
export function bxViewKvMoney(label: string, display: string, opts: BxKvOpts = {}): ViewField {
|
||||
return { label, value: display || '—', money: true, ...opts }
|
||||
}
|
||||
Reference in new issue
Block a user