|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<!-- 期货交易、套保交易 -->
|
|
|
- <Drawer class="top dialog-trade" :title="(isSpotContract | isHedgePlan) ? '套保交易' : '期货交易'" placement="right"
|
|
|
+ <Drawer class="top dialog-trade" :title="(isSpotContract || isHedgePlan) ? '套保交易' : '期货交易'" placement="right"
|
|
|
:visible="visible" @cancel="cancel">
|
|
|
<div class="futures_trade">
|
|
|
<div class="futures_trade__left">
|
|
|
@@ -123,6 +123,7 @@ import { queryErmcp3ContractMiddleGoodsCfg } from '@/services/go/ermcp/spot-cont
|
|
|
import { QueryErmcp3ContractMiddleGoodsCfgRsp } from '@/services/go/ermcp/spot-contract/interface';
|
|
|
import { queryRelatedTaAccount } from '@/services/go/TaAccount';
|
|
|
import { QueryRelatedTaAccountRsp } from "@/services/go/TaAccount/interface";
|
|
|
+import { Ermcp2HedgedItemRsp } from '@/services/go/ermcp/hedgedItem/interface'
|
|
|
|
|
|
export default defineComponent({
|
|
|
emits: ['cancel', 'update'],
|
|
|
@@ -130,13 +131,13 @@ export default defineComponent({
|
|
|
components: { Des, Drawer, PlusOutlined, MinusOutlined },
|
|
|
props: {
|
|
|
selectedRow: {
|
|
|
- type: Object as PropType<GoodsQuote & QueryErmcpTradePositionRsp & Ermcp3SellBuyContract & Ermcp3HedgePlan & ErmcpRealExposureModel>,
|
|
|
+ type: Object as PropType<GoodsQuote & QueryErmcpTradePositionRsp & Ermcp3SellBuyContract & Ermcp3HedgePlan & ErmcpRealExposureModel & Ermcp2HedgedItemRsp>,
|
|
|
default: () => ({}),
|
|
|
},
|
|
|
},
|
|
|
setup(props, context) {
|
|
|
const { visible, cancel } = _closeModal(context);
|
|
|
- const { tradeuserid, goodsid, spotcontractid, hedgeplanid, deliverygoodsid, goodsgroupid, MiddleGoodsID } = props.selectedRow;
|
|
|
+ const { tradeuserid, goodsid, spotcontractid, hedgeplanid, deliverygoodsid, wrstandardid, goodsgroupid, MiddleGoodsID, hedgeditemid } = props.selectedRow;
|
|
|
const { rules, formData } = handleForm();
|
|
|
const formRef = ref();
|
|
|
const loading = ref<boolean>(false);
|
|
|
@@ -159,6 +160,8 @@ export default defineComponent({
|
|
|
const isHedgePlan = Boolean(hedgeplanid);
|
|
|
// 是否实时敞口 (根据参数 MiddleGoodsID 来判断)
|
|
|
const isExposure = Boolean(MiddleGoodsID);
|
|
|
+ // 是否套期项目 (根据参数 hedgeditemid 来判断)
|
|
|
+ const isHedgedItem = Boolean(hedgeditemid);
|
|
|
|
|
|
// 现货合同
|
|
|
if (isSpotContract) {
|
|
|
@@ -187,30 +190,32 @@ export default defineComponent({
|
|
|
goodsList.value = [];
|
|
|
})
|
|
|
} else {
|
|
|
- // 购销计划
|
|
|
- if (isHedgePlan) {
|
|
|
- GetDeliveryGoodsDetail(deliverygoodsid).then((res) => {
|
|
|
- const ids: number[] = [];
|
|
|
- const deliveryGoodsList = res.filter((e) => e.isvalid);
|
|
|
-
|
|
|
- deliveryGoodsList.forEach((dg) => {
|
|
|
- dg.wdlst.forEach((wd) => {
|
|
|
- wd.mglst.forEach((mg) => {
|
|
|
- mg.GPLST.forEach((gp) => {
|
|
|
- ids.push(...gp.GDLST.map((e) => e.goodsid));
|
|
|
+ // 购销计划、套期项目
|
|
|
+ if (isHedgePlan || isHedgedItem) {
|
|
|
+ if (deliverygoodsid) {
|
|
|
+ GetDeliveryGoodsDetail(deliverygoodsid).then((res) => {
|
|
|
+ const ids: number[] = [];
|
|
|
+ const deliveryGoodsList = res.filter((e) => e.isvalid);
|
|
|
+
|
|
|
+ deliveryGoodsList.forEach((dg) => {
|
|
|
+ const wd = dg.wdlst.find((e) => e.wrstandardid === wrstandardid);
|
|
|
+ if (wd) {
|
|
|
+ wd.mglst.forEach((mg) => {
|
|
|
+ mg.GPLST.forEach((gp) => {
|
|
|
+ ids.push(...gp.GDLST.map((e) => e.goodsid));
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
+ }
|
|
|
})
|
|
|
- })
|
|
|
|
|
|
- goodsList.value = goodsList.value.filter((e) => ids.includes(e.goodsid));
|
|
|
- if (goodsList.value.length) {
|
|
|
- formData.GoodsID = goodsList.value[0].goodsid;
|
|
|
- goodsChange(formData.GoodsID); // 默认选中第一个
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- goodsList.value = [];
|
|
|
- })
|
|
|
+ const tmpList = goodsList.value.filter((e) => ids.includes(e.goodsid));
|
|
|
+ if (tmpList.length) {
|
|
|
+ goodsList.value = tmpList;
|
|
|
+ formData.GoodsID = tmpList[0].goodsid;
|
|
|
+ goodsChange(formData.GoodsID); // 默认选中第一个
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
const item = goodsList.value.find((e) => e.goodsid === goodsid);
|
|
|
if (!item) {
|
|
|
@@ -401,7 +406,7 @@ export default defineComponent({
|
|
|
|
|
|
// 判断是否现货合同交易
|
|
|
if (isSpotContract) {
|
|
|
- const { saleuserid, spotcontractid, bizsubjectid } = props.selectedRow;
|
|
|
+ const { saleuserid, bizsubjectid } = props.selectedRow;
|
|
|
formData.HedgeFlag = 4;
|
|
|
formData.SaleUserID = saleuserid;
|
|
|
formData.SpotContractID = spotcontractid;
|
|
|
@@ -410,11 +415,16 @@ export default defineComponent({
|
|
|
|
|
|
// 判断是否购销计划交易,任务 #3645
|
|
|
if (isHedgePlan) {
|
|
|
- const { hedgeplanid } = props.selectedRow;
|
|
|
formData.HedgeFlag = 9;
|
|
|
formData.SpotContractID = hedgeplanid;
|
|
|
}
|
|
|
|
|
|
+ // 判断是否套期项目
|
|
|
+ if (isHedgedItem) {
|
|
|
+ formData.HedgeFlag = 13;
|
|
|
+ formData.SpotContractID = hedgeditemid;
|
|
|
+ }
|
|
|
+
|
|
|
// 按钮提交类型
|
|
|
switch (submitType) {
|
|
|
case 'buy': {
|