review:代码生成的 demo01、demo02

This commit is contained in:
YunaiV
2025-04-12 09:47:52 +08:00
parent 4f90f46a8f
commit 1f914e2ce2
5 changed files with 12 additions and 18 deletions

View File

@@ -83,6 +83,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
component: 'RangePicker',
componentProps: {
allowClear: true,
// TODO @puhui999缺了你写的哪个时间选择哈
},
},
];
@@ -132,7 +133,7 @@ export function useGridColumns(
name: 'CellOperation',
options: [
{
code: 'add_child',
code: 'add_child', // TODO @puhui999append 使用这个单词哈,和之前 vben 官方示例一致
text: '新增下级',
show: hasAccessByCodes(['infra:demo02-category:create']),
},

View File

@@ -13,8 +13,7 @@ import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<Demo02CategoryApi.Demo02Category>();
// 新增下级时的父级ID
const parentId = ref<number>();
const parentId = ref<number>(); // 新增下级时的父级 ID
const getTitle = computed(() => {
if (formData.value?.id) {
@@ -26,10 +25,7 @@ const getTitle = computed(() => {
const [Form, formApi] = useVbenForm({
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
commonConfig: {
labelWidth: 120,
},
showDefaultActions: false
});
const [Modal, modalApi] = useVbenModal({
@@ -65,6 +61,7 @@ const [Modal, modalApi] = useVbenModal({
}
// 处理新增下级的情况
// TODO @puhui999按照 dept 或者 menu 的 form 处理风格,可以更简洁一点;可能 parentId 也不用啦
if (!data.id && data.parentId) {
parentId.value = data.parentId;
formData.value = { parentId: parentId.value } as Demo02CategoryApi.Demo02Category;