export const OWNERSHIP_TYPE_OPTIONS = [ { label: '专业所', value: '专业所' }, { label: '综合所', value: '综合所' }, { label: '专业分包', value: '专业分包' } ] export const CALCULATION_METHOD_OPTIONS = [ { label: '指导价法', value: '指导价法' }, { label: '合同价法', value: '合同价法' }, { label: '虚拟产值法', value: '虚拟产值法' } ] export const VIRTUAL_CALCULATION_METHOD_OPTIONS = [ { label: '指导单价法', value: '指导单价法' }, { label: '虚拟总价法', value: '虚拟总价法' }, { label: '工日法', value: '工日法' } ] export const DESIGN_STAGE_OPTIONS = [ { label: '方案', value: '方案' }, { label: '施工图', value: '施工图' }, { label: '方案+施工图', value: '方案+施工图' } ] export const CONTRACT_SIGN_OPTIONS = [ { label: '已签订', value: true }, { label: '未签订', value: false } ] export const PROJECT_TYPE_OPTIONS = [ { label: '建筑工程', value: '建筑工程' }, { label: '精装工程', value: '精装工程' }, { label: '综合工程', value: '综合工程' } ] export const QUARTER_OPTIONS = [ { label: '一季度', value: 1 }, { label: '二季度', value: 2 }, { label: '三季度', value: 3 }, { label: '四季度', value: 4 } ] export const OUTPUT_SPLIT_SPECIALTY_OPTIONS = [ { label: '建筑', value: 'arch' }, { label: '装修', value: 'decor' }, { label: '结构', value: 'struct' }, { label: '水', value: 'water' }, { label: '电气', value: 'elec' }, { label: '暖通', value: 'hvac' }, { label: '数字化设计', value: 'digital' } ] export const SPECIALTY_ROLE_OPTIONS = [ { label: '专业负责人', value: 'director' }, { label: '校对', value: 'check' }, { label: '审核', value: 'review' }, { label: '审定', value: 'approve' }, { label: '设计', value: 'design' } ] const OWNERSHIP_TYPE_MAJOR = '专业所' const OWNERSHIP_TYPE_COMPREHENSIVE = '综合所' const OWNERSHIP_TYPE_SUBCONTRACT = '专业分包' const CALCULATION_METHOD_GUIDANCE_PRICE = '指导价法' const CALCULATION_METHOD_CONTRACT_PRICE = '合同价法' const CALCULATION_METHOD_VIRTUAL_OUTPUT = '虚拟产值法' const VIRTUAL_METHOD_GUIDANCE_PRICE = '指导单价法' const VIRTUAL_METHOD_VIRTUAL_TOTAL_PRICE = '虚拟总价法' const VIRTUAL_METHOD_WORKING_DAY = '工日法' export const isMajorOwnership = (value?: string) => value === OWNERSHIP_TYPE_MAJOR export const isComprehensiveOwnership = (value?: string) => value === OWNERSHIP_TYPE_COMPREHENSIVE export const isSubcontractOwnership = (value?: string) => value === OWNERSHIP_TYPE_SUBCONTRACT export const isGuidancePriceMethod = (value?: string) => value === CALCULATION_METHOD_GUIDANCE_PRICE export const isContractPriceMethod = (value?: string) => value === CALCULATION_METHOD_CONTRACT_PRICE export const isVirtualOutputMethod = (value?: string) => value === CALCULATION_METHOD_VIRTUAL_OUTPUT export const isVirtualGuidanceMethod = (value?: string) => value === VIRTUAL_METHOD_GUIDANCE_PRICE export const isVirtualTotalPriceMethod = (value?: string) => value === VIRTUAL_METHOD_VIRTUAL_TOTAL_PRICE export const isWorkingDayMethod = (value?: string) => value === VIRTUAL_METHOD_WORKING_DAY export const getCalculationRatioLabel = (ownershipType?: string) => { if (isComprehensiveOwnership(ownershipType)) { return '协作比例' } if (isSubcontractOwnership(ownershipType)) { return '分包比例' } return '比例' } export const getReviewOutsourceDefaultPercent = ( ownershipType?: string, reviewOutsourceFlag?: boolean ) => { if (!reviewOutsourceFlag) { return 0 } if (isMajorOwnership(ownershipType)) { return 6 } return 25 } export const getCalculationRatioDefaultPercent = (ownershipType?: string) => { if (isComprehensiveOwnership(ownershipType)) { return 8 } if (isSubcontractOwnership(ownershipType)) { return 4 } return undefined } export const toPercentValue = (value?: number | string | null, digits = 2) => { if (value === undefined || value === null || value === '') { return undefined } const numericValue = Number(value) if (Number.isNaN(numericValue)) { return undefined } return Number((numericValue * 100).toFixed(digits)) } export const fromPercentValue = (value?: number | string | null, digits = 4) => { if (value === undefined || value === null || value === '') { return undefined } const numericValue = Number(value) if (Number.isNaN(numericValue)) { return undefined } return Number((numericValue / 100).toFixed(digits)) } export const formatAmountText = (value?: number | string | null) => { if (value === undefined || value === null || value === '') { return '0.00' } const numericValue = Number(value) if (Number.isNaN(numericValue)) { return '0.00' } return numericValue.toFixed(2) } export const formatAreaText = (value?: number | string | null) => `${formatAmountText(value)} ㎡` export const formatPercentText = (value?: number | string | null, digits = 2) => { const percentValue = toPercentValue(value, digits) return `${(percentValue ?? 0).toFixed(digits)}%` }