调整删除方法 放弃使用el-popover 删除操作使用弹窗提示

This commit is contained in:
piexlMax
2024-03-13 22:37:07 +08:00
parent 7b79ec6c66
commit 50b1d21d13
11 changed files with 223 additions and 618 deletions

View File

@@ -86,16 +86,7 @@
<div class="gva-table-box">
<div class="gva-btn-list">
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
<el-popover v-model:visible="deleteVisible" :disabled="!multipleSelection.length" placement="top" width="160">
<p>确定要删除吗?</p>
<div style="text-align: right; margin-top: 8px;">
<el-button type="primary" link @click="deleteVisible = false">取消</el-button>
<el-button type="primary" @click="onDelete">确定</el-button>
</div>
<template #reference>
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="deleteVisible = true">删除</el-button>
</template>
</el-popover>
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="onDelete">删除</el-button>
</div>
<el-table
ref="multipleTable"
@@ -549,12 +540,13 @@ const deleteRow = (row) => {
})
}
// 批量删除控制标记
const deleteVisible = ref(false)
// 多选删除
const onDelete = async() => {
ElMessageBox.confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
const {{.PrimaryField.FieldJson}}s = []
if (multipleSelection.value.length === 0) {
ElMessage({
@@ -576,9 +568,9 @@ const onDelete = async() => {
if (tableData.value.length === {{.PrimaryField.FieldJson}}s.length && page.value > 1) {
page.value--
}
deleteVisible.value = false
getTableData()
}
})
}
// 行为控制标记(弹窗内部需要增还是改)