lip 2 lat temu
rodzic
commit
d9c76a815c
21 zmienionych plików z 2053 dodań i 406 usunięć
  1. +25
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcLtMsWorker.java
  2. +25
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcLtWorker.java
  3. +25
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcMsWorker.java
  4. +70
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcNormalWorker.java
  5. +2
    -5
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcSingleWorker.java
  6. +5
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java
  7. +64
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsDelHandler.java
  8. +88
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsLoadHandler.java
  9. +138
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java
  10. +67
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsService.java
  11. +58
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java
  12. +30
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java
  13. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java
  14. +78
    -0
      smtweb-framework/bpm/src/main/resources/static/template/default/incModel/inc_clist_ms.ftl
  15. +28
    -10
      smtweb-framework/bpm/src/main/resources/static/template/default/incModel/inc_list_table.ftl
  16. +489
    -0
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl
  17. +162
    -0
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_normal.ftl
  18. +111
    -0
      smtweb-framework/bpm/src/main/resources/static/template/default/model_list_normal.ftl
  19. +149
    -387
      smtweb-framework/bpm/src/main/resources/static/template/default/model_tree_list.ftl
  20. +433
    -0
      smtweb-framework/bpm/src/main/resources/static/template/default/model_tree_list_bak.ftl
  21. +4
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java

+ 25
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcLtMsWorker.java Wyświetl plik

@@ -0,0 +1,25 @@
package cc.smtweb.system.bpm.web.design.form.model;

import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.ModelForm;

/**
* @Author:lip
* @Date : 2022/8/28 22:57
*/
public class LcLtMsWorker extends LcMsWorker {
private final static String templateList = "model_tree_list";
private final static String templateCard = "model_card_ms";

@Override
protected String getTmplId(ModelForm bean) {
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.LIST.value))){
return templateList;
}
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.CARD.value))){
return templateCard;
}
return super.getTmplId(bean);
}
}

+ 25
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcLtWorker.java Wyświetl plik

@@ -0,0 +1,25 @@
package cc.smtweb.system.bpm.web.design.form.model;

import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.ModelForm;

/**
* @Author:lip
* @Date : 2022/8/26 10:20
*/
public class LcLtWorker extends LcNormalWorker {
private final static String templateList = "model_tree_list";
private final static String templateCard = "model_card_normal";

@Override
protected String getTmplId(ModelForm bean) {
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.LIST.value))){
return templateList;
}
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.CARD.value))){
return templateCard;
}
return super.getTmplId(bean);
}
}

+ 25
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcMsWorker.java Wyświetl plik

@@ -0,0 +1,25 @@
package cc.smtweb.system.bpm.web.design.form.model;

import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.ModelForm;

/**
* @Author:lip
* @Date : 2022/8/28 12:11
*/
public class LcMsWorker extends LcNormalWorker{
private final static String templateList = "model_list_normal";
private final static String templateCard = "model_card_ms";

@Override
protected String getTmplId(ModelForm bean) {
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.LIST.value))){
return templateList;
}
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.CARD.value))){
return templateCard;
}
return super.getTmplId(bean);
}
}

+ 70
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcNormalWorker.java Wyświetl plik

@@ -0,0 +1,70 @@
package cc.smtweb.system.bpm.web.design.form.model;

import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import org.springframework.util.Assert;

import java.util.List;

/**
* @Author:lip
* @Date : 2022/8/26 10:20
*/
public class LcNormalWorker extends BaseModelWorker {
private final static String templateList = "model_list_normal";
private final static String templateCard = "model_card_normal";

@Override
protected void saveModule(ModelForm bean, List<ModelForm> listFormChild) {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(ModelForm.class);

String baseName = ModelFormHelper.getPageName(bean);
String listName = baseName + StringUtil.upFirst(SwEnum.PageType.LIST.value);
String cardName = baseName + StringUtil.upFirst(SwEnum.PageType.CARD.value);

bean.setOption(JsonUtil.encodeString(bean.getOpts()));
ModelForm listPage;
ModelForm cardPage;
if (bean.isNew()) {
//新增
listPage = createPage(bean, SwEnum.PageType.LIST.value);
cardPage = createPage(bean, SwEnum.PageType.CARD.value);
listFormChild.add(listPage);
listFormChild.add(cardPage);
dao.batchInsertEntity(listFormChild);
} else {
//修改,先不考虑修改模型的情况 todo
listPage = ModelFormHelper.getFromCache(listName);
cardPage = ModelFormHelper.getFromCache(cardName);
Assert.isTrue(listPage != null && cardPage != null, "获取页面失败");
listFormChild.add(listPage);
listFormChild.add(cardPage);
boolean modified = false;
//服务名发生变化
if (!StringUtil.isStrEquals(listPage.getService(), bean.getService())) {
listPage.setService(bean.getService());
cardPage.setService(bean.getService());
modified = true;
}
if (modified) {
dao.batchUpdateEntity(listFormChild, "mf_content,mf_dataset,mf_tmpl");
}
}
}

@Override
protected String getTmplId(ModelForm bean) {
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.LIST.value))){
return templateList;
}
if (bean.getName().endsWith(StringUtil.upFirst(SwEnum.PageType.CARD.value))){
return templateCard;
}
return super.getTmplId(bean);
}
}

smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcSinlgeWorker.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/LcSingleWorker.java Wyświetl plik

@@ -4,20 +4,17 @@ import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormCache;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;

import java.util.List;
import java.util.Set;

/**
* Created by Akmm at 2022-08-14 12:17
*/
public class LcSinlgeWorker extends BaseModelWorker {
public class LcSingleWorker extends BaseModelWorker {
private final static String tmpl = "model_list_card";

@Override
@@ -31,7 +28,7 @@ public class LcSinlgeWorker extends BaseModelWorker {
String formName = ModelFormHelper.getPageName(bean) + StringUtil.upFirst(SwEnum.PageType.LIST.value);
cfgPage.put(SwEnum.PageType.LIST.value, formName);
bean.setOption(JsonUtil.encodeString(opts));
ModelForm page;
if (bean.isNew()) {//新增
page = createPage(bean, SwEnum.PageType.LIST.value);

+ 5
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java Wyświetl plik

@@ -2,7 +2,6 @@ package cc.smtweb.system.bpm.web.design.form.model;

import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
@@ -21,7 +20,11 @@ public class ModelFactory {
instance = new ModelFactory();
mapWorker = new HashMap<>();
mapWorker.put(SwConsts.DEF_ROOT_ID, new BaseModelWorker());
mapWorker.put(SwEnum.ModelType.LC_SINGLE.value, new LcSinlgeWorker());
mapWorker.put(SwEnum.ModelType.LC_SINGLE.value, new LcSingleWorker());
mapWorker.put(SwEnum.ModelType.LC_NORMAL.value, new LcNormalWorker());
mapWorker.put(SwEnum.ModelType.LC_LT.value, new LcLtWorker());
mapWorker.put(SwEnum.ModelType.LC_MS.value, new LcMsWorker());
mapWorker.put(SwEnum.ModelType.LC_LT_MS.value, new LcLtMsWorker());
}

public static ModelFactory getInstance() {


+ 64
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsDelHandler.java Wyświetl plik

@@ -0,0 +1,64 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.mastersub;

import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;
import org.springframework.util.Assert;

/**
* @Author:lip
* @Date : 2022/8/28 20:40
*/
public class LCMsDelHandler extends AbstractDynPageHandler {
/**
* 删除指定数据集,入参{pageId, dataset, id}
*
* @return
*/
public R del() {
long id = params.readLong("id");
if (id <= 0L) throw new BizException("没有收到待删除记录Id(" + id + ")!");
SwMap props = form.getOpts().readMap("config").readMap("props");
//主表
ModelTable masterTable = ModelTableCache.getInstance().get(props.readLong("masterTable",-1L));
Assert.notNull(masterTable,"未获取到主表配置");

//获取子表
ModelTable subTable = ModelTableCache.getInstance().get(props.readLong("subTable",-1L));
String subForeignKey = props.readString("subForeignKey","-1");
Assert.isTrue(subTable!= null && !subForeignKey.equals("-1"),"未获取到子表配置");

//
DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
DbEngine engine = DbEngine.getInstance();
EntityDao masterDao = engine.findDao(masterTable.getName());
EntityDao subDao = engine.findDao(subTable.getName());
masterDao.deleteEntity(id);
subDao.deleteEntity("where " + subForeignKey + " = ?", id);
}

@Override
public void doAfterDbCommit() {
if (masterTable.isNeedCache()) {
AbstractCache cache = CacheManager.getIntance().getCache(masterTable.getName());
cache.remove(id);
}
if (subTable.isNeedCache()) {
AbstractCache cache = CacheManager.getIntance().getCache(masterTable.getName());
cache.remove(id);
}
}
});
return R.success();
}
}

+ 88
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsLoadHandler.java Wyświetl plik

@@ -0,0 +1,88 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.mastersub;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageHelper;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper;
import org.springframework.util.Assert;

/**
* @Author:lip
* @Date : 2022/8/28 21:44
*/
public class LCMsLoadHandler extends AbstractDynPageHandler {
//新增卡片操作,初始化定义的数据集
public R add() {
String dataSet = params.readString("dataset");
PageDataset addDataSet = this.datasets.findByName(dataSet);
Assert.notNull(addDataSet, "未获取到数据集:" + dataSet);
SwMap data;
//懒加载,给个空对象
if (addDataSet.lazy) {
data = new SwMap();
} else {
data = DynPageHelper.createBean(addDataSet);
}

return R.success(LCSingleHelper.buildRetData(addDataSet.name, data));
}

public R load() {
//过滤条件
SwMap filter = params.readMap("filter");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset loadDataSet = this.datasets.findByName(dataSet);
Assert.notNull(loadDataSet, "未获取到数据集:" + dataSet);

SwMap data = provider.loadData(filter, loadDataSet);

return R.success(LCSingleHelper.buildRetData(loadDataSet.name, data));
}

private DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) {
DynPageListHandler listHandler = new DynPageListHandler(form.getId(), filter, pageDataSet);
listHandler.init(params, us);
return listHandler;
}

/**
* 列表数据
* @return
*/
public R list() {
//过滤条件
SwMap filter = params.readMap("filter");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset listDataSet = this.datasets.findByName(dataSet);
Assert.notNull(listDataSet, "未获取到数据集:" + dataSet);

DynRetBean bean = DynRetBean.createList(getListWorker(filter, listDataSet).buildListData());

return R.success(bean);
}

/**
* 计算分页数据
*
* @return
*/
public R getTotal() {
//过滤条件
SwMap filter = params.readMap("filter");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset listDataSet = this.datasets.findByName(dataSet);
Assert.notNull(listDataSet, "未获取到数据集:" + dataSet);

return getListWorker(filter, listDataSet).getTotal();
}
}

+ 138
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java Wyświetl plik

@@ -0,0 +1,138 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.mastersub;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler;
import org.springframework.util.Assert;

import java.util.ArrayList;
import java.util.Set;

/**
* @Author:lip
* @Date : 2022/8/28 21:03
*/
public class LCMsSaveHandler extends LCSingleSaveHandler {
private String cardMaster = "cardMaster";
private String listSub = "listSub";

/**
* 保存指定数据集操作,入参:{pageId,dataset:"", data:{form:{},list: {total:0,rows:[]}}, filter:{}}
*/
public R save() {
//数据集
String dbName = params.readString("dataset");
SwMap filter = params.readMap("filter");

//待保存数据
SwMap data = params.readMap("data");
if (data == null) throw new BizException("没有收到待保存的的数据:" + dbName + "!");

String subForeignKey = form.getOpts().readMap("config").readMap("props").readString("subForeignKey","-1");
Assert.isTrue(!subForeignKey.equals("-1"),"未获取到子表外键配置");

//对应的数据集定义
PageDataset masterDataSet = findDataset(cardMaster);
PageDataset subDataSet = findDataset(listSub);
Assert.isTrue(masterDataSet != null && subDataSet != null,"没有找到数据集");

//读取待保存的bean
DefaultEntity masterBean = readBeanFromPage(masterDataSet, data.readMap(cardMaster).readMap("form"));
if (filter != null && masterBean.isNew()) {
//有过滤条件,将关联的值设上
setLinkValue(masterDataSet, masterBean, f -> filter.get(f.name));
}
// 读取子表数据
SwMap details = params.readMap("details");
Assert.notNull(details,"没有收到待保存的明细数据");
ArrayList<DefaultEntity> inserted = new ArrayList<>();
ArrayList<DefaultEntity> updated = new ArrayList<>();
details.readListMap("inserted").forEach(row -> {
SwMap rowData = new SwMap();
rowData.putAll(row);
DefaultEntity insertBean = readBeanFromPage(subDataSet, rowData);
insertBean.put(subForeignKey,masterBean.getEntityId());
inserted.add(insertBean);
});
details.readListMap("updated").forEach(row -> {
SwMap rowData = new SwMap();
rowData.putAll(row);
DefaultEntity updateBean = readBeanFromPage(subDataSet, rowData);
updated.add(updateBean);
});
Set<Long> deleted = details.readLongSet("deleted");

//
checkBean(masterBean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
saveBean(masterBean);
ModelTable subTable = ModelTableCache.getInstance().get(subDataSet.masterTable);
Assert.notNull(subTable,"未获取到子表");

EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(subTable.getName());
dao.batchInsertEntity(inserted);
dao.batchUpdateEntity(updated);
if (deleted != null){
dao.deleteEntity(deleted);
}
}

@Override
public void doAfterDbCommit() {
afterCommit(masterBean);
}

@Override
public void doAfterDbRollback() {
afterRollback(masterBean);
}
});
return R.success(LCSingleHelper.buildRetData(masterDataSet.name, masterBean.getData()));
}

/**
* 从页面获取待保存的bean
*
* @param pageDataSet
* @param data
* @return
*/
protected DefaultEntity readBeanFromPage(PageDataset pageDataSet, SwMap data) {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);
if (table == null) throw new BizException("没有找到待保存的表定义:" + pageDataSet.name);

long id = data.readLong(table.getIdField());

EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(table.getName());
DefaultEntity bean;
if (id <= 0L) {
bean = dao.createBean();
bean.setIsNew(true);
//暂时不考虑list保存的情况
bean.getData().putAll(data);
setNewId(bean);
} else {
bean = dao.queryEntity(id);
if (bean == null) {
throw new BizException("没有找到待保存的记录:" + table.getName() + "." + id);
}
//暂时不考虑list保存的情况
bean.getData().putAll(data);
bean.setIsNew(false);
}
return bean;
}

}

+ 67
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsService.java Wyświetl plik

@@ -0,0 +1,67 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.mastersub;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService;

/**
* @Author:lip
* @Date : 2022/8/28 20:38
*/
@SwService
public class LCMsService extends LCSingleService {
private final static String TYPE_MODEL_LIST = "modelList";
private final static String TYPE_MODEL_ADD = "modelAdd";
private final static String TYPE_MODEL_LOAD = "modelLoad";
private final static String TYPE_MODEL_SAVE = "modelSave";
private final static String TYPE_MODEL_DEL = "modelDel";

@Override
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_MODEL_LIST:
case TYPE_MODEL_LOAD:
case TYPE_MODEL_ADD:
return new LCMsLoadHandler();
case TYPE_MODEL_SAVE:
return new LCMsSaveHandler();
case TYPE_MODEL_DEL:
return new LCMsDelHandler();
}
return super.createHandler(type);
}

//保存
public R modelSave(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_SAVE, handler -> ((LCMsSaveHandler)handler).save());
}

//读取
public R modelLoad(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_LOAD, handler -> ((LCMsLoadHandler)handler).load());
}

//读取
public R modelAdd(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_ADD, handler -> ((LCMsLoadHandler)handler).add());
}

//删除
public R modelDel(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCMsDelHandler)handler).del());
}

//列表数据
public R modelList(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((LCMsLoadHandler)handler).list());
}

//列表总记录数及合计栏
public R modelListTotal(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((LCMsLoadHandler)handler).getTotal());
}
}

+ 58
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java Wyświetl plik

@@ -0,0 +1,58 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.normal;

import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleDelHandler;
import org.springframework.util.Assert;

/**
* Created by Akmm at 2022/4/21 17:53
* 删除操作
*/
public class LCNormalDelHandler extends LCSingleDelHandler {
/**
* 删除指定数据集,入参{pageId, dataset, id}
*
* @return
*/
public R del() {
long id = params.readLong("id");
if (id == 0L) throw new BizException("没有收到待删除记录Id(" + id + ")!");
//数据集
String dataSet = params.readString("dataset");
PageDataset delDataSet = this.datasets.findByName(dataSet);
Assert.notNull(delDataSet,"未获取到数据集:"+dataSet);
//
checkBean(delDataSet, id);
//
DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
ModelTable table = ModelTableCache.getInstance().get(delDataSet.masterTable);
if (table == null) throw new BizException("没有找到指定的的表定义:" + delDataSet.name + "!");
EntityDao dao = DbEngine.getInstance().findDao(table.getName());
dao.deleteEntity(id);
localDel(id, table);
}

@Override
public void doAfterDbCommit() {
ModelTable table = ModelTableCache.getInstance().get(delDataSet.masterTable);
if (table.isNeedCache()) {
AbstractCache cache = CacheManager.getIntance().getCache(table.getName());
cache.remove(id);
}
localDelSuccess(id, table);
}
});
return R.success();
}
}

+ 30
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java Wyświetl plik

@@ -0,0 +1,30 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.normal;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService;

/**
* @Author:lip
* @Date : 2022/8/27 13:54
*/
@SwService
public class LCNormalService extends LCSingleService {

@Override
protected AbstractHandler createHandler(String type) {
if (type.equals(TYPE_MODEL_DEL)){
return new LCNormalDelHandler();
}
return super.createHandler(type);
}

//删除
public R modelDel(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCNormalDelHandler)handler).del());
}
}

+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java Wyświetl plik

@@ -87,7 +87,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
protected DefaultEntity readBeanFromPage(PageDataset pageDataSet, SwMap pageData) {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);
if (table == null) throw new BizException("没有找到待保存的表定义:" + pageDataSet.name);
SwMap data = pageData.readMap(pageDataSet.name);
if (data == null) throw new BizException("没有找到待保存的表数据:" + pageDataSet.name);
data = data.readMap("form");
@@ -212,7 +212,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
}
}

interface IGetValue {
public interface IGetValue {
Object getValue(PageDatasetFilter f);
}
}

+ 78
- 0
smtweb-framework/bpm/src/main/resources/static/template/default/incModel/inc_clist_ms.ftl Wyświetl plik

@@ -0,0 +1,78 @@
<#assign tmpl_Type = tmplType>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "",
"label": "列表",
"colNum": 0,
"paddingLeft": 20,
"paddingRight": 20,
"shadow": ""
},
"children": [
{
"id": "id${newId()}",
"type": "fx-table",
"props": {
"label": "表格",
"border": true,
"stripe": true,
"showHeader": true,
"fit": true,
"dataset": "${group.dataset}",
"actionWidth": 120
},
"slots": {
<#if (group.fields?size>0)>
<#assign fields = group.fields>
"default": [
<#list fields as col>
{
"id": "id${newId()}",
"type": "fx-table-column",
"props": {
"field": "${col.id}",
"label": "${col.label}"
}
}
<#if col_has_next>,</#if>
</#list>
],
</#if>
"button": [
{
"id": "id${newId()}",
"type": "fx-button",
"props": {
"label": "编辑",
"type": "primary",
"leftIcon": "edit",
"action": "button:loadRow",
"link": false,
"text": true,
"linkType": "dialog",
"fxLink": "dialog:cardSubDialog",
"fxLink_text": "子表编辑卡片"
}
},
{
"id": "id${newId()}",
"type": "fx-button",
"props": {
"label": "删除",
"type": "danger",
"leftIcon": "delete-themes",
"action": "button:delRow",
"link": false,
"text": true,
"confirm": ""
}
}
]
},
"events": {}
}
]
},

+ 28
- 10
smtweb-framework/bpm/src/main/resources/static/template/default/incModel/inc_list_table.ftl Wyświetl plik

@@ -41,7 +41,7 @@
],
</#if>
"button": [
<#if (tmpl_Type == "model_list")>
<#if (tmpl_Type == "model_list_card")>
{
"id": "id${newId()}",
"type": "fx-button",
@@ -49,16 +49,33 @@
"label": "编辑",
"type": "primary",
"leftIcon": "edit",
"action": "button:edit",
"action": "button:editCard",
"link": false,
"text": true,
"linkType": "dialog",
"fxLink": "dialog:cardDialog",
"fxLink_text": "${param.cardTitle}"
}
},
<#elseif (tmpl_Type == "model_list_normal" || tmpl_Type == "model_tree_list")>
{
"id": "id${newId()}",
"type": "fx-button",
"props": {
"label": "编辑",
"type": "primary",
"leftIcon": "edit",
"action": "button:editCard",
"dataset": "${group.dataset}",
"text": true,
"link": false,
"linkType": "",
"linkType": "curr",
"nextAction": "",
"fxLink": ""
"fxLink": "",
"fxLink_text": ""
}
},
<#elseif (tmpl_Type == "model_list_card")>
<#else >
{
"id": "id${newId()}",
"type": "fx-button",
@@ -66,12 +83,13 @@
"label": "编辑",
"type": "primary",
"leftIcon": "edit",
"action": "button:editCard",
"link": false,
"action": "button:edit",
"dataset": "${group.dataset}",
"text": true,
"linkType": "dialog",
"fxLink": "dialog:cardDialog",
"fxLink_text": "${param.cardTitle}"
"link": false,
"linkType": "curr",
"nextAction": "",
"fxLink": ""
}
},
</#if>


+ 489
- 0
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl Wyświetl plik

@@ -0,0 +1,489 @@
{
"version": 6,
"form": [
{
"page": {
"id": "id${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}",
"tipsExpand": false
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": ""
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false,
"scroll": true
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"size": "60"
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"showDropdown": false,
"dataset":"${layout.cardMaster[0].dataset}"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "保存",
"leftIcon": "save",
"type": "success",
"action": "button:saveCard"
},
"id": "${newId()}",
"events": {}
},
{
"type": "fx-button",
"props": {
"label": "删除",
"leftIcon": "delete",
"type": "danger",
"action": "button:delCard"
},
"id": "${newId()}",
"events": {}
},
{
"type": "fx-button",
"props": {
"label": "返回",
"leftIcon": "return",
"action": "button:return"
},
"id": "${newId()}",
"events": {}
}
],
"dropdown": []
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignX": "stretch",
"size": "0"
},
"children": [
{
"id": "${newId()}",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0",
"paddingTop": 15,
"colNum": "${param.masterCol}"
},
<#assign mfields = layout.cardMaster[0].fields>
"children": [
<#list mfields as mfield>
{
"id": "id${newId()}",
<#if (mfield.readonly = true)>
"type": "fx-text",
"disabled": true,
<#else>
"type": "${mfield.editor}",
</#if>
"props": {
"label": "${mfield.label}",
"dataset": "${mfield.dataset}",
"field": "${mfield.id}",
"required": "${mfield.required}",
<#if mfield.maxlength gt 0>
"maxlength": ${mfield.maxlength},
</#if>
"placeholder": "请输入${mfield.label}",
<#if (param.masterCol gte 2)>
"tips": "${mfield.desc}",
</#if>
"labelWidth": 100,
<#if (mfield.readonly = true)>
"readonly": true,
<#else>
"readonly": false,
</#if>
"affixError": true
},
"events": {}
}
<#if mfield_has_next>
<#if (param.masterCol lte 1 )>
<#if (mfield.desc != "")>
,{
"id": "id${newId()}",
"type": "fx-label",
"props": {
"label": "${mfield.desc}",
"labelWidth": 0,
"affixError": true,
"labelAlign": "left"
}
}
<#else>
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
</#if>
</#if>
,
</#if>
</#list>
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0"
},
"children": [
{
"id": "${newId()}",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"alignX": "end",
"alignY": "center",
"paddingRight": 20,
"colNum": 2,
"gridTemplateColumns": "92px 1fr"
},
"children": [
{
"id": "${newId()}",
"type": "fx-title",
"props": {
<#if (param.listSubTitle == "")>
"label": "明细列表",
<#else>
"label": "${param.listSubTitle}",
</#if>
"fontWeight": "bold",
"showPrefix": true,
"fontSize": 16,
"prefixWidth": 5
}
},
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"showDropdown": false
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "新增",
"leftIcon": "plus",
"type": "primary",
"action": "button:addRow",
"linkType": "dialog",
"fxLink": "dialog:cardSubDialog",
"fxLink_text": "子表编辑卡片",
"nextAction": "",
"preAction": "",
"dataset": "${layout.listSub[0].dataset}"
},
"id": "${newId()}",
"events": {}
}
],
"dropdown": []
}
}
]
},
<#assign group = layout.listSub[0]>
<#include "incModel/inc_clist_ms.ftl"/>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "transparent"
},
"children": []
}
]
}
]
}
},
{
"page": {
"id": "${newId()}",
"type": "fx-dialog",
"props": {
"title": "子表编辑卡片",
"key": "cardSubDialog",
"width": "670px",
"height": "560px",
"showPrefix": true
},
"events": {}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"alignX": "start",
"alignY": "center",
"paddingLeft": 20
},
"children": [
{
"id": "${newId()}",
"type": "fx-title",
"props": {
<#if (param.cardSubTitle == "")>
"label": "明细编辑",
<#else>
"label": "${param.cardSubTitle}",
</#if>
"fontWeight": "bold",
"fontSize": 16,
"showPrefix": true
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"paddingLeft": 50,
"colNum": "${param.subCol}"
},
<#assign sfields = layout.listSub[0].fields>
"children": [
<#list sfields as sfield>
{
"id": "id${newId()}",
<#if (sfield.readonly = true)>
"type": "fx-text",
"disabled": true,
<#else>
"type": "${sfield.editor}",
</#if>
"props": {
"label": "${sfield.label}",
"dataset": "${sfield.dataset}",
"field": "${sfield.id}",
"required": "${sfield.required}",
<#if sfield.maxlength gt 0>
"maxlength": ${sfield.maxlength},
</#if>
"placeholder": "请输入${sfield.label}",
<#if (param.subCol gte 2)>
"tips": "${sfield.desc}",
</#if>
"labelWidth": 100,
<#if (sfield.readonly = true)>
"readonly": true,
<#else>
"readonly": false,
</#if>
"affixError": true
},
"events": {}
}
<#if sfield_has_next>
<#if (param.subCol lte 1 )>
<#if (sfield.desc != "")>
,{
"id": "id${newId()}",
"type": "fx-label",
"props": {
"label": "${sfield.desc}",
"labelWidth": 0,
"affixError": true,
"labelAlign": "left"
}
}
<#else>
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
</#if>
</#if>
,
</#if>
</#list>
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0"
},
"children": [
{
"id": "${newId()}",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"alignX": "end",
"paddingRight": 20,
"alignY": "center"
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"showDropdown": false
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "保存",
"leftIcon": "save",
"type": "success",
"action": "button:saveRow",
"dataset": "${layout.listSub[0].dataset}",
"nextAction": "button:closeDialog"
},
"id": "${newId()}",
"events": {}
},
{
"type": "fx-button",
"props": {
"label": "保存并新增",
"type": "primary",
"action": "button:saveRow",
"linkType": "curr",
"dataset": "${layout.listSub[0].dataset}",
"nextAction": "button:addRow"
},
"id": "${newId()}",
"events": {}
},
{
"type": "fx-button",
"props": {
"label": "返回",
"leftIcon": "return",
"action": "button:closeDialog"
},
"id": "${newId()}",
"events": {}
}
],
"dropdown": []
}
}
]
}
]
}
}
],
"model": [
<#list datasets as dataset>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
</#list>
],
"option": {
"widgetRef": [${widgetRef}],
"vars": []
}
}

+ 162
- 0
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_normal.ftl Wyświetl plik

@@ -0,0 +1,162 @@
{
"version": 6,
"form": [
{
"page": {
"id": "id${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}",
"tipsExpand": false
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"size": "60"
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"showDropdown": false,
"dataset":"${layout.card[0].dataset}"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "保存",
"leftIcon": "save",
"type": "success",
"action": "button:saveCard"
},
"id": "${newId()}",
"events": {}
},
{
"type": "fx-button",
"props": {
"label": "删除",
"leftIcon": "delete",
"type": "danger",
"action": "button:delCard"
},
"id": "${newId()}",
"events": {}
},
{
"type": "fx-button",
"props": {
"label": "返回",
"leftIcon": "return",
"action": "button:return"
},
"id": "${newId()}",
"events": {}
}
],
"dropdown": []
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"colNum": "${param.col}"
},
<#assign dfields = layout.card[0].fields>
"children": [
<#list dfields as dfield>
{
"id": "id${newId()}",
<#if (dfield.readonly = true)>
"type": "fx-text",
"disabled": true,
<#else>
"type": "${dfield.editor}",
</#if>
"props": {
"label": "${dfield.label}",
"dataset": "${dfield.dataset}",
"field": "${dfield.id}",
"required": "${dfield.required}",
<#if dfield.maxlength gt 0>
"maxlength": ${dfield.maxlength},
</#if>
"placeholder": "请输入${dfield.label}",
<#if (param.col gte 2)>
"tips": "${dfield.desc}",
</#if>
"labelWidth": 100,
<#if (dfield.readonly = true)>
"readonly": true,
<#else>
"readonly": false,
</#if>
"affixError": true
},
"events": {}
}
<#if dfield_has_next>
<#if (param.col lte 1 )>
<#if (dfield.desc != "")>
,{
"id": "id${newId()}",
"type": "fx-label",
"props": {
"label": "${dfield.desc}",
"labelWidth": 0,
"affixError": true,
"labelAlign": "left"
}
}
<#else>
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
</#if>
</#if>
,
</#if>
</#list>
]
}
]
}
}
],
"model": [
<#list datasets as dataset>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
</#list>
],
"option": {
"widgetRef": [${widgetRef}],
"vars": []
}
}

+ 111
- 0
smtweb-framework/bpm/src/main/resources/static/template/default/model_list_normal.ftl Wyświetl plik

@@ -0,0 +1,111 @@
{
<#list layout.list as group>
"form": [
{
"page": {
"id": "${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}"
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": ""
},
"children": [
<#if (group.cfilters?size>0)>
<#include "incModel/inc_list_query.ftl"/>
</#if>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"label": "按钮区域",
"colNum": 2,
"alignY": "center",
"paddingLeft": 20,
"paddingRight": 20,
"shadow": ""
},
"children": [
{
"id": "id${newId()}",
"type": "fx-title",
"props": {
"label": "${title}",
"fontSize": 15,
"color": "#313131",
"fontWeight": "bold",
"showPrefix": true,
"prefixWidth": 5,
"prefixHeight": 15,
"prefixColor": "#1E90FF"
}
},
{
"id": "id${newId()}",
"type": "fx-button-group",
"props": {
"showDropdown": false,
"dataset": "${group.dataset}"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "新增",
"leftIcon": "plus",
"type": "primary",
"action": "button:addCard",
"link": false,
"linkType": "curr",
"fxLink": "",
"fxLink_text": ""
},
"id": "id${newId()}",
"events": {}
}
],
"dropdown": []
}
}
]
},
<#include "incModel/inc_list_table.ftl"/>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "transparent"
},
"children": []
}
]
}
}
<#if (group.sfilters?size>0)>
<#include "incModel/inc_query_sfilters.ftl"/>
</#if>
],
"model": [
<#list datasets as dataset>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
</#list>
],
"option": {
"widgetRef": [${widgetRef}],
"vars": []
}
</#list>
}

+ 149
- 387
smtweb-framework/bpm/src/main/resources/static/template/default/model_tree_list.ftl Wyświetl plik

@@ -1,433 +1,195 @@
{
"version": 6,
<#list layout.c1 as group>
<#list layout.list as group>
"form": [
{
"page": {
"id": "id${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}"
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"shadow": ""
"page": {
"id": "${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}"
}
},
"children": [
{
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": true,
"shadow": ""
"horizontal": true,
"shadow": ""
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false,
"size": "300"
},
"children": [
{
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "",
"colNum": 0,
"align": "full",
"paddingTop": 10,
"paddingLeft": 10,
"paddingRight": 10
},
"children": [
{
"id": "id${newId()}",
"type": "fx-tree",
"props": {
"defaultExpandAll": true,
"expandOnClickNode": false,
"filterShow": true,
"filterPlaceholder": "查询",
"dataset": "ds_18210085a45",
"field": "fid18210085a51",

"label": "编码"
},
"events": {}
}
]
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "--color-transparent"
},
"children": []
},
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false
},
"children": [

{
"type": "fx-split-panel",
"shape": "panel",
"id": "form_panel",
"type": "fx-form-panel",
"props": {
"colNum": 3,
"label": "查询条件",
"size": "50",
"alignY": "center",
"paddingRight": 20,
"gridTemplateColumns": "400px 400px 1fr",
"paddingLeft": 20
"size": "300",
"horizontal": false,
"shadow": ""
},
"children": [
<#list group.cfilters as cfilters>
{
"id": "id${newId()}",
"type": "fx-${cfilters.editor}",
"props": {
"label": "${cfilters.label}",
"type": "text",
"maxlength": 50,
"hideLabel": true,
"placeholder": "请输入${cfilters.label}",
"labelWidth": 100,
"affixError": false
},
"events": {}
},
</#list>
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"showDropdown": false
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"size": "",
"horizontal": false,
"name": "left"
},
"children": [
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "",
"colNum": 0,
"paddingTop": 10,
"paddingLeft": 10,
"paddingRight": 10,
"scroll": true
},
"children": [
{
"id": "${newId()}",
"type": "fx-tree",
"props": {
"defaultExpandAll": false,
"expandOnClickNode": false,
"filterShow": true,
"filterPlaceholder": "查询",
"createVirtualRoot": false,
"virtualRootLabel": "顶级虚拟节点",
"dataset": "${group.dataset}"
},
"events": {}
}
]
}
]
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "查询",
"leftIcon": "search",
"type": "primary",
"action": "button:search",
"linkType": "",
"dataset": "${param.queryDs}"
},
"id": "id${newId()}"
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "--color-transparent"
},
{
"type": "fx-button",
"props": {
"label": "重置",
"leftIcon": "clear",
"action": "button:reset"
},
"id": "id${newId()}"
}
],
"dropdown": []
"children": []
}
}
]
},
{
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"label": "间隔",
"size": "15",
"backgroundColor": "--color-transparent"
"size": "15",
"backgroundColor": "--color-transparent"
},
"children": []
},

{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"label": "表格标题区",
"size": "50",
"colNum": 2,
"alignY": "center",
"paddingLeft": 20,
"paddingRight": 20
},
"children": [
{
"id": "id${newId()}",
"type": "fx-title",
"props": {
"label": "${group.label}"
}
},
{
"id": "id${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right",
"showDropdown": false
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "新增",
"leftIcon": "plus",
"type": "primary",
"action": "button:add",
"linkType": "dialog",
"dataset": "",
"fxLink": "dialog:editMainDialog",
"fxLink_text": "卡片一号",
"preAction": ""
},
"id": "id${newId()}"
}
],
"dropdown": []
}
}
]
},
{
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"label": "表格区",
"colNum": 0,
"paddingLeft": 20,
"paddingRight": 20
"horizontal": false,
"name": "right"
},
"children": [
{
"id": "id${newId()}",
"type": "fx-table",
"props": {
"label": "表格",
"border": true,
"stripe": true,
"showHeader": true,
"fit": true,
"dataset": "${param.queryDs}",
"actionWidth": 150
},
"slots": {
"button": [
{
"type": "fx-button",
"props": {
"label": "编辑",
"type": "primary",
"leftIcon": "edit",
"action": "button:edit",
"link": false,
"text": true,
"dataset": "${param.editDs}",
"linkType": "dialog",
"fxLink": "dialog:editMainDialog",
"fxLink_text": ""
},
"id": "id${newId()}"
<#if (group.cfilters?size>0)>
<#include "incModel/inc_list_query.ftl"/>
</#if>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"label": "按钮区域",
"colNum": 2,
"alignY": "center",
"paddingLeft": 20,
"paddingRight": 20,
"shadow": ""
},
{
"type": "fx-button",
"props": {
"label": "删除",
"type": "danger",
"leftIcon": "delete",
"action": "button:remove",
"link": false,
"text": true,
"dataset": "${param.editDs}",
"preAction": ""
},
"id": "id${newId()}"
}
],
"default": [
<#if (group.fields?size>0)>
<#list group.fields as col>
{
"id": "id${newId()}",
"type": "fx-table-column",
"props": {
"field": "${col.id}",
"label": "${col.label}"
}
}<#if col_has_next>,</#if>
</#list>
</#if>
]
"children": [
{
"id": "id${newId()}",
"type": "fx-title",
"props": {
"label": "${title}",
"fontSize": 15,
"color": "#313131",
"fontWeight": "bold",
"showPrefix": true,
"prefixWidth": 5,
"prefixHeight": 15,
"prefixColor": "#1E90FF"
}
},
{
"id": "id${newId()}",
"type": "fx-button-group",
"props": {
"showDropdown": false,
"dataset": "${group.dataset}"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "新增",
"leftIcon": "plus",
"type": "primary",
"action": "button:addCard",
"link": false,
"linkType": "curr",
"fxLink": "",
"fxLink_text": ""
},
"id": "id${newId()}",
"events": {}
}
],
"dropdown": []
}
}
]
},
"events": {}
}
<#include "incModel/inc_list_table.ftl"/>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "transparent"
},
"children": []
}
]
}
]
}
]
},
{
"shape": "panel",
"id": "fx-form-panel",
"type": "fx-split-panel",
"props": {
"shadow": "",
"size": 15
},
"children": []
}
]
}
},
<#list layout.c2 as main_dialog>
{
"page": {
"id": "id${newId()}",
"type": "fx-dialog",
"props": {
<#if (param.editTitle == "")>
"title": "卡片一号",
<#else>
"title": "${param.editTitle}",
</#if>
"key": "editMainDialog",
"closeOnClickModal": false,
"showPrefix": true
},
"events": {}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false,
"scroll": true,
"backgroundColor": "--color-white"
},
"children": [
<#assign dfields = main_dialog.fields>
<#assign col = param.col>
<#include "incModel/inc_list_dialog.ftl"/>
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0"
},
"children": [
{
"id": "id${newId()}",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"paddingRight": 20,
"alignY": "center"
},
"children": [
{
"id": "id${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "保存",
"leftIcon": "save",
"type": "success",
"action": "button:save",
"dataset": "${param.editDs}"
},
"id": "id${newId()}"
},
{
"type": "fx-button",
"props": {
"label": "关闭",
"leftIcon": "close",
"type": "",
"action": "button:closeDialog",
"nextAction": "button:search"
},
"id": "id${newId()}"
}
]
}
}
]
}
]
}
}
}
</#list>
<#if (group.sfilters?size>0)>
<#include "incModel/inc_query_sfilters.ftl"/>
</#if>
],
</#list>
"model": [
<#list datasets as dataset>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
</#list>
],
"option": {
"widgetRef": [${widgetRef}],
"vars": []
}
</#list>
}

+ 433
- 0
smtweb-framework/bpm/src/main/resources/static/template/default/model_tree_list_bak.ftl Wyświetl plik

@@ -0,0 +1,433 @@
{
"version": 6,
<#list layout.c1 as group>
"form": [
{
"page": {
"id": "id${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}"
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"shadow": ""
},
"children": [
{
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": true,
"shadow": ""
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false,
"size": "300"
},
"children": [
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "",
"colNum": 0,
"align": "full",
"paddingTop": 10,
"paddingLeft": 10,
"paddingRight": 10
},
"children": [
{
"id": "id${newId()}",
"type": "fx-tree",
"props": {
"defaultExpandAll": true,
"expandOnClickNode": false,
"filterShow": true,
"filterPlaceholder": "查询",
"dataset": "ds_18210085a45",
"field": "fid18210085a51",

"label": "编码"
},
"events": {}
}
]
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "--color-transparent"
},
"children": []
},
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false
},
"children": [

{
"shape": "panel",
"id": "form_panel",
"type": "fx-form-panel",
"props": {
"colNum": 3,
"label": "查询条件",
"size": "50",
"alignY": "center",
"paddingRight": 20,
"gridTemplateColumns": "400px 400px 1fr",
"paddingLeft": 20
},
"children": [
<#list group.cfilters as cfilters>
{
"id": "id${newId()}",
"type": "fx-${cfilters.editor}",
"props": {
"label": "${cfilters.label}",
"type": "text",
"maxlength": 50,
"hideLabel": true,
"placeholder": "请输入${cfilters.label}",
"labelWidth": 100,
"affixError": false
},
"events": {}
},
</#list>
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"showDropdown": false
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "查询",
"leftIcon": "search",
"type": "primary",
"action": "button:search",
"linkType": "",
"dataset": "${param.queryDs}"
},
"id": "id${newId()}"
},
{
"type": "fx-button",
"props": {
"label": "重置",
"leftIcon": "clear",
"action": "button:reset"
},
"id": "id${newId()}"
}
],
"dropdown": []
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"label": "间隔",
"size": "15",
"backgroundColor": "--color-transparent"
},
"children": []
},

{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"label": "表格标题区",
"size": "50",
"colNum": 2,
"alignY": "center",
"paddingLeft": 20,
"paddingRight": 20
},
"children": [
{
"id": "id${newId()}",
"type": "fx-title",
"props": {
"label": "${group.label}"
}
},
{
"id": "id${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right",
"showDropdown": false
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "新增",
"leftIcon": "plus",
"type": "primary",
"action": "button:add",
"linkType": "dialog",
"dataset": "",
"fxLink": "dialog:editMainDialog",
"fxLink_text": "卡片一号",
"preAction": ""
},
"id": "id${newId()}"
}
],
"dropdown": []
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"label": "表格区",
"colNum": 0,
"paddingLeft": 20,
"paddingRight": 20
},
"children": [
{
"id": "id${newId()}",
"type": "fx-table",
"props": {
"label": "表格",
"border": true,
"stripe": true,
"showHeader": true,
"fit": true,
"dataset": "${param.queryDs}",
"actionWidth": 150
},
"slots": {
"button": [
{
"type": "fx-button",
"props": {
"label": "编辑",
"type": "primary",
"leftIcon": "edit",
"action": "button:edit",
"link": false,
"text": true,
"dataset": "${param.editDs}",
"linkType": "dialog",
"fxLink": "dialog:editMainDialog",
"fxLink_text": ""
},
"id": "id${newId()}"
},
{
"type": "fx-button",
"props": {
"label": "删除",
"type": "danger",
"leftIcon": "delete",
"action": "button:remove",
"link": false,
"text": true,
"dataset": "${param.editDs}",
"preAction": ""
},
"id": "id${newId()}"
}
],
"default": [
<#if (group.fields?size>0)>
<#list group.fields as col>
{
"id": "id${newId()}",
"type": "fx-table-column",
"props": {
"field": "${col.id}",
"label": "${col.label}"
}
}<#if col_has_next>,</#if>
</#list>
</#if>
]
},
"events": {}
}
]
}
]
}
]
},
{
"shape": "panel",
"id": "fx-form-panel",
"type": "fx-split-panel",
"props": {
"shadow": "",
"size": 15
},
"children": []
}
]
}
},
<#list layout.c2 as main_dialog>
{
"page": {
"id": "id${newId()}",
"type": "fx-dialog",
"props": {
<#if (param.editTitle == "")>
"title": "卡片一号",
<#else>
"title": "${param.editTitle}",
</#if>
"key": "editMainDialog",
"closeOnClickModal": false,
"showPrefix": true
},
"events": {}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false,
"scroll": true,
"backgroundColor": "--color-white"
},
"children": [
<#assign dfields = main_dialog.fields>
<#assign col = param.col>
<#include "incModel/inc_list_dialog.ftl"/>
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0"
},
"children": [
{
"id": "id${newId()}",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"paddingRight": 20,
"alignY": "center"
},
"children": [
{
"id": "id${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "保存",
"leftIcon": "save",
"type": "success",
"action": "button:save",
"dataset": "${param.editDs}"
},
"id": "id${newId()}"
},
{
"type": "fx-button",
"props": {
"label": "关闭",
"leftIcon": "close",
"type": "",
"action": "button:closeDialog",
"nextAction": "button:search"
},
"id": "id${newId()}"
}
]
}
}
]
}
]
}
}
</#list>
],
</#list>
"model": [
<#list datasets as dataset>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
</#list>
],
"option": {
"widgetRef": [${widgetRef}],
"vars": []
}
}

+ 4
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java Wyświetl plik

@@ -339,6 +339,10 @@ public interface SwEnum {
class ModelType extends StrEnum {
public static ModelType instance = new ModelType();
public static StrEnumBean LC_SINGLE = instance.addEnum("LC_SINGLE", "简单列表(含卡片)");
public static StrEnumBean LC_NORMAL = instance.addEnum("LC_NORMAL", "普通列表(含卡片)");
public static StrEnumBean LC_LT = instance.addEnum("LC_LT", "列表卡片(左树+列表)");
public static StrEnumBean LC_MS = instance.addEnum("LC_MS", "列表卡片(主子表)");
public static StrEnumBean LC_LT_MS = instance.addEnum("LC_LT_MS", "列表卡片(左树+列表+主子表)");
}

// 权限类型


Ładowanie…
Anuluj
Zapisz