strategicAddModal.vue
11.2 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
<template>
<a-modal :title="title" :width="800" :visible="visible" :maskClosable="false" :confirmLoading="confirmLoading"
okText="下一步" @ok="handleNextStep" @cancel="handleCancel" cancelText="取消" style="top:20px;">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="审批流程编号" :labelCol="labelCol" :wrapperCol="wrapperCol"
v-show="model.strategyNo ? true : false">
<a-input placeholder="请输入审批流程编号" v-decorator="['strategyNo', { 'initialValue': model ? model.strategyNo : '' }]"
:disabled="model.strategyNo ? true : false" />
</a-form-item>
<a-form-item label="审批流程名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入审批流程名称" :maxLength="16"
v-decorator="['strategyName', validatorRules.strategyName]" />
</a-form-item>
<a-form-item label="审批流程类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择审批流程类型" v-decorator="['strategyType', validatorRules.strategyType]"
@change="handleSelectChange">
<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="进件/用信流名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
placeholder="请选择进件/用信流名称"
v-decorator="['processName', validatorRules.processName]"
@change="handleSelectChangeProcessName"
>
<a-select-option v-for="(item,index) in copyProcessList" :key="index" :value="item.code">{{item.value}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="进件/用信流编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入进件/用信流编号" v-decorator="['processNo', validatorRules.processNo]" :disabled="true"/>
</a-form-item> -->
<a-form-item label="产品名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择产品" v-decorator="['productNo', validatorRules.productNo]" ref="cpbh" @change="chanpin">
<a-select-option v-for="(item, index) in cpOption" :key="index" :value="item.productNo">{{ item.productName }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="产品编号" :labelCol="labelCol" :wrapperCol="wrapperCol" style="display: none;">
<a-input placeholder="请输入产品编号" v-decorator="['productName', validatorRules.productName]" :disabled="true"/>
</a-form-item>
<a-form-item label="资金方" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择资金方" v-decorator="['fundNo']">
<a-select-option v-for="(item, index) in zjOption" :key="index" :value="item.fundNo">{{ item.fundName }}
</a-select-option>
<!-- <a-select-option :value="2">拍拍贷</a-select-option> -->
</a-select>
</a-form-item>
<!-- <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="风控授信区间">
<a-input-number :min="0" :max="999999999" v-decorator="['minAmount']" @change="handleNumberChangeMin" />
<label style="margin:0 10px;">—</label>
<a-input-number :min="0" :max="999999999" v-decorator="['maxAmount']" @change="handleNumberChangeMax" />
</a-form-item> -->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="备注">
<a-textarea :rows="4" placeholder="最多输入60字" :maxLength="60" v-decorator="['strategyNote']" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import Vue from 'vue'
import store from '@/store'
import pick from 'lodash.pick'
import { postAction } from '@/api/configApi'
import { saveApprovalStrategyConfig, modifyApprovalStrategyConfig } from '@/api/insys'
export default {
name: "strategicAddModel",
data() {
return {
cpOption: [],
zjOption:[],
form: this.$form.createForm(this),
visible: false,
confirmLoading: false,
confirmDirty: false,
disableSubmit: false,
validatorRules: {
strategyName: {
rules: [{
required: true,
message: '请输入审批流程名称'
}]
},
strategyType: {
rules: [{
required: true,
message: '请选择审批流程类型'
}]
},
processName: {
rules: [{
required: true,
message: '请选择进件/用信流名称'
}]
},
processNo: {
rules: [{
required: true,
message: '请输入进件/用信流编号'
}]
},
},
tips: '',
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
copyProcessList: [],
dbFund: JSON.parse(sessionStorage.getItem('FUND_APPROVAL')),
title: '',
}
},
created() {
this.cpInitPrudect()
this.zjInitPrudect()
},
methods: {
cpInitPrudect() {
let _params = {
pageNo: 1,
pageSize: 10000,
params: {}
}
postAction('/config/admin/queryProductList', _params).then(r => {
this.cpOption = r.result.records.filter(item => item.status ==1)
//console.log(this.cpOption)
// alert("1111")
})
},
zjInitPrudect() {
let _params = {
pageNo: 1,
pageSize: 10000,
params: {}
}
postAction('/config/admin/queryFundList', _params).then(r => {
this.zjOption = r.result.records.filter(item => item.status ==1)
//console.log(this.zjOption)
// alert("1111")
})
},
chanpin(value){
let obj = this.cpOption.find(o => o.productNo === value);
console.log(obj.productName)
this.form.setFieldsValue({
productName: obj.productName,
});
// this.form.setFieldsValue({
// productNo: value,
// });
},
handleSelectChange(value) {
// if(value == 1){
// this.copyProcessList = Vue.ls.get('SET_PROCESSLIST').length <=0 ? [] : Vue.ls.get('SET_PROCESSLIST')
// }else{
// this.copyProcessList = Vue.ls.get('SET_COLLECTPROCESSLIST').length <=0 ? [] : Vue.ls.get('SET_COLLECTPROCESSLIST')
// }
// if(this.copyProcessList.length<=0){
// this.form.setFieldsValue({
// processName:'',
// processNo: '',
// });
// }
},
handleSelectChangeProcessName(value) {
this.form.setFieldsValue({
processNo: value,
});
},
show(record) {
this.title = '查看'
this.form.resetFields();
this.visible = true;
this.model = record;
this.model.show = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(record, 'strategyNo', 'strategyName', 'productNo', 'productName', 'strategyType', 'processName', 'processNo', 'fundNo', 'minAmount', 'maxAmount', 'strategyNote'));
});
},
edit(record) {
this.title = '编辑'
this.model = record;
this.form.resetFields();
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(record, 'strategyNo', 'strategyName', 'productName', 'productNo', 'strategyType', 'processName', 'processNo', 'fundNo', 'minAmount', 'maxAmount', 'strategyNote'));
this.handleSelectChange(record.strategyType)
});
},
add() {
this.title = '新增'
this.model = {};
this.form.resetFields();
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue();
});
},
close() {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
this.selectedRole = [];
},
handleNumberChangeMin(value) {
this.model.minAmount = value
},
handleNumberChangeMax(value) {
this.model.maxAmount = value
},
handleNextStep() {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
let promiseFn, formData
//查看逻辑处理
if (!!this.model.show) {
this.$router.push({
path: "/core/strategicModel/activiti",
query: {
modelId: this.model.modelId,
disabled: true
}
});
return false
}
console.log("chufalema")
//金额区间判断
if (((values.minAmount == null || values.minAmount == undefined) && (values.maxAmount != null || values.maxAmount != undefined)) || ((values.minAmount != null || values.minAmount != undefined) && (values.maxAmount == null || values.maxAmount == undefined))) {
this.$message.error('请输入完整的金额区间');
return false
}
// if((values.minAmount != null || values.minAmount != undefined) && (values.maxAmount != null || values.maxAmount != undefined)){
// }
// else if((values.minAmount === null || values.minAmount === undefined ) && (values.maxAmount === null || values.maxAmount === undefined )){
// }
// else{
// this.$message.error('请输入完整的金额区间');
// return false
// }
console.log("chufalema2")
this.confirmLoading = true;
console.log()
//code value 转换
// let list = values.strategyType == '1' ? Vue.ls.get('SET_PROCESSLIST') : Vue.ls.get('SET_COLLECTPROCESSLIST')
// for(var i=0 ;i<list.length; i++){
// if( values.processName == list[i].code){
// values.processName = list[i].value
// }
// }
console.log("chufalema3")
if (!!this.model.id) { //编辑
formData = Object.assign({ modelId: this.model.modelId, id: this.model.id }, values);
promiseFn = modifyApprovalStrategyConfig(formData);
} else {
formData = Object.assign(values);
promiseFn = saveApprovalStrategyConfig(formData)
}
console.log("chufalema4")
promiseFn.then((res) => {
console.log("you")
if (res.status.statusCode == 0) {
this.$message.success(res.status.statusReason);
this.$emit('ok');
this.$router.push({
path: "/core/strategicModel/activiti",
query: {
modelId: res.result.modelId,
}
});
this.confirmLoading = false;
this.close();
} else {
this.$message.warning(res.status.statusReason);
}
}).finally(() => {
this.confirmLoading = false;
this.close();
});
}
})
},
handleCancel() {
this.close()
},
handleConfirmBlur(e) {
const value = e.target.value
this.confirmDirty = this.confirmDirty || !!value
}
}
}
</script>