Skip to content

Commit

Permalink
feat: 代码生成增加了 TREE_SELECT/CHECK_GROUP/INPUT_NUMBER/INPUT_PASSWORD控件
Browse files Browse the repository at this point in the history
  • Loading branch information
javacares authored and Charles7c committed May 23, 2024
1 parent 2fb4001 commit 8632b22
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,26 @@ public enum FormTypeEnum implements IBaseEnum<Integer> {
* 日期时间框
*/
DATE_TIME(6, "日期时间框"),;

/**
* 树形选择
*/
TREE_SELECT(7, "树选择"),
/**
* 复选框
*/
CHECK_GROUP(8, "复选框"),
/**
* 数字输入框
*/
INPUT_NUMBER(9, "数字输入框"),
/**
* 密码输入框
*/
INPUT_PASSWORD(10, "密码输入框"),
/**
* 开关
*/
SWITCH(11, "开关"),;
private final Integer value;
private final String description;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<div class="table-page">
<GiTable
ref="tableRef"
row-key="id"
title="${businessName}管理"
:data="dataList"
Expand All @@ -16,9 +15,37 @@
<template #custom-left>
<#list fieldConfigs as fieldConfig>
<#if fieldConfig.showInQuery>
<a-input v-model="queryForm.${fieldConfig.fieldName}" placeholder="请输入${fieldConfig.comment}" allow-clear @change="search">
<template #prefix><icon-search /></template>
</a-input>
<#if fieldConfig.formType == "SELECT"><#-- 下拉框 -->
<a-select
v-model="queryForm.${fieldConfig.fieldName}"
:options="${fieldConfig.columnName}_enum"
placeholder="请选择${fieldConfig.comment}"
allow-clear
style="width: 150px"
@change="search"
/>
<#elseif fieldConfig.formType == "RADIO"><#-- 单选框 -->
<a-radio-group v-model="queryForm.${fieldConfig.fieldName}" :options="${fieldConfig.columnName}_enum" @change="search"/>
<#elseif fieldConfig.formType == "DATE"><#-- 日期框 -->
<a-date-picker
v-model="queryForm.${fieldConfig.fieldName}"
placeholder="请选择${fieldConfig.comment}"
format="YYYY-MM-DD"
style="width: 100%"
/>
<#elseif fieldConfig.formType == "DATE_TIME"><#-- 日期时间框 -->
<a-date-picker
v-model="queryForm.${fieldConfig.fieldName}"
placeholder="请选择${fieldConfig.comment}"
show-time
format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
/>
<#else>
<a-input v-model="queryForm.${fieldConfig.fieldName}" placeholder="请输入${fieldConfig.comment}" allow-clear @change="search">
<template #prefix><icon-search /></template>
</a-input>
</#if>
</#if>
</#list>
<a-button @click="reset">重置</a-button>
Expand Down Expand Up @@ -67,6 +94,7 @@ import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useDownload, useTable } from '@/hooks'
import { isMobile } from '@/utils'
import has from '@/utils/has'
import { useDict } from '@/hooks/app'
defineOptions({ name: '${classNamePrefix}' })
Expand All @@ -79,6 +107,14 @@ const queryForm = reactive<${classNamePrefix}Query>({
sort: ['createTime,desc']
})
<#list fieldConfigs as fieldConfig>
<#if fieldConfig.showInQuery>
<#if fieldConfig.formType == "SELECT" || fieldConfig.formType == "RADIO">
const { ${fieldConfig.columnName}_enum } = useDict('${fieldConfig.columnName}_enum')
</#if>
</#if>
</#list>
const {
tableData: dataList,
loading,
Expand All @@ -91,7 +127,7 @@ const columns: TableInstanceColumns[] = [
<#if fieldConfigs??>
<#list fieldConfigs as fieldConfig>
<#if fieldConfig.showInList>
{ title: '${fieldConfig.comment}', dataIndex: '${fieldConfig.fieldName}', slotName: ${fieldConfig.fieldName} },
{ title: '${fieldConfig.comment}', dataIndex: '${fieldConfig.fieldName}', slotName: '${fieldConfig.fieldName}' },
</#if>
</#list>
</#if>
Expand Down

0 comments on commit 8632b22

Please sign in to comment.