Commit 9492412c by Lin

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

- 更新接待中心页面以增强自定义事件监听功能
- 调整筛选器组件的样式以改善布局和响应式表现
- 修改接待记录编辑页面的提交按钮,增加加载状态提示
- 重构日期时间格式化函数以支持 null 值处理
- 优化文件上传处理逻辑,确保本地文件上传状态一致性
- 清理未使用的代码和注释,提高代码可读性
1 parent c2ab0051
...@@ -750,9 +750,10 @@ onMounted(() => { ...@@ -750,9 +750,10 @@ onMounted(() => {
void refreshReceptionListForCurrentFilter(); void refreshReceptionListForCurrentFilter();
}); });
// 监听自定义事件,刷新列表 // 监听自定义事件,刷新列表(含本地未提交库)
uni.$on("refresh-reception-list", () => { // ✅ 测试8:恢复事件监听 uni.$on("refresh-reception-list", () => {
customerFilePageNum.value = 1; customerFilePageNum.value = 1;
void refreshReceptionListForCurrentFilter();
}); });
receptionCenterPageReady.value = true; receptionCenterPageReady.value = true;
......
...@@ -94,18 +94,31 @@ const onSwitchSubmittedResult = (event: any) => { ...@@ -94,18 +94,31 @@ const onSwitchSubmittedResult = (event: any) => {
.reception-filters { .reception-filters {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 8px; /* 横向间距由次级栏 margin-left 承担,避免与 gap 叠加以致端上表现不一致 */
width: 100%; width: 100%;
/* 两块略窄于 50%+50% 时左侧对齐,右侧留白 */
justify-content: space-between;
} }
/* 主筛 / 次级筛同宽且略窄于整行一半,覆盖 shared 中 rcf-half 的 width:50% 与 flex 行为 */
.rcf-half { .rcf-half {
flex: 1; flex-grow: 0;
flex-shrink: 1;
flex-basis: 40%;
width: 40%;
min-width: 0; min-width: 0;
/* 去掉 shared 中半宽卡片的默认白底,仅保留内层 segmented 区域背景 */
background-color: transparent;
} }
.filter-actions.filter-actions--review { .filter-actions.filter-actions--review {
flex: 2 1 0; flex-grow: 0;
flex-shrink: 1;
flex-basis: 42%;
width: 42%;
min-width: 0; min-width: 0;
/* 覆盖 shared 的 margin-left: auto,并与左侧主筛保留固定中间距 */
margin-left: 12px;
} }
.rcf-review-half { .rcf-review-half {
...@@ -124,7 +137,11 @@ const onSwitchSubmittedResult = (event: any) => { ...@@ -124,7 +137,11 @@ const onSwitchSubmittedResult = (event: any) => {
/* ✅ 响应式布局:窄屏时垂直排列 */ /* ✅ 响应式布局:窄屏时垂直排列 */
.filter-section--wrap { .filter-section--wrap {
flex-direction: column; flex-direction: column;
gap: 8px; gap: 12px;
}
.filter-section--wrap .filter-actions.filter-actions--review {
margin-left: 0;
} }
.filter-section--wrap .rcf-half, .filter-section--wrap .rcf-half,
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* 包含接待记录列表、客户档案列表专用的业务逻辑工具 * 包含接待记录列表、客户档案列表专用的业务逻辑工具
*/ */
import { get } from '@/utils/common.uts'
import { isBlankDisplayText, formatDateTimeLike } from '@/utils/format-utils.uts' import { isBlankDisplayText, formatDateTimeLike } from '@/utils/format-utils.uts'
import { getStr, getTs } from '../types/reception-center-helpers.uts' import { getStr, getTs } from '../types/reception-center-helpers.uts'
...@@ -83,17 +84,17 @@ export function getCustomerPhone(item: UTSJSONObject): string { ...@@ -83,17 +84,17 @@ export function getCustomerPhone(item: UTSJSONObject): string {
*/ */
export function formatReceptionDateTime(item: UTSJSONObject, kind: 'start' | 'end'): string { export function formatReceptionDateTime(item: UTSJSONObject, kind: 'start' | 'end'): string {
if (kind == 'start') { if (kind == 'start') {
let s = formatDateTimeLike(item['startTime'] as any) let s = formatDateTimeLike(get(item, 'startTime'))
if (!isBlankDisplayText(s)) { if (!isBlankDisplayText(s)) {
return s return s
} }
return formatDateTimeLike(item['receptionStartTime'] as any) return formatDateTimeLike(get(item, 'receptionStartTime'))
} }
let s = formatDateTimeLike(item['endTime'] as any) let s = formatDateTimeLike(get(item, 'endTime'))
if (!isBlankDisplayText(s)) { if (!isBlankDisplayText(s)) {
return s return s
} }
return formatDateTimeLike(item['receptionEndTime'] as any) return formatDateTimeLike(get(item, 'receptionEndTime'))
} }
/** /**
......
...@@ -179,8 +179,10 @@ class RecordSave { ...@@ -179,8 +179,10 @@ class RecordSave {
} }
async _handleCompletedRecord(record: UTSJSONObject, fileList: UTSJSONObject[]) { async _handleCompletedRecord(record: UTSJSONObject, fileList: UTSJSONObject[]) {
// 1. 整理文件路径 // 1. 整理文件路径(与 _saveOrUpdate 判定一致:Uploaded / Completed 均视为已拿到可提交地址)
const uploadedFiles = fileList.filter(file => file.status === FileStatus.Uploaded); const uploadedFiles = fileList.filter(
file => file.status === FileStatus.Uploaded || file.status === FileStatus.Completed
);
const serverPaths = uploadedFiles.map(i => i.file as string); const serverPaths = uploadedFiles.map(i => i.file as string);
const localPaths = uploadedFiles.map(i => i.filePathOnClient as string); const localPaths = uploadedFiles.map(i => i.filePathOnClient as string);
...@@ -191,7 +193,8 @@ class RecordSave { ...@@ -191,7 +193,8 @@ class RecordSave {
params.urlList = serverPaths; // replace with string array params.urlList = serverPaths; // replace with string array
if (params.endTime === null || params.endTime === "") { if (params.endTime === null || params.endTime === "") {
params.endTime = await this._requestReceptionEndTime(serverPaths, params.startTime as string); // startTime 可能为 null,避免 Kotlin 端对 null 做非空 String 强转崩溃
params.endTime = await this._requestReceptionEndTime(serverPaths, toStr(params.startTime));
} }
// 3. 提交到服务器 // 3. 提交到服务器
...@@ -354,14 +357,26 @@ class RecordSave { ...@@ -354,14 +357,26 @@ class RecordSave {
// mock api // mock api
// const endTime = await uni.$api.commonApi.searchRecordingEndTime({ urlList, startTime: startTime.replace(/\//g, '-') }) // const endTime = await uni.$api.commonApi.searchRecordingEndTime({ urlList, startTime: startTime.replace(/\//g, '-') })
const startTimeStr = replaceAll(startTime, "/", "-"); const startTimeStr = replaceAll(startTime, "/", "-");
const endTime = await searchRecordingEndTime({ urlList, startTime: startTimeStr }); const endTimeRaw = await searchRecordingEndTime({ urlList, startTime: startTimeStr });
const endTime = toStr(endTimeRaw);
logger.info(`【上传服务】 == 服务器返回结束接待时间: endTime ->${endTime}`, "RecordSave"); logger.info(`【上传服务】 == 服务器返回结束接待时间: endTime ->${endTime}`, "RecordSave");
if (endTime.includes("-")){ if (endTime.includes("-")) {
return replaceAll(endTime, "-", "/"); return replaceAll(endTime, "-", "/");
} }
return endTime; return endTime;
} }
/**
* 接待记录编辑页「保存提交」:本地文件已全部上传后,将合并后的整单提交服务端,
* 成功后删除本地录音文件与数据库记录(与上传完成回调路径一致)。
*/
async submitLocalReceptionToServer(mergedRecord: UTSJSONObject): Promise<void> {
const record = toObj(deepClone<UTSJSONObject>(mergedRecord));
const urlListRaw = record.urlList;
const fileList: UTSJSONObject[] = Array.isArray(urlListRaw) ? (urlListRaw as UTSJSONObject[]) : [];
await this._handleCompletedRecord(record, fileList);
}
async _saveOrUpdate(data: UTSJSONObject) { async _saveOrUpdate(data: UTSJSONObject) {
logger.info(`【接待记录保存服务】 == 开始保存或更新接待记录!!`, "RecordSave"); logger.info(`【接待记录保存服务】 == 开始保存或更新接待记录!!`, "RecordSave");
const status = data.status as number; // 没有文件的记录,status 为 NoFile 有文件的记录没有此状态 const status = data.status as number; // 没有文件的记录,status 为 NoFile 有文件的记录没有此状态
......
...@@ -80,8 +80,9 @@ export function formatDateOnly(ts: number | null): string { ...@@ -80,8 +80,9 @@ export function formatDateOnly(ts: number | null): string {
/** /**
* 格式化类日期字段(支持字符串、数字时间戳) * 格式化类日期字段(支持字符串、数字时间戳)
* 入参可为 null(JSON 缺字段),避免调用方 `as any` 在 Kotlin 侧触发非空 Any 强转 NPE
*/ */
export function formatDateTimeLike(value: any): string { export function formatDateTimeLike(value: any | null): string {
if (value == null) { if (value == null) {
return '' return ''
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!