看板平均响应按协同分发统计;查价失败可从主账恢复;报价模板匹配与填表更稳,后台改名运营后台。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-05 18:00:08 +08:00
co-authored by Cursor
parent e95e8869a6
commit 58df358577
28 changed files with 1493 additions and 245 deletions
@@ -16,6 +16,12 @@ import {
import ProtoIcon from "/@/views/inquiry/components/ProtoIcon.vue";
import AdminModal from "/@/views/inquiry/components/AdminModal.vue";
import AdminPagination from "/@/views/inquiry/components/AdminPagination.vue";
import ExpandableClamp from "/@/views/inquiry/components/ExpandableClamp.vue";
import {
buildDemandFields,
quantitySummary,
type DemandField,
} from "/@/views/inquiry/workOrder/demandFields";
/** 单条费用明细:名称 + 带币种金额,对齐企微价格明细。 */
type TicketQuoteFee = { name: string; amount: string };
@@ -61,6 +67,8 @@ type TicketRow = {
weightKg: string;
volumeCbm: string;
goodsName: string;
/** 询价需求格子:按运输方式/运输类型变化 */
demandFields: DemandField[];
updateTime: string;
lostReason: string;
nextFollowupAt: string;
@@ -300,7 +308,8 @@ function looksLikeRawFp(v: any) {
/**
* 询价需求摘要:对齐旧后台 requirementSummaryLines。
* 首行 = 业务线 · 路线;后续 = 货量 / 品名。结构化字段优先,不信 demandDetail 管道串。
* 首行 = 业务线 · 路线;后续 = 该运输方式关心的货量 / 品名。
* 陆运整车写车型数量,海运写箱型箱量;不信 demandDetail 管道串。
*/
function requirementSummaryLines(t: any): string[] {
const businessLine = String(t?.businessLine ?? "").trim().toUpperCase();
@@ -313,37 +322,11 @@ function requirementSummaryLines(t: any): string[] {
const lines: string[] = [];
if (heading) lines.push(heading);
const isAir = businessLine === "AIR" || lineLabel.includes("空运");
const isSea = businessLine === "SEA" || lineLabel.includes("海运");
const isLand = businessLine === "LAND" || lineLabel.includes("陆运");
const quantities: string[] = [];
const pieces = t?.pieces;
const weight = t?.weightKg;
const volume = t?.volumeCbm;
const plain = (v: any) => {
if (v == null || v === "") return "";
const n = Number(v);
return Number.isFinite(n) ? String(n) : String(v).trim();
};
if (isAir) {
if (pieces != null && pieces !== "") quantities.push(`件数 ${plain(pieces)}`);
if (weight != null && weight !== "") quantities.push(`重量(KG) ${plain(weight)}kg`);
if (volume != null && volume !== "") quantities.push(`体积(CBM) ${plain(volume)}CBM`);
} else if (isSea) {
if (pieces != null && pieces !== "") quantities.push(`件数 ${plain(pieces)}`);
if (weight != null && weight !== "") quantities.push(`重量(KG) ${plain(weight)}kg`);
if (volume != null && volume !== "") quantities.push(`体积(CBM) ${plain(volume)}CBM`);
} else if (isLand) {
if (volume != null && volume !== "") quantities.push(`体积(CBM) ${plain(volume)}CBM`);
if (weight != null && weight !== "") quantities.push(`重量(KG) ${plain(weight)}kg`);
if (pieces != null && pieces !== "") quantities.push(`件数 ${plain(pieces)}`);
} else {
if (pieces != null && pieces !== "") quantities.push(`件数 ${plain(pieces)}`);
if (weight != null && weight !== "") quantities.push(`重量(KG) ${plain(weight)}kg`);
if (volume != null && volume !== "") quantities.push(`体积(CBM) ${plain(volume)}CBM`);
}
if (quantities.length) lines.push(quantities.join(" · "));
const qty = quantitySummary(t);
if (qty) lines.push(qty);
const isLand = businessLine === "LAND" || lineLabel.includes("陆运");
const isAir = businessLine === "AIR" || lineLabel.includes("空运");
const cargo: string[] = [];
const goods = String(t?.goodsName ?? "").trim();
if (goods) cargo.push(`${isLand ? "货物品名" : "品名"} ${goods}`);
@@ -418,6 +401,7 @@ function mapTicket(t: any, quotes: any[] = [], attachments: any[] = [], timeline
weightKg: fmtMeasure(t.weightKg, "kg"),
volumeCbm: fmtMeasure(t.volumeCbm, "CBM"),
goodsName: dash(t.goodsName),
demandFields: buildDemandFields(t),
updateTime: fmtTime(t.updateTime || t.createTime),
lostReason: dash(t.lostReason || t.lost_reason),
nextFollowupAt: fmtTime(t.nextFollowupAt || t.next_followup_at),
@@ -425,11 +409,8 @@ function mapTicket(t: any, quotes: any[] = [], attachments: any[] = [], timeline
};
}
function routeText(row: TicketRow) {
if (row.origin !== "-" || row.destination !== "-") {
return `${row.origin === "-" ? "" : row.origin} → ${row.destination === "-" ? "" : row.destination}`.trim();
}
return row.demandTitle || "-";
function quoteHasFees(row: TicketRow) {
return (row.quotes || []).some((q) => (q.fees || []).length > 0);
}
/** 列表询价需求第二行起:与旧后台 summary-cell 多行展示一致。 */
@@ -670,18 +651,26 @@ function refresh() {
<td class="align-top">
<span style="font-size: 12px; font-weight: 700">{{ row.initiator }}</span>
</td>
<td class="align-top">
<div class="summary-cell">
<strong>{{ row.demandTitle }}</strong>
<span
v-for="(line, idx) in demandDetailLines(row)"
:key="row.id + '-demand-' + idx"
>{{ line }}</span
>
</div>
<td class="align-top col-demand">
<ExpandableClamp :content-key="row.id + '-demand'" :max-height="132">
<div class="summary-cell">
<strong>{{ row.demandTitle }}</strong>
<span
v-for="(line, idx) in demandDetailLines(row)"
:key="row.id + '-demand-' + idx"
>{{ line }}</span
>
</div>
</ExpandableClamp>
</td>
<td class="align-top">
<template v-if="row.quotes.length">
<td class="align-top col-quote">
<ExpandableClamp
v-if="row.quotes.length"
v-slot="{ expanded }"
:content-key="row.id + '-quote-' + row.quotes.length"
:force-toggle="quoteHasFees(row)"
:clip-collapsed="false"
>
<div
v-for="q in row.quotes"
:key="q.source + q.price"
@@ -689,18 +678,20 @@ function refresh() {
style="margin-bottom: 8px"
>
<div class="quote-source">{{ q.source }}</div>
<div
v-for="(fee, fi) in q.fees"
:key="q.source + '-fee-' + fi"
class="quote-fee-line"
>
{{ fee.name }}:{{ fee.amount }}
</div>
<div class="quote-price" :style="q.highlight ? { color: '#1d4ed8' } : undefined">
{{ q.price }}
</div>
<template v-if="expanded && q.fees.length">
<div
v-for="(fee, fi) in q.fees"
:key="q.source + '-fee-' + fi"
class="quote-fee-line"
>
{{ fee.name }}:{{ fee.amount }}
</div>
</template>
</div>
</template>
</ExpandableClamp>
<span v-else style="color: #94a3b8">-</span>
</td>
<td class="align-top">
@@ -896,7 +887,12 @@ function refresh() {
<span v-else>{{ current.profit }}</span>
</div>
</div>
<div v-if="current.quotes.length" class="ticket-detail-demand">
<ExpandableClamp
v-if="current.quotes.length"
class="ticket-detail-demand"
:content-key="current.id + '-detail-quote-' + current.quotes.length"
:max-height="220"
>
<div
v-for="q in current.quotes"
:key="q.source + q.price + (q.time || '')"
@@ -922,28 +918,32 @@ function refresh() {
合计 {{ q.price }}
</div>
</div>
</div>
</ExpandableClamp>
</section>
<section class="ticket-detail-section">
<div class="ticket-detail-title">
<ProtoIcon name="route" :size="14" />询价需求
</div>
<div class="ticket-detail-demand">
<ExpandableClamp
class="ticket-detail-demand"
:content-key="current.id + '-detail-demand-' + current.demandFields.length"
:max-height="220"
>
<div class="summary-cell">
<strong>{{ current.demandTitle }}</strong>
<span v-for="(line, idx) in demandDetailLines(current)" :key="'detail-demand-' + idx">{{ line }}</span>
</div>
<div class="ticket-detail-grid" style="margin-top: 8px">
<div class="ticket-detail-item"><label>业务类型</label><span>{{ dash(current.bizType) }}</span></div>
<div class="ticket-detail-item"><label>起运 / 目的</label><span>{{ routeText(current) }}</span></div>
<div class="ticket-detail-item"><label>件数</label><span>{{ current.pieces }}</span></div>
<div class="ticket-detail-item"><label>重量(KG)</label><span>{{ current.weightKg }}</span></div>
<div class="ticket-detail-item"><label>体积(CBM)</label><span>{{ current.volumeCbm }}</span></div>
<div class="ticket-detail-item"><label>品名</label><span>{{ current.goodsName }}</span></div>
<div class="ticket-detail-item"><label>客户</label><span>{{ current.customerName }}</span></div>
<div
v-for="(item, idx) in current.demandFields"
:key="'demand-field-' + idx + '-' + item.label"
class="ticket-detail-item"
>
<label>{{ item.label }}</label><span>{{ item.value }}</span>
</div>
</div>
</div>
</ExpandableClamp>
</section>
<section class="ticket-detail-section">