This commit is contained in:
wangzenghua 2025-03-25 08:45:53 +01:00
parent a7a9d4eead
commit 60022829f6

View File

@ -30,14 +30,14 @@
<el-button type="success" icon="download" @click="handleExport">导出</el-button>
<el-button type="success" icon="upload" @click="onUpload">导入</el-button>
</template>
<template #menu="{ row }">
<!-- <template #menu="{ row }">
<el-button type="info" link @click="handleView(row)">查看</el-button>
<el-popconfirm title="确定删除该土地?" @confirm="() => handleDelete(row.id)">
<template #reference>
<el-button type="danger" link>删除</el-button>
</template>
</el-popconfirm>
</template>
</template> -->
<template #area-form>
<section class="area_form_">
<el-input-number v-model="landArea" :precision="2" :step="1" :min="1" controls-position="right"></el-input-number>
@ -58,7 +58,12 @@
<template #landUrl-form="{ type }">
<Attrs v-model:attrs="landAttrs" :type="type" />
</template>
<template #menu="scope">
<custom-table-operate :actions="option.actions" :data="scope" />
</template>
</avue-crud>
<custom-import-excel
ref="importExcelRef"
:template-url="getAssetsFile('template/土地模版表.xlsx')"
@ -416,6 +421,24 @@ const option = reactive({
],
},
],
actions: [
{
name: '查看',
icon: 'view',
event: ({ row }) => handleView(row),
},
// {
// name: '',
// icon: 'edit',
// event: ({ row }) => rowEdit(row),
// },
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => handleDelete(row.id),
},
],
});
const searchData = reactive({
landName: '',
@ -495,11 +518,26 @@ async function handleExport() {
window.URL.revokeObjectURL(link);
}
}
async function handleDelete(id) {
let res = await delLand(id);
if (res.code == 200) {
getList();
}
function handleDelete(id) {
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
delLand(id)
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
getList();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
}
function handleView(obj) {
rowData.value = obj;