1 |
- import{d as R,dV as E,af as v,e as j,r as h,M as q,aZ as b,o as t,c as m,k as n,F as V,A as F,i as s,w as _,B as M,a4 as N,a as g,j as U,l as B,_ as I,aR as L}from"./index-34852970.js";import{E as T}from"./el-image-32cffe65.js";import"./el-image-viewer-619778cc.js";import{f as X}from"./spu-0b44769c.js";import{_ as Z}from"./SpuTableSelect.vue_vue_type_script_setup_true_lang-28978622.js";import{_ as z}from"./_plugin-vue_export-helper-1b428a4d.js";import"./Dialog-e0707d40.js";import"./ContentWrap.vue_vue_type_script_setup_true_lang-eb026e5c.js";import"./el-card-73839c3c.js";import"./index.vue_vue_type_script_setup_true_lang-1515f911.js";import"./index-d6d07698.js";import"./el-tree-select-bcaa5997.js";import"./tree-0af4953a.js";import"./category-51c9a940.js";const D={class:"flex flex-wrap items-center gap-8px"},G={class:"relative h-full w-full"},H=z(R({name:"SpuShowcase",__name:"SpuShowcase",props:{modelValue:E([Number,Array]).isRequired,limit:v.number.def(Number.MAX_VALUE),disabled:v.bool.def(!1)},emits:["update:modelValue","change"],setup(o,{emit:w}){const a=o,k=j(()=>!a.disabled&&(!a.limit||l.value.length<a.limit)),l=h([]);q(()=>a.modelValue,async()=>{const e=b(a.modelValue)?a.modelValue:a.modelValue?[a.modelValue]:[];e.length!==0?(l.value.length===0||l.value.some(d=>!e.includes(d.id)))&&(l.value=await X(e)):l.value=[]},{immediate:!0});const c=h(),x=()=>{c.value.open(l.value)},y=e=>{l.value=b(e)?e:[e],r()},i=w,r=()=>{if(a.limit===1){const e=l.value.length>0?l.value[0]:null;i("update:modelValue",(e==null?void 0:e.id)||0),i("change",e)}else i("update:modelValue",l.value.map(e=>e.id)),i("change",l.value)};return(e,d)=>{const C=T,p=I,f=L;return t(),m(V,null,[n("div",D,[(t(!0),m(V,null,F(g(l),(u,S)=>(t(),m("div",{key:u.id,class:"select-box spu-pic"},[s(f,{content:u.name},{default:_(()=>[n("div",G,[s(C,{src:u.picUrl,class:"h-full w-full"},null,8,["src"]),M(s(p,{class:"del-icon",icon:"ep:circle-close-filled",onClick:J=>(A=>{l.value.splice(A,1),r()})(S)},null,8,["onClick"]),[[N,!o.disabled]])])]),_:2},1032,["content"])]))),128)),g(k)?(t(),U(f,{key:0,content:"\u9009\u62E9\u5546\u54C1"},{default:_(()=>[n("div",{class:"select-box",onClick:x},[s(p,{icon:"ep:plus"})])]),_:1})):B("",!0)]),s(Z,{ref_key:"spuTableSelectRef",ref:c,multiple:o.limit!=1,onChange:y},null,8,["multiple"])],64)}}}),[["__scopeId","data-v-f5b96300"]]);export{H as default};
|