huangbin 4 năm trước cách đây
mục cha
commit
c0edd33e3a

+ 34 - 5
src/views/order/swap_the_order/components/swap_commodity_contract_summary/index.vue

@@ -37,7 +37,9 @@
           </template>
           <!-- 持仓盈亏 -->
           <template #profitloss="{ record }">
-            <span :class="handleQuotePriceColor(+getDetailProfitloss(record), 0)">{{ getDetailProfitloss(record) }}</span>
+            <span
+              :class="handleQuotePriceColor(+getDetailProfitloss(record), 0)"
+            >{{ getDetailProfitloss(record) }}</span>
           </template>
           <!-- 市值 -->
           <template #marketamount="{ record }">
@@ -76,7 +78,7 @@
       :selectedRow="selectedRow"
       :tableList="tableList"
       :swapList="swapList"
-      @cancel="closeComponent"
+      @cancel="clsoeAction"
     ></component>
   </section>
 </template>
@@ -137,7 +139,7 @@ export default defineComponent({
         subscribeAction([...goodsSet]);
       });
     };
-    Bus.$on('spotTrade', queryTableAction);
+
     // 明细 逻辑
     const { getTradeHolderDetail, detailLoading, getDetailColums, detailTableList, getDetailProfitloss, getDetailMarketAmount } = useDetail();
     // 表格通用逻辑
@@ -164,8 +166,35 @@ export default defineComponent({
       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));
     }
+    const {
+      contextMenu, openContext, closeContext, // 右键
+      columns, registerColumn, updateColumn,  // 表头
+      expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
+      componentId, closeComponent, openComponent,  // 控制异步组件
+      btnList, // 表格按钮
+    } = handleComposeOrderTable<QueryTradePositionRsp>(param)
+    function clsoeAction(value: boolean) {
+      closeComponent(value)
+      if (value) {
+        if (selectedRow.value) {
+          getTradeHolderDetail(selectedRow.value!)
+
+        }
+      }
+    }
+    Bus.$on('spotTrade', () => {
+      queryTableAction()
+      if (selectedRow.value) {
+        getTradeHolderDetail(selectedRow.value!)
+
+      }
+    });
     return {
-      ...handleComposeOrderTable<QueryTradePositionRsp>(param),
+      contextMenu, openContext, closeContext, // 右键
+      columns, registerColumn, updateColumn,  // 表头
+      expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
+      componentId, closeComponent, openComponent,  // 控制异步组件
+      btnList, // 表格按钮
       loading,
       tableList,
       formatTime,
@@ -181,7 +210,7 @@ export default defineComponent({
       detailLoading,
       getDetailColums,
       detailTableList,
-      getDetailProfitloss, getDetailMarketAmount,handleQuotePriceColor
+      getDetailProfitloss, getDetailMarketAmount, handleQuotePriceColor, clsoeAction
     };
   },
 });