代码生成模板新增vue子表独立组件的生成

This commit is contained in:
thinkgem
2024-10-08 14:13:32 +08:00
parent 2f74e04645
commit 7d9b643edf
6 changed files with 364 additions and 291 deletions

View File

@@ -23,6 +23,7 @@
<template>crud/vueImport.xml</template>
<childTable>
<template>category-ref:dao</template>
<template>crud/vueFormChildList.xml</template>
</childTable>
</category>
<category value="crud_only_vue" label="单表/主子表 (增删改查) 仅vue">
@@ -31,17 +32,25 @@
<template>crud/vueForm.xml</template>
<template>crud/vueIndex.xml</template>
<template>crud/vueImport.xml</template>
<childTable>
<template>crud/vueFormChildList.xml</template>
</childTable>
</category>
<category value="crud_only_vue_modal" label="单表/主子表 (增删改查,弹窗表单) 仅vue ">
<template>category-ref:crud_only_vue</template>
<childTable>
<template>crud/vueFormChildList.xml</template>
</childTable>
</category>
<category value="crud_only_vue_modal_route" label="单表/主子表 (增删改查,路由表单) 仅vue ">
<template>crud/vueApi.xml</template>
<template>crud/vueList.xml</template>
<!--<template>crud/vueForm.xml</template>-->
<template>crud/vueFormRoute.xml</template>
<template>crud/vueIndex.xml</template>
<template>crud/vueImport.xml</template>
<childTable>
<template>crud/vueFormChildList.xml</template>
</childTable>
</category>
<category value="crud_select" label="单表/主子表 (增删改查,含 listselect 选择页面) beetl">
<template>category-ref:crud</template>
@@ -55,6 +64,7 @@
<template>crud/vueSelect.xml</template>
<childTable>
<template>category-ref:dao</template>
<template>crud/vueFormChildList.xml</template>
</childTable>
</category>
<category value="crud_java" label="单表/主子表 (增删改查,只生成 java/mapper 仅后端 ">
@@ -83,6 +93,7 @@
<template>crud/vueImport.xml</template>
<childTable>
<template>category-ref:dao_cloud</template>
<template>crud/vueFormChildList.xml</template>
</childTable>
</category>
<category value="crud_cloud_select" label="单表/主子表 (增删改查 Cloud含 listselect 选择页面) beetl">
@@ -97,6 +108,7 @@
<template>crud/vueSelect.xml</template>
<childTable>
<template>category-ref:dao_cloud</template>
<template>crud/vueFormChildList.xml</template>
</childTable>
</category>
<category value="crud_cloud_java" label="单表/主子表 (增删改查 Cloud只生成 java/mapper 仅后端">

View File

@@ -29,15 +29,7 @@
<BasicForm @register="registerForm">
<% for (child in table.childList){ %>
<template #${@StringUtils.uncap(child.classNameSimple)}List>
<BasicTable
@register="register${child.className}Table"
@row-click="handle${child.className}RowClick"
/>
<% if(table.tplCategory != 'query'){ %>
<a-button class="mt-2" @click="handle${child.className}Add" v-auth="'${permissionPrefix}:edit'">
<Icon icon="i-ant-design:plus-circle-outlined" /> {{ t('新增') }}
</a-button>
<% } %>
<Form${@StringUtils.cap(child.classNameSimple)}List ref="form${@StringUtils.cap(child.classNameSimple)}ListRef" />
</template>
<% } %>
</BasicForm>
@@ -70,42 +62,42 @@
import { router } from '/@/router';
import { Icon } from '/@/components/Icon';
import { BasicForm, FormSchema, useForm } from '/@/components/Form';
<% if (table.childList.~size > 0){ %>
import { BasicTable, useTable } from '/@/components/Table';
<% } %>
import { Basic${modalOrDrawer}, use${modalOrDrawer}Inner } from '/@/components/${modalOrDrawer}';
import { ${ClassName}, ${className}Save, ${className}Form<% if(table.isTreeEntity){ %>, ${className}TreeData<% } %> } from '/@/api/${moduleName}${isNotEmpty(subModuleName)?'/'+subModuleName:''}/${className}';
<%
var userselectExists = false;
var officeselectExists = false;
var companyselectExists = false;
var areaselectExists = false;
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.showType == 'userselect'){
userselectExists = true;
}else if(c.showType == 'officeselect'){
officeselectExists = true;
}else if(c.showType == 'companyselect'){
companyselectExists = true;
}else if(c.showType == 'areaselect'){
areaselectExists = true;
<%
var userselectExists = false;
var officeselectExists = false;
var companyselectExists = false;
var areaselectExists = false;
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.showType == 'userselect'){
userselectExists = true;
}else if(c.showType == 'officeselect'){
officeselectExists = true;
}else if(c.showType == 'companyselect'){
companyselectExists = true;
}else if(c.showType == 'areaselect'){
areaselectExists = true;
}
}
}
}
%>
<% if(userselectExists || officeselectExists) { %>
%>
<% if(userselectExists || officeselectExists) { %>
import { officeTreeData } from '/@/api/sys/office';
<% } %>
<% if(companyselectExists) { %>
<% } %>
<% if(companyselectExists) { %>
import { companyTreeData } from '/@/api/sys/company';
<% } %>
<% if(areaselectExists) { %>
<% } %>
<% if(areaselectExists) { %>
import { areaTreeData } from '/@/api/sys/area';
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
import { BpmButton } from '/@/components/Bpm';
<% } %>
<% } %>
<% for (child in table.childList){ %>
import Form${@StringUtils.cap(child.classNameSimple)}List from './form${@StringUtils.cap(child.classNameSimple)}List.vue';
<% } %>
const emit = defineEmits(['success', 'register']);
@@ -113,9 +105,12 @@ for(c in table.columnList){
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<${ClassName}>({} as ${ClassName});
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
<% for (child in table.childList){ %>
const form${@StringUtils.cap(child.classNameSimple)}ListRef = ref<InstanceType<typeof Form${@StringUtils.cap(child.classNameSimple)}List>>();
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
const loadingRef = ref(false);
<% } %>
<% } %>
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
@@ -135,7 +130,7 @@ for(c in table.columnList){
},
colProps: { md: 24, lg: 24 },
},
<% }
<% }
for (c in table.columnList){
if (c.isEdit == '1' && c.showType != 'hidden'){
// 如果是树结构的字段,则自动忽略
@@ -152,7 +147,7 @@ for (c in table.columnList){
isNewLine = true;
}
}
%>
%>
{
label: t('${c.columnLabel}'),
field: '${c.attrName}',
@@ -316,9 +311,8 @@ for (c in table.columnList){
},
<%
}
}
if(toBoolean(table.optionMap['isImageUpload'])){
%>
} %>
<% if(toBoolean(table.optionMap['isImageUpload'])){ %>
{
label: t('图片上传'),
field: 'dataMap',
@@ -333,8 +327,7 @@ for (c in table.columnList){
},
<%
}
if(toBoolean(table.optionMap['isFileUpload'])){
%>
if(toBoolean(table.optionMap['isFileUpload'])){ %>
{
label: t('附件上传'),
field: 'dataMap',
@@ -357,10 +350,9 @@ for (c in table.columnList){
colProps: { md: 24, lg: 24 },
slot: '${@StringUtils.uncap(child.classNameSimple)}List',
},
<%
<%
}
if(false && toBoolean(table.optionMap['isBpmForm'])){
%>
if(false && toBoolean(table.optionMap['isBpmForm'])){ %>
{
label: t('审批意见'),
field: 'bpm.comment',
@@ -403,9 +395,7 @@ for (c in table.columnList){
selectType: 'empUserSelect',
},
},
<%
}
%>
<% } %>
];
<%
var updateSchemas = [];
@@ -444,186 +434,6 @@ for (c in table.columnList){
<% var formColNum = table.optionMap['formColNum']; %>
baseColProps: { md: 24, lg: ${formColNum=="1"?24:formColNum=="3"?8:12} },
});
<% for (child in table.childList){ %>
const [register${child.className}Table, ${@StringUtils.uncap(child.classNameSimple)}Table] = useTable({
actionColumn: {
width: 60,
actions: (record: Recordable) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
popConfirm: {
title: '是否确认删除',
confirm: handle${child.className}Delete.bind(this, record),
},
auth: '${permissionPrefix}:edit',
},
],
},
rowKey: 'id',
pagination: false,
bordered: true,
size: 'small',
inset: true,
});
async function set${child.className}TableData(_res: Recordable) {
${@StringUtils.uncap(child.classNameSimple)}Table.setColumns([
<%
for (c in child.columnList){
if (c.isEdit != '1' || c.isPk == '1'){
continue;
}
if(child.parentExists && child.parentTableFkName == c.columnName){
continue;
}
%>
{
title: t('${c.columnLabel}'),
dataIndex: '${c.attrName}',
<% if(c.showType == 'datetime'){ %>
width: 215,
<% }else{ %>
width: 130,
<% } %>
<% if ((isNotBlank(c.optionMap['dictType']) || @StringUtils.inString(c.attrType, 'java.util.Date', 'Integer', 'Long'))){ %>
align: 'center',
<% }else if (@StringUtils.inString(c.attrType, 'Float', 'Double')){ %>
align: 'right',
<% }else{ %>
align: 'left',
<% } %>
<% if(c.showType == 'select' || c.showType == 'select_multiple' || c.showType == 'checkbox' || c.showType == 'radio'){ %>
dictType: '${c.optionMap['dictType']}',
<% } %>
editRow: true,
<% if(c.showType == 'input' || c.showType == 'textarea'){ %>
<% if (c.simpleAttrType == 'Integer' && c.attrName == 'treeSort'){ %>
editComponent: 'InputNumber',
editDefaultValue: '30',
<% }else{ %>
editComponent: '${c.showType == 'input' ? 'Input' : 'InputTextArea'}',
<% } %>
<% if (c.dataLength != '0'){ %>
editComponentProps: {
maxlength: ${c.dataLength},
},
<% } %>
<% }else if(c.showType == 'select' || c.showType == 'select_multiple' || c.showType == 'radio' || c.showType == 'checkbox'){
var isMultiple = (c.showType == 'select_multiple'); %>
editComponent: 'Select',
editComponentProps: {
dictType: '${c.optionMap['dictType']}',
allowClear: true,
<% if(isMultiple){ %>
mode: 'multiple',
<% } %>
},
<% }else if(c.showType == 'date' || c.showType == 'datetime'){
var isTime = (c.showType == 'datetime'); %>
editComponent: 'DatePicker',
editComponentProps: {
format: 'YYYY-MM-DD${isTime?' HH:mm':''}',
showTime: ${isTime?'{ format: \'HH:mm\' \}':'false'},
},
<% }else if(c.showType == 'userselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: officeTreeData,
params: { isLoadUser: true, userIdPrefix: '' },
canSelectParent: false,
allowClear: true,
},
<% }else if(c.showType == 'officeselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: officeTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else if(c.showType == 'companyselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: companyTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else if(c.showType == 'areaselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: areaTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else{ %>
editComponent: 'Input',
<% } %>
editRule: ${c.isRequired == '1'},
},
<%
}
%>
]);
${@StringUtils.uncap(child.classNameSimple)}Table.setTableData(record.value.${@StringUtils.uncap(child.classNameSimple)}List || []);
}
function handle${child.className}RowClick(record: Recordable) {
record.onEdit?.(true, false);
}
function handle${child.className}Add() {
${@StringUtils.uncap(child.classNameSimple)}Table.insertTableDataRecord({
id: new Date().getTime(),
isNewRecord: true,
editable: true,
});
}
function handle${child.className}Delete(record: Recordable) {
${@StringUtils.uncap(child.classNameSimple)}Table.deleteTableDataRecord(record);
}
async function get${child.className}List() {
let ${@StringUtils.uncap(child.classNameSimple)}ListValid = true;
let ${@StringUtils.uncap(child.classNameSimple)}List: Recordable[] = [];
for (const record of ${@StringUtils.uncap(child.classNameSimple)}Table.getDataSource()) {
if (!(await record.onEdit?.(false, true))) {
${@StringUtils.uncap(child.classNameSimple)}ListValid = false;
}
${@StringUtils.uncap(child.classNameSimple)}List.push({
...record,
id: !!record.isNewRecord ? '' : record.id,
});
}
for (const record of ${@StringUtils.uncap(child.classNameSimple)}Table.getDelDataSource()) {
if (!!record.isNewRecord) continue;
${@StringUtils.uncap(child.classNameSimple)}List.push({
...record,
status: '1',
});
}
if (!${@StringUtils.uncap(child.classNameSimple)}ListValid) {
throw {
errorFields: [{ name: ['${@StringUtils.uncap(child.classNameSimple)}List'] }],
message: t('${child.comments}填写有误,请根据提示修正'),
};
}
return ${@StringUtils.uncap(child.classNameSimple)}List;
}
<% } %>
const [register${modalOrDrawer}, { set${modalOrDrawer}Props, close${modalOrDrawer} }] = use${modalOrDrawer}Inner(async (data) => {
set${modalOrDrawer}Props({ loading: true });
@@ -639,7 +449,7 @@ for (c in table.columnList){
<% } %>
setFieldsValue(record.value);
<% for (child in table.childList){ %>
set${child.className}TableData(res);
form${@StringUtils.cap(child.classNameSimple)}ListRef.value?.setTableData(record.value);
<% } %>
<% if(updateSchemas.~size > 0){ %>
updateSchema([
@@ -658,7 +468,7 @@ for (c in table.columnList){
formData(true, data); // 将表单数据传递给 BpmButton
} catch (error: any) {
if (error && error.errorFields) {
showMessage(t('common.validateError'));
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
}
@@ -688,7 +498,7 @@ for (c in table.columnList){
%>
};
<% for (child in table.childList){ %>
data.${@StringUtils.uncap(child.classNameSimple)}List = await get${child.className}List();
await form${@StringUtils.cap(child.classNameSimple)}ListRef.value?.getTableData(data);
<% } %>
<% if(table.isTreeEntity){ %>
data.oldParentCode = record.value.parentCode;

View File

@@ -0,0 +1,250 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved.
No deletion without permission, or be held responsible to law. -->
<template>
<name>vueFormChildList</name>
<filePath>${frontDir}/src/views/${urlPrefix}</filePath>
<fileName>form${@StringUtils.cap(table.classNameSimple)}List.vue</fileName>
<content><![CDATA[
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author ${functionAuthor}
-->
<template>
<div>
<BasicTable @register="registerTable" @row-click="handleRowClick" />
<% if(table.tplCategory != 'query'){ %>
<a-button class="mt-2" @click="handleRowAdd" v-auth="'${permissionPrefix}:edit'">
<Icon icon="i-ant-design:plus-circle-outlined" /> {{ t('新增') }}
</a-button>
<% } %>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { useI18n } from '/@/hooks/web/useI18n';
import { Icon } from '/@/components/Icon';
import { BasicTable, BasicColumn, useTable } from '/@/components/Table';
import { ${ParentClassName} } from '/@/api/${moduleName}${isNotEmpty(subModuleName)?'/'+subModuleName:''}/${parentClassName}';
<%
var userselectExists = false;
var officeselectExists = false;
var companyselectExists = false;
var areaselectExists = false;
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.showType == 'userselect'){
userselectExists = true;
}else if(c.showType == 'officeselect'){
officeselectExists = true;
}else if(c.showType == 'companyselect'){
companyselectExists = true;
}else if(c.showType == 'areaselect'){
areaselectExists = true;
}
}
}
%>
<% if(userselectExists || officeselectExists) { %>
import { officeTreeData } from '/@/api/sys/office';
<% } %>
<% if(companyselectExists) { %>
import { companyTreeData } from '/@/api/sys/company';
<% } %>
<% if(areaselectExists) { %>
import { areaTreeData } from '/@/api/sys/area';
<% } %>
const { t } = useI18n('${moduleName}${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${className}');
const record = ref<TestData>({} as ${ParentClassName});
const tableColumns: BasicColumn[] = [
<%
for (c in table.columnList){
if (c.isEdit != '1' || c.isPk == '1'){
continue;
}
if(table.parentExists && table.parentTableFkName == c.columnName){
continue;
}
%>
{
title: t('${c.columnLabel}'),
dataIndex: '${c.attrName}',
<% if(c.showType == 'datetime'){ %>
width: 215,
<% }else{ %>
width: 130,
<% } %>
<% if ((isNotBlank(c.optionMap['dictType']) || @StringUtils.inString(c.attrType, 'java.util.Date', 'Integer', 'Long'))){ %>
align: 'center',
<% }else if (@StringUtils.inString(c.attrType, 'Float', 'Double')){ %>
align: 'right',
<% }else{ %>
align: 'left',
<% } %>
<% if(c.showType == 'select' || c.showType == 'select_multiple' || c.showType == 'checkbox' || c.showType == 'radio'){ %>
dictType: '${c.optionMap['dictType']}',
<% } %>
editRow: true,
<% if(c.showType == 'input' || c.showType == 'textarea'){ %>
<% if (c.simpleAttrType == 'Integer' && c.attrName == 'treeSort'){ %>
editComponent: 'InputNumber',
editDefaultValue: '30',
<% }else{ %>
editComponent: '${c.showType == 'input' ? 'Input' : 'InputTextArea'}',
<% } %>
<% if (c.dataLength != '0'){ %>
editComponentProps: {
maxlength: ${c.dataLength},
},
<% } %>
<% }else if(c.showType == 'select' || c.showType == 'select_multiple' || c.showType == 'radio' || c.showType == 'checkbox'){
var isMultiple = (c.showType == 'select_multiple'); %>
editComponent: 'Select',
editComponentProps: {
dictType: '${c.optionMap['dictType']}',
allowClear: true,
<% if(isMultiple){ %>
mode: 'multiple',
<% } %>
},
<% }else if(c.showType == 'date' || c.showType == 'datetime'){
var isTime = (c.showType == 'datetime'); %>
editComponent: 'DatePicker',
editComponentProps: {
format: 'YYYY-MM-DD${isTime?' HH:mm':''}',
showTime: ${isTime?'{ format: \'HH:mm\' \}':'false'},
},
<% }else if(c.showType == 'userselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: officeTreeData,
params: { isLoadUser: true, userIdPrefix: '' },
canSelectParent: false,
allowClear: true,
},
<% }else if(c.showType == 'officeselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: officeTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else if(c.showType == 'companyselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: companyTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else if(c.showType == 'areaselect'){
if (isNotBlank(c.attrName2)){ %>
dataLabel: '${c.attrName2}',
<% } %>
editComponent: 'TreeSelect',
editComponentProps: {
api: areaTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else{ %>
editComponent: 'Input',
<% } %>
editRule: ${c.isRequired == '1'},
},
<% } %>
];
const [registerTable, tableAction] = useTable({
columns: tableColumns,
actionColumn: {
width: 60,
actions: (record: Recordable) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
popConfirm: {
title: '是否确认删除',
confirm: handleRowDelete.bind(this, record),
},
auth: '${permissionPrefix}:edit',
},
],
},
rowKey: 'id',
pagination: false,
bordered: true,
size: 'small',
inset: true,
});
function handleRowClick(data: Recordable) {
data.onEdit?.(true, false);
}
function handleRowAdd() {
tableAction.insertTableDataRecord({
id: 'rid_' + new Date().getTime(),
isNewRecord: true,
editable: true,
});
}
function handleRowDelete(data: Recordable) {
tableAction.deleteTableDataRecord(data);
}
async function getTableData(data: Recordable): Promise<Recordable> {
let valid = true;
let tableList: Recordable[] = [];
for (const record of tableAction.getDataSource()) {
if (!(await record.onEdit?.(false, true))) {
valid = false;
}
tableList.push({
...record,
id: !!record.isNewRecord ? '' : record.id,
});
}
for (const record of tableAction.getDelDataSource()) {
if (!!record.isNewRecord) continue;
tableList.push({
...record,
status: '1',
});
}
if (!valid) {
throw {
errorFields: [{ name: ['${@StringUtils.uncap(table.classNameSimple)}List'] }],
message: t('${table.comments}填写有误,请根据提示修正'),
};
}
data.${@StringUtils.uncap(table.classNameSimple)}List = tableList;
return tableList;
}
async function setTableData(data: Recordable) {
record.value = data as ${ParentClassName};
tableAction.setTableData(data.${@StringUtils.uncap(table.classNameSimple)}List || []);
}
defineExpose({
getTableData,
setTableData,
});
</script>
<% %>
]]>
</content>
</template>

View File

@@ -713,7 +713,7 @@ for (c in table.columnList){
formData(true, data); // 将表单数据传递给 BpmButton
} catch (error: any) {
if (error && error.errorFields) {
showMessage(t('common.validateError'));
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
}

View File

@@ -2,7 +2,7 @@
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved.
No deletion without permission, or be held responsible to law. -->
<template>
<name>formImport</name>
<name>vueFormImport</name>
<filePath>${frontDir}/src/views/${urlPrefix}</filePath>
<fileName>formImport.vue</fileName>
<content><![CDATA[
@@ -107,7 +107,7 @@
emit('success');
} catch (error: any) {
if (error && error.errorFields) {
showMessage(t('common.validateError'));
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {

View File

@@ -109,64 +109,64 @@ if(table.isTreeEntity){
import { Icon } from '/@/components/Icon';
import { BasicTable, BasicColumn, useTable } from '/@/components/Table';
import { ${className}Delete, ${className}ListData } from '/@/api/${moduleName}${isNotEmpty(subModuleName)?'/'+subModuleName:''}/${className}';
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
import { ${className}Disable, ${className}Enable } from '/@/api/${moduleName}${isNotEmpty(subModuleName)?'/'+subModuleName:''}/${className}';
<% } %>
<%
var userselectExists = false;
var officeselectExists = false;
var companyselectExists = false;
var areaselectExists = false;
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.showType == 'userselect'){
userselectExists = true;
}else if(c.showType == 'officeselect'){
officeselectExists = true;
}else if(c.showType == 'companyselect'){
companyselectExists = true;
}else if(c.showType == 'areaselect'){
areaselectExists = true;
<% } %>
<%
var userselectExists = false;
var officeselectExists = false;
var companyselectExists = false;
var areaselectExists = false;
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.showType == 'userselect'){
userselectExists = true;
}else if(c.showType == 'officeselect'){
officeselectExists = true;
}else if(c.showType == 'companyselect'){
companyselectExists = true;
}else if(c.showType == 'areaselect'){
areaselectExists = true;
}
}
}
}
%>
<% if(userselectExists || officeselectExists) { %>
%>
<% if(userselectExists || officeselectExists) { %>
import { officeTreeData } from '/@/api/sys/office';
<% } %>
<% if(companyselectExists) { %>
<% } %>
<% if(companyselectExists) { %>
import { companyTreeData } from '/@/api/sys/company';
<% } %>
<% if(areaselectExists) { %>
<% } %>
<% if(areaselectExists) { %>
import { areaTreeData } from '/@/api/sys/area';
<% } %>
<% if(modalOrDrawer == 'Drawer' && !@StringUtils.contains(table.tplCategory, '_route')){ %>
<% } %>
<% if(modalOrDrawer == 'Drawer' && !@StringUtils.contains(table.tplCategory, '_route')){ %>
import { useDrawer } from '/@/components/Drawer';
<% } %>
<% if(modalOrDrawer == 'Modal' || (toBoolean(table.optionMap['isBpmForm'])
<% } %>
<% if(modalOrDrawer == 'Modal' || (toBoolean(table.optionMap['isBpmForm'])
|| toBoolean(table.optionMap['isImportExport']))){ %>
import { useModal } from '/@/components/Modal';
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
import { BpmRuntimeTrace } from '/@/components/Bpm';
<% } %>
<% } %>
import { FormProps } from '/@/components/Form';
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
import InputForm from './form.vue';
<% } %>
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
<% } %>
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
import FormImport from './formImport.vue';
<% } %>
<% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>
<% } %>
<% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>
const props = defineProps({
treeCode: String,
});
<% } %>
<% if(@StringUtils.contains(table.tplCategory, '_route')) { %>
<% } %>
<% if(@StringUtils.contains(table.tplCategory, '_route')) { %>
const emitter = useEmitter();
<% } %>
<% } %>
const { t } = useI18n('${moduleName}${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${className}');
const { showMessage } = useMessage();
@@ -176,9 +176,9 @@ for(c in table.columnList){
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('${functionNameSimple}管理'),
};
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
const loading = ref(false);
<% } %>
<% } %>
const searchForm: FormProps = {
baseColProps: { md: 8, lg: 6 },
@@ -409,9 +409,6 @@ for(c in table.columnList){
],
};
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
const [register${modalOrDrawer}, { open${modalOrDrawer} }] = use${modalOrDrawer}();
<% } %>
const [registerTable, { reload<% if(table.isTreeEntity){ %>, expandAll, collapseAll, expandCollapse<% } %><%
if (table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])
|| toBoolean(table.optionMap['isImportExport'])){ %>, getForm<% } %> }] = useTable({
@@ -430,7 +427,11 @@ for(c in table.columnList){
<% } %>
canResize: true,
});
<% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
const [register${modalOrDrawer}, { open${modalOrDrawer} }] = use${modalOrDrawer}();
<% } %>
<% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>
watch(
() => props.treeCode,
@@ -447,15 +448,15 @@ for(c in table.columnList){
reload();
},
);
<% } %>
<% if(table.isTreeEntity){ %>
<% } %>
<% if(table.isTreeEntity){ %>
function fetchSuccess() {
if (props.treeCode) {
nextTick(expandAll);
}
}
<% } %>
<% } %>
function handleForm(record: Recordable) {
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
@@ -467,7 +468,7 @@ for(c in table.columnList){
});
<% } %>
}
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
async function handleExport() {
loading.value = true;
@@ -484,8 +485,8 @@ for(c in table.columnList){
function handleImport() {
importModal(true, {});
}
<% } %>
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
<% } %>
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
async function handleDisable(record: Recordable) {
const params = { ${idParam} };
@@ -500,7 +501,7 @@ for(c in table.columnList){
showMessage(res.message);
handleSuccess(record);
}
<% } %>
<% } %>
async function handleDelete(record: Recordable) {
const params = { ${idParam} };