huangbin 4 gadi atpakaļ
vecāks
revīzija
60ce277553

+ 14 - 1
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_floating_price/index.vue

@@ -28,6 +28,10 @@ import { queryTableList, BtnList, contextMenu, defineAsyncComponent, defineCompo
 import { QueryOrderQuoteReq, WrOrderQuote } from '@/services/go/wrtrade/interface';
 import { queryOrderQuote } from '@/services/go/wrtrade';
 import { handleComposeTable } from '@/views/market/spot_trade/setup';
+import { subscribeInfoType } from '@/services/socket/quota/interface';
+import { v4 as uuidv4 } from 'uuid';
+import { addSubscribeQuotation } from '@/services/socket/quota';
+import { onMounted } from 'vue';
 
 export default defineComponent({
     name: EnumRouterName.warehouse_receipt_trade_floating_price,
@@ -40,14 +44,23 @@ export default defineComponent({
     setup() {
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuote>();
+        let uuid = uuidv4();
         // 获取列表数据
         const queryTableAction = () => {
             const param: QueryOrderQuoteReq = {
                 wrpricetype: 2,
                 haswr: 1,
             };
-            queryTable(queryOrderQuote, param);
+            queryTable(queryOrderQuote, param).then((res) => {
+                uuid = uuidv4();
+                // 订阅行情
+                const list: subscribeInfoType[] = res.map((el) => {
+                    return { exchangeCode: 250, goodsCode: el.goodscode, subState: 0 };
+                });
+                addSubscribeQuotation(uuid, list);
+            });
         };
+        onMounted(() => {});
         // 表格通用逻辑
         const param: ComposeTableParam = {
             queryFn: queryTableAction,

+ 1 - 1
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/index.vue

@@ -174,7 +174,7 @@ export default defineComponent({
         const { rules, formState, formRef } = handlePasswordForm(props.selectedRow);
         const data = props.selectedRow;
         const loading = ref<boolean>(false);
-        const { goodsGroup, goodsList, groupsChange } = handleGoods();
+        const { goodsGroup, goodsList, groupsChange, findGoodsCode } = handleGoods();
         function submit() {
             const marketInfo = getMarketRunByTradeMode(17);
             if (marketInfo) {

+ 4 - 1
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/setup.ts

@@ -42,5 +42,8 @@ export function handleGoods() {
     function groupsChange(id: number) {
         goodsList.value = allGoods.filter(e => e.goodsgroupid === id)
     }
-    return { goodsGroup, goodsList, groupsChange }
+    function findGoodsCode(id: number) {
+        return allGoods.find(e => e.goodsid === id)?.goodscode
+    }
+    return { goodsGroup, goodsList, groupsChange, findGoodsCode }
 }