import{r as n,j as t,a as r,F as S}from"./react.e658030c.js";import{d as H}from"./zarm.5a521378.js";import{u as k,L as B}from"./index.52024c57.js";import{a as x}from"./Project.b97a5292.js";import{E as A}from"./Empty.350ce403.js";const K="_wrapper_7lgmj_1",q="_tabWrapper_7lgmj_8",G="_tab_7lgmj_8",z="_title_7lgmj_23",J="_inspect_7lgmj_30",M="_triangle_7lgmj_37",Q="_cardWrapper_7lgmj_43",U="_item_7lgmj_52",V="_label_7lgmj_57",X="_content_7lgmj_61",Y="_loadingSvg_7lgmj_64",Z="_rotate_7lgmj_1";var s={wrapper:K,tabWrapper:q,tab:G,title:z,inspect:J,triangle:M,cardWrapper:Q,item:U,label:V,content:X,loadingSvg:Y,rotate:Z};const I="_collapsibleContainer_1xutc_1",O="_closed_1xutc_7";var F={collapsibleContainer:I,closed:O};const ee=({isOpen:o,children:p})=>{const[j,l]=n.exports.useState(o?"auto":"0px"),u=n.exports.useRef(null);return n.exports.useEffect(()=>{var v,f,b,m;if(o){const g=(f=(v=u.current)==null?void 0:v.scrollHeight)!=null?f:0;l(g+"px");const c=setTimeout(()=>{l("auto")},500);return()=>clearTimeout(c)}else{const g=(m=(b=u.current)==null?void 0:b.scrollHeight)!=null?m:0;l(g+"px"),requestAnimationFrame(()=>{l("0px")})}},[o]),t("div",{ref:u,style:{height:j},className:`${F.collapsibleContainer} ${o?F.open:F.closed}}`,children:p})};var te="/m-inspection/assets/triangle.5a27e5a6.svg",se="/m-inspection/assets/loading.b38afab8.svg";const L={normal:0,pull:1,drop:2,loading:3,success:4,failure:5},d={normal:0,abort:1,loading:2,success:3,failure:4,complete:5},ae=({detail:o,onTabClick:p})=>r("div",{className:s.cardWrapper,onClick:()=>{p&&p()},children:[r("div",{className:s.item,children:[t("span",{className:s.label,children:"\u6240\u5C5E\u4EFB\u52A1\uFF1A"}),t("span",{className:s.content,children:o.title})]}),r("div",{className:s.item,children:[t("span",{className:s.label,children:"\u671F"}),t("span",{className:s.label,style:{paddingLeft:"1.7rem"},children:"\u53F7\uFF1A"}),r("span",{className:s.content,children:["\u7B2C",o.period,"\u671F"]})]}),r("div",{className:s.item,children:[t("span",{className:s.label,children:"\u81EA\u67E5\u5468\u671F\uFF1A"}),t("span",{className:s.content,children:o.time_type=="2"?"\u65E0\u9650\u5236":`${o.startTime.split(" ")[0]||"--"} ~ ${o.endTime.split(" ")[0]||"--"}`})]})]}),ie=o=>{const p=k(),j=n.exports.useRef(),[l,u]=n.exports.useState([1]),[v,f]=n.exports.useState(1),[b,m]=n.exports.useState(L.normal),[g,c]=n.exports.useState(d.normal),[h,_]=n.exports.useState([]),[y,E]=n.exports.useState(!1),[$,C]=n.exports.useState(),R=(e,a)=>{p(`/my-self-inspect/${a.room_id}/${e.pid}/self`,{state:{task:e}})};n.exports.useEffect(()=>{(async()=>{await w(1,20)})()},[]);const w=async(e,a)=>{E(!0);const i=await x.getRoomSolfList({page:e,limit:a});i&&i.list?_([...i.list]):_([]),E(!1)},T=async()=>{m(L.loading);try{f(1);const e=await x.getRoomSolfList({page:1,limit:20});_(e.list),m(L.success),c(d.success)}catch{m(L.failure)}},D=async()=>{if(g!==d.loading){c(d.loading);try{const e=v+1,a=await x.getRoomSolfList({page:e,limit:20});a.list&&a.list.length>0?(_([...h,...a.list]),f(e),c(d.success)):c(d.complete)}catch{c(d.failure)}}},P=async e=>{C(e);const a=await x.getProjectList(e),i=[...h],W=i.find(N=>N.room_id===e);a&&a.list&&(W.projectList=a.list.filter(N=>N.pid)),_(i),C(0)};return r("div",{className:s.wrapper,children:[y&&t(B,{}),t(H,{ref:j,animationDuration:1e3,refresh:{state:b,handler:T},load:{state:g,distance:10,handler:D},children:h&&h.length?t(S,{children:h.map(e=>r("div",{className:s.tabWrapper,children:[r("div",{className:s.tab,onClick:()=>{l.includes(e.room_id)?u(l.filter(a=>a!==e.room_id)):(u([...l,e.room_id]),P(e.room_id))},children:[r("div",{className:s.title,children:[e.room_code?`${e.room_code} - `:"",e.room_name]}),r("div",{className:s.inspect,children:["\u8FDB\u884C\u4E2D\uFF1A",e.total,t("img",{className:`${s.triangle}`,style:{transform:l.includes(e.room_id)?"rotate(180deg)":"rotate(0deg)"},src:te,alt:""})]})]}),t("div",{className:s.container,children:t(ee,{isOpen:l.includes(e.room_id),children:$==e.room_id?t(S,{children:r("div",{className:s.loadingSvg,children:[t("img",{src:se,alt:""}),"\u52A0\u8F7D\u4E2D"]})}):t(S,{children:e.projectList&&e.projectList.length?e.projectList.map(a=>t(ae,{detail:a,onTabClick:()=>{R(a,e)}},a.pid)):t(A,{})})})})]},e.room_id))}):y?"":t(A,{})})]})};export{ie as default};
