import{r as m,d as l,F as P,j as t,R as Q}from"./react.6693569e.js";import{a as _,s as U}from"./index.ab3d776b.js";/* empty css               *//* empty css              */import{S as V,a as u,C as n,B as I}from"./antd.e57bc55d.js";const X="_task_vxmsh_1",Y="_buttonGroup_vxmsh_6",Z="_mb8_vxmsh_17",$="_ml16_vxmsh_23",o="_title_vxmsh_26",g="_label_vxmsh_34",M="_value_vxmsh_41",ee="_groupType_vxmsh_50",a={task:X,buttonGroup:Y,mb8:Z,ml16:$,title:o,label:g,value:M,groupType:ee},ce=({params:q,onMethod:c})=>{var E,F,B,j,k,S,R,w,D,G,T,O,W,L,p;const{status:N,approvalId:r}=q,[e,z]=m.exports.useState(null),[H,x]=m.exports.useState(!1),y=m.exports.useCallback(async()=>{try{x(!0);const s={status:2};await _.groupApi.patchApprovalStatus(r,{status:2}),c==null||c("closeWindow",[null,s])}catch(s){c==null||c("closeWindow",[s])}finally{x(!1)}},[c,r]),[J,C]=m.exports.useState(!1),v=m.exports.useCallback(async()=>{try{C(!0);const s={status:1};await _.groupApi.patchApprovalStatus(r,s),c==null||c("closeWindow",[null,s])}catch(s){c==null||c("closeWindow",[s])}finally{C(!1)}},[c,r]);m.exports.useEffect(()=>{Number(N)===1?v().catch(()=>{}):Number(N)===2&&y().catch(()=>{})},[N]);const[K,A]=m.exports.useState(!1);return m.exports.useEffect(()=>{!r||(A(!0),_.groupApi.getApproval(r).then(s=>{z(s),c("setTitle",["\u6CE8\u518C\u5BA1\u6279"])}).finally(()=>{A(!1)}))},[r]),l(P,{children:[t("div",{className:a.task,children:l(V,{spinning:K,children:[l("div",{className:a.mb8,children:[t("div",{className:a.title,children:"\u57FA\u672C\u4FE1\u606F"}),l("div",{className:a.ml16,children:[l(u,{children:[t(n,{className:a.label,span:4,children:"\u59D3\u540D"}),t(n,{className:a.value,span:19,offset:1,children:(E=e==null?void 0:e.user)==null?void 0:E.name})]}),l(u,{children:[t(n,{className:a.label,span:4,children:"\u90AE\u7BB1"}),t(n,{className:a.value,span:19,offset:1,children:(F=e==null?void 0:e.user)==null?void 0:F.email})]}),l(u,{children:[t(n,{className:a.label,span:4,children:U.configStore.alias.refNo}),t(n,{className:a.value,span:19,offset:1,children:(B=e==null?void 0:e.user)==null?void 0:B.ref_no})]}),l(u,{children:[t(n,{className:a.label,span:4,children:"\u4EBA\u5458\u7C7B\u578B"}),t(n,{className:a.value,span:19,offset:1,children:(k=(j=e==null?void 0:e.user)==null?void 0:j.type)==null?void 0:k.name})]})]})]}),((S=e==null?void 0:e.data)==null?void 0:S.groups)&&((w=(R=e==null?void 0:e.data)==null?void 0:R.groups)==null?void 0:w.length)>0&&l("div",{className:a.mb8,children:[t("div",{className:a.title,children:"\u7533\u8BF7\u52A0\u5165\u5206\u7EC4"}),(G=(D=e==null?void 0:e.data)==null?void 0:D.groups)==null?void 0:G.map(s=>{var h;const d=[],f=i=>{i.parent&&f(i.parent),i.name&&d.push(i.name)};s!=null&&s.parent&&f(s==null?void 0:s.parent),d.push(s==null?void 0:s.name);const b=d.join("/");return t("div",{className:a.ml16,children:l(u,{children:[t(n,{className:a.label,span:4,children:(h=s==null?void 0:s.type)==null?void 0:h.name}),t(n,{className:a.value,span:19,offset:1,children:b})]})})})]}),((T=e==null?void 0:e.data)==null?void 0:T.create_group)&&((W=(O=e==null?void 0:e.data)==null?void 0:O.create_group)==null?void 0:W.length)>0&&l("div",{className:a.mb8,children:[t("div",{className:a.title,children:"\u7533\u8BF7\u521B\u5EFA\u5206\u7EC4"}),(p=(L=e==null?void 0:e.data)==null?void 0:L.create_group)==null?void 0:p.map(s=>{var h;const d=[],f=i=>{i.parent&&f(i.parent),i.name&&d.push(i.name)};f(s==null?void 0:s.parent);const b=d.join("/");return l(Q.Fragment,{children:[t("div",{className:a.groupType,children:(h=s==null?void 0:s.type)==null?void 0:h.name}),l("div",{className:a.ml16,children:[l(u,{children:[t(n,{className:a.label,span:4,children:"\u5206\u7EC4\u540D\u79F0"}),t(n,{className:a.value,span:19,offset:1,children:s==null?void 0:s.name})]}),l(u,{children:[t(n,{className:a.label,span:4,children:"\u7236\u7EA7\u5206\u7EC4"}),t(n,{className:a.value,span:19,offset:1,children:b})]}),l(u,{children:[t(n,{className:a.label,span:4,children:"\u5206\u7EC4\u63CF\u8FF0"}),t(n,{className:a.value,span:19,offset:1,children:s==null?void 0:s.description})]})]})]},s.id)})]})]})}),Number(e==null?void 0:e.status)===0&&l("div",{className:a.buttonGroup,children:[t(I,{type:"primary",danger:!0,disabled:Number(e==null?void 0:e.status)!==0,loading:H,onClick:y,children:"\u62D2\u7EDD"}),t(I,{type:"primary",disabled:Number(e==null?void 0:e.status)!==0,loading:J,onClick:v,children:"\u540C\u610F"})]})]})};export{ce as default};
