refactor: 重新生成单表代码生成预览

This commit is contained in:
puhui999
2025-04-22 14:57:11 +08:00
parent 062111502f
commit 6ca22ff155
4 changed files with 19 additions and 24 deletions

View File

@@ -52,22 +52,16 @@ export function useFormSchema(): VbenFormSchema[] {
valueFormat: 'x',
},
},
// TODO 【富文本】@puhui999@芋艿:后续要封装下;单独 pr
{
fieldName: 'description',
label: '简介',
rules: 'required',
component: 'Editor',
component: 'RichTextarea',
},
// TODO 【文件上传】@puhui999@芋艿:后续要封装下;单独 pr
{
fieldName: 'avatar',
label: '头像',
component: 'FileUpload',
componentProps: {
fileType: 'image',
maxCount: 1,
},
component: 'ImageUpload',
},
];
}
@@ -91,6 +85,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
componentProps: {
allowClear: true,
options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'),
placeholder: '请选择性别',
},
},
{

View File

@@ -25,15 +25,9 @@ function onRefresh() {
gridApi.query();
}
/** 导出表格 */
async function onExport() {
const data = await exportDemo01Contact(await gridApi.formApi.getValues());
downloadByData(data, '示例联系人.xls');
}
/** 创建示例联系人 */
function onCreate() {
formModalApi.setData(null).open();
formModalApi.setData({}).open();
}
/** 编辑示例联系人 */
@@ -60,18 +54,23 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
}
}
/** 导出表格 */
async function onExport() {
const data = await exportDemo01Contact(await gridApi.formApi.getValues());
downloadByData(data, '示例联系人.xls');
}
/** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<Demo01ContactApi.Demo01Contact>) {
switch (code) {
case 'delete': {
onDelete(row);
break;
}
// TODO @puhui999edit 放在 delete 前面哈。好理解一点,修改 => 删除
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
}
}

View File

@@ -47,6 +47,7 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
return;
}
@@ -55,9 +56,7 @@ const [Modal, modalApi] = useVbenModal({
if (!data) {
return;
}
if (data.id) {
// 编辑 TODO @puhui9991这里注释“编辑”去掉2data.id 上面的空行去掉;
modalApi.lock();
try {
data = await getDemo01Contact(data.id);