2 lines
3.4 KiB
JavaScript
2 lines
3.4 KiB
JavaScript
var M=Object.defineProperty,T=Object.defineProperties;var V=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var I=(n,a,t)=>a in n?M(n,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[a]=t,C=(n,a)=>{for(var t in a||(a={}))$.call(a,t)&&I(n,t,a[t]);if(_)for(var t of _(a))k.call(a,t)&&I(n,t,a[t]);return n},R=(n,a)=>T(n,V(a));var p=(n,a,t)=>new Promise((v,c)=>{var h=i=>{try{g(t.next(i))}catch(l){c(l)}},o=i=>{try{g(t.throw(i))}catch(l){c(l)}},g=i=>i.done?v(i.value):Promise.resolve(i.value).then(h,o);g((t=t.apply(n,a)).next())});import{_ as A}from"./form.vue_vue_type_script_setup_true_lang-B-fxyO5i.js";import{n as r,b as E,r as U,fI as q,aA as d,aK as H,ag as K}from"./index-CRmU-Qpi.js";import{l as N,m as O,n as j,o as G,p as J}from"./system-CqYheEHE.js";function ae(){const n=r(),a=r(!0),t=r([]),v=r(!1),c=r({search_name:""}),h=r([{label:"分类名称",prop:"search_name",type:"input"}]),o=r({total:0,pageSize:10,pageSizes:[10,20,50,100],currentPage:1,background:!0}),g=r([{label:"ID",prop:"crid"},{label:"充值金额",prop:"money"},{label:"金币",prop:"coins"},{label:"状态",prop:"status",cellRenderer:({row:e,props:s})=>E(U("el-switch"),{modelValue:e.status,"onUpdate:modelValue":u=>e.status=u,onChange:()=>i(e),"active-value":1,"inactive-value":2,"active-text":"显示","inactive-text":"隐藏","active-color":"#13ce66","inactive-color":"#ff4949"},null)},{label:"发布人员",prop:"admin"},{label:"创建时间",prop:"createtime"},{label:"操作",fixed:"right",width:210,slot:"operation"}]),i=e=>p(this,null,function*(){a.value||q.confirm(`确认要<strong>${e.status===2?"隐藏":"显示"}</strong><strong style='color:var(--el-color-primary)'></strong>吗?`,"系统提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",dangerouslyUseHTMLString:!0,draggable:!0}).then(()=>p(this,null,function*(){const{data:s,code:u}=yield N({id:e.id,status:e.status});u&&d(`已${e.status===2?"隐藏":"显示"}`,{type:"success"})})).catch(()=>{e.status==2?e.status=1:e.status=2})}),l=e=>p(this,null,function*(){a.value=!0;const{data:s,code:u}=yield O(R(C({},e),{page:o.value.currentPage,page_limit:o.value.pageSize}));u&&(t.value=s.lists.map(f=>(f.status,f)),o.value.total=s.count,o.value.currentPage=s.page),a.value=!1});return{searchForm:c,searchLabel:h,onSearch:l,isShow:v,tableList:t,tableLabel:g,pagination:o,handleSizeChange:e=>{o.value.pageSize=e,l(c.value)},handleCurrentChange:e=>{o.value.currentPage=e,l(c.value)},loading:a,handleDelete:e=>p(this,null,function*(){const{code:s}=yield j({id:e.crid});s&&(d("删除成功",{type:"success"}),l(c.value))}),openDialog:(e="新增",s)=>{var u,f,S;H({title:`${e}充值规则`,props:{formInline:{money:(u=s==null?void 0:s.money)!=null?u:"",coins:(f=s==null?void 0:s.coins)!=null?f:"",status:(S=s==null?void 0:s.status)!=null?S:""}},width:"40%",closeOnClickModal:!1,contentRenderer:()=>K(A,{ref:n,formInline:null}),beforeSure:(x,{options:L})=>{const P=n.value.getRef(),z=L.props.formInline,B=m=>p(this,null,function*(){const{code:y,msg:b}=yield G(m);y?(d("新增成功",{type:"success"}),l(c.value),x()):d(b,{type:"error"})}),F=m=>p(this,null,function*(){const{code:y,msg:b}=yield J(R(C({},m),{id:s.crid}));y?(d("修改成功",{type:"success"}),l(c.value),x()):d(b,{type:"error"})});P.validate(m=>{m&&(e==="新增"?B(z):F(z))})}})}}}export{ae as useData};
|