import{d as z,r as n,t as re,A as ie,f as le,j as s,I as y,b as w,B as i,P as oe,h as ce,Q as de,i as T,g as N,p as h,a as xe}from"./index-BtzNP73w.js";import{O as pe}from"./index-Bulw9wNg.js";import{P as v}from"./index-CW4Fb3Fw.js";import{F as he}from"./Table-BCm752cP.js";import"./index-B6m4IotF.js";import"./iconUtil-D_WnT0lW.js";const ge=z.div`
font-size: 16px;
height: 100%;
padding-left: 10px;
display: flex;
flex-direction: column;
  .topSearch {
    height: 60px;
    line-height: 60px;
    padding-left: 20px;
    font-size: 16px;
    margin-bottom: 16px;
    display: flex;
    background-color: ${r=>r.theme.colorBgContainer};
    .searchflex {
      flex: 1;
      .searchInput {
        width:60%;
      }
      .ysh_search_TreeSelect {
        width:60%;
      }
    }
    .btns {
      display: flex;
      justify-content: flex-start;
      align-items: center;
    }
    .startBtn {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      padding-right: 25px;
    }
    .ysh_search_add {
      margin-left: 20px;
    }
  }
  .content {
    flex: 1;
    height: 100%;
    display: flex;
    overflow: hidden;
    .organ {
      width: 220px;
      height: 100%;
      margin-right: 16px;
      border-radius: 6px;
      background-color: ${r=>r.theme.colorBgContainer};
    }
    .tableBox {
      flex: 1;
      padding: 16px;
      box-sizing: border-box;
      overflow: hidden;
      border-radius: 6px;
      background-color: ${r=>r.theme.colorBgContainer};
    }
  }
`,me=z.div`
  padding: 20px;
  margin: 20px;
  border: 1px solid ${r=>r.theme.colorBorder};
  border-radius: 20px;
  .title {
    line-height: 36px;
    height: 36px;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    font-size: 16px;
    margin-bottom: 20px
  }
  .qr {
    width: 420px;
    height: 420px;
    margin: 0 auto;
    padding: 10px;
  }
  .btns {
    line-height: 36px;
    height: 36px;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    font-size: 16px;
    margin-bottom: 20px
  }
  .tip {
    margin-bottom: 20px;
    font-size: 14px;
    color: #f00;
    line-height: 24px;
    text-align: center;
  }
`,ue=n.memo(()=>{const{token:r}=re.useToken(),{message:a}=ie.useApp(),{genderList:P,militaryrankList:B,nationList:F,organ:fe,educationList:je}=le(e=>e),[D,d]=n.useState(!1),[o,g]=n.useState([]),[R,m]=n.useState(!1),[u,f]=n.useState(!0),[x,Q]=n.useState(""),[p,_]=n.useState(""),[I,k]=n.useState(""),[E,A]=n.useState(null),[S,L]=n.useState(""),[M,q]=n.useState(!1),[j,b]=n.useState({});n.useEffect(()=>{(async()=>{const t=await N("/api/Person/All",{pageIndex:1,pageSize:9999999});g(t.data)})()},[]),n.useEffect(()=>{let e=o.length>0&&o.some(t=>t.flag===2);f(!e)},[o]);const O=e=>{Q(e.target.value)},$=e=>{_(e.target.value)},c=async()=>{const e={};x&&(e.PNum=x),p&&(e.PName=p),S&&(e.QorganizeId=S);const t=await N("/api/Person/All",{...e,pageIndex:1,pageSize:9999999});g(t.data)},V=e=>{Y(e)},Y=async e=>{L(e);const t={};x&&(t.PNum=x),p&&(t.PName=p),t.QorganizeId=e;try{const l=await N("/api/Person/All",{...t,pageIndex:1,pageSize:9999999});g(l.data)}catch(l){a.error(l),console.log(l)}finally{q(!1)}},U=()=>{d(!1)},J=()=>{d(!1)},K=async()=>{const e=await h("/api/Person/UpdateFlag",{},{id:j.id,flag:1});e.code===200?(a.success("加入训练成功"),c(),d(!1),b({})):a.error(e.msg)},G=async()=>{const e=await h("/api/DVInterTrainStartEnd/TrainStart");e.code===200?(a.success(e.msg,3),c(),f(!1)):e.code===100?a.warning(e.msg.Message):a.error(e.msg)},H=async()=>{const e=await h("/api/DVInterTrainStartEnd/TrainEnd");e.code===200?(a.success(e.msg,3),c(),f(!0)):a.info(e.msg)},W=async e=>{const t=await h("/api/Person/UpdateFlag",{},{id:e,flag:0});t.code===200?(a.success(t.msg),c(),d(!1)):a.error(t.msg)},X=async()=>{const e=await h("/api/DVInterTrainStartEnd/TrainReset");e.code===200?(a.success(e.msg,3),c()):a.error(e.msg),k("")},Z=()=>{I==="123456"?(X(),m(!1)):a.info("密码错误")},C=e=>{m(e)},ee=()=>{m(!0)},se=e=>{A(`${e.id}|0|0`),b(e),d(!0)},te=e=>e===0?"":e===1?"准备中":e===2?"训练中":"",ne=s.jsxs("div",{className:"resetTrain",style:{textAlign:"right"},children:[s.jsx(y.Password,{size:"small",className:"ysh_antd_input",style:{width:"150px"},placeholder:"请输入密码",value:I,onChange:e=>k(e.target.value)}),s.jsx("p",{style:{height:"10px"}}),s.jsxs(w,{children:[s.jsx(i,{size:"small",className:"ysh_antd_btn",onClick:e=>C(!1),children:"取消"}),s.jsx(i,{size:"small",className:"ysh_antd_btn",onClick:e=>Z(),children:"确认"})]})]}),ae=[{title:"序 号",dataIndex:"index",align:"center",key:"index",render:(e,t,l)=>s.jsx(s.Fragment,{children:l+1})},{title:"账 号",dataIndex:"pNum",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:e})},{title:"姓 名",dataIndex:"pName",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:e})},{title:"性 别",dataIndex:"pSex",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:P[e]})},{title:"生 日",dataIndex:"pBirthDate",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:xe(e).format("YYYY-MM-DD")})},{title:"职 位",dataIndex:"pMilitaryRank",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:B[e]})},{title:"民 族",dataIndex:"pNation",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:F[e]})},{title:"绑定状态",dataIndex:"flag",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:te(e)})},{title:"操作",dataIndex:"id",align:"center",key:"handle",render:(e,t)=>s.jsx(s.Fragment,{children:s.jsx(w,{size:"middle",children:t.flag?s.jsx(i,{style:{width:"100px"},onClick:l=>W(t.id),children:"解 绑"}):s.jsxs(i,{style:{width:"100px"},onClick:l=>se(t),children:[s.jsx(T,{})," 二维码"]})})})}];return s.jsxs(ge,{theme:r,children:[s.jsxs("div",{className:"topSearch",children:[s.jsxs("div",{className:"searchflex",children:[s.jsx("span",{children:"账 号: "}),s.jsx(y,{value:x,onChange:O,placeholder:"请输入账号",className:"searchInput",allowClear:!0})]}),s.jsxs("div",{className:"searchflex",children:[s.jsx("span",{children:"姓 名: "}),s.jsx(y,{className:"searchInput",value:p,onChange:$,allowClear:!0,placeholder:"请输入姓名"})]}),s.jsx("div",{className:"searchflex btns",children:s.jsxs(w,{size:"middle",children:[s.jsx(i,{onClick:c,className:"btn",children:"搜 索"}),s.jsx(oe,{trigger:"click",placement:"top",content:ne,open:R,onOpenChange:C,children:s.jsx(i,{className:"btn",onClick:ee,children:"训练复位"})})]})}),s.jsx("div",{className:"searchflex startBtn",children:s.jsx(v,{placement:"top",title:u?"确定开始训练吗?":"确定结束训练吗?",onConfirm:e=>u?G():H(),okText:"确定",cancelText:"取消",children:s.jsx(i,{children:u?"开始训练":"结束训练"})})})]}),s.jsxs("div",{className:"content",children:[s.jsx("div",{className:"organ",children:s.jsx(pe,{onSelectOrg:V})}),s.jsx("div",{className:"tableBox",children:o&&s.jsx(he,{rowKey:e=>e.id,size:"small",showExpandColumn:!1,columns:ae,loading:M,dataSource:o,sticky:!0,pagination:{total:o.length||0,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}})})]}),s.jsx(ce,{text:s.jsxs("span",{children:[s.jsx(T,{}),"   二 维 码"]}),width:640,footer:null,open:D,onCancel:U,children:s.jsxs(me,{children:[s.jsxs("p",{className:"title",children:[s.jsx("span",{children:"账 号: "}),s.jsx("span",{children:j.pNum}),s.jsx("span",{children:"姓 名: "}),s.jsx("span",{children:j.pName})]}),s.jsx("div",{className:"qr",children:s.jsx(de,{value:E,size:400,color:"#000",bgColor:"#fff"})}),s.jsxs("div",{className:"btns",children:[s.jsx(i,{onClick:J,children:"取 消"}),s.jsx(v,{placement:"top",title:"确定加入训练吗?",onConfirm:e=>K(),okText:"确定",cancelText:"取消",children:s.jsx(i,{children:"加入训练"})})]}),s.jsx("p",{className:"tip",children:"流 程 : 扫码 → 加入训练 → 开始训练 → 结束训练"})]})})]})});ue.displayName="DarkQR";export{ue as default};
