import{aG as O,bo as T,b1 as V,aA as m,bB as a,bb as B,b3 as d,aF as o,aa as S,bm as _,ab as A,az as p,bj as r,ad as M,aE as i,S as P,s as $,ae as D,aC as N,bd as F,af as G,ai as L,ba as U,av as j,Y as f,Z as H,u as R}from"./index-DrvLDslf.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 W}from"./PermissionGuard-BxagL6-4.js";import{O as b}from"./ops-BCeFEEjY.js";import{l as C,e as Y}from"./ops-CZkWvMAR.js";const Z={style:{display:"flex","align-items":"center",gap:"8px"}},pe=O({__name:"OpsActionPanelView",setup(q){const g=T(),u=U({}),c=B([]),E=j(()=>b.filter(n=>g.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 H.confirm(`确认执行 [${n.label}]？
目标：${e}`,"二次确认",{type:"warning"})}catch{return}try{const l=await Y({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 V(async()=>{c.value=await C()}),(n,e)=>{const l=M,s=A,h=P,k=$,v=S,w=R,I=G,z=D;return d(),m(W,{"widget-id":"OpsActionPanel"},{default:a(()=>[o(w,{shadow:"never"},{header:a(()=>[p("div",Z,[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(_(b).length)+" 可用",1)]),_:1})])]),default:a(()=>[o(v,{data:_(b),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:!_(g).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(w,{shadow:"never",style:{"margin-top":"12px"}},{header:a(()=>[...e[5]||(e[5]=[p("span",null,"本地操作记录（占位 Mock）",-1)])]),default:a(()=>[o(z,null,{default:a(()=>[(d(!0),N(L,null,F(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{pe as default};
