修复代码生成器模板的一些bug(重点vue3的)

pull/3664/head
zhangdaiscott 2022-04-29 14:43:06 +08:00
parent 3909eb5610
commit 9710b8bc7d
18 changed files with 30 additions and 10 deletions

View File

@ -340,10 +340,12 @@
selectedMainId:'',
superFieldList:[],
<#list subTables as sub>
<#if sub != null>
<#list sub.foreignMainKeys as key>
<#assign subMainFieldMap += {"${sub.entityName?uncap_first}MainId": "${dashedToCamel(key)}"}>
</#list>
${sub.entityName?uncap_first}MainId: '',
</#if>
</#list>
}
},

View File

@ -48,7 +48,7 @@
import {useModal} from '/@/components/Modal';
import ${sub.entityName}Modal from './components/${sub.entityName}Modal.vue'
import {${sub.entityName?uncap_first}Columns} from './${entityName}.data';
import {${sub.entityName?uncap_first}List, ${sub.entityName?uncap_first}Delete, ${sub.entityName?uncap_first}DeleteBatch} from './${entityName}.api';
import {${sub.entityName?uncap_first}List, ${sub.entityName?uncap_first}Delete, ${sub.entityName?uncap_first}DeleteBatch, ${sub.entityName?uncap_first}ExportXlsUrl, ${sub.entityName?uncap_first}ImportUrl } from './${entityName}.api';
import {isEmpty} from "/@/utils/is";
import {useMessage} from '/@/hooks/web/useMessage';
@ -60,7 +60,7 @@
const [registerModal, {openModal}] = useModal();
const searchInfo = {};
// 列表页面公共参数、方法
const {prefixCls, tableContext} = useListPage({
const {prefixCls, tableContext, onImportXls, onExportXls} = useListPage({
tableProps: {
api: ${sub.entityName?uncap_first}List,
columns: ${sub.entityName?uncap_first}Columns,
@ -75,6 +75,13 @@
pageSizeOptions: ['5', '10', '20'],
}
},
exportConfig: {
name: '${sub.ftlDescription}',
url: ${sub.entityName?uncap_first}ExportXlsUrl
},
importConfig: {
url: getImportUrl()
}
});
//注册table数据
@ -88,6 +95,14 @@
}
);
/**
* 导入地址
*/
function getImportUrl(){
return ${sub.entityName?uncap_first}ImportUrl+'/'+ unref(mainId)
}
/**
* 新增事件
*/

View File

@ -15,7 +15,7 @@
<a-form :form="form">
<#list subTab.colums as po><#rt/>
<#if po.fieldName !='id'><#rt/>
<#if po.fieldName !='id' && po.filedComment !='外键'><#rt/>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"

View File

@ -84,7 +84,7 @@ export const ${sub.entityName?uncap_first}Columns: BasicColumn[] = [
return !text?"":(text.length>10?text.substr(0,10):text)
},
<#else>
dataIndex: '${po.fieldName}'
dataIndex: '${po.fieldName}',
</#if>
},
</#if>
@ -92,24 +92,28 @@ export const ${sub.entityName?uncap_first}Columns: BasicColumn[] = [
];
export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
// TODO 主键隐藏字段目前写死为ID
{label: '', field: 'id', component: 'Input', show: false},
<#-- 循环子表的列 开始 -->
<#list sub.colums as po><#rt/>
<#if po.filedComment !='外键' >
{
label: '${po.filedComment}',
field: '${po.fieldName}',
<#if po.fieldType =='date'>
component: 'DatePicker'
component: 'DatePicker',
<#elseif po.fieldType =='datetime'>
component: 'TimePicker'
component: 'TimePicker',
<#elseif "int,decimal,double,"?contains(po.fieldType)>
component: 'InputNumber'
component: 'InputNumber',
<#else>
component: 'Input'
component: 'Input',
</#if>
<#if po.fieldName =='id'><#rt/>
show:false
show:false,
</#if>
},
</#if>
</#list>
<#-- 循环子表的列 结束 -->
]