approvalModal.vue
3.12 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
<template>
<a-modal
:visible="visible"
:title="title"
:maskClosable="false"
:centered='true'
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="close"
cancelText="关闭"
okText="提交"
>
<a-spin :spinning="confirmLoading">
<div class="approval">
<a-form :form="form" >
<a-form-item label="审批结果">
<a-radio-group
v-decorator="['approvalResult', validatorRules.approvalResult]"
>
<a-radio :value="1">通过</a-radio>
<a-radio :value="2">拒绝</a-radio>
<a-radio :value="3">审批退回</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="审批意见">
<a-textarea
v-decorator="['approvalNote', validatorRules.approvalNote]"
placeholder="输入审批意见"
:autosize="{ minRows: 2, maxRows: 6 }"
/>
</a-form-item>
</a-form>
</div>
</a-spin>
</a-modal>
</template>
<script>
import { submitApprovalTrans } from '@/api/insys'
export default {
name: "repayFlowUploadModal",
data () {
return {
visible: false,
confirmLoading: false,
title: '授信审批',
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
form: this.$form.createForm(this),
validatorRules:{
approvalResult:{
rules: [{
required: true, message: '请选择审批结果',
}]
},
approvalNote:{
rules: [{
required: true, message: '请输入审批意见',
}]
}
},
model: {},
}
},
methods: {
add (val) {
this.model = val
this.form.resetFields();
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue();
});
},
close () {
this.$emit('close');
this.visible = false;
this.form.setFieldsValue();
},
handleSubmit() {
let that = this
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
let p = {
id: this.model.id,
...values
};
submitApprovalTrans(p).then(res => {
if (res.status.statusCode == 0) {
this.$message.success(res.status.statusReason)
this.form.resetFields()
this.$nextTick(() => {
this.form.setFieldsValue()
})
} else {
this.$message.warning(res.status.statusReason)
}
})
.finally(() => {
that.confirmLoading = false
that.close()
this.$emit('ok', 'approvalModalOk')
})
}
})
},
}
}
</script>
<style scoped>
.approval{
padding: 0 40px;
}
</style>