Commit 2f060459 by liimin

feat(接待记录): 添加动态属性支持并调整遮罩透明度

为TempRecord类添加attributesProvider参数,支持在创建记录时注入动态属性
调整saveRecord.vue中ResultSelect组件的遮罩透明度为0.2
移除recorder.js中已注释的冗余代码
1 parent 957fb045
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<view class="btn cancel" @click="$emit('cancel')">取消</view> <view class="btn cancel" @click="$emit('cancel')">取消</view>
<view class="btn submit" @click="handleSave">保存提交</view> <view class="btn submit" @click="handleSave">保存提交</view>
</view> </view>
<ResultSelect ref="receptionStatusVisible" :value="customerInfo.result" @change="selectReception" maskBackgroundColor="rgba(0,0,0,0)" /> <ResultSelect ref="receptionStatusVisible" :value="customerInfo.result" @change="selectReception" maskBackgroundColor="rgba(0,0,0,0.2)" />
</view> </view>
</template> </template>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-12-26 10:03:54 * @Date: 2024-12-26 10:03:54
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-25 09:14:06 * @LastEditTime: 2025-12-30 18:31:01
* @FilePath: \simgle_app\mixin\record\recorder.js * @FilePath: \simgle_app\mixin\record\recorder.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
async mounted() { async mounted() {
this.audioManager = new AudioManager(this.onAudioStart, this.onAudioStop, this.onAudioError) this.audioManager = new AudioManager(this.onAudioStart, this.onAudioStop, this.onAudioError)
await this.initDto() await this.initDto()
this.record = new TempRecord(this.tempRecord, this.triggleTempNumber) this.record = new TempRecord(this.tempRecord, this.triggleTempNumber, this.attributesProvider)
this.triggleTempNumber() this.triggleTempNumber()
}, },
watch: { watch: {
...@@ -28,33 +28,17 @@ export default { ...@@ -28,33 +28,17 @@ export default {
* 监听客户信息是否发生变化 * 监听客户信息是否发生变化
* @param {object} val 监听客户信息 * @param {object} val 监听客户信息
*/ */
// customerInfo: {
// handler(val) {
// this.handler(val, this.updateCustomerInfo)
// },
// deep: true
// },
customerKey: { customerKey: {
handler() { handler() {
this.handler(this.customerInfo, this.updateCustomerInfo) this.handler(this.customerInfo, this.updateCustomerInfo)
}, },
deep: true deep: true
}, },
// booksList: {
// handler(val) {
// this.handler(val, this.updateBookList)
// }
// },
receptionStatus: { receptionStatus: {
handler(val) { handler(val) {
this.handler(val, this.updateReceptionStatus) this.handler(val, this.updateReceptionStatus)
} }
} }
// receptionKey: {
// handler(val) {
// this.handler(this.receptionTrack, this.updateMaterialPointList)
// }
// }
}, },
computed: { computed: {
...mapState(['user.customerInfo']), ...mapState(['user.customerInfo']),
...@@ -71,6 +55,7 @@ export default { ...@@ -71,6 +55,7 @@ export default {
const isPermission = await this.checkBeforeStart() const isPermission = await this.checkBeforeStart()
if (!isPermission) return if (!isPermission) return
uni.$logger.local.warn('〖接待管理Recorder〗 == 开始接待 ') uni.$logger.local.warn('〖接待管理Recorder〗 == 开始接待 ')
isInitData && this.initReception() isInitData && this.initReception()
this.initTime() this.initTime()
this.audioManager.start() this.audioManager.start()
...@@ -81,6 +66,20 @@ export default { ...@@ -81,6 +66,20 @@ export default {
return this._startAudioPromise return this._startAudioPromise
}, },
/**
* 获取动态属性,用于 TempRecord 创建新记录时回调
* @returns {Object} 包含 typeCode 和 materialId 的对象
*/
attributesProvider() {
const typeItem = uni.$storage.get('typeItem') || {}
const dynamicAttrs = {
typeCode: typeItem.typeCode || '',
materialId: this.materialId || ''
}
uni.$logger.local.warn(`〖接待管理Recorder〗 == 创建新记录,注入动态属性: ${JSON.stringify(dynamicAttrs)}`)
return dynamicAttrs
},
initReception() { initReception() {
// this.setBooks([]) // this.setBooks([])
this.clearCustomerInfo() this.clearCustomerInfo()
...@@ -177,39 +176,8 @@ export default { ...@@ -177,39 +176,8 @@ export default {
customerType, customerType,
carType carType
} }
if (!this.record.currentRecord?.typeCode) {
const typeItem = uni.$storage.get('typeItem') || {}
params.typeCode = typeItem.typeCode || ''
}
if (!this.record.currentRecord?.materialId) {
params.materialId = this.materialId || ''
}
this.record.updatePreRecords(params) this.record.updatePreRecords(params)
}, },
// updateBookList(booksList) {
// const receptionCustomerPaySourceList = booksList.map(item => {
// return {
// id: item.id,
// sourceType: item.id,
// sourceUrl: item.imgUrl
// }
// })
// this.record.updatePreRecords({ receptionCustomerPaySourceList })
// },
// updateMaterialPointList(receptionTrack) {
// const { merchantId, staffUuid, staffName } = this.tempRecord
// let receptionCustomerMaterialPointList = []
// Object.keys(receptionTrack).map(key => {
// receptionCustomerMaterialPointList.push({
// ...receptionTrack[key],
// merchantId,
// staffUuid,
// staffName,
// businessScene: this.sceneType
// })
// })
// this.record.updatePreRecords({ receptionCustomerMaterialPointList })
// },
updateReceptionStatus(status) { updateReceptionStatus(status) {
this.record.updatePreRecords({ result: status }) this.record.updatePreRecords({ result: status })
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: limin * @Author: limin
* @Date: 2025-01-02 18:49:17 * @Date: 2025-01-02 18:49:17
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-30 10:06:06 * @LastEditTime: 2025-12-30 18:24:02
* @FilePath: \simgle_app\utils\recordManager\TempRecord.js * @FilePath: \simgle_app\utils\recordManager\TempRecord.js
*/ */
import utils from '../utils' import utils from '../utils'
...@@ -21,12 +21,14 @@ class TempRecord { ...@@ -21,12 +21,14 @@ class TempRecord {
* 构造函数 * 构造函数
* @param {Object} record - 新建接待记录的初始字段(如客户信息等) * @param {Object} record - 新建接待记录的初始字段(如客户信息等)
* @param {Function} onTempRecordNumberChanged - 临时记录数量变化时的回调 * @param {Function} onTempRecordNumberChanged - 临时记录数量变化时的回调
* @param {Function} attributesProvider - [可选] 动态属性提供者,用于在创建记录时获取最新的上下文数据
*/ */
constructor(record, onTempRecordNumberChanged) { constructor(record, onTempRecordNumberChanged, attributesProvider) {
this.newRecord = record this.newRecord = record
this.recordManager = uni.$dbTempRecord this.recordManager = uni.$dbTempRecord
this.dbRecord = uni.$dbRecord this.dbRecord = uni.$dbRecord
this.onTempRecordNumberChanged = onTempRecordNumberChanged this.onTempRecordNumberChanged = onTempRecordNumberChanged
this.attributesProvider = attributesProvider
} }
/** /**
* 获取全部临时记录 * 获取全部临时记录
...@@ -225,9 +227,12 @@ class TempRecord { ...@@ -225,9 +227,12 @@ class TempRecord {
* @returns {Object} 新记录对象(含 id、开始时间、空的录音列表等) * @returns {Object} 新记录对象(含 id、开始时间、空的录音列表等)
*/ */
__createNewRecord() { __createNewRecord() {
// 获取最新的动态属性(如 typeCode, materialId)
const dynamicAttributes = this.attributesProvider() || {}
return { return {
id: utils.uuid(), id: utils.uuid(),
...this.newRecord, ...this.newRecord,
...dynamicAttributes, // 合并动态属性
startTime: this.getTimeNow(), startTime: this.getTimeNow(),
endTime: '', endTime: '',
urlList: [] urlList: []
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!