Commit d771688d by liimin

feat(质检模块): 优化质检数据加载状态处理及排序逻辑

- 新增质检数据加载状态显示,提升用户体验
- 修复质检数据排序问题,统一使用时间倒序排列
- 优化对话详情解析逻辑,增加异常处理
- 添加空记录保存时的校验提示
- 重构接待记录列表排序方法,提高代码复用性
1 parent 39eacbea
...@@ -236,64 +236,31 @@ export default { ...@@ -236,64 +236,31 @@ export default {
}, },
jumpDetail (item) { jumpDetail (item) {
// item = { // item = {
// "id": null, // carType: "1001",
// "merchantId": "44210895", // createBy: null,
// customerType: 'VIP', // createById: null,
// "customerName": "1211第五", // createTime: "2026-01-05 09:17:54",
// "phoneNumber": "13512110555", // customerName: "放地方",
// "salesUuid": "77936e318e9844e4af0b099c7ccc98e4", // customerPhone: "13476670746",
// "salesName": "叶立庆", // customerType: "地方编码",
// "carBrandId": null, // duration: "1352",
// "carBrand": "AITO 问界", // durationStr: "22分32秒",
// "carModel": "问界M8", // endTime: "2026-01-05 10:42:43",
// "receptionStartTime": 1765447430000, // id: "71",
// "receptionEndTime": 1765449405000, // materialId: "0",
// "recordUrlList": null, // merchantId: "0",
// "recCustomerId": null, // receptionDate: "2026-01-05",
// "loginPhone": null, // recordUrl: "https://report-default-test.oss-cn-shenzhen.aliyuncs.com/2026/01/06/b9dae32a-ee28-4dd5-9a69-f7f6462a9db4.mp3",
// "receptionStatus": 0, // remark: null,
// "endReasonType": null, // result: "string",
// "staffUuid": "9ec5c68f73e84357a427da9503a5ee8b", // score: 67,
// "staffName": null, // startTime: "2026-01-05 10:20:11",
// "serviceMerchantId": null, // typeCode: "RECEPTION_TYPE_001",
// "receptionCustomerPaySourceList": null, // updateBy: null,
// "orderFlag": null, // updateById: null,
// "bussinessType": null, // updateTime: "2026-01-06 09:18:01",
// "channelType": null, // userId: "4454545",
// "appCode": null, // userName: "池师傅"
// "appVersion": null,
// "merchantName": "波波的单店门店",
// "customerVisitId": null,
// "receptionCustomerMaterialPointList": null,
// "carPurchaseMethod": null,
// "checkHistoryFlag": 0,
// "batchId": 72,
// "score": 35,
// "recordingUrl": "https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/176544865331017654474319060.mp3",
// "recordId": null,
// "recordingTagRelationList": null,
// "sfjs": null,
// "fwys": null,
// "htjr": null,
// "sqfx": null,
// "zyzs": null,
// "cjsz": null,
// "alzs": null,
// "gfnl": null,
// "bdnl": null,
// "reviewFlag": null,
// "oneCarBrand": "鸿蒙智行",
// "oneCarBrandId": null,
// "bussinessTypeName": null,
// "checkDate": null,
// "isOrderFinishFlagName": "0",
// "modelType": "1001",
// "checkType": 1,
// "orderFinishFlag": false,
// "duration": "32分55秒",
// "startTime": "2025.12.11 18:03:50",
// "endTime": "2025.12.11 18:36:45",
// "totalDuration": 1975
// } // }
if (this.tabIndex == 0) { // 已上传 && 新质检 if (this.tabIndex == 0) { // 已上传 && 新质检
// const { sceneType } = uni.$storage.get("userInfo"); // const { sceneType } = uni.$storage.get("userInfo");
...@@ -315,9 +282,19 @@ export default { ...@@ -315,9 +282,19 @@ export default {
} }
}, },
// 工具方法:按时间倒序排序
sortByTime(list, key = 'startTime') {
if (!Array.isArray(list)) return []
return list.sort((a, b) => {
const timeA = new Date(a[key]).getTime()
const timeB = new Date(b[key]).getTime()
return timeB - timeA
})
},
async loadRecords () { async loadRecords () {
let records = await uni.$dbRecord.getRecords(); let records = await uni.$dbRecord.getRecords();
this.recordList = records.reverse(); this.recordList = this.sortByTime(records);
}, },
async loadTempRecords () { async loadTempRecords () {
if (!this.recorder) { if (!this.recorder) {
...@@ -351,7 +328,7 @@ export default { ...@@ -351,7 +328,7 @@ export default {
await this.loadTempRecords() await this.loadTempRecords()
// 这里的 tempRecordList 是一个数组,我们需要创建一个新数组来触发 reverse,避免修改原数组(虽然这里修改原数组也没大碍) // 这里的 tempRecordList 是一个数组,我们需要创建一个新数组来触发 reverse,避免修改原数组(虽然这里修改原数组也没大碍)
// 关键:确保 formattedList 是一个数组 // 关键:确保 formattedList 是一个数组
const formattedList = [...this.tempRecordList].reverse() const formattedList = this.sortByTime([...this.tempRecordList])
// 修复 Vue2 响应式问题 // 修复 Vue2 响应式问题
// 确保 list[0] 被正确设置 // 确保 list[0] 被正确设置
this.$set(this.list, 0, formattedList) this.$set(this.list, 0, formattedList)
...@@ -403,7 +380,8 @@ export default { ...@@ -403,7 +380,8 @@ export default {
}) || {} }) || {}
// 3. 数据处理 // 3. 数据处理
records.reverse().forEach(e => { const sortedRecords = this.sortByTime(records)
sortedRecords.forEach(e => {
e.duration = e.durationStr || this.formatSeconds(new Date(e.endTime).getTime() - new Date(e.startTime).getTime()) e.duration = e.durationStr || this.formatSeconds(new Date(e.endTime).getTime() - new Date(e.startTime).getTime())
e.orderFinishFlag = e.result === '完成' ? 1 : 0 e.orderFinishFlag = e.result === '完成' ? 1 : 0
}) })
...@@ -411,12 +389,12 @@ export default { ...@@ -411,12 +389,12 @@ export default {
// 4. 更新缓存 (仅第一页) // 4. 更新缓存 (仅第一页)
if (pageNum === 1) { if (pageNum === 1) {
const cache = JSON.parse(uni.$storage.get("recordSuccessList") || "{}") const cache = JSON.parse(uni.$storage.get("recordSuccessList") || "{}")
cache[tabIndex] = records cache[tabIndex] = sortedRecords
uni.$storage.set("recordSuccessList", JSON.stringify(cache)) uni.$storage.set("recordSuccessList", JSON.stringify(cache))
} }
// 5. 更新视图 // 5. 更新视图
this.$set(this.list, pageNum - 1, records) this.$set(this.list, pageNum - 1, sortedRecords)
this.total = total this.total = total
}, },
......
...@@ -9,7 +9,13 @@ ...@@ -9,7 +9,13 @@
@touchstart="touchstart" @touchstart="touchstart"
@touchend="touchend" @touchend="touchend"
> >
<template v-if="dialogueList.length"> <template v-if="loading">
<view class="nothing flex">
<view class="sprite-icon icon-quality-no-data"></view>
分析中,稍等...
</view>
</template>
<template v-else-if="dialogueList.length">
<block <block
v-for="(item,index) in dialogueList" v-for="(item,index) in dialogueList"
:key="index" :key="index"
...@@ -70,7 +76,7 @@ ...@@ -70,7 +76,7 @@
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<view class="sprite-icon icon-quality-no-data"></view> <view class="sprite-icon icon-quality-no-data"></view>
分析中,稍等... 暂无对话数据
</view> </view>
</template> </template>
</scroll-view> </scroll-view>
...@@ -172,7 +178,8 @@ export default { ...@@ -172,7 +178,8 @@ export default {
isPlayIng: false, isPlayIng: false,
isScrolllIng: false, isScrolllIng: false,
toId: '', toId: '',
touchTimer: null touchTimer: null,
loading: false
} }
}, },
mounted () { mounted () {
...@@ -193,6 +200,8 @@ export default { ...@@ -193,6 +200,8 @@ export default {
i.detailClassName = i.detailClassName == 'up' ? 'down' : 'up' i.detailClassName = i.detailClassName == 'up' ? 'down' : 'up'
}, },
async findConversationDetailByBatchIdNew (params) { async findConversationDetailByBatchIdNew (params) {
this.loading = true
try {
const res = await uni.$api.reception.findConversationDetailByReceptionId(params) const res = await uni.$api.reception.findConversationDetailByReceptionId(params)
res.map(e => { res.map(e => {
e.time = this.formatTime(e.mergedOffset) e.time = this.formatTime(e.mergedOffset)
...@@ -200,13 +209,24 @@ export default { ...@@ -200,13 +209,24 @@ export default {
if (e?.recordingCheckResultList && e.recordingCheckResultList.length) { if (e?.recordingCheckResultList && e.recordingCheckResultList.length) {
e.recordingCheckResultList.map(i => { e.recordingCheckResultList.map(i => {
i.detailClassName = 'down' i.detailClassName = 'down'
if (i.scriptRec){
try {
let [scriptRec] = JSON.parse(i.scriptRec) let [scriptRec] = JSON.parse(i.scriptRec)
if (scriptRec) i.scriptRec = scriptRec.replace(/\n/g, '<br>') if (scriptRec) i.scriptRec = scriptRec.replace(/\n/g, '<br>')
} catch (error) {
i.scriptRec = ''
}
}
else i.scriptRec = '' else i.scriptRec = ''
}) })
} }
}) })
this.dialogueList = res this.dialogueList = res
} catch (e) {
uni.$logger.error(e.message)
} finally {
this.loading = false
}
}, },
async findCbByBatchId () { async findCbByBatchId () {
let data = JSON.parse(JSON.stringify(this.qualityData)) let data = JSON.parse(JSON.stringify(this.qualityData))
...@@ -227,7 +247,7 @@ export default { ...@@ -227,7 +247,7 @@ export default {
data.filter(e => e.offset != null) data.filter(e => e.offset != null)
.sort((a, b) => a.offset - b.offset) .sort((a, b) => a.offset - b.offset)
.forEach(e => { .forEach(e => {
const mergedOffset = e.offset / 1000 const mergedOffset = e.offset
let top = mergedOffset / totalDuration * containerHeight let top = mergedOffset / totalDuration * containerHeight
e.docTop = top e.docTop = top
e.text_id = `text_${mergedOffset}` e.text_id = `text_${mergedOffset}`
......
<template> <template>
<view class="view"> <view class="view">
<template v-if="qualityData.length"> <template v-if="loading">
<view class="nothing flex">
<view class="sprite-icon icon-quality-no-data"></view>
分析中,稍等...
</view>
</template>
<template v-else-if="qualityData.length">
<view class="classify-wrap"> <view class="classify-wrap">
<template v-for="(item,index) in qualityData"> <template v-for="(item,index) in qualityData">
<view <view
...@@ -63,7 +69,7 @@ ...@@ -63,7 +69,7 @@
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<view class="sprite-icon icon-quality-no-data"></view> <view class="sprite-icon icon-quality-no-data"></view>
分析中,稍等... 暂无质检数据
</view> </view>
</template> </template>
</view> </view>
...@@ -85,7 +91,11 @@ export default { ...@@ -85,7 +91,11 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
disabledText: String disabledText: String,
loading: {
type: Boolean,
default: false
}
}, },
data () { data () {
return { return {
......
...@@ -54,14 +54,20 @@ ...@@ -54,14 +54,20 @@
</view> </view>
</view> </view>
<view class="reception-right-box"> <view class="reception-right-box">
<template v-if="qualityData.length"> <template v-if="qualityLoading">
<view class="nothing flex">
<view class="sprite-icon icon-quality-no-data"></view>
分析中,稍等...
</view>
</template>
<template v-else-if="qualityData.length">
<tags :tags="tags" /> <tags :tags="tags" />
<quality-table :qualityData="qualityData" /> <quality-table :qualityData="qualityData" />
</template> </template>
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<view class="sprite-icon icon-quality-no-data"></view> <view class="sprite-icon icon-quality-no-data"></view>
分析中,稍等... 暂无质检数据
</view> </view>
</template> </template>
</view> </view>
...@@ -114,18 +120,20 @@ export default { ...@@ -114,18 +120,20 @@ export default {
status: 'pause', status: 'pause',
isOperate: true, isOperate: true,
showPlayControl: false, showPlayControl: false,
tags: [] tags: [],
qualityLoading: false
} }
}, },
onLoad (options) { onLoad (options) {
let _this = this let _this = this
this.getOpenerEventChannel().on('getData', function (data) { this.getOpenerEventChannel().on('getData', function (params) {
//计算时长 单位秒
try { try {
let data = utils.deepClone(params || {})
//计算时长 单位秒
data.receptionStartTime = (dayjs(data.startTime).valueOf())/1000 data.receptionStartTime = (dayjs(data.startTime).valueOf())/1000
data.receptionEndTime = (dayjs(data.endTime).valueOf())/1000 data.receptionEndTime = (dayjs(data.endTime).valueOf())/1000
data.totalDuration = (data.receptionEndTime - data.receptionStartTime) data.totalDuration = (data.receptionEndTime - data.receptionStartTime)
data.batchId = data.id = '72' data.batchId = data.id
_this.pageData = Object.freeze(data || {}) _this.pageData = Object.freeze(data || {})
if (data.batchId) _this.findCheckResultListByReceptionId(data.batchId) if (data.batchId) _this.findCheckResultListByReceptionId(data.batchId)
_this.setAudio(data.recordUrl) _this.setAudio(data.recordUrl)
...@@ -247,7 +255,7 @@ export default { ...@@ -247,7 +255,7 @@ export default {
__formatScore(item) { __formatScore(item) {
const score = (item.score !== null && item.score !== undefined) ? item.score : '-' const score = (item.score !== null && item.score !== undefined) ? item.score : '-'
const sumScore = (item.sumScore !== null && item.sumScore !== undefined) ? item.sumScore : '-' const sumScore = (item.sumScore !== null && item.sumScore !== undefined) ? item.sumScore : '-'
item.__formatScore = `${score}/${sumScore}` item.formatScore = `${score}/${sumScore}`
}, },
// 处理命中话术 // 处理命中话术
...@@ -302,6 +310,7 @@ export default { ...@@ -302,6 +310,7 @@ export default {
}, },
async findCheckResultListByReceptionId (receptionId) { async findCheckResultListByReceptionId (receptionId) {
this.qualityLoading = true
try { try {
const res = await uni.$api.reception.findCheckResultListByReceptionId({ const res = await uni.$api.reception.findCheckResultListByReceptionId({
receptionId receptionId
...@@ -330,6 +339,8 @@ export default { ...@@ -330,6 +339,8 @@ export default {
this.qualityData = Object.freeze(res) this.qualityData = Object.freeze(res)
} catch (err) { } catch (err) {
console.error('findCheckResultListByReceptionId error', err) console.error('findCheckResultListByReceptionId error', err)
} finally {
this.qualityLoading = false
} }
}, },
desensitizePhoneNumber (customerPhone) { desensitizePhoneNumber (customerPhone) {
......
// store/plugins/activityTracker.js
import utils from '@/utils/utils'
/**
* 自动监听用户活跃状态的 Vuex 插件
* 当指定的 mutation 发生时,触发 reset_timeout 事件
*/
export default function createActivityTracker(mutationsToWatch = []) {
// 使用 utils.throttle 限制触发频率,避免高频 mutation 导致过多 emit
const notifyActivity = utils.throttle(() => {
uni.$emit('reset_timeout')
}, 1000)
return store => {
store.subscribe((mutation, state) => {
// 如果 mutation 在监控列表中,则触发活跃通知
if (mutationsToWatch.includes(mutation.type)) {
notifyActivity()
}
})
}
}
...@@ -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: 2026-01-05 17:25:50 * @LastEditTime: 2026-01-08 09:12:15
* @FilePath: \simgle_app\utils\recordManager\TempRecord.js * @FilePath: \simgle_app\utils\recordManager\TempRecord.js
*/ */
import utils from '../utils' import utils from '../utils'
...@@ -398,6 +398,10 @@ class TempRecord { ...@@ -398,6 +398,10 @@ class TempRecord {
* @returns - 返回保存后的文件路径 * @returns - 返回保存后的文件路径
*/ */
async saveTempFile(record = this.record) { async saveTempFile(record = this.record) {
if (!record) {
uni.$logger.local.warn('〖接待记录Record〗 == saveTempFile 记录为空,跳过')
return
}
let { tempFilePath, urlList } = record let { tempFilePath, urlList } = record
if (!tempFilePath || urlList.length === 0) { if (!tempFilePath || urlList.length === 0) {
if (!this.timer) { if (!this.timer) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!