import{r as n,d as _,j as e,F as k}from"./react.6693569e.js";import{a as w}from"./index.ab3d776b.js";/* empty css              *//* empty css              *//* empty css              *//* empty css               */import{c as I}from"./ColorPicker.0ba20714.js";import"./index.0a6cc9fb.js";import"./index.f92af1bb.js";/* empty css              */import{ao as D,ap as E,aq as A,B as y,m as S,T as b}from"./antd.e57bc55d.js";const T="_todo_gc7uf_1",N="_main_gc7uf_10",z={todo:T,main:N},J="_btnGroup_12xop_1",P="_button_12xop_4",j="_pending_12xop_10",$="_resolve_12xop_13",K="_reject_12xop_16",Q="_content_12xop_19",R="_table_12xop_25",q="_pagination_12xop_29",o={btnGroup:J,button:P,pending:j,resolve:$,reject:K,content:Q,table:R,pagination:q},L=()=>{const[p,g]=n.exports.useState([]),[m,h]=n.exports.useState(0),[i,u]=n.exports.useState({current:1,pageSize:10}),[C,x]=n.exports.useState(!1),F=async()=>{const{current:a,pageSize:t}=i,{items:r,total:B}=await w.groupApi.getJoinGroups({status:0,page_start:a,page_size:t});h(B),g(r.map((G,f)=>({key:f+1,index:f+1,...G})))},l=n.exports.useRef(0),s=async a=>{await I(1e3);const t=await w.groupApi.waitingApproveJoinGroup(a);if(l.current++,t.status===2){await F(),l.current=0;return}l.current<5?await s(a):l.current=0},c=async({id:a,status:t})=>{try{x(!0);const{event_id:r}=await w.groupApi.approveJoinGroup({id:a,params:{status:t}});await s(r),S.success("\u64CD\u4F5C\u6210\u529F")}catch(r){console.error(r),S.error("\u64CD\u4F5C\u5931\u8D25")}finally{x(!1)}};n.exports.useEffect(()=>{F()},[i]);const d=[{dataIndex:"index",title:"\u7F16\u53F7",width:80,align:"center"},{dataIndex:"content",title:"\u5904\u7406\u4E8B\u9879",width:300,render:(a,t)=>{const r=`\u7528\u6237 ${t.applicant_name} \u7533\u8BF7\u52A0\u5165 \u5206\u7EC4 ${t.group_name}`;return{children:e(A,{overlay:r,children:e("span",{children:r})})}}},{dataIndex:"apply_time",title:"\u65F6\u95F4",width:180,align:"center"},{dataIndex:"applicant_name",title:"\u7533\u8BF7\u4EBA",width:180,align:"center"},{dataIndex:"optional",title:"\u64CD\u4F5C",width:180,fixed:"right",render:(a,t)=>({children:_(k,{children:[e(y,{type:"link",size:"small",onClick:()=>c({id:t.id,status:2}),children:"\u540C\u610F"}),e(y,{type:"link",size:"small",onClick:()=>c({id:t.id,status:1}),children:"\u62D2\u7EDD"}),e(y,{type:"link",size:"small",onClick:()=>{},children:"\u67E5\u770B\u8BE6\u60C5"})]})})}],v=a=>{u({...i,current:a})};return _("div",{className:o.content,children:[e(D,{className:o.table,loading:C,columns:d,dataSource:p,bordered:!0,size:"small",scroll:{y:"60vh"},pagination:!1}),e(E,{className:o.pagination,current:i.current,pageSize:i.pageSize,total:m,size:"small",showQuickJumper:!0,onChange:v})]})},M={\u5F85\u5BA1\u6838:o.pending,\u5DF2\u901A\u8FC7:o.resolve,\u5DF2\u62D2\u7EDD:o.reject},H=p=>{const[g,m]=n.exports.useState([]),[h,i]=n.exports.useState(0),[u,C]=n.exports.useState({current:1,pageSize:10}),x=async()=>{const{current:s,pageSize:c}=u,{items:d,total:v}=await w.groupApi.getJoinGroups({page_start:s,page_size:c});i(v),m(d.map((a,t)=>({key:t+1,index:t+1,...a})))};n.exports.useEffect(()=>{x()},[u]);const F=[{dataIndex:"index",title:"\u7F16\u53F7",width:80,align:"center"},{dataIndex:"content",title:"\u5904\u7406\u4E8B\u9879",width:300,render(s,c){const d=`\u7528\u6237 ${c.applicant_name} \u7533\u8BF7\u52A0\u5165 \u5206\u7EC4 ${c.group_name}`;return{children:e(A,{overlay:d,children:e("span",{children:d})})}}},{dataIndex:"approver_name",title:"\u5904\u7406\u4EBA",width:180,align:"center"},{dataIndex:"status_message",title:"\u5904\u7406\u7ED3\u679C",width:180,align:"center",render(s){return{children:e("span",{className:M[s],children:s})}}},{dataIndex:"approve_time",title:"\u5904\u7406\u65F6\u95F4",width:180,align:"center"}],l=s=>{C({...u,current:s})};return _("div",{className:o.content,children:[e(D,{className:o.table,columns:F,dataSource:g,bordered:!0,size:"small",scroll:{y:"60vh"},pagination:!1}),e(E,{className:o.pagination,current:u.current,pageSize:u.pageSize,total:h,size:"small",showQuickJumper:!0,onChange:l})]})},se=()=>{const[p,g]=n.exports.useState("auditor"),m=h=>{g(h)};return _("div",{className:z.todo,children:[e("h3",{children:"\u5F85\u529E\u4E8B\u9879"}),_(b,{className:z.main,activeKey:p,onChange:m,children:[e(b.TabPane,{tab:"\u5F85\u5904\u7406",children:p==="auditor"&&e(L,{})},"auditor"),e(b.TabPane,{tab:"\u5DF2\u5904\u7406",children:p==="processed"&&e(H,{})},"processed")]})]})};export{se as default};
