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

2 lines
2.7 KiB
JavaScript

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