import{s as b,u as S,r as i,n as N,j as s,L as w}from"./index-C9R49v6m.js";import{a as C}from"./Index-CXTfQzCc.js";import{E as k}from"./Index-UIpxJMh-.js";import{R as L}from"./Index-OmvkcWPw.js";import{E as R,e as W}from"./empty-BhJT2ZU1.js";import{b as q}from"./banner-CrWGdN1D.js";import{S as E}from"./index-s4x2Se67.js";import{R as P,C as m,P as z}from"./Pagination-DYznrCf4.js";import{R as T}from"./LoadingOutlined-DJJZod9R.js";import"./EyeOutlined-BPx0C749.js";import"./useFlexGapSupport-fVpxTpuu.js";const B="_banner_2yd1q_1",K="_imgWrapper_2yd1q_5",M="_searchWrapper_2yd1q_14",A="_input_2yd1q_24",I="_inputText_2yd1q_37",O="_submitBtn_2yd1q_43",$="_content_2yd1q_54",F="_tabs_2yd1q_61",H="_main_2yd1q_66",J="_instrumentList_2yd1q_81",Q="_footer_2yd1q_84",X="_pagination_2yd1q_87",n={banner:B,imgWrapper:K,searchWrapper:M,input:A,inputText:I,submitBtn:O,content:$,tabs:F,main:H,instrumentList:J,footer:Q,pagination:X},G=s.jsx(T,{style:{fontSize:24,color:"#0c457a"},spin:!0}),U=[{title:"文章列表",key:"first"},{title:"仪器列表",key:"second"}],V={current:0,pageSize:10},cs=()=>{const[o]=b(),h=S(),[l,u]=i.useState(o.get("keyword")||""),[c,d]=i.useState("first"),[a,g]=i.useState({...V}),{data:r,loading:x}=N(()=>{const e={};return e.searchfield="name,model_no,specification",e.sort={by:"price",sc:"D"},e.searchtext=o.get("keyword")||"",w.getEquipment(e,a)},[a,o]),t=i.useMemo(()=>r?(r.equipment.length&&d("second"),{total:r.resData.total,list:r.equipment}):null,[r,a]),_=e=>{d(e)},y=i.useMemo(()=>{var e;switch(c){case"first":return s.jsx(L,{hasRead:!1,type:"search"});case"second":return s.jsxs("div",{style:{height:t!=null&&t.list&&(t!=null&&t.list.length)?"":380},children:[s.jsx(E,{spinning:x,indicator:G,children:s.jsx("div",{className:n.instrumentList,children:(e=t==null?void 0:t.list)!=null&&e.length?s.jsx(k,{equipments:t.list}):s.jsx("div",{style:{height:250,width:"894px",position:"relative"},children:s.jsx(R,{style:{position:"absolute",left:"50%",top:"10px",transform:"translateX(-50%)",marginBottom:60},image:W,imageStyle:{width:200,height:200}})})})}),(t==null?void 0:t.total)>0&&s.jsx("div",{className:n.footer,children:s.jsxs(P,{children:[s.jsxs(m,{span:3,children:["共有仪器 ",s.jsx("span",{style:{fontWeight:"bold"},children:t==null?void 0:t.total})," 台"]}),s.jsx(m,{span:21,children:s.jsx("div",{className:n.pagination,children:s.jsx(z,{total:t==null?void 0:t.total,current:Math.floor(a.current/a.pageSize)+1,onChange:j=>{const v=(j-1)*a.pageSize;g({...a,current:v})},pageSize:a.pageSize,showSizeChanger:!1,showQuickJumper:!0})})})]})})]});default:return s.jsx("div",{children:"搜索列表"})}},[c,t,a,o]),p=()=>{h("/searchList?keyword=".concat(l),{replace:!0})},f=e=>{e.key==="Enter"&&p()};return s.jsxs("div",{style:{width:"100%",backgroundColor:"#fff",minHeight:"calc(100vh - 300px)"},children:[s.jsxs("div",{className:n.banner,children:[s.jsx("div",{className:n.imgWrapper,children:s.jsx("img",{src:q,alt:""})}),s.jsx("div",{className:n.searchWrapper,children:s.jsxs("div",{className:n.input,children:[s.jsx("input",{type:"text",className:n.inputText,value:l,onChange:e=>{u(e.target.value)},onKeyPress:f,placeholder:"请输入搜索关键字"}),s.jsx("div",{className:n.submitBtn,onClick:p,children:"搜索"})]})})]}),s.jsx("div",{className:n.wrapper,children:s.jsxs("div",{className:n.content,children:[s.jsx("div",{className:n.tabs,children:s.jsx(C,{options:U,activeKey:c,onChange:e=>{_(e)}})}),s.jsx("div",{className:n.main,children:y})]})})]})};export{cs as default};
