feat-wip(components): 数据字典相关页面代码提交

This commit is contained in:
2025-12-04 23:35:41 +08:00
parent ccf2565e1d
commit 59a9ca92fb

View File

@ -1,4 +1,4 @@
<script setup lang="ts">
<script setup lang="tsx">
import { computed, ref, watch } from 'vue';
import type { DataTableColumns } from 'naive-ui';
import { jsonClone } from '@sa/utils';
@ -70,6 +70,39 @@ const childrenColumns: DataTableColumns<DictionaryItem> = [
title: $t('page.sys.core.dictionary.item.fields.sort'),
align: 'center',
resizable: true
},
{
key: 'operate',
title: $t('common.operate'),
align: 'center',
width: 80,
render: _ => {
if (model.value.type === 'tree') {
return (
<div class="flex-center gap-8px">
<NButton type="success" ghost size="small">
{$t('common.children')}
</NButton>
<NButton type="primary" ghost size="small">
{$t('common.edit')}
</NButton>
<NButton type="error" ghost size="small">
{$t('common.delete')}
</NButton>
</div>
);
}
return (
<div class="flex-center gap-8px">
<NButton type="primary" ghost size="small">
{$t('common.edit')}
</NButton>
<NButton type="error" ghost size="small">
{$t('common.delete')}
</NButton>
</div>
);
}
}
];
@ -169,6 +202,11 @@ watch(visible, () => {
</NFormItem>
</NForm>
<NCard v-if="props.operateType === 'edit'" :title="$t('page.sys.core.dictionary.item.title')">
<template #header-extra>
<NSpace>
<NButton type="primary">{{ $t('common.add') }}</NButton>
</NSpace>
</template>
<NDataTable :data="model.children" :columns="childrenColumns" :bordered="true" />
</NCard>
</NScrollbar>