import{aN as O,bV as T,bp as z,aE as m,c8 as a,bC as S,bs as d,aK as o,t as B,aa as A,bS as _,ab as M,aD as p,bL as r,ad as P,aJ as i,R as $,r as D,ae as N,aG as L,ai as G,bE as R,af as U,bA as F,ay as H,X as f,Y as J}from"./index-D5GfLbIx.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 K}from"./PermissionGuard-CR4qtxrh.js";import{O as g}from"./ops-BCeFEEjY.js";import{l as E,e as W}from"./ops-C48uBBTk.js";/* empty css                 */const X={style:{display:"flex","align-items":"center",gap:"8px"}},me=O({__name:"OpsActionPanelView",setup(Y){const w=T(),u=F({}),c=S([]),C=H(()=>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 J.confirm(`确认执行 [${n.label}]？
目标：${e}`,"二次确认",{type:"warning"})}catch{return}try{const l=await W({opCode:n.code,targetId:e});f.success(`成功，auditId=${l.auditId}`),c.value=await E()}catch(l){f.error(`失败：${l instanceof Error?l.message:String(l)}`)}}return z(async()=>{c.value=await E()}),(n,e)=>{const l=P,s=M,h=$,k=D,v=A,b=B,I=U,V=N;return d(),m(K,{"widget-id":"OpsActionPanel"},{default:a(()=>[o(b,{shadow:"never"},{header:a(()=>[p("div",X,[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(C.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(V,null,{default:a(()=>[(d(!0),L(G,null,R(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};
