import{r as o,j as t,a as r,F as S}from"./react.b0bedc10.js";import{d as H}from"./zarm.80120c4d.js";import{u as k,L as B}from"./index.a3f0fe79.js";import{P as x}from"./Project.fe0152f3.js";import{E as A}from"./Empty.1ca4811e.js";import"./Patrol.49bc16dd.js";import"./searchEmpty.9ddd526b.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:n,children:p})=>{const[j,l]=o.exports.useState(n?"auto":"0px"),m=o.exports.useRef(null);return o.exports.useEffect(()=>{var v,f,b,u;if(n){const g=(f=(v=m.current)==null?void 0:v.scrollHeight)!=null?f:0;l(g+"px");const c=setTimeout(()=>{l("auto")},500);return()=>clearTimeout(c)}else{const g=(u=(b=m.current)==null?void 0:b.scrollHeight)!=null?u:0;l(g+"px"),requestAnimationFrame(()=>{l("0px")})}},[n]),t("div",{ref:m,style:{height:j},className:`${F.collapsibleContainer} ${n?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:n,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:n.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",n.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:n.time_type=="2"?"\u65E0\u9650\u5236":`${n.startTime.split(" ")[0]||"--"} ~ ${n.endTime.split(" ")[0]||"--"}`})]})]}),pe=n=>{const p=k(),j=o.exports.useRef(),[l,m]=o.exports.useState([1]),[v,f]=o.exports.useState(1),[b,u]=o.exports.useState(L.normal),[g,c]=o.exports.useState(d.normal),[h,_]=o.exports.useState([]),[y,E]=o.exports.useState(!1),[$,C]=o.exports.useState(),R=(e,a)=>{p(`/my-self-inspect/${a.room_id}/${e.pid}/self`,{state:{task:e}})};o.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)},P=async()=>{u(L.loading);try{f(1);const e=await x.getRoomSolfList({page:1,limit:20});_(e.list),u(L.success),c(d.success)}catch{u(L.failure)}},T=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)}}},D=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:P},load:{state:g,distance:10,handler:T},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)?m(l.filter(a=>a!==e.room_id)):(m([...l,e.room_id]),D(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{pe as default};
