feat: 扩展rest-bean能力,支持提供表格,表格前端支持状态切换
This commit is contained in:
parent
39caf44231
commit
eb5a7b5fb9
@ -1,20 +0,0 @@
|
||||
package com.flyfish.framework.domain.po;
|
||||
|
||||
import com.flyfish.framework.domain.base.Domain;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
/**
|
||||
* 在线表单
|
||||
*/
|
||||
@Document("online-forms")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OnlineForm extends Domain {
|
||||
|
||||
// 配置信息
|
||||
private String form;
|
||||
|
||||
|
||||
}
|
32
flyfish-form/pom.xml
Normal file
32
flyfish-form/pom.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>flyfish-framework</artifactId>
|
||||
<groupId>com.flyfish.framework</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>flyfish-form</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.flyfish.framework</groupId>
|
||||
<artifactId>flyfish-data</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.flyfish.framework</groupId>
|
||||
<artifactId>flyfish-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,17 @@
|
||||
package com.flyfish.framework.form.controller;
|
||||
|
||||
import com.flyfish.framework.controller.BaseController;
|
||||
import com.flyfish.framework.domain.base.NameLikeQo;
|
||||
import com.flyfish.framework.form.domain.OnlineForm;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 在线表单接口
|
||||
*
|
||||
* @author wangyu
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("online-forms")
|
||||
public class OnlineFormController extends BaseController<OnlineForm, NameLikeQo<OnlineForm>> {
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.flyfish.framework.form.domain;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.flyfish.framework.domain.base.Domain;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.data.mongodb.core.index.CompoundIndex;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 在线表单
|
||||
*/
|
||||
@Document("online-forms")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@CompoundIndex(name = "uniq_code", def = "{code: 1}", unique = true)
|
||||
public class OnlineForm extends Domain {
|
||||
|
||||
// 表单描述
|
||||
private String description;
|
||||
|
||||
// 表单配置
|
||||
private List<FormItem> form = new ArrayList<>();
|
||||
|
||||
// 分组们,包含标识和名称
|
||||
private List<FormGroup> groups = new ArrayList<>();
|
||||
|
||||
// 表单样式,支持default, tabs, step
|
||||
private String type = "default";
|
||||
|
||||
// 宽度
|
||||
private Integer width;
|
||||
|
||||
// 默认布局
|
||||
private JSONObject layout = new JSONObject();
|
||||
|
||||
@Data
|
||||
public static class FormItem {
|
||||
|
||||
// 表单编码,存储数据的key
|
||||
private String code;
|
||||
// 显示名称,这个名称是输入框的label
|
||||
private String title = "";
|
||||
// 组件,标识使用的组件
|
||||
private String component;
|
||||
// 占据栅格,用于表单布局
|
||||
private Integer span = 12;
|
||||
// 栅格偏移,布局需要
|
||||
private Integer offset = 0;
|
||||
// 栅格布局
|
||||
private JSONObject grid = new JSONObject();
|
||||
// 儿子,手动指定儿子们
|
||||
private String children;
|
||||
// 条件,用于匹配条件以显示与否
|
||||
private JSONObject condition;
|
||||
// 校验规则,允许多个
|
||||
private List<JSONObject> validation;
|
||||
// 选项,用于表单的额外选项,支持antd vue的所有逻辑
|
||||
private JSONObject options = new JSONObject();
|
||||
// 组件属性,支持对象
|
||||
private JSONObject props;
|
||||
// 表单联动,key为表单组件的属性,包含两种模式,condition是激活条件,value是激活的值
|
||||
private JSONObject links;
|
||||
// 事件支持
|
||||
private JSONObject events;
|
||||
// 映射支持
|
||||
private JSONObject mapping;
|
||||
// 异步的props
|
||||
private JSONObject delay;
|
||||
// 分组
|
||||
private String group;
|
||||
// 新增,增加反馈状态
|
||||
private Boolean feedback = false;
|
||||
// 新增,增加额外描述
|
||||
private String extra;
|
||||
// 新增,额外的复杂帮助,在tooltip弹出
|
||||
private String tips;
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单分组
|
||||
*/
|
||||
@Data
|
||||
public static class FormGroup {
|
||||
|
||||
// 分组名称
|
||||
private String name;
|
||||
|
||||
// 分组code
|
||||
private String code;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.flyfish.framework.form.repository;
|
||||
|
||||
import com.flyfish.framework.form.domain.OnlineForm;
|
||||
import com.flyfish.framework.repository.DefaultRepository;
|
||||
|
||||
/**
|
||||
* 在线表单
|
||||
*/
|
||||
public interface OnlineFormRepository extends DefaultRepository<OnlineForm> {
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.flyfish.framework.form.service;
|
||||
|
||||
import com.flyfish.framework.form.domain.OnlineForm;
|
||||
import com.flyfish.framework.service.impl.BaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 在线表单服务
|
||||
* @author wangyu
|
||||
*/
|
||||
@Service
|
||||
public class OnlineFormService extends BaseServiceImpl<OnlineForm> {
|
||||
}
|
Loading…
Reference in New Issue
Block a user