chore: codegen

This commit is contained in:
dap 2024-09-26 11:56:43 +08:00
parent 62e7cc6e7b
commit c3618e121e
4 changed files with 29 additions and 4 deletions

View File

@ -176,6 +176,7 @@ export interface Info {
crud: boolean;
// 树表需要添加此属性
params?: any;
popupComponent?: string;
}
export interface GenInfo {

View File

@ -100,8 +100,13 @@ async function initMenuSelect() {
onMounted(async () => {
const info = genInfoData.value;
for (const key in info) {
formApi.setFieldValue(key, info[key as keyof typeof info]);
await formApi.setValues(info);
//
if (info.options) {
const popupComponent = JSON.parse(info.options)?.popupComponent;
if (popupComponent) {
await formApi.setFieldValue('popupComponent', popupComponent);
}
}
await Promise.all([initTreeSelect(info.columns), initMenuSelect()]);
});

View File

@ -168,6 +168,20 @@ export const formSchema: FormSchemaGetter = () => [
fieldName: 'parentMenuId',
label: '上级菜单',
},
{
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
options: [
{ label: 'modal弹窗', value: 'modal' },
{ label: 'drawer抽屉', value: 'drawer' },
],
optionType: 'button',
},
defaultValue: 'modal',
fieldName: 'popupComponent',
label: '弹窗组件类型',
},
{
component: 'RadioGroup',
componentProps: {

View File

@ -20,9 +20,8 @@ async function handleSubmit() {
const requestData = cloneDeep(unref(genInfoData));
//
if (requestData && requestData.tplCategory === 'tree') {
const { parentMenuId, treeCode, treeName, treeParentCode } = requestData;
const { treeCode, treeName, treeParentCode } = requestData;
requestData.params = {
parentMenuId,
treeCode,
treeName,
treeParentCode,
@ -39,6 +38,12 @@ async function handleSubmit() {
column.isQuery = transform(query);
column.isRequired = transform(required);
});
//
requestData.params = {
...requestData.params,
parentMenuId: requestData.parentMenuId,
popupComponent: requestData.popupComponent,
};
}
await editSave(requestData);
//