1 |
- import{d as X,p as $,r as v,b as G,aS as M,o as f,c as z,k as A,a as m,F as D,l as P,w as c,g as S,i as n,j as _,t as U,C as V,a1 as B,y as N,Q as O,U as T,n as W,ak as Y,J as Z,E as w,q as aa,_ as sa,__tla as la}from"./index-af173888.js";import{E as ea,__tla as ta}from"./el-text-0fe23cf3.js";import{c as ua,__tla as ra}from"./property-306cc22d.js";import{u as oa,__tla as ca}from"./useMessage-170c1b43.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(X({name:"ProductAttributes",__name:"ProductAttributes",props:{propertyList:{type:Array,default:()=>{}},isDetail:$.bool.def(!1)},emits:["success"],setup(y,{emit:K}){const{t:L}=W(),C=oa(),e=v(""),d=v(null),k=G(()=>a=>d.value!==null&&(d.value===a||void 0)),b=v([]),j=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([]),q=y;M(()=>q.propertyList,a=>{a&&(u.value=a)},{deep:!0,immediate:!0});const F=K,x=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")),F("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=Y,H=Z,I=aa,J=w;return f(!0),z(D,null,A(m(u),(p,s)=>(f(),P(J,{key:s},{default:c(()=>[S("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 h;(h=u.value)==null||h.splice(o,1)})(s)},{default:c(()=>[_(U(p.name),1)]),_:2},1032,["closable","onClose"])]),S("div",null,[n(t,{class:"mx-1"},{default:c(()=>[_("\u5C5E\u6027\u503C\uFF1A")]),_:1}),(f(!0),z(D,null,A(p.values,(l,o)=>(f(),P(i,{key:l.id,class:"mx-1",closable:!y.isDetail,onClose:h=>((Q,R)=>{var g;(g=u.value[Q].values)==null||g.splice(R,1)})(s,o)},{default:c(()=>[_(U(l.name),1)]),_:2},1032,["closable","onClose"]))),128)),V(n(m(T),{id:`input${s}`,ref_for:!0,ref:j,modelValue:m(e),"onUpdate:modelValue":r[0]||(r[0]=l=>N(e)?e.value=l:null),class:"!w-20",size:"small",onBlur:l=>x(s,p.id),onKeyup:O(l=>x(s,p.id),["enter"])},null,8,["id","modelValue","onBlur","onKeyup"]),[[B,m(k)(s)]]),V(n(H,{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(k)(s)]])]),n(I,{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};
|