This commit is contained in:
李想 2025-03-12 10:12:54 +08:00
parent 8412ba4bf8
commit 2740fb22b5
2 changed files with 13 additions and 18 deletions

View File

@ -14,21 +14,11 @@
@row-save="handleSave"
@row-update="handleUpdate"
>
<template #menu="{ index, row }">
<el-dropdown>
<el-icon style="padding: 14px 0"><More /></el-icon>
<template #dropdown>
<el-dropdown-menu>
<template v-for="item in actions" :key="item.name">
<el-dropdown-item @click="item.event(row, index)">
<el-button :type="item.type ?? 'primary'" :icon="item.icon" :size="item.size" :disabled="item.disabled" text>
{{ item.name == '查看' ? (row.status == '1' ? '禁用' : '启用') : item.name }}
</el-button>
</el-dropdown-item>
</template>
</el-dropdown-menu>
</template>
</el-dropdown>
<template #menu-left>
<el-button type="primary" @click="handleDownSoilType">导出</el-button>
</template>
<template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" />
</template>
</avue-crud>
</CustomCard>
@ -46,6 +36,7 @@ const {
pageData,
option,
actions,
handleDownSoilType,
handleSizeChange,
handleCurrentChange,
handleSearch,

View File

@ -62,8 +62,8 @@ export default function useSoilTypeHook() {
});
const actions = ref([
{
name: '查看',
icon: 'view',
name: ({ row }) => (row.status == '0' ? '启用' : '禁用'),
icon: 'TurnOff',
event: handleStatusChange,
},
{
@ -90,7 +90,7 @@ export default function useSoilTypeHook() {
pageData.value.total = res.data.total;
}
}
async function handleStatusChange(row, index) {
async function handleStatusChange({ row, index }) {
await editSoilType(row, index);
}
function handleCurrentChange(val) {
@ -153,6 +153,9 @@ export default function useSoilTypeHook() {
pageData.value.pageSize = 10;
getList();
}
function handleDownSoilType() {
console.log('handleDownSoilType');
}
return {
crudRef,
condition,
@ -167,5 +170,6 @@ export default function useSoilTypeHook() {
handleSizeChange,
handleSave,
handleUpdate,
handleDownSoilType,
};
}