import{aI as g,M as I,aK as r,W as C}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.1703796278973305.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import{_ as S}from"./index.vue_vue_type_script_setup_true_name_ValueItem_lang.1703796278973.js";import{u as B}from"./instance.17037962789732.js";import{a2 as D,a3 as E}from"./instance.1703796278973.js";import{d as M,k as N,w as j,r as K,o as m,c,a as f,b as O,u as U,z,t as A,A as J}from"./vue.1703796278973.js";const L={style:{width:"280px"}},oa=M({__name:"Save",emits:["close","save"],setup(W,{emit:u}){const x=[{title:"ID",dataIndex:"key",with:"33%"},{title:"名称",dataIndex:"name",with:"33%"},{title:"值",dataIndex:"value",with:"34%"}],i=B(),s=N([]);j(()=>{var t;const l=((t=i.current)==null?void 0:t.tags)||[];s.value=g.cloneDeep(l)});const k=async()=>{var l;if(s.value.length){const t=(s.value||[]).filter(a=>(a==null?void 0:a.key)&&(a==null?void 0:a.value)).map(a=>{const{dataType:n,..._}=a;return{..._}});t.length&&(await D(((l=i.current)==null?void 0:l.id)||"",t)).status===200&&I.success("操作成功！");const o=(s.value||[]).filter(a=>(a==null?void 0:a.key)&&!(a!=null&&a.value));o.length&&o.map(async a=>{var n;a.id&&await E(((n=i.current)==null?void 0:n.id)||"",a.id)}),u("save")}else u("close")},w=()=>{u("close")};return(l,t)=>{const o=K("Ellipsis"),a=S,n=r,_=C;return m(),c(_,{width:1e3,visible:!0,title:"编辑标签",onOk:k,onCancel:w},{default:f(()=>[O(n,{rowKey:"id",columns:x,"data-source":U(s),bordered:"",pagination:!1},{bodyCell:f(({column:b,text:V,record:e})=>{var y,v,d,h,T;return[z("div",L,[["key","name"].includes(b.dataIndex)?(m(),c(o,{key:0},{default:f(()=>[A(J(V),1)]),_:2},1024)):(m(),c(a,{key:1,modelValue:e.value,"onUpdate:modelValue":p=>e.value=p,itemType:e.type,options:e.type==="enum"?(((y=e==null?void 0:e.dataType)==null?void 0:y.elements)||[]).map(p=>({label:p.text,value:p.value})):e.type==="boolean"?[{label:(v=e==null?void 0:e.dataType)==null?void 0:v.trueText,value:(d=e==null?void 0:e.dataType)==null?void 0:d.trueValue},{label:(h=e==null?void 0:e.dataType)==null?void 0:h.falseText,value:(T=e==null?void 0:e.dataType)==null?void 0:T.falseValue}]:void 0},null,8,["modelValue","onUpdate:modelValue","itemType","options"]))])]}),_:1},8,["data-source"])]),_:1})}}});export{oa as _};
