feat: 完善档案删除与追溯码筛选

This commit is contained in:
Nixevol
2026-07-04 07:18:52 +08:00
parent e2b54a8027
commit f51f45bcb1
9 changed files with 190 additions and 54 deletions
+31 -2
View File
@@ -49,12 +49,13 @@ import { h, onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { NButton, NIcon, NTag, NAvatar, type DataTableColumns } from 'naive-ui';
import { SearchOutline, AddOutline, CreateOutline, BarChartOutline } from '@vicons/ionicons5';
import { SearchOutline, AddOutline, CreateOutline, BarChartOutline, TrashOutline } from '@vicons/ionicons5';
import { ArtworkStatus } from '@artveris/shared';
import { artworkApi } from '@/api';
import { useAuthStore } from '@/stores/auth';
import { fmt, statusType } from '@/utils/format';
import { useTablePage } from '@/composables/useTablePage';
import { dialog, message } from '@/utils/feedback';
const { t } = useI18n();
const router = useRouter();
@@ -106,7 +107,7 @@ const columns: DataTableColumns<any> = [
{
title: () => t('common.label.operation'),
key: 'ops',
width: 112,
width: 148,
fixed: 'right',
align: 'center',
render: (r) =>
@@ -133,6 +134,21 @@ const columns: DataTableColumns<any> = [
},
{ icon: () => h(NIcon, null, { default: () => h(BarChartOutline) }) },
),
auth.canWrite
? h(
NButton,
{
quaternary: true,
circle: true,
size: 'small',
type: 'error',
disabled: (r.codeCount ?? 0) > 0,
title: (r.codeCount ?? 0) > 0 ? t('pages.artwork.deleteDisabledTip') : t('common.action.delete'),
onClick: () => remove(r),
},
{ icon: () => h(NIcon, null, { default: () => h(TrashOutline) }) },
)
: null,
]),
},
];
@@ -159,6 +175,19 @@ function onSearch() {
function goCreate() {
router.push('/artworks/new');
}
function remove(r: any) {
dialog.warning({
title: t('common.action.delete'),
content: t('pages.artwork.deleteConfirm'),
positiveText: t('common.action.confirm'),
negativeText: t('common.action.cancel'),
onPositiveClick: async () => {
await artworkApi.remove(r.id);
message.success(t('common.msg.deleted'));
await load();
},
});
}
onMounted(load);
</script>