|
|
@ -55,42 +55,42 @@ const MT4Order: FC = () => { |
|
|
|
<div>{statusText[`${status}`] || ''}</div> |
|
|
|
) |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'operations', |
|
|
|
align: 'center', |
|
|
|
key: Date.now(), |
|
|
|
render: (text, record) => ( |
|
|
|
<div> |
|
|
|
{record.account_forex_type === 1 && record.handle_status === 4 && ( |
|
|
|
<Button type='primary' size='small' onClick={() => { |
|
|
|
setVisible(true) |
|
|
|
setCurrentItem(record) |
|
|
|
}}>平仓</Button> |
|
|
|
)} |
|
|
|
</div> |
|
|
|
) |
|
|
|
} |
|
|
|
// {
|
|
|
|
// title: '操作',
|
|
|
|
// dataIndex: 'operations',
|
|
|
|
// align: 'center',
|
|
|
|
// key: Date.now(),
|
|
|
|
// render: (text, record) => (
|
|
|
|
// <div>
|
|
|
|
// {record.account_forex_type === 1 && record.handle_status === 4 && (
|
|
|
|
// <Button type='primary' size='small' onClick={() => {
|
|
|
|
// setVisible(true)
|
|
|
|
// setCurrentItem(record)
|
|
|
|
// }}>平仓</Button>
|
|
|
|
// )}
|
|
|
|
// </div>
|
|
|
|
// )
|
|
|
|
// }
|
|
|
|
], []) |
|
|
|
|
|
|
|
const closePosition = async () => { |
|
|
|
let params = { |
|
|
|
login: currentItem.login, |
|
|
|
ticket: `${currentItem.order}`, |
|
|
|
volume: currentItem.volume |
|
|
|
} |
|
|
|
setVisible(false) |
|
|
|
const res: any = await clientApi.close_order(params) |
|
|
|
if (res.code === 0) { |
|
|
|
notification.success({ |
|
|
|
message: '平仓成功' |
|
|
|
}) |
|
|
|
setCurrentItem({}) |
|
|
|
setTimeout(() => { |
|
|
|
tableRefs.current?.update() |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
} |
|
|
|
// const closePosition = async () => {
|
|
|
|
// let params = {
|
|
|
|
// login: currentItem.login,
|
|
|
|
// ticket: `${currentItem.order}`,
|
|
|
|
// volume: currentItem.volume
|
|
|
|
// }
|
|
|
|
// setVisible(false)
|
|
|
|
// const res: any = await clientApi.close_order(params)
|
|
|
|
// if (res.code === 0) {
|
|
|
|
// notification.success({
|
|
|
|
// message: '平仓成功'
|
|
|
|
// })
|
|
|
|
// setCurrentItem({})
|
|
|
|
// setTimeout(() => {
|
|
|
|
// tableRefs.current?.update()
|
|
|
|
// }, 1000)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
return ( |
|
|
|
<div> |
|
|
@ -100,9 +100,9 @@ const MT4Order: FC = () => { |
|
|
|
columns={column} |
|
|
|
rowKey="order" |
|
|
|
/> |
|
|
|
<Modal visible={visible} onCancel={() => setVisible(false)} title='提示' onOk={closePosition}> |
|
|
|
{/* <Modal visible={visible} onCancel={() => setVisible(false)} title='提示' onOk={closePosition}> |
|
|
|
<div>确认平仓吗?</div> |
|
|
|
</Modal> |
|
|
|
</Modal> */} |
|
|
|
</div> |
|
|
|
) |
|
|
|
} |
|
|
|