BUG:查询业面没有生成ApiTree输入框的查询条件

This commit is contained in:
yzp 2024-12-18 16:04:50 +08:00
parent 4b9809a323
commit f874ff817b
2 changed files with 52 additions and 10 deletions

View File

@ -29,7 +29,7 @@ public class TestCodeGenDemo : EntityBase
/// 数值
/// </summary>
[SugarColumn(ColumnDescription = "数值")]
public int Age { get; set; }
public int? Age { get; set; }
/// <summary>
/// 时间选择
@ -41,41 +41,47 @@ public class TestCodeGenDemo : EntityBase
/// 开关
/// </summary>
[SugarColumn(ColumnDescription = "开关")]
public bool IsOk { get; set; }
public bool? IsOk { get; set; }
/// <summary>
/// 外键(sys_user)
/// </summary>
[SugarColumn(ColumnDescription = "外键(sys_user)")]
public long UserId { get; set; }
public long? UserId { get; set; }
/// <summary>
/// 树选择框(sys_org)
/// 树选择框1(sys_org)
/// </summary>
[SugarColumn(ColumnDescription = "树选择框(sys_org)")]
public long OrgId { get; set; }
[SugarColumn(ColumnDescription = "树选择框1(sys_org)")]
public long? OrgId { get; set; }
/// <summary>
/// 树选择框2(sys_menu)
/// </summary>
[SugarColumn(ColumnDescription = "树选择框2(sys_menu)")]
public long? MenuId { get; set; }
/// <summary>
/// 字典1
/// </summary>
[SugarColumn(ColumnDescription = "字典1")]
public string Dict1 { get; set; }
public string? Dict1 { get; set; }
/// <summary>
/// 枚举1
/// </summary>
[SugarColumn(ColumnDescription = "枚举1")]
public string Enum1 { get; set; }
public int? Enum1 { get; set; }
/// <summary>
/// 常量1
/// </summary>
[SugarColumn(ColumnDescription = "常量1")]
public int Const1 { get; set; }
public int? Const1 { get; set; }
/// <summary>
/// 上传控件
/// </summary>
[SugarColumn(ColumnDescription = "上传控件")]
public long UploadImage { get; set; }
public string? UploadImage { get; set; }
}

View File

@ -64,6 +64,24 @@
<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">
@ -225,6 +243,9 @@ 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)';
}
}
}
@ -468,6 +489,21 @@ const handleDelete = (row: any) => {
@: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();
}
}
</script>
<style lang="scss" scoped>