review:代码生成的 demo01、demo02

pull/73/MERGE
YunaiV 2025-04-12 09:47:52 +08:00
parent 4f90f46a8f
commit 1f914e2ce2
5 changed files with 12 additions and 18 deletions

View File

@ -51,12 +51,14 @@ export function useFormSchema(): VbenFormSchema[] {
valueFormat: 'x',
},
},
// TODO 【富文本】@puhui999@芋艿:后续要封装下;单独 pr
{
fieldName: 'description',
label: '简介',
rules: 'required',
component: 'Editor',
},
// TODO 【文件上传】@puhui999@芋艿:后续要封装下;单独 pr
{
fieldName: 'avatar',
label: '头像',

View File

@ -2,7 +2,6 @@
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { Demo01ContactApi } from '#/api/infra/demo/demo01';
import { DocAlert } from '#/components/doc-alert';
import Form from './modules/form.vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons';
@ -63,14 +62,14 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
/** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<Demo01ContactApi.Demo01Contact>) {
switch (code) {
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
}
}
@ -106,8 +105,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template>
<Page auto-content-height>
<DocAlert title="示例联系人" url="https://doc.iocoder.cn/infra/" />
<FormModal @success="onRefresh" />
<Grid table-title="">
<template #toolbar-tools>

View File

@ -20,10 +20,7 @@ const getTitle = computed(() => {
const [Form, formApi] = useVbenForm({
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
commonConfig: {
labelWidth: 120,
},
showDefaultActions: false
});
const [Modal, modalApi] = useVbenModal({

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;