var w=(a,r,e)=>new Promise((m,o)=>{var v=t=>{try{l(e.next(t))}catch(d){o(d)}},g=t=>{try{l(e.throw(t))}catch(d){o(d)}},l=t=>t.done?m(t.value):Promise.resolve(t.value).then(v,g);l((e=e.apply(a,r)).next())});import{D as f,d as h,r as B,K as D,j as c,o as x,h as C,w as s,b as N,e as u,k as b,c as j,F as S,v as T,t as V,_ as O}from"./index-90c78f99.js";import{u as $}from"./useCurrentInstance-cd4729ef.js";const M=a=>f.get("/api/v1/index/setting/page",a),P=a=>f.get("/api/v1/index/list",a),z=a=>f.post("/api/v1/index/setting/save",a),U=a=>f.delete("/api/v1/index/setting/delete",{data:a}),F={class:"flex justify-center"},G=h({__name:"target-config-drawer",props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(a,{emit:r}){const e=a,{proxy:m}=$(),o=B([]),v=()=>w(this,null,function*(){yield z({applicationStatus:e.data&&e.data.detail.applicationStatus,applicationType:e.data&&e.data.detail.applicationType,id:e.data&&e.data.detail.id,indexIds:o.value.join(",")}),r("close",!0),m.$message.success("保存成功！")}),g=(l,t,d)=>{const p=["cpu（核数）","内存（GB）","储存空间（GB）"],_=e.data&&e.data.configData.filter(i=>p.includes(i.indexName)).map(i=>i.indexId);p.includes(d)&&(l?o.value=[...new Set([...o.value,..._])]:o.value=o.value.filter(i=>!_.includes(i)))};return D(()=>e.visible,l=>{l?o.value=e.data&&e.data.detail.indexIds?e.data.detail.indexIds.split(",").map(t=>Number(t)):[]:o.value=[]}),(l,t)=>{const d=c("el-checkbox"),p=c("el-col"),_=c("el-row"),i=c("el-checkbox-group"),y=c("el-button"),k=c("el-drawer");return x(),C(k,{"model-value":a.visible,title:"指标配置",size:840,"destroy-on-close":"",onClose:t[2]||(t[2]=n=>r("close"))},{footer:s(()=>[N("div",F,[u(y,{type:"primary",onClick:v},{default:s(()=>[b("确定")]),_:1}),u(y,{onClick:t[1]||(t[1]=n=>r("close"))},{default:s(()=>[b("取消")]),_:1})])]),default:s(()=>[u(i,{modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=n=>o.value=n)},{default:s(()=>[u(_,null,{default:s(()=>[(x(!0),j(S,null,T(e.data&&e.data.configData,n=>(x(),C(p,{key:n.indexId,span:12},{default:s(()=>[u(d,{label:n.indexId,onChange:I=>g(I,n.indexId,n.indexName)},{default:s(()=>[b(V(n.indexName),1)]),_:2},1032,["label","onChange"])]),_:2},1024))),128))]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["model-value"])}}});const q=O(G,[["__scopeId","data-v-786f94f7"]]),A=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"}));export{q as T,A as a,U as d,M as l,P as t};
