import{x as O,q as T,h as M}from"./elementPlus.CXoFsoPv.js";import{u as N,a as $}from"./useTableData.YE2EVtgg.js";import{u as L}from"./useResponse.DqThFJSa.js";import{P as h}from"./Columns.D29A1xlB.js";import{_ as j}from"./index.vue_vue_type_script_setup_true_lang.DKtMKa0b.js";import{_ as q}from"./DataTableSlot.vue_vue_type_script_setup_true_lang.CGOPUJDM.js";import F from"./EditDrawer.BpIe5ipb.js";import I from"./NoticeDialog.BWvfidO5.js";import{g as K,d as Z}from"./api.CUqZ8T2Z.js";import{_ as A}from"./CreateDialog.vue_vue_type_script_setup_true_lang.BTsFXq3A.js";import{h as G}from"./hasPermission.Dyr7g3RK.js";import{d as J,r as d,Z as Q,E as W,j as X,ai as p,o as s,c as Y,U as i,aa as ee,a8 as oe,O as r,u as e,K as ae,am as te,M as f,D as k,R as C,F as ne,B as re,S as le}from"./vue.1RczIYhx.js";import{_ as se}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./api.BKSbPohE.js";import"./index.fM6cvGYs.js";const ie=J({__name:"DataTable",setup(ue,{expose:D}){const b=re("query-parameter"),{tableOptions:v,handlePageChange:R}=N(l),x=d(),o=Q({id:"product-attribute-table",keepSource:!0,size:"small",border:!1,round:!0,stripe:!0,currentRowHighLight:!0,height:"100%",customConfig:{storage:!0},toolbarConfig:{size:"large",slots:{tools:"toolbar_tools",buttons:"toolbar_buttons"}},rowConfig:{isHover:!0},columnConfig:{},pagerConfig:{total:v.value.total,page:v.value.page,limit:v.value.limit},loading:!1,loadingConfig:{icon:"vxe-icon-indicator roll",text:"正在拼命加载中..."},columns:"",data:""}),u=d(!1),m=d(!1),w=d({}),g=d(!1);W(()=>{o.pagerConfig.limit=20}),X(()=>{l()});async function l(n=!1){var c,_;n&&(o.pagerConfig.page=1),o.data=[],o.columns=[];const a={brand_name:b==null?void 0:b.name};await $(K,a,o),o&&((c=o.data)!=null&&c.length)&&await x.value.loadColumn(h),o.showHeader=!!((_=o.data)!=null&&_.length)}function y(){l()}function P(n){u.value=!0,w.value=n}function B(){m.value=!0}async function E(n){(await L(Z,n)).code===2e3&&(M.error({message:"已删除!",plain:!0,icon:"Delete"}),y())}const S={custom({type:n}){n=="confirm"&&l()}};return D({fetchList:l}),(n,a)=>{const c=p("el-icon"),_=p("el-button"),U=p("vxe-pager"),z=p("el-empty"),H=p("vxe-grid");return s(),Y(ne,null,[i(H,ae({ref_key:"gridRef",ref:x},e(o),te(S)),ee({toolbar_buttons:r(()=>[e(G)("SkuBrandCreate")?(s(),f(j,{key:0,icon:e(O),plain:"",round:"",type:"primary",onClick:B},{default:r(()=>a[5]||(a[5]=[le("新 增")])),_:1},8,["icon"])):C("",!0)]),toolbar_tools:r(()=>[i(_,{circle:"",class:"toolbar-btn",onClick:y},{default:r(()=>[i(c,null,{default:r(()=>[i(e(T))]),_:1})]),_:1})]),pager:r(()=>[i(U,{currentPage:e(o).pagerConfig.page,"onUpdate:currentPage":a[0]||(a[0]=t=>e(o).pagerConfig.page=t),pageSize:e(o).pagerConfig.limit,"onUpdate:pageSize":a[1]||(a[1]=t=>e(o).pagerConfig.limit=t),total:e(o).pagerConfig.total,class:"mt-1.5",onPageChange:e(R)},null,8,["currentPage","pageSize","total","onPageChange"])]),empty:r(()=>[i(z,{description:"暂无数据"})]),_:2},[oe(e(h),t=>({name:`${t.field}`,fn:r(({row:V})=>[(s(),f(q,{key:V.id,field:t.field,row:V,onEditRow:P,onHandleDelete:E},null,8,["field","row"]))])}))]),1040),e(u)?(s(),f(F,{key:0,modelValue:e(u),"onUpdate:modelValue":a[2]||(a[2]=t=>k(u)?u.value=t:null),"row-data":e(w),onRefresh:y},null,8,["modelValue","row-data"])):C("",!0),e(g)?(s(),f(I,{key:1,modelValue:e(g),"onUpdate:modelValue":a[3]||(a[3]=t=>k(g)?g.value=t:null),"row-data":e(w)},null,8,["modelValue","row-data"])):C("",!0),e(m)?(s(),f(A,{key:2,modelValue:e(m),"onUpdate:modelValue":a[4]||(a[4]=t=>k(m)?m.value=t:null),onRefresh:l},null,8,["modelValue"])):C("",!0)],64)}}}),he=se(ie,[["__scopeId","data-v-5e1b0ac1"]]);export{he as default};
