chore: 修改代码,列表头部插槽方式添加按钮

This commit is contained in:
AN
2025-04-24 22:22:11 +08:00
parent e381db8ba7
commit f446ac4387
7 changed files with 100 additions and 99 deletions

View File

@ -163,30 +163,29 @@ async function handleCleanOperLog() {
<OperLogSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
<NCard title="操作日志列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
<template #header-extra>
<NSpace>
<NPopconfirm v-if="hasAuth('monitor:operlog:remove')" @positive-click="() => handleCleanOperLog()">
<template #trigger>
<NButton type="warning" ghost size="small">
<template #icon>
<icon-ic-round-delete class="text-icon" />
</template>
清空
</NButton>
</template>
确认清空操作日志
</NPopconfirm>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="false"
:show-delete="hasAuth('monitor:operlog:remove')"
:show-export="hasAuth('monitor:operlog:export')"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
/>
</NSpace>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="false"
:show-delete="hasAuth('monitor:operlog:remove')"
:show-export="hasAuth('monitor:operlog:export')"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
>
<template #prefix>
<NButton
v-if="hasAuth('monitor:operlog:remove')"
type="warning"
ghost
size="small"
@click="handleCleanOperLog"
>
清空
</NButton>
</template>
</TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"

View File

@ -183,23 +183,30 @@ async function handleRefreshCache() {
<ConfigSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
<NCard title="参数配置列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
<template #header-extra>
<NSpace>
<NButton v-if="hasAuth('system:config:remove')" type="warning" ghost size="small" @click="handleRefreshCache">
刷新缓存
</NButton>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="hasAuth('system:config:add')"
:show-delete="hasAuth('system:config:remove')"
:show-export="hasAuth('system:config:export')"
@add="handleAdd"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
/>
</NSpace>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="hasAuth('system:config:add')"
:show-delete="hasAuth('system:config:remove')"
:show-export="hasAuth('system:config:export')"
@add="handleAdd"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
>
<template #prefix>
<NButton
v-if="hasAuth('system:config:remove')"
type="warning"
ghost
size="small"
@click="handleRefreshCache"
>
刷新缓存
</NButton>
</template>
</TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"

View File

@ -156,18 +156,19 @@ async function addInRow(row: TableDataWithIndex<Api.System.Dept>) {
<DeptSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<NCard title="部门列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
<template #header-extra>
<div class="flex items-center gap-8px">
<NButton size="small" @click="expandAll">展开</NButton>
<NButton size="small" @click="collapseAll">收起</NButton>
<TableHeaderOperation
v-model:columns="columnChecks"
:loading="loading"
:show-add="hasAuth('system:dept:add')"
:show-delete="false"
@add="handleAdd"
@refresh="getData"
/>
</div>
<TableHeaderOperation
v-model:columns="columnChecks"
:loading="loading"
:show-add="hasAuth('system:dept:add')"
:show-delete="false"
@add="handleAdd"
@refresh="getData"
>
<template #prefix>
<NButton size="small" @click="expandAll">展开</NButton>
<NButton size="small" @click="collapseAll">收起</NButton>
</template>
</TableHeaderOperation>
</template>
<NDataTable
:columns="columns"

View File

@ -184,23 +184,24 @@ async function handleRefreshCache() {
<DictTypeSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
<NCard title="字典类型列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
<template #header-extra>
<NSpace>
<NButton v-if="hasAuth('system:dict:remove')" type="warning" ghost size="small" @click="handleRefreshCache">
刷新缓存
</NButton>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="hasAuth('system:dict:add')"
:show-delete="hasAuth('system:dict:remove')"
:show-export="hasAuth('system:dict:export')"
@add="handleAdd"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
/>
</NSpace>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="hasAuth('system:dict:add')"
:show-delete="hasAuth('system:dict:remove')"
:show-export="hasAuth('system:dict:export')"
@add="handleAdd"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
>
<template #prefix>
<NButton v-if="hasAuth('system:dict:remove')" type="warning" ghost size="small" @click="handleRefreshCache">
刷新缓存
</NButton>
</template>
</TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"

View File

@ -201,31 +201,24 @@ async function handleExport() {
<TenantSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
<NCard title="租户列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
<template #header-extra>
<NSpace>
<NPopconfirm v-if="isSuperAdmin" @positive-click="() => handleSyncTenantDict()">
<template #trigger>
<NButton size="small">
<template #icon>
<icon-material-symbols:sync-rounded />
</template>
同步租户字典
</NButton>
</template>
确认同步租户字典
</NPopconfirm>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="hasAuth('system:tenant:add')"
:show-delete="hasAuth('system:tenant:delete')"
:show-export="hasAuth('system:tenant:export')"
@add="handleAdd"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
/>
</NSpace>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-add="hasAuth('system:tenant:add')"
:show-delete="hasAuth('system:tenant:delete')"
:show-export="hasAuth('system:tenant:export')"
@add="handleAdd"
@delete="handleBatchDelete"
@export="handleExport"
@refresh="getData"
>
<template #prefix>
<NButton v-if="isSuperAdmin" type="warning" ghost size="small" @click="handleSyncTenantDict">
同步租户字典
</NButton>
</template>
</TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"