huangbin 4 éve
szülő
commit
0c0932d66b

+ 6 - 0
src/views/market/spot_trade/components/filter/index.vue

@@ -32,6 +32,7 @@
                 v-if="isFloat()"
                 :style="{width: '180px', maxHeight: '400px', overflow: 'auto' }"
                 @change="goodsChange"
+                v-model:value="goodsid"
                 placeholder="全部期货合约">
         <a-select-option v-for="item in goodsList"
                          :value="item.goodsid"
@@ -121,18 +122,22 @@ export default defineComponent({
         const uuid = v4();
         // 切换商品
         function goodsChange(id: number) {
+            console.log('id', id);
             //行情订阅
             removeSubscribeQuotation(uuid);
             const goods = goodsList.value.find((e) => e.goodsid === id);
             selectedGoods.value = goods;
             const arr = [{ exchangeCode: 250, goodsCode: goods!.goodscode, subState: 0 }];
             addSubscribeQuotation(uuid, arr);
+            context.emit('filterGoods', id);
         }
         onMounted(() => {
             removeSubscribeQuotation(uuid);
         });
         // 交收月
         const time = ref<Moment>(); // string 交收月
+        // 期货合约
+        const goodsid = ref<number | undefined>(undefined);
         function search(isQuery: boolean) {
             const result: any = {};
             if (selectedFT.value) {
@@ -225,6 +230,7 @@ export default defineComponent({
             goodsChange,
             isWR,
             isFloat,
+            goodsid,
         };
     },
 });

+ 10 - 1
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_floating_price/index.vue

@@ -3,6 +3,7 @@
   <div class="topTableHeight">
     <Filter :enumName="name"
             @buy="buyOpen"
+            @filterGoods="filterGoods"
             @search="search" />
     <a-table :columns="columns"
              :class="['srcollYTable', isBottom ? 'condSecondTabTable' : 'condSecondTabTableNoBottom', tableList.length ? 'noPlaceHolder' : 'hasPlaceHolder']"
@@ -51,13 +52,16 @@ export default defineComponent({
         const isBottom = getShowBottomValue();
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuote>();
+        const cacheList = ref<WrOrderQuote[]>([]);
         // 获取列表数据
         const queryTableAction = () => {
             const param: QueryOrderQuoteReq = {
                 wrpricetype: 2,
                 haswr: 0,
             };
-            queryTable(queryOrderQuote, param);
+            queryTable(queryOrderQuote, param).then((res) => {
+                cacheList.value = res;
+            });
         };
         Bus.$on('spotTrade', queryTableAction);
         // 表格通用逻辑
@@ -90,6 +94,10 @@ export default defineComponent({
             Object.assign(param, value);
             queryTable(queryOrderQuote, param);
         }
+        // 过滤期货合约商品
+        function filterGoods(id: number) {
+            tableList.value = cacheList.value.filter((el) => el.goodsid === id);
+        }
         function buyOpen(value: any, goods: Goods) {
             componentId.value = 'postBuying';
             value.goodsid = goods.goodsid;
@@ -115,6 +123,7 @@ export default defineComponent({
             tableList,
             search,
             buyOpen,
+            filterGoods,
         };
     },
 });

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

@@ -3,6 +3,7 @@
   <div class="topTableHeight">
     <Filter :enumName="name"
             @search="search"
+            @filterGoods="filterGoods"
             @buy="buyOpen" />
     <a-table :columns="columns"
              :class="['srcollYTable', isBottom ? 'condSecondTabTable' : 'condSecondTabTableNoBottom', tableList.length ? 'noPlaceHolder' : 'hasPlaceHolder']"
@@ -35,6 +36,7 @@ import Filter from '../../components/filter/index.vue';
 import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
 import { getShowBottomValue } from '@/common/config/constrolBottom';
 import Bus from '@/utils/eventBus/index';
+import { ref } from 'vue';
 
 export default defineComponent({
     name: EnumRouterName.warehouse_receipt_trade_floating_price,
@@ -50,13 +52,16 @@ export default defineComponent({
         const isBottom = getShowBottomValue();
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuote>();
+        const cacheList = ref<WrOrderQuote[]>([]);
         // 获取列表数据
         const queryTableAction = () => {
             const param: QueryOrderQuoteReq = {
                 wrpricetype: 2,
                 haswr: 1,
             };
-            queryTable(queryOrderQuote, param);
+            queryTable(queryOrderQuote, param).then((res) => {
+                cacheList.value = res;
+            });
         };
         Bus.$on('spotTrade', queryTableAction);
         // 表格通用逻辑
@@ -82,6 +87,7 @@ export default defineComponent({
             firstBtn, // 表格按钮
         } = handleComposeTable<WrOrderQuote>(param);
         function search(value: Object) {
+            console.log('value', value);
             const param: QueryOrderQuoteReq = {
                 wrpricetype: 2,
                 haswr: 1,
@@ -89,6 +95,10 @@ export default defineComponent({
             Object.assign(param, value);
             queryTable(queryOrderQuote, param);
         }
+        // 过滤期货合约商品
+        function filterGoods(id: number) {
+            tableList.value = cacheList.value.filter((el) => el.goodsid === id);
+        }
         function buyOpen(value: any, goods: Goods) {
             componentId.value = 'postBuying';
             value.goodsid = goods.goodsid;
@@ -114,6 +124,7 @@ export default defineComponent({
             tableList,
             search,
             buyOpen,
+            filterGoods,
         };
     },
 });