import{r as s,j as e}from"./app-2b14cdc4.js";import{C as t}from"./index-47cbd1bd.js";import{C as a}from"./index-5f3ff9e6.js";import{h as i,l,t as o,u as n,i as r}from"./local-b2ec0571.js";import{C as c}from"./index-dd54d262.js";import{i as h}from"./dom-ce105537.js";import{t as d,a as m,b as p}from"./trade-8bf27581.js";import"./auth-d886836e.js";const u=["status"],x=[],j=[];class b extends s.Component{constructor(s){super(s),this.SymbolList=async()=>{try{const s=await i(!0,l);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===d?n=u:s===m?n=x:s===p&&(n=j);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:o()},directionSelect:{label:"方向",options:n("position_side")},exchangeSelect:{label:"交易所",options:n("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:n,symbolOptions:d}=this.state;return e.jsxs("div",{className:[r()?"custom-trade-select-box__mobile":""].join(" "),children:[e.jsxs("div",{style:{display:h("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:n,name:"symbol",options:d,className:"trade-dialog-select",clearable:!1,customClear:!0,autoWidth:!1,filterable:!0,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:h("2"===this.props.currentGroupButton||"3"===this.props.currentGroupButton)},children:[e.jsx("span",{className:"label",children:"状态"}),e.jsx(c,{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{b as default};
