From 4561735900148ff39f9ada22b01ece23fd769456 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Sep 2026 14:42:54 +0800 Subject: [PATCH] =?utf8?q?=E9=A2=86=E5=9F=9F=E6=96=B9=E6=A1=88=E5=88=97?= =?utf8?q?=E8=A1=A8=EF=BC=9A=E7=82=B9=E5=87=BB=E6=96=B9=E6=A1=88=E5=90=8D?= =?utf8?q?=E7=A7=B0=E7=9B=B4=E6=8E=A5=E6=89=93=E5=BC=80=E7=BC=96=E8=BE=91?= =?utf8?q?=E9=A1=B5=EF=BC=8C=E7=A7=BB=E9=99=A4=E8=AF=A6=E6=83=85=E6=8A=BD?= =?utf8?q?=E5=B1=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/page.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 0e708e3..3992e4d 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2518,14 +2518,13 @@ function CompanyDomainLibrary({go,notify,onOpen,domainFilter,domainOptions}:{go: const [query,setQuery]=useState(""); const [domainSel,setDomainSel]=useState(domainFilter==null?"":String(domainFilter)); const [statusSel,setStatusSel]=useState(""); - const [preview,setPreview]=useState(null); const [pageIndex,setPageIndex]=useState(1); const [pageSize,setPageSize]=useState(10); const {confirm,el:confirmEl}=useConfirm(); const load=async()=>{ try{ setList(await fetchDb("/domain-templates") as any[]); }catch(e:any){ notify("加载失败:"+e.message); }finally{ setLoading(false); } }; useEffect(()=>{ load(); },[]); useEffect(()=>{ setDomainSel(domainFilter==null?"":String(domainFilter)); },[domainFilter]); - const remove=async(row:any)=>{ if(!(await confirm(`确定删除领域方案「${row.name}」?此操作不可恢复`))) return; try{ await fetchDb(`/domain-templates/${row.id}`,{method:"DELETE"}); setPreview(null); await load(); notify("领域方案已删除"); }catch(e:any){ notify("删除失败:"+e.message); } }; + const remove=async(row:any)=>{ if(!(await confirm(`确定删除领域方案「${row.name}」?此操作不可恢复`))) return; try{ await fetchDb(`/domain-templates/${row.id}`,{method:"DELETE"}); await load(); notify("领域方案已删除"); }catch(e:any){ notify("删除失败:"+e.message); } }; const counts=useMemo(()=>({all:list.length,available:list.filter(x=>x.status==="available").length,unavailable:list.filter(x=>x.status!=="available").length}),[list]); const filtered=useMemo(()=>list.filter(row=>(!statusSel||(statusSel==="available"?row.status==="available":row.status!=="available"))&&(!domainSel||String(row.domain_id)===domainSel)&&(!query.trim()||`${row.name} ${row.domain_name} ${row.creator}`.toLowerCase().includes(query.trim().toLowerCase()))),[list,statusSel,domainSel,query]); useEffect(()=>setPageIndex(1),[statusSel,domainSel,query]); @@ -2539,11 +2538,8 @@ function CompanyDomainLibrary({go,notify,onOpen,domainFilter,domainOptions}:{go:
- {loading?
加载中…
:<>{filtered.slice((pageIndex-1)*pageSize,pageIndex*pageSize).map(row=>setPreview(row)}>)}
方案名称所属领域版本设备页面文档状态创建人从模板创建操作
{row.domain_name||"—"}{row.version||"—"}{row.device_count||0}{row.page_count||0}{row.doc_count||0}{row.status==="available"?"可用":"不可用"}{row.creator||"—"}e.stopPropagation()}>e.stopPropagation()}>},{key:"delete",label:"删除",danger:true,icon:}],onClick:({key})=>key==="edit"?onOpen(row.id):remove(row)}}>}/>
{filtered.length===0&&
暂无符合条件的领域方案
}
{filtered.length} / 总数
} + {loading?
加载中…
:<>{filtered.slice((pageIndex-1)*pageSize,pageIndex*pageSize).map(row=>onOpen(row.id)}>)}
方案名称所属领域版本设备页面文档状态创建人从模板创建操作
{row.domain_name||"—"}{row.version||"—"}{row.device_count||0}{row.page_count||0}{row.doc_count||0}{row.status==="available"?"可用":"不可用"}{row.creator||"—"}e.stopPropagation()}>e.stopPropagation()}>},{key:"delete",label:"删除",danger:true,icon:}],onClick:({key})=>key==="edit"?onOpen(row.id):remove(row)}}>}/>
{filtered.length===0&&
暂无符合条件的领域方案
}
{filtered.length} / 总数
} - setPreview(null)} extra={preview&&}> - {preview&&
{preview.status==="available"?"可用":"不可用"}

基础信息

所属领域
{preview.domain_name||"—"}
版本
{preview.version||"—"}
创建人
{preview.creator||"—"}

方案内容

设备模板
{preview.device_count||0}
页面
{preview.page_count||0}
知识文档
{preview.doc_count||0}
{preview.description&&<>

方案说明

{preview.description}

}
} -
; } -- 2.43.0