refactor(sj_1.0.0): 删除CustomerTableHeaderOperation

This commit is contained in:
dhb52 2024-05-27 22:50:25 +08:00
parent 01159d9cd9
commit 426b36ddac
2 changed files with 11 additions and 90 deletions

View File

@ -14,7 +14,6 @@ import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table';
import { retryTaskStatusTypeRecord, retryTaskTypeRecord } from '@/constants/business';
import { tagColor } from '@/utils/common';
import CustomerTableHeaderOperation from './modules/customer-table-header-operation.vue';
import RetryTaskOperateDrawer from './modules/retry-task-operate-drawer.vue';
import RetryTaskBatchAddDrawer from './modules/retry-task-batch-add-drawer.vue';
import RetryTaskSearch from './modules/retry-task-search.vue';
@ -311,15 +310,23 @@ async function updateRetryTaskStatus(id: number, groupName: string, retryStatus:
header-class="view-card-header"
>
<template #header-extra>
<CustomerTableHeaderOperation
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
@add="handleAdd"
@batch-add="handleBatchAdd"
@delete="handleBatchDelete"
@refresh="getData"
/>
>
<template #addAfter>
<NButton size="small" ghost type="primary" @click="handleBatchAdd">
<template #icon>
<icon-ic-round-plus class="text-icon" />
</template>
{{ $t('common.batchAdd') }}
</NButton>
</template>
</TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"

View File

@ -1,86 +0,0 @@
<script setup lang="ts">
defineOptions({
name: 'CustomerTableHeaderOperation'
});
interface Props {
itemAlign?: NaiveUI.Align;
disabledDelete?: boolean;
loading?: boolean;
showDelete?: boolean;
showAdd?: boolean;
}
withDefaults(defineProps<Props>(), {
showDelete: true,
showAdd: true
});
interface Emits {
(e: 'add'): void;
(e: 'batchAdd'): void;
(e: 'delete'): void;
(e: 'refresh'): void;
}
const emit = defineEmits<Emits>();
const columns = defineModel<NaiveUI.TableColumnCheck[]>('columns', {
default: () => []
});
function add() {
emit('add');
}
function batchAdd() {
emit('batchAdd');
}
function batchDelete() {
emit('delete');
}
function refresh() {
emit('refresh');
}
</script>
<template>
<NSpace :align="itemAlign" wrap justify="end" class="lt-sm:w-200px">
<slot name="default">
<NButton v-if="showAdd" size="small" ghost type="primary" @click="add">
<template #icon>
<icon-ic-round-plus class="text-icon" />
</template>
{{ $t('common.add') }}
</NButton>
<NButton v-if="showAdd" size="small" ghost type="primary" @click="batchAdd">
<template #icon>
<icon-ic-round-plus class="text-icon" />
</template>
{{ $t('common.batchAdd') }}
</NButton>
<NPopconfirm v-if="showDelete" @positive-click="batchDelete">
<template #trigger>
<NButton size="small" ghost type="error" :disabled="disabledDelete">
<template #icon>
<icon-ic-round-delete class="text-icon" />
</template>
{{ $t('common.batchDelete') }}
</NButton>
</template>
{{ $t('common.confirmDelete') }}
</NPopconfirm>
</slot>
<NButton size="small" @click="refresh">
<template #icon>
<icon-mdi-refresh class="text-icon" :class="{ 'animate-spin': loading }" />
</template>
{{ $t('common.refresh') }}
</NButton>
<TableColumnSetting v-model:columns="columns" />
</NSpace>
</template>
<style scoped></style>