2 lines
2.8 KiB
JavaScript
2 lines
2.8 KiB
JavaScript
|
|
var L=Object.defineProperty,$=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var z=(t,e,a)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,h=(t,e)=>{for(var a in e||(e={}))F.call(e,a)&&z(t,a,e[a]);if(k)for(var a of k(e))K.call(e,a)&&z(t,a,e[a]);return t},R=(t,e)=>$(t,q(e));var p=(t,e,a)=>new Promise((d,f)=>{var s=o=>{try{i(a.next(o))}catch(g){f(g)}},b=o=>{try{i(a.throw(o))}catch(g){f(g)}},i=o=>o.done?d(o.value):Promise.resolve(o.value).then(s,b);i((a=a.apply(t,e)).next())});import{_ as M}from"./form.vue_vue_type_script_setup_true_lang-B5Zt0w7a.js";import{n as c,b as N,r as O,aK as V,ag as j,aA as u}from"./index-CRmU-Qpi.js";import{c as B,f as E,h as H,i as J}from"./activities-UkTzwAkp.js";function Z(){const t=c(),e=c(null),a=c(!0),d=c([]),f=c(!1),s=c({total:0,pageSize:10,currentPage:1,pageSizes:[10,20,50,100],background:!0}),b=c([{label:"ID",prop:"id"},{label:"礼物名称",prop:"name"},{label:"封面图",prop:"icon",cellRenderer:({row:n})=>N(O("el-image"),{fit:"cover","preview-teleported":!0,src:n.icon,"preview-src-list":Array.of(n.icon),class:"w-[50px] h-[50px] align-middle"},null)},{label:"数量",prop:"num"},{label:"价格",prop:"gold"},{label:"类型",prop:"type_str"},{label:"添加时间",prop:"createtime"},{label:"操作",fixed:"right",width:210,slot:"operation"}]),i=n=>p(this,null,function*(){e.value=h({},n),a.value=!0;const{data:l,code:m}=yield B({gift_bag_id:e.value.id,page:s.value.currentPage,page_limit:s.value.pageSize});m&&(d.value=l.lists.map(v=>h({},v)),s.value.total=l.count,s.value.currentPage=l.page),a.value=!1});return{onSearch:i,isShow:f,tableList:d,tableLabel:b,pagination:s,handleSizeChange:n=>{s.value.pageSize=n,i(e.value)},handleCurrentChange:n=>{s.value.currentPage=n,i(e.value)},handleDelete:n=>p(this,null,function*(){const{code:l}=yield E({id:n.id});l&&(u(`您删除了名称为${n.name}的这条数据`,{type:"success"}),i(e.value))}),loading:a,openDialog:(n="新增",l)=>{var m,v,_,S;V({title:`${n}礼物`,props:{formInline:{type:(m=l==null?void 0:l.type)!=null?m:"",num:(v=l==null?void 0:l.num)!=null?v:"",gift_id:(_=l==null?void 0:l.gift_id)!=null?_:"",gift_bag_id:(S=e.value.id)!=null?S:""}},width:"40%",closeOnClickModal:!1,contentRenderer:()=>j(M,{ref:t,formInline:null}),beforeSure:(C,{options:x})=>{const G=t.value.getRef(),P=x.props.formInline,I=r=>p(this,null,function*(){const{code:y}=yield H(r);y?(u("新增成功",{type:"success"}),i(e.value),C()):u("新增失败",{type:"error"})}),A=r=>p(this,null,function*(){const{code:y}=yield J(R(h({},r),{id:l.id}));y?(u("修改成功",{type:"success"}),i(e.value),C()):u("修改失败",{type:"error"})});G.validate(r=>{r&&(n==="新增"?I(P):A(P))})}})}}}export{Z as useData};
|