import{d as q,as as M,r as v,e as N,w as O,o as f,c as P,R as A,a as m,F as D,C as V,A as c,B,f as n,D as _,E,k as K,v as L,a2 as Q,a5 as T,a9 as W,P as X,aw as Y,J as Z,H as k,ce as aa,_ as sa,__tla as ea}from"./index-286756b9.js";import{E as la,__tla as ta}from"./el-text-573636b0.js";import{c as ua,__tla as ra}from"./property-7385b8c3.js";import{u as oa,__tla as ca}from"./useMessage-084b1e70.js";let g,na=Promise.all([(()=>{try{return ea}catch{}})(),(()=>{try{return ta}catch{}})(),(()=>{try{return ra}catch{}})(),(()=>{try{return ca}catch{}})()]).then(async()=>{g=sa(q({name:"ProductAttributes",__name:"ProductAttributes",props:{propertyList:{type:Array,default:()=>{}},isDetail:M.bool.def(!1)},emits:["success"],setup(y,{emit:F}){const{t:H}=X(),x=oa(),l=v(""),d=v(null),C=N(()=>a=>d.value!==null&&(d.value===a||void 0)),b=v([]),I=a=>{a!=null&&(b.value.some(r=>{var t,i;return((t=r.input)==null?void 0:t.attributes.id)===((i=a.input)==null?void 0:i.attributes.id)})||b.value.push(a))},u=v([]),J=y;O(()=>J.propertyList,a=>{a&&(u.value=a)},{deep:!0,immediate:!0});const j=F,w=async(a,r)=>{if(l.value)try{const t=await ua({propertyId:r,name:l.value});u.value[a].values.push({id:t,name:l.value}),x.success(H("common.createSuccess")),j("success",u.value)}catch{x.error("\u6DFB\u52A0\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}d.value=null,l.value=""};return(a,r)=>{const t=la,i=Y,G=Z,R=aa,S=k;return f(!0),P(D,null,A(m(u),(p,s)=>(f(),V(S,{key:s},{default:c(()=>[B("div",null,[n(t,{class:"mx-1"},{default:c(()=>[_("\u5C5E\u6027\u540D\uFF1A")]),_:1}),n(i,{class:"mx-1",closable:!y.isDetail,type:"success",onClose:e=>(o=>{var h;(h=u.value)==null||h.splice(o,1)})(s)},{default:c(()=>[_(E(p.name),1)]),_:2},1032,["closable","onClose"])]),B("div",null,[n(t,{class:"mx-1"},{default:c(()=>[_("\u5C5E\u6027\u503C\uFF1A")]),_:1}),(f(!0),P(D,null,A(p.values,(e,o)=>(f(),V(i,{key:e.id,class:"mx-1",closable:!y.isDetail,onClose:h=>((U,$)=>{var z;(z=u.value[U].values)==null||z.splice($,1)})(s,o)},{default:c(()=>[_(E(e.name),1)]),_:2},1032,["closable","onClose"]))),128)),K(n(m(W),{id:`input${s}`,ref_for:!0,ref:I,modelValue:m(l),"onUpdate:modelValue":r[0]||(r[0]=e=>Q(l)?l.value=e:null),class:"!w-20",size:"small",onBlur:e=>w(s,p.id),onKeyup:T(e=>w(s,p.id),["enter"])},null,8,["id","modelValue","onBlur","onKeyup"]),[[L,m(C)(s)]]),K(n(G,{class:"button-new-tag ml-1",size:"small",onClick:e=>(async o=>{d.value=o,b.value[o].focus()})(s)},{default:c(()=>[_(" + \u6DFB\u52A0 ")]),_:2},1032,["onClick"]),[[L,!m(C)(s)]])]),n(R,{class:"my-10px"})]),_:2},1024))),128)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mall/product/spu/form/ProductAttributes.vue"]])});export{na as __tla,g as default};