import{r as l,n as U,_ as q,d as H,u as Be,A as Ye,f as $e,t as Te,F as i,j as e,I as v,b as ee,B as A,R as Ve,l as ae,J as Ue,h as qe,S as k,D as te,a as y,af as He,c as se,C as re,g as m,v as I,ck as Le,cl as _e,N as Qe}from"./index-BtzNP73w.js";import{O as Ge}from"./index-Bulw9wNg.js";import{R as Je}from"./PlusCircleOutlined-Dx3NdtuO.js";import{R as ne}from"./MoreOutlined-DStrJbIi.js";import{F as We}from"./Table-BCm752cP.js";import{T as Ke}from"./index-BghaPaBU.js";import{R as Xe}from"./UserAddOutlined-BAyUtdjX.js";import{D as Ze}from"./index-BGCT95LN.js";import{T as ea}from"./index-B6m4IotF.js";import{R as aa}from"./DeleteOutlined-ClifBhia.js";import"./iconUtil-D_WnT0lW.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,q({},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,q({},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,q({},r,{ref:h,icon:ca}))},da=l.forwardRef(ia);const ha=H.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=H.div`
 height: 100%;
 padding: 16px;
 .userEdit {
  .ant-form-item {
    width: 45%;
    margin-bottom: 16px;
  }
  .organ {
    width: 93%;
  }
  .birthday {
    .ant-picker {
      width: 100%;
    }
  }
 }
`,ua=H.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:R}=k,ma=l.memo(()=>{const c=Be(),{message:r,modal:h}=Ye.useApp(),{genderList:E,militaryrankList:N,nationList:F,organ:B,educationList:D}=$e(a=>a),{token:Y}=Te.useToken(),[j]=i.useForm(),[$,x]=l.useState([]),[p,L]=l.useState([]),[le,g]=l.useState(0),[oe,o]=l.useState(!1),[P,ce]=l.useState(null),[S,ie]=l.useState(null),[_,de]=l.useState(0),[w,Q]=l.useState("添 加"),[he,pe]=l.useState(""),[ue,C]=l.useState(!1),[me,z]=l.useState(!1),[M,O]=l.useState(0),[G,xe]=l.useState([]),[b,T]=l.useState([0]),[J,W]=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 ge=a=>{ce(a.target.value)},fe=a=>{ie(a.target.value)},je=async()=>{o(!0);const a={PNum:P,PName:S,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)}},ye=[{label:e.jsx("span",{children:"重置密码"}),icon:e.jsx(Le,{}),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(_e,{}),key:"3"}],we=[{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:"pEnlistmentDate",align:"center",key:"pEnlistmentDate",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:D[a]})},{title:"职 位",dataIndex:"pPosition",align:"center",key:"pPosition",render:a=>e.jsx(e.Fragment,{children:N[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:Y.colorPrimaryText},children:[e.jsxs("span",{style:{cursor:"pointer"},onClick:()=>K("编 辑",t),children:[e.jsx(se,{}),"  编 辑"]}),e.jsx(ae,{placement:"bottom",arrow:!0,menu:{items:ye,onClick:s=>be(s,t)},children:e.jsxs("span",{style:{cursor:"pointer"},children:["更 多",e.jsx(ne,{})]})})]})})}],be=({key:a},{id:t})=>{switch(console.log(a,t),a){case"1":h.confirm({title:"温馨提示",content:"确定重置密码吗?",onOk(){ve(t)}});break;case"2":h.confirm({title:"温馨提示",content:"确定删除吗?",onOk(){Se(t)}});break;case"3":X(t);break}},ve=async a=>{const t=btoa(123456);try{const{code:s,msg:n}=await I("/api/Person/ResetPwd",{},{id:a,pwd:t});s===200?r.success(n):r.warning(n)}catch(s){r.error(s)}},K=(a,t)=>{a==="添 加"?(Q("添 加"),j.resetFields()):(Q("编 辑"),console.log("人员编辑回显",t),j.setFieldsValue({pBirthDate:y(t.pBirthDate),pNum:t.pNum,pName:t.pName,PEducation:t.pEducation,PEnlistmentDate:y(t.pEnlistmentDate),organizeId:t.pOrganizationID,pSex:t.pSex,pNation:t.pNation,PPosition:t.pPosition}),pe(t.id)),C(!0)},Ie=()=>{j.submit()},ke=()=>{C(!1),j.resetFields()},Ne=async a=>{a.pBirthDate=a.pBirthDate.format("YYYY-MM-DD");const t={...a};o(!0);const s=[];w==="编 辑"?(s[0]="/api/Person/Update",s[1]=t,s[2]={id:he}):(s[0]="/api/Person/Add",s[1]=t);try{const{code:n,msg:d}=await I(...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()}},De=a=>{Pe(a)},Pe=async a=>{de(a);const t={PNum:P,PName:S,QorganizeId:a,pageIndex:1,pageSize:50};o(!0);try{const{data:s,total:n}=await m("/api/Person/All",t);x(s),g(n)}catch(s){r.error(s),console.log(s)}finally{o(!1)}},Se=async a=>{try{const{code:t,msg:s}=await Qe(`/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:P,PName:S,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)}},ze=[{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"}],Me=({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?(xe(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)}},Oe={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 I("/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){W(a),await V(a),z(!0);return}if(p.length===0){r.info("请先选择人员",4);return}else p.length===1?await V(p[0]):await V();await z(!0)},Re=()=>{z(!1),O(0)},Z=a=>{O(a)},Ee=(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)},Fe=async()=>{if(p.length===$.length&&M===0){r.info("请选择添加菜单类型");return}if(J){let a=b.length>0?b:[0];const{code:t,msg:s}=await I("/api/Role/SetPersonMenu",a,{PersonId:J,SelectPersonFlag:M});t===200?(r.success(s),W(""),O(0)):r.error(s)}else{let a=p.join(),t=b.length>0?b:[0];try{const{code:s,msg:n}=await I("/api/Role/SetMuPersonMenu",t,{muPersonId:a});s===200?(r.success(n,3),L([]),T([0]),O(0)):r.error(n)}catch(s){r.error(s)}}z(!1)};return e.jsxs(ha,{theme:Y,children:[e.jsxs("div",{className:"search",children:[e.jsxs("div",{className:"searchflex",children:[e.jsx("span",{className:"label",children:"账 号: "}),e.jsx(v,{className:"value",allowClear:!0,value:P,onChange:ge,placeholder:"请输入账号"})]}),e.jsxs("div",{className:"searchflex",children:[e.jsx("span",{className:"label",children:"姓 名: "}),e.jsx(v,{className:"value",allowClear:!0,value:S,onChange:fe,placeholder:"请输入姓名"})]}),e.jsx("div",{className:"searchflex btns",children:e.jsxs(ee,{size:"large",children:[e.jsxs(A,{type:"primary",onClick:je,children:[e.jsx(Ve,{})," 搜 索"]}),e.jsxs(A,{onClick:()=>K("添 加"),children:[e.jsx(Je,{})," 添 加"]}),e.jsx(ae,{placement:"bottom",arrow:!0,menu:{items:ze,onClick:Me},trigger:["click"],children:e.jsxs(A,{icon:e.jsx(ne,{}),children:["更 多 ",e.jsx(Ue,{})," "]})})]})})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"organ",children:e.jsx(Ge,{onSelectOrg:De})}),e.jsx("div",{className:"tableBox",children:e.jsx(We,{size:"small",showExpandColumn:!1,rowKey:a=>a.id,rowSelection:Oe,columns:we,loading:oe,dataSource:$,sticky:!0,pagination:{total:le,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:50,onChange:Ce,showTotal:a=>`共 ${a} 条`}})})]}),e.jsx(qe,{text:e.jsxs("span",{children:[w==="添 加"?e.jsx(Xe,{}):e.jsx(se,{}),"   ",w]}),width:618,open:ue,onOk:Ie,onCancel:ke,children:e.jsx(pa,{children:e.jsxs(i,{className:"userEdit",form:j,layout:"inline",onFinish:Ne,children:[e.jsx(i.Item,{label:"账 号",name:"pNum",rules:[{required:!0,message:"请输入账号"}],children:e.jsx(v,{disabled:w==="编 辑",placeholder:"请输入账号"})}),e.jsx(i.Item,{label:"姓 名",name:"pName",rules:[{required:!0,message:"请输入姓名"}],children:e.jsx(v,{placeholder:"请输入姓名"})}),w!=="编 辑"&&e.jsx(i.Item,{label:"密 码",name:"pwd",rules:[{required:!0,message:"请输入密码"}],children:e.jsx(v,{placeholder:"请输入密码"})}),e.jsx(i.Item,{label:"性别",name:"pSex",rules:[{required:!0,message:"请选择性别"}],children:e.jsx(k,{placeholder:"请选择性别",allowClear:!0,children:E&&Object.keys(E).map((a,t)=>a==="0"?null:e.jsx(R,{value:t,children:E[a]},a))})}),e.jsx(i.Item,{className:"birthday",label:"生 日",name:"pBirthDate",rules:[{required:!0,message:"请选择出生日期"}],children:e.jsx(te,{format:"YYYY-MM-DD",disabledDate:a=>a&&a>y().endOf("day")})}),e.jsx(i.Item,{className:"birthday",label:"入学",name:"PEnlistmentDate",rules:[{required:!0,message:"请选择入学时间"}],children:e.jsx(te,{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(k,{placeholder:"请选择职位",allowClear:!0,children:N&&Object.keys(N).map((a,t)=>e.jsx(R,{value:t,children:N[a]},a))})}),e.jsx(i.Item,{label:"民 族",name:"pNation",rules:[{required:!0,message:"请选择民族"}],children:e.jsx(k,{placeholder:"请选择民族",allowClear:!0,children:F&&Object.keys(F).map((a,t)=>e.jsx(R,{value:t,children:F[a]},a))})}),e.jsx(i.Item,{label:"文 化",name:"PEducation",rules:[{required:!0,message:"请选择文化程度"}],children:e.jsx(k,{placeholder:"请选择文化程度",allowClear:!0,children:D&&Object.keys(D).map((a,t)=>e.jsx(R,{value:t,children:D[a]},a))})}),e.jsx(i.Item,{className:"organ",label:"机 构",name:"organizeId",rules:[{required:!0,message:"请选择组织机构"}],children:B[0]&&e.jsx(Ke,{dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:He(B,B[0].PId),placeholder:"请选择组织机构",treeDefaultExpandAll:!0,allowClear:!0,fieldNames:{label:"Name",value:"Id",children:"children"}})})]})})}),e.jsx(Ze,{title:"菜 单 管 理",placement:"right",open:me,onClose:Re,children:e.jsxs(ua,{theme:Y,children:[p.length===$.length&&e.jsxs("div",{className:"submitType",children:[e.jsx("span",{children:"人员: "}),e.jsxs("span",{className:"value",children:["当 前  ",e.jsx(re,{checked:M===1,onChange:()=>Z(1)})]}),e.jsxs("span",{className:"value",children:["全 部  ",e.jsx(re,{checked:M===2,onChange:()=>Z(2)})]})]}),G.length>0&&e.jsx(ea,{className:"ysh_antd_tree",checkable:!0,checkStrictly:!0,checkedKeys:b,onCheck:Ee,treeData:G,defaultExpandAll:!0,fieldNames:{title:"menuname",key:"id",children:"nodes"}}),e.jsx("p",{className:"ysh_p",children:e.jsx(A,{type:"primary",onClick:()=>Fe(),children:"提 交"})})]})})]})});ma.displayName="UserManage";export{ma as default};
