Commit 714a894b by Lin

refactor(receptionCenter): 更新接待中心组件逻辑和样式

- 修改 DetailData 组件的样式注释以提高可读性
- 更新 receptionDetail.qualityMock.uts 中的 mock 数据逻辑,禁用 mock 以使用真实数据
- 新增 receptionDetail.qualityTransform.uts 文件,处理质检行数据转换
- 优化 receptionDetail.uvue 组件的渲染逻辑,确保在不同状态下正确显示质检数据
- 调整 ListReception 组件的导航逻辑,增强数据传递的可靠性
1 parent 9fa08a1d
...@@ -195,7 +195,7 @@ const qualityDetailList = computed((): QualityDetailRow[] => { ...@@ -195,7 +195,7 @@ const qualityDetailList = computed((): QualityDetailRow[] => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
// ✅ UVUE 不支持 max-width: 100%,移除后由 width: 100% 控制 /* UVUE:非 scss 样式块中不可用 // 注释 */
min-width: 0; min-width: 0;
height: auto; height: auto;
box-sizing: border-box; box-sizing: border-box;
...@@ -251,7 +251,7 @@ const qualityDetailList = computed((): QualityDetailRow[] => { ...@@ -251,7 +251,7 @@ const qualityDetailList = computed((): QualityDetailRow[] => {
justify-content: center; justify-content: center;
flex-grow: 0; flex-grow: 0;
flex-shrink: 0; flex-shrink: 0;
// ✅ UVUE 不支持 max-width: 100%,移除后由 flex 布局自适应 /* flex 子项宽度由父级与 flex 约束 */
box-sizing: border-box; box-sizing: border-box;
margin-right: var(--reception-detail-data-tag-gap-x, 8px); margin-right: var(--reception-detail-data-tag-gap-x, 8px);
margin-bottom: 8px; margin-bottom: 8px;
......
...@@ -235,7 +235,17 @@ function onCardClick(item: UTSJSONObject): void { ...@@ -235,7 +235,17 @@ function onCardClick(item: UTSJSONObject): void {
} }
// ✅ 导航逻辑下沉:直接在组件内部处理,避免事件层层传递 // ✅ 导航逻辑下沉:直接在组件内部处理,避免事件层层传递
uni.navigateTo({ uni.navigateTo({
url: `/pages/receptionCenter/receptionDetail?record=${encodeURIComponent(JSON.stringify(item))}` url: `/pages/receptionCenter/receptionDetail?record=${encodeURIComponent(JSON.stringify(item))}`,
success(res: any) {
const resObj = res as UTSJSONObject;
const ec = resObj["eventChannel"] as any | null;
if (ec != null) {
const emitFn = ec["emit"] as any | null;
if (emitFn != null && typeof emitFn == "function") {
(emitFn as (name: string, data: any) => void)("getData", item);
}
}
}
}); });
} }
</script> </script>
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* 字段与 pickQualityRowsFromResponse 及 receptionDetail 中 dim*、conversationBlocks 消费逻辑对齐。 * 字段与 pickQualityRowsFromResponse 及 receptionDetail 中 dim*、conversationBlocks 消费逻辑对齐。
*/ */
/** 为 true 时 receptionDetail 跳过 findCheckResultByBatchId,直接使用 buildMockQualityRows() */ /** 为 true 时 receptionDetail 跳过网关质检请求,直接使用 buildMockQualityRows() */
export const USE_MOCK_QUALITY_ROWS = true; export const USE_MOCK_QUALITY_ROWS = false;
/** /**
* 质检维度模拟数据。 * 质检维度模拟数据。
......
/**
* 将网关 findCheckResultListByReceptionId / findCheckResultByBatchId 返回的质检行
* 加工为 ReceptionQualityAnalysis / DetailData 所需字段(与功能清单第六节对齐)。
*/
import { formatMmSs, getNum, parseStringArray } from "./lists/reception-detail-helpers.uts";
function formatPlainText(s: string): string {
return s.replace(/\r\n/g, "\n").replace(/\n/g, " ").trim();
}
function firstScriptRecLine(raw: any | null): string {
const lines = parseStringArray(raw);
if (lines.length > 0) {
return formatPlainText(lines[0]);
}
return "";
}
/**
* 单条质检维度加工:formatScore、命中意图、话术首行、对话行 time/text_id、话术挂载
*/
export function transformSingleQualityRow(row: UTSJSONObject): UTSJSONObject {
const out = {} as UTSJSONObject;
for (const k in row) {
out[k] = row[k];
}
const scoreRaw = out["score"];
const sumRaw = out["sumScore"];
if (scoreRaw != null && sumRaw != null) {
out["formatScore"] = `${scoreRaw}/${sumRaw}`;
} else {
const fs = out["formatScore"] as string | null;
if (fs == null || fs.trim() == "") {
out["formatScore"] = "-";
}
}
const hitTextList = parseStringArray(out["hitText"]);
if (hitTextList.length > 0) {
out["matchedClass"] = "hit";
out["matchedText"] = "意图匹配";
} else {
out["matchedClass"] = "";
out["matchedText"] = "意图不匹配";
}
const scriptLine = firstScriptRecLine(out["scriptRec"]);
let list: UTSJSONObject[] = [];
const listRaw = out["conversationDetailDTOList"];
if (listRaw != null && listRaw instanceof Array) {
list = listRaw as UTSJSONObject[];
}
const itemOffset = getNum(out, "offset");
let i = 0;
while (i < list.length) {
const line = list[i];
const mo = getNum(line, "mergedOffset");
if (mo != null && mo >= 0) {
const sec = Math.floor(mo);
line["time"] = formatMmSs(sec);
line["text_id"] = `text_${Math.ceil(mo)}`;
}
i++;
}
if (scriptLine != "") {
let attached = false;
let j = 0;
while (j < list.length) {
const line = list[j];
const mo = getNum(line, "mergedOffset");
if (itemOffset != null && mo != null) {
const offSec = itemOffset > 1000 ? itemOffset / 1000.0 : itemOffset;
if (Math.abs(mo - offSec) < 0.001) {
line["scriptRec"] = scriptLine;
attached = true;
break;
}
}
j++;
}
if (!attached && list.length > 0) {
const last = list[list.length - 1];
last["scriptRec"] = scriptLine;
}
out["scriptRec"] = scriptLine;
}
if (list.length == 0) {
const stub = {} as UTSJSONObject;
stub["scriptRec"] = scriptLine != "" ? scriptLine : "暂无话术推荐";
list = [stub];
}
out["conversationDetailDTOList"] = list;
return out;
}
export function transformQualityCheckRows(rawRows: UTSJSONObject[]): UTSJSONObject[] {
const out: UTSJSONObject[] = [];
let i = 0;
while (i < rawRows.length) {
out.push(transformSingleQualityRow(rawRows[i]));
i++;
}
return out;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!