huangbin %!s(int64=4) %!d(string=hai) anos
pai
achega
f4e0ba4542

+ 17 - 67
src/views/market/spot_trade/setup.ts

@@ -1,15 +1,10 @@
 import { BtnList } from '@/common/components/btnList/interface';
 import { ContextMenuTemp } from "@/common/components/contextMenu/interface";
 import { handleContextMenu } from "@/common/components/contextMenu/setup";
-import { TabList } from '@/common/components/description/interface';
 import { getTableColumns, getTableEvent, initData } from "@/common/export/table";
-import { handleModalComponent } from '@/common/setup/asyncComponent';
-import { getBtnList_, getThirdMenuData } from "@/common/setup/table/button";
-import { handleTableDrawer } from "@/common/setup/table/drawer";
-import { ComposeTableDetailParam, ComposeTableParam, TableEventCB } from "@/common/setup/table/interface";
-import { onUnmounted, ref, Ref } from "vue";
-
-export type { ComposeTableParam, ComposeTableDetailParam };
+import { getBtnList_ } from "@/common/setup/table/button";
+import { ComposeTableParam, TableEventCB } from "@/common/setup/table/interface";
+import { onUnmounted, ref } from "vue";
 
 // 表格 + 表头 + 右键 + 单击表格 + 按钮列表 通用处理逻辑
 export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName, tableFilterKey }: ComposeTableParam) {
@@ -17,23 +12,33 @@ export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName,
     const { contextMenu, openContext, closeContext: closeContextAction } = handleContextMenu();
     // 表头数据
     const { columns, registerColumn, updateColumn } = getTableColumns();
+    // 控制异步组件
+    const componentId = ref<string>('');
+    // 关闭组件
+    function closeComponent(isRefresh: boolean) {
+        componentId.value = '';
+        if (isRefresh) {
+            queryFn()
+        }
+    }
     // 右键回调函数
     const eventsCB: TableEventCB = {
         contextmenuCB: (record: T, value: ContextMenuTemp) => {
             // 控制打开右键
             contextMenu.value = value
+        },
+        clickCB: (record: T) => {
+            componentId.value = 'warehouse_receipt_trade_floating_price_delisting'
         }
     }
     // 表格事件
     const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(eventsCB);
     // 表格操作按钮列表
     const [firstBtn, secondBtn] = getBtnList_(menuType, isDetail).value;
-    // 控制异步组件
-    const { componentId, closeComponent, openComponent } = handleModalComponent(queryFn, selectedRow);
     // 关闭右键
     function closeContext(value: BtnList | null) {
         // 打开对应的弹窗组件
-        if (value) openComponent(value, selectedRow.value)
+        if (value) componentId.value = value.code;
         // 关闭右键
         closeContextAction()
     }
@@ -50,62 +55,7 @@ export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName,
         contextMenu, openContext, closeContext, // 右键
         columns, registerColumn, updateColumn,  // 表头
         expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
-        componentId, closeComponent, openComponent,  // 控制异步组件
+        componentId, closeComponent,  // 控制异步组件
         firstBtn, secondBtn, // 表格按钮
     }
 }
-
-
-// 表格 + 表头 + 表格明细 + 单击表格  通用处理逻辑
-export function handleComposeTable_detail<T>({ queryFn, tableName, tableFilterKey, menuType }: ComposeTableDetailParam) {
-    // 控制 drawer 组件是否显示
-    const { visible, openDrawer, closeDrawer } = handleTableDrawer()
-    // 表头数据
-    const { columns, registerColumn, updateColumn } = getTableColumns();
-    // 明细列表数据
-    const detailTableList = ref<any[]>([])
-    // 明细表头数据
-    const { columns: columnsDetail, registerColumn: registerColumnDetail, updateColumn: updateColumnDetail } = getTableColumns();
-    // 缓存点击选中的数据
-    let cacheSelectedRow: null | Ref<T> = null
-    // 单击回调
-    const events: TableEventCB = {
-        clickCB: (value: T) => {
-            if (cacheSelectedRow) {
-                // 点击同一个
-                if (JSON.stringify(cacheSelectedRow.value) === JSON.stringify(value)) {
-                    visible.value ? closeDrawer() : openDrawer()
-                } else {
-                    openDrawer()
-                }
-            } else {
-                openDrawer()
-            }
-        },
-    };
-    // 表格事件
-    const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(events);
-    cacheSelectedRow = selectedRow as Ref<T>
-    // 明细tab 列表
-    const data = getThirdMenuData()
-    const list = data.find((e) => e.code === menuType);
-    const tabList = ref<TabList[]>([])
-    list?.children.forEach(el => {
-        const { code, title, type } = el
-        if (type === 3) {
-            tabList.value.push({ lable: title, code })
-        }
-    })
-
-    initData(() => {
-        queryFn();
-        registerColumn(tableName, tableFilterKey);
-    });
-    return {
-        visible, openDrawer, closeDrawer,   // 控制 drawer 组件是否显示
-        columns, registerColumn, updateColumn,  //  表头数据
-        columnsDetail, registerColumnDetail, updateColumnDetail, detailTableList,// 明细表头数据
-        expandedRowKeys, selectedRow, Rowclick, // 表格事件
-        tabList,
-    }
-}

+ 22 - 23
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_floating_price/index.vue

@@ -1,34 +1,33 @@
 <template>
-    <!-- 仓单贸易 浮动价挂牌-->
-    <div class="warehouse_receipt_trade_floating_price topTableHeight">
-        <a-table
-            :columns="columns"
-            class="srcollYTable"
-            :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="key"
-            :data-source="tableList"
-        ></a-table>
-        <!-- 右键 -->
-        <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="firstBtn"></contextMenu>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
-    </div>
+  <!-- 仓单贸易 浮动价挂牌-->
+  <div class="warehouse_receipt_trade_floating_price topTableHeight">
+    <a-table :columns="columns"
+             class="srcollYTable"
+             :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList"></a-table>
+    <!-- 右键 -->
+    <contextMenu :contextMenu="contextMenu"
+                 @cancel="closeContext"
+                 :list="firstBtn"></contextMenu>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </div>
 </template>
 
 <script lang="ts">
 import { EnumRouterName } from '@/common/constants/enumRouterName';
-import { queryTableList, BtnList, contextMenu, defineAsyncComponent, defineComponent, ModalEnum, handleComposeTable, ComposeTableParam } from '@/common/export/commonTable';
+import { queryTableList, BtnList, contextMenu, defineAsyncComponent, defineComponent, ModalEnum, ComposeTableParam } from '@/common/export/commonTable';
 import { queryAgreementConfig } from '@/services/go/ermcp/qhj';
 import { QueryOrderQuoteReq, WrOrderQuote } from '@/services/go/wrtrade/interface';
 import { queryOrderQuote } from '@/services/go/wrtrade';
+import { handleComposeTable } from '@/views/market/spot_trade/setup';
 
 export default defineComponent({
     name: EnumRouterName.warehouse_receipt_trade_floating_price,