kcode-pi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -0
- package/dist/cli/kcode.d.ts +15 -0
- package/dist/cli/kcode.js +153 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +7 -0
- package/docs/KCODE_DISTRIBUTION.md +91 -0
- package/extensions/kingdee-harness.ts +180 -0
- package/extensions/kingdee-header.ts +122 -0
- package/extensions/kingdee-tools.ts +379 -0
- package/knowledge/.backup/v1.0.0/version.json +10 -0
- package/knowledge/cangqiong/product-notes.md +15 -0
- package/knowledge/common/business-flows.md +115 -0
- package/knowledge/common/config-guides.md +110 -0
- package/knowledge/common/error-patterns.md +170 -0
- package/knowledge/common/implementation.md +144 -0
- package/knowledge/cosmic/hard-constraints.md +38 -0
- package/knowledge/cosmic/ksql-datafix.md +34 -0
- package/knowledge/cosmic/platform-baseline.md +32 -0
- package/knowledge/cosmic/plugin-decision-matrix.md +40 -0
- package/knowledge/cosmic/review-checklist.md +40 -0
- package/knowledge/cosmic/unittest.md +35 -0
- package/knowledge/enterprise/api-reference.md +186 -0
- package/knowledge/enterprise/code-patterns.md +217 -0
- package/knowledge/enterprise/plugin-lifecycle.md +188 -0
- package/knowledge/enterprise/tables.json +159 -0
- package/knowledge/flagship/api-reference.md +237 -0
- package/knowledge/flagship/code-patterns.md +246 -0
- package/knowledge/flagship/cosmic-platform-note.md +15 -0
- package/knowledge/flagship/plugin-lifecycle.md +248 -0
- package/knowledge/flagship/tables.json +159 -0
- package/knowledge/version.json +10 -0
- package/knowledge/xinghan/product-notes.md +15 -0
- package/package.json +71 -0
- package/prompts/kd-discuss.md +11 -0
- package/prompts/kd-execute.md +12 -0
- package/prompts/kd-plan.md +12 -0
- package/prompts/kd-ship.md +12 -0
- package/prompts/kd-spec.md +12 -0
- package/prompts/kd-verify.md +12 -0
- package/skills/kd-check/SKILL.md +26 -0
- package/skills/kd-cosmic-dev/SKILL.md +82 -0
- package/skills/kd-cosmic-review/SKILL.md +90 -0
- package/skills/kd-cosmic-unittest/SKILL.md +92 -0
- package/skills/kd-debug/SKILL.md +30 -0
- package/skills/kd-discuss/SKILL.md +24 -0
- package/skills/kd-execute/SKILL.md +22 -0
- package/skills/kd-gen/SKILL.md +34 -0
- package/skills/kd-ksql/SKILL.md +86 -0
- package/skills/kd-plan/SKILL.md +24 -0
- package/skills/kd-ship/SKILL.md +22 -0
- package/skills/kd-spec/SKILL.md +24 -0
- package/skills/kd-verify/SKILL.md +22 -0
- package/themes/kcode-dark.json +81 -0
- package/vendor/kingdee-skills/cosmic-unittest/SKILL.md +788 -0
- package/vendor/kingdee-skills/cosmic-unittest/author-cache.json +5 -0
- package/vendor/kingdee-skills/cosmic-unittest/cosmic-unittest-skill-overview.html +746 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/business-test.md +205 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/common-test.md +257 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/formplugin-test.md +560 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/op-plugin-test.md +231 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/validator-test.md +232 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/business-helper.md +184 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/common-module.md +355 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/convert-plugin.md +130 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/formplugin.md +235 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/op-plugin.md +226 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/validator.md +206 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/SKILL.md +674 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/advanced-scenario-checklist.md +307 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/algox-performance-checklist.md +129 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/coding-standard-checklist.md +491 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/cosmic-api-checklist.md +285 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/data-access-checklist.md +261 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/data-transaction-checklist.md +390 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/domain-logic-checklist.md +295 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/form-plugin-checklist.md +508 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/infra-checklist.md +254 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/ksql-checklist.md +305 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/lifecycle-checklist.md +298 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/operation-plugin-checklist.md +442 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/test-mock-checklist.md +120 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/ui-performance-checklist.md +320 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/scripts/pattern-matcher.py +336 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/scripts/review-score-calculator.py +121 -0
- package/vendor/kingdee-skills/ok-cosmic/CHANGELOG.md +295 -0
- package/vendor/kingdee-skills/ok-cosmic/README.md +460 -0
- package/vendor/kingdee-skills/ok-cosmic/SKILL.md +287 -0
- package/vendor/kingdee-skills/ok-cosmic/agents/openai.yaml +17 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/BatchImportPluginTemplate.java +93 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/BillPlugInTemplate.java +156 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ConvertPlugInTemplate.java +255 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/FormPluginTemplate.java +597 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/IWorkflowPluginTemplate.java +91 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ListPluginTemplate.java +194 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/OpPluginTemplate.java +201 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/OpenApiControllerTemplate.java +103 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/PrintPluginTemplate.java +95 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ReportFormPluginTemplate.java +257 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ReportListDataPluginTemplate.java +70 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/StandardTreeListPluginTemplate.java +130 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/TaskTemplate.java +80 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/TreeListPluginTemplate.java +152 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/WriteBackPlugInTemplate.java +286 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/attachment/AttachmentUploadBindSample.java +93 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/botp/BotpTracePushSample.java +168 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/botp/SampleConvertPlugin.java +223 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/cache/SampleCacheUsage.java +218 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/concurrent/SampleThreadPoolBatch.java +156 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/data/DynamicObjectCrudSample.java +205 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/data/DynamicObjectOpsSample.java +100 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/BeforeOperationConfirmSample.java +217 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/ConfirmDialogSample.java +131 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/EntryRowCalculateSample.java +116 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/F7FilterSample.java +134 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/GetAndSetValueSample.java +176 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/HyperlinkJumpSample.java +124 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/OpenBillModalSample.java +253 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/ReturnParentDataSample.java +295 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/TreeControlSample.java +140 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/ViewControlOpsSample.java +132 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/list/ListPluginBasicSample.java +170 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/list/ListPreOpenFilterSample.java +68 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/message/MessageNotifySample.java +95 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/mq/SampleMQConsumer.java +198 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/mq/sample_mq.xml +15 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/operation/OpAddValidatorsSample.java +137 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/operation/OperationOptionBridgeSample.java +228 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/package-info.java +19 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/query/BaseDataQuerySample.java +194 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/query/BatchQuerySample.java +368 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/query/DataSetQueryStatSample.java +131 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/report/SampleReportFormPlugin.java +179 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/report/SampleReportListDataPlugin.java +616 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/snippets-guide.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/task/ScheduleTaskSample.java +160 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/workflow/SampleWorkflowPlugin.java +302 -0
- package/vendor/kingdee-skills/ok-cosmic/manifest.json +78 -0
- package/vendor/kingdee-skills/ok-cosmic/ok-cosmic-intro.html +903 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/attachment-api.md +114 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/botp-convert.md +98 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/dynamic-object.md +113 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/entity-metadata.md +123 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/event-lifecycle.md +184 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/flex-prop.md +114 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/form-utils.md +133 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/operate-chain.md +159 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/plugin-base.md +218 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/query-dataset.md +149 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/request-context.md +88 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/view-handler.md +157 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-bill.md +76 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-botp.md +70 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-form.md +165 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-import.md +69 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-list.md +227 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-openapi.md +112 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-operation.md +135 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-print.md +65 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-report-data.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-report-form.md +90 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-task.md +62 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-tree-list.md +71 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-workflow.md +82 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-writeback.md +71 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-algo.md +67 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-cache.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-dynamic-model-svc.md +82 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-dynamic-object.md +70 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-entity-model.md +61 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-exception.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-file.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-id.md +47 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-lock.md +61 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-log.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-network-control.md +70 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-orm-access.md +78 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-request-context.md +62 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-threadpool.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-tx.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-utils.md +67 -0
- package/vendor/kingdee-skills/ok-cosmic/requirements.txt +2 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/a-layer-rules.json +24 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/anti-patterns.md +48 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/cheat-sheet.md +256 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/coding-preferences.md +140 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/constraints.md +61 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/decision-matrix.md +222 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/intent-routing.md +94 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/platform-baseline.md +69 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/post-check.md +109 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/config_loader.py +204 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-api-knowledge.py +910 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-basedata-query.py +359 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-config-check.py +181 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-extpoints-query.py +389 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-form-metadata.py +856 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-post-check.py +262 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-post-lint.py +293 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/__init__.py +2 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/base.py +393 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/resource_check.py +176 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/scene_check.py +375 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/style_check.py +434 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/verify_check.py +36 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/route_client.py +186 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/script_utils.py +40 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/sqlite_cache.py +142 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/cuslib/kd-cd-cosmic-commons.jar +0 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/cuslib/kd-cd-cosmic-features.jar +0 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/ok-cosmic-docs.db +0 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/ok-cosmic.json +13 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/setup-mac.sh +18 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/setup-windows.bat +53 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/setup.jar +0 -0
- package/vendor/kingdee-skills/ok-ksql/SKILL.md +81 -0
- package/vendor/kingdee-skills/ok-ksql/agents/openai.yaml +7 -0
- package/vendor/kingdee-skills/ok-ksql/manifest.json +14 -0
- package/vendor/kingdee-skills/ok-ksql/references/ksql-datafix.md +452 -0
- package/vendor/kingdee-skills/ok-ksql/scripts/ksql_lint.py +363 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
package kd.cd.common;
|
|
2
|
+
|
|
3
|
+
import kd.bos.context.RequestContext;
|
|
4
|
+
import kd.bos.dataentity.entity.DynamicObject;
|
|
5
|
+
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
6
|
+
import kd.bos.dataentity.resource.ResManager;
|
|
7
|
+
import kd.bos.entity.NumberFormatProvider;
|
|
8
|
+
import kd.bos.entity.datamodel.events.PackageDataEvent;
|
|
9
|
+
import kd.bos.entity.report.FilterInfo;
|
|
10
|
+
import kd.bos.entity.report.ReportColumn;
|
|
11
|
+
import kd.bos.entity.report.ReportQueryParam;
|
|
12
|
+
import kd.bos.entity.report.queryds.ReportFilterFieldConfig;
|
|
13
|
+
import kd.bos.form.control.events.FilterContainerInitEvent;
|
|
14
|
+
import kd.bos.form.events.FilterContainerSearchClickArgs;
|
|
15
|
+
import kd.bos.form.field.events.BeforeFilterF7SelectEvent;
|
|
16
|
+
import kd.bos.lang.Lang;
|
|
17
|
+
import kd.bos.logging.Log;
|
|
18
|
+
import kd.bos.logging.LogFactory;
|
|
19
|
+
import kd.bos.list.column.ListOperationColumnDesc;
|
|
20
|
+
import kd.bos.report.ReportList;
|
|
21
|
+
import kd.bos.report.events.CreateColumnEvent;
|
|
22
|
+
import kd.bos.report.plugin.AbstractReportFormPlugin;
|
|
23
|
+
|
|
24
|
+
import java.util.ArrayList;
|
|
25
|
+
import java.util.HashMap;
|
|
26
|
+
import java.util.List;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 报表界面插件骨架模板(原生 AbstractReportFormPlugin)。
|
|
30
|
+
* 该类仅用于示例写法,生成后请按实际业务删除无用事件并替换占位常量。
|
|
31
|
+
*/
|
|
32
|
+
public class ReportFormPluginTemplate extends AbstractReportFormPlugin {
|
|
33
|
+
private static final Log LOG = LogFactory.getLog(ReportFormPluginTemplate.class);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 触发时机: 在需要了解当前插件可访问上下文能力时调用。
|
|
37
|
+
* 参数要点: 无入参;仅展示当前插件可通过 this. 访问的方法能力。
|
|
38
|
+
* 典型用途: 作为模板提示,指导在各事件内选择正确的上下文 API。
|
|
39
|
+
*/
|
|
40
|
+
private void getContextSample() {
|
|
41
|
+
// this.getView();
|
|
42
|
+
// this.getModel();
|
|
43
|
+
// this.getPageCache();
|
|
44
|
+
// this.getControl("reportlistap");
|
|
45
|
+
// this.getQueryParam();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private static final String GRID_KEY = "reportlistap";
|
|
49
|
+
private static final String FILTER_ORG = "org";
|
|
50
|
+
private static final String FILTER_BILL_STATUS = "billstatus";
|
|
51
|
+
private static final String RES_APP_ID = "kd-cd-common-template";
|
|
52
|
+
|
|
53
|
+
// ===== 核心事件 =====
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 触发时机: 默认查询参数初始化时。
|
|
57
|
+
* 参数要点: queryParam 可设置默认过滤、排序、方案值。
|
|
58
|
+
* 典型用途: 为报表设置默认组织、默认状态等初始查询条件。
|
|
59
|
+
*/
|
|
60
|
+
@Override
|
|
61
|
+
public void initDefaultQueryParam(ReportQueryParam queryParam) {
|
|
62
|
+
super.initDefaultQueryParam(queryParam);
|
|
63
|
+
FilterInfo filter = queryParam.getFilter();
|
|
64
|
+
if (filter == null) {
|
|
65
|
+
filter = new FilterInfo();
|
|
66
|
+
queryParam.setFilter(filter);
|
|
67
|
+
}
|
|
68
|
+
filter.addFilterItem("fieldKey", RequestContext.get().getOrgId());
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 触发时机: 过滤容器初始化时。
|
|
73
|
+
* 参数要点: contInitEvent 可访问过滤容器定义,queryParam 为当前查询参数。
|
|
74
|
+
* 典型用途: 初始化过滤项默认值、隐藏字段或补充联动字段。
|
|
75
|
+
*/
|
|
76
|
+
@Override
|
|
77
|
+
protected void filterContainerInit(FilterContainerInitEvent contInitEvent, ReportQueryParam queryParam) {
|
|
78
|
+
super.filterContainerInit(contInitEvent, queryParam);
|
|
79
|
+
initDefaultQueryParam(queryParam);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 触发时机: 过滤项 F7(基础资料/引用数据选择控件)打开前。
|
|
84
|
+
* 参数要点: args 可追加基础资料过滤条件。
|
|
85
|
+
* 典型用途: 限定 F7(基础资料/引用数据选择控件)可选范围,如只显示启用组织或启用基础资料。
|
|
86
|
+
*/
|
|
87
|
+
@Override
|
|
88
|
+
public void filterContainerBeforeF7Select(BeforeFilterF7SelectEvent args) {
|
|
89
|
+
super.filterContainerBeforeF7Select(args);
|
|
90
|
+
args.addCustomQFilter(new kd.bos.orm.query.QFilter("enable", kd.bos.orm.query.QCP.equals, true));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 触发时机: 点击过滤容器“查询”按钮时。
|
|
95
|
+
* 参数要点: args 含当前过滤值。
|
|
96
|
+
* 典型用途: 在查询按钮点击时读取过滤值、补充联动参数或提示信息。
|
|
97
|
+
*/
|
|
98
|
+
@Override
|
|
99
|
+
public void filterContainerSearchClick(FilterContainerSearchClickArgs args) {
|
|
100
|
+
super.filterContainerSearchClick(args);
|
|
101
|
+
Object orgValue = args.getFilterValue(FILTER_ORG);
|
|
102
|
+
if (orgValue != null) {
|
|
103
|
+
this.getView().showTipNotification(String.format(
|
|
104
|
+
ResManager.loadKDString("按组织过滤:%s", "ReportFormPluginTemplate_0", RES_APP_ID),
|
|
105
|
+
orgValue
|
|
106
|
+
));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 触发时机: 查询前校验时。
|
|
112
|
+
* 参数要点: 返回 false 会阻断查询。
|
|
113
|
+
* 典型用途: 避免空条件、超大范围或非法查询进入数据库。
|
|
114
|
+
*/
|
|
115
|
+
@Override
|
|
116
|
+
public boolean verifyQuery(ReportQueryParam queryParam) {
|
|
117
|
+
super.verifyQuery(queryParam);
|
|
118
|
+
return queryParam.getFilter() != null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 触发时机: 报表查询执行前。
|
|
123
|
+
* 参数要点: queryParam 含过滤、分页、排序等上下文。
|
|
124
|
+
* 典型用途: 追加查询过滤条件、设置报表控件状态或修正参数。
|
|
125
|
+
*/
|
|
126
|
+
@Override
|
|
127
|
+
public void beforeQuery(ReportQueryParam queryParam) {
|
|
128
|
+
super.beforeQuery(queryParam);
|
|
129
|
+
FilterInfo filter = queryParam.getFilter();
|
|
130
|
+
if (filter == null) {
|
|
131
|
+
filter = new FilterInfo();
|
|
132
|
+
queryParam.setFilter(filter);
|
|
133
|
+
}
|
|
134
|
+
// 设置取数排序规则
|
|
135
|
+
queryParam.setSortInfo("xxx");
|
|
136
|
+
// 设置自定义参数到取数插件
|
|
137
|
+
queryParam.setCustomParam(new HashMap<>());
|
|
138
|
+
// 设置是否树形报表
|
|
139
|
+
queryParam.setTreeReportList(false);
|
|
140
|
+
// 设置报表过滤条件配置
|
|
141
|
+
queryParam.setReportFilterFieldConfig(new ReportFilterFieldConfig());
|
|
142
|
+
// 设置多语言
|
|
143
|
+
queryParam.setMulLang(Lang.zh_CN);
|
|
144
|
+
// 设置报表自定义过滤条件
|
|
145
|
+
queryParam.setCustomFilter(new ArrayList<>());
|
|
146
|
+
// 设置提示信息
|
|
147
|
+
queryParam.setMessage(ResManager.loadKDString("查询完成", "ReportFormPluginTemplate_1", RES_APP_ID));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 触发时机: 报表查询执行后。
|
|
152
|
+
* 参数要点: queryParam 保留本次查询上下文。
|
|
153
|
+
* 典型用途: 查询完成后输出提示、记录日志或刷新附属区域。
|
|
154
|
+
*/
|
|
155
|
+
@Override
|
|
156
|
+
public void afterQuery(ReportQueryParam queryParam) {
|
|
157
|
+
super.afterQuery(queryParam);
|
|
158
|
+
this.getView().showTipNotification(ResManager.loadKDString("报表查询完成", "ReportFormPluginTemplate_2", RES_APP_ID));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* 触发时机: 报表列创建后。
|
|
163
|
+
* 参数要点: event 可调整列标题、宽度、隐藏状态等。
|
|
164
|
+
* 典型用途: 动态调整列显示方式或列元数据。
|
|
165
|
+
*/
|
|
166
|
+
@Override
|
|
167
|
+
public void afterCreateColumn(CreateColumnEvent event) {
|
|
168
|
+
super.afterCreateColumn(event);
|
|
169
|
+
this.getView().showTipNotification(ResManager.loadKDString("报表列初始化完成", "ReportFormPluginTemplate_3", RES_APP_ID));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 触发时机: 打包单元格数据时。
|
|
174
|
+
* 参数要点: packageDataEvent 含当前行列数据上下文。
|
|
175
|
+
* 典型用途: 对界面展示值做格式化;该事件通常不用于导出逻辑。
|
|
176
|
+
*/
|
|
177
|
+
@Override
|
|
178
|
+
public void packageData(PackageDataEvent packageDataEvent) {
|
|
179
|
+
super.packageData(packageDataEvent);
|
|
180
|
+
if (packageDataEvent.getSource() instanceof ReportColumn) {
|
|
181
|
+
DynamicObject dObject = packageDataEvent.getRowData();
|
|
182
|
+
String applyType = dObject.getString("kdec_applytype");
|
|
183
|
+
if ("A".equals(applyType)) {
|
|
184
|
+
ReportColumn column = (ReportColumn) packageDataEvent.getSource();
|
|
185
|
+
if (LOG.isDebugEnabled()) {
|
|
186
|
+
LOG.debug(String.format(
|
|
187
|
+
ResManager.loadKDString("当前报表列:%s", "ReportFormPluginTemplate_4", RES_APP_ID),
|
|
188
|
+
column.getFieldKey()
|
|
189
|
+
));
|
|
190
|
+
}
|
|
191
|
+
if ("kdec_totalday".equals(column.getFieldKey())) {
|
|
192
|
+
packageDataEvent.setFormatValue(100);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 触发时机: 行数据返回后、渲染前。
|
|
200
|
+
* 参数要点:
|
|
201
|
+
* - gridPK: 当前报表 grid 标识。
|
|
202
|
+
* - rowData: 查询结果行集合。
|
|
203
|
+
* - queryParam: 查询参数。
|
|
204
|
+
* 典型用途: 对查询结果行做补值、格式修正和显示增强。
|
|
205
|
+
*/
|
|
206
|
+
@Override
|
|
207
|
+
public void processRowData(String gridPK, DynamicObjectCollection rowData, ReportQueryParam queryParam) {
|
|
208
|
+
super.processRowData(gridPK, rowData, queryParam);
|
|
209
|
+
if (!GRID_KEY.equals(gridPK)) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
for (DynamicObject row : rowData) {
|
|
213
|
+
if (row.get("name") == null) {
|
|
214
|
+
row.set("name", ResManager.loadKDString("未命名", "ReportFormPluginTemplate_5", RES_APP_ID));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 触发时机: 导出分批数据预处理时。
|
|
221
|
+
* 参数要点: data 为当前待导出的数据集合。
|
|
222
|
+
* 典型用途: 导出前补值、替换导出文本或标准化数值格式。
|
|
223
|
+
*/
|
|
224
|
+
@Override
|
|
225
|
+
public void preProcessExportData(List exportColumns,
|
|
226
|
+
DynamicObjectCollection data,
|
|
227
|
+
NumberFormatProvider numberFormatProvider) {
|
|
228
|
+
super.preProcessExportData(exportColumns, data, numberFormatProvider);
|
|
229
|
+
for (DynamicObject row : data) {
|
|
230
|
+
if (row.get("name") == null) {
|
|
231
|
+
row.set("name", ResManager.loadKDString("导出默认名称", "ReportFormPluginTemplate_6", RES_APP_ID));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 触发时机: 设置导出 Excel 文件名时。
|
|
238
|
+
* 参数要点: list 为导出文件名片段集合。
|
|
239
|
+
* 典型用途: 自定义导出文件名,便于区分组织、期间或报表类型。
|
|
240
|
+
*/
|
|
241
|
+
@Override
|
|
242
|
+
public void setExcelName(List list) {
|
|
243
|
+
super.setExcelName(list);
|
|
244
|
+
list.add("report_export");
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* 触发时机: 初始化列排序和过滤能力时。
|
|
249
|
+
* 参数要点: allColumns 为全部列定义。
|
|
250
|
+
* 典型用途: 控制列是否支持排序、列头过滤等交互行为。
|
|
251
|
+
*/
|
|
252
|
+
@Override
|
|
253
|
+
public void setSortAndFilter(List allColumns) {
|
|
254
|
+
super.setSortAndFilter(allColumns);
|
|
255
|
+
this.getView().showTipNotification(ResManager.loadKDString("初始化排序与过滤能力", "ReportFormPluginTemplate_7", RES_APP_ID));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
package kd.cd.common;
|
|
2
|
+
|
|
3
|
+
import kd.bos.algo.DataSet;
|
|
4
|
+
import kd.bos.entity.report.*;
|
|
5
|
+
import kd.bos.orm.query.QFilter;
|
|
6
|
+
import kd.bos.servicehelper.QueryServiceHelper;
|
|
7
|
+
|
|
8
|
+
import java.util.List;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 报表取数插件骨架模板(原生 AbstractReportListDataPlugin)。
|
|
12
|
+
* 该类仅用于示例写法,生成后请按实际业务删除无用事件并替换占位常量。
|
|
13
|
+
*/
|
|
14
|
+
public class ReportListDataPluginTemplate extends AbstractReportListDataPlugin {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 触发时机: 在需要了解当前插件可访问上下文能力时调用。
|
|
18
|
+
* 参数要点: 无入参;仅展示当前插件可通过 this. 访问的方法能力。
|
|
19
|
+
* 典型用途: 作为模板提示,指导在各事件内选择正确的上下文 API。
|
|
20
|
+
*/
|
|
21
|
+
private void getContextSample() {
|
|
22
|
+
// this.getQueryParam();
|
|
23
|
+
// this.getSelectedObj();
|
|
24
|
+
// this.setProgress(30);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private static final String QUERY_KEY = "report-query";
|
|
28
|
+
private static final String ENTITY_NAME = "entity_name";
|
|
29
|
+
private static final String SELECT_FIELDS = "id,billno,name";
|
|
30
|
+
private static final String ORDER_BY = "id desc";
|
|
31
|
+
private static final String FIELD_BILL_NO = "billno";
|
|
32
|
+
|
|
33
|
+
// ===== 核心事件 =====
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 触发时机: 报表发起查询时。
|
|
37
|
+
* 参数要点:
|
|
38
|
+
* - queryParam.getFilter() 为过滤面板条件。
|
|
39
|
+
* - selectedObj 为左侧树或左表选中对象。
|
|
40
|
+
* 典型用途: 按查询条件与左侧选中对象组装 DataSet。
|
|
41
|
+
*/
|
|
42
|
+
@Override
|
|
43
|
+
public DataSet query(ReportQueryParam queryParam, Object selectedObj) {
|
|
44
|
+
super.query(queryParam, selectedObj);
|
|
45
|
+
FilterInfo filter = queryParam.getFilter();
|
|
46
|
+
int top = 1000;
|
|
47
|
+
QFilter[] filters = filter == null ? null : filter.getQFilters().toArray(new QFilter[0]);
|
|
48
|
+
this.setProgress(20);
|
|
49
|
+
return QueryServiceHelper.queryDataSet(QUERY_KEY, ENTITY_NAME, SELECT_FIELDS, filters, ORDER_BY, top);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 触发时机: 报表初始化列定义后。
|
|
54
|
+
* 参数要点: columns 为系统生成的列集合,可调整显示列属性。
|
|
55
|
+
* 典型用途: 动态隐藏列、修改列宽、冻结列或调整显示顺序。
|
|
56
|
+
*/
|
|
57
|
+
@Override
|
|
58
|
+
public List<AbstractReportColumn> getColumns(List<AbstractReportColumn> columns) {
|
|
59
|
+
super.getColumns(columns);
|
|
60
|
+
for (int i = 0; i < columns.size(); i++) {
|
|
61
|
+
ReportColumn rColumn = (ReportColumn) columns.get(i);
|
|
62
|
+
String key = rColumn.getFieldKey();
|
|
63
|
+
if (key.equals("textfield")) {
|
|
64
|
+
rColumn.setFreeze(true);
|
|
65
|
+
columns.set(i, rColumn);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return columns;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
package kd.cd.common;
|
|
2
|
+
|
|
3
|
+
import kd.bos.dataentity.resource.ResManager;
|
|
4
|
+
import kd.bos.form.control.Search;
|
|
5
|
+
import kd.bos.form.control.events.BeforeItemClickEvent;
|
|
6
|
+
import kd.bos.form.control.events.SearchEnterEvent;
|
|
7
|
+
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
8
|
+
import kd.bos.form.events.ClosedCallBackEvent;
|
|
9
|
+
import kd.bos.form.events.MessageBoxClosedEvent;
|
|
10
|
+
import kd.bos.form.operate.AbstractOperate;
|
|
11
|
+
import kd.bos.list.plugin.StandardTreeListPlugin;
|
|
12
|
+
|
|
13
|
+
import java.util.EventObject;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 标准树列表插件骨架模板(原生 StandardTreeListPlugin)。
|
|
17
|
+
* 该类仅用于示例写法,生成后请按实际业务删除无用事件并替换占位常量。
|
|
18
|
+
*/
|
|
19
|
+
public class StandardTreeListPluginTemplate extends StandardTreeListPlugin {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 触发时机: 在需要了解当前插件可访问上下文能力时调用。
|
|
23
|
+
* 参数要点: 无入参;仅展示当前插件可通过 this. 访问的方法能力。
|
|
24
|
+
* 典型用途: 作为模板提示,指导在各事件内选择正确的上下文 API。
|
|
25
|
+
*/
|
|
26
|
+
private void getContextSample() {
|
|
27
|
+
// this.getTreeListView();
|
|
28
|
+
// this.getTreeModel();
|
|
29
|
+
// this.getView();
|
|
30
|
+
// this.getModel();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private static final String OP_DELETE = "delete";
|
|
34
|
+
private static final String OP_DISABLE = "disable";
|
|
35
|
+
private static final String RES_APP_ID = "kd-cd-common-template";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 触发时机: 插件注册监听阶段。
|
|
39
|
+
* 参数要点: e 为通用事件对象。
|
|
40
|
+
* 典型用途: 注册树工具栏、搜索框等监听器。
|
|
41
|
+
*/
|
|
42
|
+
@Override
|
|
43
|
+
public void registerListener(EventObject e) {
|
|
44
|
+
super.registerListener(e);
|
|
45
|
+
this.addItemClickListeners("tree_toolbar");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 触发时机: 工具栏项点击前。
|
|
51
|
+
* 参数要点: evt.getItemKey() 标识当前按钮,可取消默认处理。
|
|
52
|
+
* 典型用途: 在删除、停用前做前置校验或弹框确认。
|
|
53
|
+
*/
|
|
54
|
+
@Override
|
|
55
|
+
public void beforeItemClick(BeforeItemClickEvent evt) {
|
|
56
|
+
super.beforeItemClick(evt);
|
|
57
|
+
if (OP_DELETE.equals(evt.getItemKey()) && this.getSelectedRows().isEmpty()) {
|
|
58
|
+
evt.setCancel(true);
|
|
59
|
+
this.getView().showErrorNotification(ResManager.loadKDString("请先选择数据", "StandardTreeListPluginTemplate_0", RES_APP_ID));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 触发时机: 标准操作执行前。
|
|
65
|
+
* 参数要点:
|
|
66
|
+
* - (AbstractOperate) args.getSource(): 获取操作对象。
|
|
67
|
+
* - operate.getOperateKey(): 获取操作标识。
|
|
68
|
+
* - args.setCancel(true): 取消操作。
|
|
69
|
+
* 典型用途: 在停用、删除等操作前校验选择数据是否合法。
|
|
70
|
+
*/
|
|
71
|
+
@Override
|
|
72
|
+
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
|
73
|
+
super.beforeDoOperation(args);
|
|
74
|
+
AbstractOperate operate = (AbstractOperate) args.getSource();
|
|
75
|
+
if (OP_DISABLE.equals(operate.getOperateKey()) && this.getSelectedRows().isEmpty()) {
|
|
76
|
+
args.setCancel(true);
|
|
77
|
+
this.getView().showErrorNotification(ResManager.loadKDString("请先选择数据", "StandardTreeListPluginTemplate_1", RES_APP_ID));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 触发时机: 左树搜索回车时。
|
|
83
|
+
* 参数要点: evt 携带搜索关键字。
|
|
84
|
+
* 典型用途: 过滤树节点或联动刷新右侧数据。
|
|
85
|
+
*/
|
|
86
|
+
@Override
|
|
87
|
+
public void search(SearchEnterEvent evt) {
|
|
88
|
+
super.search(evt);
|
|
89
|
+
Search search = (Search) evt.getSource();
|
|
90
|
+
//搜索控件标识,可以根据该标识,判断是哪个控件,然后做逻辑处理
|
|
91
|
+
String key = search.getKey();
|
|
92
|
+
//搜索的文本内容
|
|
93
|
+
this.getView().showTipNotification(String.format(
|
|
94
|
+
ResManager.loadKDString("树搜索关键字:%s", "StandardTreeListPluginTemplate_2", RES_APP_ID),
|
|
95
|
+
evt.getText()
|
|
96
|
+
));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 触发时机: 左树工具栏按钮点击时。
|
|
101
|
+
* 参数要点: e 可识别当前点击来源。
|
|
102
|
+
* 典型用途: 处理新增分组、刷新分组、展开节点等动作。
|
|
103
|
+
*/
|
|
104
|
+
@Override
|
|
105
|
+
public void treeToolbarClick(EventObject e) {
|
|
106
|
+
super.treeToolbarClick(e);
|
|
107
|
+
this.getView().showTipNotification(ResManager.loadKDString("已触发标准树列表工具栏动作", "StandardTreeListPluginTemplate_3", RES_APP_ID));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 触发时机: 确认框关闭后。
|
|
112
|
+
* 参数要点: event.getResult() 可判断用户确认结果。
|
|
113
|
+
* 典型用途: 处理删除、停用等二次确认后的后续逻辑。
|
|
114
|
+
*/
|
|
115
|
+
@Override
|
|
116
|
+
public void confirmCallBack(MessageBoxClosedEvent event) {
|
|
117
|
+
super.confirmCallBack(event);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 触发时机: 子页面关闭回调时。
|
|
122
|
+
* 参数要点: closedCallBackEvent 可读取返回动作与回参。
|
|
123
|
+
* 典型用途: 子页面关闭后刷新当前树列表。
|
|
124
|
+
*/
|
|
125
|
+
@Override
|
|
126
|
+
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
|
127
|
+
super.closedCallBack(closedCallBackEvent);
|
|
128
|
+
this.reload();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
package kd.cd.common;
|
|
2
|
+
|
|
3
|
+
import kd.bos.context.RequestContext;
|
|
4
|
+
import kd.bos.dataentity.resource.ResManager;
|
|
5
|
+
import kd.bos.exception.KDException;
|
|
6
|
+
import kd.bos.schedule.executor.AbstractTask;
|
|
7
|
+
|
|
8
|
+
import java.util.HashMap;
|
|
9
|
+
import java.util.Map;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 后台任务骨架模板(原生 AbstractTask)。
|
|
13
|
+
* 该类仅用于示例写法,生成后请按实际业务删除无用逻辑并替换占位常量。
|
|
14
|
+
*/
|
|
15
|
+
public class TaskTemplate extends AbstractTask {
|
|
16
|
+
private static final String RES_APP_ID = "kd-cd-common-template";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 触发时机: 在需要了解当前插件可访问上下文能力时调用。
|
|
20
|
+
* 参数要点: 无入参;仅展示当前插件可通过 this. 访问的方法能力。
|
|
21
|
+
* 典型用途: 作为模板提示,指导在各事件内选择正确的上下文 API。
|
|
22
|
+
*/
|
|
23
|
+
private void getContextSample() {
|
|
24
|
+
// this.getTaskId();
|
|
25
|
+
// this.checkIsStop();
|
|
26
|
+
// this.isStop();
|
|
27
|
+
// this.feedbackProgress(10);
|
|
28
|
+
// this.feedbackProgress(30, "处理中", null);
|
|
29
|
+
// this.feedbackCustomdata(new java.util.HashMap<>());
|
|
30
|
+
// this.getMessageHandler();
|
|
31
|
+
// this.setTaskId("task-id");
|
|
32
|
+
// this.isSupportReSchedule();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ===== 核心事件 =====
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 触发时机: 调度中心触发任务执行时。
|
|
39
|
+
* 参数要点:
|
|
40
|
+
* - context: 请求上下文,包含用户、组织、租户等信息。
|
|
41
|
+
* - params: 调度参数 map,通常承载任务业务入参。
|
|
42
|
+
* 典型用途: 编排任务主流程、分阶段回传进度、按需检查中止标记。
|
|
43
|
+
*/
|
|
44
|
+
@Override
|
|
45
|
+
public void execute(RequestContext context, Map<String, Object> params) throws KDException {
|
|
46
|
+
super.execute(context, params);
|
|
47
|
+
this.feedbackProgress(0, ResManager.loadKDString("任务开始", "TaskTemplate_0", RES_APP_ID), null);
|
|
48
|
+
|
|
49
|
+
Object taskParam = params == null ? null : params.get("taskParam");
|
|
50
|
+
doStep(taskParam);
|
|
51
|
+
|
|
52
|
+
this.checkIsStop();
|
|
53
|
+
|
|
54
|
+
Map<String, Object> customData = new HashMap<>();
|
|
55
|
+
customData.put("result", "ok");
|
|
56
|
+
customData.put("taskParam", taskParam);
|
|
57
|
+
this.feedbackProgress(100, ResManager.loadKDString("任务完成", "TaskTemplate_1", RES_APP_ID), customData);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 触发时机: 调度中心主动停止任务时。
|
|
62
|
+
* 参数要点: 可在停止前做资源释放、状态补偿、最后一次进度反馈。
|
|
63
|
+
* 典型用途: 安全退出长任务,避免中途停止导致资源未释放。
|
|
64
|
+
*/
|
|
65
|
+
@Override
|
|
66
|
+
public void stop() throws KDException {
|
|
67
|
+
super.stop();
|
|
68
|
+
this.feedbackProgress(95, ResManager.loadKDString("收到停止指令,准备安全退出", "TaskTemplate_2", RES_APP_ID), null);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private void doStep(Object taskParam) {
|
|
72
|
+
if (taskParam == null) {
|
|
73
|
+
this.feedbackProgress(30, ResManager.loadKDString("未传入 taskParam,按默认逻辑执行", "TaskTemplate_3", RES_APP_ID), null);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
Map<String, Object> customData = new HashMap<>();
|
|
77
|
+
customData.put("taskParam", taskParam);
|
|
78
|
+
this.feedbackProgress(60, ResManager.loadKDString("正在处理 taskParam", "TaskTemplate_4", RES_APP_ID), customData);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
package kd.cd.common;
|
|
2
|
+
|
|
3
|
+
import kd.bos.dataentity.resource.ResManager;
|
|
4
|
+
import kd.bos.form.ShowType;
|
|
5
|
+
import kd.bos.form.control.Search;
|
|
6
|
+
import kd.bos.form.control.events.RefreshNodeEvent;
|
|
7
|
+
import kd.bos.form.control.events.SearchEnterEvent;
|
|
8
|
+
import kd.bos.form.control.events.TreeNodeEvent;
|
|
9
|
+
import kd.bos.list.events.BeforeShowBillFormEvent;
|
|
10
|
+
import kd.bos.list.events.BuildTreeListFilterEvent;
|
|
11
|
+
import kd.bos.list.plugin.AbstractTreeListPlugin;
|
|
12
|
+
import kd.bos.orm.query.QCP;
|
|
13
|
+
import kd.bos.orm.query.QFilter;
|
|
14
|
+
|
|
15
|
+
import java.util.EventObject;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 左树右表列表插件骨架模板(原生 AbstractTreeListPlugin)。
|
|
19
|
+
* 该类仅用于示例写法,生成后请按实际业务删除无用事件并替换占位常量。
|
|
20
|
+
*/
|
|
21
|
+
public class TreeListPluginTemplate extends AbstractTreeListPlugin {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 触发时机: 在需要了解当前插件可访问上下文能力时调用。
|
|
25
|
+
* 参数要点: 无入参;仅展示当前插件可通过 this. 访问的方法能力。
|
|
26
|
+
* 典型用途: 作为模板提示,指导在各事件内选择正确的上下文 API。
|
|
27
|
+
*/
|
|
28
|
+
private void getContextSample() {
|
|
29
|
+
// this.getTreeListView();
|
|
30
|
+
// this.getTreeModel();
|
|
31
|
+
// this.getView();
|
|
32
|
+
// this.getModel();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private static final String FIELD_GROUP = "group.id";
|
|
36
|
+
private static final String TREE_NODE_ALL = "0";
|
|
37
|
+
private static final String RES_APP_ID = "kd-cd-common-template";
|
|
38
|
+
|
|
39
|
+
// ===== 核心事件 =====
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 触发时机: 视图初始化后、事件注册阶段。
|
|
43
|
+
* 参数要点: e 为通用事件对象,通常用于注册监听。
|
|
44
|
+
* 典型用途: 注册树搜索框、工具栏等监听。
|
|
45
|
+
*/
|
|
46
|
+
@Override
|
|
47
|
+
public void registerListener(EventObject e) {
|
|
48
|
+
super.registerListener(e);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 触发时机: 左树首次构建时,以及树模型重新创建时。
|
|
53
|
+
* 参数要点: 此时已可通过 this.getTreeModel() 访问树模型。
|
|
54
|
+
* 典型用途: 设置根节点、默认展开层级、默认筛选条件。
|
|
55
|
+
*/
|
|
56
|
+
@Override
|
|
57
|
+
public void initializeTree(EventObject e) {
|
|
58
|
+
super.initializeTree(e);
|
|
59
|
+
if (this.getTreeModel() != null) {
|
|
60
|
+
this.getTreeModel().setRootVisable(true);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 触发时机: 树节点点击后。
|
|
66
|
+
* 参数要点: e 可读取当前节点信息。
|
|
67
|
+
* 典型用途: 切换右侧列表数据范围、刷新按钮状态或页面提示。
|
|
68
|
+
*/
|
|
69
|
+
@Override
|
|
70
|
+
public void treeNodeClick(TreeNodeEvent e) {
|
|
71
|
+
super.treeNodeClick(e);
|
|
72
|
+
this.reload();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 触发时机: 树节点刷新时。
|
|
77
|
+
* 参数要点: e 指向当前待刷新的节点。
|
|
78
|
+
* 典型用途: 懒加载子节点、刷新节点状态或补充树结构。
|
|
79
|
+
*/
|
|
80
|
+
@Override
|
|
81
|
+
public void refreshNode(RefreshNodeEvent e) {
|
|
82
|
+
super.refreshNode(e);
|
|
83
|
+
this.getView().showTipNotification(String.format(
|
|
84
|
+
ResManager.loadKDString("刷新树节点:%s", "TreeListPluginTemplate_0", RES_APP_ID),
|
|
85
|
+
e.getNodeId()
|
|
86
|
+
));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 触发时机: 节点选中后构建右侧列表过滤时。
|
|
91
|
+
* 参数要点: e 可追加 QFilter 到右侧列表。
|
|
92
|
+
* 典型用途: 按当前节点 ID 生成右表过滤条件。
|
|
93
|
+
*/
|
|
94
|
+
@Override
|
|
95
|
+
public void buildTreeListFilter(BuildTreeListFilterEvent e) {
|
|
96
|
+
super.buildTreeListFilter(e);
|
|
97
|
+
// 生成过滤条件
|
|
98
|
+
QFilter filter = new QFilter("fieldKey", QCP.equals, "value");
|
|
99
|
+
e.addQFilter(filter);
|
|
100
|
+
e.setCancel(true); // 略过系统内置的分组过滤条件
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 触发时机: 左树工具栏初始化时。
|
|
105
|
+
* 参数要点: 可调整工具栏按钮可见性与可用状态。
|
|
106
|
+
* 典型用途: 初始化新增、删除、刷新等树工具栏按钮。
|
|
107
|
+
*/
|
|
108
|
+
@Override
|
|
109
|
+
public void initTreeToolbar(EventObject e) {
|
|
110
|
+
super.initTreeToolbar(e);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 触发时机: 左树工具栏按钮点击时。
|
|
115
|
+
* 参数要点: e 可识别按钮来源。
|
|
116
|
+
* 典型用途: 处理树节点新增、删除、刷新等动作。
|
|
117
|
+
*/
|
|
118
|
+
@Override
|
|
119
|
+
public void treeToolbarClick(EventObject e) {
|
|
120
|
+
super.treeToolbarClick(e);
|
|
121
|
+
this.getView().showTipNotification(ResManager.loadKDString("已触发左树工具栏动作", "TreeListPluginTemplate_1", RES_APP_ID));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 触发时机: 左树搜索框回车时。
|
|
126
|
+
* 参数要点: evt 包含搜索关键字。
|
|
127
|
+
* 典型用途: 按关键字过滤左树节点或触发远程搜索。
|
|
128
|
+
*/
|
|
129
|
+
@Override
|
|
130
|
+
public void search(SearchEnterEvent evt) {
|
|
131
|
+
super.search(evt);
|
|
132
|
+
Search search = (Search) evt.getSource();
|
|
133
|
+
//搜索控件标识,可以根据该标识,判断是哪个控件,然后做逻辑处理
|
|
134
|
+
String key = search.getKey();
|
|
135
|
+
//搜索的文本内容
|
|
136
|
+
this.getView().showTipNotification(String.format(
|
|
137
|
+
ResManager.loadKDString("树搜索关键字:%s", "TreeListPluginTemplate_2", RES_APP_ID),
|
|
138
|
+
evt.getText()
|
|
139
|
+
));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* 触发时机: 打开右侧单据详情前。
|
|
144
|
+
* 参数要点: e 可获取单据打开参数并追加自定义参数。
|
|
145
|
+
* 典型用途: 标记当前打开动作来源于左树右表场景。
|
|
146
|
+
*/
|
|
147
|
+
@Override
|
|
148
|
+
public void beforeShowBill(BeforeShowBillFormEvent e) {
|
|
149
|
+
super.beforeShowBill(e);
|
|
150
|
+
e.getParameter().getOpenStyle().setShowType(ShowType.Modal);
|
|
151
|
+
}
|
|
152
|
+
}
|