添加Vue子表生成模板

This commit is contained in:
thinkgem
2021-12-30 23:33:11 +08:00
parent 364752f876
commit b6762cacd0
4 changed files with 407 additions and 201 deletions

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>vueApi</name>
<filePath>vue/src/api/${moduleName}/${subModuleName}</filePath>
<filePath>src/api/${moduleName}/${subModuleName}</filePath>
<fileName>${className}.ts</fileName>
<content><![CDATA[
/**
@@ -26,39 +26,39 @@ export interface ${ClassName} extends ${table.isTreeEntity?'Tree':'Basic'}Model<
isExtend = false;
// 生成字段属性
for(c in table.columnList){
var attrType = c.simpleAttrType;
if (attrType == 'String') attrType = 'string';
else if (attrType == 'Long') attrType = 'number';
else if (attrType == 'Integer') attrType = 'number';
else if (attrType == 'Double') attrType = 'number';
else if (attrType == 'BigDecimal') attrType = 'number';
else if (attrType == 'Date') attrType = 'string';
else attrType = 'any';
if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
// 如果是Extend类属性
if(table.isExtendEntity && c.isExtendColumn){
if(!isExtend){
isExtend = true;
var attrType = c.simpleAttrType;
if (attrType == 'String') attrType = 'string';
else if (attrType == 'Long') attrType = 'number';
else if (attrType == 'Integer') attrType = 'number';
else if (attrType == 'Double') attrType = 'number';
else if (attrType == 'BigDecimal') attrType = 'number';
else if (attrType == 'Date') attrType = 'string';
else attrType = 'any';
if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
// 如果是Extend类属性
if(table.isExtendEntity && c.isExtendColumn){
if(!isExtend){
isExtend = true;
%>
extend?: any; // 扩展字段
<%
}
}
// 如果不是基类属性
else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
// 父类对象
if(table.parentExists && table.parentTableFkName == c.columnName){
}
}
// 如果不是基类属性
else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
// 父类对象
if(table.parentExists && table.parentTableFkName == c.columnName){
%>
${c.simpleAttrName}?: ${attrType};<% if (isNotBlank(c.comments)){ %> // ${c.comments} 父类<% } %>
<%
// 其它字段
}else{
// 其它字段
}else{
%>
${c.simpleAttrName}?: ${attrType};<%if(isNotBlank(c.comments)){%> // ${c.comments}<%}%>
<%
}
}
}
}
}
}
}
%>
<% // 生成子表列表字段

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>vueForm</name>
<filePath>vue/src/views/${urlPrefix}</filePath>
<filePath>src/views/${urlPrefix}</filePath>
<fileName>form.vue</fileName>
<content><![CDATA[
<!--
@@ -24,7 +24,25 @@
<Icon :icon="getTitle.icon" class="pr-1 m-1" />
<span> {{ getTitle.value }} </span>
</template>
<% if (table.childList.~size > 0){ %>
<BasicForm @register="registerForm">
<% for (child in table.childList){ %>
<template #${@StringUtils.uncap(child.className)}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="ant-design:plus-circle-outlined" /> {{ t('新增') }}
</a-button>
<% } %>
</template>
<% } %>
</BasicForm>
<% }else{ %>
<BasicForm @register="registerForm" />
<% } %>
</BasicDrawer>
</template>
<script lang="ts">
@@ -39,6 +57,9 @@
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 { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { ${className}Save, ${className}Form<% if(table.isTreeEntity){ %>, ${className}TreeData<% } %> } from '/@/api/${moduleName}${isNotEmpty(subModuleName)?'/'+subModuleName:''}/${className}';
<%
@@ -46,15 +67,15 @@ var userselectExists = false;
var officeselectExists = 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 == 'areaselect'){
areaselectExists = true;
}
}
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.showType == 'userselect'){
userselectExists = true;
}else if(c.showType == 'officeselect'){
officeselectExists = true;
}else if(c.showType == 'areaselect'){
areaselectExists = true;
}
}
}
%>
<% if(userselectExists || officeselectExists) { %>
@@ -75,7 +96,7 @@ for(c in table.columnList){
};
const inputFormSchemas: FormSchema[] = [
<% if(table.isTreeEntity){ %>
<% if(table.isTreeEntity){ %>
{
label: t('上级${functionNameSimple}'),
field: 'parentCode',
@@ -87,29 +108,29 @@ for(c in table.columnList){
},
colProps: { lg: 24, md: 24 },
},
<% }
<% }
for (c in table.columnList){
if (c.isEdit == '1' && c.showType != 'hidden'){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && @StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')
&& c.attrName != table.treeViewCodeAttrName
&& c.attrName != table.treeViewNameAttrName){
continue;
}
// 是否强制新行获取,生成字段界面用户设定的
var isNewLine = @Global.YES.equals(c.optionMap['isNewLine']);
if (isBlank(c.optionMap['isNewLine'])){
if (c.showType == 'textarea'){
isNewLine = true;
}
}
if (c.isEdit == '1' && c.showType != 'hidden'){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && @StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')
&& c.attrName != table.treeViewCodeAttrName
&& c.attrName != table.treeViewNameAttrName){
continue;
}
// 是否强制新行获取,生成字段界面用户设定的
var isNewLine = @Global.YES.equals(c.optionMap['isNewLine']);
if (isBlank(c.optionMap['isNewLine'])){
if (c.showType == 'textarea'){
isNewLine = true;
}
}
%>
{
label: t('${c.columnLabel}'),
field: '${c.attrName}',
<% if(c.showType == 'input' || c.showType == 'textarea'){ %>
<% if (c.simpleAttrType == 'Integer' && c.attrName == 'treeSort'){ %>
<% if (c.simpleAttrType == 'Integer' && c.attrName == 'treeSort'){ %>
helpMessage: '升序',
component: 'InputNumber',
defaultValue: '30',
@@ -120,9 +141,9 @@ for (c in table.columnList){
componentProps: {
maxlength: ${c.dataLength},
},
<% } %>
<% } %>
<% }else if(c.showType == 'select' || c.showType == 'select_multiple'){
var isMultiple = (c.showType == 'select_multiple'); %>
var isMultiple = (c.showType == 'select_multiple'); %>
component: 'Select',
componentProps: {
dictType: '${c.optionMap['dictType']}',
@@ -137,7 +158,7 @@ for (c in table.columnList){
dictType: '${c.optionMap['dictType']}',
},
<% }else if(c.showType == 'date' || c.showType == 'datetime'){
var isTime = (c.showType == 'datetime'); %>
var isTime = (c.showType == 'datetime'); %>
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD${isTime?' HH:mm':''}',
@@ -161,6 +182,7 @@ for (c in table.columnList){
component: 'TreeSelect',
componentProps: {
api: officeTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else if(c.showType == 'areaselect'){
@@ -170,81 +192,82 @@ for (c in table.columnList){
component: 'TreeSelect',
componentProps: {
api: areaTreeData,
canSelectParent: false,
allowClear: true,
},
<% }else{ %>
component: 'Input',
<% }
var fieldValid = c.optionMap['fieldValid'], fvs = [], rules = [];
if(isNotEmpty(fieldValid)){
var t = type.name(fieldValid);
if (t == 'String[]' || t == 'ArrayList'){
fvs = fieldValid;
}else if(t == 'String' && isNotBlank(fieldValid)){
@fvs.add(fieldValid);
}
}
for(var fv in fvs){
if (fv == 'email'){
var s = { %>{ type: 'email', message: t('请输入邮箱地址') }<% };
@rules.add(s);
}
if (fv == 'number'){
var s = { %>{ pattern: /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/, message: t('请输入一个数值') }<% };
@rules.add(s);
}
if (fv == 'integer'){
var s = { %>{ pattern: /^-?\d+$/, message: t('请输入一个整数') }<% };
@rules.add(s);
}
if (fv == 'digits'){
var s = { %>{ pattern: /^\d+$/, message: t('请输入一个正整数') }<% };
@rules.add(s);
}
if (fv == 'userName'){
var s = { %>{ pattern: /^[\u0391-\uFFE5\w]+$/, message: t('请输入登录账号') }<% };
@rules.add(s);
}
if (fv == 'realName'){
var s = { %>{ pattern: /^[\u4e00-\u9fa5]{2,30}$/, message: t('请输入真实姓名') }<% };
@rules.add(s);
}
if (fv == 'abc'){
var s = { %>{ pattern: /^[a-zA-Z0-9_]*$/, message: t('请输入字母数字下划线') }<% };
@rules.add(s);
}
if (fv == 'mobile'){
var s = { %>{ pattern: /^1[3,4,5,6,7,8,9]\d{9}$/g, message: t('请输入手机号码') }<% };
@rules.add(s);
}
if (fv == 'simplePhone'){
var s = { %>{ pattern: /^(\d{3,4}-?)?\d{7,9}$/g, message: t('请输入固话号码') }<% };
@rules.add(s);
}
if (fv == 'phone'){
var s = { %>{ pattern: /(^0[1-9]{1}\d{8,10}$)|(^1[3,4,5,6,7,8,9]\d{9}$)/g, message: t('请输入固话或手机号码') }<% };
@rules.add(s);
}
if (fv == 'zipCode'){
var s = { %>{ pattern: /^[0-9]{6}$/, message: t('请输入邮政编码') }<% };
@rules.add(s);
}
}
if(rules.~size == 0){
if(c.isRequired == '1'){
var fieldValid = c.optionMap['fieldValid'], fvs = [], rules = [];
if(isNotEmpty(fieldValid)){
var t = type.name(fieldValid);
if (t == 'String[]' || t == 'ArrayList'){
fvs = fieldValid;
}else if(t == 'String' && isNotBlank(fieldValid)){
@fvs.add(fieldValid);
}
}
for(var fv in fvs){
if (fv == 'email'){
var s = { %>{ type: 'email', message: t('请输入邮箱地址') }<% };
@rules.add(s);
}
if (fv == 'number'){
var s = { %>{ pattern: /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/, message: t('请输入一个数值') }<% };
@rules.add(s);
}
if (fv == 'integer'){
var s = { %>{ pattern: /^-?\d+$/, message: t('请输入一个整数') }<% };
@rules.add(s);
}
if (fv == 'digits'){
var s = { %>{ pattern: /^\d+$/, message: t('请输入一个正整数') }<% };
@rules.add(s);
}
if (fv == 'userName'){
var s = { %>{ pattern: /^[\u0391-\uFFE5\w]+$/, message: t('请输入登录账号') }<% };
@rules.add(s);
}
if (fv == 'realName'){
var s = { %>{ pattern: /^[\u4e00-\u9fa5]{2,30}$/, message: t('请输入真实姓名') }<% };
@rules.add(s);
}
if (fv == 'abc'){
var s = { %>{ pattern: /^[a-zA-Z0-9_]*$/, message: t('请输入字母数字下划线') }<% };
@rules.add(s);
}
if (fv == 'mobile'){
var s = { %>{ pattern: /^1[3,4,5,6,7,8,9]\d{9}$/g, message: t('请输入手机号码') }<% };
@rules.add(s);
}
if (fv == 'simplePhone'){
var s = { %>{ pattern: /^(\d{3,4}-?)?\d{7,9}$/g, message: t('请输入固话号码') }<% };
@rules.add(s);
}
if (fv == 'phone'){
var s = { %>{ pattern: /(^0[1-9]{1}\d{8,10}$)|(^1[3,4,5,6,7,8,9]\d{9}$)/g, message: t('请输入固话或手机号码') }<% };
@rules.add(s);
}
if (fv == 'zipCode'){
var s = { %>{ pattern: /^[0-9]{6}$/, message: t('请输入邮政编码') }<% };
@rules.add(s);
}
}
if(rules.~size == 0){
if(c.isRequired == '1'){
%> required: true,
<%
}
} else { %>
}
} else { %>
rules: [<%
if(c.isRequired == '1'){
%>{ required: true }, <%
if(c.isRequired == '1'){
%>{ required: true }, <%
}
for (var rule in rules){
print(rule);
if (ruleLP.index < rules.~size) {
print(', ');
}
print(rule);
if (ruleLP.index < rules.~size) {
print(', ');
}
} %>],
<%
}
@@ -254,16 +277,26 @@ for (c in table.columnList){
}
%>
},
<%
}
<%
}
}
for (child in table.childList){ %>
{
label: t('${child.comments}'),
field: '${@StringUtils.uncap(child.className)}List',
component: 'Input',
colProps: { lg: 24, md: 24 },
slot: '${@StringUtils.uncap(child.className)}List',
},
<%
}
%>
];
<%
var updateSchemas = [];
if(table.isTreeEntity){
var s = {
%> {
var updateSchemas = [];
if(table.isTreeEntity){
var s = {
%> {
field: 'parentCode',
componentProps: {
api: ${className}TreeData,
@@ -273,29 +306,196 @@ for (c in table.columnList){
},
},
},<%
};
@updateSchemas.add(s);
}
for (c in table.columnList){
if (c.isPk == '1' && c.showType == 'input'){
var s = {
%> {
};
@updateSchemas.add(s);
}
for (c in table.columnList){
if (c.isPk == '1' && c.showType == 'input'){
var s = {
%> {
field: '${c.attrName}',
componentProps: {
disabled: !record.value.isNewRecord,
},
},<%
};
@updateSchemas.add(s);
}
}
%>
};
@updateSchemas.add(s);
}
}
%>
const [registerForm, { resetFields, setFieldsValue<% if(updateSchemas.~size > 0){ %>, updateSchema<% } %>, validate }] = useForm({
labelWidth: 120,
schemas: inputFormSchemas,
<% var formColNum = table.optionMap['formColNum']; %>
baseColProps: { lg: ${formColNum=="1"?24:formColNum=="3"?8:12}, md: 24 },
});
<% for (child in table.childList){ %>
const [register${child.className}Table, ${@StringUtils.uncap(child.className)}Table] = useTable({
actionColumn: {
width: 60,
actions: (record: Recordable) => [
{
icon: '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.className)}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: 'Input',
<% } %>
<% 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 == '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.className)}Table.setTableData(record.value.${@StringUtils.uncap(child.className)}List || []);
}
function handle${child.className}RowClick(record: Recordable) {
record.onEdit?.(true, false);
}
function handle${child.className}Add() {
${@StringUtils.uncap(child.className)}Table.insertTableDataRecord({
id: new Date().getTime(),
isNewRecord: true,
editable: true,
});
}
function handle${child.className}Delete(record: Recordable) {
${@StringUtils.uncap(child.className)}Table.deleteTableDataRecord(record);
}
async function get${child.className}List() {
let ${@StringUtils.uncap(child.className)}ListValid = true;
let ${@StringUtils.uncap(child.className)}List: Recordable[] = [];
for (const record of ${@StringUtils.uncap(child.className)}Table.getDataSource()) {
if (!(await record.onEdit?.(false, true))) {
${@StringUtils.uncap(child.className)}ListValid = false;
}
${@StringUtils.uncap(child.className)}List.push({
...record,
id: !!record.isNewRecord ? '' : record.id,
});
}
for (const record of ${@StringUtils.uncap(child.className)}Table.getDelDataSource()) {
if (!!record.isNewRecord) continue;
${@StringUtils.uncap(child.className)}List.push({
...record,
status: '1',
});
}
if (!${@StringUtils.uncap(child.className)}ListValid) {
throw new Error('${@StringUtils.uncap(child.className)}List valid.');
}
return ${@StringUtils.uncap(child.className)}List;
}
<% } %>
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
resetFields();
@@ -309,10 +509,13 @@ for (c in table.columnList){
}
<% } %>
setFieldsValue(record.value);
<% for (child in table.childList){ %>
set${child.className}TableData(res);
<% } %>
<% if(updateSchemas.~size > 0){ %>
updateSchema([
<% for(updateSchema in updateSchemas){
print(updateSchema + '\n');
print(updateSchema + '\n');
} %>
]);
<% } %>
@@ -327,13 +530,16 @@ for (c in table.columnList){
isNewRecord: record.value.isNewRecord,
<%
for (c in table.columnList){
if (c.isPk == '1' || c.showType == 'hidden'){ %>
if (c.isPk == '1' || c.showType == 'hidden'){ %>
${c.attrName}: record.value.${c.attrName},
<%
}
}
%>
};
<% for (child in table.childList){ %>
data.${@StringUtils.uncap(child.className)}List = await get${child.className}List();
<% } %>
// console.log('submit', params, data, record);
const res = await ${className}Save(params, data);
showMessage(res.message);

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>vueIndex</name>
<filePath>vue/src/views/${urlPrefix}</filePath>
<filePath>src/views/${urlPrefix}</filePath>
<fileName>index.vue</fileName>
<content><![CDATA[
<% if(table.isTreeEntity){ %>

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>vueList</name>
<filePath>vue/src/views/${urlPrefix}</filePath>
<filePath>src/views/${urlPrefix}</filePath>
<fileName>list.vue</fileName>
<content><![CDATA[
<!--
@@ -19,7 +19,7 @@
<span> {{ getTitle.value }} </span>
</template>
<template #toolbar>
<% if(table.isTreeEntity){ %>
<% if(table.isTreeEntity){ %>
<a-button @click="expandAll" :title="t('展开一级')">
<Icon icon="bi:chevron-double-down" /> {{ t('展开') }}
</a-button>
@@ -33,14 +33,14 @@
</template>
<template #firstColumn="{ record }">
<%
var idParam = '';
for(pk in table.pkList){
idParam = idParam + pk.attrName + ': record.' + pk.attrName;
if (pkLP.index == table.pkList.~size - 1) {
idParam = idParam + ', ';
}
}
if(table.isTreeEntity){
var idParam = '';
for(pk in table.pkList){
idParam = idParam + pk.attrName + ': record.' + pk.attrName;
if (pkLP.index == table.pkList.~size - 1) {
idParam = idParam + ', ';
}
}
if(table.isTreeEntity){
%>
<span class="cursor-pointer" @click="expandCollapse(record)">
( {{ record.${table.treeViewCodeAttrName} }} )
@@ -49,25 +49,25 @@
{{ record.${table.treeViewNameAttrName} }}
</a>
<%
}else{
for(c in table.columnList){
if(c.isList == "1"){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && @StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')
&& c.attrName != table.treeViewCodeAttrName
&& c.attrName != table.treeViewNameAttrName){
continue;
}
}else{
for(c in table.columnList){
if(c.isList == "1"){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && @StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')
&& c.attrName != table.treeViewCodeAttrName
&& c.attrName != table.treeViewNameAttrName){
continue;
}
%>
<a @click="handleForm({ ${idParam} })">
{{ record.${c.attrName} }}
</a>
<%
break;
}
}
}
break;
}
}
}
%>
</template>
</BasicTable>
@@ -95,15 +95,15 @@ var userselectExists = false;
var officeselectExists = 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 == 'areaselect'){
areaselectExists = true;
}
}
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.showType == 'userselect'){
userselectExists = true;
}else if(c.showType == 'officeselect'){
officeselectExists = true;
}else if(c.showType == 'areaselect'){
areaselectExists = true;
}
}
}
%>
<% if(userselectExists || officeselectExists) { %>
@@ -148,7 +148,7 @@ for(c in table.columnList){
component: 'Input',
<% } %>
<% }else if(c.showType == 'select' || c.showType == 'select_multiple'){
var isMultiple = (c.showType == 'select_multiple'); %>
var isMultiple = (c.showType == 'select_multiple'); %>
component: 'Select',
componentProps: {
dictType: '${c.optionMap['dictType']}',
@@ -163,7 +163,7 @@ for(c in table.columnList){
dictType: '${c.optionMap['dictType']}',
},
<% }else if(c.showType == 'date' || c.showType == 'datetime'){
var isTime = (c.showType == 'datetime'); %>
var isTime = (c.showType == 'datetime'); %>
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD${isTime?' HH:mm':''}',
@@ -214,9 +214,9 @@ for(c in table.columnList){
var firstColumn = true;
// 生成树表的节点列
if(table.isTreeEntity){
for(c in table.columnList){
if(c.attrName == table.treeViewNameAttrName){
%>
for(c in table.columnList){
if(c.attrName == table.treeViewNameAttrName){
%>
{
title: t('${c.columnLabel}'),
dataIndex: '${c.attrName}',
@@ -224,21 +224,21 @@ if(table.isTreeEntity){
align: 'left',
slots: { customRender: 'firstColumn' },
},
<%
firstColumn = false;
break;
}
}
<%
firstColumn = false;
break;
}
}
}
for(c in table.columnList){
if(c.isList == "1"){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && (@StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')
|| c.attrName == table.treeViewCodeAttrName
|| c.attrName == table.treeViewNameAttrName)){
continue;
}
if(c.isList == "1"){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && (@StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')
|| c.attrName == table.treeViewCodeAttrName
|| c.attrName == table.treeViewNameAttrName)){
continue;
}
%>
{
title: t('${c.columnLabel}'),
@@ -271,10 +271,10 @@ for(c in table.columnList){
<% } %>
},
<%
if(firstColumn){
firstColumn = false;
}
}
if(firstColumn){
firstColumn = false;
}
}
}
%>
];
@@ -342,11 +342,11 @@ for(c in table.columnList){
const [registerTable, { reload<% if(table.isTreeEntity){ %>, expandAll, collapseAll, expandCollapse<% } %> }] = useTable({
api: ${className}ListData,
beforeFetch: (params) => {
<% if(table.isTreeEntity){ %>
<% for(pk in table.pkList){ %>
<% if(table.isTreeEntity){ %>
<% for(pk in table.pkList){ %>
params.${pk.attrName} = props.treeCode;
<% } %>
<% } %>
<% } %>
<% } %>
return params;
},
columns: tableColumns,