|
@@ -1,55 +1,58 @@
|
|
|
<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="(record,index)=>index" :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>{{ text ? text : 0 }}</a>
|
|
|
|
|
- </template>
|
|
|
|
|
- <!-- 持仓金额 -->
|
|
|
|
|
- <!-- <template #holderprice="{ record }">
|
|
|
|
|
|
|
+ <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="buttons.length" #expandedRowRender="{ record }">
|
|
|
|
|
+ <BtnList :btnList="handleBtnList(record,buttons)" :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>{{ text ? text : 0 }}</a>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 持仓金额 -->
|
|
|
|
|
+ <!-- <template #holderprice="{ record }">
|
|
|
<a>{{ useHolderprice(record) }}</a>
|
|
<a>{{ useHolderprice(record) }}</a>
|
|
|
</template> -->
|
|
</template> -->
|
|
|
- <!-- 持仓盈亏 -->
|
|
|
|
|
- <template #profitloss="{ record }">
|
|
|
|
|
- <span>{{ record.averageprice ? useProfitloss(record) : '--' }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #buyorsell="{ record }">
|
|
|
|
|
- <span>{{ getBuyOrSellName(record.buyorsell) }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </a-table>
|
|
|
|
|
- <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" :tableList="tableList" @cancel="closeComponent"></component>
|
|
|
|
|
- </section>
|
|
|
|
|
|
|
+ <!-- 持仓盈亏 -->
|
|
|
|
|
+ <template #profitloss="{ record }">
|
|
|
|
|
+ <span>{{ record.averageprice ? useProfitloss(record) : '--' }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #buyorsell="{ record }">
|
|
|
|
|
+ <span>{{ getBuyOrSellName(record.buyorsell) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </mtp-table-scroll>
|
|
|
|
|
+ <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" :tableList="tableList" @cancel="closeComponent"></component>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
|
|
+import { PropType } from 'vue';
|
|
|
|
|
+import { DynamicComponent } from '@/@next/hooks/common/interface'
|
|
|
|
|
+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 { BtnList, defineAsyncComponent, defineComponent, ModalEnum, queryTableList } from '@/common/export/commonTable';
|
|
|
|
|
|
|
+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 { 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 { 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';
|
|
|
|
|
|
|
|
const tabColumns = [
|
|
const tabColumns = [
|
|
|
{
|
|
{
|
|
@@ -165,18 +168,26 @@ const tabColumns = [
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
- name: enumOrderComponents.commodity_contract_summary,
|
|
|
|
|
|
|
+ props: {
|
|
|
|
|
+ parentComponent: {
|
|
|
|
|
+ type: Object as PropType<DynamicComponent>,
|
|
|
|
|
+ required: true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
components: {
|
|
components: {
|
|
|
BtnList,
|
|
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')),
|
|
|
|
|
|
|
+ MtpTableScroll,
|
|
|
|
|
+ settlement: defineAsyncComponent(() => import('./components/commodity_contract_summary_settlement/index.vue')), // 交收
|
|
|
|
|
+ transfer: defineAsyncComponent(() => import('./components/commodity_contract_summary_transfer/index.vue')), // 转让
|
|
|
|
|
+ deal_closed: defineAsyncComponent(() => import('./components/commodity_contract_summary_deal_closed/index.vue')), // 协议平仓
|
|
|
|
|
+ order_closed: defineAsyncComponent(() => import('./components/commodity_contract_summary_order_closed/index.vue')), // 平仓
|
|
|
},
|
|
},
|
|
|
- setup() {
|
|
|
|
|
|
|
+ setup(props) {
|
|
|
|
|
+ const { buttons } = props.parentComponent;
|
|
|
// 表格列表数据
|
|
// 表格列表数据
|
|
|
const { loading, tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
|
|
const { loading, tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
|
|
|
const { subscribeAction } = handleSubcriteQuote();
|
|
const { subscribeAction } = handleSubcriteQuote();
|
|
|
|
|
+
|
|
|
// 交割商品
|
|
// 交割商品
|
|
|
handleDeliveryRelation();
|
|
handleDeliveryRelation();
|
|
|
|
|
|
|
@@ -184,6 +195,7 @@ export default defineComponent({
|
|
|
// const { deliverGoods, getQuoteList, goodsList, } = handleDeliveryRelation([1, 3]);
|
|
// const { deliverGoods, getQuoteList, goodsList, } = handleDeliveryRelation([1, 3]);
|
|
|
// // 参考行情商品
|
|
// // 参考行情商品
|
|
|
// const goodsList = getQutoGoodsByTradeMode(TradeMode.quote99);
|
|
// const goodsList = getQutoGoodsByTradeMode(TradeMode.quote99);
|
|
|
|
|
+
|
|
|
// 获取列表数据
|
|
// 获取列表数据
|
|
|
const queryTableAction = () => {
|
|
const queryTableAction = () => {
|
|
|
queryTable(queryTradePosition).then((res) => {
|
|
queryTable(queryTradePosition).then((res) => {
|
|
@@ -195,13 +207,14 @@ export default defineComponent({
|
|
|
// 行情订阅
|
|
// 行情订阅
|
|
|
subscribeAction(goodsList);
|
|
subscribeAction(goodsList);
|
|
|
});
|
|
});
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 表格通用逻辑
|
|
// 表格通用逻辑
|
|
|
const param: ComposeOrderTableParam = {
|
|
const param: ComposeOrderTableParam = {
|
|
|
queryFn: queryTableAction,
|
|
queryFn: queryTableAction,
|
|
|
tableName: 'table_pcweb_spot_trade_bottom_commodity_contract_summary',
|
|
tableName: 'table_pcweb_spot_trade_bottom_commodity_contract_summary',
|
|
|
- recordList: getRecordItemTab(),
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 现价
|
|
// 现价
|
|
|
function getLastprice({ goodscode, decimalplace }: QueryTradePositionRsp) {
|
|
function getLastprice({ goodscode, decimalplace }: QueryTradePositionRsp) {
|
|
|
const lastPrice = getQuoteDayInfoByCodeFindPrice(goodscode);
|
|
const lastPrice = getQuoteDayInfoByCodeFindPrice(goodscode);
|
|
@@ -210,16 +223,18 @@ export default defineComponent({
|
|
|
|
|
|
|
|
function handleBtnList(record: QueryTradePositionRsp, btnList: BtnListType[]) {
|
|
function handleBtnList(record: QueryTradePositionRsp, btnList: BtnListType[]) {
|
|
|
// 挂牌点选
|
|
// 挂牌点选
|
|
|
- const listing = ['commodity_contract_summary_transfer', 'commodity_contract_summary_settlement'];
|
|
|
|
|
|
|
+ const listing = ['transfer', 'settlement'];
|
|
|
// 贸易圈
|
|
// 贸易圈
|
|
|
- const diaoqi = ['commodity_contract_summary_deal_closed', 'commodity_contract_summary_order_closed'];
|
|
|
|
|
|
|
+ const diaoqi = ['deal_closed', 'order_closed'];
|
|
|
const arr = findGoodsTradeModeById(record.goodsid) === TradeMode.DiaoQi ? diaoqi : listing;
|
|
const arr = findGoodsTradeModeById(record.goodsid) === TradeMode.DiaoQi ? diaoqi : listing;
|
|
|
return btnList.filter((e) => arr.includes(e.code));
|
|
return btnList.filter((e) => arr.includes(e.code));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return {
|
|
return {
|
|
|
...handleComposeOrderTable<QueryTradePositionRsp>(param),
|
|
...handleComposeOrderTable<QueryTradePositionRsp>(param),
|
|
|
loading,
|
|
loading,
|
|
|
tableList,
|
|
tableList,
|
|
|
|
|
+ buttons,
|
|
|
formatTime,
|
|
formatTime,
|
|
|
expandIcon,
|
|
expandIcon,
|
|
|
getLastprice,
|
|
getLastprice,
|
|
@@ -228,7 +243,7 @@ export default defineComponent({
|
|
|
handleBtnList,
|
|
handleBtnList,
|
|
|
tabColumns,
|
|
tabColumns,
|
|
|
getBuyOrSellName,
|
|
getBuyOrSellName,
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
-});
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|