Explorar o código

修改 融资摘牌 按钮是否显示条件

huangbin %!s(int64=3) %!d(string=hai) anos
pai
achega
84959d7c69

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

@@ -10,7 +10,7 @@
         :customRow="Rowclick"
         :expandIcon="expandIcon"
         :expandIconAsCell="false"
-        rowKey="key"
+        :rowKey="(record, index) => index"
         :data-source="tableList"
     >
         <!-- ,  -->

+ 13 - 8
src/views/market/market-spot/components/buy-sell-market/components/sell/index.vue

@@ -10,7 +10,7 @@
         :customRow="Rowclick"
         :expandIcon="expandIcon"
         :expandIconAsCell="false"
-        rowKey="key"
+        :rowKey="(record, index) => index"
         :data-source="tableList"
     >
         <!-- 额外的展开行 -->
@@ -38,15 +38,17 @@ import { ComposeTableParam, BtnList, defineComponent, handleComposeTable, queryT
 import { _closeModal } from '@/common/setup/modal/modal';
 import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
 import { QueryOrderQuoteDetailReq, WrOrderQuote, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
-import { defineAsyncComponent, PropType } from 'vue';
+import { defineAsyncComponent, PropType, ref } from 'vue';
 import { BtnListType } from '@/common/components/btnList/interface';
-import { getSellMarketParam } from '../../setup';
+import { getSellMarketParam, setFinacingList } from '../../setup';
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { expandIcon } from '@/common/setup/table/clolumn';
 import { ColumnType } from '@/common/methods/table/interface';
 import { Moment } from 'moment';
 import moment from 'moment';
 import { getShowBottomValue } from '@/common/config/constrolBottom';
+import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { queryFaProductDetail } from '@/services/go/wrtrade';
 
 export default defineComponent({
     emits: ['cancel', 'openComponent'],
@@ -79,11 +81,14 @@ export default defineComponent({
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuoteDetail>();
 
-        // 后期区分 不同市场 添加判断 是否有融资摘牌
-        const buttonList: BtnListType[] = [
-            { lable: '摘牌', code: 'delisting', className: 'operBtn' },
-            { lable: '融资摘牌', code: 'financing_delisting', className: 'operBtn' },
-        ]
+        const buttonList = ref<BtnListType[]>([{ lable: '摘牌', code: 'delisting', className: 'operBtn' }])
+        // 融资摘牌
+        queryResultLoadingAndInfo(queryFaProductDetail, loading, { wrfactortypeid: props.parantSelectedRow.wrfactortypeid }).then((res) => {
+            if (res.length) {
+                setFinacingList(res)
+                buttonList.value.push({ lable: '融资摘牌', code: 'financing_delisting', className: 'operBtn' })
+            }
+        });
 
         const { wrpricetype, haswr, tableKey } = getSellMarketParam(props.enumName);
         // 获取列表数据

+ 2 - 11
src/views/market/market-spot/components/buy-sell-market/index.vue

@@ -104,13 +104,12 @@ import { defineAsyncComponent, defineComponent, BtnList, ModalEnum } from '@/com
 import { _closeModal } from '@/common/setup/modal/modal';
 import { WrOrderQuote } from '@/services/go/wrtrade/interface';
 import { LeftOutlined } from '@ant-design/icons-vue';
-import { handleFinacing, handleIs, setGoodsPrice } from './setup';
+import { setGoodsPrice } from './setup';
 import Buy from './components/buy/index.vue';
 import Sell from './components/sell/index.vue';
 import { LineChartOutlined, DownOutlined } from '@ant-design/icons-vue';
 import { handleModalComponent } from '@/common/setup/asyncComponent';
 import { onBeforeUnmount, onMounted, PropType, ref } from 'vue';
-// import { handleSpotBtnList } from '../../setup';
 import { v4 } from 'uuid';
 import { addSubscribeQuotation, removeSubscribeQuotation } from '@/services/socket/quota';
 import Bus from '@/utils/eventBus/index';
@@ -185,15 +184,7 @@ export default defineComponent({
       sellRef.value?.queryTableAction();
     };
     const { componentId, closeComponent, openComponent } = handleModalComponent(queryFn, ref({}));
-    const { hasFinacing } = handleFinacing(loading, props.selectedRow.wrfactortypeid);
-    function handleBtnList(list: BtnListType[]) {
-      console.log('list', list);
-      if (!hasFinacing()) {
-        return list.filter((e) => e.code !== 'warehouse_receipt_trade_floating_price_spot_trade_warehouse_financing_delisting');
-      } else {
-        return list;
-      }
-    }
+
     function timeChange() {
       TimerUtils.setTimeout(
         () => {

+ 4 - 13
src/views/market/market-spot/components/buy-sell-market/setup.ts

@@ -1,9 +1,7 @@
 import { AuctionwrType, BuyOrSell, ListingMode } from '@/common/constants/enumCommon';
 import { EnumRouterName } from '@/common/constants/enumRouterName';
-import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { TableKey } from '@/common/methods/table/interface';
 import { getTableColumns, getTableEvent, queryTableList } from "@/common/setup/table";
-import { queryFaProductDetail } from '@/services/go/wrtrade';
 import { WrFAProductDetail } from "@/services/go/wrtrade/interface";
 import { Ref, ref } from 'vue';
 import { marketTradeType } from '../../setup';
@@ -106,19 +104,12 @@ export function handleIs(enumName: EnumRouterName, buyOrSell: BuyOrSell) {
     return { isWR, isBuy, isFloat }
 }
 
+// 融资摘牌
 const list = ref<WrFAProductDetail[]>([]);
-// 获取融资摘牌
-export function handleFinacing(loading: Ref<boolean>, id: number) {
-    queryResultLoadingAndInfo(queryFaProductDetail, loading, { wrfactortypeid: id }).then((res) => {
-        list.value = res;
-        return res
-    });
-    function hasFinacing(): boolean {
-        return list.value.length > 0
-    }
-    return { hasFinacing }
-}
 
+export function setFinacingList(value: WrFAProductDetail[]) {
+    list.value = value
+}
 export function getFinacingList(): WrFAProductDetail[] {
     return list.value
 }