初始版本提交

This commit is contained in:
yaoyn
2024-02-05 09:15:37 +08:00
parent b52d4414be
commit 445292105f
1848 changed files with 236859 additions and 75 deletions

View File

@ -0,0 +1,91 @@
/**
* 手机端表单props
*/
export interface AppFormProps {
rules: Object; //校验规则
validateTrigger: string; //各组件配置
labelPosition: string; //label 位置 top/left
labelWidth: number; //label 宽度,单位 px 75
labelAlign: string; //label 居中方式 left/center/right
errShowType: string; //表单错误信息提示方式 undertext/toast/modal
border: boolean; //是否显示分格线
schemas: AppFormSchema[]; //组件模板
}
/**
* 手机端组件配置模板
*/
export interface AppFormSchema {
key: string; //唯一标识 用于处理某些无字段组件
name: string; //表单域的属性名,在使用校验规则时必填
field?: string; //字段名
label?: string; //输入框左边的文字提示
component?: AppComponentType; //组件类型
labelWidth?: number; //label 宽度,单位 px
labelAlign?: string; //label 居中方式
rules?: {
required: boolean;
errorMessage: string;
}[]; //表单校验规则
required?: boolean; //label 右边显示红色"*"号,样式显示不会对校验规则产生效果
defaultValue?: any; //默认值
events?: {
[key: string]: string;
};
componentProps?: any; //组件的所有配置信息
layout?: any[]; //tab 等组件特有
columns?: AppFormSchema[]; //子表单组件特有
preloadType?: string; //子表单预加载类型
itemId?: string; //子表单预加载数据字典
apiConfig?: any; //子表单预加载api
associateOptions?: any; //子表单按钮选数据数据选择的配置
useSelectButton?: boolean; //子表单是否按钮选数据
buttonName?: string; //子表单 按钮选数据按钮名称
url?: string;
}
export enum AppComponentType {
input = 'Input',
inputNumber = 'InputNumber',
picker = 'Picker',
associatePicker = 'AssociatePicker',
select = 'Select',
checkbox = 'Checkbox',
radio = 'Radio',
switch = 'Switch',
date = 'Date',
dateTime = 'DateTime',
dateRange = 'DateRange',
dateTimeRange = 'DateTimeRange',
collapse = 'Collapse',
tab = 'Tab',
segmented = 'Segmented',
divider = 'Divider',
subForm = 'SubForm',
singleForm = 'SingleForm',
autoCode = 'AutoCode',
editor = 'Editor',
cascader = 'Cascader',
slider = 'Slider',
timeRange = 'TimeRange',
rate = 'Rate',
image = 'Image',
color = 'colorPicker',
qrcode = 'QRcode',
title = 'Title',
map = 'SelectMap',
upload = 'FileUpload',
opinion = 'Opinion',
organization = 'Organization',
user = 'User',
computation = 'Computation',
moneyChinese = 'MoneyChinese',
associatePopup = 'AssociatePopup',
multiplePopup = 'MultiplePopup',
info = 'Info',
button = 'CustomButton',
tableLayout = 'TableLayout',
text = 'Text',
formView = 'FormView',
iframe = 'Iframe',
}

View File

@ -0,0 +1,290 @@
import { ColEx } from '/@/components/TableForm/src/types';
import { ButtonLocation, FormSchema, Rule } from '/@/components/Form';
import { HiddenComponentInfo } from '/@/components/Designer/src/types/index';
/**
* 表单设计器 返回类型
*/
export interface FormJson {
//表单总体配置
config: FormOptionModel;
//各组件配置
list: ComponentOptionModel[];
hiddenComponent: HiddenComponentInfo[];
}
export interface GeneratorFormSchema extends FormSchema {
key: string;
group: string;
name: string;
icon: string;
}
/**
* 组件通用配置 实体模型
*/
export interface ComponentOptionModel {
//key 唯一
key: string;
//field name
bindField: string;
//table name
bindTable: string;
//名称
label: string;
//图标
rules?: Rule[];
//类型
type: string;
//各组件 特殊配置信息 具体配置信息
options?: ComponentConfigModel;
//栅格布局的子节点 栅格布局特有
layout?: LayoutOptionModel[];
//子表单子节点 子表单特有
children?: ComponentOptionModel[];
//range特有
bindStartTime?: string;
bindEndTime?: string;
//隐藏组件特有
code?: string; //编码
value?: string; //值
//界面优先-结构配置 字段备注展示
typeName?: string; //类型的中文名称
//是否是子表组件
isSubFormChild?: boolean;
//是否是单表组件
isSingleFormChild?: boolean;
}
/**
* 表单整体配置 实体模型
*/
export interface FormOptionModel {
//是否需要隐藏 必填标记
hideRequiredMark?: boolean;
//表单尺寸
size?: 'default' | 'small' | 'large';
//对齐方式
layout?: 'vertical' | 'inline' | 'horizontal';
//label配置
labelCol?: Partial<ColEx>;
//对齐方式
labelAlign?: 'left' | 'right';
//按钮位置
buttonLocation?: ButtonLocation;
//表单形式
formType?: 'modal' | 'drawer';
//表单宽度
formWidth?: number;
}
/**
* 组件具体配置 实体模型
*/
export interface ComponentConfigModel {
//绑定表
table: string;
//绑定字段
field: string;
//宽度
width?: string;
// 占位符
placeholder?: string;
// 栅格布局占多少列
col?: number;
//是否只读
readonly?: boolean;
//是否启用
disabled?: boolean;
//是否需要label
isLabel?: boolean;
showLabel?: boolean;
//label
labelWidth?: number;
//子表单 表格列宽
columnWidth?: number;
//默认值
defaultValue?: any;
//是否必填
required?: boolean;
//是否能够清空
allowClear: boolean;
//自定义验证 正则
rules?: Rule[];
//事件配置
events: any;
//下拉框模式(下拉框框特有) 'default' | 'multiple' | 'tags' | 'combobox'
mode?: string;
//是否为远程组件(下拉,单选,多选等组件)
remote?: boolean;
//如果是远程组件,代表远程类型
datasourceType: 'staticData' | 'dic' | 'datasource' | 'api';
//静态数据默认选择
defaultSelect?: string | number;
//datasourceType 是 dic 数据字典项目code
itemId: string;
//datasourceType 是datasrouce 存入数据源Id
sourceId: string;
//选项 (下拉,单选,多选等组件)
staticOptions?: any[];
// 请求地址 (下拉,单选,多选等组件)
api?: string;
//api配置信息下拉单选多选等组件
apiConfig: any;
//数据字典配置信息(下拉,单选,多选等组件)
dicOptions: Array<any>;
//返回值数据字段 (下拉,单选,多选等组件)
resultField?: string;
//显示字段 (下拉,单选,多选等组件)
labelField?: string;
//保存字段 (下拉,单选,多选等组件)
valueField?: string;
//子字段(树下拉,级联等)
childrenField?: string;
//最大输入
maxLength?: number;
//是否可以半选(评分特有)
allowHalf?: boolean;
//最大值(数字框特有)
max?: number;
//最小值(数字框特有)
min?: number;
//数值精度(数字框特有)
precision: number;
//小数点(数字框特有)
decimalSeparator: string;
//最大行 (多行文本框特有)
maxRow?: number;
//是否自适应高度(多行文本特有)
autoSize: boolean;
// // 是否显示字数(多行文本特有)
// showCount: boolean;
//步长(数字框特有)
step?: number;
//前缀input特有
addonBefore?: string;
//后缀input特有
addonAfter?: string;
//前缀图标input特有
prefix?: string;
//后缀图标input特有
suffix?: string;
//分割线文字位置 (分割线特有)
orientation?: string;
//tab页签位置tab特有
tabPosition?: string;
//tab大小 tab独有
tabSize: string;
//card布局特有
title?: string;
//时间组件特有
format?: string;
showTime?: boolean;
//编码规则(编码组件特有)
autoCodeRule: string;
//上间距(分割线特有)
marginTop: number;
//下间距(分割线特有)
marginBottom: number;
//开始占位(时间范围组件特有)
startTimePlaceholder: string;
//结束占位(时间范围组件特有)
endTimePlaceholder: string;
//按钮高度(按钮组件特有)
buttonHeight: string;
//按钮宽度(按钮组件特有)
buttonWidth: string;
//选项卡风格(选项卡组件特有)
type: string;
//信息体类型(信息体组件特有)
infoType: number;
//预加载数据源类型(表格组件特有)
preloadType: string;
//是否选择按钮选数据(表格组件特有)
useSelectButton: boolean;
//选数据按钮名称(表格组件特有)
buttonName: string;
span?: string | number;
maxlength?: string | number;
controls?: boolean;
subTotal?: boolean;
//预加载数据绑定字段(表格组件特有)
prestrainField?: string;
//单行文本不存表
isSave?: boolean;
//是否显示
isShow?: boolean;
url?: string;
}
/**
* 栅格布局 实体模型
*/
export interface LayoutOptionModel {
name?: string;
span: number;
list: ComponentOptionModel[];
}
/**
* 前端代码模型
*/
export interface FrontCodeModel {
listCode: string; // 列表代码
formCode: string; //表单代码
apiCode: string; //请求代码
modelCode?: string; //模型代码
configJsonCode: string; //配置json模型代码
workflowPermissionCode: string; //配置工作流权限数据
simpleFormCode: string; //simpleForm页面
}
/**
* 展示代码模型
*/
export interface ShowFrontCodeModel extends FrontCodeModel {
controllerCode?: string; //控制器代码
entityCode?: object; //实体类代码
}
//表单尺寸
export enum FormSizeEnum {
FULL,
BIG,
MEDIUM,
SMALL,
}
export enum AlignTypeEnum {
LEFT,
RIGHT,
CENTER,
}

View File

@ -0,0 +1,38 @@
/**
* 表单事件
*/
export interface FormEventStyleConfig {
color?: string;
icon?: string;
text?: string;
detail?: string;
type?: string;
bgcColor?: string;
lineHeight?: string;
isLast?: boolean;
isUserDefined: boolean;
isClick?: boolean;
nodeInfo?: nodeInfoConfig;
}
export interface FormEventColumnConfig {
0: FormEventStyleConfig[];
1: FormEventStyleConfig[];
2: FormEventStyleConfig[];
3: FormEventStyleConfig[];
4: FormEventStyleConfig[];
}
export interface selectedNodeConfig {
columnIndex: number;
index: number;
}
export interface nodeInfoConfig {
processEvent?: processEventConfig[];
}
export interface processEventConfig {
operateConfig: any;
operateType: string;
}

View File

@ -0,0 +1,82 @@
import { FormJson } from './codeGenerator';
import { ListConfig } from './listConfig';
import { MenuConfig } from './menuConfig';
import { OutputConfig } from './outputConfig';
import { TableConfig } from './tableConfig';
import { TableStructureConfig } from './tableStructureConfig';
import { FormEventColumnConfig } from './formEventConfig';
import { FormTypeEnum } from '/@/enums/formtypeEnum';
/**
* 表单设计器 代码优先/界面优先
*/
export interface GeneratorConfig {
//数据库id
databaseId: string | null;
//数据表配置
tableConfigs?: TableConfig[];
//表单配置
formJson: FormJson;
//列表页面配置
listConfig: ListConfig;
//输出配置
outputConfig: OutputConfig;
//菜单配置
menuConfig?: MenuConfig;
//表结构配置
tableStructureConfigs?: TableStructureConfig[];
//表单事件配置
formEventConfig: FormEventColumnConfig;
//是否开启数据权限(自定义表单)
isDataAuth?: boolean;
//数据权限选择(自定义表单)
dataAuthList?: string[] | number[];
//表单分类id
categoryId?: string;
//代码模板名称
name?: string;
formId?: string;
}
/**
* 自定义表单 配置项
*/
export interface CustomFormConfig {
name: string;
category: string; //分类
formDesignType: number; // 0-数据优先 1-界面优先 2-简易模板
formType: FormTypeEnum; //表单类型
remark: string;
formJson: CustomFormJson;
isChange?: boolean; //是否是编辑状态
}
export interface CustomFormJson {
//数据库id
databaseId: string;
//数据表配置
tableConfigs?: TableConfig[];
//表单配置
formJson: FormJson;
//表结构配置
tableStructureConfigs?: TableStructureConfig[];
//表单事件配置
formEventConfig?: FormEventColumnConfig;
//是否开启数据权限
isDataAuth: boolean;
//数据权限选择
dataAuthList: string[] | number[];
}
/**
* 表单发布
*/
export interface FormReleaseConfig {
//表单id
formId: string;
//列表配置
listConfig?: ListConfig;
//菜单配置
menuConfig: MenuConfig;
}

View File

@ -0,0 +1,137 @@
/**
* 列表配置
*/
export interface ListConfig {
//是否有左侧菜单
isLeftMenu: boolean;
//是否分页
isPage: boolean;
//分页 每页显示条数
pageSize?: number;
//左侧菜单配置
leftMenuConfig?: LeftMenuConfig;
//查询配置
queryConfigs: QueryConfig[];
//列表配置
columnConfigs: ColumnConfig[];
//按钮配置
buttonConfigs: ButtonConfig[];
// //合计配置
// totalConfigs?: TotalConfig[];
//列表标题
listTitle?: string;
//是否默认排序
defaultOrder?: boolean;
//排序字段
orderBy?: string;
//排序类型 (默认 倒叙)
orderType?: 'desc' | 'asc';
}
/**
* 左侧菜单配置
*/
export interface LeftMenuConfig {
//左侧菜单是否树结构
// isTree: boolean;
//左侧菜单宽度 分为 按照 1/3 | 1/4 | 1/5
leftWidth?: 1 | 2 | 3;
//如果不是数据字典 就是数据源
datasourceType: string; //dic | datasource | api
//如果是静态数据 则需要静态数据列表
staticData?: Array<any>;
//如果是数据源 就需要有数据源id
datasourceId?: string;
//如果是数据源 则需要配置 数据字段名 与parentFiledName 搭配拼接树结构)
fieldName?: string;
//如果是数据源 则需要配置 父级字段名 与fieldName 搭配拼接树结构)
parentFiledName?: string;
// 显示字段
showFieldName?: string;
//如果是数据源 需要 关联字段 关联 列表关联字段
relationFieldName?: string;
//列表关联字段
listFieldName?: string;
//数据项Id 用户查询数据字典详情
dictionaryItemId?: string;
//如果是api 则需要api配置
apiConfig?: any;
//菜单显示名称
menuName?: string;
//父级菜单图标
parentIcon?: string;
//子级菜单图标
childIcon?: string;
}
/**
* 查询配置
*/
export interface QueryConfig {
//查询字段
fieldName: string;
//查询框所占宽度
width?: number;
//是否时间字段
isDate: boolean;
//时间选择和日期选择需要
format?: string;
}
/**
* 列表配置
*/
export interface ColumnConfig {
//组件唯一标识
key?: string;
//显示名
label?: string;
//列名
columnName: string;
//对齐
alignType?: string;
//宽度
columnWidth?: string;
//自适应
autoWidth?: boolean;
//是否合计
isTotal?: boolean;
//是否是数字类型
isNumber?: boolean;
//组件类型
componentType?: string;
//时间选择、日期选择、时间范围、日期范围需要
format?: string;
//组件配置
componentProps?: any;
//手机端是否显示标签
showLabel?: boolean;
//手机端是否主字段当主字段启用时该字段的标签和内容的字体大小增加2px然后字体加粗
mainField?: boolean;
//是否列头筛选
isFilter?: boolean;
}
/**
* 按钮配置
*/
export interface ButtonConfig {
//是否启用
isUse: boolean;
//按钮名
name: string;
//编码
code: string;
//图标
icon: string;
//是否新增
isDefault: boolean;
}
/**
* 合计配置
*/
export interface TotalConfig {
//需要合计字段
fieldName: string;
}

View File

@ -0,0 +1,14 @@
export interface MenuConfig {
//编号
code: string;
//菜单名
name: string;
//父级菜单Id
parentId: string;
// 图标
icon: string;
//排序
sortCode: number;
//备注
remark: string;
}

View File

@ -0,0 +1,40 @@
/**
* 输出配置
*/
export interface OutputConfig {
//创建人
creator?: string;
//功能类名(必须英文字母开头 首字母不能使用字符以及数字)
className?: string;
//描述 注释
comment?: string;
// 输出区域(数据字典显示)
outputArea?: string;
//只生成前端源码
onlyFront?: boolean;
//只生成接口
onlyInterface?: boolean;
//是否生成移动端
isApp?: boolean;
//是否需要生成菜单
isMenu?: boolean;
//备注
remarks?: string;
//是否开启数据权限
isDataAuth?: boolean;
//数据权限选择
dataAuthList?: string[] | number[];
//代码模板类型
type?: number;
//生成接口名需要
outputValue?: string;
//手机端代码功能类型
funcType?: number;
//手机端选择要转换的表单
formObj?: {
formId: string;
formName?: string;
};
//手机端自定义表单是否开启生成代码功能
createCode?: boolean;
}

View File

@ -0,0 +1,33 @@
import { BasicFetchResult } from '/@/api/model/baseModel';
export interface PrintBasicData {
id?: string;
code: string; //编码
name: string; //名称
category: string; //类别
apiConfig: string; //api
isMenu: number; //菜单
sortCode: number; //排序
parentId: string; //上级
icon: string; //图标
remark: string; //描述
enabledMark?: number; //启用1 禁用0
content: string; // 设计器Json string
}
export type PageResult = BasicFetchResult<PrintBasicData>;
export interface SearchParams {
keyword: string;
}
export interface PrintConfigData {
apiConfig: string;
buttonCode: string;
buttonId: string;
menuId: string;
schemaId: string;
}
export interface PrintButtonRowItem {
code: string;
id: string;
name: string;
menuId: string;
}

View File

@ -0,0 +1,16 @@
/**
* 数据表配置
*/
export interface TableConfig {
[x: string]: any;
//表名
tableName: string;
//是否主表
isMain: boolean;
//主键字段
pkField?: string;
//关联字段
relationField?: string;
//关联表字段
relationTableField?: string;
}

View File

@ -0,0 +1,30 @@
export interface TableInfo {
//表名
tableName: string;
//列信息
columnInfo: ColumnInfo[];
}
export interface ColumnInfo {
//列名
columnName: string;
//列类型
columnType: ColumnType;
//列长度
columnLength: string;
//是否主键
isPrimaryKey: boolean;
//是否可空
isNullable: boolean;
}
export enum ColumnType {
//字符串
STRING,
//数字
NUMBER,
//布尔
BOOL,
//时间
DATE,
}

View File

@ -0,0 +1,34 @@
/**
* 表单设计器 代码优先/界面优先
*/
export interface TableStructureConfig {
//表的唯一标识(主要用于区分子表)
key?: string;
//表名
tableName: string;
//表注释
tableComment: string;
//是否主表
isMain: boolean;
//表的字段配置
tableFieldConfigs: TableFieldConfig[];
//数据表操作(界面优先编辑时)
operator?: number;
}
export interface TableFieldConfig {
key?: string;
//字段名称
fieldName?: string;
//字段开始名称(范围组件特有)
fieldStartName?: string;
//字段结束名称(范围组件特有)
fieldEndName?: string;
//字段长度
fieldLength: number | null;
//字段类型 0:文本 默认255 1:长文本 max 2:数字 3:小数 4:日期 5:日期时间 6:外键 7:长整数
fieldType: number;
//字段备注
fieldComment: string;
tableName?: string;
}