import{M as S,K as T,Y as D,r as J,F as O,cD as E}from"./index.17037962789732.js";import"./index.1703796278973318.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import{_ as L}from"./index.vue_vue_type_script_setup_true_name_ValueItem_lang.1703796278973.js";import"./index.170379627897315.js";import{Y as M}from"./instance.1703796278973.js";import{u as U}from"./instance.17037962789732.js";import{d as Y,k as $,v as z,w as K,r as Q,o as p,c as d,a as r,z as _,b as c,t as C,u as f,x as y,F as g,h as V,A as G,B as H,a5 as P}from"./vue.1703796278973.js";const W={style:{display:"flex","justify-content":"space-between","align-items":"center"}},X={style:{"margin-right":"5px"}},le=Y({__name:"Save",props:{config:{type:Array,default:[]}},emits:["close","save"],setup(j,{emit:v}){const u=j,i=$(),l=z({}),m=U();K(()=>{var s;const n=(s=m.current)==null?void 0:s.configuration;n&&Object.keys(n).length&&((u==null?void 0:u.config)||[]).map(t=>{Array.isArray(t.properties)&&(t!=null&&t.properties.length)&&t.properties.map(a=>{l[a.property]=n[a.property]})})});const w=()=>{v("close"),i.value.resetFields()},B=()=>{i.value.validate().then(async n=>{var s,t;if(n){const a=P(l);(await M(((s=m.current)==null?void 0:s.id)||"",{id:(t=m.current)==null?void 0:t.id,configuration:{...a}})).status===200&&(S.success("操作成功！"),v("save"))}})};return(n,s)=>{const t=Q("AIcon"),a=T,h=D,A=L,q=J,F=O,I=E;return p(),d(I,{placement:"right",closable:!1,visible:!0},{title:r(()=>[_("div",W,[_("span",null,[c(t,{type:"CloseOutlined",style:{"margin-right":"5px"},onClick:w}),C("编辑配置")]),c(a,{type:"primary",onClick:B},{default:r(()=>[C("保存")]),_:1})])]),default:r(()=>[c(F,{layout:"vertical",ref_key:"formRef",ref:i,model:f(l)},{default:r(()=>[(p(!0),y(g,null,V(u.config||[],(N,R)=>(p(),y(g,{key:R},[(p(!0),y(g,null,V(N.properties,e=>{var k,x;return p(),d(q,{name:e.property,key:e.property,required:!!((k=e.type.expands)!=null&&k.required),rules:(x=e.type.expands)!=null&&x.required?[{required:!0,message:`请输入${e.name}`}]:[]},{label:r(()=>[_("span",X,G(e.name),1),e.description?(p(),d(h,{key:0,title:e.description},{default:r(()=>[c(t,{type:"QuestionCircleOutlined"})]),_:2},1032,["title"])):H("",!0)]),default:r(()=>{var b;return[c(A,{modelValue:f(l)[e.property],"onUpdate:modelValue":o=>f(l)[e.property]=o,itemType:e.type.type,options:e.type.type==="enum"?(((b=e.type)==null?void 0:b.elements)||[]).map(o=>({label:o==null?void 0:o.text,value:o==null?void 0:o.value})):void 0},null,8,["modelValue","onUpdate:modelValue","itemType","options"])]}),_:2},1032,["name","required","rules"])}),128))],64))),128))]),_:1},8,["model"])]),_:1})}}});export{le as _};
