数据目录 F2b / B9:在目录页改过目录(编辑保存、确认、驳回、填码值)之后,表头也说「已保存。N 个已发布模板引用这张表,下次正式运行时会提示数据目录有变化」,和助手卡片保存后同一句;带「查看模板」跳到影响面一栏,可收起,没有模板引用时不说;补检查脚本的断言

This commit is contained in:
ThearchyHelios
2026-10-04 02:15:23 +08:00
parent 1483af474c
commit b328341a86
4 changed files with 68 additions and 5 deletions
+6 -2
View File
@@ -18,24 +18,28 @@ import { Skeleton } from './ui'
const SHOWN = 5
export function CatalogImpactList({ sourceId, table, refreshKey, compact = false }: {
export function CatalogImpactList({ sourceId, table, refreshKey, compact = false, onLoad }: {
sourceId: string
table: string
/** 变了就重新统计(表详情传目录版本:保存之后刷新) */
refreshKey?: number | string
/** 卡片里的紧凑版:只列前几个模板,节点收成一行 */
compact?: boolean
/** 统计好了:数据目录页据此在保存之后说「N 个已发布模板引用这张表」 */
onLoad?: (d: CatalogImpact) => void
}) {
const [data, setData] = useState<CatalogImpact | null>(null)
const [error, setError] = useState<unknown>(null)
const [all, setAll] = useState(false)
const seq = useRef(0)
const onLoadRef = useRef(onLoad)
onLoadRef.current = onLoad
const load = useCallback(() => {
const mine = ++seq.current
setError(null)
api.dataCatalog.impact(sourceId, table)
.then((d) => { if (mine === seq.current) setData(d) })
.then((d) => { if (mine === seq.current) { setData(d); onLoadRef.current?.(d) } })
.catch((e) => { if (mine === seq.current) setError(e) })
}, [sourceId, table])