feat: 新增代码生成页面

This commit is contained in:
xlsea
2024-09-04 15:50:09 +08:00
parent c4d959d133
commit 824974e904
22 changed files with 1272 additions and 76 deletions

View File

@ -0,0 +1,25 @@
<script setup lang="ts">
defineOptions({
name: 'TableColumnCheckAlert'
});
const checkedRowKeys = defineModel<CommonType.IdType[]>('columns', { required: true });
</script>
<template>
<NAlert type="info">
<span v-if="checkedRowKeys.length">
已选择{{ checkedRowKeys.length }}条记录
<NButton class="pl-6px" text type="primary" @click="() => (checkedRowKeys = [])">清空</NButton>
</span>
<span v-else>未选中任何记录</span>
</NAlert>
</template>
<style scoped lang="scss">
.n-alert {
--n-padding: 5px 13px !important;
--n-icon-margin: 6px 8px 0 12px !important;
--n-icon-size: 20px !important;
}
</style>

View File

@ -9,9 +9,15 @@ interface Props {
itemAlign?: NaiveUI.Align;
disabledDelete?: boolean;
loading?: boolean;
showAdd?: boolean;
showDelete?: boolean;
}
defineProps<Props>();
withDefaults(defineProps<Props>(), {
itemAlign: undefined,
showAdd: true,
showDelete: true
});
interface Emits {
(e: 'add'): void;
@ -42,13 +48,13 @@ function refresh() {
<NSpace :align="itemAlign" wrap justify="end" class="lt-sm:w-200px">
<slot name="prefix"></slot>
<slot name="default">
<NButton size="small" ghost type="primary" @click="add">
<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>
<NPopconfirm @positive-click="batchDelete">
<NPopconfirm v-if="showDelete" @positive-click="batchDelete">
<template #trigger>
<NButton size="small" ghost type="error" :disabled="disabledDelete">
<template #icon>