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