review:代码生成优化

pull/76/head
YunaiV 2025-04-19 10:18:54 +08:00
parent eea46a1920
commit 7622e9a666
4 changed files with 15 additions and 9 deletions

View File

@ -389,6 +389,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
}
/** 列表的字段 */
// TODO @puhui999getDataSourceConfigName要不改成 data.ts 加载 list然后使用。
export function useGridColumns<T = InfraCodegenApi.CodegenTable>(
onActionClick: OnActionClickFn<T>,
getDataSourceConfigName: ComputedRef<(cellValue: number) => string>,

View File

@ -5,7 +5,6 @@ import BasicInfo from '../modules/basic-info.vue';
import ColumnInfo from '../modules/column-info.vue';
import GenerationInfo from '../modules/generation-info.vue';
import { Page } from '@vben/common-ui';
import { ChevronsLeft } from '@vben/icons';
import { Button, message, Steps } from 'ant-design-vue';
import { getCodegenTable, updateCodegenTable } from '#/api/infra/codegen';
@ -73,6 +72,7 @@ const submitForm = async () => {
content: $t('ui.actionMessage.operationSuccess'),
key: 'action_process_msg',
});
// TODO @puhui999 tab
close();
} catch (error) {
console.error('保存失败', error);
@ -118,7 +118,7 @@ getDetail();
<template>
<Page auto-content-height v-loading="loading">
<div class="flex h-[95%] flex-col rounded-md bg-white p-4 dark:bg-[#1f1f1f] dark:text-gray-300">
<Steps type="navigation" :current="currentStep" class="mb-8 rounded shadow-sm dark:bg-[#141414]">
<Steps type="navigation" v-model:current="currentStep" class="mb-8 rounded shadow-sm dark:bg-[#141414]">
<Steps.Step v-for="(step, index) in steps" :key="index" :title="step.title" />
</Steps>
@ -136,8 +136,8 @@ getDetail();
<div class="mt-4 flex justify-end space-x-2">
<Button v-show="currentStep > 0" @click="prevStep"></Button>
<Button v-show="currentStep < steps.length - 1" type="primary" @click="nextStep"></Button>
<Button v-show="currentStep === steps.length - 1" type="primary" :loading="loading" @click="submitForm">
<Button v-show="currentStep < steps.length - 1" @click="nextStep"></Button>
<Button type="primary" :loading="loading" @click="submitForm">
保存
</Button>
</div>

View File

@ -122,14 +122,14 @@ async function onGenerate(row: InfraCodegenApi.CodegenTable) {
/** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<InfraCodegenApi.CodegenTable>) {
switch (code) {
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
case 'generate': {
onGenerate(row);
break;

View File

@ -1,4 +1,10 @@
<script lang="ts" setup>
// TODO @puhui999bug
// TODO @puhui999
// TODO @puhui999
// TODO @puhui999
// TODO @vben2.0 CodeEditor
import type { InfraCodegenApi } from '#/api/infra/codegen';
import { useVbenModal } from '@vben/common-ui';
@ -224,7 +230,6 @@ const [Modal, modalApi] = useVbenModal({
</div>
</Tabs.TabPane>
<template #rightExtra>
<!-- TODO @芋艿貌似别的模块也可以通过 :icon="h(Copy)" -->
<Button type="primary" ghost @click="copyCode" :icon="h(Copy)"> 复制代码 </Button>
</template>
</Tabs>