|
@@ -1,24 +1,52 @@
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 商品订单 - 合约汇总 -->
|
|
<!-- 商品订单 - 合约汇总 -->
|
|
|
<section>
|
|
<section>
|
|
|
- <a-table :columns="tabColumns"
|
|
|
|
|
- class="srcollYTable expandLeftTable"
|
|
|
|
|
- :scroll="{ x: '100%', y: '190px' }"
|
|
|
|
|
- :pagination="false"
|
|
|
|
|
- :loading="loading"
|
|
|
|
|
- :expandedRowKeys="expandedRowKeys"
|
|
|
|
|
- :customRow="Rowclick"
|
|
|
|
|
- :expandIcon="expandIcon"
|
|
|
|
|
- :expandIconAsCell="false"
|
|
|
|
|
- rowKey="key"
|
|
|
|
|
- :data-source="tableList">
|
|
|
|
|
|
|
+ <a-table
|
|
|
|
|
+ :columns="getTableColums()"
|
|
|
|
|
+ class="srcollYTableExpendBgColor srcollYTable expandLeftTable"
|
|
|
|
|
+ :scroll="{ x: '100%', y: '190px' }"
|
|
|
|
|
+ :pagination="false"
|
|
|
|
|
+ :loading="loading"
|
|
|
|
|
+ :expandedRowKeys="expandedRowKeys"
|
|
|
|
|
+ :customRow="Rowclick"
|
|
|
|
|
+ :expandIcon="expandIcon"
|
|
|
|
|
+ :expandIconAsCell="false"
|
|
|
|
|
+ rowKey="key"
|
|
|
|
|
+ :data-source="tableList"
|
|
|
|
|
+ >
|
|
|
<!-- 额外的展开行 -->
|
|
<!-- 额外的展开行 -->
|
|
|
- <template v-if="btnList.length"
|
|
|
|
|
- #expandedRowRender="{ record }">
|
|
|
|
|
- <BtnList :btnList="handleBtnList(record,btnList)"
|
|
|
|
|
- :record="record"
|
|
|
|
|
- class="btn-list-sticky"
|
|
|
|
|
- @click="openComponent" />
|
|
|
|
|
|
|
+ <template #expandedRowRender="{ record }">
|
|
|
|
|
+ <a-table
|
|
|
|
|
+ :columns="getDetailColums()"
|
|
|
|
|
+ class="expandBottomTable"
|
|
|
|
|
+ :pagination="false"
|
|
|
|
|
+ :loading="detailLoading"
|
|
|
|
|
+ :expandedRowKeys="expandedRowKeys"
|
|
|
|
|
+ :expandIcon="expandIcon"
|
|
|
|
|
+ :expandIconAsCell="false"
|
|
|
|
|
+ rowKey="key"
|
|
|
|
|
+ :data-source="detailTableList"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #operate="sub">
|
|
|
|
|
+ <BtnList
|
|
|
|
|
+ :btnList="handleBtnList(record, btnList)"
|
|
|
|
|
+ :record="sub.record"
|
|
|
|
|
+ class="btn-list-sticky"
|
|
|
|
|
+ @click="openComponent"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 持仓盈亏 -->
|
|
|
|
|
+ <template #profitloss="{ record }">
|
|
|
|
|
+ <span>{{ getDetailProfitloss(record) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 市值 -->
|
|
|
|
|
+ <template #marketamount="{ record }">
|
|
|
|
|
+ <span>{{ getDetailMarketAmount(record) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #expiredate="{ text }">
|
|
|
|
|
+ <span>{{ handleNoneValue(text) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
</template>
|
|
</template>
|
|
|
<template #createtime="{ record }">
|
|
<template #createtime="{ record }">
|
|
|
<a>{{ formatTime(record.createtime) }}</a>
|
|
<a>{{ formatTime(record.createtime) }}</a>
|
|
@@ -29,7 +57,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<!-- 均价 -->
|
|
<!-- 均价 -->
|
|
|
<template #averageprice="{ text }">
|
|
<template #averageprice="{ text }">
|
|
|
- <a>{{ handleNoneValue(text)}}</a>
|
|
|
|
|
|
|
+ <a>{{ handleNoneValue(text) }}</a>
|
|
|
</template>
|
|
</template>
|
|
|
<!-- 持仓盈亏 -->
|
|
<!-- 持仓盈亏 -->
|
|
|
<template #profitloss="{ record }">
|
|
<template #profitloss="{ record }">
|
|
@@ -38,16 +66,18 @@
|
|
|
<template #buyorsell="{ record }">
|
|
<template #buyorsell="{ record }">
|
|
|
<span>{{ getBuyOrSellName(record.buyorsell) }}</span>
|
|
<span>{{ getBuyOrSellName(record.buyorsell) }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
- <template #marketamount="{ record, text }">
|
|
|
|
|
|
|
+ <!-- <template #marketamount="{ record, text }">
|
|
|
<span>{{ isDiaoQi(record) ? '--' : text }}</span>
|
|
<span>{{ isDiaoQi(record) ? '--' : text }}</span>
|
|
|
- </template>
|
|
|
|
|
|
|
+ </template>-->
|
|
|
</a-table>
|
|
</a-table>
|
|
|
- <component :is="componentId"
|
|
|
|
|
- v-if="componentId"
|
|
|
|
|
- :selectedRow="selectedRow"
|
|
|
|
|
- :tableList="tableList"
|
|
|
|
|
- :swapList="swapList"
|
|
|
|
|
- @cancel="closeComponent"></component>
|
|
|
|
|
|
|
+ <component
|
|
|
|
|
+ :is="componentId"
|
|
|
|
|
+ v-if="componentId"
|
|
|
|
|
+ :selectedRow="selectedRow"
|
|
|
|
|
+ :tableList="tableList"
|
|
|
|
|
+ :swapList="swapList"
|
|
|
|
|
+ @cancel="closeComponent"
|
|
|
|
|
+ ></component>
|
|
|
</section>
|
|
</section>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -55,112 +85,104 @@
|
|
|
import { BtnListType } from '@/common/components/btnList/interface';
|
|
import { BtnListType } from '@/common/components/btnList/interface';
|
|
|
import { TradeMode } from '@/common/constants/enumCommon';
|
|
import { TradeMode } from '@/common/constants/enumCommon';
|
|
|
import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
|
|
import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
|
|
|
-import { BtnList, defineAsyncComponent, defineComponent, ModalEnum, queryTableList } from '@/common/export/commonTable';
|
|
|
|
|
|
|
+import { getBuyOrSellName } from '@/common/constants/enumsName';
|
|
|
|
|
+import { BtnList, defineAsyncComponent, defineComponent, queryTableList } from '@/common/export/commonTable';
|
|
|
import { formatTime } from '@/common/methods';
|
|
import { formatTime } from '@/common/methods';
|
|
|
import { handleDeliveryRelation } from '@/common/setup/deliveryRelation';
|
|
import { handleDeliveryRelation } from '@/common/setup/deliveryRelation';
|
|
|
import { getRecordItemTab } from '@/common/setup/order/orderData';
|
|
import { getRecordItemTab } from '@/common/setup/order/orderData';
|
|
|
import { expandIcon } from '@/common/setup/table/clolumn';
|
|
import { expandIcon } from '@/common/setup/table/clolumn';
|
|
|
import { handleComposeOrderTable } from '@/common/setup/table/compose';
|
|
import { handleComposeOrderTable } from '@/common/setup/table/compose';
|
|
|
import { ComposeOrderTableParam } from '@/common/setup/table/interface';
|
|
import { ComposeOrderTableParam } from '@/common/setup/table/interface';
|
|
|
-import { handleSubcriteQuote } from '@/common/setup/table/tableQuote';
|
|
|
|
|
-import { findGoodsTradeModeById, getQuoteDayInfoByCodeFindPrice, getQutoGoodsByTradeMode } from '@/services/bus/goods';
|
|
|
|
|
-import { useHolderprice, useProfitloss } from '@/services/bus/holdPosition';
|
|
|
|
|
|
|
+import { handleNoneValue, handleSubcriteQuote } from '@/common/setup/table/tableQuote';
|
|
|
|
|
+import { getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
|
|
|
|
|
+import { useProfitloss, useHolderprice } from '@/services/bus/holdPosition';
|
|
|
import { queryTradePosition } from '@/services/go/ermcp/order';
|
|
import { queryTradePosition } from '@/services/go/ermcp/order';
|
|
|
import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
|
|
import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
|
|
|
-import { getBuyOrSellName, getChannelBuildName } from '@/common/constants/enumsName';
|
|
|
|
|
-import { isInvestment } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/setup';
|
|
|
|
|
-import { useIsDiaoQi, findGoodsCode } from './setup';
|
|
|
|
|
-// import { getSwapList } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/setup';
|
|
|
|
|
-import { ref } from 'vue';
|
|
|
|
|
import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
|
import Bus from '@/utils/eventBus/index';
|
|
import Bus from '@/utils/eventBus/index';
|
|
|
-import { tabColumns, getSwapList } from './setup';
|
|
|
|
|
-import { handleNoneValue } from '@/common/setup/table/tableQuote';
|
|
|
|
|
|
|
+import { isInvestment } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/setup';
|
|
|
|
|
+import { ref } from 'vue';
|
|
|
|
|
+import { findGoodsCode, getSwapList, getTableColums, useDetail } from './setup';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
- name: enumOrderComponents.commodity_contract_summary,
|
|
|
|
|
- components: {
|
|
|
|
|
- BtnList,
|
|
|
|
|
- [ModalEnum.commodity_contract_summary_settlement]: defineAsyncComponent(() => import('./components/commodity_contract_summary_settlement/index.vue')),
|
|
|
|
|
- [ModalEnum.commodity_contract_summary_transfer]: defineAsyncComponent(() => import('./components/commodity_contract_summary_transfer/index.vue')),
|
|
|
|
|
- commodity_contract_summary_deal_closed: defineAsyncComponent(() => import('./components/commodity_contract_summary_deal_closed/index.vue')),
|
|
|
|
|
- commodity_contract_summary_order_closed: defineAsyncComponent(() => import('./components/commodity_contract_summary_order_closed/index.vue')),
|
|
|
|
|
- },
|
|
|
|
|
- setup() {
|
|
|
|
|
- // 表格列表数据
|
|
|
|
|
- const { loading, tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
|
|
|
|
|
- const { subscribeAction } = handleSubcriteQuote();
|
|
|
|
|
- // 交割商品
|
|
|
|
|
- handleDeliveryRelation();
|
|
|
|
|
- const swapList = ref<QueryQuoteGoodsListRsp[]>([]);
|
|
|
|
|
- // 挂牌点选商品
|
|
|
|
|
- // const { deliverGoods, getQuoteList, goodsList, } = handleDeliveryRelation([1, 3]);
|
|
|
|
|
- // // 参考行情商品
|
|
|
|
|
- // const goodsList = getQutoGoodsByTradeMode(TradeMode.quote99);
|
|
|
|
|
|
|
+ name: enumOrderComponents.commodity_contract_summary,
|
|
|
|
|
+ components: {
|
|
|
|
|
+ BtnList,
|
|
|
|
|
+ swap_commodity_contract_summary_deal_closed: defineAsyncComponent(() => import('./components/swap_commodity_contract_summary_deal_closed/index.vue')), // 协议平仓
|
|
|
|
|
+ swap_commodity_contract_summary_order_closed: defineAsyncComponent(() => import('./components/swap_commodity_contract_summary_order_closed/index.vue')), // 平仓
|
|
|
|
|
+ },
|
|
|
|
|
+ setup() {
|
|
|
|
|
+ // 表格列表数据
|
|
|
|
|
+ const { loading, tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
|
|
|
|
|
+ const { subscribeAction } = handleSubcriteQuote();
|
|
|
|
|
+ // 交割商品
|
|
|
|
|
+ handleDeliveryRelation();
|
|
|
|
|
+ const swapList = ref<QueryQuoteGoodsListRsp[]>([]);
|
|
|
|
|
+
|
|
|
|
|
+ // 获取列表数据
|
|
|
|
|
+ const queryTableAction = () => {
|
|
|
|
|
+ Promise.all([queryTable(queryTradePosition, TradeMode.DiaoQi.toString()), getSwapList()]).then((res) => {
|
|
|
|
|
+ swapList.value = res[1];
|
|
|
|
|
+ tableList.value = res[0];
|
|
|
|
|
+ const goodsSet = new Set<string>();
|
|
|
|
|
+ res[0].forEach((el) => {
|
|
|
|
|
+ // 商品掉期取参考行情最新价,挂牌点选取自己行情的最新价
|
|
|
|
|
+ const goodscode = findGoodsCode(el.goodsid, el.goodscode, swapList.value);
|
|
|
|
|
+ if (goodscode) {
|
|
|
|
|
+ goodsSet.add(goodscode);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // 行情订阅
|
|
|
|
|
+ subscribeAction([...goodsSet]);
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+ Bus.$on('spotTrade', queryTableAction);
|
|
|
|
|
+ // 明细 逻辑
|
|
|
|
|
+ const { getTradeHolderDetail, detailLoading, getDetailColums, detailTableList, getDetailProfitloss, getDetailMarketAmount } = useDetail();
|
|
|
|
|
+ // 表格通用逻辑
|
|
|
|
|
+ const param: ComposeOrderTableParam = {
|
|
|
|
|
+ queryFn: queryTableAction,
|
|
|
|
|
+ tableName: 'table_pcweb_spot_trade_bottom_commodity_contract_summary',
|
|
|
|
|
+ recordList: getRecordItemTab(),
|
|
|
|
|
+ clickCB: getTradeHolderDetail,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 现价
|
|
|
|
|
+ function getLastprice(record: QueryTradePositionRsp) {
|
|
|
|
|
+ let result: number | string = '--';
|
|
|
|
|
+ const goodscode = findGoodsCode(record.goodsid, record.goodscode, swapList.value);
|
|
|
|
|
+ if (goodscode) {
|
|
|
|
|
+ result = getQuoteDayInfoByCodeFindPrice(goodscode);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 获取列表数据
|
|
|
|
|
- const queryTableAction = () => {
|
|
|
|
|
- Promise.all([queryTable(queryTradePosition), getSwapList()]).then((res) => {
|
|
|
|
|
- swapList.value = res[1];
|
|
|
|
|
- tableList.value = res[0];
|
|
|
|
|
- const goodsSet = new Set<string>();
|
|
|
|
|
- res[0].forEach((el) => {
|
|
|
|
|
- // 商品掉期取参考行情最新价,挂牌点选取自己行情的最新价
|
|
|
|
|
- const goodscode = findGoodsCode(el.goodsid, el.goodscode, swapList.value);
|
|
|
|
|
- if (goodscode) {
|
|
|
|
|
- goodsSet.add(goodscode);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- // 行情订阅
|
|
|
|
|
- subscribeAction([...goodsSet]);
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
- Bus.$on('spotTrade', queryTableAction);
|
|
|
|
|
- // 表格通用逻辑
|
|
|
|
|
- const param: ComposeOrderTableParam = {
|
|
|
|
|
- queryFn: queryTableAction,
|
|
|
|
|
- tableName: 'table_pcweb_spot_trade_bottom_commodity_contract_summary',
|
|
|
|
|
- recordList: getRecordItemTab(),
|
|
|
|
|
- };
|
|
|
|
|
- // 现价
|
|
|
|
|
- function getLastprice(record: QueryTradePositionRsp) {
|
|
|
|
|
- let result: number | string = '--';
|
|
|
|
|
- const goodscode = findGoodsCode(record.goodsid, record.goodscode, swapList.value);
|
|
|
|
|
- if (goodscode) {
|
|
|
|
|
- result = getQuoteDayInfoByCodeFindPrice(goodscode);
|
|
|
|
|
- }
|
|
|
|
|
- return result;
|
|
|
|
|
- }
|
|
|
|
|
- function isDiaoQi(record: QueryTradePositionRsp) {
|
|
|
|
|
- return findGoodsTradeModeById(record.goodsid) === TradeMode.DiaoQi;
|
|
|
|
|
- }
|
|
|
|
|
- function handleBtnList(record: QueryTradePositionRsp, btnList: BtnListType[]) {
|
|
|
|
|
- // 挂牌点选
|
|
|
|
|
- const listing = ['commodity_contract_summary_transfer', 'commodity_contract_summary_settlement'];
|
|
|
|
|
- // 贸易圈
|
|
|
|
|
- // 只有机构 才有平仓
|
|
|
|
|
- const diaoqi = isInvestment() ? ['commodity_contract_summary_deal_closed', 'commodity_contract_summary_order_closed'] : ['commodity_contract_summary_deal_closed'];
|
|
|
|
|
- const arr = isDiaoQi(record) ? diaoqi : listing;
|
|
|
|
|
- return btnList.filter((e) => arr.includes(e.code));
|
|
|
|
|
- }
|
|
|
|
|
- return {
|
|
|
|
|
- ...handleComposeOrderTable<QueryTradePositionRsp>(param),
|
|
|
|
|
- loading,
|
|
|
|
|
- tableList,
|
|
|
|
|
- formatTime,
|
|
|
|
|
- expandIcon,
|
|
|
|
|
- getLastprice,
|
|
|
|
|
- useHolderprice,
|
|
|
|
|
- useProfitloss,
|
|
|
|
|
- handleBtnList,
|
|
|
|
|
- tabColumns,
|
|
|
|
|
- getBuyOrSellName,
|
|
|
|
|
- swapList,
|
|
|
|
|
- findGoodsCode,
|
|
|
|
|
- isDiaoQi,
|
|
|
|
|
- handleNoneValue,
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ function handleBtnList(record: QueryTradePositionRsp, btnList: BtnListType[]) {
|
|
|
|
|
+ // 贸易圈
|
|
|
|
|
+ // 只有机构 才有平仓
|
|
|
|
|
+ const diaoqi = isInvestment() ? ['swap_commodity_contract_summary_deal_closed', 'swap_commodity_contract_summary_order_closed'] : ['swap_commodity_contract_summary_deal_closed'];
|
|
|
|
|
+ return btnList.filter((e) => diaoqi.includes(e.code));
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...handleComposeOrderTable<QueryTradePositionRsp>(param),
|
|
|
|
|
+ loading,
|
|
|
|
|
+ tableList,
|
|
|
|
|
+ formatTime,
|
|
|
|
|
+ expandIcon,
|
|
|
|
|
+ getLastprice,
|
|
|
|
|
+ useProfitloss,
|
|
|
|
|
+ useHolderprice,
|
|
|
|
|
+ handleBtnList,
|
|
|
|
|
+ getTableColums,
|
|
|
|
|
+ getBuyOrSellName,
|
|
|
|
|
+ swapList,
|
|
|
|
|
+ handleNoneValue,
|
|
|
|
|
+ detailLoading,
|
|
|
|
|
+ getDetailColums,
|
|
|
|
|
+ detailTableList,
|
|
|
|
|
+ getDetailProfitloss, getDetailMarketAmount
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|