Files
yusheng-admin/dist/static/js/hook-B3EaNBmR.js

2 lines
3.0 KiB
JavaScript
Raw Normal View History

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