addAccount.vue
11.3 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
<template>
<div>
<a-modal
:title="title"
:maskClosable="false"
:width="800"
:centered="true"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="handleCancel"
cancelText="关闭"
style="top:20px;"
>
<a-spin :spinning="confirmLoading">
<a-form v-if="type=='edit'" :form="form">
<a-form-item v-show="false" label="客户类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入客户类型" v-decorator="['customerType']" />
</a-form-item>
<a-form-item label="所属上层节点:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<p>{{detailDatas.length>0?formData.nodeName:'--'}}</p>
</a-form-item>
<a-form-item v-if="formData.nodeLevel!=2" label="节点名称:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :disabled="true" placeholder="请输入节点名称" v-decorator="[ 'businessName', validatorRules.businessName]" />
</a-form-item>
<a-form-item v-if="formData.nodeLevel==2" label="业务线名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
placeholder="请选择业务线"
@change="value => handleChange(value,{type:'businessNo'})"
v-decorator="[ 'businessNo', validatorRules.businessNo]"
>
<a-select-option :disabled="true"
v-for="(item, index) in productList"
:key="index"
:value="item.businessChannelNo"
>{{item.businessChannelName}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="授信类型:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select @change="value => handleCreditChange(value)" v-decorator="[ 'nodeCreditType', validatorRules.nodeCreditType]" placeholder="请选择授信类型">
<!-- <a-select-option value>请选择</a-select-option> -->
<a-select-option :value="1">直接授信</a-select-option>
<a-select-option :value="2">继承上层百分比</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="占上层比例:" v-if="zhanbiFlag" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
style="width:30%"
id="inputNumber"
placeholder="请输入占上层比例"
:min="1" :max="100"
v-decorator="[ 'nodeExtendsRatio',validatorRules.nodeExtendsRatio]"
/> %
</a-form-item>
<a-form-item label="分期类型:" v-if="formData.nodeLevel==3" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-decorator="[ 'productType', {rules: [
{
required:true,
message: '请选择分期类型'
}
]}]" placeholder="请选择分期类型">
<!-- <a-select-option value>请选择</a-select-option> -->
<a-select-option :value="1">未分期</a-select-option>
<a-select-option :value="2">分期</a-select-option>
</a-select>
</a-form-item>
</a-form>
<!-- 添加模板 -->
<a-form :form="form" v-if="type=='add'">
<a-form-item v-show="false" label="客户类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入客户类型" v-decorator="['customerType']" />
</a-form-item>
<a-form-item label="所属上层节点:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<p>{{detailDatas.length>0?formData.nodeName:'--'}}</p>
</a-form-item>
<a-form-item v-if="formData.nodeLevel!=3" label="节点名称:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入节点名称" v-decorator="[ 'businessName', validatorRules.businessName]" />
</a-form-item>
<a-form-item label="业务线名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
placeholder="请选择业务线"
@change="value => handleChange(value,{type:'businessNo'})"
v-decorator="[ 'businessNo', validatorRules.businessNo]"
>
<a-select-option
v-for="(item, index) in productList"
:key="index"
:value="item.businessChannelNo"
>{{item.businessChannelName}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="授信类型:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select @change="value => handleCreditChange(value)" v-decorator="[ 'nodeCreditType', validatorRules.nodeCreditType]" placeholder="请选择授信类型">
<!-- <a-select-option value>请选择</a-select-option> -->
<a-select-option :value="1">直接授信</a-select-option>
<a-select-option :value="2">继承上层百分比</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="占上层比例:" v-if="zhanbiFlag" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
style="width:30%"
id="inputNumber"
placeholder="请输入占上层比例"
:min="1" :max="100"
v-decorator="[ 'nodeExtendsRatio',validatorRules.nodeExtendsRatio]"
/> %
</a-form-item>
<a-form-item label="分期类型:" v-if="formData.nodeLevel==3" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-decorator="[ 'productType', validatorRules.productType]" placeholder="请选择分期类型">
<!-- <a-select-option value>请选择</a-select-option> -->
<a-select-option :value="1">未分期</a-select-option>
<a-select-option :value="2">分期</a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</div>
</template>
<script>
import { postAction, updateCreditModelConfig,getBusinessChannelSelect,
saveCreditModelConfig } from '@/api/configApi'
export default {
name: 'PasswordModal',
props:['detailDatas'],
data() {
return {
visible: false,
detailFlag:false,
formData:{},//基础信息
zhanbiFlag:false,//占比显示
title: '',
productList:[],
type:'add',
confirmLoading: false,
confirmDirty: false,
validatorRules: {
businessNo: {
rules: [
{
required: true,
message: '请选择业务线'
}
]
},
businessName: {
rules: [
{
required: true,
message: '请输入节点名称'
// pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
// message: '密码由8位数字、大小写字母和特殊符号组成!'
},
// {
// validator: this.validateToNextPassword
// }
]
},
parentNodeId: {
rules: [
{
required: true,
message: '请选择所属上层节点'
}
]
},
nodeCreditType: {
rules: [
{
required: true,
message: '请选择授信类型'
}
]
},
nodeExtendsRatio:{
rules: [
{
required: true,
message: '请填写占上层比例'
}
]
},
},
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
form: this.$form.createForm(this)
}
},
created() {
let _params = {
pageNo: 1,
pageSize: 10000,
params: {}
}
postAction('/config/admin/getBusinessChannelSelect', _params).then(r => {
this.productList = r.result
console.log("ssssss")
})
},
computed:{},
watch:{},
methods: {
handleChange(value,params) {
// console.log(value,params)
for(var i=0,len= this.productList.length;i<len;i++){
if(value == this.productList[i].businessChannelNo){
this.model.businessNo=value
this.model.businessName=this.productList[i].businessChannelName
console.log(this.model)
return '';
}
}
},
handleCreditChange(value){
console.log(value)
this.zhanbiFlag = value==1?false:true
},
edit(record) {
this.type = "edit"
this.title='修改节点信息'
this.formData = record
this.zhanbiFlag = record.nodeCreditType==1?false:true
console.log('修改',this.formData)
// this.model = record
this.form.resetFields();
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(record);
});
},
add(record) {
this.form.resetFields()
console.log(record)
if(!record){
this.formData.customerType=this.detailDatas.customerType
}
this.type = "add"
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue()
})
},
onChange() {},
close() {
this.$emit('close')
this.visible = false
this.detailFlag = false
this.disableSubmit = false
this.selectedRole = []
},
handleSubmit() {
// 触发表单验证
this.form.validateFields((err, values) => {
console.log(err, values);
// this.close()
if (!err) {
this.confirmLoading = true
let formData = Object.assign(this.model, values);
// formData.businessName =this.model.businessName
if(this.formData.nodeLevel==2){
formData.businessName =this.formData.businessName
formData.nodeName =this.formData.nodeName
formData.customerType =this.formData.customerType
formData.id =this.formData.id
}else{
formData.customerType =this.formData.customerType
formData.id =this.formData.id
}
console.log(formData)
// return '';
if(this.type!='edit'){
saveCreditModelConfig(formData)
.then(res => {
if (res.status.statusCode == 0) {
this.$message.success(res.status.statusReason)
this.$emit('ok')
} else {
this.$message.warning(res.status.statusReason)
}
})
.finally(() => {
this.confirmLoading = false
this.close()
})
}else{
updateCreditModelConfig(formData)
.then(res => {
if (res.status.statusCode == 0) {
this.$message.success(res.status.statusReason)
this.$emit('getModle')
this.$emit('ok')
} else {
this.$message.warning(res.status.statusReason)
}
})
.finally(() => {
this.confirmLoading = false
this.close()
})
}
}
})
},
handleCancel() {
this.close()
}
}
}
</script>