协同群改为智价通BOT接管对话,报价单按需生成;补客户名称、计费重与陆运报价条件
为什么改:应用建的协同群只能代答,销售在群里发文件、@人、问报价都对不上人; 本次把群对话交给智价通BOT,应用只负责拉群和解散群,并把几处销售已反馈的口径补齐。 群与身份: - 新增 group_bot 短协调(Redis 带环境前缀):记录 BOT 已接管群、当前关联工单、 @BOT 指令窗口与窗口外先到的附件,只做协调不当六态,六态仍在主账。 - 群里没有 @BOT 的文字不回;非 @ 文字断开当前单关联,之后必须重新 @BOT 带工单号。 - 先发文件再 @BOT 也认:窗口外附件先缓冲,等 @BOT 认领后补办。 - 会话存档只补附件、不重复办理 BOT 已办的同一句文字,避免同一条消息回两遍。 - 入站 from.userid 是加密 open_userid 时按官方接口换明文(带 Redis 缓存), 否则与主账 sales_wecom_id 永远比不上,航线本人会被判成「不是本人」。 - 桥侧只认本群 req_id,不再借用别的群 req_id,避免测服把话发进别的群。 报价单: - 建群后只发字段摘要和成交卡,Excel/PDF 等群里 @BOT 说「生成报价单」再出; 多段逐段出,没价出空白表;出表后补推成交跟进不涨 deal_version、不重置等待计时。 - 陆运转人工先选业务类型和报价场景再建群,按选定模板名直取,不再靠关键词猜。 - 空运舱位只回一条时直接出该条报价,不再发选择卡。 字段与金额: - 客户名称改为海/空/陆询价非必填,有值写回工单列,后台列表、报价单与 factsJson 一致。 - 空运新增计费重投影:体积重=CBM×166.7,计费重=max(毛重,体积重); TMS 无价、航线手工按 KG 报价时按计费重×单价算整票金额,群摘要与报价单同公式。 - 陆运报价附加条件统一到 land_quote_condition:未含税/含0税/未含燃油/含燃油费, 燃油只乘主运费,不乘提货送货报关等杂费;跨境整车无备注列时追加到底部备注事项。 - 海运拼柜不适用箱型箱量:不进必填、不进补问、不出站,改回整柜可再用。 - 海运提货地址/派送地址改为非必填,写了才出站(placeOfReceipt/deliveryAddress), 禁止从港口或贸易条款反推地址;TMS 查不到价时把 TMS 原话透给销售。 - 中港集拼与跨境集拼同口径:按体积+毛重,不采车型数量;修正被国内拼车别名抢单。 - 报关费区只收报关类费目;口岸海关监管费+接驳费按车型列回填固定行。 主账与后台: - 看板处理量按协同群处理人统计;下线「平均报价销售额」;处理人搜索先把姓名换回企微 id。 - 「转人工」筛选同时兼容旧六态与新 collab_mode=handoff,新版单不再漏。 - 报价单客户名称、提货/派送地址、空运计费重、拼柜空箱型按新口径填表。 - 新增协同成员查询支持与 AIR_NEED_WO v2 迁移脚本。 文档:04 补海运/空运/陆运必填与地址口径,10 补地址出站规则,12 补测服独立应用 1000015 的部署与切换记录。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -410,7 +410,7 @@ onUnmounted(() => document.removeEventListener("click", onDocClick));
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<!-- 1. 九指标 -->
|
||||
<!-- 1. 八指标(平均报价销售额已下线) -->
|
||||
<div class="ref-surface ref-surface--metrics">
|
||||
<div class="ref-header ref-header--compact">
|
||||
<div>
|
||||
|
||||
@@ -31,12 +31,11 @@ export type CostRoute = {
|
||||
points: Array<{ x: number; y: number; index: number }>;
|
||||
};
|
||||
|
||||
/** 今日视角九指标(与原型 5 列栅格、主账 InquiryDashboardServiceImpl 一致) */
|
||||
/** 今日视角八指标(与主账 InquiryDashboardServiceImpl 一致;「平均报价销售额」已下线) */
|
||||
export const todayMetrics: MetricCard[] = [
|
||||
{ key: "inquiry", label: "询价总量", tip: "周期内询价工单总数", value: "128" },
|
||||
{ key: "quoted", label: "报价工单", tip: "已报价工单数(已报价 + 议价中 + 已成交 + 未成交)", value: "92 单" },
|
||||
{ key: "tms", label: "标准报价命中率", tip: "命中 TMS 标准价的询价数 ÷ 询价总数 × 100%", value: "67.8%" },
|
||||
{ key: "avgSale", label: "平均报价销售额", tip: "AVG(已勾选报价的销售价)", value: "12800" },
|
||||
{ key: "manual", label: "手工工单占比", tip: "人工报价的询价数 ÷ 询价总数 × 100%", value: "32.0%" },
|
||||
{ key: "pending", label: "待处理工单", tip: "工单总数 − 已成交 − 未成交 − 已关闭", value: "39 单" },
|
||||
{ key: "dealRate", label: "报价成功率", tip: "已成交数 ÷ 已报价数 × 100%", value: "34.8%" },
|
||||
|
||||
@@ -677,6 +677,7 @@ body {
|
||||
.ticket-list-table .col-w-ex { width: 110px; }
|
||||
.ticket-list-table .col-w-reason { width: 140px; }
|
||||
.ticket-list-table .col-w-time { width: 132px; }
|
||||
.ticket-list-table .col-w-handler { width: 96px; }
|
||||
.ticket-list-table .col-w-actions { width: 196px; }
|
||||
|
||||
.ticket-list-table th.col-sticky-left,
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
* 工单详情「询价需求」格子:按运输方式 + 陆运运输类型展示不同必填项。
|
||||
*
|
||||
* 口径对齐销售侧询价确认卡(inquiry_field_lines):
|
||||
* 空运看件数/重量/体积/包装;海运看货量/整柜拼柜/箱型箱量;
|
||||
* 陆运拼车看体积重量,整车/中港零担看车型数量,中港整车不强制车型。
|
||||
* 空运看件数/重量/体积/包装;海运看货量/整柜拼柜/箱型箱量(拼柜隐藏箱型箱量);
|
||||
* 陆运拼车与中港集拼看体积重量,国内整车/跨境整车看车型数量,中港整车不强制车型。
|
||||
* 中港零担/集拼(销售侧中港集拼)按体积+毛重计费,所以展示体积/重量而不是车型/数量。
|
||||
* 只做展示,不改六态、不写主账。
|
||||
*/
|
||||
|
||||
/** 详情格子一行:标签 + 值(空则「-」) */
|
||||
export type DemandField = { label: string; value: string };
|
||||
|
||||
const LAND_FTL_TYPES = new Set(["国内运输整车", "跨境整车", "中港零担/集拼"]);
|
||||
/** 只收「车型/数量」口径的陆运类型;中港集拼按体积毛重,不在此列。 */
|
||||
const LAND_FTL_TYPES = new Set(["国内运输整车", "跨境整车"]);
|
||||
const LAND_CUSTOMS_TYPES = new Set(["跨境集拼", "跨境整车", "中港整车", "中港零担/集拼"]);
|
||||
|
||||
const LAND_LABEL: Record<string, string> = {
|
||||
@@ -101,7 +103,8 @@ export function multiSegmentViews(ticket: any): MultiSegmentView[] {
|
||||
const extras = [
|
||||
pick(sf, "运输条款", "贸易条款"),
|
||||
pick(sf, "整柜或拼柜"),
|
||||
pick(sf, "箱型箱量"),
|
||||
// 拼柜不指定箱型:段详情不写箱型(产品口径 2026-11-22)。
|
||||
isSeaLcl(pick(sf, "整柜或拼柜")) ? "" : pick(sf, "箱型箱量"),
|
||||
pick(sf, "包装方式", "包装类型"),
|
||||
pick(sf, "运输类型"),
|
||||
pick(sf, "客户"),
|
||||
@@ -229,6 +232,7 @@ function landCargoKeys(landType: string): string[] {
|
||||
if (LAND_FTL_TYPES.has(landType)) {
|
||||
return ["起运港", "目的港", "品名", "车型/数量", "报价日期"];
|
||||
}
|
||||
// 拼车、跨境集拼、中港集拼:体积 + 毛重。
|
||||
return ["起运港", "目的港", "品名", "体积", "毛重", "报价日期"];
|
||||
}
|
||||
|
||||
@@ -236,6 +240,20 @@ function push(fields: DemandField[], label: string, value: string) {
|
||||
fields.push({ label, value: dash(value) });
|
||||
}
|
||||
|
||||
/** 「整柜或拼柜」是否拼柜(散货/LCL)。否定说法「非拼柜/不拼柜」按整柜处理。 */
|
||||
export function isSeaLcl(load: unknown): boolean {
|
||||
const text = String(load ?? "").trim().toLowerCase();
|
||||
if (!text) return false;
|
||||
// 模型偶尔把字段名本身当值(整柜或拼柜 / 整柜/拼柜):未定,不当拼柜。
|
||||
const compact = text.replace(/\s+/g, "");
|
||||
if (["整柜或拼柜", "整柜/拼柜", "整柜拼柜"].includes(compact)) return false;
|
||||
if (/(非|不|无需|不用|免)\s*拼/.test(text)) return false;
|
||||
if (text.includes("整柜") && !text.includes("拼柜") && !text.includes("拼箱") && !text.includes("散货")) {
|
||||
return false;
|
||||
}
|
||||
return text.includes("拼柜") || text.includes("拼箱") || text.includes("散货") || text.includes("lcl");
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单详情询价需求格子。
|
||||
* 列字段(origin / pieces / containerSpec 等)作 facts 空时的兜底,兼容旧单。
|
||||
@@ -259,11 +277,26 @@ export function buildDemandFields(ticket: any): DemandField[] {
|
||||
push(fields, "目的港", dest);
|
||||
push(fields, "品名", goods);
|
||||
push(fields, "货物数量", pick(facts, "货量", "货物数量", "件数") || columnText(ticket?.cargoQty) || columnText(ticket?.pieces));
|
||||
push(fields, "整柜或拼柜", pick(facts, "整柜或拼柜") || columnText(ticket?.fclLcl));
|
||||
push(fields, "箱型箱量", pick(facts, "箱型箱量") || columnText(ticket?.containerSpec));
|
||||
const seaLoad = pick(facts, "整柜或拼柜") || columnText(ticket?.fclLcl);
|
||||
push(fields, "整柜或拼柜", seaLoad);
|
||||
// 拼柜按体积计费、承运人不指定箱型:箱型箱量整行不出现(产品口径 2026-11-22)。
|
||||
// 旧单若留着箱型值也不展示,避免销售以为拼柜还要填箱型。
|
||||
if (!isSeaLcl(seaLoad)) {
|
||||
push(fields, "箱型箱量", pick(facts, "箱型箱量") || columnText(ticket?.containerSpec));
|
||||
}
|
||||
push(fields, "贸易条款", pick(facts, "贸易条款"));
|
||||
push(fields, "运输分类", pick(facts, "运输分类"));
|
||||
push(fields, "报价日期", quoteDate);
|
||||
// 海运提货地址 / 海运派送地址:非必填,有值才占一行。
|
||||
// 内部键沿用提货地址/收货地址,派送地址、送货地址同义(与空运、陆运共用)。
|
||||
const pickup = pick(facts, "提货地址", "海运提货地址");
|
||||
if (pickup) {
|
||||
push(fields, "提货地址", pickup);
|
||||
}
|
||||
const delivery = pick(facts, "收货地址", "派送地址", "送货地址", "海运派送地址");
|
||||
if (delivery) {
|
||||
push(fields, "派送地址", delivery);
|
||||
}
|
||||
} else if (line === "LAND") {
|
||||
const landType = pick(facts, "运输类型");
|
||||
push(fields, "运输类型", landType);
|
||||
@@ -350,7 +383,7 @@ export function buildDemandFields(ticket: any): DemandField[] {
|
||||
if (vehicle) push(fields, "车型/数量", vehicle);
|
||||
}
|
||||
|
||||
push(fields, "客户", customer);
|
||||
push(fields, "客户名称", customer);
|
||||
return fields;
|
||||
}
|
||||
|
||||
@@ -368,8 +401,12 @@ export function quantitySummary(ticket: any): string {
|
||||
};
|
||||
if (line === "SEA") {
|
||||
add("货物数量", pick(facts, "货量", "货物数量") || columnText(ticket?.cargoQty));
|
||||
add("整柜或拼柜", pick(facts, "整柜或拼柜") || columnText(ticket?.fclLcl));
|
||||
add("箱型箱量", pick(facts, "箱型箱量") || columnText(ticket?.containerSpec));
|
||||
const seaLoad = pick(facts, "整柜或拼柜") || columnText(ticket?.fclLcl);
|
||||
add("整柜或拼柜", seaLoad);
|
||||
// 拼柜没有箱型:列表第二行也不写「箱型箱量 -」。
|
||||
if (!isSeaLcl(seaLoad)) {
|
||||
add("箱型箱量", pick(facts, "箱型箱量") || columnText(ticket?.containerSpec));
|
||||
}
|
||||
return parts.join(" · ");
|
||||
}
|
||||
if (line === "LAND") {
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
type DemandField,
|
||||
type MultiSegmentView,
|
||||
} from "/@/views/inquiry/workOrder/demandFields";
|
||||
import { stripMentionFromRawQuote } from "/@/views/inquiry/workOrder/quoteRawText";
|
||||
import { usePermission } from "/@/hooks/web/usePermission";
|
||||
import { InquiryBtnPerm } from "/@/views/inquiry/shared/inquiryPagePerms";
|
||||
|
||||
@@ -142,6 +143,11 @@ type TicketRow = {
|
||||
* 旧单没有这一列,主账返回空,界面不显示该格。
|
||||
*/
|
||||
collabMode: string;
|
||||
/**
|
||||
* 处理人姓名(可多个):协同群里的航线·空运 / 产品·海运 / 产品·陆运。
|
||||
* 未建群或群里没有产品时为空数组,列表显示「—」。
|
||||
*/
|
||||
handlers: string[];
|
||||
/** 父行询价需求:不含段1/段2(段已下沉到子工单) */
|
||||
multiParentDetail: string;
|
||||
/**
|
||||
@@ -489,7 +495,7 @@ function looksLikeRawFp(v: any) {
|
||||
/**
|
||||
* 询价需求摘要:对齐旧后台 requirementSummaryLines。
|
||||
* 首行 = 业务线 · 路线;后续 = 该运输方式关心的货量 / 品名。
|
||||
* 陆运整车写车型数量,海运写箱型箱量;不信 demandDetail 管道串。
|
||||
* 陆运整车写车型数量,海运写箱型箱量(拼柜不写);不信 demandDetail 管道串。
|
||||
*/
|
||||
function requirementSummaryLines(t: any): string[] {
|
||||
const businessLine = String(t?.businessLine ?? "").trim().toUpperCase();
|
||||
@@ -758,9 +764,18 @@ function mapTicket(t: any, quotes: any[] = [], attachments: any[] = [], timeline
|
||||
multiParentDetail,
|
||||
multiParentAttachRows,
|
||||
collabMode: String(t.collabMode || t.collab_mode || "").trim(),
|
||||
handlers: Array.isArray(t.handlers)
|
||||
? t.handlers.map((n: any) => String(n || "").trim()).filter(Boolean)
|
||||
: [],
|
||||
};
|
||||
}
|
||||
|
||||
/** 列表/详情展示处理人:多人顿号拼接;没有则「—」。 */
|
||||
function handlersDisplay(names: string[] | undefined | null): string {
|
||||
const list = (names || []).map((n) => String(n || "").trim()).filter(Boolean);
|
||||
return list.length ? list.join("、") : "—";
|
||||
}
|
||||
|
||||
/** 报价金额是否有实质内容(排除空与单独的「-」)。 */
|
||||
function quotePriceUseful(price: string): boolean {
|
||||
const p = String(price || "").trim();
|
||||
@@ -821,7 +836,22 @@ function collabModeLabel(mode: string): string {
|
||||
return "";
|
||||
}
|
||||
|
||||
/** 产品原话来源标签;只认识主账约定的四种,其它原样显示。 */
|
||||
/**
|
||||
* 这一单是不是「转人工」(销售转人工、产品群内手工报价)。
|
||||
*
|
||||
* 为什么两个条件都认:
|
||||
* - 新版用 collab_mode=handoff 表达,六态照常走「询价中 → 已报价」;
|
||||
* - 老版把「转人工」直接写成六态终态,迁移只是把老单的 collab_mode 一并刷成 handoff,
|
||||
* 但更早的数据/其他环境未必执行过迁移。
|
||||
* 只认一个都会让一部分单在列表上丢掉标签,所以状态与协同模式取并集。
|
||||
*/
|
||||
function isHandoffTicket(row: TicketRow | null): boolean {
|
||||
if (!row) return false;
|
||||
if (String(row.collabMode || "").trim().toLowerCase() === "handoff") return true;
|
||||
return String(row.status || "").trim() === "转人工";
|
||||
}
|
||||
|
||||
/** 原始报价参考的来源标签;只认识主账约定的四种,其它原样显示。 */
|
||||
function rawSourceLabel(src: string): string {
|
||||
const s = String(src || "").trim().toLowerCase();
|
||||
if (s === "text") return "文字";
|
||||
@@ -832,15 +862,17 @@ function rawSourceLabel(src: string): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情「产品报价原话」:只取主账留了 rawText 的报价。
|
||||
* 详情「原始报价参考」:只取主账留了 rawText 的报价。
|
||||
* 一段话重复落多条报价时(改价/补版本)只留最近一条相同文本,避免后台刷屏。
|
||||
* 展示前用 stripMentionFromRawQuote 去掉开头的「@机器人」称呼:
|
||||
* @ 是叫机器人的称呼,不是报价内容(产品 2026-11-22 口径);库里的原话保持不动。
|
||||
*/
|
||||
function quoteRawRows(row: TicketRow | null) {
|
||||
if (!row) return [];
|
||||
const seen = new Set<string>();
|
||||
const out: { key: string; source: string; time: string; kind: string; raw: string }[] = [];
|
||||
for (const q of row.quotes || []) {
|
||||
const raw = String(q.rawText || "").trim();
|
||||
const raw = stripMentionFromRawQuote(String(q.rawText || "").trim());
|
||||
if (!raw || seen.has(raw)) continue;
|
||||
seen.add(raw);
|
||||
out.push({
|
||||
@@ -1068,7 +1100,7 @@ async function exportTickets() {
|
||||
<div class="toolbar">
|
||||
<div class="search">
|
||||
<ProtoIcon class="search-icon" name="search" :size="16" />
|
||||
<input v-model="filters.keyword" placeholder="搜索工单号、销售、路线..." />
|
||||
<input v-model="filters.keyword" placeholder="搜索工单号、销售、处理人、路线..." />
|
||||
</div>
|
||||
<select v-model="filters.status">
|
||||
<option value="">状态 · 全部</option>
|
||||
@@ -1130,6 +1162,7 @@ async function exportTickets() {
|
||||
<col class="col-w-ex" />
|
||||
<col class="col-w-ex" />
|
||||
<col class="col-w-reason" />
|
||||
<col class="col-w-handler" />
|
||||
<col class="col-w-time" />
|
||||
<col class="col-w-actions" />
|
||||
</colgroup>
|
||||
@@ -1147,16 +1180,17 @@ async function exportTickets() {
|
||||
<th class="col-center">事件异常</th>
|
||||
<th>系统异常</th>
|
||||
<th>系统异常原因</th>
|
||||
<th>处理人</th>
|
||||
<th>创建时间</th>
|
||||
<th class="col-actions col-sticky-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="loading">
|
||||
<td colspan="14" style="text-align: center; color: #94a3b8">加载中…</td>
|
||||
<td colspan="15" style="text-align: center; color: #94a3b8">加载中…</td>
|
||||
</tr>
|
||||
<tr v-else-if="!rows.length">
|
||||
<td colspan="14" style="text-align: center; color: #94a3b8">暂无工单</td>
|
||||
<td colspan="15" style="text-align: center; color: #94a3b8">暂无工单</td>
|
||||
</tr>
|
||||
<template v-for="row in rows" :key="row.id">
|
||||
<!-- 多段联运:父行摘要 + 灰底子工单(对齐原型) -->
|
||||
@@ -1166,6 +1200,8 @@ async function exportTickets() {
|
||||
<button class="ticket-no" type="button" @click="openDetail(row)">
|
||||
{{ row.id }}
|
||||
</button>
|
||||
<!-- 转人工标签:工单号下方,仅转人工单出现;六态照常,所以只能靠标签区分 -->
|
||||
<span v-if="isHandoffTicket(row)" class="tag tag-violet ticket-handoff-tag">转人工</span>
|
||||
</td>
|
||||
<td class="align-top" :rowspan="multiRowSpan(row)">
|
||||
<span class="ticket-multi-initiator">{{ row.initiator }}</span>
|
||||
@@ -1227,6 +1263,14 @@ async function exportTickets() {
|
||||
>
|
||||
<span v-else class="ticket-multi-muted">—</span>
|
||||
</td>
|
||||
<!-- 处理人:跟工单绑定,父子行合并;放在创建时间前面 -->
|
||||
<td class="align-top" :rowspan="multiRowSpan(row)">
|
||||
<span
|
||||
class="ticket-handlers"
|
||||
:class="{ 'is-empty': !row.handlers.length }"
|
||||
>{{ handlersDisplay(row.handlers) }}</span
|
||||
>
|
||||
</td>
|
||||
<td class="align-top" style="white-space: nowrap; font-size: 12px; color: #334155">
|
||||
{{ row.createdAt }}
|
||||
</td>
|
||||
@@ -1330,6 +1374,8 @@ async function exportTickets() {
|
||||
<button class="ticket-no" type="button" @click="openDetail(row)">
|
||||
{{ row.id }}
|
||||
</button>
|
||||
<!-- 转人工标签:工单号下方,仅转人工单出现;六态照常,所以只能靠标签区分 -->
|
||||
<span v-if="isHandoffTicket(row)" class="tag tag-violet ticket-handoff-tag">转人工</span>
|
||||
</td>
|
||||
<td class="align-top">
|
||||
<span style="font-size: 12px; font-weight: 700">{{ row.initiator }}</span>
|
||||
@@ -1460,6 +1506,13 @@ async function exportTickets() {
|
||||
row.systemExceptionReason
|
||||
}}</span>
|
||||
</td>
|
||||
<td class="align-top">
|
||||
<span
|
||||
class="ticket-handlers"
|
||||
:class="{ 'is-empty': !row.handlers.length }"
|
||||
>{{ handlersDisplay(row.handlers) }}</span
|
||||
>
|
||||
</td>
|
||||
<td class="align-top" style="white-space: nowrap; font-size: 12px; color: #334155">
|
||||
{{ row.createdAt }}
|
||||
</td>
|
||||
@@ -1538,6 +1591,7 @@ async function exportTickets() {
|
||||
<div class="ticket-detail-grid">
|
||||
<div class="ticket-detail-item"><label>工单号</label><span>{{ current.id }}</span></div>
|
||||
<div class="ticket-detail-item"><label>发起销售</label><span>{{ current.initiator }}</span></div>
|
||||
<div class="ticket-detail-item"><label>处理人</label><span>{{ handlersDisplay(current.handlers) }}</span></div>
|
||||
<div class="ticket-detail-item"><label>业务类型</label><span>{{ dash(current.bizType) }}</span></div>
|
||||
<div v-if="collabModeLabel(current.collabMode)" class="ticket-detail-item">
|
||||
<label>协同方式</label><span>{{ collabModeLabel(current.collabMode) }}</span>
|
||||
@@ -1661,7 +1715,7 @@ async function exportTickets() {
|
||||
|
||||
<section v-if="quoteRawRows(current).length" class="ticket-detail-section">
|
||||
<div class="ticket-detail-title">
|
||||
<ProtoIcon name="chat" :size="14" />产品报价原话
|
||||
<ProtoIcon name="chat" :size="14" />原始报价参考
|
||||
</div>
|
||||
<div class="ticket-raw-quote-list">
|
||||
<div
|
||||
@@ -1802,6 +1856,28 @@ async function exportTickets() {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 转人工标签:贴在工单号下方一行,不挤占工单号的点击区域 */
|
||||
.ticket-handoff-tag {
|
||||
/* .tag 默认 inline-flex;这里改成独占一行,宽度跟随文字 */
|
||||
display: flex;
|
||||
width: fit-content;
|
||||
margin-top: 4px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
/* 处理人:可多人,顿号拼接;空值灰色占位 */
|
||||
.ticket-handlers {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
line-height: 1.45;
|
||||
word-break: break-word;
|
||||
}
|
||||
.ticket-handlers.is-empty {
|
||||
color: #94a3b8;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 多段联运:父行摘要 + 灰底子工单(子行禁止被 :first-child/:last-child 粘列刷成白底) */
|
||||
.ticket-multi-parent td {
|
||||
border-bottom-color: transparent;
|
||||
@@ -1973,7 +2049,7 @@ async function exportTickets() {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* 详情「产品报价原话」:只读留档块,长句自动换行,不抢报价金额的视觉权重 */
|
||||
/* 详情「原始报价参考」:只读留档块,长句自动换行,不抢报价金额的视觉权重 */
|
||||
.ticket-raw-quote-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 后台「原始报价参考」展示清洗。
|
||||
*
|
||||
* 主账 inq_quote.raw_text 存的是产品在群里发的原话,为了审计原样保留,
|
||||
* 里面常以「@机器人」开头(例:`@智价通AIQ测试 1:300,+500,USD11/kg…`)。
|
||||
* @机器人 是叫机器人的称呼,不是报价内容;后台这一栏是给人看的,
|
||||
* 展示前把称呼去掉,但**保留原话的换行与其它字句**,不改库、不改主账契约。
|
||||
* 只做展示,不参与解析、不改六态。
|
||||
*/
|
||||
|
||||
/** 全角 @ 统一成半角,企微客户端输入法可能给全角。 */
|
||||
function normalizeAt(text: string): string {
|
||||
return String(text || "").replace(/@/g, "@");
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉一行开头的 @称呼。
|
||||
*
|
||||
* 为什么整段剥而不是按名字替换:群里显示名可能比后台配置名更长
|
||||
* (测服真机:配置名「智价通AIQ」,群里是「智价通AIQ测试」),
|
||||
* 只按配置名切会留下「测试」两个残字。
|
||||
* 称呼后面必须有空白或行尾才算称呼,避免把 `@aaa@bbb` 这类中间粘住的文字误切。
|
||||
*/
|
||||
function stripLineMention(line: string): string {
|
||||
let rest = line;
|
||||
// 可能连续 @ 多人(@张三 @机器人),逐个剥。
|
||||
// 称呼遇到标点(逗号/顿号/冒号/分号)就算结束:报价原话常写「@机器人,运输费USD3200」,
|
||||
// 若只按空白结尾,会把整句价格一起当成名字切掉。
|
||||
for (;;) {
|
||||
const hit = rest.match(/^\s*@[^\s,,;;、::]+[\s]*/);
|
||||
if (!hit) break;
|
||||
rest = rest.slice(hit[0].length);
|
||||
}
|
||||
// 称呼后面常紧跟逗号/顿号(「@机器人,1:300」),一并去掉,别让人读到半句。
|
||||
return rest.replace(/^[,,;;、::\s]+/, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 原话展示清洗:逐行去开头的 @称呼,保留行结构与其它内容。
|
||||
*
|
||||
* 返回空串表示这一行没有可展示的报价内容(例如整行只有 @机器人),调用方跳过。
|
||||
* 副作用:无。纯函数,可在单测里直接断言。
|
||||
*/
|
||||
export function stripMentionFromRawQuote(raw: string): string {
|
||||
const text = normalizeAt(raw);
|
||||
if (!text.trim()) return "";
|
||||
const lines = text.split(/\r?\n/);
|
||||
const out: string[] = [];
|
||||
for (const line of lines) {
|
||||
const clean = stripLineMention(line).replace(/[ \t]+$/, "");
|
||||
if (clean.trim()) out.push(clean);
|
||||
}
|
||||
return out.join("\n").trim();
|
||||
}
|
||||
@@ -1 +1,114 @@
|
||||
/**
|
||||
* 工单需求字段展示单测:海运拼柜隐藏箱型箱量(产品口径 2026-11-22)。
|
||||
* 拼柜按体积计费,承运人不指定箱型,所以格子、列表第二行、多段详情都不出现箱型。
|
||||
*/
|
||||
import { buildDemandFields, isSeaLcl, quantitySummary, multiSegmentViews } from '/@/views/inquiry/workOrder/demandFields';
|
||||
|
||||
function labelsOf(fields: { label: string }[]): string[] {
|
||||
return fields.map((f) => f.label);
|
||||
}
|
||||
|
||||
test('isSeaLcl 识别拼柜口语,否定说法按整柜', () => {
|
||||
['拼柜', '拼箱', '散货', 'LCL', 'lcl 拼箱'].forEach((v) => expect(isSeaLcl(v)).toBe(true));
|
||||
['整柜', '非拼柜', '不拼柜', '', null, undefined, 'FCL'].forEach((v) =>
|
||||
expect(isSeaLcl(v as string)).toBe(false),
|
||||
);
|
||||
});
|
||||
|
||||
test('海运拼柜:需求格子不列箱型箱量', () => {
|
||||
const ticket = {
|
||||
businessLine: 'SEA',
|
||||
origin: '上海',
|
||||
destination: '洛杉矶',
|
||||
goodsName: '普货',
|
||||
factsJson: JSON.stringify({
|
||||
起运港: '上海',
|
||||
目的港: '洛杉矶',
|
||||
品名: '普货',
|
||||
货量: '20吨',
|
||||
整柜或拼柜: '拼柜',
|
||||
箱型箱量: '1x40HQ',
|
||||
贸易条款: '门到门',
|
||||
}),
|
||||
};
|
||||
const labels = labelsOf(buildDemandFields(ticket));
|
||||
expect(labels).toContain('整柜或拼柜');
|
||||
expect(labels).not.toContain('箱型箱量');
|
||||
});
|
||||
|
||||
test('海运整柜:需求格子保留箱型箱量', () => {
|
||||
const ticket = {
|
||||
businessLine: 'SEA',
|
||||
factsJson: JSON.stringify({
|
||||
起运港: '上海',
|
||||
目的港: '洛杉矶',
|
||||
品名: '普货',
|
||||
货量: '20吨',
|
||||
整柜或拼柜: '整柜',
|
||||
箱型箱量: '1x40HQ',
|
||||
贸易条款: '门到门',
|
||||
}),
|
||||
};
|
||||
const fields = buildDemandFields(ticket);
|
||||
expect(labelsOf(fields)).toContain('箱型箱量');
|
||||
expect(fields.find((f) => f.label === '箱型箱量')?.value).toBe('1x40HQ');
|
||||
});
|
||||
|
||||
test('海运拼柜:列表第二行不写箱型', () => {
|
||||
const ticket = {
|
||||
businessLine: 'SEA',
|
||||
factsJson: JSON.stringify({
|
||||
货量: '20吨',
|
||||
整柜或拼柜: '拼柜',
|
||||
箱型箱量: '1x40HQ',
|
||||
}),
|
||||
};
|
||||
const summary = quantitySummary(ticket);
|
||||
expect(summary).toContain('整柜或拼柜 拼柜');
|
||||
expect(summary).not.toContain('箱型箱量');
|
||||
});
|
||||
|
||||
test('多段里海运段是拼柜时不显示箱型', () => {
|
||||
const ticket = {
|
||||
businessLine: 'MULTI',
|
||||
factsJson: JSON.stringify({
|
||||
segments_json: JSON.stringify([
|
||||
{
|
||||
mode: 'SEA',
|
||||
facts: { 起运港: '上海', 目的港: '洛杉矶', 整柜或拼柜: '拼柜', 箱型箱量: '1x40HQ' },
|
||||
},
|
||||
]),
|
||||
}),
|
||||
};
|
||||
const views = multiSegmentViews(ticket);
|
||||
expect(views.length).toBeGreaterThan(0);
|
||||
expect(views[0].detailLine).not.toContain('1x40HQ');
|
||||
expect(views[0].detailLine).toContain('拼柜');
|
||||
});
|
||||
|
||||
test('中港集拼:需求格子看体积毛重,不看车型/数量', () => {
|
||||
const ticket = {
|
||||
businessLine: 'LAND',
|
||||
factsJson: JSON.stringify({
|
||||
运输类型: '中港零担/集拼',
|
||||
线路类别: '中港/中亚/中欧',
|
||||
运输分类: '普件(东南亚、中港常用线路/常规车型)',
|
||||
起运港: '广州',
|
||||
目的港: '香港',
|
||||
品名: '衣服',
|
||||
体积: '20CBM',
|
||||
毛重: '3000KG',
|
||||
}),
|
||||
};
|
||||
const fields = buildDemandFields(ticket);
|
||||
const labels = labelsOf(fields);
|
||||
expect(labels).toContain('体积(CBM)');
|
||||
expect(labels).toContain('重量(KG)');
|
||||
expect(labels).not.toContain('车型/数量');
|
||||
expect(fields.find((f) => f.label === '体积(CBM)')?.value).toBe('20CBM');
|
||||
expect(fields.find((f) => f.label === '重量(KG)')?.value).toBe('3000KG');
|
||||
const summary = quantitySummary(ticket);
|
||||
expect(summary).toContain('体积(CBM) 20CBM');
|
||||
expect(summary).toContain('重量(KG) 3000KG');
|
||||
expect(summary).not.toContain('车型/数量');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 后台「原始报价参考」展示清洗单测(产品口径 2026-11-22)。
|
||||
* 库里原话保留 @机器人 以便审计,后台这一栏展示前把称呼去掉。
|
||||
*/
|
||||
import { stripMentionFromRawQuote } from '/@/views/inquiry/workOrder/quoteRawText';
|
||||
|
||||
test('去掉开头的 @机器人,保留原话', () => {
|
||||
expect(
|
||||
stripMentionFromRawQuote('@智价通AIQ测试 1:300,+500,USD11/kg,卡转/MUST GO、TH'),
|
||||
).toBe('1:300,+500,USD11/kg,卡转/MUST GO、TH');
|
||||
});
|
||||
|
||||
test('称呼后紧跟逗号也一并去掉', () => {
|
||||
expect(stripMentionFromRawQuote('@智价通AIQ,运输费USD3200')).toBe('运输费USD3200');
|
||||
});
|
||||
|
||||
test('全角 @ 与连续 @ 多人', () => {
|
||||
expect(stripMentionFromRawQuote('@智价通AIQ @会话存档-机器人 东莞-春疆,7.6米CNY13000元')).toBe(
|
||||
'东莞-春疆,7.6米CNY13000元',
|
||||
);
|
||||
});
|
||||
|
||||
test('多行原话保留换行与行内内容', () => {
|
||||
expect(
|
||||
stripMentionFromRawQuote('@智价通AIQ\n空运费:USD11/kg\n报价有效期:2026-11-23'),
|
||||
).toBe('空运费:USD11/kg\n报价有效期:2026-11-23');
|
||||
});
|
||||
|
||||
test('只有 @机器人 的行不输出空行', () => {
|
||||
expect(stripMentionFromRawQuote('@智价通AIQ\n\n1:300')).toBe('1:300');
|
||||
});
|
||||
|
||||
test('没有称呼的原话原样返回', () => {
|
||||
const raw = '春疆-罗勇,45HQ,运输费USD3200,报关费cny1400';
|
||||
expect(stripMentionFromRawQuote(raw)).toBe(raw);
|
||||
expect(stripMentionFromRawQuote('')).toBe('');
|
||||
expect(stripMentionFromRawQuote(' ')).toBe('');
|
||||
});
|
||||
|
||||
test('句子中间的 @ 不当称呼切掉', () => {
|
||||
const raw = '客户@某某 要求 11月23日走';
|
||||
expect(stripMentionFromRawQuote(raw)).toBe(raw);
|
||||
});
|
||||
Reference in New Issue
Block a user