chore: 更新codegen
This commit is contained in:
parent
8d4378ad7f
commit
62e7cc6e7b
@ -22,7 +22,7 @@ const routes = useRoute();
|
|||||||
// 获取路由参数
|
// 获取路由参数
|
||||||
const tableId = routes.params.tableId as string;
|
const tableId = routes.params.tableId as string;
|
||||||
|
|
||||||
const genInfoData = ref<GenInfo>();
|
const genInfoData = ref<GenInfo['info']>();
|
||||||
|
|
||||||
provide('genInfoData', genInfoData);
|
provide('genInfoData', genInfoData);
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ onMounted(async () => {
|
|||||||
const resp = await genInfo(tableId);
|
const resp = await genInfo(tableId);
|
||||||
// 需要做菜单转换 严格相等 才能选中回显
|
// 需要做菜单转换 严格相等 才能选中回显
|
||||||
resp.info.parentMenuId = safeParseNumber(resp.info.parentMenuId);
|
resp.info.parentMenuId = safeParseNumber(resp.info.parentMenuId);
|
||||||
genInfoData.value = resp;
|
genInfoData.value = resp.info;
|
||||||
setTabTitle(`生成配置: ${resp.info.tableName}`);
|
setTabTitle(`生成配置: ${resp.info.tableName}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import { formSchema } from './basic';
|
|||||||
/**
|
/**
|
||||||
* 从父组件注入
|
* 从父组件注入
|
||||||
*/
|
*/
|
||||||
const genInfoData = inject('genInfoData') as Ref<GenInfo>;
|
const genInfoData = inject('genInfoData') as Ref<GenInfo['info']>;
|
||||||
|
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
@ -99,7 +99,7 @@ async function initMenuSelect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const { info } = genInfoData.value;
|
const info = genInfoData.value;
|
||||||
for (const key in info) {
|
for (const key in info) {
|
||||||
formApi.setFieldValue(key, info[key as keyof typeof info]);
|
formApi.setFieldValue(key, info[key as keyof typeof info]);
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ async function handleNext() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const data = await formApi.getValues();
|
const data = await formApi.getValues();
|
||||||
Object.assign(genInfoData.value.info, data);
|
Object.assign(genInfoData.value, data);
|
||||||
toCurrentStep(1);
|
toCurrentStep(1);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -4,6 +4,7 @@ import type { GenInfo } from '#/api/tool/gen/model';
|
|||||||
import { inject, type Ref, unref } from 'vue';
|
import { inject, type Ref, unref } from 'vue';
|
||||||
|
|
||||||
import { Space, Table } from 'ant-design-vue';
|
import { Space, Table } from 'ant-design-vue';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
import { editSave } from '#/api/tool/gen';
|
import { editSave } from '#/api/tool/gen';
|
||||||
|
|
||||||
@ -12,15 +13,16 @@ import { toCurrentStep } from '../mitt';
|
|||||||
/**
|
/**
|
||||||
* 从父组件注入
|
* 从父组件注入
|
||||||
*/
|
*/
|
||||||
const genInfoData = inject('genInfoData') as Ref<GenInfo>;
|
const genInfoData = inject('genInfoData') as Ref<GenInfo['info']>;
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
try {
|
try {
|
||||||
const requestData = unref(genInfoData).info;
|
const requestData = cloneDeep(unref(genInfoData));
|
||||||
// 树表需要添加这个参数
|
// 树表需要添加这个参数
|
||||||
if (requestData && requestData.tplCategory === 'tree') {
|
if (requestData && requestData.tplCategory === 'tree') {
|
||||||
const { treeCode, treeName, treeParentCode } = requestData;
|
const { parentMenuId, treeCode, treeName, treeParentCode } = requestData;
|
||||||
requestData.params = {
|
requestData.params = {
|
||||||
|
parentMenuId,
|
||||||
treeCode,
|
treeCode,
|
||||||
treeName,
|
treeName,
|
||||||
treeParentCode,
|
treeParentCode,
|
||||||
@ -37,11 +39,6 @@ async function handleSubmit() {
|
|||||||
column.isQuery = transform(query);
|
column.isQuery = transform(query);
|
||||||
column.isRequired = transform(required);
|
column.isRequired = transform(required);
|
||||||
});
|
});
|
||||||
// 需要手动添加父级菜单
|
|
||||||
requestData.params = {
|
|
||||||
...requestData.params,
|
|
||||||
parentMenuId: requestData.parentMenuId,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
await editSave(requestData);
|
await editSave(requestData);
|
||||||
// 跳转到成功页面
|
// 跳转到成功页面
|
||||||
|
Loading…
Reference in New Issue
Block a user