1 |
- import{d as E,dV as R,af as V,e as U,r as h,M as q,aZ as _,o as n,c as b,k as d,i as s,w as r,B as M,a4 as j,a as c,P as N,j as T,l as B,F,_ as I,aR as L}from"./index-df709923.js";import{E as P}from"./el-image-29d644a2.js";import"./el-image-viewer-90ad41b7.js";import{V as X}from"./vuedraggable.umd-81e2c8c5.js";import{f as Z}from"./spu-bd0a0feb.js";import{_ as z}from"./SpuTableSelect.vue_vue_type_script_setup_true_lang-7d75633e.js";import{_ as D}from"./_plugin-vue_export-helper-1b428a4d.js";import"./Dialog-2f8bd685.js";import"./ContentWrap.vue_vue_type_script_setup_true_lang-e908c5dd.js";import"./el-card-91c2276d.js";import"./index.vue_vue_type_script_setup_true_lang-6fb625ff.js";import"./index-c8bd5ba7.js";import"./el-tree-select-880d8b15.js";import"./tree-fd3a041e.js";import"./category-d6126e80.js";const G={class:"flex flex-wrap items-center gap-2"},H={class:"relative h-full w-full"},J=D(E({name:"SpuShowcase",__name:"SpuShowcase",props:{modelValue:R([Number,Array]).isRequired,limit:V.number.def(Number.MAX_VALUE),disabled:V.bool.def(!1)},emits:["update:modelValue","change"],setup(u,{emit:g}){const a=u,k=U(()=>!a.disabled&&(!a.limit||l.value.length<a.limit)),l=h([]);q(()=>a.modelValue,async()=>{const e=_(a.modelValue)?a.modelValue:a.modelValue?[a.modelValue]:[];e.length!==0?(l.value.length===0||l.value.some(o=>!e.includes(o.id)))&&(l.value=await Z(e)):l.value=[]},{immediate:!0});const p=h(),x=()=>{p.value.open(l.value)},w=e=>{l.value=_(e)?e:[e],m()},y=e=>{m()},t=g,m=()=>{if(a.limit===1){const e=l.value.length>0?l.value[0]:null;t("update:modelValue",(e==null?void 0:e.id)||0),t("change",e)}else t("update:modelValue",l.value.map(e=>e.id)),t("change",l.value)};return(e,o)=>{const S=P,f=I,v=L;return n(),b(F,null,[d("div",G,[s(c(X),{modelValue:c(l),"onUpdate:modelValue":o[0]||(o[0]=i=>N(l)?l.value=i:null),disabled:!1,class:"flex flex-wrap items-center gap-2",onEnd:y},{item:r(({element:i,index:C})=>[(n(),b("div",{key:i.id,class:"select-box spu-pic"},[s(v,{content:i.name},{default:r(()=>[d("div",H,[s(S,{src:i.picUrl,class:"h-full w-full"},null,8,["src"]),M(s(f,{class:"del-icon",icon:"ep:circle-close-filled",onClick:K=>(A=>{l.value.splice(A,1),m()})(C)},null,8,["onClick"]),[[j,!u.disabled]])])]),_:2},1032,["content"])]))]),_:1},8,["modelValue"]),c(k)?(n(),T(v,{key:0,content:"\u9009\u62E9\u5546\u54C1"},{default:r(()=>[d("div",{class:"select-box spu-pic flex-shrink-0",onClick:x},[s(f,{icon:"ep:plus"})])]),_:1})):B("",!0)]),s(z,{ref_key:"spuTableSelectRef",ref:p,multiple:u.limit!=1,onChange:w},null,8,["multiple"])],64)}}}),[["__scopeId","data-v-969e8722"]]);export{J as default};
|