feat: 扩展rest-bean能力,支持提供表格,表格前端支持状态切换

This commit is contained in:
wangyu 2021-03-25 23:32:10 +08:00
parent 39caf44231
commit eb5a7b5fb9
7 changed files with 168 additions and 20 deletions

View File

@ -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
View 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>

View File

@ -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>> {
}

View File

@ -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;
}
}

View File

@ -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> {
}

View File

@ -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> {
}

View File

@ -44,6 +44,7 @@
<module>flyfish-file</module>
<module>flyfish-logging</module>
<module>flyfish-dict</module>
<module>flyfish-form</module>
</modules>
<repositories>