danbaoxinzeng.vue
9.26 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
<template>
<a-modal :title="title" :width="1200" :centered="true" :visible="visible" v-if="visible" :confirmLoading="confirmLoading"
:okButtonProps="{ props: { disabled: disableSubmit } }" @cancel="handleCancel" cancelText="关闭" style="top:20px;"
:maskClosable="false">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-card title="担保类型" :bordered="false">
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="借款订单编号" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
<a-input placeholder="请输入借款订单编号" :readOnly="onlyread"
v-decorator="['orderNo', { initialValue: modelList ? modelList.orderNo : '', rules: [{ required: true, message: '请输入企业名称' }] }]" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="客户类型" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
<a-select placeholder="请选择" :disabled="onlyread"
v-decorator="['customerType', { initialValue: modelList ? modelList.customerType : '', rules: [{ required: true, message: '请输入客户类型' }] }]">
<a-select-option :value="1">个人</a-select-option>
<a-select-option :value="2">企业</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="担保类别" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
<a-select placeholder="请选择" @change="baoChange" :disabled="onlyread"
v-decorator="['guaranteeType', { initialValue: modelList ? modelList.guaranteeType : '', rules: [{ required: true, message: '请输入担保类别' }] }]">
<a-select-option :value="1">保险</a-select-option>
<a-select-option :value="2">担保人</a-select-option>
<a-select-option :value="3">抵/质押</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="担保名称" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
<a-input placeholder="请输入担保名称" :readOnly="onlyread && disableSubmit"
v-decorator="['guaranteeName', { initialValue: modelList ? modelList.guaranteeName : '', rules: [{ required: true, message: '请输入企业名称' }] }]" />
</a-form-item>
</a-col>
</a-row>
<!-- <a-row :gutter="24" v-show="!disableSubmit" style="float:right;margin-right:20px;">
<a-button style="margin-right:10px;" @click="handleCancel">取消</a-button>
<a-button type="primary" @click="handleSubmit">确定</a-button>
</a-row> -->
</a-card>
</a-form>
<a-card title="担保内容" :bordered="false">
<Baoxian v-if="bao == 1" ref="danMobile" @handleSubmit2="handleSubmit2" :model.sync="model" :modelList.sync="modelList"
:typeBtn.sync="typeBtn" :disableSubmit.sync="disableSubmit"
@load="load"></Baoxian>
<Danbaoren v-if="bao == 2" ref="danMobile" @handleSubmit2="handleSubmit2" :model2.sync="model2" :modelList.sync="modelList"
:typeBtn.sync="typeBtn" :disableSubmit.sync="disableSubmit"
@load="load">
</Danbaoren>
<Zhiya v-if="bao == 3" ref="danMobile" @handleSubmit2="handleSubmit2" :model3.sync="model3" :modelList.sync="modelList"
:typeBtn.sync="typeBtn" :disableSubmit.sync="disableSubmit"
@load="load"></Zhiya>
</a-card>
</a-spin>
<template slot="footer">
<a-button @click="handleCancel">关闭</a-button>
<a-button type="primary" v-show="!disableSubmit" @click="handleSubmit">确定</a-button>
</template>
</a-modal>
</template>
<script>
import { changPassword } from '@/api/api'
import { saveOrUpdateGuaranteeInfoMain, getGuaranteeInfoList } from '@/api/configApi'
import Baoxian from './baoxian.vue'
import Zhiya from './zhiya.vue';
import Danbaoren from './danbaoren.vue';
export default {
name: "PasswordModal",
components: { Baoxian, Zhiya, Danbaoren },
data() {
return {
visible: false,
confirmLoading: false,
confirmDirty: false,
title: "",
typeBtn: "add",
xinzeng: {},
dbList: [],
onlyread: false,
disableSubmit: true,
model: [],
model2: [],
model3: [],
modelList: [],
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
form: this.$form.createForm(this),
id: "",
bao: '1',
recordOrderNo: "",
guaranteeType: '',
guarantee: '',
order: '',
ss: ''
};
},
created() {
console.log("created");
},
methods: {
edit(username, id, orderNo, ca) {
// console.log(username)
this.id = id
this.recordOrderNo = orderNo
this.guaranteeType = username.guaranteeInfoMainResponse.guaranteeType
console.log(username)
// alert(ca)
if (ca == 1) {
this.typeBtn = "edit";
} else {
this.typeBtn = "aa";
}
this.ss = "edit"
this.form.resetFields();
this.visible = true;
let lis = username.guaranteeInfoFollowResponseList
this.modelList = username.guaranteeInfoMainResponse
this.model = lis.filter(item => item.guaranteeType == 1)
this.model2 = lis.filter(item => item.guaranteeType == 2)
this.model3 = lis.filter(item => item.guaranteeType == 3)
this.bao = username.guaranteeInfoMainResponse.guaranteeType
this.$nextTick(() => {
this.form.setFieldsValue(username)
})
},
add(username) {
// alert("111111")
this.typeBtn = "add";
this.ss = "add"
this.form.resetFields();
this.onlyread = false
this.bao = 1
this.model = []
this.model2 = []
this.model3 = []
this.modelList = []
// this.$refs.danMobile.newTable = []
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue();
});
},
onChange() { this.close(); },
close() {
this.$emit("close");
this.visible = false;
this.disableSubmit = false;
this.selectedRole = [];
},
handleSubmit() {
// 触发表单验证
this.form.validateFields((err, values) => {
console.log(err, values);
if (!err) {
this.confirmLoading = true;
if (this.ss == "add") {
var li = {
guaranteeFollowListRequest: this.$refs.danMobile.newTable,
guaranteeInfoMain: {
orderNo: values.orderNo,
customerType: values.customerType,
guaranteeType: values.guaranteeType,
guaranteeName: values.guaranteeName,
}
}
} else if (this.ss == "edit") {
var li = {
guaranteeInfoMain: {
orderNo: values.orderNo,
customerType: values.customerType,
guaranteeType: values.guaranteeType,
guaranteeName: values.guaranteeName,
id: this.id
}
}
}
let formData = Object.assign(li);
this.confirmLoading = false;
// let formData = values
saveOrUpdateGuaranteeInfoMain(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();
});
}
});
},
handleSubmit2() {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
// this.confirmLoading = true;
let l = { id: this.id };
let b = { flag: 2 }
this.order = values.orderNo
this.guarantee = values.guaranteeType
var formData = Object.assign(values, l, b);
this.$refs.danMobile.add(formData)
this.confirmLoading = false;
// this.close();
// let formData = values
// saveOrUpdateGuaranteeInfoMain(formData)
// .then(res => {
// if (res.status.statusCode == 0) {
// // this.$message.success(res.status.statusReason);
// this.$emit("ok");
// this.$refs.danMobile.add(formData)
// }
// else {
// this.$message.warning(res.status.statusReason);
// }
// })
// .finally(() => {
// this.confirmLoading = false;
// // this.close();
// });
}
});
},
baoChange(value) {
this.bao = value
},
success() {
this.form.validateFields((err, values) => {
this.dbList = values
//alert(values)
});
},
load() {
var _p = { orderNo: this.recordOrderNo, guaranteeType: this.guaranteeType }
getGuaranteeInfoList(_p).then(res => {
if (res.status.statusCode == 0) {
let lis = res.result.guaranteeInfoFollowResponseList
this.modelList = res.result.guaranteeInfoMainResponse
if (this.guaranteeType == 1) {
this.model = lis.filter(item => item.guaranteeType == 1)
this.$refs.danMobile.newTable = lis.filter(item => item.guaranteeType == 1)
} else if (this.guaranteeType == 2) {
this.model2 = lis.filter(item => item.guaranteeType == 2)
this.$refs.danMobile.newTable = lis.filter(item => item.guaranteeType == 2)
} else if (this.guaranteeType == 3) {
this.model3 = lis.filter(item => item.guaranteeType == 3)
this.$refs.danMobile.newTable = lis.filter(item => item.guaranteeType == 3)
}
this.bao = res.result.guaranteeInfoMainResponse.guaranteeType
this.$nextTick(() => {
this.form.setFieldsValue(res.result)
})
} else {
this.$message.warning(res.status.statusReason)
}
})
},
tableUp(res) {
},
handleCancel() {
this.close();
}
},
}
</script>