吉安感知网项目-前端
chenyao
2026-01-28 bcb34e720eb55bc1f9d03d4b4bca557a4b93d4e5
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
<template>
    <el-dialog
        class="gd-dialog"
        v-model="visible"
        :title="'拒绝申请'"
        @closed="visible = false"
        destroy-on-close
        width="550px"
        align-center
        :close-on-click-modal="false"
    >
        <div class="detail-container">
            <div class="detail-cell-reject">
                <span class="cell-label">拒绝原因:</span>
                <el-input v-model="reasonForRejection" style="width: 380px" type="textarea" :rows="4" placeholder="请输入" />
            </div>
        </div>
        <template #footer>
            <el-button class="" color="#4C34FF" @click="handleConfirm">确认</el-button>
        </template>
    </el-dialog>
</template>
 
<script setup>
import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
 
const props = defineProps({
    modelValue: {
        type: Boolean,
        default: false,
    },
})
 
const emit = defineEmits(['update:modelValue', 'confirm'])
 
const visible = ref(props.modelValue)
const reasonForRejection = ref('')
 
// 监听visible变化,同步到父组件
watch(
    () => visible.value,
    newVal => {
        emit('update:modelValue', newVal)
    }
)
 
// 监听父组件modelValue变化
watch(
    () => props.modelValue,
    newVal => {
        visible.value = newVal
    }
)
 
// 确认按钮点击事件
const handleConfirm = () => {
    if (!reasonForRejection.value.trim()) {
        return ElMessage.warning('请输入拒绝原因')
    }
    emit('confirm', reasonForRejection.value)
    visible.value = false
    reasonForRejection.value = ''
}
</script>
 
<style scoped lang="scss">
.detail-cell-reject {
display: flex;
justify-content: flex-start;
    }
</style>