import{r as c,m as U,_ as H,p as M,f as J,A as K,u as q,t as Q,F as p,d as i,j as e,I as W,D as b,a as k,B as C,R as X,aJ as Z,h as ee,aK as te,g as u,o as ae,b as se,M as ne,q as re}from"./index-CKIL6d0V.js";import{F as ie}from"./Table-BaVi_066.js";import{R as le}from"./MoreOutlined-D6hW6YIc.js";import{R as oe}from"./DeleteOutlined-BHDTCKcb.js";import"./iconUtil-Co5gbObL.js";import"./index-C-LPyJas.js";var ce={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M956 686.5l-.1-.1-.1-.1C911.7 593 843.4 545 752.5 545s-159.2 48.1-203.4 141.3v.1a42.92 42.92 0 000 36.4C593.3 816 661.6 864 752.5 864s159.2-48.1 203.4-141.3c5.4-11.5 5.4-24.8.1-36.2zM752.5 800c-62.1 0-107.4-30-141.1-95.5C645 639 690.4 609 752.5 609c62.1 0 107.4 30 141.1 95.5C860 770 814.6 800 752.5 800z"}},{tag:"path",attrs:{d:"M697 705a56 56 0 10112 0 56 56 0 10-112 0zM136 232h704v253h72V192c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v520c0 17.7 14.3 32 32 32h352v-72H136V232z"}},{tag:"path",attrs:{d:"M724.9 338.1l-36.8-36.8a8.03 8.03 0 00-11.3 0L493 485.3l-86.1-86.2a8.03 8.03 0 00-11.3 0L251.3 543.4a8.03 8.03 0 000 11.3l36.8 36.8c3.1 3.1 8.2 3.1 11.3 0l101.8-101.8 86.1 86.2c3.1 3.1 8.2 3.1 11.3 0l226.3-226.5c3.2-3.1 3.2-8.2 0-11.3z"}}]},name:"fund-view",theme:"outlined"},de=function(n,h){return c.createElement(U,H({},n,{ref:h,icon:ce}))},me=c.forwardRef(de);const pe=M.div`
height: 100%;
font-size: 16px;

display: flex;
flex-direction: column;
.topSearch {
  height: 60px;
  padding-left: 15px;
  margin-bottom: 16px;
  background-color: ${m=>m.theme.colorBgContainer};
  .ant-form {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

  }
  .userTitle {
    height: 100%;
    line-height: 60px;
    font-size: 18px;
    letter-spacing: 2px;
    .word {
      margin-left: 10px;
    }
  }
}

.tableList {
  flex: 1;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  background-color: ${m=>m.theme.colorBgContainer};
}
`,ue=M.div`
  height: 100%;
  min-height: 100px;
  padding: 16px;
  .detailInfo {
    .item {
      height: 60px;
      display: flex;
      align-items: center;
      .name {
        width: 100px;
        text-align: right;
      }
      .value {
        flex: 1;
        padding-left: 20px;

      }
      .download {
        color: skyblue;
        cursor: pointer;
      }
    }
  }
`,he=c.memo(()=>{const{userInfo:m}=J(t=>t),{message:n,modal:h}=K.useApp(),D=q(),{token:y}=Q.useToken(),[T,f]=c.useState(!1),[d,j]=c.useState(null),[v,N]=c.useState([]),[_,x]=c.useState(0),[w]=p.useForm(),[R,g]=c.useState([]);c.useEffect(()=>{const t={startTime:i().add(-1,"y").format("YYYY-MM-DD"),endTime:i().startOf("day").format("YYYY-MM-DD"),pageIndex:1,pageSize:50};(async()=>{const{code:a,data:{items:r,totalRecords:l}}=await u("/api/PsyCounse/GetPsyGroupCounseling",t);a===200&&(g(r),x(l));const o=await u("/api/Person/All",{pageIndex:1,pageSize:50});N(o.data)})()},[]);const F=[{title:"序号",width:80,dataIndex:"id",align:"center",key:"id",render:(t,s,a)=>e.jsx(e.Fragment,{children:a+1})},{title:"记录日期",dataIndex:"updatetime",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:i(t).format("YYYY-MM-DD")})},{title:"辅导日期",dataIndex:"tutor_date",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:i(t).format("YYYY-MM-DD")})},{title:"辅导活动名称",dataIndex:"tutor_name",align:"center",ellipsis:!0,key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"发起人",dataIndex:"counsellor_name",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"参与人员",dataIndex:"players",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:I(t)})},{title:"活动人数",dataIndex:"players_num",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"操 作",dataIndex:"id",align:"center",key:"id",render:(t,s)=>e.jsxs(k,{style:{color:y.colorPrimaryText},children:[e.jsxs("span",{style:{cursor:"pointer"},onClick:()=>G(s),children:[e.jsx(me,{})," 查 看"]}),m.isAdmin===2&&e.jsx(ae,{placement:"bottom",arrow:!0,menu:{items:O,onClick:a=>P(a,s)},children:e.jsxs("span",{style:{cursor:"pointer"},children:[e.jsx(le,{})," 更 多"]})})]})}],O=[{label:e.jsx("span",{children:"编 辑"}),icon:e.jsx(se,{}),key:"2"},{type:"divider"},{label:e.jsx("span",{children:"删 除"}),icon:e.jsx(oe,{}),key:"3"}],P=({key:t},s)=>{switch(t){case"3":h.confirm({title:"温馨提示",content:"确定删除吗?",okText:"删除",onOk(){h.confirm({title:"再次提示",content:"该操作不可逆,请确认删除",okText:"确定",onOk(){S(s.id)}})}});break;case"2":Y(s);break}},S=async t=>{const s=await ne(`/api/PsyCounse/PsyGroupCounselingDelete/${t}`);if(s.code===200){n.success(s.msg);const{code:a,data:{items:r,totalRecords:l}}=await u("/api/PsyCounse/GetPsyGroupCounseling",{startTime:i().add(-1,"y").format("YYYY-MM-DD"),endTime:i().startOf("day").format("YYYY-MM-DD"),pageIndex:1,pageSize:50});a===200&&(g(r),x(l))}},z=async t=>{if(t.startTime)if(t.endTime){if(i(t.startTime).valueOf()>i(t.endTime).valueOf()){n.warning("开始日期不得大于结束日期");return}}else{n.warning("请选择结束日期");return}else{n.warning("请选择开始日期");return}const s={...t};s.pageIndex=1,s.pageSize=50,console.log(s);try{const{code:a,data:{items:r,totalRecords:l},msg:o}=await u("/api/PsyCounse/GetPsyGroupCounseling",s);a===200?(g(r),x(l)):n.warning(o)}catch(a){n.error(a)}},A=async(t,s)=>{const a=w.getFieldValue();if(a.startTime)if(a.endTime){if(i(a.startTime).valueOf()>i(a.endTime).valueOf()){n.warning("开始日期不得大于结束日期");return}}else{n.warning("请选择结束日期");return}else{n.warning("请选择开始日期");return}const r={...a};r.pageIndex=t,r.pageSize=s;try{const{code:l,data:{items:o,totalRecords:E},msg:B}=await u("/api/SysLog/All",r);l===200?(g(o),x(E)):n.warning(B)}catch(l){n.error(l)}},I=t=>{const s=t.split(","),a=[];return v.forEach(r=>{s.includes(r.id)&&a.push(r.pName)}),a.join(",")},G=t=>{j(t),f(!0)},Y=t=>{D("/layout/PsyGroupCounselingAddOrEdit",{state:t})},L=()=>{j(null),f(!1)},$=()=>{f(!1)},V=async()=>{const t=d.tutor_plan_file_path.split("/"),s=t[t.length-1];try{const a=await re("/api/PsyCounse/DownloadPsyGroupCounseling",{fileName:s});let r=new Blob([a],{type:"*/*"}),l=URL.createObjectURL(r),o=document.createElement("a");o.setAttribute("href",l),o.setAttribute("download",d.tutor_plan_file_desc),o.click()}catch(a){n.warning(a)}};return e.jsxs(pe,{theme:y,children:[e.jsx("div",{className:"topSearch",children:e.jsxs(p,{form:w,layout:"inline",onFinish:z,initialValues:{tutor_name:"",startTime:i().subtract(1,"year"),endTime:i()},children:[e.jsx(p.Item,{label:"团体辅导活动名称 : ",name:"tutor_name",children:e.jsx(W,{allowClear:!0,className:"ysh_antd_input",placeholder:"请输入团体辅导活动名称"})}),e.jsx(p.Item,{label:"开始日期 : ",name:"startTime",children:e.jsx(b,{format:"YYYY-MM-DD"})}),e.jsx(p.Item,{label:"结束日期 : ",name:"endTime",children:e.jsx(b,{format:"YYYY-MM-DD"})}),e.jsx(p.Item,{children:e.jsxs(k,{children:[e.jsxs(C,{type:"primary",htmlType:"submit",children:[e.jsx(X,{}),"查 询"]}),m.isAdmin===2&&e.jsxs(C,{onClick:()=>Y(null),children:[e.jsx(Z,{}),"添加辅导记录"]})]})})]})}),e.jsx("div",{className:"tableList",children:e.jsx(ie,{className:"ysh_antd_table",size:"small",sticky:!0,rowKey:t=>t.id,columns:F,dataSource:R,pagination:{defaultPageSize:50,total:_,showSizeChanger:!0,showQuickJumper:!0,onChange:A,showTotal:t=>`共 ${t} 条`}})}),e.jsx(ee,{text:e.jsxs("span",{children:[e.jsx(te,{})," 查看辅导"]}),width:700,open:T,onOk:L,onCancel:$,children:e.jsx(ue,{children:d&&e.jsxs("ul",{className:"detailInfo",children:[e.jsxs("li",{className:"item",children:[e.jsx("span",{className:"name",children:"辅导活动名称"}),e.jsx("span",{className:"value",children:d.tutor_name})]}),e.jsxs("li",{className:"item",children:[e.jsx("span",{className:"name",children:"辅导日期"}),e.jsx("span",{className:"value",children:i(d.tutor_date).format("YYYY-MM-DD")})]}),e.jsxs("li",{className:"item",children:[e.jsx("span",{className:"name",children:"参与人员"}),e.jsx("span",{className:"value",children:I(d.players)})]}),e.jsxs("li",{className:"item",children:[e.jsx("span",{className:"name",children:"辅导活动方案"}),e.jsx("span",{className:"value",children:d.tutor_plan})]}),e.jsxs("li",{className:"item",children:[e.jsx("span",{className:"name",children:"附件"}),e.jsx("span",{className:"value download",onClick:V,children:d.tutor_plan_file_desc})]})]})})})]})});he.displayName="PsyGroupCounseling";export{he as default};
