Ver código fonte

Merge remote-tracking branch 'origin/master'

yu jie 4 anos atrás
pai
commit
5fafb75eb2

+ 9 - 7
src/utils/eventBus/index.ts

@@ -1,15 +1,17 @@
 /** 一个事件能存储多个回调 */
-interface enentNames {
+interface EnentNames {
     loadComplete: string; //加载状态名
+    spotTrade: string;  // 挂牌成功,通知报价大厅更新数据
 }
 
 /** 一个事件只能存储一个回调 */
-interface enentNames_onlyOneValue {
+interface EnentNamesOnlyOneValue {
     logout: string; //登出名:确认登出时不能进行其它操作了 暂时1s登出状态
     loginSuccess: string; // 登录成功
     loadAddressList: string; //加载地址列表
     loadMylieList: string; //加载闲置列表
 
+
     custOfflineNtf: string; //接收到账户离线通知
     userLogout: string; //接收到用户登出应答
     posChangedNtf: string; //接收到头寸变化通知
@@ -24,19 +26,19 @@ export default new (class Bus {
     private subscribe: { [key: string]: Array<Function> } = {};
 
     /** 注册事件(一个事件可以存储多个回调) */
-    $on(enentType: keyof enentNames, hander: Function): void {
+    $on(enentType: keyof EnentNames, hander: Function): void {
         this.subscribe[enentType] = this.subscribe[enentType] || [];
         this.subscribe[enentType].push(hander);
     }
 
     /** 注册事件(一个事件只能存储一个回调) */
-    $onOnly(enentType: keyof enentNames_onlyOneValue, hander: Function): void {
+    $onOnly(enentType: keyof EnentNamesOnlyOneValue, hander: Function): void {
         this.subscribe[enentType] = [];
         this.subscribe[enentType].push(hander);
     }
 
     /** 发布事件 立即执行*/
-    $emit(enentType: keyof enentNames | keyof enentNames_onlyOneValue, data?: any): void {
+    $emit(enentType: keyof EnentNames | keyof EnentNamesOnlyOneValue, data?: any): void {
         const sub = this.subscribe[enentType];
         if (sub) {
             sub.forEach((hander: Function) => hander(data));
@@ -44,7 +46,7 @@ export default new (class Bus {
     }
 
     // 取消部分订阅
-    $off(enentType: keyof enentNames | keyof enentNames_onlyOneValue, hander: Function): void {
+    $off(enentType: keyof EnentNames | keyof EnentNamesOnlyOneValue, hander: Function): void {
         const sub = this.subscribe[enentType];
         if (sub) {
             const findIndex = sub.findIndex((fn) => fn === hander);
@@ -53,7 +55,7 @@ export default new (class Bus {
     }
 
     // 取消所有订阅
-    $offall(enentType: keyof enentNames): void {
+    $offall(enentType: keyof EnentNames): void {
         const sub = this.subscribe[enentType];
         if (sub) {
             delete this.subscribe[enentType];

+ 1 - 0
src/views/market/spot_trade/components/buy-sell-market/components/buy/index.vue

@@ -81,6 +81,7 @@ export default defineComponent({
         };
         return {
             ...handleComposeTable<WrOrderQuoteDetail>(param),
+            queryTableAction,
             BuyOrSell,
             loading,
             tableList,

+ 1 - 0
src/views/market/spot_trade/components/buy-sell-market/components/sell/index.vue

@@ -83,6 +83,7 @@ export default defineComponent({
         };
         return {
             ...handleComposeTable<WrOrderQuoteDetail>(param),
+            queryTableAction,
             loading,
             tableList,
             BuyOrSell,

+ 16 - 2
src/views/market/spot_trade/components/buy-sell-market/index.vue

@@ -54,12 +54,14 @@
       <a-col :span="12"
              v-if="buyMarket.isMarket">
         <Buy :enumName="enumName"
+             ref="buy"
              :parantSelectedRow="selectedRow"
              :btnList="buyMarket.btnList" />
       </a-col>
       <a-col :span="12"
              v-if="sellMarket.isMarket">
         <Sell :enumName="enumName"
+              ref="sellRef"
               :parantSelectedRow="selectedRow"
               :btnList="sellMarket.btnList" />
       </a-col>
@@ -87,6 +89,7 @@ import { handleModalComponent } from '@/common/setup/asyncComponent';
 import { PropType, ref } from 'vue';
 import { handleSpotBtnList } from '../../setup';
 import { addSubscribeQuotation } from '@/services/socket/quota';
+import Bus from '@/utils/eventBus/index';
 
 export default defineComponent({
     emits: ['cancel'],
@@ -116,9 +119,20 @@ export default defineComponent({
         // 买卖大厅 配置数据
         // 表格操作按钮列表
         const { firstBtn, buyMarket, sellMarket } = handleSpotBtnList(props.enumName);
-        function init() {}
-        const { componentId, closeComponent, openComponent } = handleModalComponent(init, ref({}));
+        const buyRef = ref<null | { queryTableAction: Function }>(null);
+        const sellRef = ref<null | { queryTableAction: Function }>(null);
+        function loadBuyData() {
+            buyRef.value?.queryTableAction();
+        }
+        function loadSellData() {
+            sellRef.value?.queryTableAction();
+        }
+
+        const { componentId, closeComponent, openComponent } = handleModalComponent(loadBuyData, ref({}));
+        Bus.$on('spotTrade', loadSellData);
         return {
+            buyRef,
+            sellRef,
             cancel,
             visible,
             firstBtn,

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

@@ -51,16 +51,8 @@ export default defineComponent({
                 wrpricetype: 2,
                 haswr: 1,
             };
-            queryTable(queryOrderQuote, param).then((res) => {
-                uuid = uuidv4();
-                // 订阅行情
-                // const list: subscribeInfoType[] = res.map((el) => {
-                //     return { exchangeCode: 250, goodsCode: el.goodscode, subState: 0 };
-                // });
-                // addSubscribeQuotation(uuid, list);
-            });
+            queryTable(queryOrderQuote, param);
         };
-        // onMounted(() => {});
         // 表格通用逻辑
         const param: ComposeTableParam = {
             queryFn: queryTableAction,

+ 2 - 0
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_price/index.vue

@@ -28,6 +28,7 @@ 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 Bus from '@/utils/eventBus/index';
 
 export default defineComponent({
     name: EnumRouterName.warehouse_receipt_trade_price,
@@ -48,6 +49,7 @@ export default defineComponent({
             };
             queryTable(queryOrderQuote, param);
         };
+        Bus.$on('spotTrade', queryTableAction);
         // 表格通用逻辑
         const param: ComposeTableParam = {
             queryFn: queryTableAction,

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

@@ -43,8 +43,8 @@
               <a-form-item label="升贴水"
                            name="PriceMove">
                 <a-input-number class="commonInput"
-                         v-model:value="formState.PriceMove"
-                         style="width: 140px" />
+                                v-model:value="formState.PriceMove"
+                                style="width: 140px" />
               </a-form-item>
             </a-col>
           </a-row>
@@ -154,6 +154,7 @@ import { getGoodsGroupsByTradeMode } from '@/services/bus/goods';
 import { TradeMode } from '@/common/constants/enumCommon';
 import { WRGoodsInfo } from '@/services/proto/warehousetrade/interface';
 import { BuyOrSell } from '@/common/constants/enumCommon';
+import Bus from '@/utils/eventBus/index';
 
 export default defineComponent({
     name: ModalEnum.spot_warrant_spot_details_listed,
@@ -226,10 +227,11 @@ export default defineComponent({
                         wrstandardid: props.selectedRow.wrstandardid,
                         HasWr: 1,
                     };
-                    debugger
+                    debugger;
                     console.log(param);
                     requestResultLoadingAndInfo(hdWROrder, param, loading, ['挂牌成功', '挂牌失败:']).then(() => {
-                        cancel();
+                        Bus.$emit('spotTrade', true);
+                        cancel(true);
                     });
                 });
             } else {