|
|
@@ -0,0 +1,475 @@
|
|
|
+package nckd.jxccl.sit.hcsi.formplugin.web.tp;
|
|
|
+
|
|
|
+import kd.bos.base.AbstractBasePlugIn;
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.dataentity.resource.ResManager;
|
|
|
+import kd.bos.dataentity.serialization.SerializationUtils;
|
|
|
+import kd.bos.entity.datamodel.AbstractFormDataModel;
|
|
|
+import kd.bos.entity.datamodel.IDataModel;
|
|
|
+import kd.bos.entity.datamodel.TableValueSetter;
|
|
|
+import kd.bos.entity.tree.TreeNode;
|
|
|
+import kd.bos.form.CloseCallBack;
|
|
|
+import kd.bos.form.FormShowParameter;
|
|
|
+import kd.bos.form.IFormView;
|
|
|
+import kd.bos.form.ShowType;
|
|
|
+import kd.bos.form.control.Control;
|
|
|
+import kd.bos.form.control.EntryGrid;
|
|
|
+import kd.bos.form.control.TreeView;
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
+import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
|
+import kd.bos.form.events.ClosedCallBackEvent;
|
|
|
+import kd.bos.form.operate.FormOperate;
|
|
|
+import kd.bos.util.CollectionUtils;
|
|
|
+import kd.swc.hsas.business.formula.helper.FormulaDataServiceHelper;
|
|
|
+import kd.swc.hsas.business.formula.helper.FormulaItemOrFuncTreeHelper;
|
|
|
+import kd.swc.hsbp.common.cache.SWCPageCache;
|
|
|
+import kd.swc.hsbp.common.util.SWCObjectUtils;
|
|
|
+import kd.swc.hsbp.common.util.SWCStringUtils;
|
|
|
+import nckd.jxccl.sit.hcsi.formplugin.web.tp.helper.SitItemSelectAddItemServiceHelper;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Tyx 2025-10-17
|
|
|
+ * 结果表内容设置绑定插件 nckd_sititemselect
|
|
|
+ */
|
|
|
+public class SitItemSelectAddItemPlugin extends AbstractBasePlugIn {
|
|
|
+ private static final String BUTTON_CANCEL = "nckd_btncancel";
|
|
|
+ private static final String BUTTON_SAVE = "nckd_btnsave";
|
|
|
+ private static final String ENTRY_SELECT = "nckd_itemselectentry";
|
|
|
+ private static final String TREE_VIEW = "nckd_treeviewap";
|
|
|
+ private static final String FORM_MOVE_TO = "hsas_calitemmoveto";
|
|
|
+ private static final String ITEM_TYPE_II = "II";
|
|
|
+
|
|
|
+ private static final Map<String, String> ITEM_TYPE_MAPPING = new HashMap();
|
|
|
+ private static final Map<String, String> ITEM_CATEGORY_MAPPING = new HashMap();
|
|
|
+ static {
|
|
|
+ ITEM_TYPE_MAPPING.put("1", ITEM_TYPE_II);
|
|
|
+ ITEM_CATEGORY_MAPPING.put(ITEM_TYPE_II, ITEM_TYPE_II);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void registerListener(EventObject e) {
|
|
|
+ super.registerListener(e);
|
|
|
+ this.addClickListeners(BUTTON_CANCEL, BUTTON_SAVE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeBindData(EventObject e) {
|
|
|
+ super.beforeBindData(e);
|
|
|
+ long orgId = getOrgId();
|
|
|
+ loadMainPageData();
|
|
|
+ SitItemSelectAddItemServiceHelper helper = new SitItemSelectAddItemServiceHelper();
|
|
|
+ Map<String, Map<String, Map<String, Object>>> dataMap = helper.getAllItemData(orgId);
|
|
|
+ initItemTree(dataMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ private long getOrgId() {
|
|
|
+ return ((DynamicObject)this.getView().getParentView().getModel().getValue("org")).getLong("id");
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean isNeedAccItem() {
|
|
|
+ IFormView parentView = this.getView().getParentView();
|
|
|
+ return parentView == null || !SWCStringUtils.equals(parentView.getEntityId(), "hsas_migrationtpl");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
|
|
+ super.beforeDoOperation(args);
|
|
|
+ FormOperate formOperate = (FormOperate)args.getSource();
|
|
|
+ if ("do_moveto".equals(formOperate.getOperateKey())) {
|
|
|
+ openMoveToPage(args);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs args) {
|
|
|
+ super.afterDoOperation(args);
|
|
|
+ switch (args.getOperateKey()) {
|
|
|
+ case "do_addcolumn":
|
|
|
+ addColumn();
|
|
|
+ break;
|
|
|
+ case "do_removecolumn":
|
|
|
+ removeColumn();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void click(EventObject evt) {
|
|
|
+ super.click(evt);
|
|
|
+ Control source = (Control)evt.getSource();
|
|
|
+ switch (source.getKey()) {
|
|
|
+ case BUTTON_CANCEL:
|
|
|
+ this.getView().close();
|
|
|
+ break;
|
|
|
+ case BUTTON_SAVE:
|
|
|
+ btnOkClickEvent();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void closedCallBack(ClosedCallBackEvent evt) {
|
|
|
+ if ("movetoclosed".equals(evt.getActionId())) {
|
|
|
+ moveToClosedEvent(evt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkSelectedTreeNode(TreeView treeView, List<TreeNode> nodeList) {
|
|
|
+ DynamicObjectCollection selectDatas = this.getView().getModel().getEntryEntity("nckd_itemselectentry");
|
|
|
+ Set<String> uniqueCodeSet = selectDatas.stream()
|
|
|
+ .map(selectData -> selectData.getString("itemunicodeid"))
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<TreeNode> checkNodeList = FormulaItemOrFuncTreeHelper.getCheckTreeNodeList(nodeList, uniqueCodeSet);
|
|
|
+ if (CollectionUtils.isNotEmpty(checkNodeList)) {
|
|
|
+ treeView.checkNodes(checkNodeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void loadMainPageData() {
|
|
|
+ if (isMigrationTemplate()) {
|
|
|
+ loadMainPageDataFromMigrationTempate();
|
|
|
+ } else {
|
|
|
+ loadMainPageDataFromResultList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean isMigrationTemplate() {
|
|
|
+ return SWCStringUtils.equals(this.getView().getParentView().getEntityId(), "hsas_migrationtpl");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void loadMainPageDataFromResultList() {
|
|
|
+ IFormView parentView = this.getView().getParentView();
|
|
|
+ DynamicObjectCollection resultContentDatas = parentView.getModel().getEntryEntity("resultlist");
|
|
|
+ if (CollectionUtils.isEmpty(resultContentDatas)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ IDataModel model = this.getModel();
|
|
|
+ for (DynamicObject dataObj : resultContentDatas) {
|
|
|
+ int detailIndex = model.createNewEntryRow(ENTRY_SELECT);
|
|
|
+ String itemCategory = normalizeItemCategory((String)dataObj.get("itemcategory"));
|
|
|
+
|
|
|
+ populateEntryData(model, dataObj, itemCategory, detailIndex);
|
|
|
+ }
|
|
|
+ this.getView().updateView(ENTRY_SELECT);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String normalizeItemCategory(String itemCategory) {
|
|
|
+ return ITEM_CATEGORY_MAPPING.getOrDefault(itemCategory, itemCategory);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void loadMainPageDataFromMigrationTempate() {
|
|
|
+ DynamicObjectCollection matchRelationDatas = this.getView().getParentView().getModel()
|
|
|
+ .getEntryEntity("hsas_migrationtplent");
|
|
|
+ if (CollectionUtils.isEmpty(matchRelationDatas)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ IDataModel model = this.getModel();
|
|
|
+ for (DynamicObject matchRelationData : matchRelationDatas) {
|
|
|
+ String itemType = matchRelationData.getString("itemtype");
|
|
|
+ String itemCategory = ITEM_TYPE_MAPPING.get(itemType);
|
|
|
+
|
|
|
+ if (itemCategory != null) {
|
|
|
+ int detailIndex = model.createNewEntryRow(ENTRY_SELECT);
|
|
|
+ populateEntryData(model, matchRelationData, itemCategory, detailIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getView().updateView(ENTRY_SELECT);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void populateEntryData(IDataModel model, DynamicObject sourceData, String itemCategory, int detailIndex) {
|
|
|
+ model.setValue("itemnumber", sourceData.getString("itemnumber"), detailIndex);
|
|
|
+ model.setValue("itemcategory", itemCategory, detailIndex);
|
|
|
+ model.setValue("itemname", sourceData.getString("itemname"), detailIndex);
|
|
|
+ model.setValue("itemunicodeid", sourceData.getString("uniquecode"), detailIndex);
|
|
|
+ model.setValue("treenodeid", sourceData.getString("uniquecode"), detailIndex);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void btnOkClickEvent() {
|
|
|
+ DynamicObjectCollection entryDatas = this.getModel().getEntryEntity(ENTRY_SELECT);
|
|
|
+ if (CollectionUtils.isEmpty(entryDatas)) {
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先添加项目。", "CalResultTplAddItemPlugin_4", "swc-hsas-formplugin", new Object[0]));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.getView().returnDataToParent(entryDatas);
|
|
|
+ this.getView().close();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void moveToClosedEvent(ClosedCallBackEvent evt) {
|
|
|
+ Map<String, Object> returnData = (Map)evt.getReturnData();
|
|
|
+ if (SWCObjectUtils.isEmpty(returnData) || !"ok".equals(returnData.get("clickStatus"))) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ EntryGrid entryGrid = (EntryGrid)this.getView().getControl(ENTRY_SELECT);
|
|
|
+ int[] rows = entryGrid.getSelectRows();
|
|
|
+ int oldRow = rows[0];
|
|
|
+ int newRow = (Integer)returnData.get("rownumber") - 1;
|
|
|
+
|
|
|
+ IDataModel model = this.getModel();
|
|
|
+ DynamicObjectCollection datas = model.getEntryEntity(ENTRY_SELECT);
|
|
|
+ newRow = Math.min(newRow, datas.size() - 1);
|
|
|
+
|
|
|
+ if (oldRow != newRow) {
|
|
|
+ DynamicObject oldObj = (DynamicObject)datas.get(oldRow);
|
|
|
+ model.deleteEntryRow(ENTRY_SELECT, oldRow);
|
|
|
+ model.createNewEntryRow(ENTRY_SELECT, newRow, oldObj);
|
|
|
+ entryGrid.selectRows(newRow, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initItemTree(Map<String, Map<String, Map<String, Object>>> dataMap) {
|
|
|
+ TreeView treeView = (TreeView)this.getView().getControl(TREE_VIEW);
|
|
|
+ List<TreeNode> nodeList = buildTreeNodeList(dataMap);
|
|
|
+
|
|
|
+ treeView.deleteAllNodes();
|
|
|
+ treeView.addNodes(nodeList);
|
|
|
+
|
|
|
+ updatePageCache(nodeList, dataMap);
|
|
|
+ checkSelectedTreeNode(treeView, nodeList);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<TreeNode> buildTreeNodeList(Map<String, Map<String, Map<String, Object>>> dataMap) {
|
|
|
+ List<TreeNode> list = new ArrayList<>();
|
|
|
+ list.addAll(SitItemSelectAddItemServiceHelper.loadInsuranceItemChildNode(null, false, dataMap));
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updatePageCache(List<TreeNode> nodeList, Map<String, Map<String, Map<String, Object>>> dataMap) {
|
|
|
+ SWCPageCache pageCache = new SWCPageCache(this.getView());
|
|
|
+ Map<String, TreeNode> treeNodeMap = nodeList.stream()
|
|
|
+ .collect(Collectors.toMap(TreeNode::getId, Function.identity()));
|
|
|
+
|
|
|
+ pageCache.put("tree", SerializationUtils.serializeToBase64(treeNodeMap));
|
|
|
+ pageCache.put("allItemData", dataMap);
|
|
|
+ pageCache.put("simpleAllItemData", rebuildData(dataMap));
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Map<String, String>> rebuildData(Map<String, Map<String, Map<String, Object>>> dataMap) {
|
|
|
+ if (dataMap != null && dataMap.size() != 0) {
|
|
|
+ return Collections.emptyMap();
|
|
|
+ }
|
|
|
+
|
|
|
+ return dataMap.entrySet().stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ Map.Entry::getKey,
|
|
|
+ entry -> entry.getValue().entrySet().stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ Map.Entry::getKey,
|
|
|
+ innerEntry -> (String)innerEntry.getValue().get("uniquecode")
|
|
|
+ ))
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void addColumn() {
|
|
|
+ TreeView treeView = (TreeView)this.getView().getControl(TREE_VIEW);
|
|
|
+ List<String> selectNodeIds = treeView.getTreeState().getCheckedNodeIds();
|
|
|
+ if (CollectionUtils.isEmpty(selectNodeIds)) {
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先选中数据。", "CalResultTplAddItemPlugin_0", "swc-hsas-formplugin", new Object[0]));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ SWCPageCache pageCache = new SWCPageCache(this.getView());
|
|
|
+ Map<String, TreeNode> nodeMap = getNodeMapFromCache(pageCache);
|
|
|
+ Map<String, Map<String, Map<String, Object>>> dataMap = (Map)pageCache.get("allItemData", Map.class);
|
|
|
+
|
|
|
+ AbstractFormDataModel model = (AbstractFormDataModel)this.getModel();
|
|
|
+ model.beginInit();
|
|
|
+
|
|
|
+ try {
|
|
|
+ TableValueSetter vs = createTableValueSetter();
|
|
|
+ List<TreeNode> checkNodeList = new ArrayList<>(selectNodeIds.size());
|
|
|
+
|
|
|
+ for (String selectNodeId : selectNodeIds) {
|
|
|
+ TreeNode treeNode = nodeMap.get(selectNodeId);
|
|
|
+ if (!isValidNode(treeNode, selectNodeId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String itemCategory = getItemCategory(treeNode);
|
|
|
+ String itemNum = getItemNumber(dataMap, itemCategory, treeNode.getText(), treeNode);
|
|
|
+ String itemUnicodeId = getItemUnicodeId(treeNode.getId(), treeNode.getText());
|
|
|
+
|
|
|
+ vs.addRow(new Object[]{itemCategory, itemNum, treeNode.getText(), itemUnicodeId, treeNode.getId()});
|
|
|
+ checkNodeList.add(treeNode);
|
|
|
+ }
|
|
|
+
|
|
|
+ model.batchCreateNewEntryRow(ENTRY_SELECT, vs);
|
|
|
+ this.getView().updateView(ENTRY_SELECT);
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(checkNodeList)) {
|
|
|
+ treeView.checkNodes(checkNodeList);
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ model.endInit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, TreeNode> getNodeMapFromCache(SWCPageCache pageCache) {
|
|
|
+ String cacheTreeNodeStr = (String)pageCache.get("tree", String.class);
|
|
|
+ return (Map)SerializationUtils.deSerializeFromBase64(cacheTreeNodeStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ private TableValueSetter createTableValueSetter() {
|
|
|
+ TableValueSetter vs = new TableValueSetter(new String[0]);
|
|
|
+ vs.addField("nckd_itemcategory", new Object[0]);
|
|
|
+ vs.addField("nckd_itemnumber", new Object[0]);
|
|
|
+ vs.addField("nckd_itemname", new Object[0]);
|
|
|
+ vs.addField("nckd_itemunicodeid", new Object[0]);
|
|
|
+ vs.addField("nckd_treenodeid", new Object[0]);
|
|
|
+ return vs;
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean isValidNode(TreeNode treeNode, String selectNodeId) {
|
|
|
+ if (treeNode == null || SWCStringUtils.isEmpty(treeNode.getId())) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ String treeNodeId = treeNode.getId();
|
|
|
+ if (treeNodeId.equals("0_@_BS") || treeNodeId.equals("1_@_BS")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return !isExistTreeNode(selectNodeId);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getItemCategory(TreeNode treeNode) {
|
|
|
+ String treeNodeId = treeNode.getId();
|
|
|
+ String itemCategory = treeNodeId.substring(0, treeNodeId.indexOf('_'));
|
|
|
+ return normalizeItemCategory(itemCategory);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void removeCheckNode(int[] rows) {
|
|
|
+ DynamicObjectCollection selectDatas = this.getView().getModel().getEntryEntity(ENTRY_SELECT);
|
|
|
+ SWCPageCache pageCache = new SWCPageCache(this.getView());
|
|
|
+ Map<String, TreeNode> nodeMap = getNodeMapFromCache(pageCache);
|
|
|
+
|
|
|
+ List<String> removeCheckNodeList = Arrays.stream(rows)
|
|
|
+ .mapToObj(index -> {
|
|
|
+ DynamicObject selectData = (DynamicObject)selectDatas.get(index);
|
|
|
+ return nodeMap.get(selectData.getString("nckd_itemunicodeid"));
|
|
|
+ })
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(TreeNode::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ TreeView treeView = (TreeView)this.getView().getControl(TREE_VIEW);
|
|
|
+ treeView.uncheckNodes(removeCheckNodeList);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getItemNumber(Map<String, Map<String, Map<String, Object>>> dataMap, String itemCategory, String treeNodeName, TreeNode treeNode) {
|
|
|
+ String mapKey = getItemMapKey(itemCategory, treeNode);
|
|
|
+ Map<String, Map<String, Object>> itemMap = (Map)dataMap.get(mapKey);
|
|
|
+
|
|
|
+ if (itemMap == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> nameMap = itemMap.get(treeNodeName);
|
|
|
+ if (nameMap != null && nameMap.size() != 0) {
|
|
|
+ String number = (String)nameMap.get("number");
|
|
|
+ return SWCStringUtils.isEmpty(number) ? "" : number;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getItemMapKey(String itemCategory, TreeNode treeNode) {
|
|
|
+ switch (itemCategory) {
|
|
|
+ case ITEM_TYPE_II:
|
|
|
+ return "insuranceitemkey";
|
|
|
+ default:
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isExistTreeNode(String selectTreeNodeId) {
|
|
|
+ DynamicObjectCollection itemDatas = this.getModel().getEntryEntity(ENTRY_SELECT);
|
|
|
+ return itemDatas.stream()
|
|
|
+ .anyMatch(itemData -> SWCStringUtils.equals(
|
|
|
+ itemData.getString("nckd_treenodeid"),
|
|
|
+ selectTreeNodeId
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getItemUnicodeId(String treeNodeId, String treeNodeName) {
|
|
|
+ SWCPageCache pageCache = new SWCPageCache(this.getView());
|
|
|
+ Map<String, Map<String, String>> dataMap = (Map)pageCache.get("simpleAllItemData", Map.class);
|
|
|
+ if (SWCObjectUtils.isEmpty(dataMap)) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ return dataMap.values().stream()
|
|
|
+ .map(itemData -> itemData.get(treeNodeName))
|
|
|
+ .filter(uniqueCode -> SWCStringUtils.equals(uniqueCode, treeNodeId))
|
|
|
+ .findFirst()
|
|
|
+ .orElse("");
|
|
|
+ }
|
|
|
+
|
|
|
+ public TreeNode getTreeNodeByTreeId(Map<String, TreeNode> nodeMap, String treeId) {
|
|
|
+ return nodeMap.entrySet().stream()
|
|
|
+ .map(Map.Entry::getValue)
|
|
|
+ .filter(node -> findInSubTree(node, treeId))
|
|
|
+ .findFirst()
|
|
|
+ .orElse(new TreeNode());
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean findInSubTree(TreeNode node, String treeId) {
|
|
|
+ if (SWCStringUtils.equals(node.getId(), treeId)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<TreeNode> children = node.getChildren();
|
|
|
+ if (CollectionUtils.isEmpty(children)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return children.stream()
|
|
|
+ .anyMatch(child -> findInSubTree(child, treeId));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void removeColumn() {
|
|
|
+ EntryGrid entryGrid = (EntryGrid)this.getView().getControl(ENTRY_SELECT);
|
|
|
+ int[] rows = entryGrid.getSelectRows();
|
|
|
+
|
|
|
+ if (rows == null || rows.length == 0) {
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请选中一行再进行操作。", "CalResultTplAddItemPlugin_1", "swc-hsas-formplugin", new Object[0]));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ removeCheckNode(rows);
|
|
|
+ this.getModel().deleteEntryRows(ENTRY_SELECT, rows);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void openMoveToPage(BeforeDoOperationEventArgs args) {
|
|
|
+ EntryGrid entryGrid = (EntryGrid)this.getView().getControl(ENTRY_SELECT);
|
|
|
+ int[] rows = entryGrid.getSelectRows();
|
|
|
+
|
|
|
+ if (rows == null || rows.length == 0) {
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请选择要执行的数据。", "CalResultTplAddItemPlugin_2", "swc-hsas-formplugin", new Object[0]));
|
|
|
+ args.setCancel(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rows.length != 1) {
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("只能选择一条记录。", "CalResultTplAddItemPlugin_3", "swc-hsas-formplugin", new Object[0]));
|
|
|
+ args.setCancel(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ FormShowParameter showParameter = new FormShowParameter();
|
|
|
+ showParameter.setFormId(FORM_MOVE_TO);
|
|
|
+ showParameter.getOpenStyle().setShowType(ShowType.Modal);
|
|
|
+ showParameter.setParentPageId(this.getView().getPageId());
|
|
|
+ showParameter.setCaption(ResManager.loadKDString("移动到", "CalResultTplAddItemPlugin_5", "swc-hsas-formplugin", new Object[0]));
|
|
|
+ showParameter.setCloseCallBack(new CloseCallBack(this, "movetoclosed"));
|
|
|
+ this.getView().showForm(showParameter);
|
|
|
+ }
|
|
|
+}
|