var te=Object.defineProperty,le=Object.defineProperties;var se=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var K=(l,r,t)=>r in l?te(l,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[r]=t,w=(l,r)=>{for(var t in r||(r={}))ie.call(r,t)&&K(l,t,r[t]);if(H)for(var t of H(r))ne.call(r,t)&&K(l,t,r[t]);return l},I=(l,r)=>le(l,se(r));var b=(l,r,t)=>new Promise((z,p)=>{var d=n=>{try{_(t.next(n))}catch(c){p(c)}},i=n=>{try{_(t.throw(n))}catch(c){p(c)}},_=n=>n.done?z(n.value):Promise.resolve(n.value).then(d,i);_((t=t.apply(l,r)).next())});import ae from"./form-vOGmFg76.js";import pe from"./detail-tHZGhNpK.js";import{_ as ce}from"./Turntable.vue_vue_type_script_setup_true_lang-LSWXEPtD.js";import{_ as me}from"./index.vue_vue_type_script_setup_true_lang-7qz1dg5T.js";import{u as $,w as _e}from"./xlsx-DaVhO591.js";import{n as a,b as ue,r as be,aK as x,ag as k,W as E,aA as L}from"./index-CRmU-Qpi.js";import{_ as fe}from"./index.vue_vue_type_script_setup_true_lang-Vno3adgp.js";import{r as de,s as N,n as ve,t as he}from"./room-3H8Bx0CI.js";import"./index-An8nOBwL.js";import"./statistics-gtweHPF5.js";import"./index.vue_vue_type_script_setup_true_lang-B9ljupwd.js";import"./hooks-ItYVRz1P.js";import"./blindBox-BqHhL4EW.js";import"./statistics-B6YG3tm9.js";import"./Results-CDWDzDys.js";function Pe(){const l=a(),r=a(!0),t=a([]),z=a(!1),p=a({search_room_id:"",search_user_id:"",search_status:""}),d=a([{label:"房间号",prop:"search_room_id",type:"input"},{label:"房主ID",prop:"search_user_id",type:"input"},{label:"房间状态",prop:"search_status",type:"select",optionList:[{label:"正常",value:1},{label:"封禁",value:2},{label:"关闭",value:3}]},{label:"是否热门",prop:"is_hot",type:"select",optionList:[{label:"是",value:2},{label:"否",value:1}]},{label:"是否置顶",prop:"is_top",type:"select",optionList:[{label:"是",value:2},{label:"否",value:1}]},{label:"房间类型",prop:"type_id",type:"select",optionList:[]}]),i=a({total:0,pageSize:10,pageSizes:[10,20,50,100],currentPage:1,background:!0}),_=a([{label:"房间号",prop:"room_code"},{label:"靓号",prop:"room_number"},{label:"房主",prop:"user_name"},{label:"房间名称",prop:"room_name"},{label:"封面图",prop:"room_cover",cellRenderer:({row:o})=>ue(be("el-image"),{fit:"cover","preview-teleported":!0,src:o.room_cover,"preview-src-list":Array.of(o.room_cover),class:"w-[24px] h-[24px] rounded-full align-middle"},null)},{label:"房间分类",prop:"room_type_str"},{label:"是否推荐",prop:"is_recommend"},{label:"是否置顶",prop:"is_top"},{label:"是否热门",prop:"is_hot"},{label:"是否有收益",prop:"is_earnings"},{label:"所属工会",prop:"guild_name"},{label:"房间状态",prop:"room_status_str"},{label:"创建时间",prop:"createtime"},{label:"操作",fixed:"right",width:300,slot:"operation"}]),n=()=>b(this,null,function*(){const{data:o,code:s}=yield de({});s&&(d.value[d.value.length-1].optionList=o.lists.map(e=>({label:e.type_name,value:e.id})))}),c=o=>b(this,null,function*(){r.value=!0,p.value=w({},o);const{data:s,code:e}=yield N(I(w({},o),{page:i.value.currentPage,page_limit:i.value.pageSize}));e&&(t.value=s.lists,i.value.total=s.count,i.value.currentPage=s.page),r.value=!1}),W=o=>{i.value.pageSize=o,c(p.value)},X=o=>{i.value.currentPage=o,c(p.value)},j=(o,s)=>b(this,null,function*(){x({title:"查看房间详情",props:{tableData:s},width:"60%",hideFooter:!0,closeOnClickModal:!1,contentRenderer:()=>k(pe)})}),G=(o="新增",s)=>b(this,null,function*(){const{data:e,code:M}=yield ve({room_id:s.room_id});M?E(()=>{var u,R,m,D,S,v,h,C,g,f,y,F,T,q,A,V,B;x({title:`${o}房间`,props:{roomDetail:e,formInline:{room_number:(u=e==null?void 0:e.room_number)!=null?u:"",room_name:(R=e==null?void 0:e.room_name)!=null?R:"",room_intro:(m=e==null?void 0:e.room_intro)!=null?m:"",room_cover:(D=e==null?void 0:e.room_cover)!=null?D:"",room_background_id:(S=e==null?void 0:e.room_background_id)!=null?S:"",type_id:(v=e==null?void 0:e.type_id)!=null?v:"",is_earnings:(h=e==null?void 0:e.is_earnings)!=null?h:"",is_top:(C=e==null?void 0:e.is_top)!=null?C:"",is_hot:(g=e==null?void 0:e.is_hot)!=null?g:"",is_recommend:(f=e==null?void 0:e.is_recommend)!=null?f:"",room_status:(y=e==null?void 0:e.room_status)!=null?y:"",is_show_room:(F=e==null?void 0:e.is_show_room)!=null?F:"",is_room_password:(T=e==null?void 0:e.is_room_password)!=null?T:"",room_password:(q=e==null?void 0:e.room_password)!=null?q:"",is_robot_num:(A=e==null?void 0:e.is_robot_num)!=null?A:"",robot_num:(V=e==null?void 0:e.robot_num)!=null?V:"",is_open_blind_box_turntable:(B=e==null?void 0:e.is_open_blind_box_turntable)!=null?B:""}},width:"40%",closeOnClickModal:!1,contentRenderer:()=>k(ae,{ref:l,formInline:null}),beforeSure:(U,{options:Y})=>{const Z=l.value.getRef(),ee=Y.props.formInline,oe=O=>b(this,null,function*(){const{code:re}=yield he(I(w({},O),{room_id:s.room_id}));re?(L("修改成功",{type:"success"}),c(p.value),U()):L("修改失败",{type:"error"})});Z.validate(O=>{O&&(o==="新增"||oe(ee))})}})}):L("获取房间信息失败",{type:"error"})}),J=o=>{E(()=>{x({title:"盲盒转盘统计",props:{roomDetail:o},fullscreen:!0,hideFooter:!0,closeOnClickModal:!1,contentRenderer:()=>k(ce,{ref:l,formInline:null})})})},Q=o=>{E(()=>{x({title:"巡乐会数据统计",props:{roomDetail:o},fullscreen:!0,hideFooter:!0,closeOnClickModal:!1,contentRenderer:()=>k(me,{ref:l,formInline:null})})})},P=a(null);return{searchForm:p,searchLabel:d,onSearch:c,isShow:z,tableList:t,tableLabel:_,pagination:i,handleSizeChange:W,handleCurrentChange:X,loading:r,exportExcel:()=>{let o=[];x({title:"导出数据",props:{formInline:{time:""}},width:"40%",closeOnClickModal:!1,contentRenderer:()=>k(fe,{ref:P,formInline:null}),beforeSure:(s,{options:e})=>{const M=P.value.getRef(),u=e.props.formInline,R=m=>b(this,null,function*(){const{data:D,code:S}=yield N(I(w({},m),{page:1,page_limit:2e4}));if(S){o=D.lists;const v=o.map(f=>{const y=[];return _.value.forEach(F=>{y.push(f[F.prop])}),y}),h=[];_.value.forEach(f=>{h.push(f.label)}),v.unshift(h);const C=$.aoa_to_sheet(v),g=$.book_new();$.book_append_sheet(g,C,"数据报表"),_e(g,`房间列表统计${m.begin_time} - ${m.end_time}.xlsx`),L("导出成功",{type:"success"}),s()}else L("获取数据失败,请重试!",{type:"error"})});M.validate(m=>{m&&u.time&&u.time.length&&R({begin_time:u.time[0]||"",end_time:u.time[1]||""})})}})},viewDetail:j,editDialog:G,viewTurntableData:J,viewXunLeHuiData:Q,getListType:n}}export{Pe as useData};