do.vue
2.05 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
<template>
<el-dialog
v-model="show" title="会员缴费审核" :close-on-click-modal="true" draggable
width="600"
@close="close"
>
<el-form :model="form" label-width="100" label-suffix=":">
<el-form-item v-if="!isBack" label="审批结果" prop="flag">
<el-radio-group v-model="form.flag">
<el-radio label="1">审批通过</el-radio>
<el-radio label="0">审批拒绝</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="isBack?'撤回理由':'备注'" prop="reason">
<el-input v-model="form.reason" type="textarea" rows="5" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer text-center">
<el-button type="primary" @click="doApproval">{{ isBack?'撤 回':'提 交' }}</el-button>
<el-button @click="show=false">取 消</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { getCurrentInstance, reactive } from '@vue/runtime-core'
import { ref, toRefs } from 'vue'
import { audit } from '@/api/member/audit.js'
const { proxy } = getCurrentInstance()
const emit = defineEmits(['approval'])
const data = reactive({
show: false,
form: {
flag: '1',
reason: null
}
})
const { show, form } = toRefs(data)
const isBack = ref(false)
function open(rows, flag) {
console.log(rows)
if (flag) {
isBack.value = true
form.value = {
flag: '0',
reason: null,
recordIds: rows
}
} else {
form.value = {
flag: '1',
reason: null,
recordIds: rows
}
}
show.value = true
}
function close() {
show.value = false
}
function doApproval() {
if (form.value.flag === '0' && !form.value.reason) {
proxy.$modal.msgError(isBack.value ? '请输入撤回理由' : '请输入拒绝理由')
return
}
audit(form.value)
.then(() => {
proxy.$modal.msgSuccess('操作成功')
show.value = false
emit('approval', form.value.flag)
})
}
defineExpose({
open,
close
})
</script>
<style scoped>
</style>