index.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // 套保计划
  2. import {buildProtoReq50, parseProtoRsp50} from "@/services/socket/protobuf/buildReq";
  3. import APP from "@/services";
  4. import {Callback} from "@/utils/websocket";
  5. import {ErmcpHedgePlanReq} from "@/services/proto/hedgeplan/interface";
  6. /**
  7. * 套保计划操作请求
  8. * @param param.hedgePlanID Long 套保计划id
  9. * @param param.OperateType Int 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回
  10. */
  11. export const operationContractReq = (param: ErmcpHedgePlanReq): Promise<any> => {
  12. return new Promise((resolve, reject) => {
  13. const params = {
  14. protobufName: 'ErmcpHedgePlanReq',
  15. funCodeName: 'ErmcpHedgePlanReq',
  16. reqParams: param,
  17. msgHeadParams: {
  18. AccountID: param.accountid,
  19. MarketID: 18,
  20. GoodsID: 0,
  21. }
  22. };
  23. const package50 = buildProtoReq50(params);
  24. APP.sendTradingServer(package50, undefined, {
  25. onSuccess: (res) => {
  26. const { isSuccess, result } = parseProtoRsp50(res, 'ErmcpHedgePlanRsp');
  27. if (isSuccess) {
  28. resolve(result);
  29. } else {
  30. reject(result);
  31. }
  32. },
  33. onFail: (err) => reject(err.message),
  34. } as Callback);
  35. });
  36. }