提交
This commit is contained in:
1 parent
70bdd820ce
commit
bede140d12
988 files changed
+692310
-775910
No files matched your search
@@ -24,11 +24,25 @@ export interface PlanFormProductRow {
|
||||
legalUseCertUrl?: string
|
||||
}
|
||||
|
||||
export function resolveBelongsCompany(supplierName?: string) {
|
||||
if (supplierName?.includes('安徽云栋')) return 'yundong'
|
||||
/** 从合同交易主体/甲乙方名称解析运输计划归属公司 */
|
||||
export function resolveBelongsCompany(...names: Array<string | undefined | null>) {
|
||||
const text = names.map((n) => (n || '').trim()).filter(Boolean).join(' ')
|
||||
// 与合同模板/报价一致:含「云栋」视为安徽云栋,否则默认安庆山峡
|
||||
if (text.includes('云栋')) return 'yundong'
|
||||
return 'shanxia'
|
||||
}
|
||||
|
||||
/** 优先取交易主体名称;缺失时从甲/乙方中识别我方主体 */
|
||||
export function resolveTradingEntityName(contract: Pick<ContractVO, 'supplierName' | 'partyA' | 'partyB'>) {
|
||||
const supplierName = (contract.supplierName || '').trim()
|
||||
if (supplierName) return supplierName
|
||||
for (const name of [contract.partyA, contract.partyB]) {
|
||||
const n = (name || '').trim()
|
||||
if (n && (n.includes('山峡') || n.includes('云栋'))) return n
|
||||
}
|
||||
return (contract.partyA || '').trim()
|
||||
}
|
||||
|
||||
export function mapContractProductToPlanRow(item: ContractProductForm, index: number): PlanFormProductRow {
|
||||
const productId = String(item.productId || item.id || index)
|
||||
return {
|
||||
@@ -65,7 +79,8 @@ export function applyContractToPlanForm(contract: ContractVO) {
|
||||
return {
|
||||
contractId: String(contract.id),
|
||||
contractNo: contract.contractNo,
|
||||
belongsCompany: resolveBelongsCompany(contract.supplierName || contract.partyA),
|
||||
// 归属公司从合同交易主体带出,表单仍允许用户手动改
|
||||
belongsCompany: resolveBelongsCompany(resolveTradingEntityName(contract)),
|
||||
supplierId: contract.supplierId != null ? String(contract.supplierId) : '',
|
||||
supplierName,
|
||||
destinationId: contract.customerId != null ? String(contract.customerId) : '',
|
||||
|
||||
Reference in new issue
Block a user