import{p as D,r as n,f as Re,t as ke,A as Le,J as De,u as Se,F as u,j as e,d as m,B as _,h as K,D as Pe,S as N,ac as Be,b as Fe,I as $e,g as b,v as L,M as Ae,y as Oe,N as Te}from"./index-CKIL6d0V.js";import{R as Ee}from"./index-CkuBMsw4.js";import{D as Ye}from"./index-BzG6U_Bx.js";import{R as ze}from"./PlusCircleOutlined-C3dgw0Zs.js";import{F as Ve}from"./Table-BaVi_066.js";import{P as Me}from"./index-V9Oy4lBT.js";import{R as We}from"./DeleteOutlined-BHDTCKcb.js";import{R as Ge,a as qe,b as Ue}from"./StopOutlined-Cp4rPXEP.js";import{R as He}from"./WarningOutlined-DXw3DJIi.js";import"./iconUtil-Co5gbObL.js";import"./index-C-LPyJas.js";const Je=D.div`
  height: 100%;
  padding: 16px;
  
  border-radius: 6px;
  background-color: ${l=>l.theme.colorBgContainer};
  .content {
    height: 100%;
    padding: 20px;
    font-size: 16px;
    .pagetitle {
      height: 30px;
      line-height: 30px;
      font-size: 20px;
      font-weight: 600;
      text-align: center;
      margin-bottom: 15px;
    }

    .contentText {
      display: flex;
      flex-wrap: wrap;
      margin-bottom: 10px;
      span {
        height: 40px;
        line-height: 40px;
        font-size: 16px;
      }
      .title {
        width: 12%;
        text-align: right;
      }
      .value {
        width: 20%;
        padding-left: 20px;
        text-align: left;
      }
    }
    .remark {      
      display: flex;
      .title {
        width: 12%;
        line-height: 20px;
        text-align: right;
        font-size: 16px;
      }
      .value {
        width: 86%;
        line-height: 20px;
        padding-left: 20px;
        text-align: left;
        font-size: 16px;
        opacity: 0.8;
        color: ${l=>l.theme.colorTextDescription};
      }
    }
    .btns {
      padding-top: 20px;
      height: 40px;
      line-height: 40px;
      text-align: center;
      .backbtn {
        margin-left: 30px;
      }
    }
  }
`,Q=D.div`
  /* 弹窗样式 */
  /* 时间选择器样式 */
  .timePickerStyle {
    margin-left: 15px;
  }
  .ant-form {
    .ant-form-item-label {
      font-size: 14px;
      width: 80px;
    }
    .ant-form-item-label > label {
      font-size: 14px;
    }
  }
`,Ke=D.div`
  height: 100%;
  display: flex;
  flex-direction: column;
  .topCommonInfor {
    height: 95px;
    padding-bottom: 15px;
    margin-bottom: 15px;
    display: flex;
    border-bottom: 1px dashed ${l=>l.theme.colorBorder};
    .leftInput {
      flex: 1;
      display: flex;
      flex-wrap: wrap;
      .item {
        width: 33%;
        height: 40px;
        line-height: 40px;
        display: flex;
        .label {
          width: 80px;
          opacity: 0.5;
          text-align: right;
        }
        .value {
          flex: 1;
          padding-left: 10px;
        }
      }
    }
    .rightBtn {
      width: 80px;
      .btn {
        height: 100%;
        line-height: 80px;
        border-radius: 10px;
        font-size: 32px;
        text-align: center;
        cursor: pointer;
        color: ${l=>l.theme.colorBorder};
        border: 1px dashed ${l=>l.theme.colorBorder};

        transition: all 0.2s;
        &:hover {
          border-width: 2px;
          font-size: 36px;
        }
      }
    }
  }

  .Profilelist {
    height: 310px;
    display: flex;
    .profileTable {
      width: 40%;
    }
    .profileDetail {
      width: 60%;
      padding-left: 15px;
      overflow: auto;
      .items {
        line-height: 36px;
        margin-bottom: 15px;
        display: flex;
        .profileLabel {
          width: 100px;
          padding-right: 15px;
          text-align: right;
          opacity: 0.5;
        }
        .profileValue {
          flex: 1;
          width: 0;
          padding-left: 15px;
          border-radius: 5px;
          border-bottom: 1px dashed ${l=>l.theme.colorBorder};
          background-color: ${l=>l.theme.colorBgLayout};
        }
      }
      .handleBtns {
        height: 40px;
        line-height: 40px;
        padding-left: 100px;
        display: flex;
        justify-content: space-around;
      }
    }
  }
  .reportinfo {
    flex: 1;
    height: 0;
  }
  /* 选中表格行样式 */
  .ant-table .ant-table-container .ant-table-content table tbody tr.table-tr-row-id {
    background-color: ${l=>l.theme.blue1};
  }
`;D.div`
  height: 650px;
  .box {
    height: 100%;
    display: flex;
    flex-direction: column;
    .topsearch {
      height: 60px;
      padding: 0 20px;
      display: flex;
      justify-content: space-between;
      .special {
        display: flex;
        align-items: center;
        .treeLabel {
          width: 80px;
          text-align: center;
        }
        .tree {
          flex: 1;
        }
      }
      .btns {
        text-align: right;
      }

      .nameinput {
        flex: 1;
        line-height: 60px;
        .inputLabel {
          margin-right: 10px;
        }
        .searchInput {
          width: 200px;
        }
      }
    }
    .list {
      flex: 1;
      height: 0;
      padding: 16px;
      .tableScroll {
        height: 100%;
        overflow: auto;
      }
    }
  }
`;const X=(l,x=!1)=>{switch(l){case 0:return x?"#FFA500":" 已预约";case 1:return x?"#fba0b1":" 等待面询";case 2:return x?"#FF0000":" 拒绝";case 3:return x?"#bebf84":" 面询完成";case 4:return x?"#608ca7":" 取消面询";case 5:return x?"#99badf":" 全部预约";default:return x?"#ff0000":" 异 常"}},Z=[{id:1,title:"周 一",checked:!0,timeRangeList:[]},{id:2,title:"周 二",checked:!0,timeRangeList:[]},{id:3,title:"周 三",checked:!0,timeRangeList:[]},{id:4,title:"周 四",checked:!0,timeRangeList:[]},{id:5,title:"周 五",checked:!0,timeRangeList:[]},{id:6,title:"周 六",checked:!1,timeRangeList:[]},{id:7,title:"周 日",checked:!1,timeRangeList:[]}],Qe=n.memo(()=>{const{genderList:l,organ:x,userInfo:j}=Re(t=>t),{token:w}=ke.useToken(),{message:d}=Le.useApp(),i=De(),E=Se(),{Option:S}=N,{TextArea:Y}=$e,[y]=u.useForm(),[P,ee]=n.useState({}),[B,te]=n.useState({}),[C,se]=n.useState({}),[f,z]=n.useState({}),[ae,V]=n.useState(""),[o,M]=n.useState({}),[F,ie]=n.useState(null),[le,I]=n.useState(!1),[$,R]=n.useState(!1),[ne,v]=n.useState(!1),[W,G]=n.useState(""),[re,A]=n.useState(!1),[oe,ce]=n.useState([]),[de,q]=n.useState([]),[pe,me]=n.useState(Z);n.useEffect(()=>{(async()=>{try{const s=await b("/api/Dict/GetDict_Consult_Type");ee(s.data);const a=await b("/api/Dict/GetDict_Consult_Way");te(a.data);const c=await b("/api/Dict/GetDict_Evaluation_Level");se(c.data);const p=await b("/api/PsyCounse/All",{c_id:j.id,pageIndex:1,pageSize:999});if(p.code===200){const r=p.data.items[0]?p.data.items[0]:{};let k=r.opentime?r.opentime.split(","):[];k[0]===""&&(k=[]),ce(k);const g=Z.map(h=>k.includes(String(h.id))?(h.checked=!0,h):(h.checked=!1,h));g[0].timeRangeList=r.time_mon?r.time_mon.split("|"):[],g[1].timeRangeList=r.time_tue?r.time_tue.split("|"):[],g[2].timeRangeList=r.time_wed?r.time_wed.split("|"):[],g[3].timeRangeList=r.time_thu?r.time_thu.split("|"):[],g[4].timeRangeList=r.time_fri?r.time_fri.split("|"):[],g[5].timeRangeList=r.time_sat?r.time_sat.split("|"):[],g[6].timeRangeList=r.time_sun?r.time_sun.split("|"):[],me(g);let O=parseInt(m(i.state.order_date).format("d"));O===0&&(O=7),g.filter(h=>h.checked).forEach(h=>{if(h.id===O){const Ie=h.timeRangeList.map(T=>({label:T,value:T,disabled:U(m(i.state.order_date),T)}));q(Ie)}})}else d.error(p.msg)}catch(s){d.error(s),console.log(s)}})()},[d,j,i]);const he=async t=>{const{date:s,timeRange:a}=t;if(!s)return d.warning("请选择日期",3);if(!a)return d.warning("请选择时间段",3);const{code:c,msg:p}=await L("/api/PsyCounse/AddOrUpdate_order",[{id:i.state.id,c_id:j.id,order_date:m(s).format("YYYY-MM-DD"),order_time:a,status:1}]);c===200?(A(!1),d.success(p),E("/layout/psy_counsel_manage")):d.error(p)},ue=t=>t&&t<m().startOf("day"),xe=t=>{let s=parseInt(m(t).format("d"));s===0&&(s=7),pe.filter(a=>a.checked).forEach(a=>{if(a.id===s){const c=a.timeRangeList.map(p=>({label:p,value:p,disabled:U(t,p)}));q(c)}})},U=(t,s)=>{if(!s)return;const a=m(),[c]=s.split("-");return m(`${t.format("YYYY-MM-DD")} ${c}`,"YYYY-MM-DD HH:mm").isBefore(a)},fe=t=>{let s=parseInt(m(t).format("d"));return s===0&&(s=7),t?!oe.includes(String(s)):!1},ge=async()=>{if($)return;await R(!0);const t=await b("/api/PsyCounse/GetLisProfile",{person_id:i.state.person_id,type:1});if(t.code===200){if(t.data.items.length===0){if((await L("/api/PsyCounse/AddOrUpdate_profile",{person_id:i.state.person_id},{type:1})).code===200){const c=await b("/api/PsyCounse/GetLisProfile",{person_id:i.state.person_id,type:1});z(c.data.items[0])}}else z(t.data.items[0]);const s=await b("/api/PsyCounse/GetLisProfile",{person_id:i.state.person_id,type:2,pageIndex:1,pageSize:9999});if(s.code===200){const{items:a}=s.data;a[0]&&V(a[0].id),ie(a),M(a[0])}else d.error(s.msg);I(!0),R(!1),i.state.status===1&&L("/api/PsyCounse/AddOrUpdate_order",[{id:i.state.id,c_id:j.id,status:3}])}},je=t=>{let s="";return x.forEach(a=>{a.Id===t&&(s=a.Name)}),s},be=async()=>{await G("新建咨询记录"),y.setFieldsValue({consult_type:null,consult_way:null,appeals:null,reply:null,evaluation_level:null}),await v(!0)},ye=async()=>{const t=await Ae(`/api/PsyCounse/profileDelete/${o.id}`);t.code===200?(d.success(t.msg),v(!1),I(!1)):d.error(t.msg)},ve=[{title:"序 号",dataIndex:"index",align:"center",render:(t,s,a)=>e.jsx(e.Fragment,{children:a+1})},{title:"评价等级",dataIndex:"evaluation_level",align:"center",key:"id",render:t=>e.jsxs("span",{style:{color:H(t,!0)},children:[J(t),"   ",C[t]]})},{title:"面询时间",dataIndex:"updatetime",align:"center",render:t=>e.jsx(e.Fragment,{children:t})},{title:"咨询师",dataIndex:"cname",align:"center",render:t=>e.jsx(e.Fragment,{children:t})}],H=(t,s=!1)=>{switch(t){case 1:return s?"#5BC946":" 正常";case 2:return s?"#FFC125":" 一般";case 3:return s?"#FF8C00":" 严重";case 4:return s?"#ff0000":" 异常";case 5:return s?"#B413EC":" 高危";case"*":return s?"#aaa":" 未知";default:return""}},J=t=>{switch(t){case 1:return e.jsx(Ue,{});case 2:return e.jsx(Te,{});case 3:return e.jsx(qe,{});case 4:return e.jsx(Oe,{});case 5:return e.jsx(He,{});case"*":return e.jsx(Ge,{});default:return""}},_e=t=>({onClick:()=>{V(t.id)}}),Ne=t=>t.id===ae?(M(t),"table-tr-row-id"):"",we=async()=>{await G("编辑咨询记录"),y.setFieldsValue({consult_type:o.consult_type,consult_way:o.consult_way,appeals:o.appeals,reply:o.reply,evaluation_level:o.evaluation_level}),await v(!0)},Ce=async t=>{if($)return;let s={c_id:j.id,person_id:f.person_id,archives_id:f.archives_id,...t};W==="编辑咨询记录"&&(s.id=o.id);const a={type:2};R(!0);const c=await L("/api/PsyCounse/AddOrUpdate_profile",s,a);c.code===200?(d.success(c.msg),v(!1),I(!1)):d.error(c.msg),R(!1)};return e.jsxs(Je,{theme:w,children:[e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"pagetitle",children:"预约详情"}),e.jsxs("div",{className:"contentText",children:[e.jsx("span",{className:"title",children:"预约日期:"}),e.jsx("span",{className:"value",children:i.state.order_date}),e.jsx("span",{className:"title",children:"预约时间:"}),e.jsxs("span",{className:"value",children:[m(i.state.order_date).format("dddd"),"   ",i.state.order_time]}),e.jsx("span",{className:"title",children:"预约状态:"}),e.jsx("span",{className:"value",style:{color:X(i.state.status,!0)},children:X(i.state.status,!1)}),e.jsx("span",{className:"title",children:"预  约  人:"}),e.jsx("span",{className:"value",children:i.state.pname}),e.jsx("span",{className:"title",children:"性        别:"}),e.jsx("span",{className:"value",children:l[i.state.psex]})]}),e.jsxs("div",{className:"remark",children:[e.jsx("span",{className:"title",children:"留       言:"}),e.jsx("span",{className:"value",children:i.state.remark})]}),e.jsxs("div",{className:"btns",children:[e.jsx(_,{className:"backbtn",type:"primary",onClick:ge,loading:$,children:"面询详情"}),j.isAdmin===2&&i.state.status===1&&e.jsx(_,{className:"backbtn",type:"primary",onClick:()=>A(!0),children:"修改"}),e.jsx(_,{className:"backbtn",onClick:()=>E(-1),children:"返回"})]})]}),e.jsx(K,{width:418,text:"修 改",open:re,onOk:()=>y.submit(),onCancel:()=>A(!1),children:e.jsx(Q,{theme:w,children:e.jsxs(u,{form:y,onFinish:he,labelAlign:"right",initialValues:{date:m(i.state.order_date),timeRange:i.state.order_time},children:[e.jsx(u.Item,{label:"日期",name:"date",children:e.jsx(Pe,{className:"picker",placeholder:"请选择日期",onChange:xe,disabledDate:t=>ue(t)||fe(t)})}),e.jsx(u.Item,{label:"时间段",name:"timeRange",children:e.jsx(N,{className:"select",placeholder:"请选择时间段",options:de})})]})})}),e.jsx(Ye,{title:"编辑档案",width:1200,placement:"right",onClose:()=>I(!1),open:le,children:e.jsxs(Ke,{theme:w,children:[e.jsxs("div",{className:"topCommonInfor",children:[e.jsxs("div",{className:"leftInput",children:[e.jsxs("div",{className:"item",children:[e.jsx("span",{className:"label",children:"个案编号: "}),e.jsx("span",{className:"value",children:f.archives_id})]}),e.jsxs("div",{className:"item",children:[e.jsx("span",{className:"label",children:"账号: "}),e.jsx("span",{className:"value",children:f.pNum})]}),e.jsxs("div",{className:"item",children:[e.jsx("span",{className:"label",children:"姓名: "}),e.jsx("span",{className:"value",children:f.pname})]}),e.jsxs("div",{className:"item",children:[e.jsx("span",{className:"label",children:"性别: "}),e.jsx("span",{className:"value",children:l[f.pSex]})]}),e.jsxs("div",{className:"item",children:[e.jsx("span",{className:"label",children:"所属机构: "}),e.jsx("span",{className:"value",children:je(f.orgid)})]}),e.jsxs("div",{className:"item",children:[e.jsx("span",{className:"label",children:"建档日期: "}),e.jsx("span",{className:"value",children:m(f.updatetime).format("YYYY-MM-DD")})]})]}),e.jsx("div",{className:"rightBtn",children:e.jsx("div",{className:"btn",onClick:()=>be(),children:e.jsx(Be,{placement:"bottom",title:"添加咨询",children:e.jsx(ze,{})})})})]}),e.jsxs("div",{className:"Profilelist",children:[e.jsx("div",{className:"profileTable",children:F&&e.jsx(Ve,{className:"ysh_antd_table fixed_table",columns:ve,rowKey:t=>t.id,dataSource:F||[],size:"small",onRow:t=>_e(t),rowClassName:t=>Ne(t),pagination:{className:"ysh_antd_pagination",position:["bottomCenter"],total:F.length,showTotal:t=>`共 ${t} 条`}})}),e.jsx("div",{className:"profileDetail",children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"items",children:[e.jsx("div",{className:"profileLabel",children:"咨询方式:"}),e.jsx("div",{className:"profileValue",children:B[o.consult_way]})]}),e.jsxs("div",{className:"items",children:[e.jsx("div",{className:"profileLabel",children:"咨询类型:"}),e.jsx("div",{className:"profileValue",children:P[o.consult_type]})]}),e.jsxs("div",{className:"items",children:[e.jsx("div",{className:"profileLabel",children:"主述:"}),e.jsx("div",{className:"profileValue",children:o.appeals})]}),e.jsxs("div",{className:"items",children:[e.jsx("div",{className:"profileLabel",children:"回复:"}),e.jsx("div",{className:"profileValue",children:o.reply})]}),e.jsxs("div",{className:"items",children:[e.jsx("div",{className:"profileLabel",children:"评价等级:"}),e.jsx("div",{className:"profileValue",children:e.jsxs("span",{style:{color:H(o.evaluation_level,!0)},children:[J(o.evaluation_level),"   ",C[o.evaluation_level]]})})]}),j.isAdmin===2&&e.jsxs("div",{className:"handleBtns",children:[e.jsx(Me,{placement:"top",title:"确定删除当前面询?",onConfirm:()=>ye(),okText:"删除",cancelText:"取消",children:e.jsxs(_,{className:"btn",children:[e.jsx(We,{})," 删 除"]})}),e.jsxs(_,{type:"primary",className:"btn",onClick:()=>we(),children:[e.jsx(Fe,{})," 编 辑"]})]})]}):e.jsx("p",{style:{lineHeight:"100px",fontSize:"28px",textAlign:"center"},children:"暂无咨询,请添加~~~"})})]}),e.jsx("div",{className:"reportinfo",children:e.jsx(Ee,{pnum:f.pNum})})]})}),e.jsx(K,{className:"ysh_antd_modal",width:618,text:W,open:ne,maskClosable:!1,onOk:()=>y.submit(),onCancel:()=>v(!1),okButtonProps:{className:"ysh_antd_btn"},cancelButtonProps:{className:"ysh_antd_btn"},children:e.jsx(Q,{theme:w,children:e.jsxs(u,{form:y,onFinish:Ce,children:[e.jsx(u.Item,{label:"咨询类型",name:"consult_type",rules:[{required:!0,message:"请选择咨询类型"}],children:e.jsx(N,{className:"ysh_antd_select",placeholder:"请选择咨询类型",allowClear:!0,children:Object.keys(P).map((t,s)=>e.jsx(S,{value:s+1,children:P[t]},t))})}),e.jsx(u.Item,{label:"咨询方式",name:"consult_way",rules:[{required:!0,message:"请选择咨询方式"}],children:e.jsx(N,{className:"ysh_antd_select",placeholder:"请选择咨询方式",allowClear:!0,children:Object.keys(B).map((t,s)=>e.jsx(S,{value:s+1,children:B[t]},t))})}),e.jsx(u.Item,{label:"主述",name:"appeals",rules:[{required:!0,message:"请输入主述"}],children:e.jsx(Y,{className:"ysh_antd_input"})}),e.jsx(u.Item,{label:"回复",name:"reply",rules:[{required:!0,message:"请输入回复"}],children:e.jsx(Y,{className:"ysh_antd_input"})}),e.jsx(u.Item,{label:"评价等级",name:"evaluation_level",rules:[{required:!0,message:"请选择评价等级"}],children:e.jsx(N,{className:"ysh_antd_select",placeholder:"请选择评价等级",allowClear:!0,children:Object.keys(C).map((t,s)=>e.jsx(S,{value:s+1,children:C[t]},t))})})]})})})]})});Qe.displayName="DealWith";export{Qe as default};
