1 |
- import{d as I,ac as N,r as v,Y as X,aM as Y,o as f,c as z,v as D,a as m,F as P,x as g,w as c,g as R,f as n,y as _,t as V,z as h,$ as B,l as q,N as J,R as O,h as Q,ah as T,G as W,E as Z,bS as aa,_ as sa,__tla as la}from"./index-8dc1e40a.js";import{E as ea,__tla as ta}from"./el-text-13e93c25.js";import{c as ua,__tla as ra}from"./property-22343ea6.js";import{u as oa,__tla as ca}from"./useMessage-7a27dd80.js";let E,na=Promise.all([(()=>{try{return la}catch{}})(),(()=>{try{return ta}catch{}})(),(()=>{try{return ra}catch{}})(),(()=>{try{return ca}catch{}})()]).then(async()=>{E=sa(I({name:"ProductAttributes",__name:"ProductAttributes",props:{propertyList:{type:Array,default:()=>{}},isDetail:N.bool.def(!1)},emits:["success"],setup(y,{emit:K}){const{t:L}=Q(),C=oa(),e=v(""),d=v(null),w=X(()=>a=>d.value!==null&&(d.value===a||void 0)),b=v([]),S=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([]),U=y;Y(()=>U.propertyList,a=>{a&&(u.value=a)},{deep:!0,immediate:!0});const $=K,A=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}),C.success(L("common.createSuccess")),$("success",u.value)}catch{C.error("\u6DFB\u52A0\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}d.value=null,e.value=""};return(a,r)=>{const t=ea,i=T,M=W,j=aa,F=Z;return f(!0),z(P,null,D(m(u),(p,s)=>(f(),g(F,{key:s},{default:c(()=>[R("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:l=>(o=>{var x;(x=u.value)==null||x.splice(o,1)})(s)},{default:c(()=>[_(V(p.name),1)]),_:2},1032,["closable","onClose"])]),R("div",null,[n(t,{class:"mx-1"},{default:c(()=>[_("\u5C5E\u6027\u503C\uFF1A")]),_:1}),(f(!0),z(P,null,D(p.values,(l,o)=>(f(),g(i,{key:l.id,class:"mx-1",closable:!y.isDetail,onClose:x=>((G,H)=>{var k;(k=u.value[G].values)==null||k.splice(H,1)})(s,o)},{default:c(()=>[_(V(l.name),1)]),_:2},1032,["closable","onClose"]))),128)),h(n(m(O),{id:`input${s}`,ref_for:!0,ref:S,modelValue:m(e),"onUpdate:modelValue":r[0]||(r[0]=l=>q(e)?e.value=l:null),class:"!w-20",size:"small",onBlur:l=>A(s,p.id),onKeyup:J(l=>A(s,p.id),["enter"])},null,8,["id","modelValue","onBlur","onKeyup"]),[[B,m(w)(s)]]),h(n(M,{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"]),[[B,!m(w)(s)]])]),n(j,{class:"my-10px"})]),_:2},1024))),128)}}}),[["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/mall/product/spu/form/ProductAttributes.vue"]])});export{na as __tla,E as default};
|