extendedWarranty.vue
14.1 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!-- 延保权益 -->
<template>
<div class="container">
<GLCombiForm ref="showSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-wrapper">
<div class="operate_wrap">
<span class="table_title">延保权益项目</span>
<div class="operate_btn">
<el-button :size="size" type="primary" @click="addClause(1)">新增</el-button>
<el-button :size="size" @click="handleExport">导出</el-button>
</div>
</div>
<GLTable ref="equityRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div slot="statusSlot" slot-scope="scope">
<span class="statsu-circle" :style="{ 'background-color': scope.scope.serviceStatus == 0 ? '#FDB757' : '#2CCA74' }"></span>
<span>{{ scope.scope.serviceStatus == 0 ? '待配置' : '已配置' }}</span>
</div>
<span slot="auth-button" slot-scope="scope" :data="scope.scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</span>
</GLTable>
</div>
<pdf-dialog :isVisible="isPdfVisible" title="合同" :pdfUrl="pdfUrl" @closeDialog="handlePdfClose"></pdf-dialog>
<!-- <recordDialog v-if="isRecordView" :relate-visible="isRecordView" @handleConfirm="handleConfirm" @handleClose="handleClose" :info="recordInfo"></recordDialog> -->
<GLDialog :destroy-on-close="isdestroy" :hasFooter="false" :close-on-click-modal="false" title="修改记录" mode="mid" :visible.sync="isRecordView" :before-close="handleClose">
<div class="record-dialog">
<el-timeline>
<el-timeline-item :class="[{ spec: !index }]" v-for="(item, index) in operationRecordData" :key="index" :timestamp="item.createdDateStr">
{{ item.content }}
</el-timeline-item>
</el-timeline>
<div class="noData" v-if="operationRecordData.length == 0">
<img class="noDataImg" :src="url" v-if="url" alt="" />
<div>暂无数据</div>
</div>
</div>
</GLDialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import utils from '../../util/util'
import pdfDialog from '@/views/beforeSale/pdfDialog'
// import recordDialog from './components/recordDialog'
import url from '@/assets/empty.png'
export default {
name: 'ExtendedWarranty',
components: {
pdfDialog
// recordDialog
},
data() {
return {
url,
isdestroy: true,
size: 'small',
recordInfo: {},
operationRecordData: [],
isRecordView: false,
buttonList: [
{
type: 'el-button',
name: row => {
return '查看'
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.addClause(2, row.scope)
}
},
{
type: 'el-button',
name: row => {
return '编辑'
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.addClause(3, row.scope)
}
},
{
type: 'el-button',
name: row => {
return '合同预览'
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.handlePdf(row.scope)
}
},
{
type: 'el-button',
name: row => {
return '修改记录'
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.handleRecordView(row.scope)
}
}
],
searchForm: {
serviceName: '',
powerType: '',
supportPosition: '',
createdDate: '',
updatedDate: ''
},
tableSearchForm: {},
searchFormData: [
{
label: '服务名称',
name: 'serviceName',
type: 'input',
maxlength: 50,
isClear: true
},
{
label: '动力类型',
name: 'powerType',
type: 'select',
optionList: [],
optionId: 'key',
optionLabel: 'label'
},
{
label: '保障部件',
name: 'supportPosition',
type: 'select',
optionList: [],
optionId: 'key',
optionLabel: 'label'
},
{
label: '创建时间',
name: 'createdDate',
type: 'datePicker',
labelWidth: 95,
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '更新时间',
name: 'updatedDate',
type: 'datePicker',
labelWidth: 95,
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
// 表格
getListApi: this.$apis.serviceConfig.getExtendedWarrantyListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '服务编号',
prop: 'serviceCode',
width: 150,
line: 1
},
{
label: '服务名称',
prop: 'serviceName',
width: 260
},
{
label: '服务介绍',
prop: 'serviceContent',
width: 260,
line: 1
},
{
label: '动力类型',
width: 180,
prop: 'powerType',
line: 1
},
{
label: '保障部件',
prop: 'supportPosition',
width: 180,
line: 1
},
{
label: '保险公司',
prop: 'insuranceCompany',
width: 200,
line: 1
},
{
label: '创建时间',
prop: 'updatedDate',
width: 200,
formatter: cellValue => {
return cellValue.updatedDate ? dayjs(cellValue.updatedDate).format('YYYY-MM-DD HH:mm:ss') : '--'
}
},
{
label: '更新时间',
prop: 'updatedDate',
width: 200,
formatter: cellValue => {
return cellValue.updatedDate ? dayjs(cellValue.updatedDate).format('YYYY-MM-DD HH:mm:ss') : '--'
}
},
{
label: '操作人',
prop: 'updatedBy',
width: 140
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
isRecordSync: false,
isPdfVisible: false
}
},
mounted() {
this.getSearchlist()
},
methods: {
handleClose() {
this.isRecordView = !this.isRecordView
},
getSearchlist() {
this.$apis.serviceConfig.getScreeningDataApi({}).then(res => {
if (!res) return
let allObj = { key: '', label: '全部' }
let _index = this.searchFormData.findIndex(item => item.name === 'powerType')
res.powerTypeList = res.powerTypeList.map((item, index) => {
return {
key: index,
label: item
}
})
this.searchFormData[_index].optionList = res.powerTypeList || []
this.searchFormData[_index].optionList?.unshift(allObj)
_index = this.searchFormData.findIndex(item => item.name === 'supportPosition')
res.supportPositionList = res.supportPositionList.map((item, index) => {
return {
key: index,
label: item
}
})
this.searchFormData[_index].optionList = res.supportPositionList || []
this.searchFormData[_index].optionList?.unshift(allObj)
})
},
getParams() {
let params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm?.createdDate?.length) {
params.beginCreateTime = new Date(this.searchForm.createdDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endCreateTime = new Date(this.searchForm.createdDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
if (this.searchForm?.updatedDate?.length) {
params.beginUpdateTime = new Date(this.searchForm.updatedDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endUpdateTime = new Date(this.searchForm.updatedDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createdDate
delete params.updatedDate
let _index = this.searchFormData.findIndex(item => item.name === 'powerType')
params.powerType = !this.filterEmpty(params.powerType) ? this.searchFormData[_index]?.optionList?.[params.powerType + 1]?.label : ''
_index = this.searchFormData.findIndex(item => item.name === 'supportPosition')
params.supportPosition = !this.filterEmpty(params.supportPosition) ? this.searchFormData[_index]?.optionList?.[params.supportPosition + 1]?.label : ''
return { ...params }
},
filterEmpty(data) {
return (data ?? '') === ''
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
handlePdfClose() {
this.isPdfVisible = !this.isPdfVisible
},
handleRecordView(row) {
// this.recordInfo = row
// this.isRecordView = !this.isRecordView
let params = {
pageNum: 1,
pageSize: 10000,
serviceCode: row.serviceCode
}
this.$apis.serviceConfig.modifyDetailRecord(params).then(res => {
const spaces = ' '.repeat(3)
res?.forEach(val => {
val.createdDateStr = `${val.createdBy}${spaces}${dayjs(val.createdDate).format('YYYY-MM-DD HH:mm:ss')}`
// 规格A,服务年限5年,,投保成本/元 上架成本/元 嘀加成本/元
// val.content = `规格${val.serviceGrade},服务年限${val.servicePeriod}年,`
// val.content = ''
let childContent = ''
if (val.recordType == 1) {
val.content = `【${val.recordType == 1 ? '删除' : '修改'}】状态:${val.useStatus ? '禁用' : '启用'},投保成本${val.insuranceCost}元,上架成本${val.shelfCost}元,嘀加成本${val.salesCost}元,`
val?.deleteList?.forEach((v, index) => {
childContent = `${v.fieldName}${v.beforeValue}${v.valueUnit || ''}${index < val?.deleteList?.length - 1 ? ',' : ''}`
val.content += childContent
})
} else {
val.content = `【${val.recordType == 1 ? '删除' : '修改'}】`
val?.detailList?.forEach((v, index) => {
childContent = `${v.fieldName}由${v.beforeValue}${v.valueUnit || ''}变为${v.afterValue}${v.valueUnit || ''}${index < val?.detailList?.length - 1 ? ',' : ''}`
val.content += childContent
})
}
})
this.operationRecordData = res || []
this.handleClose()
})
},
// 合同预览
handlePdf(row) {
this.pdfUrl = row?.previewUrl
this.handlePdfClose()
},
// 导出
handleExport() {
var params = this.getParams()
this.$apis.serviceConfig.exportExtendedWarrantyApi(params).then(res => {
// window.open(res)
let tempaa = utils.getExplorer()
if (tempaa == 'QQ') {
window.open(res)
} else {
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = res
document.body.appendChild(iframe)
}
})
},
handleSearch() {
this.$refs.equityRef.refreshTable()
},
handleReset() {
this.searchForm = {
serviceName: '',
powerType: '',
supportPosition: '',
createdDate: '',
updatedDate: ''
}
this.handleSearch()
},
addClause(type, row) {
// 1新增 2查看 3编辑
const { id, serviceCode, serviceName } = row || {}
let query = {
type,
extendedFlag: true // 延保项目页面标识
}
if (type != 1) {
query.id = id
query.serviceCode = serviceCode
query.serviceName = serviceName
}
const queryStr = encodeURIComponent(JSON.stringify(query))
this.$router.push('/serviceConfig/addService/' + queryStr)
}
}
}
</script>
<style lang="scss" scoped>
.container {
background-color: #ffffff;
padding: 20px;
.statsu-circle {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background-color: #fdb757;
margin-right: 8px;
vertical-align: middle;
}
}
.record-dialog {
max-height: calc(80vh - 60px);
padding-left: 12px;
.el-timeline-item {
/deep/ .el-timeline-item__node {
width: 8px;
height: 8px;
}
/deep/ .el-timeline-item__tail {
left: 2px;
}
/deep/ .el-timeline-item__wrapper {
.el-timeline-item__content {
color: #333333;
line-height: 23px;
font-size: 14px;
}
.el-timeline-item__timestamp {
color: #999999;
font-size: 12px;
}
}
}
.el-timeline-item:first-child {
/deep/ .el-timeline-item__node {
background: #2a58ad !important;
}
}
.noData {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
padding: 104px;
}
}
.record-dialog {
max-height: calc(80vh - 60px);
padding-left: 12px;
.el-timeline-item {
/deep/ .el-timeline-item__node {
width: 8px;
height: 8px;
}
/deep/ .el-timeline-item__tail {
left: 2px;
}
/deep/ .el-timeline-item__wrapper {
.el-timeline-item__content {
color: #333333;
line-height: 23px;
font-size: 14px;
}
.el-timeline-item__timestamp {
color: #999999;
font-size: 12px;
}
}
}
.el-timeline-item:first-child {
/deep/ .el-timeline-item__node {
background: #2a58ad !important;
}
}
.noData {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
padding: 104px;
}
}
</style>