动态表单 基础功能完成
parent
42b8443073
commit
0d7e773a49
@ -0,0 +1,29 @@
|
|||||||
|
package cn.estsh.i3plus.pojo.model.dynamic.table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Adair Peng
|
||||||
|
* @CreateDate : 2018-12-11 15:37
|
||||||
|
* @Modify:
|
||||||
|
* 动态 Table 单元格
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class DynTableCell {
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
private Integer cellSeq;
|
||||||
|
// 单元格名称
|
||||||
|
private String cellName;
|
||||||
|
// 单元格名称英文
|
||||||
|
private String cellNameEn;
|
||||||
|
// 单元格数据
|
||||||
|
private Object cellValue;
|
||||||
|
// 单元格数据
|
||||||
|
private Integer cellValueType;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package cn.estsh.i3plus.pojo.model.dynamic.table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Adair Peng
|
||||||
|
* @CreateDate : 2018-12-11 16:43
|
||||||
|
* @Modify:
|
||||||
|
* 动态表单 工具类
|
||||||
|
**/
|
||||||
|
public class DynTablePackTool {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 Table 空行对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DynTableRow getTableRow(){
|
||||||
|
return new DynTableRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 Table 空行对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DynTableRow getTableRow(String rowKey){
|
||||||
|
DynTableRow row = getTableRow();
|
||||||
|
row.setKey(rowKey);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DynTableRow getDynTableRow(ImppDynTable table, String key){
|
||||||
|
if(table != null && key != null){
|
||||||
|
return table.getTable().get(key);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单 中添加行数据
|
||||||
|
* @param table
|
||||||
|
* @param row
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DynTableRow putDynTableRow(ImppDynTable table,DynTableRow row){
|
||||||
|
return table.getTable().put(row.getKey(),row);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建单元格
|
||||||
|
* @param seq
|
||||||
|
* @param name
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DynTableCell getTableCell(Integer seq,String name,Object value) {
|
||||||
|
return getTableCell(seq, name, null, value,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DynTableCell getTableCell(Integer seq,String name,Object value,Integer valueType) {
|
||||||
|
return getTableCell(seq, name, null, value,valueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个单元格
|
||||||
|
* @param seq 单元格排序
|
||||||
|
* @param name 单元格名称
|
||||||
|
* @param nameEn 单元格名称En
|
||||||
|
* @param value 单元格数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DynTableCell getTableCell(Integer seq,String name,String nameEn,Object value,Integer valueType){
|
||||||
|
DynTableCell cell = new DynTableCell();
|
||||||
|
cell.setCellSeq(seq);
|
||||||
|
cell.setCellName(name);
|
||||||
|
cell.setCellNameEn(nameEn);
|
||||||
|
cell.setCellValue(value);
|
||||||
|
cell.setCellValueType(valueType);
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package cn.estsh.i3plus.pojo.model.dynamic.table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Adair Peng
|
||||||
|
* @CreateDate : 2018-12-11 15:37
|
||||||
|
* @Modify:
|
||||||
|
* 动态Table Row
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class DynTableRow {
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
// 行号
|
||||||
|
private Integer index = 0;
|
||||||
|
|
||||||
|
// 行Size
|
||||||
|
private Integer cellSize = 0;
|
||||||
|
|
||||||
|
// 行数据
|
||||||
|
private List<DynTableCell> cellList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
public DynTableRow addList(DynTableCell cell){
|
||||||
|
this.cellList.add(cell);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCellSize() {
|
||||||
|
return cellList != null ? cellList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁止外部给 Size 赋值
|
||||||
|
* @param cellSize
|
||||||
|
*/
|
||||||
|
private void setCellSize(Integer cellSize) { }
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package cn.estsh.i3plus.pojo.model.dynamic.table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Adair Peng
|
||||||
|
* @CreateDate : 2018-12-11 15:37
|
||||||
|
* @Modify:
|
||||||
|
* 动态Table Row
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class ImppDynTable {
|
||||||
|
|
||||||
|
// 行数据
|
||||||
|
private Map<String,DynTableRow> table = new HashMap<>();
|
||||||
|
|
||||||
|
// 表单标题
|
||||||
|
private String tableTitle;
|
||||||
|
|
||||||
|
public ImppDynTable() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImppDynTable(String tableTitle) {
|
||||||
|
this.tableTitle = tableTitle;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue