index.vue
7.79 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
<template>
<baseDialog
:is-show.sync="dialogShow"
:config="setting"
:dialog-config="dialogConfig.config"
class="detail-content"
customClose
@handleClick="handleClick"
@cancelBtn="handleDetailClose"
:btnLoding="btnLoding"
>
<div
v-loading="loading"
class="content"
>
<img
:src="stepImg"
class="step-img"
>
<tips-box
:step="step"
:tableData="tableData"
/>
<div :class="['step-content',{step2:step == 2}, {hide:step == 3}]">
<div :class="['step-box',{show:step == 1}]">
<Step1
ref="step1"
:loading.sync="loading"
/>
</div>
<div :class="['step-box',{show:step == 2}]">
<Step2
ref="step2"
:tableData="tableData"
/>
</div>
</div>
</div>
<template #footerCustom>
<template v-if="step == 2 && showAgree">
<div class="agree-box">
<el-checkbox v-model="agree">我确认以上已上传的凭证真实有效,并知晓系统将同步变更拍卖平台上的交付人信息。</el-checkbox>
</div>
</template>
</template>
</baseDialog>
</template>
<script>
import dayjs from "dayjs"
// import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"
import TipsBox from "./TipsBox"
import Step1 from "./step-1"
import Step2 from "./step-2"
import { createStaffHandover, queryAssets } from "@api/usedCarManagement"
export default {
// mixins: [reportTrackPageMixin],
name: "addHandover",
components: {
TipsBox,
Step1,
Step2
},
props: {
visible: {
type: Boolean,
default: false
},
},
computed: {
dialogShow: {
get () {
return this.visible
},
set (val) {
this.$emit('update:visible', false)
}
},
setting () {
const { step } = this
return {
isShowFooter: true,
showClose: true,
appendToBody: false,
btnList: [],
hideConfirmBtn: step == 3,
cancel_name: step == 2 ? '上一步' : '返回',
confirm_name: {
1: '下一步:扫描资产',
2: '提交变更'
}[step]
}
},
stepImg () {
const { step } = this
return require(`./images/step-${step}.webp`)
},
componentName () {
return {
1: 'Step1',
2: 'Step2'
}[this.step]
},
step1Ref () {
return this.$refs.step1
},
step2Ref () {
return this.$refs.step2
},
showAgree () {
const { tableData } = this
let flag = false
let len = tableData.findIndex(item => item.signCustodyStatus)
if (len != -1) flag = true
return flag
}
},
mounted () { },
watch: {
visible: {
handler (val) {
if (val) {
this.step = 1
this.loading = true
this.agree = false
this.$nextTick(() => {
this.step1Ref.init()
})
// setTimeout(() => this.loading = false, 1e3)
} else {
this.step = 1
this.loading = false
}
},
immediate: true,
deep: true
}
},
data () {
return {
step: 1,
dialogConfig: {
config: {
title: "发起业务交接",
width: "1200px"
}
},
loading: true,
tableData: [],
btnLoding: false,
agree: false
}
},
methods: {
handleDetailClose () {
this.btnLoding = false
const { step } = this
if (step != 2) return this.$emit('update:visible', false)
else this.step = 1
},
handleClick () {
const { step } = this
if (step == 1) this.queryAssets()
if (step == 2) this.createStaffHandover()
},
async queryAssets () {
try {
const { formObj } = this.step1Ref,
{ originalUserId, newUserId } = formObj
if (!originalUserId) throw '请原责任人'
if (!newUserId) throw '请选择新接收人'
this.btnLoding = true
const data = await queryAssets({
originalUserId
})
this.btnLoding = false
if (data) {
console.log(data)
data.evalOrders.map(e => e.proofUrls = [])
this.step = 2
this.tableData = data.evalOrders || []
}
} catch (error) {
this.btnLoding = false
if (error) this.notice.warningTips(error)
}
},
async createStaffHandover () {
try {
this.btnLoding = true
const { formObj } = this.step1Ref,
{ filterArr } = this.step2Ref,
{ showAgree, agree } = this
let num = 0
const assets = filterArr()
let agreeFlag = false
if (assets.length) {
assets.map(i => {
if (i.signCustodyStatus && !i.proofUrls.length) num += 1
if (i.signCustodyStatus) agreeFlag = true
})
if (num > 0) throw `有${num}辆“已签协议”的车辆未上传交接凭证。\n请在列表中点击“上传凭证”按钮补充材料`
} else throw {
text: '至少选择一个资产',
type: 'infoTips'
}
if (showAgree && !agree && agreeFlag) throw {
text: '请勾选底部的确认协议复选框',
type: 'infoTips'
}
const params = {
...formObj,
assets
},
data = await createStaffHandover(params)
if (data) {
this.notice.okTips('操作成功')
this.btnLoding = false
this.step = 3
this.$emit("refresh")
}
} catch (error) {
console.log(error)
this.btnLoding = false
if (error && error.type) {
const { text, type } = error
this.notice[type](text || '未知错误')
}
if (typeof error == 'string') this.notice.errorTips(error || '未知错误')
}
}
}
}
</script>
<style lang="scss" scoped>
.flex {
display: flex;
align-items: center;
}
.detail-content {
::v-deep .el-dialog {
max-height: 70vh;
display: flex;
flex-direction: column;
.el-dialog__body {
overflow-y: scroll;
padding-bottom: 24px;
max-height: calc(100% - 137px);
}
.el-dialog__footer {
margin-top: auto;
border-top: 1px solid #e5e5e5;
}
.dialog-footer {
border-top: none;
padding-top: 10px;
}
}
.content {
.step-img {
display: block;
width: 1040px;
height: 103px;
margin: 0 auto;
}
}
.circle {
display: inline-block;
border-radius: 50%;
width: 6px;
height: 6px;
margin-right: 8px;
vertical-align: middle;
}
.div-title {
display: flex;
align-items: center;
height: 50px;
font-size: 16px;
font-weight: 600;
color: #333333;
// margin: 10px 0 20px 0;
}
.block {
height: 24px;
}
.step-content {
position: relative;
width: 100%;
min-height: 82px;
.step-box {
position: absolute;
top: 0;
left: 0;
width: 100%;
visibility: hidden;
height: 0;
overflow: hidden;
}
.show {
visibility: visible;
height: auto;
}
}
.step2 {
min-height: 264px;
// min-height: 298px;
}
.hide {
min-height: 0 !important;
}
.agree-box {
position: absolute;
top: 10px;
left: 0;
display: flex;
align-items: center;
height: 36px;
color: #666666;
font-size: 14px;
::v-deep.el-checkbox__label {
color: #666666;
}
}
}
</style>