新增树形表生成
This commit is contained in:
parent
e1c8b3b5ce
commit
38e9cddf36
@ -193,6 +193,19 @@ public partial class SysCodeGen : EntityBase
|
|||||||
[MaxLength(64)]
|
[MaxLength(64)]
|
||||||
public string? Template { get; set; }
|
public string? Template { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表类型
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "表类型", Length = 64)]
|
||||||
|
public string TabType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 树控件PidKey字段
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "树控件PidKey字段", Length = 64)]
|
||||||
|
[MaxLength(64)]
|
||||||
|
public string? TreeKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否使用 Api Service
|
/// 是否使用 Api Service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -74,6 +74,8 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData<SysDictData>
|
|||||||
new SysDictData{ Id=1300000000703, DictTypeId=1300000000201, Label="部门", Value="301", OrderNo=102, Remark="部门", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
new SysDictData{ Id=1300000000703, DictTypeId=1300000000201, Label="部门", Value="301", OrderNo=102, Remark="部门", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
||||||
new SysDictData{ Id=1300000000704, DictTypeId=1300000000201, Label="区域", Value="401", OrderNo=103, Remark="区域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
new SysDictData{ Id=1300000000704, DictTypeId=1300000000201, Label="区域", Value="401", OrderNo=103, Remark="区域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
||||||
new SysDictData{ Id=1300000000705, DictTypeId=1300000000201, Label="组", Value="501", OrderNo=104, Remark="组", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
new SysDictData{ Id=1300000000705, DictTypeId=1300000000201, Label="组", Value="501", OrderNo=104, Remark="组", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
||||||
|
new SysDictData{ Id=1300000000706, DictTypeId=1300000000202, Label="普通列表", Value="List", OrderNo=105, Remark="普通列表", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
||||||
|
new SysDictData{ Id=1300000000707, DictTypeId=1300000000202, Label="树形表", Value="Tree", OrderNo=106, Remark="树形表", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,6 +26,7 @@ public class SysDictTypeSeedData : ISqlSugarEntitySeedData<SysDictType>
|
|||||||
new SysDictType{ Id=1300000000105, Name="代码生成基类", Code="code_gen_base_class", SysFlag=YesNoEnum.Y, OrderNo=104, Remark="代码生成基类", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
new SysDictType{ Id=1300000000105, Name="代码生成基类", Code="code_gen_base_class", SysFlag=YesNoEnum.Y, OrderNo=104, Remark="代码生成基类", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
||||||
new SysDictType{ Id=1300000000106, Name="代码生成打印类型", Code="code_gen_print_type", SysFlag=YesNoEnum.Y, OrderNo=105, Remark="代码生成打印类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
|
new SysDictType{ Id=1300000000106, Name="代码生成打印类型", Code="code_gen_print_type", SysFlag=YesNoEnum.Y, OrderNo=105, Remark="代码生成打印类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
|
||||||
new SysDictType{ Id=1300000000201, Name="机构类型", Code="org_type", SysFlag=YesNoEnum.Y, OrderNo=201, Remark="机构类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
new SysDictType{ Id=1300000000201, Name="机构类型", Code="org_type", SysFlag=YesNoEnum.Y, OrderNo=201, Remark="机构类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
||||||
|
new SysDictType{ Id=1300000000202, Name="代码生成控件表类型", Code="code_gen_tab_type", SysFlag=YesNoEnum.Y, OrderNo=202, Remark="代码生成控件表类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,6 +46,7 @@ public class CustomViewEngine : ViewEngineModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string? TreeName { get; set; }
|
public string? TreeName { get; set; }
|
||||||
|
public string? TreeKey { get; set; }
|
||||||
public string? LowerTreeName { get; set; }
|
public string? LowerTreeName { get; set; }
|
||||||
public string? LeftTab { get; set; }
|
public string? LeftTab { get; set; }
|
||||||
public string? LowerLeftTab { get; set; }
|
public string? LowerLeftTab { get; set; }
|
||||||
@ -60,6 +61,7 @@ public class CustomViewEngine : ViewEngineModel
|
|||||||
public string? BottomPrimaryKey { get; set; }
|
public string? BottomPrimaryKey { get; set; }
|
||||||
public string? LowerBottomKey { get; set; }
|
public string? LowerBottomKey { get; set; }
|
||||||
public string? LowerBottomPrimaryKey { get; set; }
|
public string? LowerBottomPrimaryKey { get; set; }
|
||||||
|
public string TabType { get; set; }
|
||||||
public string PagePath { get; set; } = "main";
|
public string PagePath { get; set; } = "main";
|
||||||
|
|
||||||
public bool IsJoinTable { get; set; }
|
public bool IsJoinTable { get; set; }
|
||||||
|
|||||||
@ -61,6 +61,11 @@ public class PageCodeGenInput : BasePageInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TreeName { get; set; }
|
public string? TreeName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 树控件key
|
||||||
|
/// </summary>
|
||||||
|
public string? TreeKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 命名空间
|
/// 命名空间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -222,6 +227,11 @@ public class AddCodeGenInput : PageCodeGenInput
|
|||||||
/// 模板
|
/// 模板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Template { get; set; }
|
public string? Template { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表类型
|
||||||
|
/// </summary>
|
||||||
|
public string TabType { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeleteCodeGenInput
|
public class DeleteCodeGenInput
|
||||||
|
|||||||
@ -41,6 +41,11 @@ public class CodeGenOutput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string TableName { get; set; }
|
public string TableName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表类型
|
||||||
|
/// </summary>
|
||||||
|
public string TabType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包名
|
/// 包名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -66,6 +71,15 @@ public class CodeGenOutput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool GenerateMenu { get; set; }
|
public bool GenerateMenu { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 树控件名称
|
||||||
|
/// </summary>
|
||||||
|
public string? TreeName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 树控件key
|
||||||
|
/// </summary>
|
||||||
|
public string? TreeKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单父级
|
/// 菜单父级
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -448,6 +448,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
LowerBottomTab = input.BottomTab?.ToFirstLetterLowerCase() ?? "", // 首字母小写
|
LowerBottomTab = input.BottomTab?.ToFirstLetterLowerCase() ?? "", // 首字母小写
|
||||||
LowerBottomKey = input.BottomKey?.ToFirstLetterLowerCase() ?? "", // 首字母小写
|
LowerBottomKey = input.BottomKey?.ToFirstLetterLowerCase() ?? "", // 首字母小写
|
||||||
LowerBottomPrimaryKey = input.BottomPrimaryKey?.ToFirstLetterLowerCase() ?? "", // 首字母小写
|
LowerBottomPrimaryKey = input.BottomPrimaryKey?.ToFirstLetterLowerCase() ?? "", // 首字母小写
|
||||||
|
TabType = input.TabType ?? "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,6 +473,15 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
filename = (!string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_BottomIndx.vue.vm" : filename; // 左树右上列表下列表属性
|
filename = (!string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_BottomIndx.vue.vm" : filename; // 左树右上列表下列表属性
|
||||||
filename = (string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_UDIndx.vue.vm" : filename; // 右上列表下列表属性
|
filename = (string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_UDIndx.vue.vm" : filename; // 右上列表下列表属性
|
||||||
}
|
}
|
||||||
|
//更改list控件
|
||||||
|
if (filename == "web_views_List.vue.vm")
|
||||||
|
{
|
||||||
|
filename = data.TabType switch
|
||||||
|
{
|
||||||
|
"Tree" => "web_views_TreeList.vue.vm",
|
||||||
|
_ => "web_views_List.vue.vm" // 默认列表
|
||||||
|
};
|
||||||
|
}
|
||||||
var templateFilePath = Path.Combine(templatePath, filename);
|
var templateFilePath = Path.Combine(templatePath, filename);
|
||||||
if (!File.Exists(templateFilePath)) return null;
|
if (!File.Exists(templateFilePath)) return null;
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ const handleNodeChange = async (node: any) => {
|
|||||||
state.queryParams["@(@Model.LowerLeftPrimaryKey)"] = node.data.@(@Model.LowerLeftKey);//树主表关联字段=树关联字段
|
state.queryParams["@(@Model.LowerLeftPrimaryKey)"] = node.data.@(@Model.LowerLeftKey);//树主表关联字段=树关联字段
|
||||||
console.log('handleNodeChange--', state.queryParams.@(@Model.LowerLeftPrimaryKey));
|
console.log('handleNodeChange--', state.queryParams.@(@Model.LowerLeftPrimaryKey));
|
||||||
await indexListRef.value?.listhandleQuery(state.queryParams);
|
await indexListRef.value?.listhandleQuery(state.queryParams);
|
||||||
await @(@Model.LowerBottomTab)BottomRef.value?.listhandleQuery({@(@Model.LowerBottomKey):'0'});//重置下表一个不可能有的条件
|
await @(@Model.LowerBottomTab)BottomRef.value?.listhandleQuery({@(@Model.LowerBottomKey):'1'});//重置下表一个不可能有的条件
|
||||||
};
|
};
|
||||||
// 主表List组件点击
|
// 主表List组件点击
|
||||||
const handleIndexChange = async (row: any,column: any) => {
|
const handleIndexChange = async (row: any,column: any) => {
|
||||||
|
|||||||
@ -0,0 +1,566 @@
|
|||||||
|
@{
|
||||||
|
string LowerFirstLetter(string text)
|
||||||
|
{
|
||||||
|
return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
|
||||||
|
}
|
||||||
|
var pkField = Model.TableField.Where(c => c.ColumnKey == "True").FirstOrDefault();
|
||||||
|
string pkFieldName = null;
|
||||||
|
if(pkField != null && !string.IsNullOrEmpty(pkField.PropertyName))
|
||||||
|
{
|
||||||
|
pkFieldName = LowerFirstLetter(pkField.PropertyName);
|
||||||
|
}
|
||||||
|
Dictionary<string, int> definedObjects = new Dictionary<string, int>();
|
||||||
|
bool haveLikeCdt = false;
|
||||||
|
foreach (var column in Model.TableField){
|
||||||
|
if (column.QueryWhether == "Y" && column.QueryType == "like"){
|
||||||
|
haveLikeCdt = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<template>
|
||||||
|
<el-card shadow="hover" :body-style="{ padding: '20px 20px 16px 10px', display: 'flex', width: '100%', height: '100%', alignItems: 'start' }">
|
||||||
|
<el-form :model="state.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true" label-width="auto" style="flex: 1 1 0%" @@submit.prevent="handleQuery" >
|
||||||
|
<el-row :gutter="10">
|
||||||
|
@if(Model.QueryWhetherList.Count > 0){
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5">
|
||||||
|
<el-form-item label="关键字" prop="searchKey">
|
||||||
|
<el-input v-model="state.queryParams.searchKey" placeholder="请输入模糊查询关键字" clearable @@keyup.enter.native="handleQuery(true)" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
foreach (var column in Model.QueryWhetherList) {
|
||||||
|
if(@column.EffectType == "Input" || @column.EffectType == "InputTextArea") {
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
|
||||||
|
<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
|
||||||
|
<el-input v-model="state.queryParams.@(@column.LowerPropertyName)" placeholder="@column.ColumnComment" clearable @@keyup.enter.native="handleQuery(true)" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
} else if(@column.EffectType == "InputNumber") {
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
|
||||||
|
<el-form-item label="@column.ColumnComment">
|
||||||
|
<el-input-number v-model="state.queryParams.@(@column.LowerPropertyName)" placeholder="请输入@(@column.ColumnComment)" clearable @@keyup.enter.native="handleQuery(true)" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
} else if(@column.EffectType == "ForeignKey") {
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
|
||||||
|
<el-form-item label="@column.ColumnComment">
|
||||||
|
<el-select filterable="" v-model="state.queryParams.@(@column.LowerPropertyName)" placeholder="请选择@(@column.ColumnComment)" clearable>
|
||||||
|
<el-option v-for="(item,index) in @LowerFirstLetter(@column.FkEntityName)@(@column.PropertyName)DropdownList" :key="index" :value="item.value" :label="item.label" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
} else if(@column.EffectType == "DictSelector") {
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
|
||||||
|
<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
|
||||||
|
<el-select v-model="state.queryParams.@(@column.LowerPropertyName)" filterable placeholder="请选择@(@column.ColumnComment)" clearable @@keyup.enter.native="handleQuery(true)" >
|
||||||
|
<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="item.code" :label="`${item.name||''} [${item.code}] ${item.value}`" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
} else if(@column.EffectType == "EnumSelector") {
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
|
||||||
|
<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
|
||||||
|
<el-select v-model="state.queryParams.@(@column.LowerPropertyName)" filterable placeholder="请选择@(@column.ColumnComment)" clearable @@keyup.enter.native="handleQuery(true)" >
|
||||||
|
<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="item.value" :label="`${item.name} [${item.code}] ${item.value}`" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
} else if(@column.EffectType == "ApiTreeSelector") {
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
|
||||||
|
<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
|
||||||
|
<el-cascader
|
||||||
|
@:options="@LowerFirstLetter(@column.FkEntityName)TreeData"
|
||||||
|
@:props="{ checkStrictly: true, emitPath: false, value: '@LowerFirstLetter(@column.ValueColumn)', label: '@LowerFirstLetter(@column.DisplayColumn)' }"
|
||||||
|
placeholder="请选择@(column.ColumnComment)"
|
||||||
|
clearable=""
|
||||||
|
class="w100"
|
||||||
|
v-model="state.queryParams.@(@column.LowerPropertyName)"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.@LowerFirstLetter(@column.DisplayColumn) }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
} else if(@column.EffectType == "DatePicker") {
|
||||||
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
|
||||||
|
<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
|
||||||
|
@if(@column.QueryType == "~"){
|
||||||
|
@:<el-date-picker type="daterange" v-model="state.queryParams.@(@column.LowerPropertyName)Range" value-format="YYYY-MM-DD HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" />
|
||||||
|
} else {
|
||||||
|
@:<el-date-picker placeholder="请选择@(@column.ColumnComment)" value-format="YYYY/MM/DD" v-model="state.queryParams.@(@column.LowerPropertyName)" />
|
||||||
|
}
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-divider style="height: calc(100% - 5px); margin: 0 10px" direction="vertical" />
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<el-button-group>
|
||||||
|
<el-button type="primary" icon="ele-Search" @@click="handleQuery(true)" v-auth="'@(@Model.LowerClassName)/page'" :loading="options.loading"> 查询 </el-button>
|
||||||
|
<el-button icon="ele-Refresh" @@click="resetQuery" :loading="options.loading"> 重置 </el-button>
|
||||||
|
<el-button icon="ele-ZoomIn" @@click="changeAdvanceQueryUI" v-if="!state.showAdvanceQueryUI" style="margin-left: 5px"> 高级查询 </el-button>
|
||||||
|
<el-button icon="ele-ZoomOut" @@click="changeAdvanceQueryUI" v-if="state.showAdvanceQueryUI" style="margin-left: 5px"> 隐藏 </el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
||||||
|
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" v-on="gridEvents">
|
||||||
|
<template #toolbar_buttons>
|
||||||
|
<el-button type="primary" icon="ele-Plus" @@click="handleAdd" v-auth="'@(@Model.LowerClassName)/add'"> 新增 </el-button>
|
||||||
|
<el-button-group style="padding-left: 12px">
|
||||||
|
<el-button type="primary" icon="ele-Expand" @@click="handleExpand"> 全部展开 </el-button>
|
||||||
|
<el-button type="primary" icon="ele-Fold" @@click="handleFold"> 全部折叠 </el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</template>
|
||||||
|
<template #toolbar_tools> </template>
|
||||||
|
<template #empty>
|
||||||
|
<el-empty :image-size="200" />
|
||||||
|
</template>
|
||||||
|
@foreach (var column in Model.TableField) {
|
||||||
|
|
||||||
|
if(@column.WhetherTable == "Y") {
|
||||||
|
if(@column.EffectType == "Upload") {
|
||||||
|
@:<template #row_@(@column.LowerPropertyName)="{ row }">
|
||||||
|
@:<el-popover
|
||||||
|
@:v-if="row.@column.LowerPropertyName"
|
||||||
|
@:placement="bottom"
|
||||||
|
@::width="60"
|
||||||
|
@::height="60"
|
||||||
|
@:trigger="hover">
|
||||||
|
@:<template #reference>
|
||||||
|
@:<el-tag>查看文件</el-tag>
|
||||||
|
@:</template>
|
||||||
|
@:<template #default>
|
||||||
|
@:<el-image
|
||||||
|
@::src="row.@column.LowerPropertyName"
|
||||||
|
@::hide-on-click-modal="true"
|
||||||
|
@::preview-src-list="[row.@column.LowerPropertyName]"
|
||||||
|
@::initial-index="0"
|
||||||
|
@:fit="scale-down"
|
||||||
|
@:preview-teleported=""/>
|
||||||
|
@:</template>
|
||||||
|
@:</el-popover>
|
||||||
|
@:<el-tag v-else type="info">暂无文件</el-tag>
|
||||||
|
@:</template>
|
||||||
|
} else if(@column.EffectType == "ForeignKey") {
|
||||||
|
@:<template #row_@(@column.LowerPropertyName)="{ row }">
|
||||||
|
@:<span>{{ row.@LowerFirstLetter(@column.PropertyName)@(@column.FkColumnName) }}</span>
|
||||||
|
@:</template>
|
||||||
|
} else if(@column.EffectType == "ApiTreeSelector") {
|
||||||
|
@:<template #row_@(@column.LowerPropertyName)="{ row }">
|
||||||
|
@:<span>{{ row.@LowerFirstLetter(@column.PropertyName)@(column.DisplayColumn) }}</span>
|
||||||
|
@:</template>
|
||||||
|
} else if(@column.EffectType == "Switch") {
|
||||||
|
@:<template #row_@(@column.LowerPropertyName)="{ row }">
|
||||||
|
@:<el-tag v-if="row.@(@column.LowerPropertyName)"> 是 </el-tag>
|
||||||
|
@:<el-tag type="danger" v-else> 否 </el-tag>
|
||||||
|
@:</template>
|
||||||
|
} else if(@column.EffectType == "ConstSelector") {
|
||||||
|
@:<template #row_@(@column.LowerPropertyName)="{ row }">
|
||||||
|
@:<span>{{codeToName(row.@(@column.LowerPropertyName), '@(@column.DictTypeCode)')}}</span>
|
||||||
|
@:</template>
|
||||||
|
} else if(@column.EffectType == "DictSelector") {
|
||||||
|
@:<template #row_@(@column.LowerPropertyName)="{ row }">
|
||||||
|
@:<el-tag v-if="row.@(@column.LowerPropertyName)" :type="dc('@(@column.DictTypeCode)', row.@(@column.LowerPropertyName))?.tagType"> {{dc('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.label}}</el-tag>
|
||||||
|
@:</template>
|
||||||
|
} else if(@column.EffectType == "EnumSelector") {
|
||||||
|
@:<template #row_@(@column.LowerPropertyName)="{ row }">
|
||||||
|
@:<el-tag :type="dv('@(@column.DictTypeCode)', row.@(@column.LowerPropertyName))?.tagType"> {{dv('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}</el-tag>
|
||||||
|
@:</template>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<!-- <template #row_record="{ row }">
|
||||||
|
<ModifyRecord :data="row" />
|
||||||
|
</template> -->
|
||||||
|
<template #row_buttons="{ row }">
|
||||||
|
@if(@Model.PrintType != "off") {
|
||||||
|
<el-tooltip content="打印" placement="top">
|
||||||
|
<el-button icon="ele-Printer" size="small" text type="primary" @@click="handlePrint(row)" v-auth="'@(@Model.LowerClassName)/print'" />
|
||||||
|
</el-tooltip>
|
||||||
|
}
|
||||||
|
<el-tooltip content="编辑" placement="top">
|
||||||
|
<el-button icon="ele-Edit" size="small" text type="primary" @@click="handleEdit(row)" v-auth="'@(@Model.LowerClassName)/update'" />
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="删除" placement="top">
|
||||||
|
<el-button icon="ele-Delete" size="small" text type="danger" @@click="handleDelete(row)" v-auth="'@(@Model.LowerClassName)/delete'" />
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</vxe-grid>
|
||||||
|
</el-card>
|
||||||
|
@if(@Model.PrintType != "off"){
|
||||||
|
@:<PrintDialog ref="printDialogRef" :title="state.title" @@reloadTable="handleQuery" />
|
||||||
|
}
|
||||||
|
<EditDialog ref="editDialogRef" :title="state.title" @@reloadTable="handleQuery" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup name="@(@Model.LowerClassName)list">
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { ElMessageBox, ElMessage } from "element-plus";
|
||||||
|
import { useUserInfo } from '/@@/stores/userInfo';
|
||||||
|
|
||||||
|
import { VxeGridInstance, VxeGridListeners, VxeGridPropTypes } from 'vxe-table';
|
||||||
|
import { useVxeTable } from '/@@/hooks/useVxeTableOptionsHook';
|
||||||
|
import { Local } from '/@@/utils/storage';
|
||||||
|
|
||||||
|
@if(@Model.TableField.Any(x=>x.EffectType == "DatePicker")){
|
||||||
|
@:import { formatDate } from '/@@/utils/formatTime';
|
||||||
|
}
|
||||||
|
|
||||||
|
@if(@Model.PrintType != "off"){
|
||||||
|
@:// 推荐设置操作 width 为 200
|
||||||
|
@:import { hiprint } from 'vue-plugin-hiprint';
|
||||||
|
@:import { SysPrintApi } from '/@@/api-services/api';
|
||||||
|
@:import { SysPrint } from '/@@/api-services/models';
|
||||||
|
}
|
||||||
|
// 子窗口
|
||||||
|
@if(@Model.PrintType != "off") {
|
||||||
|
@:import PrintDialog from '/@@/views/system/print/component/hiprint/preview.vue';
|
||||||
|
}
|
||||||
|
import EditDialog from '/@@/views/@(@Model.PagePath)/@(@Model.LowerClassName)/component/editDialog.vue';
|
||||||
|
import ModifyRecord from '/@@/components/table/modifyRecord.vue';
|
||||||
|
|
||||||
|
@if (@Model.IsApiService) {
|
||||||
|
// 接口函数
|
||||||
|
@:import { getAPI } from '/@@/utils/axios-utils';
|
||||||
|
|
||||||
|
// 接口
|
||||||
|
@:import { @(@Model.ClassName)Api } from '/@@/api-services/api';
|
||||||
|
|
||||||
|
// 模型
|
||||||
|
@:import { @(@Model.ClassName), @(@Model.ClassName)Input, @(@Model.ClassName)Output } from '/@@/api-services/models';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
@:import { treelist@(@Model.ClassName), delete@(@Model.ClassName) } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
||||||
|
@:import { @(@Model.ClassName) } from '/@@/api/models/@(@Model.LowerClassName)';
|
||||||
|
foreach (var column in Model.QueryWhetherList){
|
||||||
|
if(@column.EffectType == "ForeignKey"){
|
||||||
|
@:import { get@(@column.FkEntityName)@(@column.PropertyName)Dropdown } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
||||||
|
}
|
||||||
|
if(@column.EffectType == "ApiTreeSelector"){
|
||||||
|
@:import { get@(@column.FkEntityName)Tree } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 子窗口对象
|
||||||
|
const xGrid = ref<VxeGridInstance>();
|
||||||
|
@if(@Model.PrintType != "off") {
|
||||||
|
@:const printDialogRef = ref<InstanceType<typeof PrintDialog>>();
|
||||||
|
}
|
||||||
|
const editDialogRef = ref<InstanceType<typeof EditDialog>>();
|
||||||
|
const userStore = useUserInfo();
|
||||||
|
|
||||||
|
@if(@Model.TableField.Any(x=>x.EffectType == "ConstSelector")){
|
||||||
|
@:const codeToName = userStore.codeToName;
|
||||||
|
}
|
||||||
|
@if(@Model.TableField.Any(x=>x.EffectType == "DictSelector") || @Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
|
||||||
|
@:const dc = userStore.getDictItemByValue;
|
||||||
|
@:const dv = userStore.getDictItemByLabel;
|
||||||
|
@:const dl = userStore.getDictDataByCode;
|
||||||
|
|
||||||
|
// 变量
|
||||||
|
const state = reactive({
|
||||||
|
showAdvanceQueryUI: false,
|
||||||
|
treeData: [] as Array<@(@Model.ClassName)>, // 树所有数据
|
||||||
|
queryParams: {
|
||||||
|
searchKey: undefined,
|
||||||
|
@if(Model.QueryWhetherList.Count > 0) {
|
||||||
|
@foreach (var column in Model.QueryWhetherList) {
|
||||||
|
@:@(@column.LowerPropertyName): undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
localPageParam: {
|
||||||
|
pageSize: 50 as number,
|
||||||
|
defaultSort: { field: 'Id', order: 'asc', descStr: 'desc' },
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
|
title: '',
|
||||||
|
key:'',
|
||||||
|
val:null,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 本地存储参数
|
||||||
|
const localPageParamKey = 'localPageParam:@(@Model.LowerClassName)';
|
||||||
|
|
||||||
|
// 改变高级查询的控件显示状态
|
||||||
|
const changeAdvanceQueryUI = () => {
|
||||||
|
state.showAdvanceQueryUI = !state.showAdvanceQueryUI;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 校验表格字段权限
|
||||||
|
const checkTableColumnVisible = (tableColumnName: any) => {
|
||||||
|
return !userStore.userTableList.includes(tableColumnName);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格参数配置
|
||||||
|
@if (@Model.IsApiService) {
|
||||||
|
@:const options = useVxeTable<@(@Model.ClassName)>(
|
||||||
|
} else {
|
||||||
|
@:const options = useVxeTable<@(@Model.ClassName)>(
|
||||||
|
}
|
||||||
|
{
|
||||||
|
id: '@(@Model.ClassName)',
|
||||||
|
name: '@(@Model.BusName)',
|
||||||
|
columns: [
|
||||||
|
{ type: 'seq', title: '序号', width: 60, fixed: 'left' },
|
||||||
|
@foreach (var column in Model.TableField) {
|
||||||
|
var whethersortable =column.WhetherSortable == "Y" ? "sortable: true" : "sortable: false";
|
||||||
|
var treetable =((Model.TabType == "Tree"||Model.TabType == "OnlyTree")&&column.ColumnName==Model.TreeName) ? ", treeNode: true, align: 'left'" : "";
|
||||||
|
if(@column.WhetherTable == "Y") {
|
||||||
|
if(@column.EffectType == "Upload" || @column.EffectType == "ForeignKey" || @column.EffectType == "ApiTreeSelector" || @column.EffectType == "Switch" || @column.EffectType == "ConstSelector") {
|
||||||
|
if(@column.EffectType == "Upload") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' } @treetable, @whethersortable },
|
||||||
|
} else if(@column.EffectType == "ForeignKey") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' } @treetable, @whethersortable },
|
||||||
|
} else if(@column.EffectType == "ApiTreeSelector") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' } @treetable, @whethersortable },
|
||||||
|
} else if(@column.EffectType == "Switch") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' } @treetable, @whethersortable },
|
||||||
|
} else if(@column.EffectType == "ConstSelector") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' } @treetable, @whethersortable },
|
||||||
|
}
|
||||||
|
} else if(@column.EffectType == "DictSelector") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' } @treetable, @whethersortable },
|
||||||
|
} else if(@column.EffectType == "EnumSelector") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' } @treetable, @whethersortable },
|
||||||
|
} else if(@column.EffectType == "DatePicker") {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', formatter: ({ cellValue }) => formatDate(new Date(cellValue), 'YYYY-mm-dd HH:MM:SS'), @whethersortable },
|
||||||
|
} else {
|
||||||
|
@:{ visible: checkTableColumnVisible('@(@Model.LowerClassName):@(@column.LowerPropertyName)'), field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip' @treetable, @whethersortable},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if(@Model.TableField.Any(t => t.ColumnName == "CreateTime" && t.ColumnName == "UpdateTime" && t.ColumnName == "CreateUserId")){
|
||||||
|
@:{ title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||||
|
}
|
||||||
|
{ title: '操作', fixed: 'right', width: 180, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
||||||
|
{
|
||||||
|
stripe: false,
|
||||||
|
// 多选配置
|
||||||
|
checkboxConfig: { range: false },
|
||||||
|
// 代理配置//加载时不立刻获取
|
||||||
|
proxyConfig: { autoLoad: false, ajax: { query: () => handleQueryApi() } },
|
||||||
|
// 分页配置
|
||||||
|
pagerConfig: { enabled: false },
|
||||||
|
// 工具栏配置
|
||||||
|
toolbarConfig: { export: false },
|
||||||
|
// 树形配置
|
||||||
|
treeConfig: { expandAll: false },
|
||||||
|
// 设置列显隐
|
||||||
|
customConfig: {
|
||||||
|
visibleMethod({ column }) {
|
||||||
|
return checkTableColumnVisible(`@Model.LowerClassName:${column.field}`);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 页面初始化
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 查询api
|
||||||
|
const handleQueryApi = async () => {
|
||||||
|
const params = Object.assign(state.queryParams);
|
||||||
|
@if (@Model.IsApiService) {
|
||||||
|
@:return getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)GetTreeListPost(params);
|
||||||
|
} else {
|
||||||
|
@:return treelist@(@Model.ClassName)(params);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查询操作
|
||||||
|
const handleQuery = async (updateTree: boolean = false) => {
|
||||||
|
options.loading = true;
|
||||||
|
var res = await handleQueryApi();
|
||||||
|
xGrid.value?.loadData(res.data.result ?? []);
|
||||||
|
options.loading = false;
|
||||||
|
// 是否更新左侧树
|
||||||
|
if (updateTree == true) {
|
||||||
|
emits('list-reload');
|
||||||
|
}
|
||||||
|
// 若无选择节点并且查询条件为空时,更新编辑页面机构列表树
|
||||||
|
if (state.queryParams.id == 0 && state.queryParams.name == undefined && state.queryParams.code == undefined && state.queryParams.type == undefined && updateTree == false)
|
||||||
|
state.treeData = res.data.result ?? [];
|
||||||
|
};
|
||||||
|
const listhandleQuery= async (qparams: any,key:string,val:any) => {
|
||||||
|
console.log('listhandleQuery--', JSON.stringify(qparams));
|
||||||
|
state.key=key;
|
||||||
|
state.val=val;
|
||||||
|
if(qparams) state.queryParams=qparams;
|
||||||
|
await handleQuery(true);
|
||||||
|
};
|
||||||
|
// 重置操作
|
||||||
|
const resetQuery = async () => {
|
||||||
|
state.queryParams.searchKey = undefined;
|
||||||
|
@if(Model.QueryWhetherList.Count > 0) {
|
||||||
|
@foreach (var column in Model.QueryWhetherList) {
|
||||||
|
@:state.queryParams.@(@column.LowerPropertyName) = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await xGrid.value?.commitProxy('reload');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 打开新增页面
|
||||||
|
const handleAdd = () => {
|
||||||
|
state.title = '添加@(@Model.BusName)';
|
||||||
|
let data = {
|
||||||
|
[state.key]: state.val,
|
||||||
|
@foreach (var column in Model.TableField){
|
||||||
|
if(@column.WhetherAddUpdate == "Y"&&@column.DefaultValue!=null){
|
||||||
|
if(@column.NetType.StartsWith("int")||@column.NetType.StartsWith("decimal")){
|
||||||
|
@:@column.LowerPropertyName:@(string.IsNullOrEmpty(@column.DefaultValue)?0:@column.DefaultValue),
|
||||||
|
}
|
||||||
|
if(@column.NetType.StartsWith("string")){
|
||||||
|
@:@column.LowerPropertyName:'@(@column.DefaultValue)',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
editDialogRef.value?.openDialog(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 打开编辑页面
|
||||||
|
const handleEdit = (row: any) => {
|
||||||
|
state.title = '编辑@(@Model.BusName)';
|
||||||
|
editDialogRef.value?.openDialog(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
@if(@Model.PrintType != "off") {
|
||||||
|
@:// 打开打印页面
|
||||||
|
@:const handlePrint = async (row: any) => {
|
||||||
|
@:state.title = '打印@(@Model.BusName)';
|
||||||
|
@if(@Model.PrintType != "off"){
|
||||||
|
if (@Model.IsApiService) {
|
||||||
|
@:var res = await getAPI(SysPrintApi).apiSysPrintPrintNameGet('@Model.PrintName');
|
||||||
|
} else {
|
||||||
|
@:var res = await getPrint@(@Model.ClassName)(row);
|
||||||
|
}
|
||||||
|
@:var printTemplate = res.data.result as SysPrint;
|
||||||
|
@:var template = JSON.parse(printTemplate.template);
|
||||||
|
@:var width = template.panels[0].width;
|
||||||
|
@:row['barCode'] = row.code;
|
||||||
|
@:row['qrCode'] = row.code;
|
||||||
|
@:row["printDate"] = formatDate(new Date(), 'YYYY-mm-dd HH:MM');
|
||||||
|
@:printDialogRef.value.showDialog(new hiprint.PrintTemplate({template: template}), row, width);
|
||||||
|
}
|
||||||
|
@if(@Model.PrintType == "auto"){
|
||||||
|
@:printDialogRef.value.showDialog(row);
|
||||||
|
}
|
||||||
|
@:};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const handleDelete = (row: any) => {
|
||||||
|
ElMessageBox.confirm(`确定删除@(@Model.BusName):【${row.id}】?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}).then(async () => {
|
||||||
|
@if (@Model.IsApiService) {
|
||||||
|
@:await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)DeletePost({ id: row.id });
|
||||||
|
} else {
|
||||||
|
@:await delete@(@Model.ClassName)(row);
|
||||||
|
}
|
||||||
|
await handleQuery();
|
||||||
|
ElMessage.success('删除成功');
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
// 表格事件
|
||||||
|
@if (@Model.IsApiService) {
|
||||||
|
@:const gridEvents: VxeGridListeners<@(@Model.ClassName)> = {
|
||||||
|
} else {
|
||||||
|
@:const gridEvents: VxeGridListeners = {
|
||||||
|
}
|
||||||
|
//行单击事件
|
||||||
|
async cellClick({ row, column }) {
|
||||||
|
listClick(row,column);
|
||||||
|
},
|
||||||
|
// 只对 pager-config 配置时有效,分页发生改变时会触发该事件
|
||||||
|
async pageChange({ pageSize }) {
|
||||||
|
state.localPageParam.pageSize = pageSize;
|
||||||
|
Local.set(localPageParamKey, state.localPageParam);
|
||||||
|
},
|
||||||
|
// 当排序条件发生变化时会触发该事件
|
||||||
|
async sortChange({ field, order }) {
|
||||||
|
state.localPageParam.defaultSort = { field: field, order: order!, descStr: 'desc' };
|
||||||
|
Local.set(localPageParamKey, state.localPageParam);
|
||||||
|
},
|
||||||
|
async proxyQuery() {
|
||||||
|
state.treeData = xGrid.value?.getTableData().tableData ?? [];
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
@foreach (var column in Model.QueryWhetherList) {
|
||||||
|
@if(@column.EffectType == "ForeignKey") {
|
||||||
|
@:const @LowerFirstLetter(@column.FkEntityName)@(@column.PropertyName)DropdownList = ref<any>([]);
|
||||||
|
@:const get@(@column.FkEntityName)@(@column.PropertyName)DropdownList = async () => {
|
||||||
|
@if (@Model.IsApiService) {
|
||||||
|
@:let list = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)@(@column.FkEntityName)@(@column.PropertyName)DropdownGet();
|
||||||
|
} else {
|
||||||
|
@:let list = await get@(@column.FkEntityName)@(@column.PropertyName)Dropdown();
|
||||||
|
}
|
||||||
|
@:@LowerFirstLetter(@column.FkEntityName)@(@column.PropertyName)DropdownList.value = list.data.result ?? [];
|
||||||
|
@:};
|
||||||
|
@:get@(@column.FkEntityName)@(@column.PropertyName)DropdownList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@foreach (var column in Model.QueryWhetherList) {
|
||||||
|
@if(@column.EffectType == "ApiTreeSelector") {
|
||||||
|
@:const @LowerFirstLetter(@column.FkEntityName)TreeData = ref<any>([]);
|
||||||
|
@:const get@(@column.FkEntityName)TreeData = async () => {
|
||||||
|
@if (@Model.IsApiService) {
|
||||||
|
@:let list = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)@(@column.FkEntityName)Tree();
|
||||||
|
} else {
|
||||||
|
@:let list = await get@(@column.FkEntityName)Tree();
|
||||||
|
}
|
||||||
|
@:@LowerFirstLetter(@column.FkEntityName)TreeData.value = list.data.result ?? [];
|
||||||
|
@:};
|
||||||
|
@:get@(@column.FkEntityName)TreeData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 全部展开
|
||||||
|
const handleExpand = () => {
|
||||||
|
xGrid.value?.setAllTreeExpand(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 全部折叠
|
||||||
|
const handleFold = () => {
|
||||||
|
xGrid.value?.clearTreeExpand();
|
||||||
|
};
|
||||||
|
// 与父组件的交互逻辑
|
||||||
|
const emits = defineEmits(['list-click']);
|
||||||
|
const listClick = (row: any,column:any) => {
|
||||||
|
emits('list-click', row,column);
|
||||||
|
};
|
||||||
|
// 将属性或者函数暴露给父组件
|
||||||
|
defineExpose({ listhandleQuery });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-input),
|
||||||
|
:deep(.el-select),
|
||||||
|
:deep(.el-input-number) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
:deep(.el-slider .el-input-number){
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -73,6 +73,11 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
|
<el-form-item label="表类型" prop="busName" :rules="[{ required: true, message: '表类型不能为空', trigger: 'blur' }]">
|
||||||
|
<g-sys-dict v-model="state.ruleForm.tabType" code="code_gen_tab_type" render-as="select" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="业务名" prop="busName" :rules="[{ required: true, message: '业务名不能为空', trigger: 'blur' }]">
|
<el-form-item label="业务名" prop="busName" :rules="[{ required: true, message: '业务名不能为空', trigger: 'blur' }]">
|
||||||
<el-input v-model="state.ruleForm.busName" placeholder="请输入" clearable />
|
<el-input v-model="state.ruleForm.busName" placeholder="请输入" clearable />
|
||||||
@ -93,6 +98,25 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
|
<el-form-item label="树key字段" prop="treeKey">
|
||||||
|
<template v-slot:label>
|
||||||
|
<div>
|
||||||
|
PidKey字段
|
||||||
|
<el-tooltip raw-content content="本表作为树控件的树属性父ID,PidKey字段字段,没有就请留空。" placement="top">
|
||||||
|
<el-icon size="16"
|
||||||
|
style="margin-right: 3px; display: inline; vertical-align: middle"><ele-QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-select v-model="state.ruleForm.treeKey" @change="treeKeyChanged" value-key="value"
|
||||||
|
filterable clearable class="w100">
|
||||||
|
<el-option v-for="item in state.columnData" :key="item.columnName"
|
||||||
|
:label="item.columnName + ' ( ' + item.columnName + ' ) [' + item.columnComment + ']'"
|
||||||
|
:value="item" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="生成菜单" prop="generateMenu">
|
<el-form-item label="生成菜单" prop="generateMenu">
|
||||||
<el-radio-group v-model="state.ruleForm.generateMenu">
|
<el-radio-group v-model="state.ruleForm.generateMenu">
|
||||||
@ -472,10 +496,17 @@ const tableChanged = (item: any) => {
|
|||||||
state.ruleForm.tableUniqueList = [];
|
state.ruleForm.tableUniqueList = [];
|
||||||
getColumnInfoList(item);
|
getColumnInfoList(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const tabTypeChanged = async (item: any) => {
|
||||||
|
state.ruleForm.tabType = item;
|
||||||
|
}
|
||||||
const treeNameChanged = (item: any) => {
|
const treeNameChanged = (item: any) => {
|
||||||
state.ruleForm.treeName = item.columnName;
|
state.ruleForm.treeName = item.columnName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const treeKeyChanged = (item: any) => {
|
||||||
|
state.ruleForm.treeKey = item.columnName;
|
||||||
|
};
|
||||||
const leftTableChanged = (item: any) => {
|
const leftTableChanged = (item: any) => {
|
||||||
state.ruleForm.leftTab = item.entityName;
|
state.ruleForm.leftTab = item.entityName;
|
||||||
console.log('leftTableChanged--', JSON.stringify(item));
|
console.log('leftTableChanged--', JSON.stringify(item));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user