|
|
|
|
@ -3,14 +3,14 @@ import type { GenInfo } from '#/api/tool/gen/model';
|
|
|
|
|
|
|
|
|
|
import { inject, type Ref, unref } from 'vue';
|
|
|
|
|
|
|
|
|
|
import { Space } from 'ant-design-vue';
|
|
|
|
|
import { message, Space } from 'ant-design-vue';
|
|
|
|
|
import { cloneDeep } from 'lodash-es';
|
|
|
|
|
|
|
|
|
|
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter';
|
|
|
|
|
import { editSave } from '#/api/tool/gen';
|
|
|
|
|
|
|
|
|
|
import { toCurrentStep } from '../mitt';
|
|
|
|
|
import { vxeTableColumns } from './gen-data';
|
|
|
|
|
import { validRules, vxeTableColumns } from './gen-data';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 从父组件注入
|
|
|
|
|
@ -19,12 +19,19 @@ const genInfoData = inject('genInfoData') as Ref<GenInfo['info']>;
|
|
|
|
|
|
|
|
|
|
const gridOptions: VxeGridProps = {
|
|
|
|
|
columns: vxeTableColumns,
|
|
|
|
|
// height: 'auto',
|
|
|
|
|
keepSource: true,
|
|
|
|
|
pagerConfig: {},
|
|
|
|
|
editConfig: { trigger: 'click', mode: 'cell', showStatus: true },
|
|
|
|
|
editRules: validRules,
|
|
|
|
|
rowConfig: {
|
|
|
|
|
isHover: true,
|
|
|
|
|
keyField: 'id',
|
|
|
|
|
isCurrent: true, // 高亮当前行
|
|
|
|
|
},
|
|
|
|
|
columnConfig: {
|
|
|
|
|
resizable: true,
|
|
|
|
|
},
|
|
|
|
|
proxyConfig: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
data: genInfoData.value.columns,
|
|
|
|
|
round: true,
|
|
|
|
|
@ -32,11 +39,18 @@ const gridOptions: VxeGridProps = {
|
|
|
|
|
showOverflow: true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const [BasicTable] = useVbenVxeGrid({ gridOptions });
|
|
|
|
|
const [BasicTable, tableApi] = useVbenVxeGrid({ gridOptions });
|
|
|
|
|
|
|
|
|
|
async function handleSubmit() {
|
|
|
|
|
try {
|
|
|
|
|
const hasError = await tableApi.grid.validate();
|
|
|
|
|
if (hasError) {
|
|
|
|
|
message.error('校验未通过');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const requestData = cloneDeep(unref(genInfoData));
|
|
|
|
|
// 从表格获取最新的
|
|
|
|
|
requestData.columns = tableApi.grid.getData();
|
|
|
|
|
// 树表需要添加这个参数
|
|
|
|
|
if (requestData && requestData.tplCategory === 'tree') {
|
|
|
|
|
const { treeCode, treeName, treeParentCode } = requestData;
|
|
|
|
|
|