var F=Object.defineProperty,O=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var b=(o,t,e)=>t in o?F(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,f=(o,t)=>{for(var e in t||(t={}))R.call(t,e)&&b(o,e,t[e]);if(z)for(var e of z(t))G.call(t,e)&&b(o,e,t[e]);return o},C=(o,t)=>O(o,q(t));var L=(o,t,e)=>new Promise((d,p)=>{var w=n=>{try{c(e.next(n))}catch(v){p(v)}},u=n=>{try{c(e.throw(n))}catch(v){p(v)}},c=n=>n.done?d(n.value):Promise.resolve(n.value).then(w,u);c((e=e.apply(o,t)).next())});import{d as H,r as m,o as J,m as h,g as K,i as s,w as g,u as x,k as y,v as k,F as S,j as Q,b as r,e as W,f as _,h as X,x as Y,c as Z,dz as ee,q as te,s as ae}from"./index-J-k3D_e7.js";import ne from"./Card-SEUfAu48.js";import{a as oe}from"./list-NhNE814Z.js";import{_ as le}from"./DialogForm.vue_vue_type_script_setup_true_lang-AY-hu9R7.js";import{u as se}from"./hooks-Hgyaf50l.js";import{d as ie}from"./search-DTzpNWF3.js";import{d as re}from"./add-circle-line-ROzhCHIm.js";import"./more-2-fill-476mFkdN.js";const ue={class:"main"},ce={class:"w-full flex justify-between mb-4"},me=` `,xe=H({name:"ListCard",__name:"index",setup(o){const t={name:"",status:"",description:"",type:"",mark:""},e=m({current:1,pageSize:12,total:0}),d=m([]),p=m(!0),w=()=>L(this,null,function*(){try{const{data:a}=yield oe();d.value=a.list,e.value=C(f({},e.value),{total:a.list.length})}catch(a){}finally{setTimeout(()=>{p.value=!1},500)}});J(()=>{w()});const u=m(!1),c=m(f({},t)),n=m(""),v=a=>{e.value.pageSize=a,e.value.current=1},I=a=>{e.value.current=a},V=a=>{ee.confirm(a?`确认删除后${a.name}的所有产品信息将被清空, 且无法恢复`:"","提示",{type:"warning"}).then(()=>{te("删除成功",{type:"success"})}).catch(()=>{})},D=a=>{u.value=!0,ae(()=>{c.value=C(f({},a),{status:a!=null&&a.isSetup?"1":"0"})})};return(a,i)=>{const M=r("el-button"),P=r("IconifyIconOffline"),A=r("el-icon"),B=r("el-input"),N=r("el-empty"),T=r("el-col"),$=r("el-row"),j=r("el-pagination"),U=W("loading");return _(),h("div",ue,[K("div",ce,[s(M,{icon:x(se)(x(re)),onClick:i[0]||(i[0]=l=>u.value=!0)},{default:g(()=>[X(" 新建产品 ")]),_:1},8,["icon"]),s(B,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=l=>n.value=l),style:{width:"300px"},placeholder:"请输入产品名称",clearable:""},{suffix:g(()=>[s(A,{class:"el-input__icon"},{default:g(()=>[y(s(P,{icon:x(ie)},null,8,["icon"]),[[k,n.value.length===0]])]),_:1})]),_:1},8,["modelValue"])]),y((_(),h("div",{"element-loading-svg":me,"element-loading-svg-view-box":"-10, -10, 50, 50"},[y(s(N,{description:`${n.value} 产品不存在`},null,8,["description"]),[[k,d.value.slice(e.value.pageSize*(e.value.current-1),e.value.pageSize*e.value.current).filter(l=>l.name.toLowerCase().includes(n.value.toLowerCase())).length===0]]),e.value.total>0?(_(),h(S,{key:0},[s($,{gutter:16},{default:g(()=>[(_(!0),h(S,null,Y(d.value.slice(e.value.pageSize*(e.value.current-1),e.value.pageSize*e.value.current).filter(l=>l.name.toLowerCase().includes(n.value.toLowerCase())),(l,E)=>(_(),Z(T,{key:E,xs:24,sm:12,md:8,lg:6,xl:4},{default:g(()=>[s(ne,{product:l,onDeleteItem:V,onManageProduct:D},null,8,["product"])]),_:2},1024))),128))]),_:1}),s(j,{currentPage:e.value.current,"onUpdate:currentPage":i[2]||(i[2]=l=>e.value.current=l),class:"float-right","page-size":e.value.pageSize,total:e.value.total,"page-sizes":[12,24,36],background:!0,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:v,onCurrentChange:I},null,8,["currentPage","page-size","total"])],64)):Q("",!0)])),[[U,p.value]]),s(le,{visible:u.value,"onUpdate:visible":i[3]||(i[3]=l=>u.value=l),data:c.value},null,8,["visible","data"])])}}});export{xe as default};