feat(web-admin): enrich mp plan card with party and follower fields.
List cards need supplier→buyer and follow user to match the approved mobile demo. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8c69a01e16
commit
b3ad19f6a9
2 files changed
+45
-1
No files matched your search
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Mirrors formatPartyLine in src/utils/mp-pl-plan-card.ts — keep in sync.
|
||||
* Usage: node web-admin/scripts/check-mp-pl-plan-card.mjs
|
||||
*/
|
||||
|
||||
function formatPartyLine(supplier, buyer) {
|
||||
const s = (supplier || '').trim() || '—'
|
||||
const b = (buyer || '').trim() || '—'
|
||||
return `${s} → ${b}`
|
||||
}
|
||||
|
||||
function assert(cond, msg) {
|
||||
if (!cond) {
|
||||
console.error(msg)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
assert(formatPartyLine('安庆仓', '合肥某化') === '安庆仓 → 合肥某化', 'party')
|
||||
assert(formatPartyLine('', null) === '— → —', 'empty')
|
||||
assert(formatPartyLine(' ', undefined) === '— → —', 'whitespace')
|
||||
|
||||
// buildPlanCard supplier/buyer/partyLine defaults (mirrors TS || '—' + formatPartyLine)
|
||||
function resolveBuyer(plan) {
|
||||
return plan.customerName || plan.destinationName || '—'
|
||||
}
|
||||
assert(resolveBuyer({ customerName: 'A' }) === 'A', 'buyer customer')
|
||||
assert(resolveBuyer({ destinationName: 'B' }) === 'B', 'buyer destination')
|
||||
assert(resolveBuyer({}) === '—', 'buyer empty')
|
||||
assert(formatPartyLine(undefined, undefined) === '— → —', 'partyLine empty')
|
||||
|
||||
console.log('check-mp-pl-plan-card: ok')
|
||||
@@ -6,6 +6,12 @@ import {
|
||||
getPlPlanTypeLabel
|
||||
} from '@/utils/pl-display'
|
||||
|
||||
export function formatPartyLine(supplier?: string | null, buyer?: string | null) {
|
||||
const s = (supplier || '').trim() || '—'
|
||||
const b = (buyer || '').trim() || '—'
|
||||
return `${s} → ${b}`
|
||||
}
|
||||
|
||||
function productSummary(plan: Plan): string {
|
||||
const extra = (plan as Plan & { productSummary?: string }).productSummary
|
||||
if (extra) return extra
|
||||
@@ -20,6 +26,8 @@ function productSummary(plan: Plan): string {
|
||||
}
|
||||
|
||||
export function buildPlanCard(plan: Plan) {
|
||||
const supplier = plan.supplierName || '—'
|
||||
const buyer = plan.customerName || plan.destinationName || '—'
|
||||
return {
|
||||
id: plan.id,
|
||||
planNo: plan.planNo || '—',
|
||||
@@ -29,6 +37,10 @@ export function buildPlanCard(plan: Plan) {
|
||||
statusTagType: getPlPlanFollowStatusTagType(plan.followStatus),
|
||||
plate: formatPlVehiclePlateDisplay(plan.licensePlate, plan.trailerNo) || '—',
|
||||
people: plan.personnelSummary || '—',
|
||||
product: productSummary(plan)
|
||||
product: productSummary(plan),
|
||||
supplier,
|
||||
buyer,
|
||||
partyLine: formatPartyLine(plan.supplierName, plan.customerName || plan.destinationName),
|
||||
follower: plan.followUserName || '—'
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user