Files
yusheng-admin/dist/static/js/hook-CjIFaqzN.js
2025-10-23 11:07:17 +08:00

2 lines
2.6 KiB
JavaScript

var x=Object.defineProperty,F=Object.defineProperties;var $=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var P=(n,e,a)=>e in n?x(n,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[e]=a,m=(n,e)=>{for(var a in e||(e={}))A.call(e,a)&&P(n,a,e[a]);if(L)for(var a of L(e))K.call(e,a)&&P(n,a,e[a]);return n},b=(n,e)=>F(n,$(e));var u=(n,e,a)=>new Promise((h,i)=>{var v=t=>{try{r(a.next(t))}catch(f){i(f)}},o=t=>{try{r(a.throw(t))}catch(f){i(f)}},r=t=>t.done?h(t.value):Promise.resolve(t.value).then(v,o);r((a=a.apply(n,e)).next())});import{_ as M}from"./form.vue_vue_type_script_setup_true_lang-BlmxE0Vv.js";import{n as c,aA as d,aK as O,ag as j}from"./index-CRmU-Qpi.js";import{q as B,r as E,a as G,e as H}from"./gift-BjNBi56Q.js";function X(){const n=c(),e=c(!0),a=c([]),h=c(!1),i=c({name:""}),v=c([{label:"标签名称",prop:"name",type:"input"}]),o=c({total:0,pageSize:10,pageSizes:[10,20,50,100],currentPage:1,background:!0}),r=c([{label:"ID",prop:"id"},{label:"排序",prop:"sort",width:100},{label:"礼物分类",prop:"type"},{label:"标签名称",prop:"name"},{label:"创建时间",prop:"createtime"},{label:"操作",fixed:"right",width:210,slot:"operation"}]),t=l=>u(this,null,function*(){e.value=!0,i.value=m({},l);const{data:s,code:g}=yield B(b(m({},l),{page:o.value.currentPage,page_limit:o.value.pageSize}));g&&(a.value=s.lists,o.value.total=s.count,o.value.currentPage=s.page),e.value=!1});return{searchForm:i,searchLabel:v,onSearch:t,isShow:h,tableList:a,tableLabel:r,pagination:o,handleSizeChange:l=>{o.value.pageSize=l,t(i.value)},handleCurrentChange:l=>{o.value.currentPage=l,t(i.value)},loading:e,handleDelete:l=>u(this,null,function*(){const{code:s}=yield E({id:l.id});s&&(d(`您删除了标签名称为${l.name}的这条数据`,{type:"success"}),t(i.value))}),openDialog:(l="新增",s)=>{var g,C,S;O({title:`${l}礼物标签`,props:{formInline:{sort:(g=s==null?void 0:s.sort)!=null?g:0,tid:(C=s==null?void 0:s.tid)!=null?C:"",name:(S=s==null?void 0:s.name)!=null?S:""}},width:"40%",closeOnClickModal:!1,contentRenderer:()=>j(M,{ref:n,formInline:null}),beforeSure:(z,{options:R})=>{const _=n.value.getRef(),I=R.props.formInline,k=p=>u(this,null,function*(){const{code:y}=yield G(p);y?(d("新增成功",{type:"success"}),t(i.value),z()):d("新增失败",{type:"error"})}),q=p=>u(this,null,function*(){const{code:y}=yield H(b(m({},p),{id:s.id}));y?(d("修改成功",{type:"success"}),t(i.value),z()):d("修改失败",{type:"error"})});_.validate(p=>{p&&(l==="新增"?k(I):q(I))})}})}}}export{X as useData};