Commit f389b14d by liimin

refactor(recorder): 重构录音服务数据处理逻辑

- 移除 BusinessDataType 枚举导入,直接使用字符串类型
- 简化 updateBusinessData 方法参数,移除防抖功能
- 移除 getBusinessDataFromRecord 和 getMaterialPoints 方法
- 合并 getBusinessDataByType 和 getBusinessData 方法
- 重构策略模式实现,统一数据获取接口
- 移除动态属性提供者功能
- 添加 getAllBusinessData 方法示例文件
- 更新 README 文档说明和 API 参考
1 parent 3db5cb82
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
### 引入服务 ### 引入服务
```typescript ```typescript
// 直接导入单例对象和枚举 // 直接导入单例对象
import { recordService, BusinessDataType } from '@/services/recorder/index.uts' import { recordService } from '@/services/recorder/index.uts'
``` ```
### 开始接待/录音 ### 开始接待/录音
...@@ -33,7 +33,7 @@ await recordService.stopAudio(true) ...@@ -33,7 +33,7 @@ await recordService.stopAudio(true)
## 2. 业务数据更新 ## 2. 业务数据更新
使用统一的 `updateBusinessData` 接口更新业务数据。该接口支持防抖。 使用统一的 `updateBusinessData` 接口更新业务数据。
### 更新客户信息 ### 更新客户信息
...@@ -44,11 +44,10 @@ const customerInfo = { ...@@ -44,11 +44,10 @@ const customerInfo = {
carModel: 'Model Y' carModel: 'Model Y'
} }
// updateBusinessData(类型,数据,防抖时间 ms) // updateBusinessData(类型,数据)
recordService.updateBusinessData( recordService.updateBusinessData(
BusinessDataType.CUSTOMER, 'customer',
customerInfo, customerInfo
500
) )
``` ```
...@@ -57,7 +56,7 @@ recordService.updateBusinessData( ...@@ -57,7 +56,7 @@ recordService.updateBusinessData(
```typescript ```typescript
// 状态 '1' 表示接待中,'0' 表示结束 // 状态 '1' 表示接待中,'0' 表示结束
recordService.updateBusinessData( recordService.updateBusinessData(
BusinessDataType.STATUS, 'status',
'1' '1'
) )
``` ```
...@@ -69,52 +68,31 @@ const points = [ ...@@ -69,52 +68,31 @@ const points = [
{ x: 100, y: 200, time: 1234567890 } { x: 100, y: 200, time: 1234567890 }
] ]
recordService.updateBusinessData( recordService.updateBusinessData(
BusinessDataType.MATERIAL, 'material',
points points
) )
``` ```
## 3. 获取业务数据 ## 3. 获取业务数据
### 获取本地缓存的物料轨迹点 ### 获取物料轨迹点
```typescript ```typescript
// 异步获取存储在本地缓存中的物料轨迹点数据 // 或者使用通用方法获取特定类型数据
const materialPoints = await recordService.getMaterialPoints() const materialData = await recordService.getBusinessData('material')
console.log('物料轨迹点:', materialPoints)
// 或者使用通用方法
const materialData = await recordService.getBusinessData('MATERIAL_POINTS')
console.log('物料数据:', materialData?.receptionCustomerMaterialPointList) console.log('物料数据:', materialData?.receptionCustomerMaterialPointList)
``` ```
### 获取数据库中存储的业务数据
```typescript
// 从当前临时记录中获取客户信息(存储在数据库中)
const customerInfo = recordService.getBusinessDataFromRecord('CUSTOMER')
console.log('客户姓名:', customerInfo.customerName)
console.log('电话号码:', customerInfo.phoneNumber)
// 获取书籍/资源列表
const bookList = recordService.getBusinessDataFromRecord('BOOK')
console.log('资源列表:', bookList)
// 获取接待状态
const status = recordService.getBusinessDataFromRecord('STATUS')
console.log('接待状态:', status)
```
### 注意事项 ### 注意事项
- **MATERIAL_POINTS** (物料轨迹点) 存储在本地缓存,需要使用 `await` 异步获取 - **material** (物料轨迹点) 存储在本地缓存,需要使用 `await` 异步获取
- **BOOK、CUSTOMER、STATUS** 等其他类型存储在临时记录数据库中,可以直接同步获取 - **book、customer、status** 等其他类型存储在临时记录数据库中,可以直接同步获取
## 4. 自定义业务策略 ## 4. 自定义业务策略
如果您需要切换业务场景(例如从“汽车销售”切换到“房产销售”),可以通过实现 `IRecorderStrategy` 接口来定义新的策略。 如果您需要切换业务场景(例如从"汽车销售"切换到"房产销售"),可以通过实现 `IRecorderStrategy` 接口来定义新的策略。
### 3.1 定义新策略 ### 4.1 定义新策略
创建 `services/recorder/strategies/RealEstateStrategy.uts`: 创建 `services/recorder/strategies/RealEstateStrategy.uts`:
...@@ -136,8 +114,16 @@ export class RealEstateStrategy implements IRecorderStrategy { ...@@ -136,8 +114,16 @@ export class RealEstateStrategy implements IRecorderStrategy {
] ]
} }
// 2. 处理业务数据转换 // 2. 指定需要解析为 JSON 的字段
handle(type: string, data: any | null): null | UTSJSONObject { getJsonFields(): string[] {
return [
"houseInfo", // 房屋信息
"customerPreference" // 客户偏好
]
}
// 3. 处理业务数据转换
handle(type: string, data: any | null, recordId: string): null | UTSJSONObject {
// 根据 type 处理 data,返回存入 DB 的 JSON 对象 // 根据 type 处理 data,返回存入 DB 的 JSON 对象
if (type == 'house_info') { if (type == 'house_info') {
const info = data as UTSJSONObject const info = data as UTSJSONObject
...@@ -151,7 +137,7 @@ export class RealEstateStrategy implements IRecorderStrategy { ...@@ -151,7 +137,7 @@ export class RealEstateStrategy implements IRecorderStrategy {
} }
``` ```
### 3.2 切换策略 ### 4.2 切换策略
在业务初始化时调用: 在业务初始化时调用:
...@@ -167,3 +153,102 @@ recordService.setStrategy(strategy) ...@@ -167,3 +153,102 @@ recordService.setStrategy(strategy)
切换策略后: 切换策略后:
1. `DBRecord` 会自动检查并创建新的数据库字段。 1. `DBRecord` 会自动检查并创建新的数据库字段。
2. `RecordService` 会使用新策略的 `handle` 方法处理数据。 2. `RecordService` 会使用新策略的 `handle` 方法处理数据。
## 5. API 参考
### RecordService 主要方法
#### 录音控制
- **`startAudio(isInitData?: boolean): Promise<boolean>`** - 开始录音接待
- **`stopAudio(isNotSave?: boolean): Promise<void>`** - 结束录音接待
- **`stop(): void`** - 停止录音(不保存)
#### 数据获取
- **`getBusinessData(type: BusiType): Promise<any>`** - 异步获取业务数据(支持缓存)
- **`getBusinessDataFromRecord(type: BusiType): any`** - 同步从记录中获取业务数据
- **`getMaterialPoints(): Promise<any>`** - 便捷方法:获取物料轨迹点
#### 数据更新
- **`updateBusinessData(type: string, data: any): void`** - 更新业务数据
#### 策略管理
- **`setStrategy(strategy: IRecorderStrategy): void`** - 设置自定义业务策略
#### 其他方法
- **`getRecorder(): TempRecord | null`** - 获取当前临时记录对象
- **`isReceptioning(): boolean`** - 判断是否在接待中
- **`destroy(): void`** - 销毁服务实例
## 6. 核心特性
### 6.1 策略模式设计
- 采用策略模式实现业务逻辑的解耦
- 支持动态切换不同的业务场景
- 每个策略独立管理自己的数据结构和处理逻辑
### 6.2 数据存储策略
- **基础字段**:id、receptionStartTime 等由 DBRecord 统一管理
- **业务字段**:由各策略自行决定存储方式(缓存或数据库)
- **JSON 字段**:自动解析为对象/数组,便于使用
### 6.3 缓存机制
- 物料轨迹点等大数据量字段使用本地缓存
- 消费即焚:读取后自动删除缓存
- 保存前统一合并到正式记录
### 6.4 权限管理
- 自动请求录音权限
- 友好的权限提示
- 使用 uni-app 原生 API
## 7. 最佳实践
### 7.1 数据更新时机
```typescript
// ✅ 推荐:在用户输入时立即更新
inputElement.on('change', (e) => {
recordService.updateBusinessData('customer', {
customerName: e.target.value
})
})
// ❌ 避免:集中批量更新,可能导致数据丢失
```
### 7.2 数据获取选择
```typescript
// ✅ 通用方法(支持所有类型)
const data = await recordService.getBusinessData('material')
```
### 7.3 策略切换
```typescript
// ✅ 在应用初始化时切换策略
onLaunch(() => {
const strategy = new CustomStrategy()
recordService.setStrategy(strategy)
})
// ❌ 避免在接待过程中切换策略
```
### Q: 如何添加新的业务字段?
1. 在策略的 `getTableColumns()` 中声明字段
2. 在 `getJsonFields()` 中声明需要 JSON 解析的字段
3. 在 `handle()` 中实现数据处理逻辑
...@@ -11,7 +11,7 @@ import AudioManager from "./AudioManager.uts"; ...@@ -11,7 +11,7 @@ import AudioManager from "./AudioManager.uts";
import DBRecord from "./DBRecord.uts"; import DBRecord from "./DBRecord.uts";
import { RecorderStrategyFactory } from "./strategies/RecorderStrategyFactory.uts"; import { RecorderStrategyFactory } from "./strategies/RecorderStrategyFactory.uts";
import TempRecord from "./TempRecord.uts"; import TempRecord from "./TempRecord.uts";
import { RecordData, RecordFile } from "./types"; import { BusiType, RecordData, RecordFile } from "./types";
import { IRecorderStrategy } from "./types/strategy.uts"; import { IRecorderStrategy } from "./types/strategy.uts";
export class RecordService { export class RecordService {
...@@ -41,53 +41,19 @@ export class RecordService { ...@@ -41,53 +41,19 @@ export class RecordService {
this.stop(); this.stop();
this.reset(); this.reset();
} }
/**
* 获取所有业务数据
* @returns 包含所有业务数据的对象
*/
async getAllBusinessData(): Promise<UTSJSONObject> {
const recordId = this.record?.currentRecord?.id ?? "";
const currentRecord = this.record?.currentRecord as any | null;
return await this.businessHandler.getBusinessData(recordId, currentRecord);
}
/** /**
* 获取指定类型的业务数据 * 获取指定类型的业务数据
* @param type 业务数据类型标识 (如 'customer', 'book', 'status', 'material') * @param type 业务数据类型标识 (如 'customer', 'book', 'status', 'material')
* @returns 业务数据,如果不存在则返回 null * @returns 业务数据,如果不存在则返回 null
*/ */
async getBusinessData(type: string): Promise<any> { async getBusinessData(type: BusiType): Promise<any> {
const recordId = this.record?.currentRecord?.id ?? ""; const recordId = this.record?.currentRecord?.id ?? "";
const currentRecord = this.record?.currentRecord as any | null; const currentRecord = this.record?.currentRecord as any | null;
return await this.businessHandler.getBusinessDataByType(recordId, currentRecord, type); return await this.businessHandler.getBusinessData(recordId, currentRecord, type);
} }
/**
* 从当前记录中获取业务数据(存储在数据库中的字段)
* @param type 业务数据类型标识
* @returns 业务数据对象
*/
getBusinessDataFromRecord(type: string): any {
const currentRecord = this.record?.currentRecord;
if (currentRecord === null) return {} as UTSJSONObject;
// 将 RecordData 转换为 UTSJSONObject 以便动态访问属性
const recordObj = currentRecord as UTSJSONObject;
return this.businessHandler.getBusinessDataByType("", recordObj, type);
}
/**
* 便捷方法:获取物料轨迹点数据
* @returns 物料轨迹点列表
*/
async getMaterialPoints(): Promise<any | null> {
const recordId = this.record?.currentRecord?.id ?? "";
// 直接调用策略的 getBusinessDataByType 方法获取 material 类型数据
const result = await this.businessHandler.getBusinessDataByType(recordId, null, "material");
if (result === null) return null;
const obj = result as UTSJSONObject;
return obj.receptionCustomerMaterialPointList ?? null;
}
getRecorder(): null | TempRecord { getRecorder(): null | TempRecord {
return this.record; return this.record;
} }
...@@ -102,11 +68,11 @@ export class RecordService { ...@@ -102,11 +68,11 @@ export class RecordService {
this.initDto(); this.initDto();
this.record = new TempRecord( this.record = new TempRecord(
this.tempRecordDto, this.tempRecordDto,
() => { this.triggerTempNumber(); }, () => { this.triggerTempNumber(); }
() => { // () => {
// 委托给当前的业务策略获取动态属性 // // 委托给当前的业务策略获取动态属性
return this.businessHandler.getDynamicAttributes(); // return this.businessHandler.getDynamicAttributes();
} // }
); );
this.triggerTempNumber(); this.triggerTempNumber();
......
...@@ -8,7 +8,6 @@ import { RecordData, RecordFile } from "./types"; ...@@ -8,7 +8,6 @@ import { RecordData, RecordFile } from "./types";
class TempRecord { class TempRecord {
_isDestroyed = false; // 新增销毁标志位 _isDestroyed = false; // 新增销毁标志位
attributesProvider: (() => UTSJSONObject) | null = null;
dbRecord: DBRecord | null = null; dbRecord: DBRecord | null = null;
newRecord: null | RecordData = null; newRecord: null | RecordData = null;
onTempRecordNumberChanged: (() => void) | null = null; onTempRecordNumberChanged: (() => void) | null = null;
...@@ -32,11 +31,10 @@ class TempRecord { ...@@ -32,11 +31,10 @@ class TempRecord {
return this.dbRecord; return this.dbRecord;
} }
constructor(record: null | RecordData, onTempRecordNumberChanged: (() => void) | null, attributesProvider: (() => UTSJSONObject) | null) { constructor(record: null | RecordData, onTempRecordNumberChanged: (() => void) | null) {
this.newRecord = record; this.newRecord = record;
// this.dbRecord = uni.$dbRecord // 延迟获取,避免初始化顺序问题 // this.dbRecord = uni.$dbRecord // 延迟获取,避免初始化顺序问题
this.onTempRecordNumberChanged = onTempRecordNumberChanged; this.onTempRecordNumberChanged = onTempRecordNumberChanged;
this.attributesProvider = attributesProvider;
} }
/** /**
...@@ -45,8 +43,6 @@ class TempRecord { ...@@ -45,8 +43,6 @@ class TempRecord {
* @returns {object} 新记录对象 * @returns {object} 新记录对象
*/ */
__createNewRecord(initialUrlList: RecordFile[]): RecordData { __createNewRecord(initialUrlList: RecordFile[]): RecordData {
const dynamicAttributes = this.attributesProvider?.() ?? {};
const newRec = { const newRec = {
id: getUUID(), id: getUUID(),
receptionStartTime: this.getTimeNow(), receptionStartTime: this.getTimeNow(),
...@@ -55,9 +51,9 @@ class TempRecord { ...@@ -55,9 +51,9 @@ class TempRecord {
recordStatus: 0 recordStatus: 0
} as RecordData; } as RecordData;
// 合并逻辑:新记录默认值 <- 现有记录(如有) <- 动态属性 // 合并逻辑:新记录默认值 <- 现有记录 (如有)
// 使用 Object.assign 简化合并,最后统一深拷贝 // 使用 Object.assign 简化合并,最后统一深拷贝
const merged = Object.assign({}, newRec, this.newRecord ?? {}, dynamicAttributes); const merged = Object.assign({}, newRec, this.newRecord ?? {});
const res = deepClone<RecordData>(merged); const res = deepClone<RecordData>(merged);
if (res === null) { if (res === null) {
......
...@@ -79,67 +79,17 @@ export class DefaultRecorderStrategy implements IRecorderStrategy { ...@@ -79,67 +79,17 @@ export class DefaultRecorderStrategy implements IRecorderStrategy {
} }
/** /**
* 获取所有业务数据 * 获取业务数据(统一入口)
* @param type 默认为 "all",获取所有数据
*/ */
async getBusinessData(recordId: string, currentRecord: any | null): Promise<UTSJSONObject> { async getBusinessData(recordId: string, currentRecord: any | null, type: BusiType): Promise<any> {
const promises: Array<Promise<any>> = []; // 如果指定了具体类型,获取该类型的数据
this.strategyConfig.forEach((_, type) => { if (type !== "all") {
promises.push(this.getBusinessDataByType(recordId, currentRecord, type)); return this.getBusinessDataByTypeInternal(recordId, currentRecord, type);
});
try {
const results = await Promise.all(promises);
return this.mergeBusinessData(results);
} catch (error) {
console.error(`[DefaultRecorderStrategy] Get all business data failed:`, error);
return {} as UTSJSONObject;
}
}
/**
* 获取指定类型的业务数据(统一入口)
*/
async getBusinessDataByType(recordId: string, currentRecord: any | null, type: BusiType): Promise<any> {
const config = this.strategyConfig.get(type);
if (config === null) {
console.warn(`[DefaultRecorderStrategy] Unknown business data type: ${type}`);
return null;
}
try {
return config.fetcher.invoke(recordId, currentRecord);
} catch (error) {
console.error(`[DefaultRecorderStrategy] Fetch ${type} data failed:`, error);
return null;
}
} }
getBussinessType(sceneType: any | null): number { // 否则获取所有数据
return sceneType === 0 ? 1 : 2; // sceneType 0 延保 1 精品。bussinessType 1.延保 2.轻改 return await this.getAllBusinessData(recordId, currentRecord);
}
/**
* 获取动态业务属性
*/
getDynamicAttributes(): UTSJSONObject {
const userInfo = storage.get("userInfo");
let obj: UTSJSONObject = {};
if (typeof userInfo === "string" && userInfo !== "") {
try {
obj = JSON.parse(userInfo) as UTSJSONObject;
} catch (error) {
console.warn(`Failed to parse userInfo JSON: ${error}`);
}
} else if (userInfo !== null && typeof userInfo === "object") {
// userInfo is already an object
}
const sceneType = obj.get("sceneType");
return {
bussinessType: this.getBussinessType(sceneType)
};
} }
/** /**
...@@ -156,7 +106,7 @@ export class DefaultRecorderStrategy implements IRecorderStrategy { ...@@ -156,7 +106,7 @@ export class DefaultRecorderStrategy implements IRecorderStrategy {
* 便捷方法:获取物料轨迹点数据 * 便捷方法:获取物料轨迹点数据
*/ */
async getMaterialPoints(recordId: string): Promise<any | null> { async getMaterialPoints(recordId: string): Promise<any | null> {
const result: any | null = await this.getBusinessDataByType(recordId, null, "material"); const result: any | null = await this.getBusinessData(recordId, null, "material");
if (result === null) return null; if (result === null) return null;
const obj = result as UTSJSONObject; const obj = result as UTSJSONObject;
return obj.receptionCustomerMaterialPointList ?? null; return obj.receptionCustomerMaterialPointList ?? null;
...@@ -214,11 +164,15 @@ export class DefaultRecorderStrategy implements IRecorderStrategy { ...@@ -214,11 +164,15 @@ export class DefaultRecorderStrategy implements IRecorderStrategy {
* 保存前合并业务数据(可选实现) * 保存前合并业务数据(可选实现)
*/ */
async mergeBeforeSave(recordId: string, baseRecord: UTSJSONObject, updateData: UTSJSONObject): Promise<UTSJSONObject> { async mergeBeforeSave(recordId: string, baseRecord: UTSJSONObject, updateData: UTSJSONObject): Promise<UTSJSONObject> {
// 先恢复缓存数据并合并到基础记录 // 1. 先恢复缓存数据并合并到基础记录
const mergedRecord = await this.consumeBusinessCache(recordId, baseRecord); const mergedRecord = await this.consumeBusinessCache(recordId, baseRecord);
// 再合并 updateData 中的字段(updateData 优先级更高) // 2. 获取动态属性(如果策略配置了)
const finalRecord = Object.assign({}, mergedRecord, updateData); const dynamicAttributes = this.getDynamicAttributes();
// 3. 按优先级合并所有数据:
// 基础记录 <- 缓存数据 <- 动态属性 <- updateData
const finalRecord = Object.assign({}, mergedRecord, dynamicAttributes, updateData);
return finalRecord; return finalRecord;
} }
...@@ -288,6 +242,73 @@ export class DefaultRecorderStrategy implements IRecorderStrategy { ...@@ -288,6 +242,73 @@ export class DefaultRecorderStrategy implements IRecorderStrategy {
} }
/** /**
* 获取所有业务数据(内部方法)
*/
private async getAllBusinessData(recordId: string, currentRecord: any | null): Promise<UTSJSONObject> {
const promises: Array<Promise<any>> = [];
this.strategyConfig.forEach((_, typeKey) => {
promises.push(this.getBusinessDataByTypeInternal(recordId, currentRecord, typeKey));
});
try {
const results = await Promise.all(promises);
return this.mergeBusinessData(results);
} catch (error) {
console.error(`[DefaultRecorderStrategy] Get all business data failed:`, error);
return {} as UTSJSONObject;
}
}
/**
* 获取指定类型的业务数据(内部实现)
*/
private async getBusinessDataByTypeInternal(recordId: string, currentRecord: any | null, type: BusiType): Promise<any> {
const config = this.strategyConfig.get(type);
if (config === null) {
console.warn(`[DefaultRecorderStrategy] Unknown business data type: ${type}`);
return null;
}
try {
return config.fetcher.invoke(recordId, currentRecord);
} catch (error) {
console.error(`[DefaultRecorderStrategy] Fetch ${type} data failed:`, error);
return null;
}
}
/**
* 获取业务类型(内部辅助方法)
*/
private getBussinessType(sceneType: any | null): number {
return sceneType === 0 ? 1 : 2; // sceneType 0 延保 1 精品。bussinessType 1.延保 2.轻改
}
/**
* 获取动态业务属性
*/
private getDynamicAttributes(): UTSJSONObject {
const userInfo = storage.get("userInfo");
let obj: UTSJSONObject = {};
if (typeof userInfo === "string" && userInfo !== "") {
try {
obj = JSON.parse(userInfo) as UTSJSONObject;
} catch (error) {
console.warn(`Failed to parse userInfo JSON: ${error}`);
}
} else if (userInfo !== null && typeof userInfo === "object") {
// userInfo is already an object
}
const sceneType = obj.get("sceneType");
return {
bussinessType: this.getBussinessType(sceneType)
};
}
/**
* 合并业务数据结果 * 合并业务数据结果
*/ */
......
...@@ -13,7 +13,7 @@ export enum BusinessDataType { ...@@ -13,7 +13,7 @@ export enum BusinessDataType {
STATUS = "status" STATUS = "status"
} }
export type BusiType = "book" | "customer" | "material" | "status"; export type BusiType = "all" | "book" | "customer" | "material" | "status";
/** /**
* 通用业务数据处理器接口 * 通用业务数据处理器接口
......
import { IBusinessDataHandler } from "./handler"; import { BusiType, IBusinessDataHandler } from "./handler";
/** /**
* 录音业务策略接口 * 录音业务策略接口
...@@ -25,14 +25,6 @@ export interface IRecorderStrategy extends IBusinessDataHandler { ...@@ -25,14 +25,6 @@ export interface IRecorderStrategy extends IBusinessDataHandler {
getJsonFields(): string[] getJsonFields(): string[]
/** /**
* 获取动态业务属性
* 用于在录音开始/记录创建时,动态获取当前上下文中的业务数据
* 例如:当前登录用户信息、店铺信息、场景类型等
* 这些数据通常在初始化时可能还未就绪,或者会动态变化
*/
getDynamicAttributes(): UTSJSONObject
/**
* 业务缓存处理:将业务数据存入缓存 * 业务缓存处理:将业务数据存入缓存
* @param recordId 记录ID * @param recordId 记录ID
* @param type 缓存子类型 (由 Handler 返回的 key) * @param type 缓存子类型 (由 Handler 返回的 key)
...@@ -55,21 +47,13 @@ export interface IRecorderStrategy extends IBusinessDataHandler { ...@@ -55,21 +47,13 @@ export interface IRecorderStrategy extends IBusinessDataHandler {
clearBusinessCache(recordId: string): void clearBusinessCache(recordId: string): void
/** /**
* 获取指定类型的业务数据 * 获取业务数据
* @param recordId 记录 ID(用于从缓存获取)
* @param currentRecord 当前记录对象(用于从数据库字段获取)
* @param type 业务数据类型标识
* @returns 业务数据,如果不存在则返回 null
*/
getBusinessDataByType(recordId: string, currentRecord: any | null, type: string): Promise<any>
/**
* 获取所有业务数据
* @param recordId 记录 ID(用于从缓存获取) * @param recordId 记录 ID(用于从缓存获取)
* @param currentRecord 当前记录对象(用于从数据库字段获取) * @param currentRecord 当前记录对象(用于从数据库字段获取)
* @returns 所有业务数据 * @param type 业务数据类型标识,默认为 "all" 获取所有数据
* @returns 业务数据,如果 type 为具体类型则返回该类型数据,否则返回所有数据
*/ */
getBusinessData(recordId: string, currentRecord: any | null): Promise<UTSJSONObject> getBusinessData(recordId: string, currentRecord: any | null, type: BusiType): Promise<any>
/** /**
* 保存前数据处理:将业务数据与核心记录数据合并(可选实现) * 保存前数据处理:将业务数据与核心记录数据合并(可选实现)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!