audit.vue
1.96 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
<template>
<el-dialog
:title="$t('audit.title')"
:visible.sync="visible"
width="50%"
@close="closeDialog"
>
<el-form label-width="120px">
<el-form-item :label="$t('audit.status')">
<el-select
v-model="form.state"
:placeholder="$t('audit.statusRequired')"
style="width: 100%"
>
<el-option
:label="$t('audit.approve')"
value="1100"
/>
<el-option
:label="$t('audit.reject')"
value="1200"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('audit.reason')">
<el-input
v-model="form.remark"
type="textarea"
:rows="3"
:placeholder="$t('audit.reasonRequired')"
/>
</el-form-item>
</el-form>
<div slot="footer">
<el-button @click="closeDialog">{{ $t('common.cancel') }}</el-button>
<el-button
type="primary"
@click="submitAudit"
>{{ $t('common.submit') }}</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'AuditDialog',
data() {
return {
visible: false,
form: {
state: '',
remark: ''
}
}
},
watch: {
'form.state'(val) {
if (val === '1100') {
this.form.remark = this.$t('audit.approve')
} else if (val === '1200') {
this.form.remark = this.$t('audit.reject') + ': '
}
}
},
methods: {
open() {
this.form = {
state: '',
remark: ''
}
this.visible = true
},
closeDialog() {
this.visible = false
},
submitAudit() {
if (!this.form.state) {
this.$message.warning(this.$t('audit.statusRequired'))
return
}
if (!this.form.remark) {
this.$message.warning(this.$t('audit.reasonRequired'))
return
}
this.$emit('success', this.form)
this.closeDialog()
}
}
}
</script>