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
<template>
<el-dialog
class="rejectDialog"
title="拒绝"
:visible.sync="rejectDialogFormVisible"
:before-close="beforeClose"
@closed="resetForm"
>
<el-form :model="rejectForm">
<el-form-item label="拒绝备注" :label-width="formLabelWidth">
<el-input
v-model="rejectForm.remark"
:maxlength="30"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }"
placeholder="请输入拒绝备注"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog">取 消</el-button>
<el-button
type="primary"
@click="onSubmit"
>确 定</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'RejectDialog',
components: {},
props: {
// 控制dialog是否能显示
visible: {
type: Boolean,
require: true
}
},
data() {
return {
// 控制显隐
rejectDialogFormVisible: false,
// 表单标签宽度
formLabelWidth: '100px',
// 表单数据
rejectForm: {
remark: ''
}
}
},
computed: {},
watch: {
visible: {
handler(newVal) {
this.rejectDialogFormVisible = newVal
},
immediate: true
}
},
created() {},
mounted() {},
methods: {
/**
* @author WangXinYu
* @describe 关闭模态框前的回调
**/
beforeClose(done) {
this.$emit('update:visible', false)
done()
},
/**
* @author WangXinYu
* @describe 重置表单
**/
resetForm() {
this.rejectForm = {
remark: ''
}
},
/**
* @author WangXinYu
* @describe 关闭模态框
**/
closeDialog() {
this.$emit('update:visible', false)
},
/**
* @author WangXinYu
* @describe 处理确定事件
**/
onSubmit() {
this.$emit('onConfirm', this.rejectForm)
}
}
}
</script>
<style scoped>
.rejectDialog {
}
</style>