elementplus-vue-审核按钮-对话框(Dialog )

效果图:

代码:

<template>

<el-button type="success" @click="dialogVisible = true" :icon="Edit">审核</el-button>

<el-dialog

v-model="dialogVisible"

title="是否通过"

width="500"

align-center

>

<el-dialog

v-model="innerVisible"

width="500"

title="说明理由"

append-to-body

>

<!-- 新增不通过原因输入区域 -->

<div v-if="value === 'not_pass'" style="margin-top: 16px;">

<el-form>

<el-form-item label="不通过原因">

<el-input v-model="rejectReason" placeholder="请输入不通过原因"></el-input>

</el-form-item>

</el-form>

<!-- 新增不通过原因确认按钮 -->

<div class="dialog-footer" v-if="value === 'not_pass'">

<el-button @click="RejectReasonCancel">取消</el-button>

<el-button type="primary" @click="RejectReasonSubmit">确认并关闭</el-button>

</div>

</div>

</el-dialog>

<template #footer>

<div class="dialog-footer">

<el-select v-model="value" placeholder="请选择审核结果">

<el-option

v-for="item in options"

:key="item.value"

:label="item.label"

:value="item.value"

/>

</el-select>

<el-button @click="handleClose">取消</el-button>

<el-button type="primary" @click="handleSubmit">确定</el-button>

</div>

</template>

</el-dialog>

</template>

<script lang="ts" setup>

import { ElMessage, ElMessageBox } from 'element-plus'

import { Edit } from '@element-plus/icons-vue'

import { ref } from 'vue'

const dialogVisible = ref(false);

// 嵌套的对话框

const innerVisible = ref(false);

const value = ref('')

const rejectReason = ref('');

const RejectReasonSubmit = () => {

// 提交不通过原因的逻辑,这里仅为演示关闭对话框

ElMessage({

message: '不通过原因已记录',

type: 'success',

});

// 关闭内外两个对话框

innerVisible.value = false;

dialogVisible.value = false;

};

const RejectReasonCancel = () => {

innerVisible.value = false;

};

const handleClose =() =>{

ElMessage({

message:'取消操作',

type:'info'

})

dialogVisible.value = false;

};

const handleSubmit =() =>{

if(value.value ==='not_pass'){

innerVisible.value = true;

}else{

ElMessage({

message: '审核通过',

type:'success'

})

dialogVisible.value = false;

}

};

const options = [

{

value: 'pass',

label: '通过',

},

{

value: 'not_pass',

label: '不通过',

},

];

</script>

相关推荐
Csvn1 小时前
原型链、this 与闭包内存:三座深水区一次打通(含内存泄漏排查实战)
前端·javascript
葡萄城技术团队1 小时前
如何通过 JSON 数据源 / Web API 快速构建轻量级报表(Report)?
前端·json·原型模式
万维易源1 小时前
趣味项目素材|免费脑筋急转弯查询接口实战接入教程
javascript·免费api·脑筋急转弯查询·脑筋急转弯接口
浪兎兎1 小时前
【Java Web】Servlet + JSP 笔记
java·前端·servlet
Patrick_Wilson2 小时前
iOS Safari Clipboard API 权限弹窗问题
前端·ios·safari
OpenTiny社区3 小时前
Naive UI × GenUI SDK:自定义物料库搭建实战
前端·ai编程
kyriewen3 小时前
我拿 4 个真实前端任务试了 GLM-5.3 Flash:代码一遍跑通,账单 4 分钱
前端·程序员·ai编程
IT_陈寒3 小时前
Vue的响应式更新有时候真的不听话
前端·人工智能·后端
风骏时光牛马3 小时前
AI编程常见问题梳理与要点解析
前端
前端snow3 小时前
ai agent -- LCEL 汇总
前端