|
@@ -1,57 +1,41 @@
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 商品订单 - 合约汇总 -->
|
|
<!-- 商品订单 - 合约汇总 -->
|
|
|
- <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">
|
|
|
|
|
- <!-- 额外的展开行 -->
|
|
|
|
|
- <template v-if="btnList.length"
|
|
|
|
|
- #expandedRowRender="{ record }">
|
|
|
|
|
- <BtnList :btnList="handleBtnList(record,btnList)"
|
|
|
|
|
- :record="record"
|
|
|
|
|
- class="btn-list-sticky"
|
|
|
|
|
- @click="openComponent" />
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #createtime="{ record }">
|
|
|
|
|
- <a>{{ formatTime(record.createtime) }}</a>
|
|
|
|
|
- </template>
|
|
|
|
|
- <!-- 现价 -->
|
|
|
|
|
- <template #lastprice="{ record }">
|
|
|
|
|
- <a>{{ getLastprice(record) }}</a>
|
|
|
|
|
- </template>
|
|
|
|
|
- <!-- 均价 -->
|
|
|
|
|
- <template #averageprice="{ text }">
|
|
|
|
|
- <a>{{ handleNoneValue(text)}}</a>
|
|
|
|
|
- </template>
|
|
|
|
|
- <!-- 持仓盈亏 -->
|
|
|
|
|
- <template #profitloss="{ record }">
|
|
|
|
|
- <span>{{ record.averageprice ? useProfitloss(record) : '--' }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #buyorsell="{ record }">
|
|
|
|
|
- <span>{{ getBuyOrSellName(record.buyorsell) }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #marketamount="{ record, text }">
|
|
|
|
|
- <span>{{ isDiaoQi(record) ? '--' : text }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </a-table>
|
|
|
|
|
- <component :is="componentId"
|
|
|
|
|
- v-if="componentId"
|
|
|
|
|
- :selectedRow="selectedRow"
|
|
|
|
|
- :tableList="tableList"
|
|
|
|
|
- :swapList="swapList"
|
|
|
|
|
- @cancel="closeComponent"></component>
|
|
|
|
|
- </section>
|
|
|
|
|
|
|
+ <mtp-table-scroll>
|
|
|
|
|
+ <template #default="{ scroll }">
|
|
|
|
|
+ <a-table :columns="tabColumns" class="srcollYTable" :scroll="scroll" :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>
|
|
|
|
|
+ <template #createtime="{ record }">
|
|
|
|
|
+ <a>{{ formatTime(record.createtime) }}</a>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 现价 -->
|
|
|
|
|
+ <template #lastprice="{ record }">
|
|
|
|
|
+ <a>{{ getLastprice(record) }}</a>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 均价 -->
|
|
|
|
|
+ <template #averageprice="{ text }">
|
|
|
|
|
+ <a>{{ handleNoneValue(text)}}</a>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 持仓盈亏 -->
|
|
|
|
|
+ <template #profitloss="{ record }">
|
|
|
|
|
+ <span>{{ record.averageprice ? useProfitloss(record) : '--' }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #buyorsell="{ record }">
|
|
|
|
|
+ <span>{{ getBuyOrSellName(record.buyorsell) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #marketamount="{ record, text }">
|
|
|
|
|
+ <span>{{ isDiaoQi(record) ? '--' : text }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </mtp-table-scroll>
|
|
|
|
|
+ <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" :tableList="tableList" :swapList="swapList" @cancel="closeComponent"></component>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
|
|
+import MtpTableScroll from '@/common/components/tableScroll/index.vue';
|
|
|
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';
|
|
@@ -63,13 +47,13 @@ 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 { handleSubcriteQuote } from '@/common/setup/table/tableQuote';
|
|
|
-import { findGoodsTradeModeById, getQuoteDayInfoByCodeFindPrice, getQutoGoodsByTradeMode } from '@/services/bus/goods';
|
|
|
|
|
|
|
+import { findGoodsTradeModeById, getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
|
|
|
import { useHolderprice, useProfitloss } from '@/services/bus/holdPosition';
|
|
import { useHolderprice, useProfitloss } 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 { getBuyOrSellName } from '@/common/constants/enumsName';
|
|
|
import { isInvestment } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/setup';
|
|
import { isInvestment } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/setup';
|
|
|
-import { useIsDiaoQi, findGoodsCode } from './setup';
|
|
|
|
|
|
|
+import { findGoodsCode } from './setup';
|
|
|
// import { getSwapList } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/setup';
|
|
// import { getSwapList } from '@/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/setup';
|
|
|
import { ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
|
import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
@@ -78,89 +62,90 @@ import { tabColumns, getSwapList } from './setup';
|
|
|
import { handleNoneValue } from '@/common/setup/table/tableQuote';
|
|
import { handleNoneValue } from '@/common/setup/table/tableQuote';
|
|
|
|
|
|
|
|
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: {
|
|
|
|
|
+ MtpTableScroll,
|
|
|
|
|
+ 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);
|
|
|
|
|
|
|
|
- // 获取列表数据
|
|
|
|
|
- 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,
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // 获取列表数据
|
|
|
|
|
+ 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,
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|