import{r as l,m as U,_ as H,p as q,u as Fe,A as Ee,f as $e,t as Te,F as i,j as e,I as b,a as ee,B as A,R as Ve,o as ae,K as Ye,h as Ue,b as te,S as I,D as He,d as Y,ae as qe,C as se,g as m,v,M as Le,ch as _e,ci as Qe}from"./index-CKIL6d0V.js";import{O as Ge}from"./index-DS0KBckH.js";import{R as Je}from"./PlusCircleOutlined-C3dgw0Zs.js";import{R as re}from"./MoreOutlined-D6hW6YIc.js";import{F as Ke}from"./Table-BaVi_066.js";import{R as We}from"./UserAddOutlined-DO_35nHW.js";import{T as Xe}from"./index-DhKd6wcu.js";import{D as Ze}from"./index-BzG6U_Bx.js";import{T as ea}from"./index-C-LPyJas.js";import{R as aa}from"./DeleteOutlined-BHDTCKcb.js";import"./iconUtil-Co5gbObL.js";var ta={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zm52 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}}]},name:"appstore-add",theme:"outlined"},sa=function(r,h){return l.createElement(U,H({},r,{ref:h,icon:ta}))},ra=l.forwardRef(sa),na={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M892 772h-80v-80c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v80h-80c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h80v80c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-80h80c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 498.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.8-1.7-203.2 89.2-203.2 200 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.8-1.1 6.4-4.8 5.9-8.8zM824 472c0-109.4-87.9-198.3-196.9-200C516.3 270.3 424 361.2 424 472c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C357 742.6 326 814.8 324 891.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5C505.8 695.7 563 672 624 672c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 586.7 658.2 600 624 600s-66.3-13.3-90.5-37.5a127.26 127.26 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4-.1 34.2-13.4 66.3-37.6 90.5z"}}]},name:"usergroup-add",theme:"outlined"},la=function(r,h){return l.createElement(U,H({},r,{ref:h,icon:na}))},oa=l.forwardRef(la),ca={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 784H664c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h224c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7zM824 484c0-109.4-87.9-198.3-196.9-200C516.3 282.3 424 373.2 424 484c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C357 754.6 326 826.8 324 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5C505.8 707.7 563 684 624 684c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 598.7 658.2 612 624 612s-66.3-13.3-90.5-37.5a127.26 127.26 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4-.1 34.2-13.4 66.3-37.6 90.5z"}}]},name:"usergroup-delete",theme:"outlined"},ia=function(r,h){return l.createElement(U,H({},r,{ref:h,icon:ca}))},da=l.forwardRef(ia);const ha=q.div`
  height: 100%;
  display: flex;
  flex-direction: column;
  .search {
    height: 60px;
    padding: 0 25px;
    margin-bottom: 16px;
    border-radius: 6px;
    background-color: ${c=>c.theme.colorBgContainer};
    display: flex;
    justify-content: space-between;
    align-items: center;
    .searchflex {
      width: 300px;

      display: flex;
      .label {
        width: 50px;
        line-height: 30px;
      }
      .value {
        flex: 1;
        height: 30px;
      }
    }
    .searchflex.btns {
      width: 360px;
    }
  }
  .content {
    flex: 1;
    height: 100%;
    display: flex;
    overflow: hidden;
    .organ {
      width: 220px;
      height: 100%;
      margin-right: 16px;
      border-radius: 6px;
      background-color: ${c=>c.theme.colorBgContainer};
    }
    .tableBox {
      flex: 1;
      height: 100%;
      padding: 16px;
      box-sizing: border-box;
      overflow: hidden;
      border-radius: 6px;
      background-color: ${c=>c.theme.colorBgContainer};
    }
  }
`,pa=q.div`
 height: 100%;
 padding: 16px;
 .userEdit {
  .ant-form-item {
    width: 45%;
    margin-bottom: 16px;
  }
  .organ {
    width: 93%;
  }
  .birthday {
    .ant-picker {
      width: 100%;
    }
  }
 }
`,ua=q.div`
  .submitType {
    height: 40px;
    font-size: 16px;
    .value {
      margin-left: 20px;
    }
  }
  .ysh_p {
      height: 60px;
      font-size: 16px;
      padding-top: 20px;
      text-align: center;
      border-top: 1px solid ${c=>c.theme.colorBorderSecondary};
    }
`,{Option:O}=I,ma=l.memo(()=>{const c=Fe(),{message:r,modal:h}=Ee.useApp(),{genderList:R,militaryrankList:k,nationList:B,organ:F,educationList:N}=$e(a=>a),{token:E}=Te.useToken(),[j]=i.useForm(),[$,x]=l.useState([]),[p,L]=l.useState([]),[ne,g]=l.useState(0),[le,o]=l.useState(!1),[S,oe]=l.useState(null),[P,ce]=l.useState(null),[_,ie]=l.useState(0),[y,Q]=l.useState("添 加"),[de,he]=l.useState(""),[pe,C]=l.useState(!1),[ue,D]=l.useState(!1),[z,M]=l.useState(0),[G,me]=l.useState([]),[w,T]=l.useState([0]),[J,K]=l.useState("");l.useEffect(()=>{(async()=>{o(!0);try{const{total:t,data:s}=await m("/api/Person/All",{pageIndex:1,pageSize:50});x(s),g(t)}catch(t){r.error(t),console.log(t)}finally{o(!1)}})()},[r]);const xe=a=>{oe(a.target.value)},ge=a=>{ce(a.target.value)},fe=async()=>{o(!0);const a={PNum:S,PName:P,QorganizeId:_,pageIndex:1,pageSize:50};try{const{data:t,total:s}=await m("/api/Person/All",a);x(t),g(s)}catch(t){r.error(t),console.log(t)}finally{o(!1)}},je=[{label:e.jsx("span",{children:"重置密码"}),icon:e.jsx(_e,{}),key:"1"},{type:"divider"},{label:e.jsx("span",{children:"删除"}),icon:e.jsx(aa,{}),key:"2"},{type:"divider"},{label:e.jsx("span",{children:"菜单管理"}),icon:e.jsx(Qe,{}),key:"3"}],ye=[{title:"序 号",dataIndex:"index",width:60,align:"center",key:"index",render:(a,t,s)=>e.jsx(e.Fragment,{children:s+1})},{title:"账 号",dataIndex:"pNum",align:"center",key:"pNum",render:a=>e.jsx(e.Fragment,{children:a})},{title:"姓 名",dataIndex:"pName",align:"center",key:"pName",render:a=>e.jsx(e.Fragment,{children:a})},{title:"性 别",dataIndex:"pSexDesc",width:80,align:"center",key:"pSexDesc",render:a=>e.jsx(e.Fragment,{children:a})},{title:"出生日期",dataIndex:"pBirthDate",align:"center",key:"pBirthDate",render:a=>e.jsx(e.Fragment,{children:Y(a).format("YYYY-MM-DD")})},{title:"文化程度",dataIndex:"pEducation",align:"center",key:"pEducation",render:a=>e.jsx(e.Fragment,{children:N[a]})},{title:"职 位",dataIndex:"pPosition",align:"center",key:"pPosition",render:a=>e.jsx(e.Fragment,{children:k[a]})},{title:"组织机构",dataIndex:"pOrganizationName",align:"center",width:400,key:"pOrganizationName",ellipsis:!0,render:a=>e.jsx(e.Fragment,{children:a})},{title:"操 作",dataIndex:"id",align:"center",width:150,key:"handle",render:(a,t)=>e.jsx(e.Fragment,{children:e.jsxs(ee,{size:"middle",style:{color:E.colorPrimaryText},children:[e.jsxs("span",{style:{cursor:"pointer"},onClick:()=>W("编 辑",t),children:[e.jsx(te,{}),"  编 辑"]}),e.jsx(ae,{placement:"bottom",arrow:!0,menu:{items:je,onClick:s=>we(s,t)},children:e.jsxs("span",{style:{cursor:"pointer"},children:["更 多",e.jsx(re,{})]})})]})})}],we=({key:a},{id:t})=>{switch(console.log(a,t),a){case"1":h.confirm({title:"温馨提示",content:"确定重置密码吗?",onOk(){be(t)}});break;case"2":h.confirm({title:"温馨提示",content:"确定删除吗?",onOk(){Pe(t)}});break;case"3":X(t);break}},be=async a=>{const t=btoa(123456);try{const{code:s,msg:n}=await v("/api/Person/ResetPwd",{},{id:a,pwd:t});s===200?r.success(n):r.warning(n)}catch(s){r.error(s)}},W=(a,t)=>{a==="添 加"?(Q("添 加"),j.resetFields()):(Q("编 辑"),j.setFieldsValue({pBirthDate:Y(t.pBirthDate),pNum:t.pNum,pName:t.pName,PEducation:t.pEducation,organizeId:t.pOrganizationID,pSex:t.pSex,pNation:t.pNation,PPosition:t.pPosition}),he(t.id)),C(!0)},ve=()=>{j.submit()},Ie=()=>{C(!1),j.resetFields()},ke=async a=>{a.pBirthDate=a.pBirthDate.format("YYYY-MM-DD");const t={...a};o(!0);const s=[];y==="编 辑"?(s[0]="/api/Person/Update",s[1]=t,s[2]={id:de}):(s[0]="/api/Person/Add",s[1]=t);try{const{code:n,msg:d}=await v(...s);n===200?r.success(d):r.warning(d),C(!1);const{data:u,total:f}=await m("/api/Person/All",{pageIndex:1,pageSize:50});x(u),g(f)}catch(n){r.error(n)}finally{o(!1),j.resetFields()}},Ne=a=>{Se(a)},Se=async a=>{ie(a);const t={PNum:S,PName:P,QorganizeId:a,pageIndex:1,pageSize:50};o(!0);try{const{data:s,total:n}=await m("/api/Person/All",t);await x(s),await g(n)}catch(s){r.error(s),console.log(s)}finally{o(!1)}},Pe=async a=>{try{const{code:t,msg:s}=await Le(`/api/Person/Delete/${a}`);if(o(!0),t===200){r.success(s);const{data:n,total:d}=await m("/api/Person/All",{pageIndex:1,pageSize:50});x(n),g(d)}else r.error(s)}catch(t){r.error(t)}finally{o(!1)}},Ce=async(a,t)=>{const s={PNum:S,PName:P,QorganizeId:_,pageIndex:a,pageSize:t};o(!0);try{const{data:n,total:d}=await m("/api/Person/All",s);await x(n),await g(d)}catch(n){r.error(n),console.log(n)}finally{o(!1)}},De=[{label:e.jsx("span",{children:"批量删除"}),icon:e.jsx(da,{}),key:"1"},{type:"divider"},{label:e.jsx("span",{children:"批量添加菜单"}),icon:e.jsx(ra,{}),key:"2"},{type:"divider"},{label:e.jsx("span",{children:"人员导入"}),icon:e.jsx(oa,{}),key:"3"}],ze=({key:a})=>{switch(a){case"1":h.confirm({title:"温馨提示",content:"确定批量删除吗?",onOk(){Ae()}});break;case"2":X();break;case"3":c("/layout/everymanImport");break}},V=async a=>{const t=[];try{const{code:s,data:n,msg:d}=await m("/api/Role/GetPersonMenu",{personId:a});s===200?(me(n),n.forEach(u=>{u.state.checked?(t.push(u.id),u.nodes&&u.nodes.forEach(f=>{f.state.checked&&t.push(f.id)})):u.nodes&&u.nodes.forEach(f=>{f.state.checked&&t.push(f.id)})}),T(t)):r.error(d)}catch(s){r.error(s)}},Me={selectedRowKeys:p,onChange:a=>{L(a)}},Ae=async()=>{if(p.length===0)return r.warning("请选择表格需要删除的数据",5);o(!0);try{const{code:a,msg:t}=await v("/api/Person/BatchDel",p);a===200?r.success(t):r.error(t),C(!1);const{data:s,total:n}=await m("/api/Person/All",{pageIndex:1,pageSize:50});x(s),g(n)}catch(a){r.error(a)}finally{o(!1)}},X=async a=>{if(a){K(a),await V(a),D(!0);return}if(p.length===0){r.info("请先选择人员",4);return}else p.length===1?await V(p[0]):await V();await D(!0)},Oe=()=>{D(!1),M(0)},Z=a=>{M(a)},Re=(a,t)=>{if(t.node.parent){let n=Array.from(new Set([...a.checked,t.node.parent]));a.checked=n}else{let n=[...a.checked];t.checkedNodes.forEach(d=>{d.parent===t.node.id&&(n.push(t.node.id),a.checked=Array.from(new Set(n)))})}T(a.checked)},Be=async()=>{if(p.length===$.length&&z===0){r.info("请选择添加菜单类型");return}if(J){let a=w.length>0?w:[0];const{code:t,msg:s}=await v("/api/Role/SetPersonMenu",a,{PersonId:J,SelectPersonFlag:z});t===200?(r.success(s),K(""),M(0)):r.error(s)}else{let a=p.join(),t=w.length>0?w:[0];try{const{code:s,msg:n}=await v("/api/Role/SetMuPersonMenu",t,{muPersonId:a});s===200?(r.success(n,3),L([]),T([0]),M(0)):r.error(n)}catch(s){r.error(s)}}D(!1)};return e.jsxs(ha,{theme:E,children:[e.jsxs("div",{className:"search",children:[e.jsxs("div",{className:"searchflex",children:[e.jsx("span",{className:"label",children:"账 号: "}),e.jsx(b,{className:"value",allowClear:!0,value:S,onChange:xe,placeholder:"请输入账号"})]}),e.jsxs("div",{className:"searchflex",children:[e.jsx("span",{className:"label",children:"姓 名: "}),e.jsx(b,{className:"value",allowClear:!0,value:P,onChange:ge,placeholder:"请输入姓名"})]}),e.jsx("div",{className:"searchflex btns",children:e.jsxs(ee,{size:"large",children:[e.jsxs(A,{type:"primary",onClick:fe,children:[e.jsx(Ve,{})," 搜 索"]}),e.jsxs(A,{onClick:()=>W("添 加"),children:[e.jsx(Je,{})," 添 加"]}),e.jsx(ae,{placement:"bottom",arrow:!0,menu:{items:De,onClick:ze},trigger:["click"],children:e.jsxs(A,{icon:e.jsx(re,{}),children:["更 多 ",e.jsx(Ye,{})," "]})})]})})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"organ",children:e.jsx(Ge,{onSelectOrg:Ne})}),e.jsx("div",{className:"tableBox",children:e.jsx(Ke,{size:"small",showExpandColumn:!1,rowKey:a=>a.id,rowSelection:Me,columns:ye,loading:le,dataSource:$,sticky:!0,pagination:{total:ne,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:50,onChange:Ce,showTotal:a=>`共 ${a} 条`}})})]}),e.jsx(Ue,{text:e.jsxs("span",{children:[y==="添 加"?e.jsx(We,{}):e.jsx(te,{}),"   ",y]}),width:618,open:pe,onOk:ve,onCancel:Ie,children:e.jsx(pa,{children:e.jsxs(i,{className:"userEdit",form:j,layout:"inline",onFinish:ke,children:[e.jsx(i.Item,{label:"账 号",name:"pNum",rules:[{required:!0,message:"请输入账号"}],children:e.jsx(b,{disabled:y==="编 辑",placeholder:"请输入账号"})}),e.jsx(i.Item,{label:"姓 名",name:"pName",rules:[{required:!0,message:"请输入姓名"}],children:e.jsx(b,{placeholder:"请输入姓名"})}),y!=="编 辑"&&e.jsx(i.Item,{label:"密 码",name:"pwd",rules:[{required:!0,message:"请输入密码"}],children:e.jsx(b,{placeholder:"请输入密码"})}),e.jsx(i.Item,{label:"性别",name:"pSex",rules:[{required:!0,message:"请选择性别"}],children:e.jsx(I,{placeholder:"请选择性别",allowClear:!0,children:R&&Object.keys(R).map((a,t)=>a==="0"?null:e.jsx(O,{value:t,children:R[a]},a))})}),e.jsx(i.Item,{className:"birthday",label:"生 日",name:"pBirthDate",rules:[{required:!0,message:"请选择出生日期"}],children:e.jsx(He,{format:"YYYY-MM-DD",disabledDate:a=>a&&a>Y().endOf("day")})}),e.jsx(i.Item,{label:"职 位",name:"PPosition",rules:[{required:!0,message:"请选择职位"}],children:e.jsx(I,{placeholder:"请选择职位",allowClear:!0,children:k&&Object.keys(k).map((a,t)=>e.jsx(O,{value:t,children:k[a]},a))})}),e.jsx(i.Item,{label:"民 族",name:"pNation",rules:[{required:!0,message:"请选择民族"}],children:e.jsx(I,{placeholder:"请选择民族",allowClear:!0,children:B&&Object.keys(B).map((a,t)=>e.jsx(O,{value:t,children:B[a]},a))})}),e.jsx(i.Item,{label:"文 化",name:"PEducation",rules:[{required:!0,message:"请选择文化程度"}],children:e.jsx(I,{placeholder:"请选择文化程度",allowClear:!0,children:N&&Object.keys(N).map((a,t)=>e.jsx(O,{value:t,children:N[a]},a))})}),e.jsx(i.Item,{className:"organ",label:"机 构",name:"organizeId",rules:[{required:!0,message:"请选择组织机构"}],children:F[0]&&e.jsx(Xe,{dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:qe(F,F[0].PId),placeholder:"请选择组织机构",treeDefaultExpandAll:!0,allowClear:!0,fieldNames:{label:"Name",value:"Id",children:"children"}})})]})})}),e.jsx(Ze,{title:"菜 单 管 理",placement:"right",open:ue,onClose:Oe,children:e.jsxs(ua,{theme:E,children:[p.length===$.length&&e.jsxs("div",{className:"submitType",children:[e.jsx("span",{children:"人员: "}),e.jsxs("span",{className:"value",children:["当 前  ",e.jsx(se,{checked:z===1,onChange:()=>Z(1)})]}),e.jsxs("span",{className:"value",children:["全 部  ",e.jsx(se,{checked:z===2,onChange:()=>Z(2)})]})]}),G.length>0&&e.jsx(ea,{className:"ysh_antd_tree",checkable:!0,checkStrictly:!0,checkedKeys:w,onCheck:Re,treeData:G,defaultExpandAll:!0,fieldNames:{title:"menuname",key:"id",children:"nodes"}}),e.jsx("p",{className:"ysh_p",children:e.jsx(A,{type:"primary",onClick:()=>Be(),children:"提 交"})})]})})]})});ma.displayName="UserManage";export{ma as default};
