import{aI as T,bv as V,b7 as z,aC as m,bJ as a,bh as B,b9 as d,aH as o,t as S,aa as M,bt as _,ab as P,aB as p,bq as r,ad as $,aG as i,R as A,r as D,ae as N,aE as G,ai as H,bj as L,af as R,bg as U,ax as j,X as f,Y as q}from"./index-Dg4NaXsE.js";/* empty css             *//* empty css                *//* empty css                     *//* empty css                  */import"./el-tooltip-l0sNRNKZ.js";/* empty css                    *//* empty css                        *//* empty css                  *//* empty css                 *//* empty css               */import{P as F}from"./PermissionGuard-BlMEkqrL.js";import{O as g}from"./ops-BCeFEEjY.js";import{l as C,e as J}from"./ops-CsVl7GhE.js";/* empty css                 */const W={style:{display:"flex","align-items":"center",gap:"8px"}},me=T({__name:"OpsActionPanelView",setup(X){const w=V(),u=U({}),c=B([]),E=j(()=>g.filter(n=>w.hasOp(n.code)));async function x(n){const e=u[n.code];if(!e&&n.target!=="note"){f.warning("请填写目标 ID");return}if(n.needConfirm)try{await q.confirm(`确认执行 [${n.label}]？
目标：${e}`,"二次确认",{type:"warning"})}catch{return}try{const l=await J({opCode:n.code,targetId:e});f.success(`成功，auditId=${l.auditId}`),c.value=await C()}catch(l){f.error(`失败：${l instanceof Error?l.message:String(l)}`)}}return z(async()=>{c.value=await C()}),(n,e)=>{const l=$,s=P,h=A,k=D,v=M,b=S,I=R,O=N;return d(),m(F,{"widget-id":"OpsActionPanel"},{default:a(()=>[o(b,{shadow:"never"},{header:a(()=>[p("div",W,[e[1]||(e[1]=p("span",null,"运维操作（架构 §5.1 白名单）",-1)),o(l,{size:"small",type:"info"},{default:a(()=>[...e[0]||(e[0]=[i("scope=RCSMonitor",-1)])]),_:1}),o(l,{size:"small",type:"success"},{default:a(()=>[i(r(E.value.length)+" / "+r(_(g).length)+" 可用",1)]),_:1})])]),default:a(()=>[o(v,{data:_(g),size:"small",border:""},{default:a(()=>[o(s,{prop:"code",label:"权限码",width:"200"},{default:a(t=>[p("code",null,r(t.row.code),1)]),_:1}),o(s,{prop:"label",label:"操作",width:"140"}),o(s,{prop:"target",label:"目标",width:"80"}),o(s,{prop:"needConfirm",label:"二次确认",width:"100"},{default:a(t=>[t.row.needConfirm?(d(),m(l,{key:0,size:"small",type:"warning"},{default:a(()=>[...e[2]||(e[2]=[i("是",-1)])]),_:1})):(d(),m(l,{key:1,size:"small",effect:"plain"},{default:a(()=>[...e[3]||(e[3]=[i("否",-1)])]),_:1}))]),_:1}),o(s,{prop:"description",label:"说明"}),o(s,{label:"操作",width:"200"},{default:a(t=>[o(h,{modelValue:u[t.row.code],"onUpdate:modelValue":y=>u[t.row.code]=y,placeholder:"目标 ID",size:"small",style:{width:"100px","margin-right":"6px"}},null,8,["modelValue","onUpdate:modelValue"]),o(k,{size:"small",type:t.row.needConfirm?"warning":"primary",disabled:!_(w).hasOp(t.row.code),onClick:y=>x(t.row)},{default:a(()=>[...e[4]||(e[4]=[i("执行",-1)])]),_:1},8,["type","disabled","onClick"])]),_:1})]),_:1},8,["data"])]),_:1}),o(b,{shadow:"never",style:{"margin-top":"12px"}},{header:a(()=>[...e[5]||(e[5]=[p("span",null,"本地操作记录（占位 Mock）",-1)])]),default:a(()=>[o(O,null,{default:a(()=>[(d(!0),G(H,null,L(c.value,t=>(d(),m(I,{key:t.id,timestamp:t.ts,type:t.result==="ok"?"success":"danger"},{default:a(()=>[p("strong",null,r(t.opCode),1),i(" → "+r(t.target)+"（"+r(t.user)+"） ",1)]),_:2},1032,["timestamp","type"]))),128))]),_:1})]),_:1})]),_:1})}}});export{me as default};
