huangbin пре 4 година
родитељ
комит
1c0a755cde

+ 2 - 2
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!--订单交易 挂牌转让-->
+  <!--订单交易 商品掉期-->
   <div class="topTableHeight">
     <div class="filterTable">
       <div class="filter-custom-table">
@@ -115,7 +115,7 @@ export default defineComponent({
         let stopSubcribe = handleSubcriteOnDemandQuote<RefGoodsList>(goodsList);
         // 过滤标的合约
         function goodsChange(value: string) {
-            const goodsList = filterGoodsList(value);
+            filterGoodsList(value);
             // 停止上次订阅
             stopSubcribe();
             // 重新发起订阅

+ 6 - 4
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/setup.ts

@@ -11,6 +11,7 @@ import { ref } from "vue"
 import { RefGoodsList } from './interface'
 
 const refGoods = ref<QueryQuoteGoodsListRsp[]>([])
+const allGoodsList = ref<RefGoodsList[]>([])
 
 export function findItemGoods(goodscode: string) {
     return refGoods.value.find(el => el.goodscode === goodscode)!
@@ -33,6 +34,7 @@ export const useSwapList = () => {
         queryTable(queryQuoteGoodsList, param).then(res => {
             refGoods.value = res
             goodsList.value.length = 0
+            allGoodsList.value.length = 0
             res.forEach(el => {
                 // 找到盘面数据
                 const quote = getQuoteDayInfoByCode(el.goodscode);
@@ -42,8 +44,10 @@ export const useSwapList = () => {
                         goodsname: el.goodsname, refgoodsname: el.refgoodsname
                     }
                     goodsList.value.push(result)
+                    allGoodsList.value.push(result)
                 }
             })
+            console.log(goodsList.value)
         })
     })
     // 获取标记商品列表
@@ -56,13 +60,11 @@ export const useSwapList = () => {
     }
     // 过滤标的合约
     function filterGoodsList(value: string) {
-        const result = ref<RefGoodsList[]>([])
         if (value === '全部标的合约') {
-            result.value = goodsList.value
+            goodsList.value = allGoodsList.value
         } else {
-            result.value = goodsList.value.filter(goods => goods.refgoodsname === value)
+            goodsList.value = allGoodsList.value.filter(goods => goods.refgoodsname === value)
         }
-        return result
     }
 
     return { loading, goodsList, getRefGoodsList, filterGoodsList }