import{r as t,s,j as e}from"./app-61e75031.js";import i from"./index-26531c5d.js";import a from"./index-dc453ceb.js";import r from"./index-3ac169bd.js";import{g as n,i as o}from"./dom-ce105537.js";import{t as l,a as u,b as h}from"./trade-8bf27581.js";import c from"./index-9145293e.js";import{h as d,i as m}from"./local-95ab843f.js";import{C as p}from"./index-33422928.js";import{C as b}from"./multipleUse-8758e0f1.js";import g from"./index-e0005241.js";import"./index-a7529dc7.js";import"./index-b09a3426.js";import"./auth-db23b820.js";import"./index-bf885361.js";import"./trade-281a8bb7.js";import"./index-d69519d2.js";import"./index-e39dfa26.js";import"./index-0af180fb.js";import"./index-1db4bfc2.js";import"./index-22ffc443.js";import"./submit-fbaa0812.js";const j="contract-trade",x="start-trade";class C extends t.Component{constructor(t){super(t),this.changeTableStatus=t=>{const s=Object.keys(this.state.tableStatus);for(let e=0;e<s.length;e++){const i=s[e];if(i===t){this.state.tableStatus[i]||(this.state.tableStatus[i]=!0);break}}},this.changeGroupButton=t=>{this.changeTableStatus(t),this.setState({currentGroupButton:t})},this.getTableHeight=()=>{const t=document.getElementById(j);if(t){const s=n(t),e=document.documentElement.clientHeight-s.top;this.setState({minHeight:e+"px"})}},this.storeChange=()=>{s.dispatch({type:"count",data:1})},this.closeDialog=()=>{this.setState({dialog_visible:!1})},this.onCancelEntrust=()=>{this.currentConsignment.tableContractRevoke()},this.FilterChange=t=>{this.setState({filter:t}),this.getChildTableList(t)},this.getChildTableList=t=>{"1"===this.state.currentGroupButton?this.holdingPositionRef.getTableList(t):"2"===this.state.currentGroupButton?this.currentConsignment.getTableList(t):"3"===this.state.currentGroupButton&&this.historyTransaction.getTableList(t)},this.updateTotal=t=>{this.setState({currentEntrustNum:t})},this.state={dialog_visible:!1,minHeight:"",currentEntrustNum:0,currentGroupButton:"4",tableStatus:{[x]:!0,[l]:!1,[u]:!1,[h]:!1},filter:{}}}get ComputedGroupButtons(){return[{label:"开始交易",value:"4"},{label:"持有仓位",value:"1"},{label:`当前委托(${this.state.currentEntrustNum})`,value:"2"},{label:"历史成交",value:"3"}]}async componentDidMount(){this.getTableHeight(),await d()}onClosePosition(){b({ids:[]})}getTableClass(){return["spread-out-table",m()?"spread-out-table__mobile":""].join(" ")}currentExtensionButtons(){switch(this.state.currentGroupButton){case l:return e.jsx("div",{className:"hold-position-extension",children:e.jsx(p,{onClick:this.onClosePosition,children:"一键平仓"})});case u:return e.jsx("div",{className:"hold-position-extension",children:e.jsx(p,{onClick:this.onCancelEntrust,children:"多选撤销"})});case h:return""}}render(){return s.getState(),e.jsxs("div",{className:"contract-trade-table",id:this.props.id,style:this.props.style,children:[e.jsx("div",{className:"contract-trade-label",children:"合约交易"}),e.jsx("div",{className:"contract-trade-group",children:this.ComputedGroupButtons.map(((t,s)=>e.jsx("div",{className:t.value===this.state.currentGroupButton?"group-active":"",onClick:this.changeGroupButton.bind(this,t.value),children:t.label},t.value)))}),e.jsx(c,{FilterChange:this.FilterChange,children:this.currentExtensionButtons()}),e.jsxs("div",{className:["contract-trade-table-box",m()?"contract-trade-table__mobile":""].join(" "),id:j,style:{minHeight:this.state.minHeight},children:[e.jsx(g,{"v-if":this.state.tableStatus[x],className:this.getTableClass(),style:{display:o("4"===this.state.currentGroupButton)}}),e.jsx(i,{"v-if":this.state.tableStatus[l],className:this.getTableClass(),ref:t=>this.holdingPositionRef=t,style:{display:o(this.state.currentGroupButton===l)}}),e.jsx(a,{"v-if":this.state.tableStatus[u],className:this.getTableClass(),ref:t=>this.currentConsignment=t,style:{display:o(this.state.currentGroupButton===u)},updateTotal:this.updateTotal}),e.jsx(r,{"v-if":this.state.tableStatus[h],className:this.getTableClass(),ref:t=>this.historyTransaction=t,style:{display:o(this.state.currentGroupButton===h)}})]})]})}}export{C as default};
