import{r as s,j as e}from"./app-c8e83d6a.js";import{C as t}from"./index-4352624d.js";import{C as a}from"./index-2758d81a.js";import{h as i,q as l,r as o,i as n}from"./local-b223e4bc.js";import{C as r}from"./index-a9159cae.js";import{i as c}from"./dom-ce105537.js";import{t as h,a as p,b as d}from"./trade-8bf27581.js";import"./auth-3113b8a5.js";const m=["status"],u=[],x=[];class j extends s.Component{constructor(s){super(s),this.SymbolList=async()=>{try{const s=await i();this.setState({symbolOptions:s})}catch(s){}},this.getFilterParams=(s="")=>{const{exchange_users_id:e,symbol:t,position_side:a,exchange:i,status:l}=this.state;let o={};e&&(o.exchange_users_id=e),t&&(o.symbol=t),l&&(o.status=l),a&&(o.position_side=a),i&&(o.exchange=i);let n=[];if(s){s===h?n=m:s===p?n=u:s===d&&(n=x);const e=Object.keys(o);n.forEach((s=>{-1!==e.findIndex((e=>e===s))&&delete o[s]}))}return o},this.valueChange=(s,e)=>{this.setState({[e]:s})},this.state={user:"",symbol:"",direction:"",exchange:"",status:"NEW",userSelect:{label:"用户",options:l()},directionSelect:{label:"方向",options:o("position_side")},exchangeSelect:{label:"交易所",options:o("exchange")},symbolOptions:[]}}onFilter(s){this.props.FilterChange&&this.props.FilterChange(s)}componentDidMount(){this.SymbolList()}render(){const{userSelect:s,exchange:i,directionSelect:l,exchangeSelect:o,symbol:h,symbolOptions:p}=this.state;return e.jsxs("div",{className:[n()?"custom-trade-select-box__mobile":""].join(" "),children:[e.jsxs("div",{style:{display:c("4"!==this.props.currentGroupButton)},className:["custom-trade-select-box"].join(" "),children:[e.jsxs("div",{className:"custom-trade-select",children:[e.jsx("span",{className:"label",children:s.label}),e.jsx(t,{className:"real-trade-select",name:"user",value:this.state.user,options:s.options,onChange:this.valueChange})]}),e.jsxs("div",{className:"custom-trade-input",children:[e.jsx("span",{className:"label",children:"交易对"}),e.jsx(t,{value:h,name:"symbol",options:p,className:"trade-dialog-select",clearable:!1,customClear:!0,autoWidth:!1,filterable:!0,popupProps:{overlayClassName:"trade-dialog-select__overlay"},onChange:this.valueChange})]}),e.jsxs("div",{className:"custom-trade-select",children:[e.jsx("span",{className:"label",children:l.label}),e.jsx(t,{name:"direction",value:this.state.direction,className:"real-trade-select",options:l.options,onChange:this.valueChange})]}),e.jsxs("div",{className:"custom-trade-select",children:[e.jsx("span",{className:"label",children:o.label}),e.jsx(t,{name:"exchange",value:i,className:"real-trade-select",options:o.options,onChange:this.valueChange})]}),e.jsxs("div",{className:"custom-trade-input",style:{display:c("2"===this.props.currentGroupButton||"3"===this.props.currentGroupButton)},children:[e.jsx("span",{className:"label",children:"状态"}),e.jsx(r,{name:"status",value:this.state.status,onChange:this.valueChange})]}),e.jsx(a,{onClick:this.onFilter.bind(this,this.getFilterParams(this.props.currentGroupButton)),children:"查询"}),e.jsx(a,{onClick:this.onFilter.bind(this,this.getFilterParams(this.props.currentGroupButton)),children:"刷新"})]}),this.props.children]})}}export{j as default};
