behaviorAnalysis.js
4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import api from '~/api/crew/index'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/supervisor-miniprogram/'
Component({
properties: {
detailInfo: {
type: Object,
value: {},
observer: function(n) {
}
},
selectedMerchantObj: {
type: Object
}
},
data: {
IMG_URL,
attendanceItems: [
{ label: '打卡天数', key: 'checkInDays' },
{ label: '迟到', key: 'late', valueClass: 'danger' },
{ label: '早退', key: 'earlyLeave', valueClass: 'danger' },
{ label: '旷工', key: 'absenteeism', valueClass: 'danger' }
],
dailyReportItems: [
{ label: '已提交', key: 'submitted', subLabel: '日报完成率', subKey:'completionRate', subClass: 'success' },
{ label: '未提交', key: 'notSubmitted' },
{ label: '在岗', key: 'onDuty' },
{ label: '调休', key: 'rest' }
],
receptionItems: [
{ label: '实际交车数', key: 'actualDelivery' },
{ label: '接待数量', key: 'receptionCount' },
{ label: '未触客数', key: 'notTouched' }
],
weakTags: [
{ label: '身份介绍:差', type: 'danger' },
{ label: '场景塑造:差', type: 'danger' },
{ label: '案例展示:差', type: 'danger' }
],
otherTags: [
{ label: '逼单能力:一般', type: 'default' },
{ label: '话题介入:一般', type: 'default' },
{ label: '攻防能力:一般', type: 'default' },
{ label: '服务意识:一般', type: 'default' },
{ label: '专业知识:好', type: 'success' }
],
recordStatsRows: [
[
{ label: '录音', key: 'recordingCount' },
{ label: '成交数', key: 'dealCount' },
{ label: '战败数', key: 'defeatCount' },
{ label: '成交率', key: 'dealRate' }
],
[
{ label: '质检平均分', key: 'qualityScore' },
{ label: '攻防平均分', key: 'attackDefenseScore' },
{ label: '录音缺失率', key: 'recordingMissingRate' }
]
],
tagRows: [{
label: '弱项',
class: 'danger',
key: 'badList'
}, {
label: '其他项',
key: 'ohterList'
}],
dressWarningItems: [{ label: '预警次数', key: 'warningCount' }],
behaviorInfo: {}
},
methods: {
search(e) {
this.setData({
startStr: e.detail.startDay?.replace(/\//g, '-'),
endStr: e.detail.endDay?.replace(/\//g, '-')
}, () => {
this.getData()
})
},
safeObjectToLabelList(obj) {
if (!obj || typeof obj !== 'object') {
return []
}
let cleanObj = {};
try {
const jsonStr = JSON.stringify(obj)
cleanObj = JSON.parse(jsonStr)
} catch (e) {
return []
}
const result = []
try {
const keys = Object.keys(cleanObj)
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
const value = cleanObj[key]
const displayValue = (typeof value === 'object' && value !== null)
? JSON.stringify(value)
: String(value)
result.push(`${key} : ${displayValue}`)
}
} catch (e) {
return []
}
return result
},
getData() {
let { detailInfo, startStr, endStr, selectedMerchantObj } = this.data
let params = {
phone: detailInfo.employeePhone,
employeeId: selectedMerchantObj?.employeeId,
merchantId: selectedMerchantObj?.merchantId,
bizs: detailInfo.scene,
startDate: startStr,
endDate: endStr
}
wx.$util.showLoading()
api.getEmployeebehaviorData(params).then(res => {
wx.$util.hideLoading()
let { code, data, message } = res
if (code == 0) {
data.recordingAnalysis.badList = this.safeObjectToLabelList(data.recordingAnalysis.badList)
data.recordingAnalysis.ohterList = this.safeObjectToLabelList(data.recordingAnalysis.ohterList)
this.setData({
behaviorInfo: data
})
} else {
wx.$util.showToast(message)
}
}).catch(() => {
wx.$util.hideLoading()
})
},
handleChangeMerchant() {
this.triggerEvent('changeMerchant')
},
handleChangeMerchant(e) {
let merchantId = 123
this.setData({
showSelectPopup: true,
selectOptions: [{merchantId: 123, merchantName: '明明4s店1'}],
selectValue: [merchantId]
})
},
handlePopupConfirm(e) {
let { values, items } = e.detail
console.log(values)
},
hideSelectPopup() {
this.setData({
showSelectPopup: false
})
},
},
})