bpmax-cli 0.2.1-beta.76 → 0.2.1-beta.77
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/dist/bin.js +630 -8
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-page-composition-template-editor/SKILL.md +91 -2
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-dashboard.json +215 -6
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-visual-light.json +52 -3
package/package.json
CHANGED
|
@@ -69,11 +69,13 @@ bpmax-cli config page-template export --id <id> --out <dir> --profile <profile>
|
|
|
69
69
|
bpmax-cli config page-template lint --work <dir>/work/<file>.json --profile <profile> --format json
|
|
70
70
|
bpmax-cli config page-template impact --raw <dir>/raw/<file>.json --work <dir>/work/<file>.json --out <dir>/result/impact.json --profile <profile> --format json
|
|
71
71
|
bpmax-cli config page-template preview --work <dir>/work/<file>.json --out <dir>/preview --mode mock --format json
|
|
72
|
-
bpmax-cli config page-template build --work <dir>/work/<file>.json --meta <dir>/meta/<file>.meta.json --out <dir>/submit/<file>.json --profile <profile> --format json
|
|
73
|
-
bpmax-cli config page-template submit --id <id> --payload <dir>/submit/<file>.json --profile <profile> --
|
|
72
|
+
bpmax-cli config page-template build --work <dir>/work/<file>.json --meta <dir>/meta/<file>.meta.json --preview-manifest <dir>/preview/preview.manifest.json --out <dir>/submit/<file>.json --profile <profile> --format json
|
|
73
|
+
bpmax-cli config page-template submit --id <id> --payload <dir>/submit/<file>.json --profile <profile> --format json
|
|
74
74
|
bpmax-cli config page-template verify --id <id> --expect <dir>/work/<file>.json --profile <profile> --format json
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
带有 `build --preview-manifest` 生成且仍与 canonical payload hash 匹配的 page-template submit payload,会复用该 manifest 作为确认凭据,因此不再要求重复传入 `--confirm`。显式传入 `--dry-run` 始终只输出计划、不写远端;缺少或过期 manifest 的真实写入会在远端请求前阻断。若额外传入 `--confirm`,其值必须与目标对象匹配,否则在远端请求前拒绝。
|
|
78
|
+
|
|
77
79
|
## 数据层查询引擎(默认 ES)
|
|
78
80
|
|
|
79
81
|
`template.data.queries.<name>.engine` 只允许 `es`、`sql`、`api`,CLI 在 lint/build/preview 时规范化并写入 canonical payload、lint 结果 `page_template_queries` 和 `data-trace.json` 的 `query_engines`。
|
|
@@ -97,12 +99,99 @@ bpmax-cli config page-template verify --id <id> --expect <dir>/work/<file>.json
|
|
|
97
99
|
```
|
|
98
100
|
|
|
99
101
|
`row_mapping` 只允许安全的字段点路径,不能执行表达式;CLI lint/build 会规范为 snake_case 的 `row_mapping` 并拒绝非法路径。模板应优先使用这些通用字段,业务字段仍可从原始 ES 行读取。
|
|
102
|
+
|
|
103
|
+
服务端筛选字段也必须在列表查询上显式声明,并保持逻辑控件名与 ES 字段的映射稳定。只允许 `status`、`keyword`、`owner` 和 `created_date` 四个逻辑键;`createdDate` 仅作为输入兼容别名,lint/build 会规范为 `created_date`。字段值只能是安全的 ES 点路径,不能写表达式或从当前结果行推导:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"filterMode": "server",
|
|
108
|
+
"filterGroup": "dashboard",
|
|
109
|
+
"filter_fields": {
|
|
110
|
+
"status": "status",
|
|
111
|
+
"keyword": "xmmc1",
|
|
112
|
+
"owner": "__owner_id",
|
|
113
|
+
"created_date": "__create_time"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`filter_fields` 只能用于 `engine: "es"` 的 `/project/list` 查询,并应与对应聚合查询使用同一个 `filterGroup`。筛选按钮提交后,运行时会把逻辑控件转换为受控的 term/wildcard/range ES 查询并刷新整组查询;不要把 `filter_fields` 放在聚合查询、SQL 查询或客户端查询体中。CLI lint 会拒绝未知逻辑键、危险字段路径、重复的 `created_date`/`createdDate` 声明和未声明 `filterMode: "server"` 的映射。
|
|
119
|
+
|
|
120
|
+
交互筛选的 `filterGroup` 必须是稳定的字母开头名称(例如 `dashboard`)。为避免刷新时列表和聚合失去同步,带 `filterGroup` 的 `/project/list` 查询必须同时声明 `filterMode: "server"` 和完整的 `filter_fields`;聚合查询使用相同的 `filterGroup`。固定的 `params.query` 在受控字段上只能使用 `term` 或 `terms`,不能使用 `raw`、`range`、`wildcard` 等无法与用户输入安全求交的条件;这类配置会在 lint 阶段失败,而不是等到点击筛选后才报错。只有没有列表成员的聚合组会给出 `page_template.filter.group_list_missing` warning,因为它没有可供交互刷新挂载的列表查询。
|
|
100
121
|
- 服务端只在请求体含 `data_set_id|data_set_key|query|is_select_all|_source|aggs` 时走 ES。未声明 engine 且不含这些字段的 `/project/list` 查询会被 lint 拒绝(`page_template.query.implicit_sql`),不能静默走 SQL。
|
|
101
122
|
- ES 查询没有 fixture 回退;空结果或请求失败要按实际数据展示空态或错误,不能用样例行冒充 ES 结果。
|
|
102
123
|
- 确需 SQL(例如跨多个业务流程、没有统一数据集)时显式写 `engine: "sql"` 并填写 `reason`;`sql` 查询不得携带 ES 字段。不要为跨流程看板凭空指定某个数据集。
|
|
103
124
|
- 自定义接口使用 `engine: "api"`,不得指向 `/project/list`。
|
|
104
125
|
- 数据集 key/id 必须来自真实配置 readback(如 `bpmax-cli config dataset export` 或 `project search` 验证有数据),不能猜测。
|
|
105
126
|
|
|
127
|
+
### ES 聚合查询
|
|
128
|
+
|
|
129
|
+
看板的全量 KPI、状态分布、负责人分布和时间趋势必须由服务端 ES 聚合生成,不能从 `page_size=20` 的 `projectRows` 在浏览器逐行统计。使用受控的 `/project/aggregate` 查询,并与列表查询通过相同的 `filterGroup` 绑定:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"projects": {
|
|
134
|
+
"engine": "es",
|
|
135
|
+
"resource": "/project/list",
|
|
136
|
+
"method": "POST",
|
|
137
|
+
"filterMode": "server",
|
|
138
|
+
"filterGroup": "dashboard",
|
|
139
|
+
"filter_fields": {
|
|
140
|
+
"status": "status",
|
|
141
|
+
"keyword": "xmmc1",
|
|
142
|
+
"owner": "__owner_id",
|
|
143
|
+
"created_date": "__create_time"
|
|
144
|
+
},
|
|
145
|
+
"params": {
|
|
146
|
+
"data_set_key": "main",
|
|
147
|
+
"flow_type": "flow636354625",
|
|
148
|
+
"flow_key": ""
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"dashboardStats": {
|
|
152
|
+
"engine": "es",
|
|
153
|
+
"mode": "aggregate",
|
|
154
|
+
"resource": "/project/aggregate",
|
|
155
|
+
"method": "POST",
|
|
156
|
+
"params": {
|
|
157
|
+
"data_set_key": "main",
|
|
158
|
+
"flow_type": "flow636354625",
|
|
159
|
+
"flow_key": ""
|
|
160
|
+
},
|
|
161
|
+
"aggs": {
|
|
162
|
+
"by_status": { "type": "terms", "field": "status", "size": 8 },
|
|
163
|
+
"by_owner": { "type": "terms", "field": "__owner_id", "size": 20 },
|
|
164
|
+
"by_month": {
|
|
165
|
+
"type": "date_histogram",
|
|
166
|
+
"field": "__create_time",
|
|
167
|
+
"calendar_interval": "month"
|
|
168
|
+
},
|
|
169
|
+
"total_projects": { "type": "value_count", "field": "__id" }
|
|
170
|
+
},
|
|
171
|
+
"filterGroup": "dashboard"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
约定和限制:
|
|
177
|
+
|
|
178
|
+
- 聚合查询必须显式使用 `engine: "es"`、`mode: "aggregate"`、`resource: "/project/aggregate"` 和 `POST`,并提供真实数据集 `data_set_key` 或 `data_set_id`。使用 `data_set_key` 时必须能从配置或当前路由得到字符串 `flow_type` 和 `flow_key`(主流程的 `flow_key` 可以是空字符串);CLI lint 会在配置未写死流程范围时发出 `page_template.query.dataset_scope` warning,服务端仍会拒绝缺少流程范围的请求。
|
|
179
|
+
- 聚合查询参数只能包含数据集选择器(`data_set_key` 或 `data_set_id` 二选一)、流程范围(`flow_type`、`flow_key`)和受控的 `query`;不能传 `is_select_all`、分页、排序、hook、`_source` 或任意 ES DSL。
|
|
180
|
+
- 支持 `terms`、`date_histogram`、`sum`、`avg`、`min`、`max`、`stats`、`cardinality`、`value_count`。字段必须是安全的点路径;`terms.size` 不得超过 100,`terms.min_doc_count` 只接受 0–1000000 的整数,聚合总节点数和嵌套深度由 CLI 限制。
|
|
181
|
+
- 指标聚合(`sum`、`avg`、`min`、`max`、`stats`、`cardinality`、`value_count`)不能再包含子聚合;同一节点不能同时使用 `aggs` 和 `aggregations`。列表查询中的 `params.aggs`/`params.aggregations` 会被拒绝,因为列表接口不会执行这些统计,必须使用独立的 `mode: "aggregate"` 查询。
|
|
182
|
+
- 不得配置 `script`、`runtime_mappings`、任意 `query/body/dsl`、原始 `aggregations` 或客户端指定的 ES index。数据集、工作区、项目可见性、负责人和权限过滤由服务端解析并执行。
|
|
183
|
+
- 列表查询和聚合查询使用相同的 `filterGroup`。筛选按钮触发该组的服务端刷新,聚合请求不携带分页参数;刷新后图表和 KPI 必须继续读取聚合响应。
|
|
184
|
+
- `/project/aggregate` 返回标准化 `aggregations`。模板方法可以读取 `queryAggregations('dashboardStats')`,但不应以当前分页行数推导全量指标;空聚合和 ES 错误必须显示可恢复空态/错误态。
|
|
185
|
+
- `page-chart` 绑定聚合时应显式传入 `:aggregation="dashboardAggregations.by_status"` 等值;聚合为空表示真实的空态,组件不会回退到当前页 rows。状态桶可传 `:aggregation-labels="statusLabels"`,负责人 ID 桶可用 `aggregation-label-prefix="负责人 "` 或由模板提供独立、完整的负责人字典。`__project_owner` 是 nested 字段,不能直接作为这九种公开聚合的 terms field;若必须展示全量负责人名称,应先提供受控字典查询或由服务端返回 `key_as_string`,不能把当前 20 行当作全量字典。
|
|
186
|
+
- 运行时刷新失败会保留上次成功的列表、KPI 和聚合结果,并暴露错误与重试入口;模板仍应提供明确的刷新/重试操作,不得把错误伪装成空数据。
|
|
187
|
+
- CLI lint 会输出 `page_template_queries` 的 `mode` 和聚合摘要;preview 的 `data-trace.json` 只记录聚合名称、类型、字段和深度,不记录完整结果或源码。修改聚合定义后必须重新 lint、preview、build,旧 manifest 会因 canonical hash 失效。
|
|
188
|
+
|
|
189
|
+
聚合配置完成后按以下顺序验证,并使用真实数据集 readback 确认字段 mapping:
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
lint → preview --mode mock → build → submit --dry-run → verify → 运行页只读检查
|
|
193
|
+
```
|
|
194
|
+
|
|
106
195
|
### 筛选器选项必须独立于查询结果
|
|
107
196
|
|
|
108
197
|
状态、类型、负责人等筛选器的可选项是业务枚举或独立字典,不能从当前查询结果、分页结果或已筛选结果动态生成。否则服务端筛选返回 0 行或少量行时,下拉选项会错误地消失。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "项目运营数据看板",
|
|
3
3
|
"key": "project.operations.dashboard",
|
|
4
|
-
"intro": "
|
|
4
|
+
"intro": "只读项目运营看板:用状态、负责人、部门、仓库和需求月份判断处理负荷、资源压力与交付节奏。",
|
|
5
5
|
"template": {
|
|
6
6
|
"version": 1,
|
|
7
7
|
"entry": {
|
|
@@ -26,8 +26,102 @@
|
|
|
26
26
|
"data_set_key": "main",
|
|
27
27
|
"page": 1,
|
|
28
28
|
"page_size": 20,
|
|
29
|
-
"with_step": 1
|
|
29
|
+
"with_step": 1,
|
|
30
|
+
"flow_type": "flow636354625",
|
|
31
|
+
"flow_key": ""
|
|
32
|
+
},
|
|
33
|
+
"filterMode": "server",
|
|
34
|
+
"filterGroup": "dashboard",
|
|
35
|
+
"row_mapping": {
|
|
36
|
+
"id": "__id",
|
|
37
|
+
"name": "xmmc1.0",
|
|
38
|
+
"owner_id": "__owner_id",
|
|
39
|
+
"owner_name": "__project_owner.name",
|
|
40
|
+
"create_time": "__create_time",
|
|
41
|
+
"current_step_name": "current_step_name",
|
|
42
|
+
"department": "tjbm",
|
|
43
|
+
"request_date": "tjrq",
|
|
44
|
+
"need_date": "xqrq",
|
|
45
|
+
"request_reason": "sqyy",
|
|
46
|
+
"warehouse": "ckck",
|
|
47
|
+
"branch": "szfb"
|
|
48
|
+
},
|
|
49
|
+
"filter_fields": {
|
|
50
|
+
"status": "status",
|
|
51
|
+
"keyword": "xmmc1",
|
|
52
|
+
"owner": "__owner_id",
|
|
53
|
+
"created_date": "__create_time"
|
|
30
54
|
}
|
|
55
|
+
},
|
|
56
|
+
"dashboardStats": {
|
|
57
|
+
"engine": "es",
|
|
58
|
+
"mode": "aggregate",
|
|
59
|
+
"resource": "/project/aggregate",
|
|
60
|
+
"method": "POST",
|
|
61
|
+
"params": {
|
|
62
|
+
"data_set_key": "main",
|
|
63
|
+
"flow_type": "flow636354625",
|
|
64
|
+
"flow_key": ""
|
|
65
|
+
},
|
|
66
|
+
"aggs": {
|
|
67
|
+
"by_status": {
|
|
68
|
+
"type": "terms",
|
|
69
|
+
"field": "status",
|
|
70
|
+
"size": 8
|
|
71
|
+
},
|
|
72
|
+
"by_owner": {
|
|
73
|
+
"type": "terms",
|
|
74
|
+
"field": "__owner_id",
|
|
75
|
+
"size": 20
|
|
76
|
+
},
|
|
77
|
+
"by_department": {
|
|
78
|
+
"type": "terms",
|
|
79
|
+
"field": "tjbm",
|
|
80
|
+
"size": 20
|
|
81
|
+
},
|
|
82
|
+
"by_warehouse": {
|
|
83
|
+
"type": "terms",
|
|
84
|
+
"field": "ckck",
|
|
85
|
+
"size": 20
|
|
86
|
+
},
|
|
87
|
+
"by_branch": {
|
|
88
|
+
"type": "terms",
|
|
89
|
+
"field": "szfb",
|
|
90
|
+
"size": 12
|
|
91
|
+
},
|
|
92
|
+
"by_month": {
|
|
93
|
+
"type": "date_histogram",
|
|
94
|
+
"field": "__create_time",
|
|
95
|
+
"calendar_interval": "month"
|
|
96
|
+
},
|
|
97
|
+
"by_demand_month": {
|
|
98
|
+
"type": "date_histogram",
|
|
99
|
+
"field": "xqrq",
|
|
100
|
+
"calendar_interval": "month"
|
|
101
|
+
},
|
|
102
|
+
"by_apply_month": {
|
|
103
|
+
"type": "date_histogram",
|
|
104
|
+
"field": "tjrq",
|
|
105
|
+
"calendar_interval": "month"
|
|
106
|
+
},
|
|
107
|
+
"department_count": {
|
|
108
|
+
"type": "cardinality",
|
|
109
|
+
"field": "tjbm"
|
|
110
|
+
},
|
|
111
|
+
"warehouse_count": {
|
|
112
|
+
"type": "cardinality",
|
|
113
|
+
"field": "ckck"
|
|
114
|
+
},
|
|
115
|
+
"owner_count": {
|
|
116
|
+
"type": "cardinality",
|
|
117
|
+
"field": "__owner_id"
|
|
118
|
+
},
|
|
119
|
+
"total_projects": {
|
|
120
|
+
"type": "value_count",
|
|
121
|
+
"field": "__id"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"filterGroup": "dashboard"
|
|
31
125
|
}
|
|
32
126
|
},
|
|
33
127
|
"methods": {},
|
|
@@ -150,14 +244,127 @@
|
|
|
150
244
|
}
|
|
151
245
|
},
|
|
152
246
|
"render": {
|
|
153
|
-
"template": "<main class=\"ops-dashboard\">\n <header class=\"dashboard-header\">\n <div>\n <p class=\"dashboard-eyebrow\">OPERATIONS / PAGE COMPOSITION</p>\n <h1>{{ template.name || '项目运营数据看板' }}</h1>\n <p class=\"dashboard-subtitle\">{{ template.intro || '用统一页面模板组合项目指标、状态分布和处理列表。' }}</p>\n </div>\n <div class=\"dashboard-actions\">\n <el-button class=\"dashboard-button\" type=\"primary\" :loading=\"dashboardRefreshing\" :disabled=\"dashboardRefreshing\" @click=\"refreshAll\">\n {{ dashboardRefreshing ? '刷新中…' : '刷新数据' }}\n </el-button>\n <el-button class=\"dashboard-button dashboard-button-muted\" plain @click=\"clearSelection\">清除选择</el-button>\n </div>\n </header>\n\n <div v-if=\"runtimeError\" class=\"dashboard-alert\" role=\"alert\">{{ runtimeError }}</div>\n\n <section class=\"dashboard-kpis\" aria-label=\"项目指标\">\n <article v-for=\"metric in dashboardMetrics\" :key=\"metric.key\" class=\"dashboard-kpi\" :class=\"'tone-' + metric.tone\">\n <span>{{ metric.label }}</span>\n <strong>{{ metric.value }}</strong>\n </article>\n </section>\n\n <section class=\"dashboard-charts\" aria-label=\"项目图表\">\n <page-chart chart-type=\"status-donut\" title=\"项目状态构成\" :rows=\"projectRows\" />\n <page-chart chart-type=\"owner-bar\" title=\"负责人项目量\" :rows=\"projectRows\" />\n <page-chart chart-type=\"
|
|
154
|
-
"style": ".ops-dashboard { min-height: 100%; padding: 24px 32px 48px; background: #f5f7fa; color: #1f2937; }\n.dashboard-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }\n.dashboard-eyebrow, .dashboard-overline { margin: 0; color: #2563eb; font-size: 11px; font-weight: 700; letter-spacing: .12em; }\n.dashboard-header h1 { margin: 6px 0; font-size: 26px; letter-spacing: -.02em; }\n.dashboard-subtitle { max-width: 680px; margin: 0; color: #64748b; line-height: 1.6; }\n.dashboard-actions { display: flex; gap: 8px; flex-wrap: wrap; }\n.dashboard-button, .dashboard-close { min-height: 44px; padding: 9px 14px; border: 1px solid #2563eb; border-radius: 8px; background: #2563eb; color: #fff; cursor: pointer; }\n.dashboard-button-muted, .dashboard-close { border-color: #cbd5e1; background: #fff; color: #334155; }\n.dashboard-button:focus-visible, .dashboard-close:focus-visible, .dashboard-status-row:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }\n.dashboard-button:disabled { cursor: not-allowed; opacity: .55; }\n.dashboard-alert { margin-top: 16px; padding: 12px 16px; border: 1px solid #fecaca; border-radius: 10px; background: #fff1f2; color: #991b1b; }\n.dashboard-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }\n.dashboard-kpi { position: relative; min-height: 104px; padding: 16px 18px; box-sizing: border-box; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; overflow: hidden; }\n.dashboard-kpi:before { position: absolute; inset: 0 auto 0 0; width: 4px; content: ''; background: #2563eb; }\n.dashboard-kpi.tone-amber:before { background: #d97706; } .dashboard-kpi.tone-violet:before { background: #7c3aed; } .dashboard-kpi.tone-green:before { background: #16a34a; }\n.dashboard-kpi span { display: block; color: #64748b; font-size: 12px; } .dashboard-kpi strong { display: block; margin-top: 12px; font-size: 28px; font-variant-numeric: tabular-nums; } .dashboard-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }\n.dashboard-grid { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(260px, .8fr) minmax(460px, 1.8fr); gap: 16px; margin-top: 16px; align-items: start; }\n.dashboard-charts .page-composition-chart { min-width: 0; }\n.dashboard-panel { min-width: 0; padding: 20px; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; }\n.dashboard-list-panel { grid-column: 1 / -1; } .dashboard-detail-panel { grid-column: 1 / -1; }\n.dashboard-panel-heading, .dashboard-drawer-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }\n.dashboard-panel-heading h2, .dashboard-drawer-heading h2 { margin: 4px 0 0; font-size: 17px; } .dashboard-panel-heading > span { color: #64748b; font-size: 12px; }\n.dashboard-status-list { display: grid; gap: 4px; } .dashboard-status-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; min-height: 52px; padding: 8px 0; border: 0; border-bottom: 1px solid #f1f5f9; background: transparent; color: #334155; text-align: left; cursor: pointer; }\n.dashboard-status-row.is-active .dashboard-status-label, .dashboard-status-row:hover .dashboard-status-label { color: #2563eb; } .dashboard-status-label { display: flex; gap: 8px; align-items: center; }\n.dashboard-status-value { font-variant-numeric: tabular-nums; font-weight: 600; } .dashboard-progress { grid-column: 1 / -1; display: block; height: 5px; border-radius: 999px; background: #e2e8f0; overflow: hidden; } .dashboard-progress i { display: block; height: 100%; border-radius: inherit; background: #60a5fa; }\n.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; } .status-2, .status-6, .status-pending { background: #d97706; } .status-3, .status-processing { background: #7c3aed; } .status-4, .status-completed, .status-done { background: #16a34a; }\n.dashboard-label { display: block; margin: 12px 0 6px; color: #475569; font-size: 12px; font-weight: 600; } .dashboard-control { width: 100%; min-height: 42px; box-sizing: border-box; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1f2937; } .dashboard-element-control { min-height: 32px; padding: 0; } .dashboard-element-control.el-select, .dashboard-element-control.el-date-editor { display: block; } .dashboard-element-control .el-input__inner, .dashboard-element-control.el-input .el-input__inner { min-height: 32px; height: 32px; border-color: #cbd5e1; border-radius: 6px; background: #fff; color: #1f2937; } .dashboard-element-control .el-input__inner:focus { border-color: #2563eb; }\n.dashboard-control:focus { border-color: #2563eb; outline: 2px solid #bfdbfe; outline-offset: 1px; } .dashboard-selected { margin-top: 20px; padding: 12px; border-radius: 10px; background: #eff6ff; } .dashboard-selected span, .dashboard-selected small { display: block; color: #475569; font-size: 12px; } .dashboard-selected strong { display: block; margin: 5px 0; }\n.dashboard-empty { margin: 0; color: #64748b; font-size: 13px; } .dashboard-overlay { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; background: rgba(15, 23, 42, .32); } .dashboard-drawer { width: min(520px, 100vw); height: 100%; box-sizing: border-box; padding: 24px; overflow: auto; background: #fff; } .dashboard-drawer-project { margin: 0 0 20px; font-weight: 600; }\n@media (max-width: 1024px) { .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard-list-panel, .dashboard-detail-panel { grid-column: 1 / -1; } }\n@media (max-width: 1024px) { .dashboard-charts .page-composition-chart:last-child { grid-column: 1 / -1; } }\n@media (max-width: 720px) { .ops-dashboard { padding: 16px 16px 32px; } .dashboard-header { flex-direction: column; } .dashboard-kpis, .dashboard-charts, .dashboard-grid { grid-template-columns: 1fr; } .dashboard-list-panel, .dashboard-detail-panel { grid-column: auto; } }",
|
|
247
|
+
"template": "<main class=\"ops-dashboard\">\n <header class=\"dashboard-header\">\n <div>\n <p class=\"dashboard-eyebrow\">OPERATIONS / PAGE COMPOSITION</p>\n <h1>{{ template.name || '项目运营数据看板' }}</h1>\n <p class=\"dashboard-subtitle\">{{ template.intro || '用统一页面模板组合项目指标、状态分布和处理列表。' }}</p>\n </div>\n <div class=\"dashboard-actions\">\n <el-button class=\"dashboard-button\" type=\"primary\" :loading=\"dashboardRefreshing\" :disabled=\"dashboardRefreshing\" @click=\"refreshAll\">\n {{ dashboardRefreshing ? '刷新中…' : '刷新数据' }}\n </el-button>\n <el-button class=\"dashboard-button dashboard-button-muted\" plain @click=\"clearSelection\">清除选择</el-button>\n </div>\n </header>\n\n <div v-if=\"runtimeError\" class=\"dashboard-alert\" role=\"alert\">{{ runtimeError }}</div>\n\n <section class=\"dashboard-kpis\" aria-label=\"项目指标\">\n <article v-for=\"metric in dashboardMetrics\" :key=\"metric.key\" class=\"dashboard-kpi\" :class=\"'tone-' + metric.tone\">\n <span>{{ metric.label }}</span>\n <strong>{{ metric.value }}</strong>\n </article>\n </section>\n\n <section class=\"dashboard-charts\" aria-label=\"项目图表\">\n <page-chart chart-type=\"status-donut\" title=\"项目状态构成\" :rows=\"projectRows\" :aggregation=\"dashboardAggregations.by_status\" :aggregation-labels=\"statusLabels\" />\n <page-chart chart-type=\"owner-bar\" title=\"负责人项目量\" :rows=\"projectRows\" :aggregation=\"dashboardAggregations.by_owner\" aggregation-label-prefix=\"负责人 \" />\n <page-chart chart-type=\"terms-bar\" title=\"申请部门项目量\" eyebrow=\"DEPARTMENT LOAD\" :rows=\"projectRows\" :aggregation=\"dashboardAggregations.by_department\" />\n <page-chart chart-type=\"terms-bar\" title=\"仓库需求分布\" eyebrow=\"WAREHOUSE DEMAND\" :rows=\"projectRows\" :aggregation=\"dashboardAggregations.by_warehouse\" />\n <page-chart chart-type=\"terms-bar\" title=\"所属分部项目量\" eyebrow=\"BRANCH MIX\" :rows=\"projectRows\" :aggregation=\"dashboardAggregations.by_branch\" />\n <page-chart chart-type=\"created-trend\" title=\"需求月份趋势\" eyebrow=\"DEMAND PLAN\" :rows=\"projectRows\" :aggregation=\"dashboardAggregations.by_demand_month\" />\n \n <page-chart chart-type=\"created-trend\" title=\"申请月份趋势\" eyebrow=\"REQUEST INTAKE\" :rows=\"projectRows\" :aggregation=\"dashboardAggregations.by_apply_month\" />\n </section>\n\n <section class=\"dashboard-customization\" aria-label=\"看板业务说明\">\n <page-block v-for=\"(block, index) in blocks\" v-if=\"block.type === 'report-preview'\" :key=\"'report-' + index\" :block=\"block\" :block-index=\"index\" :insight-context=\"insightContext\" />\n </section>\n\n <section class=\"dashboard-grid\">\n <article class=\"dashboard-panel dashboard-status-panel\">\n <div class=\"dashboard-panel-heading\"><div><p class=\"dashboard-overline\">DISTRIBUTION</p><h2>项目状态</h2></div><span>{{ formatNumber(dashboardMetrics[0] && dashboardMetrics[0].value) }} 项</span></div>\n <div class=\"dashboard-status-list\">\n <button v-for=\"status in statusRows\" :key=\"status.key\" type=\"button\" class=\"dashboard-status-row\" :class=\"{ 'is-active': filterStatus === status.key }\" @click=\"selectDashboardStatus(status.key)\">\n <span class=\"dashboard-status-label\"><i :class=\"'status-dot status-' + status.key\"></i>{{ status.label }}</span>\n <span class=\"dashboard-status-value\">{{ status.value }}</span>\n <span class=\"dashboard-progress\"><i :style=\"{ width: (Math.round(status.value / ((dashboardMetrics[0] && dashboardMetrics[0].value) || 1) * 100) + '%') }\"></i></span>\n </button>\n <p v-if=\"!statusRows.length\" class=\"dashboard-empty\">暂无状态数据</p>\n </div>\n </article>\n\n <article class=\"dashboard-panel dashboard-filter-panel\">\n <div class=\"dashboard-panel-heading\"><div><p class=\"dashboard-overline\">FILTERS</p><h2>筛选与选中项</h2></div></div>\n <label class=\"dashboard-label\" for=\"dashboard-status\">状态</label>\n <el-select id=\"dashboard-status\" v-model=\"filterStatus\" class=\"dashboard-control dashboard-element-control\" size=\"small\" placeholder=\"选择项目状态\" :popper-append-to-body=\"false\">\n <el-option v-for=\"status in statusOptions\" :key=\"status.key\" :label=\"status.label\" :value=\"status.key\" />\n </el-select>\n <label class=\"dashboard-label\" for=\"dashboard-keyword\">关键词</label>\n <el-input id=\"dashboard-keyword\" v-model=\"filterKeyword\" class=\"dashboard-control dashboard-element-control\" size=\"small\" clearable prefix-icon=\"el-icon-search\" placeholder=\"搜索项目名称或 ID\" />\n <label class=\"dashboard-label\" for=\"dashboard-owner\">负责人 ID</label>\n <el-input id=\"dashboard-owner\" v-model=\"filterOwner\" class=\"dashboard-control dashboard-element-control\" size=\"small\" clearable placeholder=\"按负责人 ID 筛选\" />\n <label class=\"dashboard-label\" for=\"dashboard-created-date\">创建日期</label>\n <el-date-picker id=\"dashboard-created-date\" v-model=\"filterCreatedDate\" class=\"dashboard-control dashboard-element-control\" size=\"small\" type=\"date\" format=\"yyyy-MM-dd\" value-format=\"yyyy-MM-dd\" clearable :popper-append-to-body=\"false\" placeholder=\"选择创建日期\" />\n <el-button class=\"dashboard-filter-submit\" type=\"primary\" size=\"small\" :loading=\"dashboardRefreshing\" :disabled=\"dashboardRefreshing\" @click=\"applyFilters\"><i class=\"ri ri_search-line\"></i> 筛选</el-button>\n <div v-if=\"selectedProject\" class=\"dashboard-selected\">\n <span>当前项目</span><strong>{{ selectedProject.name || selectedProject.title || selectedProject.id }}</strong>\n <small>{{ currentStep ? stepLabel(currentStep) : '没有唯一可处理环节' }}</small>\n </div>\n <p v-else class=\"dashboard-empty\">从列表选择项目后查看上下文。</p>\n </article>\n\n <article class=\"dashboard-panel dashboard-list-panel\">\n <div class=\"dashboard-panel-heading\"><div><p class=\"dashboard-overline\">PROJECT LIST</p><h2>项目列表</h2></div><span>{{ projectCount }} 个结果</span></div>\n <page-block\n v-for=\"(block, index) in blocks\"\n v-if=\"block.type === 'project-table'\"\n :key=\"'table-' + index\"\n :block=\"block\"\n :block-index=\"index\"\n :rows=\"filteredProjectRows\"\n :selected-project=\"selectedProject\"\n :current-step=\"currentStep\"\n :draft-comment=\"draftComment\"\n :action-busy=\"actionBusy\"\n :selected-project-ids=\"selectedProjectIds\"\n @select-project=\"selectProject\"\n @open-quick-process=\"openQuickProcess\"\n />\n </article>\n\n <article class=\"dashboard-panel dashboard-detail-panel\">\n <div class=\"dashboard-panel-heading\"><div><p class=\"dashboard-overline\">CONTEXT</p><h2>项目详情</h2></div></div>\n <page-block\n v-for=\"(block, index) in blocks\"\n v-if=\"block.type === 'project-detail'\"\n :key=\"'detail-' + index\"\n :block=\"block\"\n :block-index=\"index\"\n :selected-project=\"selectedProject\"\n :current-step=\"currentStep\"\n :draft-comment=\"draftComment\"\n :action-busy=\"actionBusy\"\n :selected-project-ids=\"selectedProjectIds\"\n @load-project-detail=\"loadProjectDetail\"\n />\n <p v-if=\"!selectedProject\" class=\"dashboard-empty\">选择列表中的项目查看详情。</p>\n </article>\n </section>\n\n <div v-if=\"quickProcessVisible\" class=\"dashboard-overlay\" role=\"dialog\" aria-modal=\"true\" aria-label=\"快速处理\">\n <section class=\"dashboard-drawer\">\n <div class=\"dashboard-drawer-heading\"><div><p class=\"dashboard-overline\">ACTION</p><h2>快速处理</h2></div><el-button class=\"dashboard-close\" plain @click=\"clearSelection\">关闭</el-button></div>\n <p v-if=\"selectedProject\" class=\"dashboard-drawer-project\">{{ selectedProject.name || selectedProject.title || selectedProject.id }}</p>\n <page-block\n v-for=\"(block, index) in blocks\"\n v-if=\"block.type === 'step-form' || block.type === 'step-operation'\"\n :key=\"'action-' + block.type + '-' + index\"\n :block=\"block\"\n :block-index=\"index\"\n :selected-project=\"selectedProject\"\n :current-step=\"currentStep\"\n :draft-comment=\"draftComment\"\n :action-busy=\"actionBusy\"\n :selected-project-ids=\"selectedProjectIds\"\n @submit-step=\"submitStep\"\n @update-comment=\"draftComment = $event\"\n />\n <p v-if=\"!currentStep\" class=\"dashboard-empty\">当前项目没有唯一可处理环节。</p>\n </section>\n </div>\n</main>",
|
|
248
|
+
"style": ".ops-dashboard { min-height: 100%; padding: 24px 32px 48px; background: #f5f7fa; color: #1f2937; }\n.dashboard-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }\n.dashboard-eyebrow, .dashboard-overline { margin: 0; color: #2563eb; font-size: 11px; font-weight: 700; letter-spacing: .12em; }\n.dashboard-header h1 { margin: 6px 0; font-size: 26px; letter-spacing: -.02em; }\n.dashboard-subtitle { max-width: 680px; margin: 0; color: #64748b; line-height: 1.6; }\n.dashboard-actions { display: flex; gap: 8px; flex-wrap: wrap; }\n.dashboard-button, .dashboard-close { min-height: 44px; padding: 9px 14px; border: 1px solid #2563eb; border-radius: 8px; background: #2563eb; color: #fff; cursor: pointer; }\n.dashboard-button-muted, .dashboard-close { border-color: #cbd5e1; background: #fff; color: #334155; }\n.dashboard-button:focus-visible, .dashboard-close:focus-visible, .dashboard-status-row:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }\n.dashboard-button:disabled { cursor: not-allowed; opacity: .55; }\n.dashboard-alert { margin-top: 16px; padding: 12px 16px; border: 1px solid #fecaca; border-radius: 10px; background: #fff1f2; color: #991b1b; }\n.dashboard-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }\n.dashboard-kpi { position: relative; min-height: 104px; padding: 16px 18px; box-sizing: border-box; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; overflow: hidden; }\n.dashboard-kpi:before { position: absolute; inset: 0 auto 0 0; width: 4px; content: ''; background: #2563eb; }\n.dashboard-kpi.tone-amber:before { background: #d97706; } .dashboard-kpi.tone-violet:before { background: #7c3aed; } .dashboard-kpi.tone-green:before { background: #16a34a; }\n.dashboard-kpi span { display: block; color: #64748b; font-size: 12px; } .dashboard-kpi strong { display: block; margin-top: 12px; font-size: 28px; font-variant-numeric: tabular-nums; } .dashboard-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }\n.dashboard-grid { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(260px, .8fr) minmax(460px, 1.8fr); gap: 16px; margin-top: 16px; align-items: start; }\n.dashboard-charts .page-composition-chart { min-width: 0; }\n.dashboard-panel { min-width: 0; padding: 20px; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; }\n.dashboard-list-panel { grid-column: 1 / -1; } .dashboard-detail-panel { grid-column: 1 / -1; }\n.dashboard-panel-heading, .dashboard-drawer-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }\n.dashboard-panel-heading h2, .dashboard-drawer-heading h2 { margin: 4px 0 0; font-size: 17px; } .dashboard-panel-heading > span { color: #64748b; font-size: 12px; }\n.dashboard-status-list { display: grid; gap: 4px; } .dashboard-status-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; min-height: 52px; padding: 8px 0; border: 0; border-bottom: 1px solid #f1f5f9; background: transparent; color: #334155; text-align: left; cursor: pointer; }\n.dashboard-status-row.is-active .dashboard-status-label, .dashboard-status-row:hover .dashboard-status-label { color: #2563eb; } .dashboard-status-label { display: flex; gap: 8px; align-items: center; }\n.dashboard-status-value { font-variant-numeric: tabular-nums; font-weight: 600; } .dashboard-progress { grid-column: 1 / -1; display: block; height: 5px; border-radius: 999px; background: #e2e8f0; overflow: hidden; } .dashboard-progress i { display: block; height: 100%; border-radius: inherit; background: #60a5fa; }\n.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; } .status-2, .status-6, .status-pending { background: #d97706; } .status-3, .status-processing { background: #7c3aed; } .status-4, .status-completed, .status-done { background: #16a34a; }\n.dashboard-label { display: block; margin: 12px 0 6px; color: #475569; font-size: 12px; font-weight: 600; } .dashboard-control { width: 100%; min-height: 42px; box-sizing: border-box; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1f2937; } .dashboard-element-control { min-height: 32px; padding: 0; } .dashboard-element-control.el-select, .dashboard-element-control.el-date-editor { display: block; } .dashboard-element-control .el-input__inner, .dashboard-element-control.el-input .el-input__inner { min-height: 32px; height: 32px; border-color: #cbd5e1; border-radius: 6px; background: #fff; color: #1f2937; } .dashboard-element-control .el-input__inner:focus { border-color: #2563eb; }\n.dashboard-control:focus { border-color: #2563eb; outline: 2px solid #bfdbfe; outline-offset: 1px; } .dashboard-selected { margin-top: 20px; padding: 12px; border-radius: 10px; background: #eff6ff; } .dashboard-selected span, .dashboard-selected small { display: block; color: #475569; font-size: 12px; } .dashboard-selected strong { display: block; margin: 5px 0; }\n.dashboard-empty { margin: 0; color: #64748b; font-size: 13px; } .dashboard-overlay { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; background: rgba(15, 23, 42, .32); } .dashboard-drawer { width: min(520px, 100vw); height: 100%; box-sizing: border-box; padding: 24px; overflow: auto; background: #fff; } .dashboard-drawer-project { margin: 0 0 20px; font-weight: 600; }\n@media (max-width: 1024px) { .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard-list-panel, .dashboard-detail-panel { grid-column: 1 / -1; } }\n@media (max-width: 1024px) { .dashboard-charts .page-composition-chart:last-child { grid-column: 1 / -1; } }\n@media (max-width: 720px) { .ops-dashboard { padding: 16px 16px 32px; } .dashboard-header { flex-direction: column; } .dashboard-kpis, .dashboard-charts, .dashboard-grid { grid-template-columns: 1fr; } .dashboard-list-panel, .dashboard-detail-panel { grid-column: auto; } } .dashboard-customization { margin-top: 16px; padding: 20px; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; } .dashboard-customization .page-block-report-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } @media (max-width: 720px) { .dashboard-customization .page-block-report-grid { grid-template-columns: 1fr; } }",
|
|
155
249
|
"blocks": [
|
|
156
250
|
{
|
|
157
251
|
"type": "project-table",
|
|
158
252
|
"capability": "project.table",
|
|
159
253
|
"query": "projects",
|
|
160
|
-
"title": "项目列表"
|
|
254
|
+
"title": "项目列表",
|
|
255
|
+
"columns": [
|
|
256
|
+
{
|
|
257
|
+
"key": "id",
|
|
258
|
+
"label": "项目 ID"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"key": "name",
|
|
262
|
+
"label": "项目名称"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"key": "__statusLabel",
|
|
266
|
+
"label": "状态"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"key": "__currentStepName",
|
|
270
|
+
"label": "当前环节"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"key": "owner_name",
|
|
274
|
+
"label": "负责人"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"key": "department",
|
|
278
|
+
"label": "申请部门"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"key": "branch",
|
|
282
|
+
"label": "所属分部"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"key": "request_date",
|
|
286
|
+
"label": "申请日期"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"key": "need_date",
|
|
290
|
+
"label": "需求日期"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"key": "warehouse",
|
|
294
|
+
"label": "出入库仓库"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"key": "__createTimeLabel",
|
|
298
|
+
"label": "创建时间"
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"type": "project-pagination",
|
|
304
|
+
"capability": "project.pagination",
|
|
305
|
+
"query": "projects",
|
|
306
|
+
"pageSize": 5
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"type": "report-preview",
|
|
310
|
+
"capability": "report.preview",
|
|
311
|
+
"title": "业务口径与可定制分析",
|
|
312
|
+
"eyebrow": "CUSTOMIZATION",
|
|
313
|
+
"items": [
|
|
314
|
+
{
|
|
315
|
+
"key": "data-scope",
|
|
316
|
+
"label": "数据范围",
|
|
317
|
+
"valueKey": "dataScope",
|
|
318
|
+
"description": "指标和图表来自服务端全量聚合,不随当前分页变化。"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"key": "department-count",
|
|
322
|
+
"label": "部门维度",
|
|
323
|
+
"valueKey": "departmentCount",
|
|
324
|
+
"description": "识别需求来源与部门负荷,cardinality 为全量去重数。"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"key": "warehouse-count",
|
|
328
|
+
"label": "仓库维度",
|
|
329
|
+
"valueKey": "warehouseCount",
|
|
330
|
+
"description": "识别仓库需求压力和资源分布。"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"key": "owner-count",
|
|
334
|
+
"label": "负责人维度",
|
|
335
|
+
"valueKey": "ownerCount",
|
|
336
|
+
"description": "观察工作量是否集中在少数负责人。"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"key": "filter-summary",
|
|
340
|
+
"label": "当前筛选",
|
|
341
|
+
"valueKey": "filterSummary",
|
|
342
|
+
"description": "筛选提交后同步刷新列表与所有聚合。"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"key": "apply-peak-month",
|
|
346
|
+
"label": "申请峰值月份",
|
|
347
|
+
"valueKey": "applyPeakMonth",
|
|
348
|
+
"description": "识别申请量最高的月份,辅助安排资源与库存。"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"key": "custom-elements",
|
|
352
|
+
"label": "可组合元素",
|
|
353
|
+
"value": "KPI · 图表 · 说明卡 · 筛选 · 分页",
|
|
354
|
+
"description": "同一页面模板可按业务目标组合指标、分析维度和交互控件。"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"key": "business-definition",
|
|
358
|
+
"label": "业务口径",
|
|
359
|
+
"value": "项目总数、状态、负责人、组织与需求节奏均以当前筛选条件下的服务端全量聚合为准。"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"key": "page-summary",
|
|
363
|
+
"label": "当前页",
|
|
364
|
+
"valueKey": "currentPage",
|
|
365
|
+
"description": "明确当前页码与分页范围,便于回测。"
|
|
366
|
+
}
|
|
367
|
+
]
|
|
161
368
|
},
|
|
162
369
|
{
|
|
163
370
|
"type": "project-detail",
|
|
@@ -181,8 +388,10 @@
|
|
|
181
388
|
},
|
|
182
389
|
"dependencies": {
|
|
183
390
|
"capabilities": [
|
|
184
|
-
"project.table",
|
|
185
391
|
"project.detail",
|
|
392
|
+
"project.pagination",
|
|
393
|
+
"project.table",
|
|
394
|
+
"report.preview",
|
|
186
395
|
"step.form",
|
|
187
396
|
"step.operation"
|
|
188
397
|
]
|
|
@@ -27,9 +27,58 @@
|
|
|
27
27
|
"page": 1,
|
|
28
28
|
"page_size": 20,
|
|
29
29
|
"with_step": 1,
|
|
30
|
-
"flow_type": "flow636354625"
|
|
30
|
+
"flow_type": "flow636354625",
|
|
31
|
+
"flow_key": ""
|
|
31
32
|
},
|
|
32
|
-
"filterMode": "server"
|
|
33
|
+
"filterMode": "server",
|
|
34
|
+
"filterGroup": "dashboard",
|
|
35
|
+
"row_mapping": {
|
|
36
|
+
"id": "__id",
|
|
37
|
+
"name": "xmmc1.0",
|
|
38
|
+
"owner_id": "__owner_id",
|
|
39
|
+
"owner_name": "__project_owner.name",
|
|
40
|
+
"create_time": "__create_time",
|
|
41
|
+
"current_step_name": "current_step_name"
|
|
42
|
+
},
|
|
43
|
+
"filter_fields": {
|
|
44
|
+
"status": "status",
|
|
45
|
+
"keyword": "xmmc1",
|
|
46
|
+
"owner": "__owner_id",
|
|
47
|
+
"created_date": "__create_time"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"dashboardStats": {
|
|
51
|
+
"engine": "es",
|
|
52
|
+
"mode": "aggregate",
|
|
53
|
+
"resource": "/project/aggregate",
|
|
54
|
+
"method": "POST",
|
|
55
|
+
"params": {
|
|
56
|
+
"data_set_key": "main",
|
|
57
|
+
"flow_type": "flow636354625",
|
|
58
|
+
"flow_key": ""
|
|
59
|
+
},
|
|
60
|
+
"aggs": {
|
|
61
|
+
"by_status": {
|
|
62
|
+
"type": "terms",
|
|
63
|
+
"field": "status",
|
|
64
|
+
"size": 8
|
|
65
|
+
},
|
|
66
|
+
"by_owner": {
|
|
67
|
+
"type": "terms",
|
|
68
|
+
"field": "__owner_id",
|
|
69
|
+
"size": 20
|
|
70
|
+
},
|
|
71
|
+
"by_month": {
|
|
72
|
+
"type": "date_histogram",
|
|
73
|
+
"field": "__create_time",
|
|
74
|
+
"calendar_interval": "month"
|
|
75
|
+
},
|
|
76
|
+
"total_projects": {
|
|
77
|
+
"type": "value_count",
|
|
78
|
+
"field": "__id"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"filterGroup": "dashboard"
|
|
33
82
|
}
|
|
34
83
|
},
|
|
35
84
|
"methods": {},
|
|
@@ -152,7 +201,7 @@
|
|
|
152
201
|
}
|
|
153
202
|
},
|
|
154
203
|
"render": {
|
|
155
|
-
"template": "<main class=\"visual-dashboard\">\n <header class=\"visual-dashboard__header\">\n <h1>{{ template.name || '项目运营可视化看板' }}</h1>\n <el-button type=\"primary\" :loading=\"dashboardRefreshing\" :disabled=\"dashboardRefreshing\" @click=\"refreshAll\">\n {{ dashboardRefreshing ? '刷新中…' : '刷新数据' }}\n </el-button>\n </header>\n\n <div v-if=\"runtimeError\" class=\"visual-dashboard__alert\" role=\"alert\">{{ runtimeError }}</div>\n\n <section class=\"visual-dashboard__metrics\" aria-label=\"项目指标\">\n <article v-for=\"metric in dashboardMetrics\" :key=\"metric.key\" class=\"visual-dashboard__metric\">\n <span>{{ metric.label }}</span>\n <strong>{{ metric.value }}</strong>\n </article>\n </section>\n\n <section class=\"visual-dashboard__charts\" aria-label=\"项目可视化图表\">\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"status-donut\" title=\"项目状态\" :rows=\"filteredProjectRows\" />\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"owner-bar\" title=\"负责人项目量\" :rows=\"filteredProjectRows\" />\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"created-trend\" title=\"项目创建趋势\" :rows=\"filteredProjectRows\" />\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"project-graph\" title=\"项目关系\" :rows=\"filteredProjectRows\" />\n </section>\n\n <section class=\"visual-dashboard__filters\" aria-label=\"看板筛选\">\n <el-select v-model=\"filterStatus\" size=\"small\" class=\"visual-dashboard__control\" placeholder=\"全部状态\" :popper-append-to-body=\"false\">\n <el-option v-for=\"status in statusOptions\" :key=\"status.key\" :label=\"status.label\" :value=\"status.key\" />\n </el-select>\n <el-input v-model=\"filterKeyword\" size=\"small\" class=\"visual-dashboard__control\" clearable prefix-icon=\"el-icon-search\" placeholder=\"按项目名称搜索\" />\n <el-button type=\"primary\" size=\"small\" :loading=\"dashboardRefreshing\" :disabled=\"dashboardRefreshing\" @click=\"applyFilters\">筛选</el-button>\n <span class=\"visual-dashboard__count\">{{
|
|
204
|
+
"template": "<main class=\"visual-dashboard\">\n <header class=\"visual-dashboard__header\">\n <h1>{{ template.name || '项目运营可视化看板' }}</h1>\n <el-button type=\"primary\" :loading=\"dashboardRefreshing\" :disabled=\"dashboardRefreshing\" @click=\"refreshAll\">\n {{ dashboardRefreshing ? '刷新中…' : '刷新数据' }}\n </el-button>\n </header>\n\n <div v-if=\"runtimeError\" class=\"visual-dashboard__alert\" role=\"alert\">{{ runtimeError }}</div>\n\n <section class=\"visual-dashboard__metrics\" aria-label=\"项目指标\">\n <article v-for=\"metric in dashboardMetrics\" :key=\"metric.key\" class=\"visual-dashboard__metric\">\n <span>{{ metric.label }}</span>\n <strong>{{ metric.value }}</strong>\n </article>\n </section>\n\n <section class=\"visual-dashboard__charts\" aria-label=\"项目可视化图表\">\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"status-donut\" title=\"项目状态\" :rows=\"filteredProjectRows\" :aggregation=\"dashboardAggregations.by_status\" :aggregation-labels=\"statusLabels\" />\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"owner-bar\" title=\"负责人项目量\" :rows=\"filteredProjectRows\" :aggregation=\"dashboardAggregations.by_owner\" aggregation-label-prefix=\"负责人 \" />\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"created-trend\" title=\"项目创建趋势\" :rows=\"filteredProjectRows\" :aggregation=\"dashboardAggregations.by_month\" />\n <page-chart theme=\"light\" eyebrow=\"\" chart-type=\"project-graph\" title=\"项目关系\" :rows=\"filteredProjectRows\" />\n </section>\n\n <section class=\"visual-dashboard__filters\" aria-label=\"看板筛选\">\n <el-select v-model=\"filterStatus\" size=\"small\" class=\"visual-dashboard__control\" placeholder=\"全部状态\" :popper-append-to-body=\"false\">\n <el-option v-for=\"status in statusOptions\" :key=\"status.key\" :label=\"status.label\" :value=\"status.key\" />\n </el-select>\n <el-input v-model=\"filterKeyword\" size=\"small\" class=\"visual-dashboard__control\" clearable prefix-icon=\"el-icon-search\" placeholder=\"按项目名称搜索\" />\n <el-button type=\"primary\" size=\"small\" :loading=\"dashboardRefreshing\" :disabled=\"dashboardRefreshing\" @click=\"applyFilters\">筛选</el-button>\n <span class=\"visual-dashboard__count\">{{ projectCount }} 项</span>\n </section>\n</main>",
|
|
156
205
|
"style": ".visual-dashboard { min-height: 100%; box-sizing: border-box; padding: 24px 32px 48px; background: #f6f8fb; color: #1f2937; }\n.visual-dashboard__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }\n.visual-dashboard__header h1 { min-width: 0; margin: 0; overflow: hidden; color: #111827; font-size: 26px; font-weight: 700; line-height: 36px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }\n.visual-dashboard__header .el-button { min-width: 96px; min-height: 44px; border-radius: 8px; }\n.visual-dashboard__alert { margin-top: 16px; padding: 12px 16px; border: 1px solid #fecaca; border-radius: 10px; background: #fff1f2; color: #991b1b; }\n.visual-dashboard__metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }\n.visual-dashboard__metric { min-width: 0; min-height: 100px; box-sizing: border-box; padding: 18px 20px; border: 1px solid #dbe3ec; border-radius: 12px; background: #fff; }\n.visual-dashboard__metric span { display: block; overflow: hidden; color: #64748b; font-size: 12px; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }\n.visual-dashboard__metric strong { display: block; margin-top: 10px; color: #111827; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 34px; }\n.visual-dashboard__charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }\n.visual-dashboard__charts .page-composition-chart { min-width: 0; border: 1px solid #dbe3ec; border-radius: 12px; }\n.visual-dashboard__filters { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 16px; border: 1px solid #dbe3ec; border-radius: 12px; background: #fff; }\n.visual-dashboard__control { width: 180px; } .visual-dashboard__filters .el-button { min-width: 88px; min-height: 32px; border-radius: 6px; }\n.visual-dashboard__count { margin-left: auto; color: #64748b; font-size: 13px; font-variant-numeric: tabular-nums; }\n@media (max-width: 1024px) { .visual-dashboard__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }\n@media (max-width: 720px) { .visual-dashboard { padding: 16px 16px 32px; } .visual-dashboard__header { align-items: flex-start; } .visual-dashboard__header h1 { font-size: 22px; } .visual-dashboard__metrics, .visual-dashboard__charts { grid-template-columns: 1fr; } .visual-dashboard__filters { align-items: stretch; flex-direction: column; } .visual-dashboard__control { width: 100%; } .visual-dashboard__count { margin-left: 0; } }",
|
|
157
206
|
"blocks": []
|
|
158
207
|
},
|