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>

相关推荐
@大迁世界2 小时前
Firefox 本地模式:localhost 再见了 ?
前端·架构
米米商聊4 小时前
同名附件为什么被 Map 覆盖?重复键与一对多索引
前端·javascript
echome8886 小时前
Python 异常处理:try、else、finally 的正确搭配
开发语言·前端·python·异常处理·编程技巧
时间的情敌6 小时前
OpenLayers 实战|Vue3 + OpenLayers 完整工程案例(加载天地图、要素、弹窗、绘制、WFS)
前端·openlayers
陈随易6 小时前
下载神器!Motrix 停更三年后重写回归
前端·后端·程序员
前端的日常6 小时前
一个人+AI做情侣食谱小程序,0 费用的服务器
前端·后端
计算机魔术师7 小时前
谷歌搜索广告踩刹车,AI广告成为救命稻草
前端
总要学点什么7 小时前
第81篇:数据可视化-PM2.5分布——让圆点的胖瘦替每座城市报出浓度
前端·信息可视化·echarts·cesium·空间分析
IT_陈寒7 小时前
Vue的v-for里用了个临时变量,页面直接挂了
前端·人工智能·后端
hunter_0767 小时前
一次 iOS 真机签名 409 的完整排查:证书、设备、描述文件为什么总是"对不上"
前端