Browse Source

模板修改

master
yaoq 2 years ago
parent
commit
d95c6ca6ce
3 changed files with 95 additions and 59 deletions
  1. +76
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menu/MenuHandler.java
  2. +2
    -2
      smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_dialog.ftl
  3. +17
    -53
      smtweb-framework/bpm/src/main/resources/static/template/model_tree_list.ftl

+ 76
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menu/MenuHandler.java View File

@@ -4,20 +4,19 @@ import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.vo.ModelCatalog;
import cc.smtweb.framework.core.db.vo.ModelProject;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.PubUtil;
import cc.smtweb.system.bpm.web.design.db.ModelCatalogTreeHelper;
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageLoadHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageSaveHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageTreeHandler;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;

/**
* @Author: tanghp
@@ -29,6 +28,9 @@ public class MenuHandler {
@Override
public DynPageTreeHandler getTreeWorker(SwMap filter, PageDataset pageDataSet) {
DynPageTreeHandler treeHandler = new MenuTreeHandler(pageId, filter, pageDataSet);
if (pageDataSet.name.equals("mcTree")) {
treeHandler = new MenuCatalogTreeHandler(pageId, filter, pageDataSet);
}
treeHandler.init(params, us);
return treeHandler;
}
@@ -81,6 +83,76 @@ public class MenuHandler {
}
}

static class MenuCatalogTreeHandler extends DynPageTreeHandler {
private ModelCatalogTreeHelper mcTreeHelper = new ModelCatalogTreeHelper();

public MenuCatalogTreeHandler(long pageId, SwMap filter, PageDataset pageDataSet) {
super(pageId, filter, pageDataSet);
}

@Override
protected List<SwMap> getChildren(long id) {
List<SwMap> list = new ArrayList<>();
buildTreeData(list, id);
return list;
}

private void buildTreeData(List<SwMap> list, long id) {
if (id <= 0) {
Collection<ModelProject> mpList = ModelProjectCache.getInstance().getAll();
for (ModelProject mp : mpList) {
SwMap row = new SwMap();
row.put("mc_id", mp.getId());
row.put("mc_name", mp.getName());
list.add(row);
/*List<SwMap> children = new ArrayList<>();
buildTreeData(children, mp.getId());
if (PubUtil.isEmpty(children)) continue;
row.put("children", children);*/
}
return;
}
ModelProject mp = ModelProjectCache.getInstance().get(id);
if (mp != null) {
List<ModelCatalog> mcList = mcTreeHelper.getChildren(0, mp.getId(), true, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
if (PubUtil.isEmpty(mcList)) return;
for (ModelCatalog mc : mcList) {
SwMap row = new SwMap();
row.put("mc_id", mc.getId());
row.put("mc_name", mc.getName());
list.add(row);
/*List<SwMap> children = new ArrayList<>();
buildTreeData(children, mc.getId());
if (PubUtil.isEmpty(children)) continue;
row.put("children", children);*/
}
return;
}
List<ModelCatalog> mcList = mcTreeHelper.getChildren(id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
if (PubUtil.isEmpty(mcList)) return;
for (ModelCatalog mc : mcList) {
SwMap row = new SwMap();
row.put("mc_id", mc.getId());
row.put("mc_name", mc.getName());
list.add(row);
/*List<SwMap> children = new ArrayList<>();
buildTreeData(children, mc.getId());
if (PubUtil.isEmpty(children)) continue;
row.put("children", children);*/
}
}

@Override
protected long getId(SwMap bean) {
return bean.readLong("mc_id");
}

@Override
protected String getText(SwMap bean) {
return bean.readString("mc_name");
}
}

static class MenuTreeHandler extends DynPageTreeHandler {
private ModelCatalogTreeHelper mcTreeHelper = new ModelCatalogTreeHelper();



+ 2
- 2
smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_list_dialog.ftl View File

@@ -5,7 +5,7 @@
"shape": "panel",
"props": {
"size": "0",
"paddingTop": 32,
"paddingTop": 15,
"colNum": 2
},
"children": [
@@ -30,7 +30,7 @@
<#if (col1 gte 2)>
"tips": "${dfield.desc}",
</#if>
"labelWidth": 150,
"labelWidth": 100,
<#if (dfield.readonly = true)>
"readonly": true,
<#else>


+ 17
- 53
smtweb-framework/bpm/src/main/resources/static/template/model_tree_list.ftl View File

@@ -42,48 +42,6 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "56",
"alignY": "center",
"backgroundImage": "bgImg-region-title",
"paddingLeft": 32,
"colNum": 2,
"gridTemplateColumns": "",
"paddingRight": 32
},
"children": [
{
"id": "id${newId()}",
"type": "fx-title",
"props": {
"label": "树列表"
}
}
]
},
{
"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": "",
"colNum": 0,
"align": "full",
@@ -116,7 +74,7 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"size": "15",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -138,7 +96,10 @@
"colNum": 3,
"label": "查询条件",
"size": "50",
"alignY": "center"
"alignY": "center",
"paddingRight": 20,
"gridTemplateColumns": "400px 400px 1fr",
"paddingLeft": 20
},
"children": [
<#list group.cfilters as cfilters>
@@ -149,6 +110,7 @@
"label": "${cfilters.label}",
"type": "text",
"maxlength": 50,
"hideLabel": true,
"placeholder": "请输入${cfilters.label}",
"labelWidth": 100,
"affixError": false
@@ -198,7 +160,7 @@
"shape": "panel",
"props": {
"label": "间隔",
"size": "10",
"size": "15",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -211,11 +173,10 @@
"props": {
"label": "表格标题区",
"size": "50",
"backgroundImage": "bgImg-region-title",
"colNum": 2,
"alignY": "center",
"paddingLeft": 32,
"paddingRight": 32
"paddingLeft": 20,
"paddingRight": 20
},
"children": [
{
@@ -262,7 +223,9 @@
"shape": "panel",
"props": {
"label": "表格区",
"colNum": 0
"colNum": 0,
"paddingLeft": 20,
"paddingRight": 20
},
"children": [
{
@@ -339,7 +302,7 @@
"type": "fx-split-panel",
"props": {
"shadow": "",
"size": 24
"size": 15
},
"children": []
}
@@ -358,7 +321,8 @@
"title": "${param.editTitle}",
</#if>
"key": "editMainDialog",
"closeOnClickModal": false
"closeOnClickModal": false,
"showPrefix": true
},
"events": {}
},
@@ -411,7 +375,7 @@
"shape": "panel",
"props": {
"size": "50",
"paddingRight": 10,
"paddingRight": 20,
"alignY": "center"
},
"children": [
@@ -466,4 +430,4 @@
"widgetRef": [${widgetRef}],
"vars": []
}
}
}

Loading…
Cancel
Save