import{p as O,r as a,A as J,t as K,F as i,g as f,j as s,I as r,a as R,B as p,h as P,v as k}from"./index-CKIL6d0V.js";import{F as Q}from"./Table-BaVi_066.js";import{R as U}from"./PlusCircleOutlined-C3dgw0Zs.js";import"./iconUtil-Co5gbObL.js";import"./index-C-LPyJas.js";const W=O.div`
  height: 100%;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  .searchTop {
    height: 70px;
    padding: 0 20px;
    margin-bottom: 15px;
    display: flex;
    background-color: ${t=>t.theme.colorBgContainer};
    .ysh_inputs {
      flex: 5;
      font-size: 16px;
      display: flex;
      align-items: center;
      .ysh_input {
        flex: 1;
        .input {
          margin-left: 10px;
          width: 60%;
        }
      }
    }
    .ysh_btns {
      flex: 1;
      font-size: 16px;
      display: flex;
      justify-content: space-around;
      align-items: center;
    }
  }

  .content {
    flex: 1;
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 6px;
    background-color: ${t=>t.theme.colorBgContainer};
  }
`,G=a.memo(()=>{const{message:t}=J.useApp(),{token:y}=K.useToken(),[V,o]=a.useState(!1),[x,g]=a.useState("添 加"),[I,M]=a.useState(""),[N,d]=a.useState([]),[S,j]=a.useState(0),[m,w]=a.useState(""),[u,C]=a.useState(""),[h,v]=a.useState(""),[c]=i.useForm(),B=[{title:"手机编号",dataIndex:"mobileNum",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:e})},{title:"手机设备号",dataIndex:"bandNum",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:e})},{title:"VR设备号",dataIndex:"vrNum",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:e})},{title:"备 注",dataIndex:"reMark",align:"center",key:"id",render:e=>s.jsx(s.Fragment,{children:e})},{title:"操 作",dataIndex:"id",align:"center",key:"id",render:(e,n)=>s.jsx(s.Fragment,{children:s.jsx(R,{size:"middle",children:s.jsx(p,{size:"small",onClick:l=>$(n),children:"修 改"})})})}];a.useEffect(()=>{f("/api/VRDivece/All",{pageIndex:1,pageSize:999999}).then(e=>{e.code===200&&(d(e.data.items),j(e.data.totalRecords))})},[]);const F=e=>{w(e.target.value)},z=e=>{v(e.target.value)},_=e=>{C(e.target.value)},A=()=>{b({MobileNum:m,VRNum:u,BandNum:h,pageIndex:1,pageSize:9999})},b=async e=>{const{data:n,code:l}=await f("/api/VRDivece/All",e);l===200?(d(n.items),j(n.totalRecords)):d([])},D=e=>{o(!0),g(e)},T=()=>{c.submit()},q=()=>{c.resetFields()},E=()=>{o(!1)},L=async e=>{if(x==="添 加"){const{code:n,msg:l}=await k("/api/VRDivece/Add",{mobileNum:e.MobileNum,bandNum:e.BandNum,vrNum:e.VRNum,reMark:e.reMark});n===200?t.success(l,3):t.error(l,3)}else{const{code:n,msg:l}=await k("/api/VRDivece/Update",{mobileNum:e.MobileNum,bandNum:e.BandNum,vrNum:e.VRNum,reMark:e.reMark},{id:I});n===200?t.success(l,3):t.error(l,3)}o(!1),b({MobileNum:m,VRNum:u,BandNum:h,pageIndex:1,pageSize:9999})},$=e=>{g("修 改"),o(!0),M(e.id),c.setFieldsValue({BandNum:e.bandNum,MobileNum:e.mobileNum,VRNum:e.vrNum,reMark:e.reMark})};return s.jsxs(W,{theme:y,children:[s.jsxs("div",{className:"searchTop",children:[s.jsxs("div",{className:"ysh_inputs",children:[s.jsxs("span",{className:"ysh_input",children:["手机编号:",s.jsx(r,{className:"input",value:m,allowClear:!0,onChange:F})]}),s.jsxs("span",{className:"ysh_input",children:["手机设备号:",s.jsx(r,{className:"input",value:h,onChange:z,allowClear:!0})]}),s.jsxs("span",{className:"ysh_input",children:["VR设备号  :",s.jsx(r,{className:"input",value:u,onChange:_,allowClear:!0})]})]}),s.jsx("div",{className:"ysh_btns",children:s.jsxs(R,{size:"middle",children:[s.jsx(p,{onClick:e=>A(),children:"查 询"}),s.jsx(p,{onClick:e=>D("添 加"),children:"添 加"})]})})]}),s.jsx("div",{className:"content",children:N.length>0&&s.jsx(Q,{rowKey:e=>e.id,columns:B,dataSource:N,size:"small",sticky:!0,pagination:{total:S,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}})}),s.jsx(P,{text:s.jsxs("span",{style:{fontSize:"24px"},children:[s.jsx(U,{}),"  ",x]}),width:618,visible:V,onOk:T,onCancel:E,afterClose:q,children:s.jsxs(i,{form:c,labelWrap:!0,labelAlign:"right",onFinish:L,labelCol:{flex:"120px"},initialValues:{BandNum:"",MobileNum:"",VRNum:"",reMark:""},children:[s.jsx(i.Item,{label:"手环编号",name:"BandNum",rules:[{required:!0,message:"请输入手环编号"}],children:s.jsx(r,{placeholder:"请输入手环编号"})}),s.jsx(i.Item,{label:"手机设备号",name:"MobileNum",rules:[{required:!0,message:"请输入手机设备号"}],children:s.jsx(r,{placeholder:"请输入手机设备号"})}),s.jsx(i.Item,{label:"VR设备号",name:"VRNum",rules:[{required:!0,message:"请输入VR设备号"}],children:s.jsx(r,{placeholder:"请输入VR设备号"})}),s.jsx(i.Item,{label:"备注",name:"reMark",children:s.jsx(r,{placeholder:"请输入备注"})})]})})]})});G.displayName="VRBracelets";export{G as default};
