diff --git a/frontend/src/lib/termsApp.ts b/frontend/src/lib/termsApp.ts
index db982f63..13c5b33e 100644
--- a/frontend/src/lib/termsApp.ts
+++ b/frontend/src/lib/termsApp.ts
@@ -491,8 +491,8 @@ export const PAGE_EDIT_TEXT = {
personalNoPublish: '个人应用没有发布这一步:改动保存后直接生效',
// ---- 小工具条
toolbar: (label: string) => `「${label}」的操作`,
- editText: '改文字',
- editTextTitle: (label: string) => `改「${label}」的文字`,
+ editText: '修改文字',
+ editTextTitle: (label: string) => `修改「${label}」的文字`,
editTextHint: '只改组件上显示的文字,不改它的数据来源',
noText: '这个组件没有可改的文字',
saveText: '保存文字',
diff --git a/frontend/src/lib/termsBlueprint.ts b/frontend/src/lib/termsBlueprint.ts
index 5adf362f..edac4483 100644
--- a/frontend/src/lib/termsBlueprint.ts
+++ b/frontend/src/lib/termsBlueprint.ts
@@ -112,8 +112,8 @@ export const BLUEPRINT_TEXT = {
// 右边的卡片
cardsTitle: '卡片',
cardsHint: '每张卡片是一件你能判断对错的事。「缺」的要补上才能试运行,「待确认」的发布前要确认。',
- edit: '改',
- editTitle: (what: string) => `改「${what}」`,
+ edit: '修改',
+ editTitle: (what: string) => `修改「${what}」`,
save: '保存',
cancel: '取消',
saving: '正在保存…',
@@ -121,6 +121,9 @@ export const BLUEPRINT_TEXT = {
confirm: '确认',
confirmHint: '这一项没问题:标成已确认,来源不变',
confirmed: '已确认',
+ confirmAll: (n: number) => `确认全部(${n})`,
+ confirmAllHint: (n: number) => `这张卡片上待确认的 ${n} 项都标成已确认,来源不变`,
+ confirmedAll: (n: number) => `已确认 ${n} 项`,
remove: '删掉这一项',
removed: '已删掉',
add: '加一项',
diff --git a/frontend/src/pages/blueprints/BlueprintCards.tsx b/frontend/src/pages/blueprints/BlueprintCards.tsx
index 63c36fe3..a6c3ea53 100644
--- a/frontend/src/pages/blueprints/BlueprintCards.tsx
+++ b/frontend/src/pages/blueprints/BlueprintCards.tsx
@@ -6,8 +6,9 @@
* 条件这些选填的空着也是缺,只看项的状态会把它们都标成缺;「待确认」是助手、模板、目录提的、你还没看过的项。界面不自己判
* 哪些项必填(P7)。
*
- * 每一项可以点开改:改完发一个 bp_set(值是纯值,服务端记成来源「你」、已确认);待确认的可以直接点「确认」(只改状态,
- * 来源不变)。加一项是 bp_add(卡片字段写纯值),删一项是 bp_remove。对到数据的项写表、中文名、粒度、业务日期和
+ * 每一项可以点「修改」:改完发一个 bp_set(值是纯值,服务端记成来源「你」、已确认);待确认的可以直接点「确认」(只改状态,
+ * 来源不变),一张卡片上待确认的不止一项时卡头另有「确认全部」,一次修改带上这几项的状态(服务端整批落或整批不落)。
+ * 加一项是 bp_add(卡片字段写纯值),删一项是 bp_remove。对到数据的项写表、中文名、粒度、业务日期和
* 「为什么对到这张表」(来自查看和数据目录)。
*
* 关节:按卡片生成之后列出生成关节的状态;「让助手填」走 fill-joints-stream,各组并行,逐组写进度。
@@ -87,6 +88,11 @@ function cardStatus(ctx: CardCtx, card: CardKey, items: [string, BpItem | null |
return shown.includes('confirmed') ? 'confirmed' : null
}
+/** 这张卡片上待确认、有值的项(各自有「确认」按钮的那几项) */
+function pendingOf(items: [string, BpItem | null | undefined][]): string[] {
+ return items.filter(([, i]) => isItem(i) && i.status === 'proposed' && i.value != null && i.value !== '').map(([p]) => p)
+}
+
/** 新加一项的 id(数据项、步骤):小写字母开头,和已有的不重 */
function freshId(prefix: string, taken: string[]): string {
for (let n = taken.length + 1; ; n += 1) if (!taken.includes(`${prefix}${n}`)) return `${prefix}${n}`
@@ -143,28 +149,35 @@ function CardFor({ card, ctx, template }: { card: CardKey; ctx: CardCtx; templat
)
case 'template':
return
- case 'data':
+ case 'data': {
+ const items = spec.data.flatMap((d, i) => DATA_KEYS.map((k) => [`/data/${i}/${k}`, d[k] as BpItem] as [string, BpItem]))
return (
- DATA_KEYS.map((k) => [`/data/${i}/${k}`, d[k] as BpItem] as [string, BpItem])))}
- actions={ ({ id: freshId('d', spec.data.map((d) => d.id)), label: name })} />}>
+
+
+ ({ id: freshId('d', spec.data.map((d) => d.id)), label: name })} />
+ >}>
{spec.data.length === 0 && }
{spec.data.map((d, i) => )}
)
+ }
case 'cadence':
return (
)
- case 'people':
+ case 'people': {
+ const items = spec.people.flatMap((s, i) => STEP_KEYS.map((k) => [`/people/${i}/${k}`, s[k] as BpItem] as [string, BpItem]))
return (
- STEP_KEYS.map((k) => [`/people/${i}/${k}`, s[k] as BpItem] as [string, BpItem])))}
- actions={ ({ id: freshId('s', spec.people.map((s) => s.id)), label: name })} />}>
+
+
+ ({ id: freshId('s', spec.people.map((s) => s.id)), label: name })} />
+ >}>
{spec.people.length === 0 && }
{spec.people.map((s, i) => (
)
- case 'fields':
+ }
+ case 'fields': {
+ const items = spec.fields.map((f, i) => [`/fields/${i}/spec`, f.spec] as [string, BpItem])
return (
- [`/fields/${i}/spec`, f.spec] as [string, BpItem]))}
- actions={ ({ name: freshFieldName(name, spec.fields.map((f) => f.name)), sensitive: false,
- spec: { type: 'string', title: name } })} />}>
+
+
+ ({ name: freshFieldName(name, spec.fields.map((f) => f.name)), sensitive: false,
+ spec: { type: 'string', title: name } })} />
+ >}>
{spec.fields.length === 0 && }
{spec.fields.map((f, i) => )}
)
+ }
case 'writeback': {
const wb = spec.writeback
+ const items: [string, BpItem][] = wb ? [['/writeback/capability', wb.capability], ['/writeback/mapping', wb.mapping],
+ ['/writeback/confirm', wb.confirm]] : []
return (
- void ctx.edit.run('wb', [{ op: 'bp_set', path: '/writeback', value: {} }])}>
{BP_EDIT_TEXT.addWriteback}
- ) : undefined}>
+ ) : }>
{!wb ? : (
@@ -281,7 +299,23 @@ function SubBlock({ ctx, title, path, attr, head, children }: {
)
}
-/** 卡片上的一项:名字、值、状态、来源、为什么;「改」打开编辑框,待确认的可以直接确认 */
+/**
+ * 「确认全部」:这张卡片上待确认的项一次标成已确认(一次修改带上这几项的 /status,服务端整批落或整批不落,来源不变)。
+ * 只有一项时不摆,用那一项自己的「确认」
+ */
+function ConfirmAll({ ctx, card, paths }: { ctx: CardCtx; card: CardKey; paths: string[] }) {
+ if (paths.length < 2) return null
+ const ops = paths.map((p): BpOp => ({ op: 'bp_set', path: `${p}/status`, value: 'confirmed' }))
+ return (
+
+ )
+}
+
+/** 卡片上的一项:名字、值、状态、来源、为什么;「修改」打开编辑框,待确认的可以直接确认 */
function ItemRow({ ctx, path, item, label, kind }: {
ctx: CardCtx; path: string; item: BpItem | null | undefined; label: string; kind: EditorKind
}) {
diff --git a/scripts/check-blueprint.mjs b/scripts/check-blueprint.mjs
index 306eada3..2f757ecf 100644
--- a/scripts/check-blueprint.mjs
+++ b/scripts/check-blueprint.mjs
@@ -6,8 +6,8 @@
// (模板卡写适用场景、会产出什么、要准备什么)、从已有的开始(最近的问数据回答;已发布的工作流只给搭建者)。身份决定范围:
// 搭建者建共享蓝图;使用者在管理员开了个人应用时建个人蓝图,个人应用用不了的模板不给选;开关没开照实说没开放;
// 应用首页的「新建应用」链到 /apps/create;
-// - 卡片:卡头标状态(缺按服务端检查、待确认、已确认),对到数据的项写表、中文名、粒度、业务日期、为什么;点开改发 bp_set
-// (纯值),确认只改状态,加一项发 bp_add(纯值);缺项时「用真数试一次」置灰并写清缺什么;
+// - 卡片:卡头标状态(缺按服务端检查、待确认、已确认),对到数据的项写表、中文名、粒度、业务日期、为什么;「修改」发 bp_set
+// (纯值),确认只改状态,「确认全部」一次带上整张卡片待确认的几项,加一项发 bp_add(纯值);缺项时「用真数试一次」置灰并写清缺什么;
// - 反问:助手的 bp_ask 画成可点的选项,「这一轮在等你回答」常显,输入框提示回答;点选项就是把它作为下一轮发出去(回答记在
// 问题上、这一轮落进蓝图对话都是服务端做的,前端不另记);
// - 关节:只列生成关节,按卡片填的汇总一句;「让助手填」走 fill-joints-stream,逐组写进度,组之间并行;
@@ -472,6 +472,15 @@ await section('蓝图页:卡片的状态、对到的数据、改一项、缺
check('加一项:bp_add,卡片字段写纯值、id 不和已有的重', await until(() => (state.patches ?? []).length === 3)
&& JSON.stringify(state.patches[2].ops) === JSON.stringify([{ op: 'bp_add', path: '/data', value: { id: 'd3', label: '订单数' } }]),
JSON.stringify(state.patches?.[2]))
+ // 确认全部:这张卡片上待确认、有值的几项一次标成已确认(单位、对到的表、算法);只有一项的卡片(多久更新)不摆
+ const confirmAll = page.locator('[data-card="data"] [data-bp-confirm-all]')
+ check('卡头有「确认全部」,写明几项', (await confirmAll.innerText()).includes('确认全部(3)')
+ && await page.locator('[data-card="cadence"] [data-bp-confirm-all]').count() === 0, await confirmAll.innerText())
+ check('改值的按钮写「修改」', (await page.locator('[data-bp-item="/data/0/unit"] [data-bp-edit]').innerText()).trim() === '修改')
+ await confirmAll.click()
+ check('确认全部:一次修改带上这几项的状态,只改状态', await until(() => (state.patches ?? []).length === 4)
+ && JSON.stringify(state.patches[3].ops) === JSON.stringify(['/data/0/unit', '/data/0/table', '/data/0/measure']
+ .map((p) => ({ op: 'bp_set', path: `${p}/status`, value: 'confirmed' }))), JSON.stringify(state.patches?.[3]))
// 被拒:照实说服务端的原因
state.patchReject = '「单位」最多 20 个字'
await page.locator('[data-bp-item="/data/0/unit"] [data-bp-edit]').click()