SpuShowcase-f48b7c23.js 2.9 KB

1
  1. import{d as L,dO as N,af as v,J as R,r as y,K as U,au as b,o as s,c,g as o,F as g,n as j,f as e,w as V,v as F,a3 as I,a as w,q as J,O as K,_ as M,b5 as P,__tla as T}from"./index-2eab2d23.js";import{E as X,__tla as z}from"./el-image-2171f3ff.js";import{__tla as B}from"./el-image-viewer-5d14bc77.js";import{e as D,__tla as G}from"./spu-73047b60.js";import{_ as H,__tla as Q}from"./SpuTableSelect.vue_vue_type_script_setup_true_lang-75d04071.js";import{_ as W}from"./_plugin-vue_export-helper-1b428a4d.js";import{__tla as Y}from"./Dialog-c2716df6.js";import{__tla as Z}from"./ContentWrap.vue_vue_type_script_setup_true_lang-5a63038a.js";import{__tla as $}from"./el-card-c558f0ec.js";import{__tla as aa}from"./index.vue_vue_type_script_setup_true_lang-5730b053.js";import{__tla as la}from"./index-cc63c3c4.js";import{__tla as ta}from"./el-tree-select-4ae7c290.js";import"./tree-fd3a041e.js";import{__tla as ea}from"./category-c573377b.js";let k,ra=Promise.all([(()=>{try{return T}catch{}})(),(()=>{try{return z}catch{}})(),(()=>{try{return B}catch{}})(),(()=>{try{return G}catch{}})(),(()=>{try{return Q}catch{}})(),(()=>{try{return Y}catch{}})(),(()=>{try{return Z}catch{}})(),(()=>{try{return $}catch{}})(),(()=>{try{return aa}catch{}})(),(()=>{try{return la}catch{}})(),(()=>{try{return ta}catch{}})(),(()=>{try{return ea}catch{}})()]).then(async()=>{let i,m;i={class:"flex flex-wrap items-center gap-8px"},m={class:"relative h-full w-full"},k=W(L({name:"SpuShowcase",__name:"SpuShowcase",props:{modelValue:N([Number,Array]).isRequired,limit:v.number.def(Number.MAX_VALUE),disabled:v.bool.def(!1)},emits:["update:modelValue","change"],setup(_,{emit:x}){const t=_,C=R(()=>!t.disabled&&(!t.limit||l.value.length<t.limit)),l=y([]);U(()=>t.modelValue,async()=>{const a=b(t.modelValue)?t.modelValue:t.modelValue?[t.modelValue]:[];a.length!==0?(l.value.length===0||l.value.some(p=>!a.includes(p.id)))&&(l.value=await D(a)):l.value=[]},{immediate:!0});const n=y(),S=()=>{n.value.open(l.value)},A=a=>{l.value=b(a)?a:[a],d()},r=x,d=()=>{if(t.limit===1){const a=l.value.length>0?l.value[0]:null;r("update:modelValue",(a==null?void 0:a.id)||0),r("change",a)}else r("update:modelValue",l.value.map(a=>a.id)),r("change",l.value)};return(a,p)=>{const q=X,f=M,h=P;return s(),c(g,null,[o("div",i,[(s(!0),c(g,null,j(w(l),(u,E)=>(s(),c("div",{key:u.id,class:"select-box spu-pic"},[e(h,{content:u.name},{default:V(()=>[o("div",m,[e(q,{src:u.picUrl,class:"h-full w-full"},null,8,["src"]),F(e(f,{class:"del-icon",icon:"ep:circle-close-filled",onClick:sa=>(O=>{l.value.splice(O,1),d()})(E)},null,8,["onClick"]),[[I,!_.disabled]])])]),_:2},1032,["content"])]))),128)),w(C)?(s(),J(h,{key:0,content:"\u9009\u62E9\u5546\u54C1"},{default:V(()=>[o("div",{class:"select-box",onClick:S},[e(f,{icon:"ep:plus"})])]),_:1})):K("",!0)]),e(H,{ref_key:"spuTableSelectRef",ref:n,multiple:_.limit!=1,onChange:A},null,8,["multiple"])],64)}}}),[["__scopeId","data-v-83497b1b"]])});export{ra as __tla,k as default};