qualityAnalyse.vue
9.56 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<template>
<div class="analyse">
<div class="statistics">
<div class="s-item" v-for="(item, index) in sList" :key="index">
<div class="title">{{ item.text }}</div>
<div class="content" v-html="item.formatter && item.formatter(detailObj)"></div>
</div>
</div>
<GLCombiForm ref="showSearch" class="show-search" :formObj="searchForm" :form-data="showFormData" @handleOk="handleSearch" @handleRest="handleReset">
<div slot="firstClassify">
<el-select v-model="searchForm.firstClassify" clearable placeholder="请选择" @change="changeClassify">
<el-option v-for="item in baseData.firstClassifyList" :key="item" :label="item" :value="item"></el-option>
</el-select>
</div>
<div slot="secondClassify">
<el-select v-model="searchForm.secondClassify" clearable placeholder="请选择">
<el-option v-for="item in baseData.secondClassifyList" :key="item" :label="item" :value="item"></el-option>
</el-select>
</div>
<template slot="score">
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.qualityTestScore"></el-input-range>
</template>
</GLCombiForm>
<div class="theader">
<div class="title">话术列表</div>
<el-radio-group v-model="searchForm.hitResult">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button label="1">命中</el-radio-button>
<el-radio-button label="0">未命中</el-radio-button>
</el-radio-group>
</div>
<GLTable ref="analyseTable" :get-list-api="getListApi" :search-form="searchFormSearch" :table-params="tableParams" :before-search-fn="beforeSearchFn" :pageConf="pageConf" :noDataImg="url">
<template slot="suggestions" slot-scope="scope">
<div v-html="formatSrt(scope.scope.suggestions)"></div>
</template>
<template slot="hitResult" slot-scope="scope">
<div :class="['tag', scope.scope.hitResult == 1 ? 'gre' : 'red']">
{{ scope.scope.hitResult == 1 ? '是' : '否' }}
</div>
</template>
</GLTable>
</div>
</template>
<script>
import ElInputRange from './el-input-range'
import url from '@/assets/empty.png'
import { Util, deepClone } from '@/common/util'
export default {
components: {
ElInputRange
},
props: {
detailObj: {
type: Object,
default: () => {}
}
},
data() {
return {
url: url,
sList: [
{
text: '话术评分',
formatter: data => {
return `<span style="font-weight:700;font-size:20px;">${data.score ? data.score : '0'}</span>分`
}
},
{
text: '预计营销结果',
formatter: data => {
let classStr = data.estimatedResult == '成交' ? (data.estimatedResult == '战败' ? 'redStr' : 'greenStr') : 'grayStr'
return `<span class="${classStr}" style="font-weight:700;font-size:20px;">${data.estimatedResult ? data.estimatedResult : '--'}</span>`
}
},
{
text: '开始录音时间',
formatter: data => {
return `<span style="font-weight:700;font-size:20px;">${data.startTime ? data.startTime : '--'}</span>`
}
},
{
text: '对话时长',
formatter: data => {
return `<span style="font-weight:700;font-size:20px;">${data.duration?this.toMinutesAndSeconds(data.duration):'--'}</span>`
}
// formatter: data => {
// let strHtml = this.toMinutesAndSeconds(data.duration).h
// ? `<span style="font-weight:700;font-size:20px">${this.toMinutesAndSeconds(data.duration).h}</span>小时
// <span style="font-weight:700;font-size:20px;">${this.toMinutesAndSeconds(data.duration).m}</span>分钟
// `
// : ` <span style="font-weight:700;font-size:20px;">${this.toMinutesAndSeconds(data.duration).m}</span>分钟`
// return strHtml
// }
}
],
searchForm: {
// firstClassify: '',
// secondClassify: '',
qualityTestScore: [],
hitResult: ''
},
searchFormSearch: {},
showFormData: [
// {
// label: '一级分类',
// name: 'firstClassify',
// addHtml: 'firstClassify'
// },
// {
// label: '二级分类',
// name: 'secondClassify',
// addHtml: 'secondClassify'
// },
{
label: '质检评分',
name: 'qualityTestScore',
addHtml: 'score'
}
],
select: '全部',
getListApi: this.$apis.quality.conversationCheckList,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '一级分类',
prop: 'firstClassify',
width: '120px'
},
{
label: '二级分类',
prop: 'secondClassify',
width: '140px'
},
{
label: '质检得分',
prop: 'score',
width: '100px'
},
{
label: '是否命中',
prop: 'hitResult',
width: '100px',
addHtml: 'hitResult'
},
{
label: '命中文本',
prop: 'hitText'
},
{
label: '话术建议',
prop: 'suggestions',
addHtml:'suggestions'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
firstClassifyList: [],
secondClassifyList: []
}
}
},
watch: {
'searchForm.hitResult'() {
this.$refs.analyseTable.refreshTable(true, true)
}
},
mounted() {
// this.getPointCategory()
},
methods: {
formatSrt(str) {
return str.replace(/\n/g, "<br/>")
},
toMinutesAndSeconds(seconds) {
seconds = Math.floor(seconds / 1000)
let formattedTime = ''
if (seconds < 60) return seconds + '秒'
else if (seconds > 3600) {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60)
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
return formattedTime
} else {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60),
remainingSeconds = seconds % 60
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
if (remainingSeconds > 0) formattedTime += remainingSeconds + '秒'
return formattedTime
}
},
// toMinutesAndSeconds(time) {
// time = time / 1000
// const h = Math.floor(time / 3600)
// const m = parseInt((time % 3600) / 60)
// return {
// h,
// m
// }
// },
getPointCategory() {
this.classifyMap = new Map()
this.$apis.quality.getPointCategory().then(res => {
// console.log(res)
this.baseData.firstClassifyList = Object.keys(res)
for (let item in res) {
this.classifyMap.set(item, res[item])
}
})
},
changeClassify() {
this.searchForm.secondClassify = ''
this.baseData.secondClassifyList = this.classifyMap.get(this.searchForm.firstClassify)
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchFormSearch = deepClone(this.searchForm)
this.searchFormSearch.batchId = this.detailObj.id
if (this.searchFormSearch.qualityTestScore) {
this.searchFormSearch.qualityTestScoreBegin = this.searchFormSearch.qualityTestScore[0]
this.searchFormSearch.qualityTestScoreEnd = this.searchFormSearch.qualityTestScore[1]
}
delete this.searchFormSearch.qualityTestScore
resolve()
})
},
handleSearch() {
this.$refs.analyseTable.refreshTable(true, true)
},
handleReset() {
this.searchForm = {
// firstClassify: '',
// secondClassify: '',
qualityTestScore: [],
hitResult: ''
}
this.baseData.secondClassifyList = []
this.$refs.analyseTable.refreshTable()
}
}
}
</script>
<style lang="scss" scoped>
.analyse {
.statistics {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
.s-item {
flex: 1;
// min-width: 248px;
background: #f7f9fa;
border-radius: 4px;
padding: 12px 20px;
box-sizing: border-box;
margin-right: 16px;
.title {
font-size: 14px;
color: #333333;
margin-bottom: 8px;
}
.content {
color: #333333;
line-height: 32px;
}
.greenStr {
color: #2cca74;
}
.redStr {
color: #eb4e4e;
}
.grayStr {
color: #999999;
}
}
}
.show-search{
margin-bottom:-68px;
}
.theader {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.title {
font-size: 16px;
color: #333333;
font-weight: 600;
}
}
.tag {
width: 30px;
height: 24px;
border-radius: 2px;
padding: 0 8px;
line-height: 24px;
box-sizing: border-box;
font-size: 14px;
margin: 0 auto;
}
}
</style>
<style>
.redStr {
color: #eb4e4e;
}
.greenStr {
color: #2cca74;
}
.grayStr{
color: #999999;
}
</style>